From 964be7e8d9f98f3ad6df915a712848abe94bcf93 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Feb 2011 01:45:35 +0000 Subject: m9s12x context save structure git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3298 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 + nuttx/Documentation/NuttX.html | 4 +- nuttx/arch/hc/include/hcs12/irq.h | 77 ++++++++++++++++++++++- nuttx/arch/hc/src/m9s12/m9s12_vectors.S | 95 ++++++++++++++++++++++++++++- nuttx/configs/demo9s12ne64/ostest/Make.defs | 6 +- 5 files changed, 178 insertions(+), 7 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 28cdd05cb..cf5527d58 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1459,4 +1459,7 @@ shorter and more general. * The NuttX repository has been converted to SVN and can now be found here http://nuttx.svn.sourceforge.net/viewvc/nuttx/ + * configs/mbed/hidkbd -- Added USB host support for the mbed LPC1768 board; add + a USB host HID keyboard configuraion. + diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 8beac494c..2e02a0f61 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: February 14, 2011

+

Last Updated: February 15, 2011

@@ -2036,6 +2036,8 @@ nuttx-5.18 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> shorter and more general. * The NuttX repository has been converted to SVN and can now be found here http://nuttx.svn.sourceforge.net/viewvc/nuttx/ + * configs/mbed/hidkbd -- Added USB host support for the mbed LPC1768 board; add + a USB host HID keyboard configuraion. pascal-2.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/arch/hc/include/hcs12/irq.h b/nuttx/arch/hc/include/hcs12/irq.h index b6adf7322..3149c543a 100755 --- a/nuttx/arch/hc/include/hcs12/irq.h +++ b/nuttx/arch/hc/include/hcs12/irq.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/hc/include/hcs12/irq.h * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -50,6 +50,79 @@ /************************************************************************************ * Definitions ************************************************************************************/ +/************************************************************************************ + * Register state save strucure + * Low Address <-- SP after state save + * [PPAGE] + * [soft regisers] + * XYH + * XYL + * ZH + * ZL + * TMPH + * TMPL + * FRAMEH + * FRAMEL <-- SP after interrupt + * CCR + * B + * A + * XH + * XL + * YH + * YL + * PCH + * High Address PCL <-- SP before interrupt + * + ************************************************************************************/ + +/* Byte offsets */ + +#ifndef CONFIG_HCS12_NONBANKED +# define REG_PPAGE 0 +# define REG_FIRST_SOFTREG 1 +#else +# define REG_FIRST_SOFTREG 0 +#endif + +#if CONFIG_HCS12_MSOFTREGS > 2 +# error "Need to save more registers" +#elif CONFIG_HCS12_MSOFTREGS == 2 +# define REG_SOFTREG1 REG_FIRST_SOFTREG +# define REG_SOFTREG2 (REG_FIRST_SOFTREG+2) +# define REG_FIRST_HARDREG (REG_FIRST_SOFTREG+4) +#elif CONFIG_HCS12_MSOFTREGS == 1 +# define REG_SOFTREG1 REG_FIRST_SOFTREG +# define REG_FIRST_HARDREG (REG_FIRST_SOFTREG+2) +#else +# define REG_FIRST_HARDREG REG_FIRST_SOFTREG +#endif + +#define REG_XY REG_FIRST_HARDREG +#define REG_Z (REG_FIRST_HARDREG+2) +# define REG_ZH (REG_FIRST_HARDREG+2) +# define REG_ZL (REG_FIRST_HARDREG+3) +#define REG_TMP (REG_FIRST_HARDREG+4) +# define REG_TMPH (REG_FIRST_HARDREG+4) +# define REG_TMPL (REG_FIRST_HARDREG+5) +#define REG_FRAME (REG_FIRST_HARDREG+6) +# define REG_FRAMEH (REG_FIRST_HARDREG+6) +# define REG_FRAMEL (REG_FIRST_HARDREG+7) + +#define REG_CCR (REG_FIRST_HARDREG+8) +#define REG_BA (REG_FIRST_HARDREG+9) +# define REG_B (REG_FIRST_HARDREG+9) +# define REG_A (REG_FIRST_HARDREG+10) +#define REG_X (REG_FIRST_HARDREG+11) +# define REG_XH (REG_FIRST_HARDREG+11) +# define REG_XL (REG_FIRST_HARDREG+12) +#define REG_Y (REG_FIRST_HARDREG+13) +# define REG_YH (REG_FIRST_HARDREG+13) +# define REG_YL (REG_FIRST_HARDREG+14) +#define REG_PC (REG_FIRST_HARDREG+15) +# define REG_PCH (REG_FIRST_HARDREG+15) +# define REG_PCL (REG_FIRST_HARDREG+16) + +#define XCPTCONTEXT_REGS (REG_FIRST_HARDREG+17) /************************************************************************************ * Public Types @@ -60,7 +133,7 @@ #ifndef __ASSEMBLY__ struct xcptcontext { - int dummy; /* For now */ + uint8_t regs[XCPTCONTEXT_REGS]; }; /**************************************************************************** diff --git a/nuttx/arch/hc/src/m9s12/m9s12_vectors.S b/nuttx/arch/hc/src/m9s12/m9s12_vectors.S index 147f92926..f332c49a1 100755 --- a/nuttx/arch/hc/src/m9s12/m9s12_vectors.S +++ b/nuttx/arch/hc/src/m9s12/m9s12_vectors.S @@ -2,7 +2,7 @@ * arch/hc/src/m9s12/m9s12_vectors.S * arch/hc/src/chip/m9s12_vectors.S * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -56,8 +56,24 @@ * Macros ************************************************************************************/ +/* On entry into an I- or X-interrupt, into an SWI, or into an undefined instruction + * interrupt, the stack frame created by hardware looks like: + * + * Low Address <-- SP after interrupt + * CCR + * B + * A + * XH + * XL + * YH + * YL + * PCH + * High Address PCL <-- SP before interrupt + */ + .macro HANDLER, label, irqno \label: +#warning "Missing Logic" .endm /************************************************************************************ @@ -189,11 +205,83 @@ handlers: * Common IRQ handling logic * * Description: - * To be provided + * On entry into an I- or X-interrupt, into an SWI, or into an undefined + * instruction interrupt, the stack frame created by hardware looks like: + * + * Low Address <-- SP after state save + * [PPAGE] + * [soft regisers] + * XYH + * XYL + * ZH + * ZL + * TMPH + * TMPL + * FRAMEH + * FRAMEL <-- SP after interrupt + * CCR + * B + * A + * XH + * XL + * YH + * YL + * PCH + * High Address PCL <-- SP before interrupt * ************************************************************************************/ vcommon: + /* Save the rest of the frame */ + + movw _.frame, 2, -sp + movw _.tmp, 2, -sp + movw _.z, 2, -sp + movw _.xy, 2, -sp + + /* Save the soft registers */ + +#if CONFIG_HCS12_MSOFTREGS > 2 +# error "Need to save more registers" +#endif +#if CONFIG_HCS12_MSOFTREGS > 1 + movw _.d2, 2, -sp +#endif +#if CONFIG_HCS12_MSOFTREGS > 0 + movw _.d1, 2, -sp +#endif + + /* Save the PPAGE register */ + +#ifndef CONFIG_HCS12_NONBANKED + movb HCS12_MMC_PPAGE, 1, -sp +#endif + + /* Handle the IRQ */ +#warning "Missing Logic" + + /* Restore registers and return */ + + /* Restore the PPAGE register */ + +#ifndef CONFIG_HCS12_NONBANKED + movb 1, sp+, HCS12_MMC_PPAGE +#endif + + /* Restore the soft registers */ + +#if CONFIG_HCS12_MSOFTREGS > 0 + movw 2, sp+, _.d1 +#endif +#if CONFIG_HCS12_MSOFTREGS > 1 + movw 2, sp+, _.d2 +#endif + + movw 2, sp+, _.xy + movw 2, sp+, _.z + movw 2, sp+, _.tmp + movw 2, sp+, _.frame + rti .size handlers, .-handlers /************************************************************************************ @@ -203,7 +291,8 @@ vcommon: * Name: up_interruptstack/g_userstack * * Description: - * Shouldn't happen + * If CONFIG_ARCH_INTERRUPTSTACK is defined, this sets aside memory for the + * interrupt stack. * ************************************************************************************/ diff --git a/nuttx/configs/demo9s12ne64/ostest/Make.defs b/nuttx/configs/demo9s12ne64/ostest/Make.defs index cdbfda2b3..9135f1e3f 100755 --- a/nuttx/configs/demo9s12ne64/ostest/Make.defs +++ b/nuttx/configs/demo9s12ne64/ostest/Make.defs @@ -46,10 +46,14 @@ ifeq ($(CONFIG_HCS12_NONBANKED),y) ARCHCPUFLAGS = -m9s12x -mshort -mnolong-calls LDSCRIPT = ld.script.nonbanked else - ARCHCPUFLAGS = -m9x12x -mshort -mlong-calls + ARCHCPUFLAGS = -m9s12x -mshort -mlong-calls LDSCRIPT = ld.script.banked endif +ifneq ($(CONFIG_HCS12_MSOFTREGS),0) + ARCHCPUFLAGS += -msoft-reg-count=$(CONFIG_HCS12_MSOFTREGS) +endif + ifeq ($(WINTOOL),y) # Windows-native toolchains DIRLINK = $(TOPDIR)/tools/winlink.sh -- cgit v1.2.3