diff options
Diffstat (limited to 'portable/ThirdParty/XCC/Xtensa/port.c')
-rw-r--r-- | portable/ThirdParty/XCC/Xtensa/port.c | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/portable/ThirdParty/XCC/Xtensa/port.c b/portable/ThirdParty/XCC/Xtensa/port.c index a95784167..805a78401 100644 --- a/portable/ThirdParty/XCC/Xtensa/port.c +++ b/portable/ThirdParty/XCC/Xtensa/port.c @@ -37,39 +37,34 @@ /* Defined in portasm.h */ -extern void _frxt_tick_timer_init( void ); +extern void _frxt_tick_timer_init(void); /* Defined in xtensa_context.S */ -extern void _xt_coproc_init( void ); +extern void _xt_coproc_init(void); /*-----------------------------------------------------------*/ /* We require the address of the pxCurrentTCB variable, but don't want to know - * any details of its type. */ +any details of its type. */ typedef void TCB_t; extern volatile TCB_t * volatile pxCurrentTCB; -unsigned port_xSchedulerRunning = 0; /* Duplicate of inaccessible xSchedulerRunning; needed at startup to avoid counting nesting */ -unsigned port_interruptNesting = 0; /* Interrupt nesting level */ +unsigned port_xSchedulerRunning = 0; // Duplicate of inaccessible xSchedulerRunning; needed at startup to avoid counting nesting +unsigned port_interruptNesting = 0; // Interrupt nesting level /*-----------------------------------------------------------*/ -/* User exception dispatcher when exiting */ -void _xt_user_exit( void ); +// User exception dispatcher when exiting +void _xt_user_exit(void); /* * Stack initialization */ #if portUSING_MPU_WRAPPERS - StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, - TaskFunction_t pxCode, - void * pvParameters, - BaseType_t xRunPrivileged ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) #else - StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, - TaskFunction_t pxCode, - void * pvParameters ) +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) #endif { StackType_t * sp; @@ -134,18 +129,18 @@ void _xt_user_exit( void ); void vPortEndScheduler( void ) { /* It is unlikely that the Xtensa port will get stopped. If required simply - * disable the tick interrupt here. */ + disable the tick interrupt here. */ } /*-----------------------------------------------------------*/ BaseType_t xPortStartScheduler( void ) { - /* Interrupts are disabled at this point and stack contains PS with enabled interrupts when task context is restored */ + // Interrupts are disabled at this point and stack contains PS with enabled interrupts when task context is restored #if XCHAL_CP_NUM > 0 - /* Initialize co-processor management for tasks. Leave CPENABLE alone. */ - _xt_coproc_init(); + /* Initialize co-processor management for tasks. Leave CPENABLE alone. */ + _xt_coproc_init(); #endif /* Init the tick divisor value */ @@ -155,14 +150,14 @@ BaseType_t xPortStartScheduler( void ) _frxt_tick_timer_init(); #if XT_USE_THREAD_SAFE_CLIB - /* Init C library */ - vPortClibInit(); + // Init C library + vPortClibInit(); #endif port_xSchedulerRunning = 1; - /* Cannot be directly called from C; never returns */ - __asm__ volatile ( "call0 _frxt_dispatch\n" ); + // Cannot be directly called from C; never returns + __asm__ volatile ("call0 _frxt_dispatch\n"); /* Should not get here. */ return pdTRUE; @@ -195,19 +190,19 @@ BaseType_t xPortSysTickHandler( void ) * Used to set coprocessor area in stack. Current hack is to reuse MPU pointer for coprocessor area. */ #if portUSING_MPU_WRAPPERS - void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings, - const struct xMEMORY_REGION * const xRegions, - StackType_t * pxBottomOfStack, - uint32_t ulStackDepth ) - { - #if XCHAL_CP_NUM > 0 - xMPUSettings->coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + ulStackDepth - 1 ) ); - xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings->coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); - xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings->coproc_area - XT_CP_SIZE ) & ~0xf ); - - /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to - * clear the stack area after we return. This is done in pxPortInitialiseStack(). - */ - #endif - } +void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings, + const struct xMEMORY_REGION * const xRegions, + StackType_t * pxBottomOfStack, + uint32_t ulStackDepth ) +{ + #if XCHAL_CP_NUM > 0 + xMPUSettings->coproc_area = ( StackType_t * ) ( ( uint32_t ) ( pxBottomOfStack + ulStackDepth - 1 )); + xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) xMPUSettings->coproc_area ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); + xMPUSettings->coproc_area = ( StackType_t * ) ( ( ( uint32_t ) xMPUSettings->coproc_area - XT_CP_SIZE ) & ~0xf ); + + /* NOTE: we cannot initialize the coprocessor save area here because FreeRTOS is going to + * clear the stack area after we return. This is done in pxPortInitialiseStack(). + */ + #endif +} #endif /* if portUSING_MPU_WRAPPERS */ |