mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 11:09:01 +01:00 
			
		
		
		
	Add xPortIsInsideInterrupt() to the IAR ARMv7-M ports.
This commit is contained in:
		
							parent
							
								
									be3561ed53
								
							
						
					
					
						commit
						9e86cb95a7
					
				@ -164,6 +164,34 @@ not necessary for to use this port.  They are defined so the common demo files
 | 
			
		||||
/* portNOP() is not required by this port. */
 | 
			
		||||
#define portNOP()
 | 
			
		||||
 | 
			
		||||
#define portINLINE	__inline
 | 
			
		||||
 | 
			
		||||
#ifndef portFORCE_INLINE
 | 
			
		||||
	#define portFORCE_INLINE inline __attribute__(( always_inline))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
 | 
			
		||||
{
 | 
			
		||||
uint32_t ulCurrentInterrupt;
 | 
			
		||||
BaseType_t xReturn;
 | 
			
		||||
 | 
			
		||||
	/* Obtain the number of the currently executing interrupt. */
 | 
			
		||||
	__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );
 | 
			
		||||
 | 
			
		||||
	if( ulCurrentInterrupt == 0 )
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdFALSE;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdTRUE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return xReturn;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Suppress warnings that are generated by the IAR tools, but cannot be fixed in
 | 
			
		||||
 | 
			
		||||
@ -77,6 +77,12 @@ typedef unsigned long UBaseType_t;
 | 
			
		||||
#define portBYTE_ALIGNMENT			8
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Compiler directives. */
 | 
			
		||||
#define portWEAK_SYMBOL				__attribute__( ( weak ) )
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Scheduler utilities. */
 | 
			
		||||
#define portYIELD()											\
 | 
			
		||||
{															\
 | 
			
		||||
@ -157,6 +163,34 @@ not necessary for to use this port.  They are defined so the common demo files
 | 
			
		||||
/* portNOP() is not required by this port. */
 | 
			
		||||
#define portNOP()
 | 
			
		||||
 | 
			
		||||
#define portINLINE	__inline
 | 
			
		||||
 | 
			
		||||
#ifndef portFORCE_INLINE
 | 
			
		||||
	#define portFORCE_INLINE inline __attribute__(( always_inline))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
 | 
			
		||||
{
 | 
			
		||||
uint32_t ulCurrentInterrupt;
 | 
			
		||||
BaseType_t xReturn;
 | 
			
		||||
 | 
			
		||||
	/* Obtain the number of the currently executing interrupt. */
 | 
			
		||||
	__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );
 | 
			
		||||
 | 
			
		||||
	if( ulCurrentInterrupt == 0 )
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdFALSE;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdTRUE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return xReturn;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Suppress warnings that are generated by the IAR tools, but cannot be fixed in
 | 
			
		||||
 | 
			
		||||
@ -191,6 +191,36 @@ not necessary for to use this port.  They are defined so the common demo files
 | 
			
		||||
 | 
			
		||||
/* portNOP() is not required by this port. */
 | 
			
		||||
#define portNOP()
 | 
			
		||||
 | 
			
		||||
#define portINLINE	__inline
 | 
			
		||||
 | 
			
		||||
#ifndef portFORCE_INLINE
 | 
			
		||||
	#define portFORCE_INLINE inline __attribute__(( always_inline))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
 | 
			
		||||
{
 | 
			
		||||
uint32_t ulCurrentInterrupt;
 | 
			
		||||
BaseType_t xReturn;
 | 
			
		||||
 | 
			
		||||
	/* Obtain the number of the currently executing interrupt. */
 | 
			
		||||
	__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );
 | 
			
		||||
 | 
			
		||||
	if( ulCurrentInterrupt == 0 )
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdFALSE;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdTRUE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return xReturn;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
extern BaseType_t xIsPrivileged( void );
 | 
			
		||||
 | 
			
		||||
@ -77,6 +77,12 @@ typedef unsigned long UBaseType_t;
 | 
			
		||||
#define portBYTE_ALIGNMENT			8
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Compiler directives. */
 | 
			
		||||
#define portWEAK_SYMBOL				__attribute__( ( weak ) )
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Scheduler utilities. */
 | 
			
		||||
#define portYIELD()											\
 | 
			
		||||
{															\
 | 
			
		||||
@ -160,6 +166,34 @@ not necessary for to use this port.  They are defined so the common demo files
 | 
			
		||||
/* portNOP() is not required by this port. */
 | 
			
		||||
#define portNOP()
 | 
			
		||||
 | 
			
		||||
#define portINLINE	__inline
 | 
			
		||||
 | 
			
		||||
#ifndef portFORCE_INLINE
 | 
			
		||||
	#define portFORCE_INLINE inline __attribute__(( always_inline))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
 | 
			
		||||
{
 | 
			
		||||
uint32_t ulCurrentInterrupt;
 | 
			
		||||
BaseType_t xReturn;
 | 
			
		||||
 | 
			
		||||
	/* Obtain the number of the currently executing interrupt. */
 | 
			
		||||
	__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );
 | 
			
		||||
 | 
			
		||||
	if( ulCurrentInterrupt == 0 )
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdFALSE;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		xReturn = pdTRUE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return xReturn;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Suppress warnings that are generated by the IAR tools, but cannot be fixed in
 | 
			
		||||
 | 
			
		||||
@ -82,8 +82,8 @@ void vPortSetupTimerInterrupt( void ) __attribute__(( weak ));
 | 
			
		||||
/* Used to program the machine timer compare register. */
 | 
			
		||||
uint64_t ullNextTime = 0ULL;
 | 
			
		||||
const uint64_t *pullNextTime = &ullNextTime;
 | 
			
		||||
const size_t uxTimerIncrementsForOneTick = ( size_t ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ); /* Assumes increment won't go over 32-bits. */
 | 
			
		||||
volatile uint64_t * const pullMachineTimerCompareRegisterBase = ( uint64_t * ) ( configCLINT_BASE_ADDRESS + 0x4000 );
 | 
			
		||||
const size_t uxTimerIncrementsForOneTick = ( size_t ) ( ( configCPU_CLOCK_HZ ) / ( configTICK_RATE_HZ ) ); /* Assumes increment won't go over 32-bits. */
 | 
			
		||||
volatile uint64_t * const pullMachineTimerCompareRegisterBase = ( uint64_t * ) ( ( configCLINT_BASE_ADDRESS ) + 0x4000 );
 | 
			
		||||
volatile uint64_t * pullMachineTimerCompareRegister = 0;
 | 
			
		||||
/* Set configCHECK_FOR_STACK_OVERFLOW to 3 to add ISR stack checking to task
 | 
			
		||||
stack checking.  A problem in the ISR stack will trigger an assert, not call the
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user