3737
3838
3939/* Defined in portasm.h */
40- extern void _frxt_tick_timer_init ( void );
40+ extern void _frxt_tick_timer_init (void );
4141
4242/* Defined in xtensa_context.S */
43- extern void _xt_coproc_init ( void );
43+ extern void _xt_coproc_init (void );
4444
4545
4646/*-----------------------------------------------------------*/
4747
4848/* We require the address of the pxCurrentTCB variable, but don't want to know
49- * any details of its type. */
49+ any details of its type. */
5050typedef void TCB_t ;
5151extern volatile TCB_t * volatile pxCurrentTCB ;
5252
53- unsigned port_xSchedulerRunning = 0 ; /* Duplicate of inaccessible xSchedulerRunning; needed at startup to avoid counting nesting */
54- unsigned port_interruptNesting = 0 ; /* Interrupt nesting level */
53+ unsigned port_xSchedulerRunning = 0 ; // Duplicate of inaccessible xSchedulerRunning; needed at startup to avoid counting nesting
54+ unsigned port_interruptNesting = 0 ; // Interrupt nesting level
5555
5656/*-----------------------------------------------------------*/
5757
58- /* User exception dispatcher when exiting */
59- void _xt_user_exit ( void );
58+ // User exception dispatcher when exiting
59+ void _xt_user_exit (void );
6060
6161/*
6262 * Stack initialization
6363 */
6464#if portUSING_MPU_WRAPPERS
65- StackType_t * pxPortInitialiseStack ( StackType_t * pxTopOfStack ,
66- TaskFunction_t pxCode ,
67- void * pvParameters ,
68- BaseType_t xRunPrivileged )
65+ StackType_t * pxPortInitialiseStack ( StackType_t * pxTopOfStack , TaskFunction_t pxCode , void * pvParameters , BaseType_t xRunPrivileged )
6966#else
70- StackType_t * pxPortInitialiseStack ( StackType_t * pxTopOfStack ,
71- TaskFunction_t pxCode ,
72- void * pvParameters )
67+ StackType_t * pxPortInitialiseStack ( StackType_t * pxTopOfStack , TaskFunction_t pxCode , void * pvParameters )
7368#endif
7469{
7570 StackType_t * sp ;
@@ -134,18 +129,18 @@ void _xt_user_exit( void );
134129void vPortEndScheduler ( void )
135130{
136131 /* It is unlikely that the Xtensa port will get stopped. If required simply
137- * disable the tick interrupt here. */
132+ disable the tick interrupt here. */
138133}
139134
140135/*-----------------------------------------------------------*/
141136
142137BaseType_t xPortStartScheduler ( void )
143138{
144- /* Interrupts are disabled at this point and stack contains PS with enabled interrupts when task context is restored */
139+ // Interrupts are disabled at this point and stack contains PS with enabled interrupts when task context is restored
145140
146141 #if XCHAL_CP_NUM > 0
147- /* Initialize co-processor management for tasks. Leave CPENABLE alone. */
148- _xt_coproc_init ();
142+ /* Initialize co-processor management for tasks. Leave CPENABLE alone. */
143+ _xt_coproc_init ();
149144 #endif
150145
151146 /* Init the tick divisor value */
@@ -155,14 +150,14 @@ BaseType_t xPortStartScheduler( void )
155150 _frxt_tick_timer_init ();
156151
157152 #if XT_USE_THREAD_SAFE_CLIB
158- /* Init C library */
159- vPortClibInit ();
153+ // Init C library
154+ vPortClibInit ();
160155 #endif
161156
162157 port_xSchedulerRunning = 1 ;
163158
164- /* Cannot be directly called from C; never returns */
165- __asm__ volatile ( "call0 _frxt_dispatch\n" );
159+ // Cannot be directly called from C; never returns
160+ __asm__ volatile ("call0 _frxt_dispatch\n" );
166161
167162 /* Should not get here. */
168163 return pdTRUE ;
@@ -195,19 +190,19 @@ BaseType_t xPortSysTickHandler( void )
195190 * Used to set coprocessor area in stack. Current hack is to reuse MPU pointer for coprocessor area.
196191 */
197192#if portUSING_MPU_WRAPPERS
198- void vPortStoreTaskMPUSettings ( xMPU_SETTINGS * xMPUSettings ,
199- const struct xMEMORY_REGION * const xRegions ,
200- StackType_t * pxBottomOfStack ,
201- uint32_t ulStackDepth )
202- {
203- #if XCHAL_CP_NUM > 0
204- xMPUSettings -> coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + ulStackDepth - 1 ) );
205- xMPUSettings -> coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings -> coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
206- xMPUSettings -> coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings -> coproc_area - XT_CP_SIZE ) & ~0xf );
207-
208- /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to
209- * clear the stack area after we return. This is done in pxPortInitialiseStack().
210- */
211- #endif
212- }
193+ void vPortStoreTaskMPUSettings ( xMPU_SETTINGS * xMPUSettings ,
194+ const struct xMEMORY_REGION * const xRegions ,
195+ StackType_t * pxBottomOfStack ,
196+ uint32_t ulStackDepth )
197+ {
198+ #if XCHAL_CP_NUM > 0
199+ xMPUSettings -> coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + ulStackDepth - 1 ));
200+ xMPUSettings -> coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings -> coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
201+ xMPUSettings -> coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings -> coproc_area - XT_CP_SIZE ) & ~0xf );
202+
203+ /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to
204+ * clear the stack area after we return. This is done in pxPortInitialiseStack().
205+ */
206+ #endif
207+ }
213208#endif /* if portUSING_MPU_WRAPPERS */
0 commit comments