mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-06-06 12:29:03 -04:00
Ensure queue functions go into the privileged code section when the MPU version is in use.
Provide a default value for configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS. Revert prvQueueUnregisterQueue() back to a public function.
This commit is contained in:
parent
0f3ae55e5d
commit
29ca4f1b36
|
@ -576,6 +576,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define configUSE_TIME_SLICING 1
|
#define configUSE_TIME_SLICING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
|
||||||
|
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For backward compatability. */
|
/* For backward compatability. */
|
||||||
#define eTaskStateGet eTaskGetState
|
#define eTaskStateGet eTaskGetState
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ only for ports that are using the MPU. */
|
||||||
/* Ensure API functions go in the privileged execution section. */
|
/* Ensure API functions go in the privileged execution section. */
|
||||||
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
||||||
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
||||||
//#define PRIVILEGED_DATA
|
|
||||||
|
|
||||||
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ typedef void * xQueueSetMemberHandle;
|
||||||
* \defgroup xQueueSend xQueueSend
|
* \defgroup xQueueSend xQueueSend
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
|
signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -798,7 +798,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
||||||
* \defgroup xQueueReceive xQueueReceive
|
* \defgroup xQueueReceive xQueueReceive
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek );
|
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -813,7 +813,7 @@ signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvB
|
||||||
* \page uxQueueMessagesWaiting uxQueueMessagesWaiting
|
* \page uxQueueMessagesWaiting uxQueueMessagesWaiting
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );
|
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -827,7 +827,7 @@ unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );
|
||||||
* \page vQueueDelete vQueueDelete
|
* \page vQueueDelete vQueueDelete
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
void vQueueDelete( xQueueHandle xQueue );
|
void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -1120,7 +1120,7 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition );
|
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -1209,15 +1209,15 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
|
||||||
* \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
|
* \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken );
|
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utilities to query queues that are safe to use from an ISR. These utilities
|
* Utilities to query queues that are safe to use from an ISR. These utilities
|
||||||
* should be used only from witin an ISR, or within a critical section.
|
* should be used only from witin an ISR, or within a critical section.
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue );
|
signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue );
|
signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue );
|
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1260,16 +1260,16 @@ signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portT
|
||||||
* xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
|
* xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
|
||||||
* these functions directly.
|
* these functions directly.
|
||||||
*/
|
*/
|
||||||
xQueueHandle xQueueCreateMutex( unsigned char ucQueueType );
|
xQueueHandle xQueueCreateMutex( unsigned char ucQueueType ) PRIVILEGED_FUNCTION;
|
||||||
xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount );
|
xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ) PRIVILEGED_FUNCTION;
|
||||||
void* xQueueGetMutexHolder( xQueueHandle xSemaphore );
|
void* xQueueGetMutexHolder( xQueueHandle xSemaphore ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
||||||
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
|
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
|
||||||
*/
|
*/
|
||||||
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime );
|
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) PRIVILEGED_FUNCTION;
|
||||||
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex );
|
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset a queue back to its original empty state. pdPASS is returned if the
|
* Reset a queue back to its original empty state. pdPASS is returned if the
|
||||||
|
@ -1300,14 +1300,28 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex );
|
||||||
* name that the kernel aware debugger will display.
|
* name that the kernel aware debugger will display.
|
||||||
*/
|
*/
|
||||||
#if configQUEUE_REGISTRY_SIZE > 0U
|
#if configQUEUE_REGISTRY_SIZE > 0U
|
||||||
void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName );
|
void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The registry is provided as a means for kernel aware debuggers to
|
||||||
|
* locate queues, semaphores and mutexes. Call vQueueAddToRegistry() add
|
||||||
|
* a queue, semaphore or mutex handle to the registry if you want the handle
|
||||||
|
* to be available to a kernel aware debugger, and vQueueUnregisterQueue() to
|
||||||
|
* remove the queue, semaphore or mutex from the register. If you are not using
|
||||||
|
* a kernel aware debugger then this function can be ignored.
|
||||||
|
*
|
||||||
|
* @param xQueue The handle of the queue being removed from the registry.
|
||||||
|
*/
|
||||||
|
#if configQUEUE_REGISTRY_SIZE > 0U
|
||||||
|
void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic version of the queue creation function, which is in turn called by
|
* Generic version of the queue creation function, which is in turn called by
|
||||||
* any queue, semaphore or mutex creation function or macro.
|
* any queue, semaphore or mutex creation function or macro.
|
||||||
*/
|
*/
|
||||||
xQueueHandle xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType );
|
xQueueHandle xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Queue sets provide a mechanism to allow a task to block (pend) on a read
|
* Queue sets provide a mechanism to allow a task to block (pend) on a read
|
||||||
|
@ -1357,7 +1371,7 @@ xQueueHandle xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned
|
||||||
* @return If the queue set is created successfully then a handle to the created
|
* @return If the queue set is created successfully then a handle to the created
|
||||||
* queue set is returned. Otherwise NULL is returned.
|
* queue set is returned. Otherwise NULL is returned.
|
||||||
*/
|
*/
|
||||||
xQueueSetHandle xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength );
|
xQueueSetHandle xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adds a queue or semaphore to a queue set that was previously created by a
|
* Adds a queue or semaphore to a queue set that was previously created by a
|
||||||
|
@ -1381,7 +1395,7 @@ xQueueSetHandle xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength );
|
||||||
* queue set because it is already a member of a different queue set then pdFAIL
|
* queue set because it is already a member of a different queue set then pdFAIL
|
||||||
* is returned.
|
* is returned.
|
||||||
*/
|
*/
|
||||||
portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet );
|
portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Removes a queue or semaphore from a queue set. A queue or semaphore can only
|
* Removes a queue or semaphore from a queue set. A queue or semaphore can only
|
||||||
|
@ -1400,7 +1414,7 @@ portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSet
|
||||||
* then pdPASS is returned. If the queue was not in the queue set, or the
|
* then pdPASS is returned. If the queue was not in the queue set, or the
|
||||||
* queue (or semaphore) was not empty, then pdFAIL is returned.
|
* queue (or semaphore) was not empty, then pdFAIL is returned.
|
||||||
*/
|
*/
|
||||||
portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet );
|
portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xQueueSelectFromSet() selects from the members of a queue set a queue or
|
* xQueueSelectFromSet() selects from the members of a queue set a queue or
|
||||||
|
@ -1436,16 +1450,16 @@ portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQue
|
||||||
* in the queue set that is available, or NULL if no such queue or semaphore
|
* in the queue set that is available, or NULL if no such queue or semaphore
|
||||||
* exists before before the specified block time expires.
|
* exists before before the specified block time expires.
|
||||||
*/
|
*/
|
||||||
xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks );
|
xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A version of xQueueSelectFromSet() that can be used from an ISR.
|
* A version of xQueueSelectFromSet() that can be used from an ISR.
|
||||||
*/
|
*/
|
||||||
xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet );
|
xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* Not public API functions. */
|
/* Not public API functions. */
|
||||||
void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait );
|
void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue );
|
portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue ) PRIVILEGED_FUNCTION;
|
||||||
void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned char ucQueueNumber ) PRIVILEGED_FUNCTION;
|
void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned char ucQueueNumber ) PRIVILEGED_FUNCTION;
|
||||||
unsigned char ucQueueGetQueueType( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
unsigned char ucQueueGetQueueType( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
|
@ -1210,9 +1210,14 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
|
||||||
* Called from the real time kernel tick (either preemptive or cooperative),
|
* Called from the real time kernel tick (either preemptive or cooperative),
|
||||||
* this increments the tick count and checks if any tasks that are blocked
|
* this increments the tick count and checks if any tasks that are blocked
|
||||||
* for a finite period required removing from a blocked list and placing on
|
* for a finite period required removing from a blocked list and placing on
|
||||||
* a ready list.
|
* a ready list. If a non-zero value is returned then a context switch is
|
||||||
|
* required because either:
|
||||||
|
* + A task was removed from a blocked list because its timeout had expired,
|
||||||
|
* or
|
||||||
|
* + Time slicing is in use and there is a task of equal priority to the
|
||||||
|
* currently running task.
|
||||||
*/
|
*/
|
||||||
void vTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
|
portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||||
|
|
|
@ -163,10 +163,6 @@ typedef struct QueueDefinition
|
||||||
array position being vacant. */
|
array position being vacant. */
|
||||||
xQueueRegistryItem xQueueRegistry[ configQUEUE_REGISTRY_SIZE ];
|
xQueueRegistryItem xQueueRegistry[ configQUEUE_REGISTRY_SIZE ];
|
||||||
|
|
||||||
/* Removes a queue from the registry by simply setting the pcQueueName
|
|
||||||
member to NULL. */
|
|
||||||
static void prvQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
|
||||||
|
|
||||||
#endif /* configQUEUE_REGISTRY_SIZE */
|
#endif /* configQUEUE_REGISTRY_SIZE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -209,7 +205,7 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
|
||||||
* Checks to see if a queue is a member of a queue set, and if so, notifies
|
* Checks to see if a queue is a member of a queue set, and if so, notifies
|
||||||
* the queue set that the queue contains data.
|
* the queue set that the queue contains data.
|
||||||
*/
|
*/
|
||||||
static portBASE_TYPE prvNotifyQueueSetContainer( xQUEUE *pxQueue, portBASE_TYPE xCopyPosition );
|
static portBASE_TYPE prvNotifyQueueSetContainer( xQUEUE *pxQueue, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -1259,7 +1255,7 @@ xQUEUE *pxQueue;
|
||||||
traceQUEUE_DELETE( pxQueue );
|
traceQUEUE_DELETE( pxQueue );
|
||||||
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
||||||
{
|
{
|
||||||
prvQueueUnregisterQueue( pxQueue );
|
vQueueUnregisterQueue( pxQueue );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
vPortFree( pxQueue->pcHead );
|
vPortFree( pxQueue->pcHead );
|
||||||
|
@ -1778,7 +1774,7 @@ signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
||||||
|
|
||||||
static void prvQueueUnregisterQueue( xQueueHandle xQueue )
|
void vQueueUnregisterQueue( xQueueHandle xQueue )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE ux;
|
unsigned portBASE_TYPE ux;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue