mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Code cleanup (#288)
* Update port.c * Code cleanup Misc coding style cleanup and typo fixes * Fix ASM style Fix ASM style * Fix header check Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Carl Lundin <53273776+lundinc2@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
parent
b08c19f745
commit
75e0c36eb4
|
@ -243,14 +243,14 @@ __asm void vPortSVCHandler( void )
|
||||||
PRESERVE8
|
PRESERVE8
|
||||||
|
|
||||||
/* Get the location of the current TCB. */
|
/* Get the location of the current TCB. */
|
||||||
ldr r3, = pxCurrentTCB
|
ldr r3, =pxCurrentTCB
|
||||||
ldr r1, [ r3 ]
|
ldr r1, [ r3 ]
|
||||||
ldr r0, [ r1 ]
|
ldr r0, [ r1 ]
|
||||||
/* Pop the core registers. */
|
/* Pop the core registers. */
|
||||||
ldmia r0 !, {r4-r11,r14}
|
ldmia r0!, {r4-r11,r14}
|
||||||
msr psp, r0
|
msr psp, r0
|
||||||
isb
|
isb
|
||||||
mov r0, # 0
|
mov r0, #0
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
bx r14
|
bx r14
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
@ -477,12 +477,12 @@ __asm void xPortPendSVHandler( void )
|
||||||
str r0, [ r2 ]
|
str r0, [ r2 ]
|
||||||
|
|
||||||
stmdb sp!, {r0, r3}
|
stmdb sp!, {r0, r3}
|
||||||
mov r0, # configMAX_SYSCALL_INTERRUPT_PRIORITY
|
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
bl vTaskSwitchContext
|
bl vTaskSwitchContext
|
||||||
mov r0, # 0
|
mov r0, #0
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
ldmia sp!, {r0, r3}
|
ldmia sp!, {r0, r3}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ __asm void xPortPendSVHandler( void )
|
||||||
|
|
||||||
/* Is the task using the FPU context? If so, pop the high vfp registers
|
/* Is the task using the FPU context? If so, pop the high vfp registers
|
||||||
* too. */
|
* too. */
|
||||||
tst r14, # 0x10
|
tst r14, #0x10
|
||||||
it eq
|
it eq
|
||||||
vldmiaeq r0!, {s16-s31}
|
vldmiaeq r0!, {s16-s31}
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,13 @@
|
||||||
* https://www.FreeRTOS.org
|
* https://www.FreeRTOS.org
|
||||||
* https://github.com/FreeRTOS
|
* https://github.com/FreeRTOS
|
||||||
*
|
*
|
||||||
* 1 tab == 4 spaces!
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PORTMACRO_H
|
#ifndef PORTMACRO_H
|
||||||
#define PORTMACRO_H
|
#define PORTMACRO_H
|
||||||
/* *INDENT-OFF* */
|
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -384,9 +384,9 @@ __asm void prvRestoreContextOfFirstTask( void )
|
||||||
*/
|
*/
|
||||||
BaseType_t xPortStartScheduler( void )
|
BaseType_t xPortStartScheduler( void )
|
||||||
{
|
{
|
||||||
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See
|
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.
|
||||||
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
* See https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||||
configASSERT( ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) );
|
configASSERT( configMAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
|
|
||||||
#if ( configASSERT_DEFINED == 1 )
|
#if ( configASSERT_DEFINED == 1 )
|
||||||
{
|
{
|
||||||
|
@ -968,9 +968,8 @@ __asm uint32_t prvPortGetIPSR( void )
|
||||||
* devices by calling NVIC_SetPriorityGrouping( 0 ); before starting the
|
* devices by calling NVIC_SetPriorityGrouping( 0 ); before starting the
|
||||||
* scheduler. Note however that some vendor specific peripheral libraries
|
* scheduler. Note however that some vendor specific peripheral libraries
|
||||||
* assume a non-zero priority group setting, in which cases using a value
|
* assume a non-zero priority group setting, in which cases using a value
|
||||||
* of zero will result in unpredicable behaviour. */
|
* of zero will result in unpredictable behaviour. */
|
||||||
configASSERT( ( portAIRCR_REG & portPRIORITY_GROUP_MASK ) <= ulMaxPRIGROUPValue );
|
configASSERT( ( portAIRCR_REG & portPRIORITY_GROUP_MASK ) <= ulMaxPRIGROUPValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* configASSERT_DEFINED */
|
#endif /* configASSERT_DEFINED */
|
||||||
/*-----------------------------------------------------------*/
|
|
||||||
|
|
|
@ -233,15 +233,15 @@ static void prvTaskExitError( void )
|
||||||
|
|
||||||
__asm void vPortSVCHandler( void )
|
__asm void vPortSVCHandler( void )
|
||||||
{
|
{
|
||||||
|
/* *INDENT-OFF* */
|
||||||
PRESERVE8
|
PRESERVE8
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
/* Get the location of the current TCB. */
|
/* Get the location of the current TCB. */
|
||||||
ldr r3, =pxCurrentTCB
|
ldr r3, =pxCurrentTCB
|
||||||
ldr r1, [ r3 ]
|
ldr r1, [ r3 ]
|
||||||
ldr r0, [ r1 ]
|
ldr r0, [ r1 ]
|
||||||
/* Pop the core registers. */
|
/* Pop the core registers. */
|
||||||
ldmia r0 !, { r4 - r11, r14 }
|
ldmia r0!, { r4-r11, r14 }
|
||||||
msr psp, r0
|
msr psp, r0
|
||||||
isb
|
isb
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
|
@ -374,7 +374,6 @@ BaseType_t xPortStartScheduler( void )
|
||||||
|
|
||||||
/* Make PendSV and SysTick the lowest priority interrupts. */
|
/* Make PendSV and SysTick the lowest priority interrupts. */
|
||||||
portNVIC_SHPR3_REG |= portNVIC_PENDSV_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_PENDSV_PRI;
|
||||||
|
|
||||||
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI;
|
||||||
|
|
||||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||||
|
@ -453,15 +452,15 @@ __asm void xPortPendSVHandler( void )
|
||||||
/* Is the task using the FPU context? If so, push high vfp registers. */
|
/* Is the task using the FPU context? If so, push high vfp registers. */
|
||||||
tst r14, #0x10
|
tst r14, #0x10
|
||||||
it eq
|
it eq
|
||||||
vstmdbeq r0 !, { s16 - s31 }
|
vstmdbeq r0!, {s16-s31}
|
||||||
|
|
||||||
/* Save the core registers. */
|
/* Save the core registers. */
|
||||||
stmdb r0 !, { r4 - r11, r14 }
|
stmdb r0!, {r4-r11, r14 }
|
||||||
|
|
||||||
/* Save the new top of stack into the first member of the TCB. */
|
/* Save the new top of stack into the first member of the TCB. */
|
||||||
str r0, [ r2 ]
|
str r0, [ r2 ]
|
||||||
|
|
||||||
stmdb sp !, { r0, r3 }
|
stmdb sp!, { r0, r3 }
|
||||||
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
|
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
|
||||||
cpsid i
|
cpsid i
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
|
@ -471,20 +470,20 @@ __asm void xPortPendSVHandler( void )
|
||||||
bl vTaskSwitchContext
|
bl vTaskSwitchContext
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
ldmia sp !, { r0, r3 }
|
ldmia sp!, { r0, r3 }
|
||||||
|
|
||||||
/* The first item in pxCurrentTCB is the task top of stack. */
|
/* The first item in pxCurrentTCB is the task top of stack. */
|
||||||
ldr r1, [ r3 ]
|
ldr r1, [ r3 ]
|
||||||
ldr r0, [ r1 ]
|
ldr r0, [ r1 ]
|
||||||
|
|
||||||
/* Pop the core registers. */
|
/* Pop the core registers. */
|
||||||
ldmia r0 !, { r4 - r11, r14 }
|
ldmia r0!, { r4-r11, r14 }
|
||||||
|
|
||||||
/* Is the task using the FPU context? If so, pop the high vfp registers
|
/* Is the task using the FPU context? If so, pop the high vfp registers
|
||||||
* too. */
|
* too. */
|
||||||
tst r14, #0x10
|
tst r14, #0x10
|
||||||
it eq
|
it eq
|
||||||
vldmiaeq r0 !, { s16 - s31 }
|
vldmiaeq r0!, { s16-s31 }
|
||||||
|
|
||||||
msr psp, r0
|
msr psp, r0
|
||||||
isb
|
isb
|
||||||
|
|
|
@ -22,16 +22,17 @@
|
||||||
* https://www.FreeRTOS.org
|
* https://www.FreeRTOS.org
|
||||||
* https://github.com/FreeRTOS
|
* https://github.com/FreeRTOS
|
||||||
*
|
*
|
||||||
* 1 tab == 4 spaces!
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PORTMACRO_H
|
#ifndef PORTMACRO_H
|
||||||
#define PORTMACRO_H
|
#define PORTMACRO_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
/* *INDENT-OFF* */
|
||||||
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* Port specific definitions.
|
* Port specific definitions.
|
||||||
|
@ -257,9 +258,10 @@
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
#endif /* PORTMACRO_H */
|
#endif /* PORTMACRO_H */
|
||||||
|
|
Loading…
Reference in a new issue