diff options
author | Abdoulaye Walsimou Gaye <walsimou@walsimou.com> | 2009-04-09 16:05:32 +0200 |
---|---|---|
committer | Abdoulaye Walsimou Gaye <walsimou@walsimou.com> | 2009-04-09 16:05:32 +0200 |
commit | 8ab4d5eb446cdd5b31b2c1f52f4344b0b147a5df (patch) | |
tree | 2d06fd2d00d7fe1da476cd98a3c75abc4d1cb7d3 | |
parent | fe28be29db4c4f9ea259538fc456c1e76ea6a1a2 (diff) | |
download | freertos-8ab4d5eb446cdd5b31b2c1f52f4344b0b147a5df.tar.gz freertos-8ab4d5eb446cdd5b31b2c1f52f4344b0b147a5df.tar.bz2 freertos-8ab4d5eb446cdd5b31b2c1f52f4344b0b147a5df.tar.xz |
PIC18_SDCC: save and restore context in a same manner as SDCC
This patch modifies the way that context are saved and restored in order to do
it in a same manner that SDCC do it when it generates codes.
signed-off-by: Gaye Abdoulaye Walsimou <walsimou@walsimou.com>
-rw-r--r-- | Source/portable/SDCC/PIC18/portmacro.h | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Source/portable/SDCC/PIC18/portmacro.h b/Source/portable/SDCC/PIC18/portmacro.h index f6caaf33..132cf6d0 100644 --- a/Source/portable/SDCC/PIC18/portmacro.h +++ b/Source/portable/SDCC/PIC18/portmacro.h @@ -57,12 +57,12 @@ constant defines the size of memory area which must be saved. */ #define portCOMPILER_MANAGED_MEMORY_SIZE ((unsigned portCHAR)20) -#if( configUSE_16_BIT_TICKS == 1 ) +#if(configUSE_16_BIT_TICKS==1) typedef unsigned portSHORT portTickType; - #define portMAX_DELAY ( portTickType ) 0xffff + #define portMAX_DELAY (portTickType)0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY (portTickType)0xffffffff #endif /*-----------------------------------------------------------*/ @@ -152,18 +152,18 @@ _endasm #define portSAVE_CONTEXT_HW_REGISTERS() _asm ;Store the necessary hardware registers to the stack. MOVFF BSR,POSTDEC1 - MOVFF FSR2L,POSTDEC1 - MOVFF FSR2H,POSTDEC1 + MOVFF PRODL,POSTDEC1 + MOVFF PRODH,POSTDEC1 MOVFF FSR0L,POSTDEC1 MOVFF FSR0H,POSTDEC1 + MOVFF PCLATH,POSTDEC1 + MOVFF PCLATU,POSTDEC1 + MOVFF FSR2H,POSTDEC1 + MOVFF FSR2L,POSTDEC1 MOVFF TABLAT,POSTDEC1 MOVFF TBLPTRL,POSTDEC1 MOVFF TBLPTRH,POSTDEC1 MOVFF TBLPTRU,POSTDEC1 - MOVFF PRODL,POSTDEC1 - MOVFF PRODH,POSTDEC1 - MOVFF PCLATH,POSTDEC1 - MOVFF PCLATU,POSTDEC1 _endasm #pragma preproc_asm + @@ -177,8 +177,8 @@ _endasm #pragma preproc_asm - #define portSAVE_CONTEXT_DOT_REGISTERS_END() _asm - ;End store .registers areas as described above. MOVFF INDF0,POSTDEC1 + ;Store the end address of.registers section. MOVFF FSR0L,POSTDEC1 MOVFF FSR0H,POSTDEC1 ;Store the hardware stack pointer in a temp register (FSR0L) before we @@ -199,7 +199,7 @@ _endasm #pragma preproc_asm - #define portSAVE_CONTEXT_END() _asm ;Store the number of addresses on the hardware stack (from the - ;temporary register). + ;temporary register FSR0L). MOVFF FSR0L,POSTDEC1 ;Save the new top of the software stack in the TCB. MOVFF _pxCurrentTCB,FSR0L @@ -281,7 +281,7 @@ _endasm ;Start to restore the .registers section. MOVFF PREINC1,FSR0H MOVFF PREINC1,FSR0L - ;Use WREG as temp register + ;Use FSR2L as temp register CLRF FSR2L,ACCESS _endasm #pragma preproc_asm + @@ -296,19 +296,19 @@ _endasm #pragma preproc_asm - #define portRESTORE_CONTEXT_HW_REGISTERS() _asm ;Restore the other registers forming the tasks context. - MOVFF PREINC1, PCLATU - MOVFF PREINC1, PCLATH - MOVFF PREINC1, PRODH - MOVFF PREINC1, PRODL - MOVFF PREINC1, TBLPTRU - MOVFF PREINC1, TBLPTRH - MOVFF PREINC1, TBLPTRL - MOVFF PREINC1, TABLAT - MOVFF PREINC1, FSR0H - MOVFF PREINC1, FSR0L - MOVFF PREINC1, FSR2H - MOVFF PREINC1, FSR2L - MOVFF PREINC1, BSR + MOVFF PREINC1,TBLPTRU + MOVFF PREINC1,TBLPTRH + MOVFF PREINC1,TBLPTRL + MOVFF PREINC1,TABLAT + MOVFF PREINC1,FSR2L + MOVFF PREINC1,FSR2H + MOVFF PREINC1,PCLATU + MOVFF PREINC1,PCLATH + MOVFF PREINC1,FSR0H + MOVFF PREINC1,FSR0L + MOVFF PREINC1,PRODH + MOVFF PREINC1,PRODL + MOVFF PREINC1,BSR ;The next byte is the INTCON register. Read this into WREG as some ;manipulation is required. MOVFF PREINC1, WREG |