mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-01 11:53:53 -04:00
Style: uncrustify kernel files
This commit is contained in:
parent
66a815653b
commit
587a83d647
385 changed files with 4714 additions and 4338 deletions
|
@ -22,6 +22,7 @@
|
|||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -89,28 +90,28 @@ void portSetupTick( void )
|
|||
/*
|
||||
* Set the compare match value.
|
||||
*/
|
||||
CCPR1H = ( uint8_t ) ( ( portTIMER_COMPARE_VALUE >> 8 ) & 0xff );
|
||||
CCPR1L = ( uint8_t ) ( portTIMER_COMPARE_VALUE & 0xff );
|
||||
CCPR1H = ( uint8_t ) ( ( portTIMER_COMPARE_VALUE >> 8 ) & 0xff );
|
||||
CCPR1L = ( uint8_t ) ( portTIMER_COMPARE_VALUE & 0xff );
|
||||
|
||||
/*
|
||||
* Set Compare Special Event Trigger Mode
|
||||
*/
|
||||
bCCP1M3 = portBIT_SET;
|
||||
bCCP1M2 = portBIT_CLEAR;
|
||||
bCCP1M1 = portBIT_SET;
|
||||
bCCP1M0 = portBIT_SET;
|
||||
bCCP1M3 = portBIT_SET;
|
||||
bCCP1M2 = portBIT_CLEAR;
|
||||
bCCP1M1 = portBIT_SET;
|
||||
bCCP1M0 = portBIT_SET;
|
||||
|
||||
/*
|
||||
* Enable CCP1 interrupt
|
||||
*/
|
||||
bCCP1IE = portBIT_SET;
|
||||
bCCP1IE = portBIT_SET;
|
||||
|
||||
/*
|
||||
* We are only going to use the global interrupt bit, so disable
|
||||
* interruptpriorities and enable peripheral interrupts.
|
||||
*/
|
||||
bIPEN = portBIT_CLEAR;
|
||||
bPEIE = portBIT_SET;
|
||||
bIPEN = portBIT_CLEAR;
|
||||
bPEIE = portBIT_SET;
|
||||
|
||||
/*
|
||||
* Set up timer1
|
||||
|
@ -120,18 +121,18 @@ void portSetupTick( void )
|
|||
/*
|
||||
* Clear the time count
|
||||
*/
|
||||
TMR1H = ( uint8_t ) 0x00;
|
||||
TMR1L = ( uint8_t ) 0x00;
|
||||
TMR1H = ( uint8_t ) 0x00;
|
||||
TMR1L = ( uint8_t ) 0x00;
|
||||
|
||||
/*
|
||||
* Setup the timer
|
||||
*/
|
||||
bRD16 = portBIT_SET; /* 16-bit */
|
||||
bRD16 = portBIT_SET; /* 16-bit */
|
||||
bT1CKPS1 = portTIMER_COMPARE_PS1; /* prescaler */
|
||||
bT1CKPS0 = portTIMER_COMPARE_PS0; /* prescaler */
|
||||
bT1OSCEN = portBIT_SET; /* Oscillator enable */
|
||||
bT1SYNC = portBIT_SET; /* No external clock sync */
|
||||
bTMR1CS = portBIT_CLEAR; /* Internal clock */
|
||||
bT1SYNC = portBIT_SET; /* No external clock sync */
|
||||
bTMR1CS = portBIT_CLEAR; /* Internal clock */
|
||||
|
||||
bTMR1ON = portBIT_SET; /* Start timer1 */
|
||||
bTMR1ON = portBIT_SET; /* Start timer1 */
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -86,7 +87,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
|||
#define portSTACK_MINIMAL_CALLRETURN_DEPTH ( 10 )
|
||||
#define portSTACK_OTHER_BYTES ( 20 )
|
||||
|
||||
uint16_t usCalcMinStackSize = 0;
|
||||
uint16_t usCalcMinStackSize = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -118,7 +119,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE
|
||||
movwf PRODL, ACCESS;
|
||||
PRODL is used as temp register _Pragma( "asmend" )
|
||||
ucScratch = PRODL;
|
||||
ucScratch = PRODL;
|
||||
|
||||
/*
|
||||
* Place a few bytes of known values on the bottom of the stack.
|
||||
|
@ -137,31 +138,31 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
* First store the function parameters. This is where the task expects
|
||||
* to find them when it starts running.
|
||||
*/
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pvParameters >> 8 ) & 0x00ff );
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pvParameters & 0x00ff );
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pvParameters >> 8 ) & 0x00ff );
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pvParameters & 0x00ff );
|
||||
|
||||
/*
|
||||
* Next are all the registers that form part of the task context.
|
||||
*/
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x11; /* STATUS. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x22; /* WREG. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x33; /* BSR. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x44; /* PRODH. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x55; /* PRODL. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x66; /* FSR0H. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x77; /* FSR0L. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x88; /* FSR1H. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x99; /* FSR1L. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xAA; /* TABLAT. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x11; /* STATUS. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x22; /* WREG. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x33; /* BSR. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x44; /* PRODH. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x55; /* PRODL. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x66; /* FSR0H. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x77; /* FSR0L. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x88; /* FSR1H. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x99; /* FSR1L. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xAA; /* TABLAT. */
|
||||
#if _ROMSIZE > 0x8000
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x00; /* TBLPTRU. */
|
||||
#endif
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xCC; /* TBLPTRH. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xDD; /* TBLPTRL. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xCC; /* TBLPTRH. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xDD; /* TBLPTRL. */
|
||||
#if _ROMSIZE > 0x8000
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xEE; /* PCLATU. */
|
||||
#endif
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xFF; /* PCLATH. */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xFF; /* PCLATH. */
|
||||
|
||||
/*
|
||||
* Next the compiler's scratchspace.
|
||||
|
@ -180,14 +181,14 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
#if _ROMSIZE > 0x8000
|
||||
*pxTopOfStack-- = ( StackType_t ) 0;
|
||||
#endif
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pxCode >> 8 ) & 0x00ff );
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pxCode & 0x00ff );
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pxCode >> 8 ) & 0x00ff );
|
||||
*pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pxCode & 0x00ff );
|
||||
|
||||
/*
|
||||
* Store the number of return addresses on the hardware stack.
|
||||
* So far only the address of the task entry point.
|
||||
*/
|
||||
*pxTopOfStack-- = ( StackType_t ) 1;
|
||||
*pxTopOfStack-- = ( StackType_t ) 1;
|
||||
|
||||
/*
|
||||
* The code generated by wizC does not maintain separate
|
||||
|
@ -196,7 +197,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
* track of the critical section nesting. This variable has to be stored
|
||||
* as part of the task context and is initially set to zero.
|
||||
*/
|
||||
*pxTopOfStack-- = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
*pxTopOfStack-- = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -199,86 +200,86 @@
|
|||
* assembler definitions.
|
||||
*/
|
||||
|
||||
#define portSAVE_CONTEXT( ucInterruptForced ) \
|
||||
do \
|
||||
{ \
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
_Pragma( "asm" ) \
|
||||
; \
|
||||
; Push the relevant SFR 's onto the task's stack \
|
||||
; \
|
||||
movff STATUS, POSTDEC2 \
|
||||
movff WREG, POSTDEC2 \
|
||||
movff BSR, POSTDEC2 \
|
||||
movff PRODH, POSTDEC2 \
|
||||
movff PRODL, POSTDEC2 \
|
||||
movff FSR0H, POSTDEC2 \
|
||||
movff FSR0L, POSTDEC2 \
|
||||
movff FSR1H, POSTDEC2 \
|
||||
movff FSR1L, POSTDEC2 \
|
||||
movff TABLAT, POSTDEC2 \
|
||||
if __ROMSIZE > 0x8000 \
|
||||
movff TBLPTRU, POSTDEC2 \
|
||||
endif \
|
||||
movff TBLPTRH, POSTDEC2 \
|
||||
movff TBLPTRL, POSTDEC2 \
|
||||
if __ROMSIZE > 0x8000 \
|
||||
movff PCLATU, POSTDEC2 \
|
||||
endif \
|
||||
movff PCLATH, POSTDEC2 \
|
||||
; \
|
||||
; Store the compiler - scratch - area as described above. \
|
||||
; \
|
||||
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE \
|
||||
clrf FSR0L, ACCESS \
|
||||
clrf FSR0H, ACCESS \
|
||||
_rtos_S1: \
|
||||
movff POSTINC0, POSTDEC2 \
|
||||
decfsz WREG, W, ACCESS \
|
||||
SMARTJUMP _rtos_S1 \
|
||||
; \
|
||||
; Save the pic call / return -stack belonging to the \
|
||||
#define portSAVE_CONTEXT( ucInterruptForced ) \
|
||||
do \
|
||||
{ \
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
_Pragma( "asm" ) \
|
||||
; \
|
||||
; Push the relevant SFR 's onto the task's stack \
|
||||
; \
|
||||
movff STATUS, POSTDEC2 \
|
||||
movff WREG, POSTDEC2 \
|
||||
movff BSR, POSTDEC2 \
|
||||
movff PRODH, POSTDEC2 \
|
||||
movff PRODL, POSTDEC2 \
|
||||
movff FSR0H, POSTDEC2 \
|
||||
movff FSR0L, POSTDEC2 \
|
||||
movff FSR1H, POSTDEC2 \
|
||||
movff FSR1L, POSTDEC2 \
|
||||
movff TABLAT, POSTDEC2 \
|
||||
if __ROMSIZE > 0x8000 \
|
||||
movff TBLPTRU, POSTDEC2 \
|
||||
endif \
|
||||
movff TBLPTRH, POSTDEC2 \
|
||||
movff TBLPTRL, POSTDEC2 \
|
||||
if __ROMSIZE > 0x8000 \
|
||||
movff PCLATU, POSTDEC2 \
|
||||
endif \
|
||||
movff PCLATH, POSTDEC2 \
|
||||
; \
|
||||
; Store the compiler - scratch - area as described above. \
|
||||
; \
|
||||
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE \
|
||||
clrf FSR0L, ACCESS \
|
||||
clrf FSR0H, ACCESS \
|
||||
_rtos_S1: \
|
||||
movff POSTINC0, POSTDEC2 \
|
||||
decfsz WREG, W, ACCESS \
|
||||
SMARTJUMP _rtos_S1 \
|
||||
; \
|
||||
; Save the pic call / return -stack belonging to the \
|
||||
; current task by copying it to the task 's software- \
|
||||
; stack. We save the hardware stack pointer (which \
|
||||
; is the number of addresses on the stack) in the \
|
||||
; W-register first because we need it later and it \
|
||||
; is modified in the save-loop by executing pop's. \
|
||||
; After the loop the W - register is stored on the \
|
||||
; stack, too. \
|
||||
; \
|
||||
movf STKPTR, W, ACCESS \
|
||||
bz _rtos_s3 \
|
||||
_rtos_S2: \
|
||||
if __ROMSIZE > 0x8000 \
|
||||
movff TOSU, POSTDEC2 \
|
||||
endif \
|
||||
movff TOSH, POSTDEC2 \
|
||||
movff TOSL, POSTDEC2 \
|
||||
pop \
|
||||
tstfsz STKPTR, ACCESS \
|
||||
SMARTJUMP _rtos_S2 \
|
||||
_rtos_s3: \
|
||||
movwf POSTDEC2, ACCESS \
|
||||
; \
|
||||
; Next the value for ucCriticalNesting used by the \
|
||||
; task is stored on the stack.When \
|
||||
; ( ucInterruptForced == portINTERRUPTS_FORCED ), we save \
|
||||
; it as 0 ( portNO_CRITICAL_SECTION_NESTING ). \
|
||||
; \
|
||||
if ucInterruptForced == portINTERRUPTS_FORCED \
|
||||
clrf POSTDEC2, ACCESS \
|
||||
else{ \
|
||||
movff ucCriticalNesting, POSTDEC2 \
|
||||
endif \
|
||||
; } \
|
||||
; Save the new top of the software stack in the TCB. \
|
||||
; \
|
||||
movff pxCurrentTCB, FSR0L \
|
||||
movff pxCurrentTCB + 1, FSR0H \
|
||||
movff FSR2L, POSTINC0 \
|
||||
movff FSR2H, POSTINC0 \
|
||||
_Pragma( "asmend" ) \
|
||||
; is modified in the save-loop by executing pop's. \
|
||||
; After the loop the W - register is stored on the \
|
||||
; stack, too. \
|
||||
; \
|
||||
movf STKPTR, W, ACCESS \
|
||||
bz _rtos_s3 \
|
||||
_rtos_S2: \
|
||||
if __ROMSIZE > 0x8000 \
|
||||
movff TOSU, POSTDEC2 \
|
||||
endif \
|
||||
movff TOSH, POSTDEC2 \
|
||||
movff TOSL, POSTDEC2 \
|
||||
pop \
|
||||
tstfsz STKPTR, ACCESS \
|
||||
SMARTJUMP _rtos_S2 \
|
||||
_rtos_s3: \
|
||||
movwf POSTDEC2, ACCESS \
|
||||
; \
|
||||
; Next the value for ucCriticalNesting used by the \
|
||||
; task is stored on the stack.When \
|
||||
; ( ucInterruptForced == portINTERRUPTS_FORCED ), we save \
|
||||
; it as 0 ( portNO_CRITICAL_SECTION_NESTING ). \
|
||||
; \
|
||||
if ucInterruptForced == portINTERRUPTS_FORCED \
|
||||
clrf POSTDEC2, ACCESS \
|
||||
else{ \
|
||||
movff ucCriticalNesting, POSTDEC2 \
|
||||
endif \
|
||||
; } \
|
||||
; Save the new top of the software stack in the TCB. \
|
||||
; \
|
||||
movff pxCurrentTCB, FSR0L \
|
||||
movff pxCurrentTCB + 1, FSR0H \
|
||||
movff FSR2L, POSTINC0 \
|
||||
movff FSR2H, POSTINC0 \
|
||||
_Pragma( "asmend" ) \
|
||||
} while( 0 )
|
||||
|
||||
/************************************************************/
|
||||
|
@ -286,32 +287,32 @@ _rtos_s3:
|
|||
/*
|
||||
* This is the reverse of portSAVE_CONTEXT.
|
||||
*/
|
||||
#define portRESTORE_CONTEXT() \
|
||||
do \
|
||||
{ \
|
||||
_Pragma( "asm" ) \
|
||||
; \
|
||||
; Set FSR0 to point to pxCurrentTCB->pxTopOfStack. \
|
||||
; \
|
||||
movff pxCurrentTCB, FSR0L \
|
||||
movff pxCurrentTCB + 1, FSR0H \
|
||||
; \
|
||||
; De - reference FSR0 to set the address it holds into \
|
||||
; FSR2( i.e. *( pxCurrentTCB->pxTopOfStack ) ).FSR2 \
|
||||
; is used by wizC as stackpointer. \
|
||||
; \
|
||||
movff POSTINC0, FSR2L \
|
||||
movff POSTINC0, FSR2H \
|
||||
; \
|
||||
; Next, the value for ucCriticalNesting used by the \
|
||||
; task is retrieved from the stack. \
|
||||
; \
|
||||
movff PREINC2, ucCriticalNesting \
|
||||
; \
|
||||
; Rebuild the pic call / return -stack.The number of \
|
||||
; return addresses is the next item on the task stack. \
|
||||
; Save this number in PRODL.Then fetch the addresses \
|
||||
; and store them on the hardwarestack. \
|
||||
#define portRESTORE_CONTEXT() \
|
||||
do \
|
||||
{ \
|
||||
_Pragma( "asm" ) \
|
||||
; \
|
||||
; Set FSR0 to point to pxCurrentTCB->pxTopOfStack. \
|
||||
; \
|
||||
movff pxCurrentTCB, FSR0L \
|
||||
movff pxCurrentTCB + 1, FSR0H \
|
||||
; \
|
||||
; De - reference FSR0 to set the address it holds into \
|
||||
; FSR2( i.e. *( pxCurrentTCB->pxTopOfStack ) ).FSR2 \
|
||||
; is used by wizC as stackpointer. \
|
||||
; \
|
||||
movff POSTINC0, FSR2L \
|
||||
movff POSTINC0, FSR2H \
|
||||
; \
|
||||
; Next, the value for ucCriticalNesting used by the \
|
||||
; task is retrieved from the stack. \
|
||||
; \
|
||||
movff PREINC2, ucCriticalNesting \
|
||||
; \
|
||||
; Rebuild the pic call / return -stack.The number of \
|
||||
; return addresses is the next item on the task stack. \
|
||||
; Save this number in PRODL.Then fetch the addresses \
|
||||
; and store them on the hardwarestack. \
|
||||
; The datasheets say we can 't use movff here... \
|
||||
; \
|
||||
movff PREINC2,PRODL // Use PRODL as tempregister \
|
||||
|
@ -331,17 +332,17 @@ _rtos_s3:
|
|||
decfsz PRODL,F,ACCESS \
|
||||
SMARTJUMP _rtos_R1 \
|
||||
; \
|
||||
; Restore the compiler's working storage area to page 0 \
|
||||
; \
|
||||
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE \
|
||||
movwf FSR0L, ACCESS \
|
||||
clrf FSR0H, ACCESS \
|
||||
_rtos_R2: \
|
||||
decf FSR0L, F, ACCESS \
|
||||
movff PREINC2, INDF0 \
|
||||
tstfsz FSR0L, ACCESS \
|
||||
SMARTJUMP _rtos_R2 \
|
||||
; \
|
||||
; Restore the compiler's working storage area to page 0 \
|
||||
; \
|
||||
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE \
|
||||
movwf FSR0L, ACCESS \
|
||||
clrf FSR0H, ACCESS \
|
||||
_rtos_R2: \
|
||||
decf FSR0L, F, ACCESS \
|
||||
movff PREINC2, INDF0 \
|
||||
tstfsz FSR0L, ACCESS \
|
||||
SMARTJUMP _rtos_R2 \
|
||||
; \
|
||||
; Restore the sfr 's forming the tasks context. \
|
||||
; We cannot yet restore bsr, w and status because \
|
||||
; we need these registers for a final test. \
|
||||
|
@ -424,3 +425,10 @@ extern void vPortYield( void );
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue