Prepare for V6.

This commit is contained in:
Richard Barry 2009-09-29 20:11:12 +00:00
parent b7da8d7a1b
commit 6b7397ee92

View File

@ -47,10 +47,18 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers. That should only be done when
task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "croutine.h" #include "croutine.h"
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
/*----------------------------------------------------------- /*-----------------------------------------------------------
* PUBLIC LIST API documented in list.h * PUBLIC LIST API documented in list.h
*----------------------------------------------------------*/ *----------------------------------------------------------*/
@ -114,32 +122,32 @@ typedef xQUEUE * xQueueHandle;
* include the API header file (as it defines xQueueHandle differently). These * include the API header file (as it defines xQueueHandle differently). These
* functions are documented in the API header file. * functions are documented in the API header file.
*/ */
xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize ); xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize ) PRIVILEGED_FUNCTION;
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;
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle pxQueue ); unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
void vQueueDelete( xQueueHandle xQueue ); void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition ); signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ); signed portBASE_TYPE xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken ); signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken ) PRIVILEGED_FUNCTION;
xQueueHandle xQueueCreateMutex( void ); xQueueHandle xQueueCreateMutex( void ) PRIVILEGED_FUNCTION;
xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ); xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ) PRIVILEGED_FUNCTION;
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ); portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) PRIVILEGED_FUNCTION;
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex ); portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ); signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ); signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle pxQueue ); signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle pxQueue ); signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle pxQueue ); unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
/* /*
* Co-routine queue functions differ from task queue functions. Co-routines are * Co-routine queue functions differ from task queue functions. Co-routines are
* an optional component. * an optional component.
*/ */
#if configUSE_CO_ROUTINES == 1 #if configUSE_CO_ROUTINES == 1
signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken ); signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken ); signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueCRSend( xQueueHandle pxQueue, const void *pvItemToQueue, portTickType xTicksToWait ); signed portBASE_TYPE xQueueCRSend( xQueueHandle pxQueue, const void *pvItemToQueue, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
signed portBASE_TYPE xQueueCRReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait ); signed portBASE_TYPE xQueueCRReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
#endif #endif
/* /*
@ -164,8 +172,8 @@ unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle pxQueue
/* Removes a queue from the registry by simply setting the pcQueueName /* Removes a queue from the registry by simply setting the pcQueueName
member to NULL. */ member to NULL. */
static void vQueueUnregisterQueue( xQueueHandle xQueue ); static void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
void vQueueAddToRegistry( xQueueHandle xQueue, signed portCHAR *pcQueueName ); void vQueueAddToRegistry( xQueueHandle xQueue, signed portCHAR *pcQueueName ) PRIVILEGED_FUNCTION;
#endif #endif
/* /*
@ -176,32 +184,32 @@ unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle pxQueue
* to indicate that a task may require unblocking. When the queue in unlocked * to indicate that a task may require unblocking. When the queue in unlocked
* these lock counts are inspected, and the appropriate action taken. * these lock counts are inspected, and the appropriate action taken.
*/ */
static void prvUnlockQueue( xQueueHandle pxQueue ); static void prvUnlockQueue( xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
/* /*
* Uses a critical section to determine if there is any data in a queue. * Uses a critical section to determine if there is any data in a queue.
* *
* @return pdTRUE if the queue contains no items, otherwise pdFALSE. * @return pdTRUE if the queue contains no items, otherwise pdFALSE.
*/ */
static signed portBASE_TYPE prvIsQueueEmpty( const xQueueHandle pxQueue ); static signed portBASE_TYPE prvIsQueueEmpty( const xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
/* /*
* Uses a critical section to determine if there is any space in a queue. * Uses a critical section to determine if there is any space in a queue.
* *
* @return pdTRUE if there is no space, otherwise pdFALSE; * @return pdTRUE if there is no space, otherwise pdFALSE;
*/ */
static signed portBASE_TYPE prvIsQueueFull( const xQueueHandle pxQueue ); static signed portBASE_TYPE prvIsQueueFull( const xQueueHandle pxQueue ) PRIVILEGED_FUNCTION;
/* /*
* Copies an item into the queue, either at the front of the queue or the * Copies an item into the queue, either at the front of the queue or the
* back of the queue. * back of the queue.
*/ */
static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition ); static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition ) PRIVILEGED_FUNCTION;
/* /*
* Copies an item out of a queue. * Copies an item out of a queue.
*/ */
static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer ); static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer ) PRIVILEGED_FUNCTION;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
@ -264,7 +272,6 @@ size_t xQueueSizeInBytes;
vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) ); vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );
traceQUEUE_CREATE( pxNewQueue ); traceQUEUE_CREATE( pxNewQueue );
return pxNewQueue; return pxNewQueue;
} }
else else
@ -443,7 +450,6 @@ xTimeOutType xTimeOut;
/* This function relaxes the coding standard somewhat to allow return /* This function relaxes the coding standard somewhat to allow return
statements within the function itself. This is done in the interest statements within the function itself. This is done in the interest
of execution time efficiency. */ of execution time efficiency. */
for( ;; ) for( ;; )
{ {
taskENTER_CRITICAL(); taskENTER_CRITICAL();
@ -465,11 +471,14 @@ xTimeOutType xTimeOut;
our own so yield immediately. Yes it is ok to do our own so yield immediately. Yes it is ok to do
this from within the critical section - the kernel this from within the critical section - the kernel
takes care of that. */ takes care of that. */
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
/* Return to the original privilege level before exiting the
function. */
return pdPASS; return pdPASS;
} }
else else
@ -479,6 +488,9 @@ xTimeOutType xTimeOut;
/* The queue was full and no block time is specified (or /* The queue was full and no block time is specified (or
the block time has expired) so leave now. */ the block time has expired) so leave now. */
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
/* Return to the original privilege level before exiting
the function. */
traceQUEUE_SEND_FAILED( pxQueue ); traceQUEUE_SEND_FAILED( pxQueue );
return errQUEUE_FULL; return errQUEUE_FULL;
} }
@ -521,7 +533,7 @@ xTimeOutType xTimeOut;
is also a higher priority task in the pending ready list. */ is also a higher priority task in the pending ready list. */
if( !xTaskResumeAll() ) if( !xTaskResumeAll() )
{ {
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
else else
@ -536,6 +548,9 @@ xTimeOutType xTimeOut;
/* The timeout has expired. */ /* The timeout has expired. */
prvUnlockQueue( pxQueue ); prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll(); ( void ) xTaskResumeAll();
/* Return to the original privilege level before exiting the
function. */
traceQUEUE_SEND_FAILED( pxQueue ); traceQUEUE_SEND_FAILED( pxQueue );
return errQUEUE_FULL; return errQUEUE_FULL;
} }
@ -569,7 +584,7 @@ xTimeOutType xTimeOut;
{ {
/* The unblocked task has a priority higher than /* The unblocked task has a priority higher than
our own so yield immediately. */ our own so yield immediately. */
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
@ -600,7 +615,7 @@ xTimeOutType xTimeOut;
{ {
traceBLOCKING_ON_QUEUE_SEND( pxQueue ); traceBLOCKING_ON_QUEUE_SEND( pxQueue );
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait );
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
else else
@ -658,7 +673,7 @@ xTimeOutType xTimeOut;
{ {
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) == pdTRUE ) if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) == pdTRUE )
{ {
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
} }
@ -679,7 +694,7 @@ xTimeOutType xTimeOut;
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{ {
/* The task waiting has a higher priority than this task. */ /* The task waiting has a higher priority than this task. */
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
@ -725,7 +740,7 @@ xTimeOutType xTimeOut;
#endif #endif
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
else else
@ -841,7 +856,7 @@ signed portCHAR *pcOriginalReadPosition;
{ {
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) == pdTRUE ) if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) == pdTRUE )
{ {
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
} }
@ -862,7 +877,7 @@ signed portCHAR *pcOriginalReadPosition;
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{ {
/* The task waiting has a higher priority than this task. */ /* The task waiting has a higher priority than this task. */
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
@ -922,7 +937,7 @@ signed portCHAR *pcOriginalReadPosition;
prvUnlockQueue( pxQueue ); prvUnlockQueue( pxQueue );
if( !xTaskResumeAll() ) if( !xTaskResumeAll() )
{ {
taskYIELD(); portYIELD_WITHIN_API();
} }
} }
else else
@ -1437,6 +1452,7 @@ signed portBASE_TYPE xReturn;
break; break;
} }
} }
} }
#endif #endif