mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Fix portSET_INTERRUPT_MASK_FROM_ISR definition for atomic operation (#940)
* Introduce portHAS_NESTED_INTERRUPTS to identify if port has nested interrupt or not. * Update atomic.h to use portHAS_NESTED_INTERRUPTS instead of portSET_INTERRUPT_MASK_FROM_ISR definition. --------- Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: ActoryOu <jay2002824@gmail.com>
This commit is contained in:
parent
75c4044b7e
commit
be880a1fc8
9
.github/.cSpellWords.txt
vendored
9
.github/.cSpellWords.txt
vendored
|
@ -59,6 +59,7 @@ brhi
|
||||||
brne
|
brne
|
||||||
bswtrg
|
bswtrg
|
||||||
BSWTRG
|
BSWTRG
|
||||||
|
Bytesto
|
||||||
CANEN
|
CANEN
|
||||||
CANRX
|
CANRX
|
||||||
CANTX
|
CANTX
|
||||||
|
@ -89,13 +90,16 @@ CKGR
|
||||||
CKLO
|
CKLO
|
||||||
CKPS
|
CKPS
|
||||||
CLDIV
|
CLDIV
|
||||||
|
CLEARINTENA
|
||||||
CLKA
|
CLKA
|
||||||
CLKB
|
CLKB
|
||||||
|
CLKDIS
|
||||||
CLKEN
|
CLKEN
|
||||||
clki
|
clki
|
||||||
CLKI
|
CLKI
|
||||||
CLKP
|
CLKP
|
||||||
CLKS
|
CLKS
|
||||||
|
CLKSOURCE
|
||||||
CLKSTA
|
CLKSTA
|
||||||
CLRB
|
CLRB
|
||||||
CLRF
|
CLRF
|
||||||
|
@ -690,6 +694,7 @@ Rsvd
|
||||||
RTAR
|
RTAR
|
||||||
RTCEN
|
RTCEN
|
||||||
RTCSC
|
RTCSC
|
||||||
|
RTICTL
|
||||||
RTIE
|
RTIE
|
||||||
RTIF
|
RTIF
|
||||||
RTIFRC
|
RTIFRC
|
||||||
|
@ -713,6 +718,7 @@ RXRSM
|
||||||
RXSETUP
|
RXSETUP
|
||||||
RXSUSP
|
RXSUSP
|
||||||
RXSYN
|
RXSYN
|
||||||
|
RXTDIS
|
||||||
RXTEN
|
RXTEN
|
||||||
RXUBR
|
RXUBR
|
||||||
SBYCR
|
SBYCR
|
||||||
|
@ -726,6 +732,7 @@ SECU
|
||||||
SENDA
|
SENDA
|
||||||
SETB
|
SETB
|
||||||
SETEN
|
SETEN
|
||||||
|
SETINTENA
|
||||||
SETPSW
|
SETPSW
|
||||||
SETR
|
SETR
|
||||||
setvect
|
setvect
|
||||||
|
@ -849,6 +856,7 @@ TXVC
|
||||||
TXVDIS
|
TXVDIS
|
||||||
UDCP
|
UDCP
|
||||||
uncrustify
|
uncrustify
|
||||||
|
UNDADD
|
||||||
UNRE
|
UNRE
|
||||||
unsuspended
|
unsuspended
|
||||||
URAD
|
URAD
|
||||||
|
@ -867,6 +875,7 @@ VDDCORE
|
||||||
vect
|
vect
|
||||||
VECT
|
VECT
|
||||||
VECTACTIVE
|
VECTACTIVE
|
||||||
|
VECTKEY
|
||||||
visualisation
|
visualisation
|
||||||
vldmdbeq
|
vldmdbeq
|
||||||
vldmia
|
vldmia
|
||||||
|
|
|
@ -509,12 +509,36 @@
|
||||||
|
|
||||||
#endif /* configUSE_TIMERS */
|
#endif /* configUSE_TIMERS */
|
||||||
|
|
||||||
|
#ifndef portHAS_NESTED_INTERRUPTS
|
||||||
|
#if defined( portSET_INTERRUPT_MASK_FROM_ISR ) && defined( portCLEAR_INTERRUPT_MASK_FROM_ISR )
|
||||||
|
#define portHAS_NESTED_INTERRUPTS 1
|
||||||
|
#else
|
||||||
|
#define portHAS_NESTED_INTERRUPTS 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef portSET_INTERRUPT_MASK_FROM_ISR
|
#ifndef portSET_INTERRUPT_MASK_FROM_ISR
|
||||||
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
#if ( portHAS_NESTED_INTERRUPTS == 1 )
|
||||||
|
#error portSET_INTERRUPT_MASK_FROM_ISR must be defined for ports that support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1)
|
||||||
|
#else
|
||||||
|
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if ( portHAS_NESTED_INTERRUPTS == 0 )
|
||||||
|
#error portSET_INTERRUPT_MASK_FROM_ISR must not be defined for ports that do not support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
|
#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
|
#if ( portHAS_NESTED_INTERRUPTS == 1 )
|
||||||
|
#error portCLEAR_INTERRUPT_MASK_FROM_ISR must be defined for ports that support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1)
|
||||||
|
#else
|
||||||
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if ( portHAS_NESTED_INTERRUPTS == 0 )
|
||||||
|
#error portCLEAR_INTERRUPT_MASK_FROM_ISR must not be defined for ports that do not support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef portCLEAN_UP_TCB
|
#ifndef portCLEAN_UP_TCB
|
||||||
|
|
|
@ -33,6 +33,14 @@
|
||||||
* This file implements atomic functions by disabling interrupts globally.
|
* This file implements atomic functions by disabling interrupts globally.
|
||||||
* Implementations with architecture specific atomic instructions can be
|
* Implementations with architecture specific atomic instructions can be
|
||||||
* provided under each compiler directory.
|
* provided under each compiler directory.
|
||||||
|
*
|
||||||
|
* The atomic interface can be used in FreeRTOS tasks on all FreeRTOS ports. It
|
||||||
|
* can also be used in Interrupt Service Routines (ISRs) on FreeRTOS ports that
|
||||||
|
* support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1). The
|
||||||
|
* atomic interface must not be used in ISRs on FreeRTOS ports that do not
|
||||||
|
* support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
|
||||||
|
* because ISRs on these ports cannot be interrupted and therefore, do not need
|
||||||
|
* atomics in ISRs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ATOMIC_H
|
#ifndef ATOMIC_H
|
||||||
|
@ -59,7 +67,7 @@
|
||||||
* ATOMIC_ENTER_CRITICAL().
|
* ATOMIC_ENTER_CRITICAL().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#if defined( portSET_INTERRUPT_MASK_FROM_ISR )
|
#if ( portHAS_NESTED_INTERRUPTS == 1 )
|
||||||
|
|
||||||
/* Nested interrupt scheme is supported in this port. */
|
/* Nested interrupt scheme is supported in this port. */
|
||||||
#define ATOMIC_ENTER_CRITICAL() \
|
#define ATOMIC_ENTER_CRITICAL() \
|
||||||
|
|
|
@ -111,9 +111,6 @@ extern void vTaskSwitchContext( void );
|
||||||
/* Critical section management. */
|
/* Critical section management. */
|
||||||
#define portCRITICAL_NESTING_IN_TCB 0
|
#define portCRITICAL_NESTING_IN_TCB 0
|
||||||
|
|
||||||
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
|
|
||||||
|
|
||||||
#define portDISABLE_INTERRUPTS() __asm volatile ( "csrc mstatus, 8" )
|
#define portDISABLE_INTERRUPTS() __asm volatile ( "csrc mstatus, 8" )
|
||||||
#define portENABLE_INTERRUPTS() __asm volatile ( "csrs mstatus, 8" )
|
#define portENABLE_INTERRUPTS() __asm volatile ( "csrs mstatus, 8" )
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,6 @@ extern void vTaskSwitchContext( void );
|
||||||
/* Critical section management. */
|
/* Critical section management. */
|
||||||
#define portCRITICAL_NESTING_IN_TCB 0
|
#define portCRITICAL_NESTING_IN_TCB 0
|
||||||
|
|
||||||
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
|
|
||||||
|
|
||||||
#define portDISABLE_INTERRUPTS() __disable_interrupt()
|
#define portDISABLE_INTERRUPTS() __disable_interrupt()
|
||||||
#define portENABLE_INTERRUPTS() __enable_interrupt()
|
#define portENABLE_INTERRUPTS() __enable_interrupt()
|
||||||
|
|
||||||
|
|
|
@ -139,9 +139,6 @@
|
||||||
#define portSET_INTERRUPT_MASK() rtos_interrupt_mask_all()
|
#define portSET_INTERRUPT_MASK() rtos_interrupt_mask_all()
|
||||||
#define portCLEAR_INTERRUPT_MASK( ulState ) rtos_interrupt_mask_set( ulState )
|
#define portCLEAR_INTERRUPT_MASK( ulState ) rtos_interrupt_mask_set( ulState )
|
||||||
|
|
||||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ( 0 )
|
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( ( void ) x )
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Will enable interrupts if ulState is non-zero.
|
* Will enable interrupts if ulState is non-zero.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue