Kernel optimisations.

This commit is contained in:
Richard Barry 2013-07-12 11:11:19 +00:00
parent c9d9bddc3c
commit ad8fa53043
5 changed files with 224 additions and 206 deletions

View file

@ -245,9 +245,8 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue )
{
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
taskENTER_CRITICAL();
@ -447,9 +446,8 @@ xQueueHandle xReturn = NULL;
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex )
{
portBASE_TYPE xReturn;
xQUEUE *pxMutex;
xQUEUE * const pxMutex = ( xQUEUE * ) xMutex;
pxMutex = ( xQUEUE * ) xMutex;
configASSERT( pxMutex );
/* If this is the task that holds the mutex then pxMutexHolder will not
@ -498,9 +496,8 @@ xQueueHandle xReturn = NULL;
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime )
{
portBASE_TYPE xReturn;
xQUEUE *pxMutex;
xQUEUE * const pxMutex = ( xQUEUE * ) xMutex;
pxMutex = ( xQUEUE * ) xMutex;
configASSERT( pxMutex );
/* Comments regarding mutual exclusion as per those within
@ -565,9 +562,8 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
{
signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
@ -724,9 +720,8 @@ xQUEUE *pxQueue;
{
signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
@ -804,9 +799,8 @@ xQUEUE *pxQueue;
signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut;
signed char *pcOriginalReadPosition;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
@ -825,7 +819,7 @@ xQUEUE *pxQueue;
{
traceQUEUE_RECEIVE( pxQueue );
/* We are actually removing data. */
/* Data is actually being removed (not just peeked). */
--( pxQueue->uxMessagesWaiting );
#if ( configUSE_MUTEXES == 1 )
@ -934,9 +928,8 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
{
signed portBASE_TYPE xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
@ -1048,9 +1041,8 @@ signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvB
signed portBASE_TYPE xEntryTimeSet = pdFALSE;
xTimeOutType xTimeOut;
signed char *pcOriginalReadPosition;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
@ -1199,9 +1191,8 @@ signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvB
{
signed portBASE_TYPE xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
@ -1276,9 +1267,8 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
signed portBASE_TYPE xReturn;
unsigned portBASE_TYPE uxSavedInterruptStatus;
signed char *pcOriginalReadPosition;
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );
@ -1353,9 +1343,8 @@ unsigned portBASE_TYPE uxReturn;
void vQueueDelete( xQueueHandle xQueue )
{
xQUEUE *pxQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
pxQueue = ( xQUEUE * ) xQueue;
configASSERT( pxQueue );
traceQUEUE_DELETE( pxQueue );
@ -1645,9 +1634,7 @@ signed portBASE_TYPE xReturn;
signed portBASE_TYPE xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait )
{
signed portBASE_TYPE xReturn;
xQUEUE *pxQueue;
pxQueue = ( xQUEUE * ) xQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/* If the queue is already full we may have to block. A critical section
is required to prevent an interrupt removing something from the queue
@ -1716,9 +1703,7 @@ signed portBASE_TYPE xReturn;
signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait )
{
signed portBASE_TYPE xReturn;
xQUEUE *pxQueue;
pxQueue = ( xQUEUE * ) xQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/* If the queue is already empty we may have to block. A critical section
is required to prevent an interrupt adding something to the queue
@ -1791,9 +1776,7 @@ signed portBASE_TYPE xReturn;
signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle xQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken )
{
xQUEUE *pxQueue;
pxQueue = ( xQUEUE * ) xQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/* Cannot block within an ISR so if there is no space on the queue then
exit without doing anything. */
@ -1826,9 +1809,7 @@ signed portBASE_TYPE xReturn;
signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxCoRoutineWoken )
{
signed portBASE_TYPE xReturn;
xQUEUE * pxQueue;
pxQueue = ( xQUEUE * ) xQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/* We cannot block from an ISR, so check there is data available. If
not then just leave without doing anything. */
@ -1917,9 +1898,7 @@ signed portBASE_TYPE xReturn;
void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait )
{
xQUEUE *pxQueue;
pxQueue = ( xQUEUE * ) xQueue;
xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
/* This function should not be called by application code hence the
'Restricted' in its name. It is not part of the public API. It is
@ -1999,9 +1978,7 @@ signed portBASE_TYPE xReturn;
portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
{
portBASE_TYPE xReturn;
xQUEUE *pxQueueOrSemaphore;
pxQueueOrSemaphore = ( xQUEUE * ) xQueueOrSemaphore;
xQUEUE * const pxQueueOrSemaphore = ( xQUEUE * ) xQueueOrSemaphore;
if( pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet )
{