mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Add code to assert() if non ISR safe API function is called from ISR in Tasking CM4F ports - plus fix bug where the max syscall interrupt priority was used incorrectly in the Tasking CM4F port.
This commit is contained in:
parent
113220628f
commit
b4659d8872
|
@ -81,6 +81,9 @@
|
||||||
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16 )
|
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16 )
|
||||||
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24 )
|
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24 )
|
||||||
|
|
||||||
|
/* Masks off all bits but the VECTACTIVE bits in the ICSR register. */
|
||||||
|
#define portVECTACTIVE_MASK ( 0x1FUL )
|
||||||
|
|
||||||
/* Constants required to manipulate the VFP. */
|
/* Constants required to manipulate the VFP. */
|
||||||
#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */
|
#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */
|
||||||
#define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL )
|
#define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL )
|
||||||
|
@ -240,6 +243,16 @@ void vPortEnterCritical( void )
|
||||||
ulCriticalNesting++;
|
ulCriticalNesting++;
|
||||||
__DSB();
|
__DSB();
|
||||||
__ISB();
|
__ISB();
|
||||||
|
|
||||||
|
/* This is not the interrupt safe version of the enter critical function so
|
||||||
|
assert() if it is being called from an interrupt context. Only API
|
||||||
|
functions that end in "FromISR" can be used in an interrupt. Only assert if
|
||||||
|
the critical nesting count is 1 to protect against recursive calls if the
|
||||||
|
assert function also uses a critical section. */
|
||||||
|
if( ulCriticalNesting == 1 )
|
||||||
|
{
|
||||||
|
configASSERT( ( ( *(portNVIC_INT_CTRL) ) & portVECTACTIVE_MASK ) == 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ _vector_14: .type func
|
||||||
|
|
||||||
stmdb sp!, {r3}
|
stmdb sp!, {r3}
|
||||||
ldr.w r0, =ulMaxSyscallInterruptPriorityConst
|
ldr.w r0, =ulMaxSyscallInterruptPriorityConst
|
||||||
|
ldr r0, [r0]
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
bl vTaskSwitchContext
|
bl vTaskSwitchContext
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
|
@ -146,6 +147,7 @@ _lc_ref__vector_pp_14: .type func
|
||||||
|
|
||||||
stmdb sp!, {r3}
|
stmdb sp!, {r3}
|
||||||
ldr.w r0, =ulMaxSyscallInterruptPriorityConst
|
ldr.w r0, =ulMaxSyscallInterruptPriorityConst
|
||||||
|
ldr r0, [r0]
|
||||||
msr basepri, r0
|
msr basepri, r0
|
||||||
bl vTaskSwitchContext
|
bl vTaskSwitchContext
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
|
@ -206,6 +208,7 @@ vPortStartFirstTask .type func
|
||||||
msr msp, r0
|
msr msp, r0
|
||||||
;Call SVC to start the first task.
|
;Call SVC to start the first task.
|
||||||
cpsie i
|
cpsie i
|
||||||
|
cpsie f
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
svc 0
|
svc 0
|
||||||
|
@ -237,6 +240,7 @@ vPortEnableVFP .type func
|
||||||
ulPortSetInterruptMask:
|
ulPortSetInterruptMask:
|
||||||
mrs r0, basepri
|
mrs r0, basepri
|
||||||
ldr.w r1, =ulMaxSyscallInterruptPriorityConst
|
ldr.w r1, =ulMaxSyscallInterruptPriorityConst
|
||||||
|
ldr r1, [r1]
|
||||||
msr basepri, r1
|
msr basepri, r1
|
||||||
bx r14
|
bx r14
|
||||||
.size ulPortSetInterruptMask, $-ulPortSetInterruptMask
|
.size ulPortSetInterruptMask, $-ulPortSetInterruptMask
|
||||||
|
|
Loading…
Reference in a new issue