mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-07 05:34:59 -05:00
Respond to additional review feedback. Use periods at end of briefs. Remove same line brief. Add a check back in, change some file names, slight code formatting change.
This commit is contained in:
parent
11beb7156e
commit
ca37a2cfc7
4 changed files with 437 additions and 460 deletions
|
|
@ -37,16 +37,15 @@
|
|||
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "portmacro_asm.h"
|
||||
#include "portmacro.h"
|
||||
#include "task.h"
|
||||
#include "mpu_syscall_numbers.h"
|
||||
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
/** @brief Variable used to keep track of critical section nesting.
|
||||
/**
|
||||
* @brief Variable used to keep track of critical section nesting.
|
||||
* @ingroup Critical Sections
|
||||
* @note
|
||||
* This variable has to be stored as part of the task context and must be
|
||||
|
|
@ -61,12 +60,14 @@ PRIVILEGED_DATA volatile uint32_t ulCriticalNesting = 0xFFFF;
|
|||
*/
|
||||
PRIVILEGED_DATA volatile uint32_t ulPortYieldRequired = pdFALSE;
|
||||
|
||||
/** @brief Interrupt nesting depth, used to count the number of interrupts to unwind.
|
||||
/**
|
||||
* @brief Interrupt nesting depth, used to count the number of interrupts to unwind.
|
||||
* @ingroup Interrupt Management
|
||||
*/
|
||||
PRIVILEGED_DATA volatile uint32_t ulPortInterruptNesting = 0UL;
|
||||
|
||||
/** @brief Variable to track whether or not the scheduler has been started.
|
||||
/**
|
||||
* @brief Variable to track whether or not the scheduler has been started.
|
||||
* @ingroup Scheduler
|
||||
* @note This variable is set to pdTRUE when the scheduler is started.
|
||||
*/
|
||||
|
|
@ -74,24 +75,14 @@ PRIVILEGED_DATA static BaseType_t xSchedulerRunning = pdFALSE;
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @brief Returns the smallest valid MPU Region size that can hold a number of bytes.
|
||||
/**
|
||||
* @brief Set a FreeRTOS Task's initial context.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
* @param ulActualSizeInBytes Number of bytes to find a valid MPU region size for
|
||||
* @return uint32_t The smallest MPU region size that can hold the requested bytes.
|
||||
*/
|
||||
PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
||||
uint32_t ulActualSizeInBytes
|
||||
);
|
||||
|
||||
/** @brief Set a FreeRTOS Task's initial context
|
||||
*
|
||||
* @param pxTopOfStack Pointer to where the task's stack starts
|
||||
* @param pxCode Pointer to the function a task will run
|
||||
* @param pvParameters Pointer to any arguments to be passed to the task's function
|
||||
* @param pxTopOfStack Pointer to where the task's stack starts.
|
||||
* @param pxCode Pointer to the function a task will run.
|
||||
* @param pvParameters Pointer to any arguments to be passed to the task's function.
|
||||
* @param xRunPrivileged Marks if the task is to be run in a privileged CPU mode.
|
||||
* @param xMPUSettings MPU settings to be loaded as part of a task's context
|
||||
* @param xMPUSettings MPU settings to be loaded as part of a task's context.
|
||||
* @return StackType_t* Pointer to where to restore the task's context from.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
|
|
@ -106,125 +97,154 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
)
|
||||
{
|
||||
/** Setup the initial context of the task. The context is set exactly as
|
||||
* expected by the portRESTORE_CONTEXT() macro. */
|
||||
UBaseType_t ulContextIndex = MAX_CONTEXT_SIZE - 1U;
|
||||
* expected by the portRESTORE_CONTEXT() macro and as described above the
|
||||
* MAX_CONTEXT_SIZE declaration in portmacro_asm.h */
|
||||
UBaseType_t ulIndex = MAX_CONTEXT_SIZE - 1U;
|
||||
|
||||
xSYSTEM_CALL_STACK_INFO * xSysCallInfo = NULL;
|
||||
|
||||
if( pdTRUE == xRunPrivileged )
|
||||
{
|
||||
/* Current Program Status and Control Register */
|
||||
/* Current Program Status Register (CPSR) */
|
||||
xMPUSettings->ulTaskFlags |= portTASK_IS_PRIVILEGED_FLAG;
|
||||
xMPUSettings->ulTaskFlags |= 0x1F000000;
|
||||
xMPUSettings->ulContext[ ulContextIndex ] = SYS_MODE;
|
||||
xMPUSettings->ulContext[ ulIndex ] = SYS_MODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Current Program Status and Control Register */
|
||||
/* Current Program Status Register (CPSR) */
|
||||
xMPUSettings->ulTaskFlags &= ( ~portTASK_IS_PRIVILEGED_FLAG );
|
||||
xMPUSettings->ulTaskFlags |= 0x10000000;
|
||||
xMPUSettings->ulContext[ ulContextIndex ] = USER_MODE;
|
||||
xMPUSettings->ulContext[ ulIndex ] = USER_MODE;
|
||||
}
|
||||
|
||||
if( 0x0UL != ( ( uint32_t ) pxCode & portTHUMB_MODE_ADDRESS ) )
|
||||
{
|
||||
/* The task will start in THUMB mode, set the bit in the CPSR. */
|
||||
xMPUSettings->ulContext[ ulContextIndex ] |= portTHUMB_MODE_BIT;
|
||||
xMPUSettings->ulTaskFlags |= portSTACK_FRAME_HAS_PADDING_FLAG;
|
||||
xMPUSettings->ulContext[ ulIndex ] |= portTHUMB_MODE_BIT;
|
||||
}
|
||||
|
||||
/* Decrement ulContextIndex here after setting the CPSR */
|
||||
ulContextIndex--;
|
||||
/* Decrement ulIndex here after setting the CPSR */
|
||||
ulIndex--;
|
||||
|
||||
/** First we load the Memory Location of the Task's function.
|
||||
* Task Program Counter */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) pxCode;
|
||||
/** Set Task Program Counter to provided Task Function */
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) pxCode;
|
||||
ulIndex--;
|
||||
|
||||
/** A FreeRTOS Task is not designed to return or exit from its function.
|
||||
* As such a default Link Register is provided that will return to an
|
||||
* error handling function.
|
||||
* Task Link Register */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) portTASK_RETURN_ADDRESS;
|
||||
* error handling function. */
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) portTASK_RETURN_ADDRESS;
|
||||
ulIndex--;
|
||||
|
||||
/** Set the task's stack pointer to be the bottom of it's stack, since on this
|
||||
* CPU stacks grow upwards.
|
||||
* Task Stack Pointer */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) pxTopOfStack; /* SP */
|
||||
/** CPU Stack Grows up, set Task's Stack Pointer's to bottom of stack */
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) pxTopOfStack; /* SP */
|
||||
ulIndex--;
|
||||
|
||||
/* Next the General Purpose Registers */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x12121212; /* R12 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x11111111; /* R11 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x10101010; /* R10 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x09090909; /* R9 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x08080808; /* R8 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x07070707; /* R7 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x06060606; /* R6 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x05050505; /* R5 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x04040404; /* R4 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x03030303; /* R3 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x02020202; /* R2 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x01010101; /* R1 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) pvParameters; /* R0 */
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x12121212; /* R12 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x11111111; /* R11 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x10101010; /* R10 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x09090909; /* R9 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x08080808; /* R8 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x07070707; /* R7 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x06060606; /* R6 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x05050505; /* R5 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x04040404; /* R4 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x03030303; /* R3 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x02020202; /* R2 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0x01010101; /* R1 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) pvParameters; /* R0 */
|
||||
ulIndex--;
|
||||
|
||||
#ifdef portENABLE_FPU
|
||||
/* Initial Floating Point Context is the Floating Point Registers (FPRs) */
|
||||
/* There are 16 Double FPRs, D0-D15 on the Cortex-R FPU enabled chips */
|
||||
/* These map to the Single Precision FPRs, S0-S31 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000015; /* S31 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1500000; /* S30 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000014; /* S29 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1400000; /* S28 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000013; /* S27 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1300000; /* S26 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000012; /* S25 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1200000; /* S24 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000011; /* S23 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1100000; /* S22 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000010; /* S21 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1000000; /* S20 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000009; /* S19 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD9000000; /* S18 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000008; /* S17 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD8000000; /* S16 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000007; /* S15 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD7000000; /* S14 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000006; /* S13 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD6000000; /* S12 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000005; /* S11 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD5000000; /* S10 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000004; /* S9 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD4000000; /* S8 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000003; /* S7 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD3000000; /* S6 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000002; /* S5 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD2000000; /* S4 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000001; /* S3 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD1000000; /* S2 */
|
||||
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000000; /* S1 */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0xD0000000; /* S0 */
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000015; /* S31 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1500000; /* S30 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000014; /* S29 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1400000; /* S28 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000013; /* S27 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1300000; /* S26 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000012; /* S25 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1200000; /* S24 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000011; /* S23 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1100000; /* S22 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000010; /* S21 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1000000; /* S20 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000009; /* S19 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD9000000; /* S18 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000008; /* S17 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD8000000; /* S16 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000007; /* S15 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD7000000; /* S14 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000006; /* S13 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD6000000; /* S12 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000005; /* S11 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD5000000; /* S10 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000004; /* S9 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD4000000; /* S8 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000003; /* S7 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD3000000; /* S6 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000002; /* S5 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD2000000; /* S4 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000001; /* S3 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD1000000; /* S2 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000000; /* S1 */
|
||||
ulIndex--;
|
||||
xMPUSettings->ulContext[ ulIndex ] = ( StackType_t ) 0xD0000000; /* S0 */
|
||||
ulIndex--;
|
||||
|
||||
/* Floating Point Status and Control Register */
|
||||
xMPUSettings->ulContext[ ulContextIndex-- ] = ( StackType_t ) 0x00000000; /* FPSR */
|
||||
xMPUSettings->ulContext[ ulIndex-- ] = ( StackType_t ) 0x00000000; /* FPSR */
|
||||
#endif /* portENABLE_FPU */
|
||||
|
||||
/* The task will start with a critical nesting count of 0. */
|
||||
xMPUSettings->ulContext[ ulContextIndex ] = portNO_CRITICAL_NESTING;
|
||||
xMPUSettings->ulContext[ ulIndex ] = portNO_CRITICAL_NESTING;
|
||||
|
||||
/* Ensure that the system call stack is double word aligned. */
|
||||
xSYSTEM_CALL_STACK_INFO * xSysCallInfo = &( xMPUSettings->xSystemCallStackInfo );
|
||||
xSysCallInfo = &( xMPUSettings->xSystemCallStackInfo );
|
||||
xSysCallInfo->pulSystemCallStackPointer = &(
|
||||
xSysCallInfo->ulSystemCallStackBuffer[ configSYSTEM_CALL_STACK_SIZE - 1U ]
|
||||
);
|
||||
|
|
@ -239,12 +259,21 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
xSysCallInfo->pulSystemCallLinkRegister = &vPortSystemCallExit;
|
||||
|
||||
/* Return the address where the context of this task should be restored from */
|
||||
return ( &xMPUSettings->ulContext[ ulContextIndex ] );
|
||||
return ( &xMPUSettings->ulContext[ ulIndex ] );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/* PRIVILEGED_FUNCTION */ static uint32_t prvGetMPURegionSizeSetting(
|
||||
|
||||
/**
|
||||
* @brief Determine smallest MPU Region Setting for a number of bytes.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
* @param ulActualSizeInBytes Number of bytes to find a valid MPU region size for.
|
||||
* @return uint32_t The smallest MPU region size that can hold the requested bytes.
|
||||
*/
|
||||
PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
||||
uint32_t ulActualSizeInBytes
|
||||
)
|
||||
{
|
||||
|
|
@ -270,7 +299,8 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/** @brief Stores a FreeRTOS Task's MPU Settings in its TCB
|
||||
/**
|
||||
* @brief Stores a FreeRTOS Task's MPU Settings in its TCB.
|
||||
*
|
||||
* @param xMPUSettings The memory location in the TCB to store MPU settings
|
||||
* @param xRegions The MPU settings being requested by the task.
|
||||
|
|
@ -296,8 +326,6 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
* exported from linker scripts. */
|
||||
extern uint32_t * __SRAM_segment_start__;
|
||||
extern uint32_t * __SRAM_segment_end__;
|
||||
extern uint32_t * __privileged_data_start__;
|
||||
extern uint32_t * __privileged_data_end__;
|
||||
#else
|
||||
/* Declaration when these variable are exported from linker scripts. */
|
||||
extern uint32_t __SRAM_segment_start__[];
|
||||
|
|
@ -309,6 +337,7 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
uint32_t ulRegionEnd;
|
||||
uint32_t ulRegionLen;
|
||||
uint32_t ulAlignment;
|
||||
|
||||
/* Allow Read/Write from User and Privileged modes */
|
||||
uint32_t ulRegionAttr = portMPU_PRIV_RW_USER_RW_NOEXEC |
|
||||
portMPU_NORMAL_OIWTNOWA_SHARED;
|
||||
|
|
@ -322,7 +351,10 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
ulRegionLen = prvGetMPURegionSizeSetting( ulRegionLen );
|
||||
ulRegionLen |= portMPU_REGION_ENABLE;
|
||||
|
||||
/* Invalidate other MPU regions by using the last configurable region */
|
||||
/* MPU Settings is zero'd out in the TCB before reaching this function.
|
||||
* Set this region as the highest configurable MPU Region so it overrides
|
||||
* the lower unused regions.
|
||||
*/
|
||||
ulIndex = portNUM_CONFIGURABLE_REGIONS;
|
||||
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionBaseAddress = ulRegionStart;
|
||||
|
|
@ -333,7 +365,7 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
{
|
||||
for( ulIndex = 0UL; ulIndex < portNUM_CONFIGURABLE_REGIONS; ulIndex++ )
|
||||
{
|
||||
/* If a length has been provided, the region is in use */
|
||||
/* If a length has been provided, the region is in use. */
|
||||
if( ( xRegions[ ulIndex ] ).ulLengthInBytes > 0UL )
|
||||
{
|
||||
ulRegionStart = ( uint32_t ) xRegions[ ulIndex ].pvBaseAddress;
|
||||
|
|
@ -366,25 +398,27 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
* stack region has already been configured. */
|
||||
|
||||
/* Cannot have a task stack of size 0 */
|
||||
configASSERT( ulStackDepth != 0x0UL );
|
||||
if( 0x0UL != ulStackDepth )
|
||||
{
|
||||
/* Define the region that allows access to the stack. */
|
||||
ulRegionStart = ( uint32_t ) pxBottomOfStack;
|
||||
ulRegionAttr = portMPU_PRIV_RW_USER_RW_NOEXEC |
|
||||
portMPU_NORMAL_OIWTNOWA_SHARED;
|
||||
ulRegionLen = prvGetMPURegionSizeSetting( ulStackDepth << 2UL );
|
||||
ulRegionLen |= portMPU_REGION_ENABLE;
|
||||
|
||||
/* Define the region that allows access to the stack. */
|
||||
ulRegionStart = ( uint32_t ) pxBottomOfStack;
|
||||
ulRegionAttr = portMPU_PRIV_RW_USER_RW_NOEXEC | portMPU_NORMAL_OIWTNOWA_SHARED;
|
||||
ulRegionLen = prvGetMPURegionSizeSetting( ulStackDepth << 2UL );
|
||||
ulRegionLen |= portMPU_REGION_ENABLE;
|
||||
/* MPU Regions must be aligned to a power of 2 equal to length */
|
||||
ulAlignment = 2UL << ( ulRegionLen >> 1UL );
|
||||
configASSERT( 0U == ( ulRegionStart % 2UL ) );
|
||||
configASSERT( 0U == ( ulRegionStart % ( ulAlignment ) ) );
|
||||
|
||||
/* MPU Regions must be aligned to a power of 2 equal to length */
|
||||
ulAlignment = 2UL << ( ulRegionLen >> 1UL );
|
||||
configASSERT( 0U == ( ulRegionStart % 2UL ) );
|
||||
configASSERT( 0U == ( ulRegionStart % ( ulAlignment ) ) );
|
||||
/* xRegion[portNUM_CONFIGURABLE_REGIONS] is the Task Stack */
|
||||
ulIndex = portNUM_CONFIGURABLE_REGIONS;
|
||||
|
||||
/* xRegion[portNUM_CONFIGURABLE_REGIONS] is the Task Stack */
|
||||
ulIndex = portNUM_CONFIGURABLE_REGIONS;
|
||||
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionBaseAddress = ulRegionStart;
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionSize = ulRegionLen;
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionAttribute = ulRegionAttr;
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionBaseAddress = ulRegionStart;
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionSize = ulRegionLen;
|
||||
xMPUSettings->xRegion[ ulIndex ].ulRegionAttribute = ulRegionAttr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +432,7 @@ PRIVILEGED_FUNCTION static uint32_t prvGetMPURegionSizeSetting(
|
|||
* Ensure that the variables used in your linker script match up with the variable names
|
||||
* used at the start of this function.
|
||||
*/
|
||||
PRIVILEGED_FUNCTION static void prvSetupDefaultMPU( void )
|
||||
PRIVILEGED_FUNCTION static void prvSetupMPU( void )
|
||||
{
|
||||
#if defined( __ARMCC_VERSION )
|
||||
/* Declaration when these variable are defined in code instead of being
|
||||
|
|
@ -442,7 +476,7 @@ PRIVILEGED_FUNCTION static void prvSetupDefaultMPU( void )
|
|||
uint32_t ulRegionLength;
|
||||
|
||||
/* Ensure the MPU is disabled */
|
||||
prvMPUDisable();
|
||||
vMPUDisable();
|
||||
|
||||
/* Unprivileged and Privileged Read and Exec MPU Region for Flash */
|
||||
ulRegionStart = ( uint32_t ) __FLASH_segment_start__;
|
||||
|
|
@ -451,7 +485,7 @@ PRIVILEGED_FUNCTION static void prvSetupDefaultMPU( void )
|
|||
ulRegionLength = prvGetMPURegionSizeSetting( ulRegionLength );
|
||||
ulRegionLength |= portMPU_REGION_ENABLE;
|
||||
|
||||
prvMpuSetRegion(
|
||||
vMPUSetRegion(
|
||||
portUNPRIVILEGED_FLASH_REGION,
|
||||
ulRegionStart,
|
||||
ulRegionLength,
|
||||
|
|
@ -465,7 +499,7 @@ PRIVILEGED_FUNCTION static void prvSetupDefaultMPU( void )
|
|||
ulRegionLength = prvGetMPURegionSizeSetting( ulRegionLength );
|
||||
ulRegionLength |= portMPU_REGION_ENABLE;
|
||||
|
||||
prvMpuSetRegion(
|
||||
vMPUSetRegion(
|
||||
portPRIVILEGED_FLASH_REGION,
|
||||
ulRegionStart,
|
||||
ulRegionLength,
|
||||
|
|
@ -479,34 +513,35 @@ PRIVILEGED_FUNCTION static void prvSetupDefaultMPU( void )
|
|||
ulRegionLength = prvGetMPURegionSizeSetting( ulRegionLength );
|
||||
ulRegionLength |= portMPU_REGION_ENABLE;
|
||||
|
||||
prvMpuSetRegion(
|
||||
vMPUSetRegion(
|
||||
portGENERAL_PERIPHERALS_REGION,
|
||||
ulRegionStart,
|
||||
ulRegionLength,
|
||||
portMPU_PRIV_RW_USER_RW_NOEXEC | portMPU_DEVICE_NONSHAREABLE
|
||||
);
|
||||
|
||||
/* Privileged Write and Read, Unprivileged Read, MPU Region for PRIVILEGED_DATA. */
|
||||
/* Privileged Write and Read, Unprivileged no access, MPU Region for PRIVILEGED_DATA. */
|
||||
ulRegionStart = ( uint32_t ) __privileged_data_start__;
|
||||
ulRegionEnd = ( uint32_t ) __privileged_data_end__;
|
||||
ulRegionLength = ulRegionEnd - ulRegionStart;
|
||||
ulRegionLength = prvGetMPURegionSizeSetting( ulRegionLength );
|
||||
ulRegionLength |= portMPU_REGION_ENABLE;
|
||||
|
||||
prvMpuSetRegion(
|
||||
vMPUSetRegion(
|
||||
portPRIVILEGED_RAM_REGION,
|
||||
ulRegionStart,
|
||||
ulRegionLength,
|
||||
portMPU_PRIV_RW_USER_RO_NOEXEC | portMPU_NORMAL_OIWTNOWA_SHARED
|
||||
portMPU_PRIV_RW_USER_NA_NOEXEC | portMPU_NORMAL_OIWTNOWA_SHARED
|
||||
);
|
||||
|
||||
/* After setting default regions, enable the MPU */
|
||||
prvMPUEnable();
|
||||
vMPUEnable();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/** @brief Determine if a FreeRTOS Task has been granted access to a memory region
|
||||
/**
|
||||
* @brief Determine if a FreeRTOS Task has been granted access to a memory region.
|
||||
*
|
||||
* @param xTaskMPURegion Pointer to a single set of MPU region registers.
|
||||
* @param ulRegionStart Base address of the memory region access is being requested.
|
||||
|
|
@ -583,13 +618,11 @@ PRIVILEGED_FUNCTION static BaseType_t prvTaskCanAccessRegion(
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Only way to receive a NULL here is if no task has been created,
|
||||
* but the scheduler has been started. */
|
||||
xTaskMPUSettings = xTaskGetMPUSettings( NULL );
|
||||
|
||||
if( NULL == xTaskMPUSettings )
|
||||
{
|
||||
xAccessGranted = pdFALSE;
|
||||
}
|
||||
else if( xTaskMPUSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG )
|
||||
if( xTaskMPUSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG )
|
||||
{
|
||||
/* If a task is privileged it is assumed that it can access the buffer */
|
||||
xAccessGranted = pdTRUE;
|
||||
|
|
@ -615,7 +648,8 @@ PRIVILEGED_FUNCTION static BaseType_t prvTaskCanAccessRegion(
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @brief Determine if the FreeRTOS Task was created as a privileged task
|
||||
/**
|
||||
* @brief Determine if the FreeRTOS Task was created as a privileged task.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
* @ingroup Task Context
|
||||
|
|
@ -640,8 +674,8 @@ PRIVILEGED_FUNCTION static BaseType_t prvTaskCanAccessRegion(
|
|||
return xTaskIsPrivileged;
|
||||
}
|
||||
|
||||
/** @brief Start the FreeRTOS-Kernel's control of Tasks by starting the System Tick
|
||||
* Interrupt.
|
||||
/**
|
||||
* @brief Start the System Tick Timer, starting the FreeRTOS-Kernel.
|
||||
*
|
||||
* @ingroup Scheduler
|
||||
* @return BaseType_t This function is not meant to be returned from.
|
||||
|
|
@ -656,7 +690,7 @@ BaseType_t xPortStartScheduler( void )
|
|||
ulCriticalNesting = 0UL;
|
||||
|
||||
/* Configure the regions in the MPU that are common to all tasks. */
|
||||
prvSetupDefaultMPU();
|
||||
prvSetupMPU();
|
||||
|
||||
xSchedulerRunning = pdTRUE;
|
||||
|
||||
|
|
@ -774,13 +808,6 @@ BaseType_t xPortStartScheduler( void )
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @brief Function that is used as the default Link Register address for a new Task
|
||||
*
|
||||
* @ingroup Task Context
|
||||
* @note This function is used as the default Link Register address if
|
||||
* configTASK_RETURN_ADDRESS is not defined in FreeRTOSConfig.h
|
||||
*
|
||||
*/
|
||||
void prvTaskExitError( void )
|
||||
{
|
||||
/* A function that implements a task must not exit or attempt to return to
|
||||
|
|
@ -798,7 +825,8 @@ void prvTaskExitError( void )
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @brief Function meant to end the FreeRTOS Scheduler, not implemented on this port.
|
||||
/**
|
||||
* @brief Function meant to end the FreeRTOS Scheduler, not implemented on this port.
|
||||
* @ingroup Scheduler
|
||||
*/
|
||||
void vPortEndScheduler( void )
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
LDR R0, [R0]
|
||||
/* Push the value of ulCriticalNesting into the context, auto-increment the
|
||||
* LR by using the ! operator. */
|
||||
STM LR!, {R0}
|
||||
STM LR!, { R0 }
|
||||
|
||||
#if ( portENABLE_FPU == 1 )
|
||||
/* Save the floating point context */
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
* the mode selected in the Saved Program Status Register (SPSR) */
|
||||
STM LR, { R0-R14 }^
|
||||
/* Not allowed to auto-increment with ! when using banked registers */
|
||||
ADD LR, LR, #portGPR_LENGTH
|
||||
ADD LR, LR, #portREGISTER_LENGTH
|
||||
/* Pop the pushed LR, which is the pre-exception Program Counter (PC) */
|
||||
POP { R0 }
|
||||
/* Copy the pre-exception Current Program Status Register (CPSR), which,
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
* For (R5 = portFIRST_CONFIGURABLE_REGION ; R5 <= portSTACK_REGION ; R5++ ) */
|
||||
123:
|
||||
/* Load values of struct MPU_REGION_REGISTERS into R2-R4 */
|
||||
LDMIA R1!, {R2-R4}
|
||||
LDMIA R1!, { R2-R4 }
|
||||
/* Load the values set in xMPU_REGION_REGISTERS
|
||||
* R2 Will hold ulRegionSize
|
||||
* R3 will hold ulRegionAttribute
|
||||
|
|
@ -160,17 +160,17 @@
|
|||
/* Move the saved FPSCR value into the FPSCR */
|
||||
VMSR FPSCR, R1
|
||||
/* Restore the Floating Point Registers */
|
||||
VLDM LR!, {D0-D15}
|
||||
VLDM LR!, { D0-D15 }
|
||||
#endif /* portENABLE_FPU*/
|
||||
|
||||
/* Load the value of the CPSR into R1, needed to set the SP and the LR */
|
||||
LDR R0, [LR, +#portREGISTER_CONTEXT_LENGTH]
|
||||
/* Load the value of the CPSR into R0, needed to set the SP and the LR */
|
||||
LDR R0, [LR, +#(portREGISTER_LENGTH + 4UL)]
|
||||
/* Move the CPSR the into our SPSR */
|
||||
MSR SPSR_cxsf, R0
|
||||
/* Restore the saved Stack Pointer and Link Register */
|
||||
LDM LR, {R0-R14}^
|
||||
/* Restore the saved Stack Pointer and Link Register into User Mode */
|
||||
LDM LR, { R0-R14 }^
|
||||
/* Not allowed to auto-increment with ! when using banked registers */
|
||||
ADD LR, LR, #portGPR_LENGTH
|
||||
ADD LR, LR, #portREGISTER_LENGTH
|
||||
/* Load the PC to return from the exception */
|
||||
RFE LR
|
||||
|
||||
|
|
@ -267,7 +267,6 @@ SVC_Handler_Exit:
|
|||
/* This instruction loads the SPSR into the CPSR, performing the mode swap */
|
||||
MOVS PC, LR
|
||||
|
||||
/* ----------------------------------------------------------------------------------- */
|
||||
/* Perform a task swap */
|
||||
svcPortYield:
|
||||
/* Restore the previously saved R11, R12 */
|
||||
|
|
@ -279,7 +278,6 @@ svcPortYield:
|
|||
/* Restore the context of the task selected to execute. */
|
||||
portRESTORE_CONTEXT
|
||||
|
||||
/* ----------------------------------------------------------------------------------- */
|
||||
/* Reset task stack and link register after a FreeRTOS System Call */
|
||||
svcSystemCallExit:
|
||||
/* Restore the Task Stack Pointer and Link Register */
|
||||
|
|
@ -290,7 +288,7 @@ svcSystemCallExit:
|
|||
/* Set R11 to be the location of xSystemCallStackInfo inside the TCB */
|
||||
ADD R11, R11, #portSYSTEM_CALL_INFO_OFFSET
|
||||
/* Restore the user mode Stack Pointer and Link Register */
|
||||
LDMIB R11, {R13-R14}^
|
||||
LDMIB R11, { R13-R14 }^
|
||||
/* Zero out R12 so we can set ulTaskStackPointer back to NULL */
|
||||
AND R12, R12, #0x0
|
||||
/* Set pulTaskStackPointer to be 0x0 */
|
||||
|
|
@ -298,7 +296,7 @@ svcSystemCallExit:
|
|||
/* Set pulLinkRegisterAtSystemCallEntry to be 0x0 */
|
||||
STR R12, [R11, #0x8]
|
||||
/* Load the ulTaskFlag so we can determine if we're going to lower privilege */
|
||||
LDM R11, {R12}
|
||||
LDM R11, { R12 }
|
||||
/* Check if the task is privileged */
|
||||
CMP R12, #portTASK_IS_PRIVILEGED_FLAG
|
||||
/* If the task is privileged we can leave now */
|
||||
|
|
@ -312,7 +310,6 @@ svcSystemCallExit:
|
|||
/* Jump back */
|
||||
B SVC_Handler_Exit
|
||||
|
||||
/* ----------------------------------------------------------------------------------- */
|
||||
/* Save task's SP and LR, swap to ulSystemCallStack Buffer, raise privilege */
|
||||
svcSystemCallEnter:
|
||||
/* Load the base address of the uxSystemCallImplementations[] table into R14 */
|
||||
|
|
@ -342,15 +339,15 @@ svcSystemCallEnter:
|
|||
* assert if the ulTaskStackPointer is not null. */
|
||||
MOVWEQ R0, #0x706F
|
||||
MOVTEQ R0, #0x7274
|
||||
MOVEQ R1, #458
|
||||
MOVEQ R1, #342
|
||||
BEQ vAssertCalled
|
||||
|
||||
/* Store the task's SP and LR to xSYSTEM_CALL_STACK_INFO */
|
||||
STM R11, {R13-R14}^
|
||||
STM R11, { R13-R14 }^
|
||||
/* Not allowed to auto-increment with ! when using banked registers */
|
||||
ADD R11, R11, 0x8
|
||||
/* Load pulSystemCallStackPointer and pulSystemCallLinkRegister now */
|
||||
LDM R11, {R13-R14}^
|
||||
LDM R11, { R13-R14 }^
|
||||
|
||||
/* Swap the SPSR to SYS_MODE for the System Call. Move SPSR into R12 */
|
||||
MRS R12, SPSR
|
||||
|
|
@ -437,16 +434,16 @@ vPortEnableInterrupts:
|
|||
|
||||
/* ----------------------------------------------------------------------------------- */
|
||||
/** Set MPU Registers using provided values
|
||||
* Function: void prvMpuSetRegion
|
||||
* Function: void vMPUSetRegion
|
||||
* Inputs: uint32_t ulRegionNumber
|
||||
* Inputs: uint32_t ulBaseAddress
|
||||
* Inputs: uint32_t ulRegionSize
|
||||
* Inputs: uint32_t ulRegionPermissions
|
||||
*/
|
||||
.align 4
|
||||
.global prvMpuSetRegion
|
||||
.type prvMpuSetRegion, %function
|
||||
prvMpuSetRegion:
|
||||
.global vMPUSetRegion
|
||||
.type vMPUSetRegion, %function
|
||||
vMPUSetRegion:
|
||||
/* Only 15 possible regions, drop all other bits */
|
||||
AND R0, R0, #15
|
||||
/* Select the MPU Region selected by ulRegionNumber */
|
||||
|
|
@ -463,9 +460,9 @@ prvMpuSetRegion:
|
|||
/* ----------------------------------------------------------------------------------- */
|
||||
/* Set the Enable bit of the MPU Enable Register to 1. */
|
||||
.align 4
|
||||
.global prvMPUEnable
|
||||
.type prvMPUEnable, %function
|
||||
prvMPUEnable:
|
||||
.global vMPUEnable
|
||||
.type vMPUEnable, %function
|
||||
vMPUEnable:
|
||||
/* Read the current MPU control register into R0 */
|
||||
MRC p15, #0, R0, c1, c0, #0
|
||||
/* Set the enable bit to high */
|
||||
|
|
@ -482,9 +479,9 @@ prvMPUEnable:
|
|||
/* ----------------------------------------------------------------------------------- */
|
||||
/* Set the Enable bit of the MPU Enable Register to 0. */
|
||||
.align 4
|
||||
.global prvMPUDisable
|
||||
.type prvMPUDisable, %function
|
||||
prvMPUDisable:
|
||||
.global vMPUDisable
|
||||
.type vMPUDisable, %function
|
||||
vMPUDisable:
|
||||
/* Read the MPU enable register values into R0 */
|
||||
MRC p15, #0, R0, c1, c0, #0
|
||||
/* Perform a bitwise AND of R0 and NOT #1, i.e. clear bit 1 */
|
||||
|
|
@ -510,7 +507,7 @@ FreeRTOS_IRQ_Handler:
|
|||
/* Save the return state to the IRQ stack */
|
||||
SRSDB SP!, #IRQ_MODE
|
||||
/* Push used registers. */
|
||||
PUSH {R0-R3, R12}
|
||||
PUSH { R0-R3, R12 }
|
||||
|
||||
/* Load &ulPortInterruptNesting into R0 */
|
||||
LDR R0, =ulPortInterruptNesting
|
||||
|
|
|
|||
|
|
@ -29,14 +29,16 @@
|
|||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
|
||||
/** @brief Functions, Defines, and Structs for use in the ARM_CRx_MPU FreeRTOS-Port
|
||||
/**
|
||||
* @brief Functions, Defines, and Structs for use in the ARM_CRx_MPU FreeRTOS-Port
|
||||
* @file portmacro.h
|
||||
* @note The settings in this file configure FreeRTOS correctly for the given
|
||||
* hardware and compiler. These settings should not be altered.
|
||||
*/
|
||||
|
||||
/** @defgroup MPU Control
|
||||
/**
|
||||
* @brief APIs and Variables used to control the onboard MPU.
|
||||
* @defgroup MPU Control
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -52,55 +54,37 @@ extern "C" {
|
|||
#include "FreeRTOSConfig.h"
|
||||
|
||||
#ifndef configENABLE_MPU
|
||||
#error "This port is only usable with configENABLE_MPU set to 1"
|
||||
#define configENABLE_MPU 1
|
||||
#elif( configENABLE_MPU != 1 )
|
||||
#error "This port is only usable with configENABLE_MPU set to 1"
|
||||
#endif /* configENABLE_MPU */
|
||||
|
||||
#ifndef configUSE_MPU_WRAPPERS_V1
|
||||
#define configUSE_MPU_WRAPPERS_V1 0
|
||||
#elif( ( configUSE_MPU_WRAPPERS_V1 != 0 ) )
|
||||
#error "This port is only usable with configUSE_MPU_WRAPPERS_V1 set to 0"
|
||||
#endif /* ( configUSE_MPU_WRAPPERS_V1 != 0 ) */
|
||||
|
||||
#ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY
|
||||
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 1
|
||||
#elif( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY != 1 )
|
||||
#error This Port is only usable with configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY set to 1
|
||||
#endif /* ( configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY != 1 ) */
|
||||
|
||||
#ifndef configENABLE_ACCESS_CONTROL_LIST
|
||||
#define configENABLE_ACCESS_CONTROL_LIST 0
|
||||
#elif( configENABLE_ACCESS_CONTROL_LIST == 1 )
|
||||
#ifndef configPROTECTED_KERNEL_OBJECT_POOL_SIZE
|
||||
#error "Set configPROTECTED_KERNEL_OBJECT_POOL_SIZE to at least the number " \
|
||||
"of FreeRTOS-Kernel Objects to be created"
|
||||
#endif /* configPROTECTED_KERNEL_OBJECT_POOL_SIZE */
|
||||
#endif /* configENABLE_ACCESS_CONTROL_LIST */
|
||||
#define configENABLE_ACCESS_CONTROL_LIST 1
|
||||
#endif /* configENABLE_ACCESS_CONTROL_LIST */
|
||||
|
||||
#ifndef configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS
|
||||
#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0
|
||||
#elif( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 )
|
||||
#error "This port does not support unprivileged tasks to enter a critical section"
|
||||
#endif /* configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS */
|
||||
#ifndef configPROTECTED_KERNEL_OBJECT_POOL_SIZE
|
||||
#error "Set configPROTECTED_KERNEL_OBJECT_POOL_SIZE to at least the number " \
|
||||
"of FreeRTOS-Kernel Objects to be created"
|
||||
#endif /* configPROTECTED_KERNEL_OBJECT_POOL_SIZE */
|
||||
|
||||
/* ------------------------- FreeRTOS Config Check ------------------------- */
|
||||
|
||||
/** @brief The size in Bytes that the Privileged System Call Stack should be.
|
||||
|
||||
/**
|
||||
* @brief The size in Bytes that the Privileged System Call Stack should be.
|
||||
*
|
||||
* @ingroup MPU Privilege
|
||||
*
|
||||
* @note This stack is used when performing FreeRTOS System Calls. The stack pointer
|
||||
* is changed to use this region when a call to a function is made that goes through
|
||||
* the MPU Wrappers.
|
||||
*
|
||||
* This value should be a size that can be made into a MPU Region.
|
||||
*
|
||||
* @note A Stack of this length, in bytes, is used by FreeRTOS APIs when called
|
||||
* by an unprivileged task.
|
||||
*/
|
||||
#ifndef configSYSTEM_CALL_STACK_SIZE
|
||||
#error configSYSTEM_CALL_STACK_SIZE must be defined to the desired size of the system call stack in words for using MPU wrappers v2.
|
||||
#error "configSYSTEM_CALL_STACK_SIZE must be defined to a length, in bytes, " \
|
||||
"to use when an unprivileged task makes a FreeRTOS Kernel call. "
|
||||
#endif /* configSYSTEM_CALL_STACK_SIZE */
|
||||
|
||||
/* ------------------------- FreeRTOS Config Check ------------------------- */
|
||||
|
||||
#if( configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 )
|
||||
/* Check the configuration. */
|
||||
#if( configMAX_PRIORITIES > 32 )
|
||||
|
|
@ -110,7 +94,8 @@ extern "C" {
|
|||
"priorities as tasks that share a priority will time slice."
|
||||
#endif /* ( configMAX_PRIORITIES > 32 ) */
|
||||
|
||||
/** @brief Mark that a task of the current priority is ready for execution
|
||||
/**
|
||||
* @brief Mark that a task of the current priority is ready for execution.
|
||||
*
|
||||
* @ingroup Scheduler
|
||||
*
|
||||
|
|
@ -120,7 +105,8 @@ extern "C" {
|
|||
#define portRECORD_READY_PRIORITY( uxPriority, uxTopReadyPriority ) \
|
||||
( uxTopReadyPriority ) |= ( 1UL << ( uxPriority ) )
|
||||
|
||||
/** @brief Mark that a task of the current priority has left the ready state
|
||||
/**
|
||||
* @brief Mark that a task of the current priority has left the ready state.
|
||||
*
|
||||
* @ingroup Scheduler
|
||||
*
|
||||
|
|
@ -130,7 +116,8 @@ extern "C" {
|
|||
#define portRESET_READY_PRIORITY( uxPriority, uxTopReadyPriority ) \
|
||||
( uxTopReadyPriority ) &= ~( 1UL << ( uxPriority ) )
|
||||
|
||||
/** @brief Determine what the highest priority ready task is.
|
||||
/**
|
||||
* @brief Determine what the highest priority ready task is.
|
||||
*
|
||||
* @ingroup Scheduler
|
||||
*
|
||||
|
|
@ -147,16 +134,12 @@ extern "C" {
|
|||
#endif /* configSETUP_TICK_INTERRUPT */
|
||||
|
||||
#ifndef configCLEAR_TICK_INTERRUPT
|
||||
#error configCLEAR_TICK_INTERRUPT must be defined in FreeRTOSConfig.h to clear which ever interrupt was used to generate the tick interrupt.
|
||||
#error configCLEAR_TICK_INTERRUPT() must be defined in FreeRTOSConfig.h to clear which ever interrupt was used to generate the tick interrupt.
|
||||
#endif /* configCLEAR_TICK_INTERRUPT */
|
||||
|
||||
#ifndef configEOI_ADDRESS
|
||||
#error Did not define a memrory address to mark the end of an Interrupt
|
||||
#endif /* configEOI_ADDRESS */
|
||||
|
||||
#ifdef configUSE_TICKLESS_IDLE
|
||||
#if( configUSE_TICKLESS_IDLE != 0 )
|
||||
#error This port does not yet support tickless idle
|
||||
#error This port does not support tickless idle
|
||||
#endif /* ( configUSE_TICKLESS_IDLE != 0 ) */
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
|
|
@ -164,7 +147,8 @@ extern "C" {
|
|||
|
||||
#include "portmacro_asm.h"
|
||||
|
||||
/** @brief Critical section nesting value to mark the end of a critical section.
|
||||
/**
|
||||
* @brief Critical section nesting value to mark the end of a critical section.
|
||||
*
|
||||
* @ingroup Critical Sections
|
||||
*
|
||||
|
|
@ -174,17 +158,20 @@ extern "C" {
|
|||
*/
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0x0 )
|
||||
|
||||
/** @brief Bit value used to mark if the CPU is currently executing in Thumb Mode.
|
||||
/**
|
||||
* @brief Bit value used to mark if the CPU is currently executing in Thumb Mode.
|
||||
* @ingroup Task Context
|
||||
*/
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
|
||||
/** @brief Value used to check if a task's function is a Thumb function.
|
||||
/**
|
||||
* @brief Value used to check if a task's function is a Thumb function.
|
||||
* @ingroup Task Context
|
||||
*/
|
||||
#define portTHUMB_MODE_ADDRESS ( 0x01UL )
|
||||
|
||||
/** @brief Unsigned Data type equal to the data word operating size of the CPU.
|
||||
/**
|
||||
* @brief Unsigned Data type equal to the data word operating size of the CPU.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
|
|
@ -194,7 +181,8 @@ extern "C" {
|
|||
*/
|
||||
typedef uint32_t StackType_t;
|
||||
|
||||
/** @brief Signed Data type equal to the data word operating size of the CPU.
|
||||
/**
|
||||
* @brief Signed Data type equal to the data word operating size of the CPU.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
|
|
@ -204,7 +192,8 @@ typedef uint32_t StackType_t;
|
|||
*/
|
||||
typedef int32_t BaseType_t;
|
||||
|
||||
/** @brief Unsigned Data type equal to the data word operating size of the CPU.
|
||||
/**
|
||||
* @brief Unsigned Data type equal to the data word operating size of the CPU.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
|
|
@ -214,7 +203,8 @@ typedef int32_t BaseType_t;
|
|||
*/
|
||||
typedef uint32_t UBaseType_t;
|
||||
|
||||
/** @brief Integer type used for the Tick Counter
|
||||
/**
|
||||
* @brief Integer type used for the Tick Counter.
|
||||
*
|
||||
* @note
|
||||
* Use a 32-bit tick type on a 32-bit architecture, so reads of the tick count
|
||||
|
|
@ -222,21 +212,24 @@ typedef uint32_t UBaseType_t;
|
|||
*/
|
||||
typedef uint32_t TickType_t;
|
||||
|
||||
/** @brief Marks the direction the stack grows on the targeted CPU.
|
||||
/**
|
||||
* @brief Marks the direction the stack grows on the targeted CPU.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
*/
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
|
||||
/** @brief Specifies at what number of bytes a stack pointer shall be aligned.
|
||||
/**
|
||||
* @brief Specifies at what number of bytes a stack pointer shall be aligned.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
*/
|
||||
#define portBYTE_ALIGNMENT 8U
|
||||
|
||||
/** @brief Task function prototype macro as described on FreeRTOS.org
|
||||
/**
|
||||
* @brief Task function prototype macro as described on FreeRTOS.org.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
|
|
@ -247,7 +240,8 @@ typedef uint32_t TickType_t;
|
|||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) \
|
||||
void vFunction( void * pvParameters )
|
||||
|
||||
/** @brief Task function prototype macro as described on FreeRTOS.org
|
||||
/**
|
||||
* @brief Task function prototype macro as described on FreeRTOS.org.
|
||||
*
|
||||
* @ingroup Port Interface Specifications
|
||||
*
|
||||
|
|
@ -257,34 +251,40 @@ typedef uint32_t TickType_t;
|
|||
*/
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
|
||||
/** @brief Wrapper for the no-op ARM Assembly Instruction
|
||||
/**
|
||||
* @brief Wrapper for the no-op ARM Assembly Instruction.
|
||||
* @ingroup Port Interface Specifications
|
||||
*/
|
||||
#define portNOP() __asm volatile( "NOP" )
|
||||
|
||||
/** @brief Wrapper for the Inline GCC Label
|
||||
/**
|
||||
* @brief Wrapper for the Inline GCC Label.
|
||||
* @ingroup Port Interface Specifications
|
||||
*/
|
||||
#define portINLINE __inline
|
||||
|
||||
/** @brief Wrapper for the ARM Memory Sync Assembly Instruction
|
||||
/**
|
||||
* @brief Wrapper for the ARM Memory Sync Assembly Instruction.
|
||||
* @ingroup Port Interface Specifications
|
||||
*/
|
||||
#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )
|
||||
|
||||
/** @brief Defines if the system tick count can be accessed atomically
|
||||
/**
|
||||
* @brief Defines if the system tick count can be accessed atomically.
|
||||
*
|
||||
* @ingroup System Clock
|
||||
*/
|
||||
#define portTICK_TYPE_IS_ATOMIC 1
|
||||
|
||||
/** @brief Define the number of miliseconds between system ticks.
|
||||
/**
|
||||
* @brief Define the number of miliseconds between system ticks.
|
||||
*
|
||||
* @ingroup System Clock
|
||||
*/
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000UL / configTICK_RATE_HZ )
|
||||
|
||||
/** @brief Define the larges possible delay value for a task.
|
||||
/**
|
||||
* @brief Define the larges possible delay value for a task.
|
||||
*
|
||||
* @ingroup System Clock
|
||||
*/
|
||||
|
|
@ -292,7 +292,7 @@ typedef uint32_t TickType_t;
|
|||
|
||||
/* --------------------------- Port Assembly Handlers --------------------------- */
|
||||
|
||||
/** @brief Assembly FreeRTOS Supervisor Call Handler */
|
||||
/** @brief Assembly FreeRTOS Supervisor Call Handler. */
|
||||
void FreeRTOS_SVC_Handler( void );
|
||||
|
||||
/** @brief Assembly FreeRTOS Interrupt Handler */
|
||||
|
|
@ -300,7 +300,8 @@ void FreeRTOS_IRQ_Handler( void );
|
|||
|
||||
/* --------------------------- Port Assembly Functions --------------------------- */
|
||||
|
||||
/** @brief Make a Supervisor Call to swap the currently running task out.
|
||||
/**
|
||||
* @brief Make a Supervisor Call to swap the currently running task out.
|
||||
*
|
||||
* @ingroup Scheduler
|
||||
* @note The FreeRTOS-Kernel needs a method to swap the current task that is
|
||||
|
|
@ -314,7 +315,8 @@ void vPortYield( void );
|
|||
/** @brief Raise a Supervisor Call to swap the currently running task out. */
|
||||
#define portYIELD() vPortYield()
|
||||
|
||||
/** @brief Disable IRQs then increment the critical nesting count.
|
||||
/**
|
||||
* @brief Disable IRQs then increment the critical nesting count.
|
||||
* @ingroup Critical Section
|
||||
*/
|
||||
void vPortEnterCritical( void );
|
||||
|
|
@ -322,37 +324,44 @@ void vPortEnterCritical( void );
|
|||
/** @brief Enter a Critical Section inside of the FreeRTOS-Kernel */
|
||||
#define portENTER_CRITICAL() vPortEnterCritical()
|
||||
|
||||
/** @brief Enable IRQs and decrement the critical nesting count.
|
||||
/**
|
||||
* @brief Enable IRQs and decrement the critical nesting count.
|
||||
* @ingroup Critical Section
|
||||
*/
|
||||
void vPortExitCritical( void );
|
||||
|
||||
/** @brief Exit a Critical Section inside of the FreeRTOS-Kernel.
|
||||
/**
|
||||
* @brief Exit a Critical Section inside of the FreeRTOS-Kernel.
|
||||
* @ingroup Critical Section
|
||||
*/
|
||||
#define portEXIT_CRITICAL() vPortExitCritical()
|
||||
|
||||
/** @brief Set the IRQ bit of the CPSR high, enabling IRQs.
|
||||
/**
|
||||
* @brief Set the IRQ bit of the CPSR high, enabling IRQs.
|
||||
* @ingroup Interrupt Management
|
||||
*/
|
||||
void vPortEnableInterrupts( void );
|
||||
|
||||
/** @brief Enable Interrupts by setting the IRQ allowed flag on the CPU
|
||||
/**
|
||||
* @brief Enable Interrupts by setting the IRQ allowed flag on the CPU
|
||||
* @ingroup Interrupt Management
|
||||
*/
|
||||
#define portENABLE_INTERRUPTS() vPortEnableInterrupts()
|
||||
|
||||
/** @brief Set the IRQ bit of the CPSR low, disabling IRQs.
|
||||
/**
|
||||
* @brief Set the IRQ bit of the CPSR low, disabling IRQs.
|
||||
* @ingroup Interrupt Management
|
||||
*/
|
||||
void vPortDisableInterrupts( void );
|
||||
|
||||
/** @brief Enable Interrupts by lowering the IRQ allowed flag on the CPU.
|
||||
/**
|
||||
* @brief Enable Interrupts by lowering the IRQ allowed flag on the CPU.
|
||||
* @ingroup Interrupt Management
|
||||
*/
|
||||
#define portDISABLE_INTERRUPTS() vPortDisableInterrupts()
|
||||
|
||||
/** @brief Exit the FreeRTOS-Kernel, restoring the task's settings.
|
||||
/**
|
||||
* @brief Exit the FreeRTOS-Kernel, restoring the task's settings.
|
||||
*
|
||||
* @ingroup Port Privilege
|
||||
*
|
||||
|
|
@ -360,7 +369,8 @@ void vPortDisableInterrupts( void );
|
|||
*/
|
||||
void vPortSystemCallExit( void );
|
||||
|
||||
/** @brief Load the context of the first task.
|
||||
/**
|
||||
* @brief Load the context of the first task.
|
||||
*
|
||||
* @ingroup Scheduler
|
||||
*
|
||||
|
|
@ -369,23 +379,26 @@ void vPortSystemCallExit( void );
|
|||
*/
|
||||
void vPortStartFirstTask( void );
|
||||
|
||||
/** @brief Enable the onboard MPU
|
||||
/**
|
||||
* @brief Enable the onboard MPU.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void prvMPUEnable( void );
|
||||
void vMPUEnable( void );
|
||||
|
||||
/** @brief Disable the onboard MPU
|
||||
/**
|
||||
* @brief Disable the onboard MPU.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
* @return VOID
|
||||
*/
|
||||
void prvMPUDisable( void );
|
||||
void vMPUDisable( void );
|
||||
|
||||
/** @brief Assembly routine to set permissions for an MPU Region.
|
||||
/**
|
||||
* @brief Assembly routine to set permissions for an MPU Region.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -399,7 +412,7 @@ void prvMPUDisable( void );
|
|||
* provided values to the relevant MPU Registers. The inputs to this function
|
||||
* are checked internally before it is called in the port.c file.
|
||||
*/
|
||||
void prvMpuSetRegion(
|
||||
void vMPUSetRegion(
|
||||
uint32_t ulRegionNumber,
|
||||
uint32_t ulBaseAddress,
|
||||
uint32_t ulRegionSize,
|
||||
|
|
@ -408,7 +421,8 @@ void prvMpuSetRegion(
|
|||
|
||||
/* ----------------------------- Port C Functions ----------------------------- */
|
||||
|
||||
/** @brief Checks whether or not the processor is privileged.
|
||||
/**
|
||||
* @brief Checks whether or not the processor is privileged.
|
||||
*
|
||||
* @ingroup Port Privilege
|
||||
*
|
||||
|
|
@ -423,7 +437,8 @@ void prvMpuSetRegion(
|
|||
*/
|
||||
BaseType_t xPortIsPrivileged( void );
|
||||
|
||||
/** @brief Check if the CPU is currently in a privileged operating mode
|
||||
/**
|
||||
* @brief Check if the CPU is currently in a privileged operating mode.
|
||||
*
|
||||
* @ingroup Port Privilege
|
||||
*
|
||||
|
|
@ -434,7 +449,8 @@ BaseType_t xPortIsPrivileged( void );
|
|||
*/
|
||||
#define portIS_PRIVILEGED() xPortIsPrivileged()
|
||||
|
||||
/** @brief Check if ulTaskFlags has portTASK_IS_PRIVILEGED_FLAG.
|
||||
/**
|
||||
* @brief Check if ulTaskFlags has portTASK_IS_PRIVILEGED_FLAG.
|
||||
*
|
||||
* @ingroup Port Privilege
|
||||
*
|
||||
|
|
@ -448,7 +464,8 @@ BaseType_t xPortIsPrivileged( void );
|
|||
*/
|
||||
BaseType_t xPortIsTaskPrivileged( void );
|
||||
|
||||
/** @brief Checks whether or not the currently running task is privileged.
|
||||
/**
|
||||
* @brief Checks whether or not the currently running task is privileged.
|
||||
*
|
||||
* @ingroup Port Privilege
|
||||
*
|
||||
|
|
@ -458,10 +475,18 @@ BaseType_t xPortIsTaskPrivileged( void );
|
|||
*/
|
||||
#define portIS_TASK_PRIVILEGED() xPortIsTaskPrivileged()
|
||||
|
||||
/** @brief Default return to catch tasks incorrectly exiting their functions. */
|
||||
/**
|
||||
* @brief Default return address for tasks, it is not meant to be called.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
* @note This function is used as the default Link Register address if
|
||||
* configTASK_RETURN_ADDRESS is not defined in FreeRTOSConfig.h
|
||||
*
|
||||
*/
|
||||
void prvTaskExitError( void );
|
||||
|
||||
/** @brief User provided task return function.
|
||||
/**
|
||||
* @brief User provided task return function.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
*
|
||||
|
|
@ -475,7 +500,8 @@ void prvTaskExitError( void );
|
|||
#define configTASK_RETURN_ADDRESS prvTaskExitError
|
||||
#endif /* configTASK_RETURN_ADDRESS */
|
||||
|
||||
/** @brief Address of function a task should execute if it exits its assigned function.
|
||||
/**
|
||||
* @brief Address of function a task should execute if it exits its assigned function.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
*
|
||||
|
|
@ -484,16 +510,8 @@ void prvTaskExitError( void );
|
|||
*/
|
||||
#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS
|
||||
|
||||
/** @brief The lowest priority interrupt available on the CPU */
|
||||
#define portLOWEST_INTERRUPT_PRIORITY \
|
||||
( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL )
|
||||
|
||||
/** @brief The lowest priority interrupt that is usable by the system.
|
||||
* @ingroup Interrupt Management
|
||||
*/
|
||||
#define portLOWEST_USABLE_INTERRUPT_PRIORITY ( portLOWEST_INTERRUPT_PRIORITY - 1UL )
|
||||
|
||||
/** @brief Returns the number of leading zeros in a 32 bit variable.
|
||||
/**
|
||||
* @brief Returns the number of leading zeros in a 32 bit variable.
|
||||
*
|
||||
* @param[in] ulBitmap 32 Bit long number to count zeros of.
|
||||
*
|
||||
|
|
@ -503,7 +521,8 @@ UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
|
|||
|
||||
/* ------------------------- Port MPU Definitions ------------------------- */
|
||||
|
||||
/** @brief Mark that this port utilizes the onboard ARM MPU.
|
||||
/**
|
||||
* @brief Mark that this port utilizes the onboard ARM MPU.
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -514,7 +533,8 @@ UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
|
|||
*/
|
||||
#define portUSING_MPU_WRAPPERS 1
|
||||
|
||||
/** @brief Used to mark if a task should be created as a privileged task.
|
||||
/**
|
||||
* @brief Used to mark if a task should be created as a privileged task.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
* @ingroup MPU Control
|
||||
|
|
@ -525,24 +545,15 @@ UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
|
|||
*/
|
||||
#define portPRIVILEGE_BIT ( 0x80000000UL )
|
||||
|
||||
/** @brief Mark that a Task has Stack Frame Padding
|
||||
*
|
||||
* @ingroup Task Context
|
||||
*
|
||||
* @note Flags used for xMPU_SETTINGS.ulTaskFlags member to mark the stack frame is
|
||||
* padded. */
|
||||
#define portSTACK_FRAME_HAS_PADDING_FLAG ( 1UL << 0UL )
|
||||
|
||||
/** @brief Size of the System Call Buffer in the TCB
|
||||
* @ingroup Task Context
|
||||
*/
|
||||
/** @brief Size of the System Call Buffer in the TCB. */
|
||||
|
||||
#define portSYSTEM_CALL_STACK_SIZE configSYSTEM_CALL_STACK_SIZE
|
||||
|
||||
/* Size of an Access Control List (ACL) entry in bits. */
|
||||
#define portACL_ENTRY_SIZE_BITS ( 32U )
|
||||
#define portACL_ENTRY_SIZE_BITS ( 32UL )
|
||||
|
||||
/** @brief Structure to hold the MPU Register Values
|
||||
/**
|
||||
* @brief Structure to hold the MPU Register Values.
|
||||
* @struct xMPU_REGION_REGISTERS
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
|
|
@ -552,26 +563,30 @@ UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
|
|||
*/
|
||||
typedef struct MPU_REGION_REGISTERS
|
||||
{
|
||||
/** @brief Member used to hold the MPU register value for the Region Size
|
||||
/**
|
||||
* @brief Member used to hold the MPU register value for the Region Size.
|
||||
* @struct xMPU_REGION_REGISTERS
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
uint32_t ulRegionSize;
|
||||
|
||||
/** @brief Member used to hold the MPU register value for the Region Attributes
|
||||
/**
|
||||
* @brief Member used to hold the MPU register value for the Region Attributes.
|
||||
* @struct xMPU_REGION_REGISTERS
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
uint32_t ulRegionAttribute;
|
||||
|
||||
/** @brief Member used to hold the MPU register value for the Region Base Address.
|
||||
/**
|
||||
* @brief Member used to hold the MPU register value for the Region Base Address.
|
||||
* @struct xMPU_REGION_REGISTERS
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
uint32_t ulRegionBaseAddress;
|
||||
} xMPU_REGION_REGISTERS;
|
||||
|
||||
/** @brief Structure to hold per-task System Call Stack information
|
||||
/**
|
||||
* @brief Structure to hold per-task System Call Stack information.
|
||||
* @struct xSYSTEM_CALL_STACK_INFO
|
||||
*
|
||||
* @ingroup Port Privilege
|
||||
|
|
@ -581,41 +596,47 @@ typedef struct MPU_REGION_REGISTERS
|
|||
*/
|
||||
typedef struct SYSTEM_CALL_STACK_INFO
|
||||
{
|
||||
/** @brief Stack Pointer of the task when it made a FreeRTOS System Call
|
||||
/**
|
||||
* @brief Stack Pointer of the task when it made a FreeRTOS System Call.
|
||||
* @note This will point to the start of ulSystemCallStackBuffer[]
|
||||
* @struct xSYSTEM_CALL_STACK_INFO
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
uint32_t * pulTaskStackPointer;
|
||||
|
||||
/** @brief Link Register of the task when it made a FreeRTOS System Call
|
||||
/**
|
||||
* @brief Link Register of the task when it made a FreeRTOS System Call.
|
||||
* @struct xSYSTEM_CALL_STACK_INFO
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
uint32_t * pulLinkRegisterAtSystemCallEntry;
|
||||
|
||||
/** @brief Pre-Set Stack Pointer to use when making a FreeRTOS System Call
|
||||
/**
|
||||
* @brief Pre-Set Stack Pointer to use when making a FreeRTOS System Call.
|
||||
* @struct xSYSTEM_CALL_STACK_INFO
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
uint32_t * pulSystemCallStackPointer;
|
||||
|
||||
/** @brief Pre-Set Link Register to exit a FreeRTOS System Call
|
||||
* @note This value is set in pxPortInitialiseStack to ensure after making
|
||||
* a FreeRTOS System Call that the last LR jump is to vPortSystemCallExit()
|
||||
/**
|
||||
* @brief Pre-Set Link Register to exit a FreeRTOS System Call.
|
||||
* @struct xSYSTEM_CALL_STACK_INFO
|
||||
* @ingroup Port Privilege
|
||||
* @note This value is set in pxPortInitialiseStack() to ensure after making
|
||||
* a FreeRTOS System Call that the last LR jump is to vPortSystemCallExit()
|
||||
*/
|
||||
void * pulSystemCallLinkRegister;
|
||||
|
||||
/** @brief Buffer to be used when performing a FreeRTOS System Call
|
||||
/**
|
||||
* @brief Buffer to be used when performing a FreeRTOS System Call.
|
||||
* @struct xSYSTEM_CALL_STACK_INFO
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
uint32_t ulSystemCallStackBuffer[ configSYSTEM_CALL_STACK_SIZE ];
|
||||
} xSYSTEM_CALL_STACK_INFO;
|
||||
|
||||
/** @brief Per-Task MPU Settings structure stored in the TCB
|
||||
/**
|
||||
* @brief Per-Task MPU Settings structure stored in the TCB
|
||||
* @struct xMPU_SETTINGS
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
|
|
@ -627,29 +648,32 @@ typedef struct SYSTEM_CALL_STACK_INFO
|
|||
*/
|
||||
typedef struct MPU_SETTINGS
|
||||
{
|
||||
/** @brief Array of Per-Task MPU Register Values. Loaded on Task Context Restore
|
||||
/**
|
||||
* @brief Array of Per-Task MPU Register Values. Loaded on Task Context Restore.
|
||||
* @struct xMPU_SETTINGS
|
||||
*
|
||||
* @ingroup Task Context
|
||||
* @ingroup Port Privilege
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
xMPU_REGION_REGISTERS xRegion[ portTOTAL_NUM_REGIONS_IN_TCB ];
|
||||
|
||||
/** @brief Buffer that holds a Task's Context when being swapped out
|
||||
/**
|
||||
* @brief Buffer that holds a Task's Context when being swapped out.
|
||||
* @struct xMPU_SETTINGS
|
||||
* @ingroup Task Context
|
||||
*/
|
||||
uint32_t ulContext[ MAX_CONTEXT_SIZE ];
|
||||
|
||||
/** @brief Variable to hold FreeRTOS Privilege Settings
|
||||
/**
|
||||
* @brief Variable to hold FreeRTOS Privilege Settings.
|
||||
* @struct xMPU_SETTINGS
|
||||
* @ingroup Task Context
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
uint32_t ulTaskFlags;
|
||||
|
||||
/** @brief System Call Info structure that is stored in the TCB
|
||||
/**
|
||||
* @brief System Call Info structure that is stored in the TCB.
|
||||
* @struct xMPU_SETTINGS
|
||||
* @ingroup Task Context
|
||||
* @ingroup Port Privilege
|
||||
|
|
@ -658,7 +682,7 @@ typedef struct MPU_SETTINGS
|
|||
|
||||
#if( configENABLE_ACCESS_CONTROL_LIST == 1 )
|
||||
uint32_t ulAccessControlList
|
||||
[ ( configPROTECTED_KERNEL_OBJECT_POOL_SIZE / portACL_ENTRY_SIZE_BITS ) + 1 ];
|
||||
[ ( configPROTECTED_KERNEL_OBJECT_POOL_SIZE / portACL_ENTRY_SIZE_BITS ) + 1UL ];
|
||||
#endif
|
||||
} xMPU_SETTINGS;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ extern "C" {
|
|||
#define portMPU_TOTAL_REGIONS ( 16UL )
|
||||
#else
|
||||
#error "Set configTOTAL_MPU_REGIONS to the number of MPU regions in FreeRTOSConfig.h"
|
||||
#endif
|
||||
#endif /* configTOTAL_MPU_REGIONS */
|
||||
|
||||
/** On the ArmV7-R Architecture the Operating mode of the Processor is set using
|
||||
* the Current Program Status and Control Register (CPSR) Mode bits, [4:0]
|
||||
|
|
@ -58,67 +58,86 @@ extern "C" {
|
|||
*
|
||||
* */
|
||||
|
||||
/** @brief CPSR Mode bit field value for User Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for User Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define USER_MODE 0x10U
|
||||
|
||||
/** @brief CPSR Mode bit field value for Fast Interrupt Handler (FIQ) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Fast Interrupt Handler (FIQ) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define FIQ_MODE 0x11U
|
||||
|
||||
/** @brief CPSR Mode bit field value for Interrupt Handler (IRQ) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Interrupt Handler (IRQ) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define IRQ_MODE 0x12U
|
||||
|
||||
/** @brief CPSR Mode bit field value for Supervisor (SVC) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Supervisor (SVC) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define SVC_MODE 0x13U
|
||||
|
||||
/** @brief CPSR Mode bit field value for Monitor (MON) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Monitor (MON) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define MON_MODE 0x16U
|
||||
|
||||
/** @brief CPSR Mode bit field value for Abort (ABT) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Abort (ABT) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define ABT_MODE 0x17U
|
||||
|
||||
/** @brief CPSR Mode bit field value for Hypervisor (HYP) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Hypervisor (HYP) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define HYP_MODE 0x1AU
|
||||
|
||||
/** @brief CPSR Mode bit field value for Undefined (UND) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for Undefined (UND) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define UND_MODE 0x1BU
|
||||
|
||||
/** @brief CPSR Mode bit field value for System (SYS) Mode
|
||||
/**
|
||||
* @brief CPSR Mode bit field value for System (SYS) Mode.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define SYS_MODE 0x1FU
|
||||
|
||||
/** @brief Mark that a Task Stack has padding values added
|
||||
/**
|
||||
* @brief Used to mark if a task should be created as a privileged task.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
* @note This is done by performing a bitwise OR of this value and the task priority.
|
||||
* For example, to create a privileged task at priority 2 the uxPriority
|
||||
* parameter should be set to ( 2 | portPRIVILEGE_BIT ).
|
||||
*/
|
||||
#define portSTACK_FRAME_HAS_PADDING_FLAG ( 1UL << 0UL )
|
||||
#define portPRIVILEGE_BIT ( 0x80000000UL )
|
||||
|
||||
/** @brief Flag uses to mark that a FreeRTOS Task is privileged
|
||||
/**
|
||||
* @brief Flag uses to mark that a FreeRTOS Task is privileged.
|
||||
* @ingroup Port Privilege
|
||||
*/
|
||||
#define portTASK_IS_PRIVILEGED_FLAG ( 1UL << 1UL )
|
||||
|
||||
/** @brief SVC Number to use when requesting a context swap.
|
||||
/**
|
||||
* @brief SVC Number to use when requesting a context swap.
|
||||
* @ingroup Scheduler
|
||||
*/
|
||||
#define portSVC_YIELD 0x0100
|
||||
|
||||
/** @brief SVC Number to use when exiting a FreeRTOS System Call
|
||||
/**
|
||||
* @brief SVC Number to use when exiting a FreeRTOS System Call.
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
#define portSVC_SYSTEM_CALL_EXIT 0x0104
|
||||
|
|
@ -131,7 +150,7 @@ extern "C" {
|
|||
*
|
||||
*/
|
||||
|
||||
/* MPU Sub Region region */
|
||||
/* MPU Sub Region settings */
|
||||
#define portMPU_SUBREGION_0_DISABLE ( 0x1UL << 8UL )
|
||||
#define portMPU_SUBREGION_1_DISABLE ( 0x1UL << 9UL )
|
||||
#define portMPU_SUBREGION_2_DISABLE ( 0x1UL << 10UL )
|
||||
|
|
@ -184,126 +203,25 @@ extern "C" {
|
|||
#define portMPU_SIZE_2GB ( 0x1EUL << 1UL )
|
||||
#define portMPU_SIZE_4GB ( 0x1FUL << 1UL )
|
||||
|
||||
/** @brief Used to mark if a task should be created as a privileged task.
|
||||
*
|
||||
* @ingroup Task Context
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
* @note This is done by performing a bitwise OR of this value and the task priority.
|
||||
* For example, to create a privileged task at priority 2 the uxPriority
|
||||
* parameter should be set to ( 2 | portPRIVILEGE_BIT ).
|
||||
*/
|
||||
#define portPRIVILEGE_BIT ( 0x80000000UL )
|
||||
|
||||
/** @brief MPU Setting for a Strongly Ordered Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
/* MPU Device Memory Types */
|
||||
#define portMPU_REGION_STRONGLY_ORDERED ( 0x00UL )
|
||||
|
||||
/** @brief MPU Setting for a Strongly Ordered Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_REGION_DEVICE ( 0x01UL )
|
||||
|
||||
/** @brief MPU Setting for a Strongly Ordered Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_REGION_CACHEABLE_BUFFERABLE ( 0x03UL )
|
||||
|
||||
/** @brief MPU Setting for a Strongly Ordered Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_REGION_EXECUTE_NEVER ( 0x01UL << 12UL )
|
||||
|
||||
/** @brief MPU Setting for a Strongly Ordered and Shareable Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_STRONGLYORDERED_SHAREABLE ( 0x0000UL )
|
||||
|
||||
/** @brief MPU Setting for a Device and Shareable Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_DEVICE_SHAREABLE ( 0x0001UL )
|
||||
|
||||
/** @brief MPU Setting for a Device and Non-Shareable Memory Region
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_DEVICE_NONSHAREABLE ( 0x0010UL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Write-Through, No Write Allocate & Non
|
||||
* Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OIWTNOWA_NONSHARED ( 0x0002UL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Write-Back, No Write Allocate & Non
|
||||
* Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OIWBNOWA_NONSHARED ( 0x0003UL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Write-Through, no Write Allocate &
|
||||
* Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OIWTNOWA_SHARED ( 0x0006UL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Write-back, no Write Allocate & Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OIWBNOWA_SHARED ( 0x0007UL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Non-Cacheable & Non Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OINC_NONSHARED ( 0x0008UL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Write-Back, Write Allocate & Non Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OIWBWA_NONSHARED ( 0x000BUL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Non-Cacheable & Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OINC_SHARED ( 0x000CUL )
|
||||
|
||||
/** @brief MPU Setting for a Normal Outer & Inner Write-Back, Write Allocate & Shared
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
*/
|
||||
#define portMPU_NORMAL_OIWBWA_SHARED ( 0x000FUL )
|
||||
|
||||
/** @brief MPU_CTRL value for: No Access and No Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: No Access and No Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -313,7 +231,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_NA_USER_NA_NOEXEC ( 0x1000UL )
|
||||
|
||||
/** @brief MPU_CTRL value for Privileged Read and Exec
|
||||
/**
|
||||
* @brief MPU_CTRL value for Privileged Read and Exec
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -323,7 +242,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RO_USER_NA_EXEC ( 0x0500UL )
|
||||
|
||||
/** @brief MPU_CTRL value for Privileged Read, Write, and Exec
|
||||
/**
|
||||
* @brief MPU_CTRL value for Privileged Read, Write, and Exec
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -333,7 +253,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RW_USER_NA_EXEC ( 0x0100UL )
|
||||
|
||||
/** @brief MPU_CTRL value for Read Only and Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for Read Only and Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -343,7 +264,8 @@ extern "C" {
|
|||
* */
|
||||
#define portMPU_PRIV_RO_USER_RO_EXEC ( 0x0600UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: Read, Execute, and Privileged Write
|
||||
/**
|
||||
* @brief MPU_CTRL value for: Read, Execute, and Privileged Write
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -353,7 +275,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RW_USER_RO_EXEC ( 0x0200UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: Read, Write, and Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: Read, Write, and Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -363,7 +286,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RW_USER_RW_EXEC ( 0x0300UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: Privileged Read, Write Only, no Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: Privileged Read, Write Only, no Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -373,7 +297,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RW_USER_NA_NOEXEC ( 0x1100UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: All Read, Privileged Write, no Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: All Read, Privileged Write, no Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -383,7 +308,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RW_USER_RO_NOEXEC ( 0x1200UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: Read, Write, no Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: Read, Write, no Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -393,7 +319,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RW_USER_RW_NOEXEC ( 0x1300UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: Privileged Read Only, No Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: Privileged Read Only, No Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -403,7 +330,8 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RO_USER_NA_NOEXEC ( 0x1500UL )
|
||||
|
||||
/** @brief MPU_CTRL value for: Read Only, No Execute
|
||||
/**
|
||||
* @brief MPU_CTRL value for: Read Only, No Execute
|
||||
*
|
||||
* @ingroup MPU Control
|
||||
*
|
||||
|
|
@ -413,14 +341,12 @@ extern "C" {
|
|||
*/
|
||||
#define portMPU_PRIV_RO_USER_RO_NOEXEC ( 0x1600UL )
|
||||
|
||||
/** @brief MPU_CTRL value to enable an MPU Region
|
||||
/**
|
||||
* @brief MPU_CTRL value to enable an MPU Region
|
||||
* @ingroup MPU Control
|
||||
*/
|
||||
#define portMPU_REGION_ENABLE ( 0x01UL )
|
||||
|
||||
/** @brief The lowest priority interrupt that is usable by the system */
|
||||
#define portLOWEST_USABLE_INTERRUPT_PRIORITY ( portLOWEST_INTERRUPT_PRIORITY - 1UL )
|
||||
|
||||
/** This following section is used to create the proper size for the ulContext array.
|
||||
* This array is where all registers related to a task's context are saved.
|
||||
* The size of this array will depend on if the system is using an integrated
|
||||
|
|
@ -452,17 +378,15 @@ extern "C" {
|
|||
*
|
||||
*/
|
||||
|
||||
/** @brief The length in ulContext for the General Purpose Registers in bytes
|
||||
* @note There are 13 GPRs, R0-R12 each is 32 bits, so 13 registers * 4 Bytes each
|
||||
/**
|
||||
* @brief The length in ulContext for the General Purpose Registers in bytes.
|
||||
* @note There are 13 GPRs, R0-R12, the SP, and the LR. Each are 32 bits,
|
||||
* which leads to the 15 registers * 4 in length.
|
||||
*/
|
||||
#define portGPR_LENGTH ( 15U * 4U )
|
||||
#define portREGISTER_LENGTH ( 15U * 4U )
|
||||
|
||||
/** @brief The length in ulContext for all the registers in a context
|
||||
* @note There are the 13 GPRs, the Stack Pointer, and the Link Register
|
||||
*/
|
||||
#define portREGISTER_CONTEXT_LENGTH ( ( 16 * 4U ) )
|
||||
|
||||
/** If you KNOW that your system will not utilize the FPU in any capacity
|
||||
/**
|
||||
* If you KNOW that your system will not utilize the FPU in any capacity
|
||||
* you can set portENABLE_FPU to 0, which will reduce the per-task RAM usage
|
||||
* by ( 32 FPRs + 32 bit FPSCR ) * 4 bytes per register = 132, or 0x84, Bytes Per Task
|
||||
* BE CAREFUL DISABLING THIS: Certain APIs will try and optimize themselves
|
||||
|
|
@ -474,7 +398,8 @@ extern "C" {
|
|||
#define configENABLE_FPU 1
|
||||
#endif /* configENABLE_FPU */
|
||||
|
||||
/** @brief Mark if the Floating Point Registers will be saved.
|
||||
/**
|
||||
* @brief Mark if the Floating Point Registers will be saved.
|
||||
* @ingroup Task Context
|
||||
* @note When using the FPU, we must save additional registers into the task's context
|
||||
* These consist of the Floating Point Status and Control Register (FPSCR),
|
||||
|
|
@ -483,7 +408,8 @@ extern "C" {
|
|||
#define portENABLE_FPU configENABLE_FPU
|
||||
|
||||
#if( portENABLE_FPU == 1 )
|
||||
/** @brief Length of a Task's Register Context when using an FPU.
|
||||
/**
|
||||
* @brief Length of a Task's Register Context when using an FPU.
|
||||
* @ingroup Task Context
|
||||
* @note Task Context which is stored in ulContext in order, consists of:
|
||||
* ulContext[ 0 ]: Critical Nesting Count: ulCriticalNesting
|
||||
|
|
@ -497,7 +423,8 @@ extern "C" {
|
|||
*/
|
||||
#define MAX_CONTEXT_SIZE 51U
|
||||
#else
|
||||
/** @brief Length of a Task's Register Context when not using an FPU.
|
||||
/**
|
||||
* @brief Length of a Task's Register Context when not using an FPU.
|
||||
* @ingroup Task Context
|
||||
* @note Task Context which is stored in ulContext in order, consists of:
|
||||
* ulContext[ 0 ]: Critical Nesting Count: ulCriticalNesting
|
||||
|
|
@ -510,7 +437,8 @@ extern "C" {
|
|||
#define MAX_CONTEXT_SIZE 18U
|
||||
#endif /* MAX_CONTEXT_SIZE */
|
||||
|
||||
/** @brief Numerical offset from the start of a TCB to xSystemCallStackInfo
|
||||
/**
|
||||
* @brief Numerical offset from the start of a TCB to xSystemCallStackInfo.
|
||||
* @note In the exception handlers it is necessary to load this variable from the TCB.
|
||||
* This provides an easy way for the exception handlers to get this structure.
|
||||
* The numerical value here should be equal to:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue