mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Ignore FreeRToS in formatting
As its sensitive to import order
This commit is contained in:
@@ -32,11 +32,11 @@ SOURCE_DRIVERS_DIR = ./Core/Drivers
|
|||||||
INC_PD_DRIVERS_DIR = ./Core/Drivers/FUSB302
|
INC_PD_DRIVERS_DIR = ./Core/Drivers/FUSB302
|
||||||
SOURCE_MIDDLEWARES_DIR = ./Middlewares
|
SOURCE_MIDDLEWARES_DIR = ./Middlewares
|
||||||
# Find-all's used for formatting
|
# Find-all's used for formatting
|
||||||
ALL_INCLUDES = $(shell find ./ -type f -name '*.h') \
|
ALL_INCLUDES = $(shell find ./Core -type f -name '*.h') \
|
||||||
$(shell find ./ -type f -name '*.hpp')
|
$(shell find ./Core -type f -name '*.hpp')
|
||||||
|
|
||||||
ALL_SOURCE = $(shell find ./ -type f -name '*.c') \
|
ALL_SOURCE = $(shell find ./Core -type f -name '*.c') \
|
||||||
$(shell find ./ -type f -name '*.cpp')
|
$(shell find ./Core -type f -name '*.cpp')
|
||||||
# Device dependent settings
|
# Device dependent settings
|
||||||
ifeq ($(model),$(filter $(model),TS100 TS80 TS80P))
|
ifeq ($(model),$(filter $(model),TS100 TS80 TS80P))
|
||||||
$(info Building for Miniware )
|
$(info Building for Miniware )
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -25,37 +25,37 @@
|
|||||||
* 1 tab == 4 spaces!
|
* 1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "croutine.h"
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
#include "croutine.h"
|
||||||
|
|
||||||
/* Remove the whole file is co-routines are not being used. */
|
/* Remove the whole file is co-routines are not being used. */
|
||||||
#if (configUSE_CO_ROUTINES != 0)
|
#if( configUSE_CO_ROUTINES != 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some kernel aware debuggers require data to be viewed to be global, rather
|
* Some kernel aware debuggers require data to be viewed to be global, rather
|
||||||
* than file scope.
|
* than file scope.
|
||||||
*/
|
*/
|
||||||
#ifdef portREMOVE_STATIC_QUALIFIER
|
#ifdef portREMOVE_STATIC_QUALIFIER
|
||||||
#define static
|
#define static
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Lists for ready and blocked co-routines. --------------------*/
|
/* Lists for ready and blocked co-routines. --------------------*/
|
||||||
static List_t pxReadyCoRoutineLists[configMAX_CO_ROUTINE_PRIORITIES]; /*< Prioritised ready co-routines. */
|
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */
|
||||||
static List_t xDelayedCoRoutineList1; /*< Delayed co-routines. */
|
static List_t xDelayedCoRoutineList1; /*< Delayed co-routines. */
|
||||||
static List_t xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
|
static List_t xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
|
||||||
static List_t *pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */
|
static List_t * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */
|
||||||
static List_t *pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
|
static List_t * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
|
||||||
static List_t xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by
|
static List_t xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
|
||||||
interrupts. */
|
|
||||||
|
|
||||||
/* Other file private variables. --------------------------------*/
|
/* Other file private variables. --------------------------------*/
|
||||||
CRCB_t * pxCurrentCoRoutine = NULL;
|
CRCB_t * pxCurrentCoRoutine = NULL;
|
||||||
static UBaseType_t uxTopCoRoutineReadyPriority = 0;
|
static UBaseType_t uxTopCoRoutineReadyPriority = 0;
|
||||||
static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;
|
static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;
|
||||||
|
|
||||||
/* The initial state of the co-routine when it is created. */
|
/* The initial state of the co-routine when it is created. */
|
||||||
#define corINITIAL_STATE (0)
|
#define corINITIAL_STATE ( 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Place the co-routine represented by pxCRCB into the appropriate ready queue
|
* Place the co-routine represented by pxCRCB into the appropriate ready queue
|
||||||
@@ -64,19 +64,20 @@ static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0
|
|||||||
* This macro accesses the co-routine ready lists and therefore must not be
|
* This macro accesses the co-routine ready lists and therefore must not be
|
||||||
* used from within an ISR.
|
* used from within an ISR.
|
||||||
*/
|
*/
|
||||||
#define prvAddCoRoutineToReadyQueue(pxCRCB) \
|
#define prvAddCoRoutineToReadyQueue( pxCRCB ) \
|
||||||
{ \
|
{ \
|
||||||
if (pxCRCB->uxPriority > uxTopCoRoutineReadyPriority) { \
|
if( pxCRCB->uxPriority > uxTopCoRoutineReadyPriority ) \
|
||||||
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \
|
{ \
|
||||||
} \
|
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \
|
||||||
vListInsertEnd((List_t *)&(pxReadyCoRoutineLists[pxCRCB->uxPriority]), &(pxCRCB->xGenericListItem)); \
|
} \
|
||||||
}
|
vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utility to ready all the lists used by the scheduler. This is called
|
* Utility to ready all the lists used by the scheduler. This is called
|
||||||
* automatically upon the creation of the first co-routine.
|
* automatically upon the creation of the first co-routine.
|
||||||
*/
|
*/
|
||||||
static void prvInitialiseCoRoutineLists(void);
|
static void prvInitialiseCoRoutineLists( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Co-routines that are readied by an interrupt cannot be placed directly into
|
* Co-routines that are readied by an interrupt cannot be placed directly into
|
||||||
@@ -84,7 +85,7 @@ static void prvInitialiseCoRoutineLists(void);
|
|||||||
* in the pending ready list in order that they can later be moved to the ready
|
* in the pending ready list in order that they can later be moved to the ready
|
||||||
* list by the co-routine scheduler.
|
* list by the co-routine scheduler.
|
||||||
*/
|
*/
|
||||||
static void prvCheckPendingReadyList(void);
|
static void prvCheckPendingReadyList( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macro that looks at the list of co-routines that are currently delayed to
|
* Macro that looks at the list of co-routines that are currently delayed to
|
||||||
@@ -94,230 +95,259 @@ static void prvCheckPendingReadyList(void);
|
|||||||
* meaning once one co-routine has been found whose timer has not expired
|
* meaning once one co-routine has been found whose timer has not expired
|
||||||
* we need not look any further down the list.
|
* we need not look any further down the list.
|
||||||
*/
|
*/
|
||||||
static void prvCheckDelayedList(void);
|
static void prvCheckDelayedList( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
BaseType_t xCoRoutineCreate(crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex) {
|
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex )
|
||||||
BaseType_t xReturn;
|
{
|
||||||
CRCB_t * pxCoRoutine;
|
BaseType_t xReturn;
|
||||||
|
CRCB_t *pxCoRoutine;
|
||||||
|
|
||||||
/* Allocate the memory that will store the co-routine control block. */
|
/* Allocate the memory that will store the co-routine control block. */
|
||||||
pxCoRoutine = (CRCB_t *)pvPortMalloc(sizeof(CRCB_t));
|
pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );
|
||||||
if (pxCoRoutine) {
|
if( pxCoRoutine )
|
||||||
/* If pxCurrentCoRoutine is NULL then this is the first co-routine to
|
{
|
||||||
be created and the co-routine data structures need initialising. */
|
/* If pxCurrentCoRoutine is NULL then this is the first co-routine to
|
||||||
if (pxCurrentCoRoutine == NULL) {
|
be created and the co-routine data structures need initialising. */
|
||||||
pxCurrentCoRoutine = pxCoRoutine;
|
if( pxCurrentCoRoutine == NULL )
|
||||||
prvInitialiseCoRoutineLists();
|
{
|
||||||
}
|
pxCurrentCoRoutine = pxCoRoutine;
|
||||||
|
prvInitialiseCoRoutineLists();
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the priority is within limits. */
|
/* Check the priority is within limits. */
|
||||||
if (uxPriority >= configMAX_CO_ROUTINE_PRIORITIES) {
|
if( uxPriority >= configMAX_CO_ROUTINE_PRIORITIES )
|
||||||
uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1;
|
{
|
||||||
}
|
uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fill out the co-routine control block from the function parameters. */
|
/* Fill out the co-routine control block from the function parameters. */
|
||||||
pxCoRoutine->uxState = corINITIAL_STATE;
|
pxCoRoutine->uxState = corINITIAL_STATE;
|
||||||
pxCoRoutine->uxPriority = uxPriority;
|
pxCoRoutine->uxPriority = uxPriority;
|
||||||
pxCoRoutine->uxIndex = uxIndex;
|
pxCoRoutine->uxIndex = uxIndex;
|
||||||
pxCoRoutine->pxCoRoutineFunction = pxCoRoutineCode;
|
pxCoRoutine->pxCoRoutineFunction = pxCoRoutineCode;
|
||||||
|
|
||||||
/* Initialise all the other co-routine control block parameters. */
|
/* Initialise all the other co-routine control block parameters. */
|
||||||
vListInitialiseItem(&(pxCoRoutine->xGenericListItem));
|
vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) );
|
||||||
vListInitialiseItem(&(pxCoRoutine->xEventListItem));
|
vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );
|
||||||
|
|
||||||
/* Set the co-routine control block as a link back from the ListItem_t.
|
/* Set the co-routine control block as a link back from the ListItem_t.
|
||||||
This is so we can get back to the containing CRCB from a generic item
|
This is so we can get back to the containing CRCB from a generic item
|
||||||
in a list. */
|
in a list. */
|
||||||
listSET_LIST_ITEM_OWNER(&(pxCoRoutine->xGenericListItem), pxCoRoutine);
|
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );
|
||||||
listSET_LIST_ITEM_OWNER(&(pxCoRoutine->xEventListItem), pxCoRoutine);
|
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
|
||||||
|
|
||||||
/* Event lists are always in priority order. */
|
/* Event lists are always in priority order. */
|
||||||
listSET_LIST_ITEM_VALUE(&(pxCoRoutine->xEventListItem), ((TickType_t)configMAX_CO_ROUTINE_PRIORITIES - (TickType_t)uxPriority));
|
listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( TickType_t ) configMAX_CO_ROUTINE_PRIORITIES - ( TickType_t ) uxPriority ) );
|
||||||
|
|
||||||
/* Now the co-routine has been initialised it can be added to the ready
|
/* Now the co-routine has been initialised it can be added to the ready
|
||||||
list at the correct priority. */
|
list at the correct priority. */
|
||||||
prvAddCoRoutineToReadyQueue(pxCoRoutine);
|
prvAddCoRoutineToReadyQueue( pxCoRoutine );
|
||||||
|
|
||||||
xReturn = pdPASS;
|
xReturn = pdPASS;
|
||||||
} else {
|
}
|
||||||
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
else
|
||||||
}
|
{
|
||||||
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vCoRoutineAddToDelayedList(TickType_t xTicksToDelay, List_t *pxEventList) {
|
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList )
|
||||||
TickType_t xTimeToWake;
|
{
|
||||||
|
TickType_t xTimeToWake;
|
||||||
|
|
||||||
/* Calculate the time to wake - this may overflow but this is
|
/* Calculate the time to wake - this may overflow but this is
|
||||||
not a problem. */
|
not a problem. */
|
||||||
xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
|
xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
|
||||||
|
|
||||||
/* We must remove ourselves from the ready list before adding
|
/* We must remove ourselves from the ready list before adding
|
||||||
ourselves to the blocked list as the same list item is used for
|
ourselves to the blocked list as the same list item is used for
|
||||||
both lists. */
|
both lists. */
|
||||||
(void)uxListRemove((ListItem_t *)&(pxCurrentCoRoutine->xGenericListItem));
|
( void ) uxListRemove( ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||||
|
|
||||||
/* The list item will be inserted in wake time order. */
|
/* The list item will be inserted in wake time order. */
|
||||||
listSET_LIST_ITEM_VALUE(&(pxCurrentCoRoutine->xGenericListItem), xTimeToWake);
|
listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
|
||||||
|
|
||||||
if (xTimeToWake < xCoRoutineTickCount) {
|
if( xTimeToWake < xCoRoutineTickCount )
|
||||||
/* Wake time has overflowed. Place this item in the
|
{
|
||||||
overflow list. */
|
/* Wake time has overflowed. Place this item in the
|
||||||
vListInsert((List_t *)pxOverflowDelayedCoRoutineList, (ListItem_t *)&(pxCurrentCoRoutine->xGenericListItem));
|
overflow list. */
|
||||||
} else {
|
vListInsert( ( List_t * ) pxOverflowDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||||
/* The wake time has not overflowed, so we can use the
|
}
|
||||||
current block list. */
|
else
|
||||||
vListInsert((List_t *)pxDelayedCoRoutineList, (ListItem_t *)&(pxCurrentCoRoutine->xGenericListItem));
|
{
|
||||||
}
|
/* The wake time has not overflowed, so we can use the
|
||||||
|
current block list. */
|
||||||
|
vListInsert( ( List_t * ) pxDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||||
|
}
|
||||||
|
|
||||||
if (pxEventList) {
|
if( pxEventList )
|
||||||
/* Also add the co-routine to an event list. If this is done then the
|
{
|
||||||
function must be called with interrupts disabled. */
|
/* Also add the co-routine to an event list. If this is done then the
|
||||||
vListInsert(pxEventList, &(pxCurrentCoRoutine->xEventListItem));
|
function must be called with interrupts disabled. */
|
||||||
}
|
vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvCheckPendingReadyList(void) {
|
static void prvCheckPendingReadyList( void )
|
||||||
/* Are there any co-routines waiting to get moved to the ready list? These
|
{
|
||||||
are co-routines that have been readied by an ISR. The ISR cannot access
|
/* Are there any co-routines waiting to get moved to the ready list? These
|
||||||
the ready lists itself. */
|
are co-routines that have been readied by an ISR. The ISR cannot access
|
||||||
while (listLIST_IS_EMPTY(&xPendingReadyCoRoutineList) == pdFALSE) {
|
the ready lists itself. */
|
||||||
CRCB_t *pxUnblockedCRCB;
|
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )
|
||||||
|
{
|
||||||
|
CRCB_t *pxUnblockedCRCB;
|
||||||
|
|
||||||
/* The pending ready list can be accessed by an ISR. */
|
/* The pending ready list can be accessed by an ISR. */
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
{
|
{
|
||||||
pxUnblockedCRCB = (CRCB_t *)listGET_OWNER_OF_HEAD_ENTRY((&xPendingReadyCoRoutineList));
|
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
|
||||||
(void)uxListRemove(&(pxUnblockedCRCB->xEventListItem));
|
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
portENABLE_INTERRUPTS();
|
portENABLE_INTERRUPTS();
|
||||||
|
|
||||||
(void)uxListRemove(&(pxUnblockedCRCB->xGenericListItem));
|
( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
|
||||||
prvAddCoRoutineToReadyQueue(pxUnblockedCRCB);
|
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvCheckDelayedList(void) {
|
static void prvCheckDelayedList( void )
|
||||||
CRCB_t *pxCRCB;
|
{
|
||||||
|
CRCB_t *pxCRCB;
|
||||||
|
|
||||||
xPassedTicks = xTaskGetTickCount() - xLastTickCount;
|
xPassedTicks = xTaskGetTickCount() - xLastTickCount;
|
||||||
while (xPassedTicks) {
|
while( xPassedTicks )
|
||||||
xCoRoutineTickCount++;
|
{
|
||||||
xPassedTicks--;
|
xCoRoutineTickCount++;
|
||||||
|
xPassedTicks--;
|
||||||
|
|
||||||
/* If the tick count has overflowed we need to swap the ready lists. */
|
/* If the tick count has overflowed we need to swap the ready lists. */
|
||||||
if (xCoRoutineTickCount == 0) {
|
if( xCoRoutineTickCount == 0 )
|
||||||
List_t *pxTemp;
|
{
|
||||||
|
List_t * pxTemp;
|
||||||
|
|
||||||
/* Tick count has overflowed so we need to swap the delay lists. If there are
|
/* Tick count has overflowed so we need to swap the delay lists. If there are
|
||||||
any items in pxDelayedCoRoutineList here then there is an error! */
|
any items in pxDelayedCoRoutineList here then there is an error! */
|
||||||
pxTemp = pxDelayedCoRoutineList;
|
pxTemp = pxDelayedCoRoutineList;
|
||||||
pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
|
pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
|
||||||
pxOverflowDelayedCoRoutineList = pxTemp;
|
pxOverflowDelayedCoRoutineList = pxTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if this tick has made a timeout expire. */
|
/* See if this tick has made a timeout expire. */
|
||||||
while (listLIST_IS_EMPTY(pxDelayedCoRoutineList) == pdFALSE) {
|
while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )
|
||||||
pxCRCB = (CRCB_t *)listGET_OWNER_OF_HEAD_ENTRY(pxDelayedCoRoutineList);
|
{
|
||||||
|
pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
|
||||||
|
|
||||||
if (xCoRoutineTickCount < listGET_LIST_ITEM_VALUE(&(pxCRCB->xGenericListItem))) {
|
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
|
||||||
/* Timeout not yet expired. */
|
{
|
||||||
break;
|
/* Timeout not yet expired. */
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
{
|
{
|
||||||
/* The event could have occurred just before this critical
|
/* The event could have occurred just before this critical
|
||||||
section. If this is the case then the generic list item will
|
section. If this is the case then the generic list item will
|
||||||
have been moved to the pending ready list and the following
|
have been moved to the pending ready list and the following
|
||||||
line is still valid. Also the pvContainer parameter will have
|
line is still valid. Also the pvContainer parameter will have
|
||||||
been set to NULL so the following lines are also valid. */
|
been set to NULL so the following lines are also valid. */
|
||||||
(void)uxListRemove(&(pxCRCB->xGenericListItem));
|
( void ) uxListRemove( &( pxCRCB->xGenericListItem ) );
|
||||||
|
|
||||||
/* Is the co-routine waiting on an event also? */
|
/* Is the co-routine waiting on an event also? */
|
||||||
if (pxCRCB->xEventListItem.pxContainer) {
|
if( pxCRCB->xEventListItem.pxContainer )
|
||||||
(void)uxListRemove(&(pxCRCB->xEventListItem));
|
{
|
||||||
}
|
( void ) uxListRemove( &( pxCRCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
portENABLE_INTERRUPTS();
|
}
|
||||||
|
portENABLE_INTERRUPTS();
|
||||||
|
|
||||||
prvAddCoRoutineToReadyQueue(pxCRCB);
|
prvAddCoRoutineToReadyQueue( pxCRCB );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xLastTickCount = xCoRoutineTickCount;
|
xLastTickCount = xCoRoutineTickCount;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vCoRoutineSchedule(void) {
|
void vCoRoutineSchedule( void )
|
||||||
/* See if any co-routines readied by events need moving to the ready lists. */
|
{
|
||||||
prvCheckPendingReadyList();
|
/* See if any co-routines readied by events need moving to the ready lists. */
|
||||||
|
prvCheckPendingReadyList();
|
||||||
|
|
||||||
/* See if any delayed co-routines have timed out. */
|
/* See if any delayed co-routines have timed out. */
|
||||||
prvCheckDelayedList();
|
prvCheckDelayedList();
|
||||||
|
|
||||||
/* Find the highest priority queue that contains ready co-routines. */
|
/* Find the highest priority queue that contains ready co-routines. */
|
||||||
while (listLIST_IS_EMPTY(&(pxReadyCoRoutineLists[uxTopCoRoutineReadyPriority]))) {
|
while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
|
||||||
if (uxTopCoRoutineReadyPriority == 0) {
|
{
|
||||||
/* No more co-routines to check. */
|
if( uxTopCoRoutineReadyPriority == 0 )
|
||||||
return;
|
{
|
||||||
}
|
/* No more co-routines to check. */
|
||||||
--uxTopCoRoutineReadyPriority;
|
return;
|
||||||
}
|
}
|
||||||
|
--uxTopCoRoutineReadyPriority;
|
||||||
|
}
|
||||||
|
|
||||||
/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
|
/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
|
||||||
of the same priority get an equal share of the processor time. */
|
of the same priority get an equal share of the processor time. */
|
||||||
listGET_OWNER_OF_NEXT_ENTRY(pxCurrentCoRoutine, &(pxReadyCoRoutineLists[uxTopCoRoutineReadyPriority]));
|
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
|
||||||
|
|
||||||
/* Call the co-routine. */
|
/* Call the co-routine. */
|
||||||
(pxCurrentCoRoutine->pxCoRoutineFunction)(pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex);
|
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvInitialiseCoRoutineLists(void) {
|
static void prvInitialiseCoRoutineLists( void )
|
||||||
UBaseType_t uxPriority;
|
{
|
||||||
|
UBaseType_t uxPriority;
|
||||||
|
|
||||||
for (uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++) {
|
for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ )
|
||||||
vListInitialise((List_t *)&(pxReadyCoRoutineLists[uxPriority]));
|
{
|
||||||
}
|
vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );
|
||||||
|
}
|
||||||
|
|
||||||
vListInitialise((List_t *)&xDelayedCoRoutineList1);
|
vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 );
|
||||||
vListInitialise((List_t *)&xDelayedCoRoutineList2);
|
vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 );
|
||||||
vListInitialise((List_t *)&xPendingReadyCoRoutineList);
|
vListInitialise( ( List_t * ) &xPendingReadyCoRoutineList );
|
||||||
|
|
||||||
/* Start with pxDelayedCoRoutineList using list1 and the
|
/* Start with pxDelayedCoRoutineList using list1 and the
|
||||||
pxOverflowDelayedCoRoutineList using list2. */
|
pxOverflowDelayedCoRoutineList using list2. */
|
||||||
pxDelayedCoRoutineList = &xDelayedCoRoutineList1;
|
pxDelayedCoRoutineList = &xDelayedCoRoutineList1;
|
||||||
pxOverflowDelayedCoRoutineList = &xDelayedCoRoutineList2;
|
pxOverflowDelayedCoRoutineList = &xDelayedCoRoutineList2;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
BaseType_t xCoRoutineRemoveFromEventList(const List_t *pxEventList) {
|
BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList )
|
||||||
CRCB_t * pxUnblockedCRCB;
|
{
|
||||||
BaseType_t xReturn;
|
CRCB_t *pxUnblockedCRCB;
|
||||||
|
BaseType_t xReturn;
|
||||||
|
|
||||||
/* This function is called from within an interrupt. It can only access
|
/* This function is called from within an interrupt. It can only access
|
||||||
event lists and the pending ready list. This function assumes that a
|
event lists and the pending ready list. This function assumes that a
|
||||||
check has already been made to ensure pxEventList is not empty. */
|
check has already been made to ensure pxEventList is not empty. */
|
||||||
pxUnblockedCRCB = (CRCB_t *)listGET_OWNER_OF_HEAD_ENTRY(pxEventList);
|
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
||||||
(void)uxListRemove(&(pxUnblockedCRCB->xEventListItem));
|
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||||
vListInsertEnd((List_t *)&(xPendingReadyCoRoutineList), &(pxUnblockedCRCB->xEventListItem));
|
vListInsertEnd( ( List_t * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );
|
||||||
|
|
||||||
if (pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority) {
|
if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )
|
||||||
xReturn = pdTRUE;
|
{
|
||||||
} else {
|
xReturn = pdTRUE;
|
||||||
xReturn = pdFALSE;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
xReturn = pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* configUSE_CO_ROUTINES == 0 */
|
#endif /* configUSE_CO_ROUTINES == 0 */
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@
|
|||||||
#define STACK_MACROS_H
|
#define STACK_MACROS_H
|
||||||
|
|
||||||
#ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
|
#ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
|
||||||
#warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released.
|
#warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,73 +48,86 @@
|
|||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW == 1) && (portSTACK_GROWTH < 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if (pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack) { \
|
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
{ \
|
||||||
} \
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
}
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW == 1) && (portSTACK_GROWTH > 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
\
|
\
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if (pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack) { \
|
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
{ \
|
||||||
} \
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
}
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW > 1) && (portSTACK_GROWTH < 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
const uint32_t *const pulStack = (uint32_t *)pxCurrentTCB->pxStack; \
|
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
||||||
const uint32_t ulCheckValue = (uint32_t)0xa5a5a5a5; \
|
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
|
||||||
\
|
\
|
||||||
if ((pulStack[0] != ulCheckValue) || (pulStack[1] != ulCheckValue) || (pulStack[2] != ulCheckValue) || (pulStack[3] != ulCheckValue)) { \
|
if( ( pulStack[ 0 ] != ulCheckValue ) || \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
( pulStack[ 1 ] != ulCheckValue ) || \
|
||||||
} \
|
( pulStack[ 2 ] != ulCheckValue ) || \
|
||||||
}
|
( pulStack[ 3 ] != ulCheckValue ) ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW > 1) && (portSTACK_GROWTH > 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
int8_t * pcEndOfStack = (int8_t *)pxCurrentTCB->pxEndOfStack; \
|
int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
||||||
static const uint8_t ucExpectedStackBytes[] = {tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE}; \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
\
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
pcEndOfStack -= sizeof(ucExpectedStackBytes); \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
||||||
\
|
\
|
||||||
/* Has the extremity of the task stack ever been written over? */ \
|
\
|
||||||
if (memcmp((void *)pcEndOfStack, (void *)ucExpectedStackBytes, sizeof(ucExpectedStackBytes)) != 0) { \
|
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
\
|
||||||
} \
|
/* Has the extremity of the task stack ever been written over? */ \
|
||||||
}
|
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Remove stack overflow macro if not being used. */
|
/* Remove stack overflow macro if not being used. */
|
||||||
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW()
|
#define taskCHECK_FOR_STACK_OVERFLOW()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* STACK_MACROS_H */
|
#endif /* STACK_MACROS_H */
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#define ATOMIC_H
|
#define ATOMIC_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include atomic.h"
|
#error "include FreeRTOS.h must appear in source files before include atomic.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
@@ -56,18 +56,20 @@ extern "C" {
|
|||||||
* ATOMIC_ENTER_CRITICAL().
|
* ATOMIC_ENTER_CRITICAL().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#if defined(portSET_INTERRUPT_MASK_FROM_ISR)
|
#if defined( portSET_INTERRUPT_MASK_FROM_ISR )
|
||||||
|
|
||||||
/* Nested interrupt scheme is supported in this port. */
|
/* Nested interrupt scheme is supported in this port. */
|
||||||
#define ATOMIC_ENTER_CRITICAL() UBaseType_t uxCriticalSectionType = portSET_INTERRUPT_MASK_FROM_ISR()
|
#define ATOMIC_ENTER_CRITICAL() \
|
||||||
|
UBaseType_t uxCriticalSectionType = portSET_INTERRUPT_MASK_FROM_ISR()
|
||||||
|
|
||||||
#define ATOMIC_EXIT_CRITICAL() portCLEAR_INTERRUPT_MASK_FROM_ISR(uxCriticalSectionType)
|
#define ATOMIC_EXIT_CRITICAL() \
|
||||||
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxCriticalSectionType )
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Nested interrupt scheme is NOT supported in this port. */
|
/* Nested interrupt scheme is NOT supported in this port. */
|
||||||
#define ATOMIC_ENTER_CRITICAL() portENTER_CRITICAL()
|
#define ATOMIC_ENTER_CRITICAL() portENTER_CRITICAL()
|
||||||
#define ATOMIC_EXIT_CRITICAL() portEXIT_CRITICAL()
|
#define ATOMIC_EXIT_CRITICAL() portEXIT_CRITICAL()
|
||||||
|
|
||||||
#endif /* portSET_INTERRUPT_MASK_FROM_ISR() */
|
#endif /* portSET_INTERRUPT_MASK_FROM_ISR() */
|
||||||
|
|
||||||
@@ -79,11 +81,11 @@ extern "C" {
|
|||||||
* instead of resulting error, simply define it away.
|
* instead of resulting error, simply define it away.
|
||||||
*/
|
*/
|
||||||
#ifndef portFORCE_INLINE
|
#ifndef portFORCE_INLINE
|
||||||
#define portFORCE_INLINE
|
#define portFORCE_INLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U /**< Compare and swap succeeded, swapped. */
|
#define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U /**< Compare and swap succeeded, swapped. */
|
||||||
#define ATOMIC_COMPARE_AND_SWAP_FAILURE 0x0U /**< Compare and swap failed, did not swap. */
|
#define ATOMIC_COMPARE_AND_SWAP_FAILURE 0x0U /**< Compare and swap failed, did not swap. */
|
||||||
|
|
||||||
/*----------------------------- Swap && CAS ------------------------------*/
|
/*----------------------------- Swap && CAS ------------------------------*/
|
||||||
|
|
||||||
@@ -102,21 +104,27 @@ extern "C" {
|
|||||||
* @note This function only swaps *pulDestination with ulExchange, if previous
|
* @note This function only swaps *pulDestination with ulExchange, if previous
|
||||||
* *pulDestination value equals ulComparand.
|
* *pulDestination value equals ulComparand.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32(uint32_t volatile *pulDestination, uint32_t ulExchange, uint32_t ulComparand) {
|
static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32( uint32_t volatile * pulDestination,
|
||||||
uint32_t ulReturnValue;
|
uint32_t ulExchange,
|
||||||
|
uint32_t ulComparand )
|
||||||
|
{
|
||||||
|
uint32_t ulReturnValue;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if (*pulDestination == ulComparand) {
|
if( *pulDestination == ulComparand )
|
||||||
*pulDestination = ulExchange;
|
{
|
||||||
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS;
|
*pulDestination = ulExchange;
|
||||||
} else {
|
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS;
|
||||||
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulReturnValue;
|
return ulReturnValue;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -132,17 +140,19 @@ static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32(uint32_t volatile *pu
|
|||||||
*
|
*
|
||||||
* @return The initial value of *ppvDestination.
|
* @return The initial value of *ppvDestination.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE void *Atomic_SwapPointers_p32(void *volatile *ppvDestination, void *pvExchange) {
|
static portFORCE_INLINE void * Atomic_SwapPointers_p32( void * volatile * ppvDestination,
|
||||||
void *pReturnValue;
|
void * pvExchange )
|
||||||
|
{
|
||||||
|
void * pReturnValue;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
pReturnValue = *ppvDestination;
|
pReturnValue = *ppvDestination;
|
||||||
*ppvDestination = pvExchange;
|
*ppvDestination = pvExchange;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return pReturnValue;
|
return pReturnValue;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -162,21 +172,26 @@ static portFORCE_INLINE void *Atomic_SwapPointers_p32(void *volatile *ppvDestina
|
|||||||
* @note This function only swaps *ppvDestination with pvExchange, if previous
|
* @note This function only swaps *ppvDestination with pvExchange, if previous
|
||||||
* *ppvDestination value equals pvComparand.
|
* *ppvDestination value equals pvComparand.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32(void *volatile *ppvDestination, void *pvExchange, void *pvComparand) {
|
static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32( void * volatile * ppvDestination,
|
||||||
uint32_t ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
|
void * pvExchange,
|
||||||
|
void * pvComparand )
|
||||||
|
{
|
||||||
|
uint32_t ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if (*ppvDestination == pvComparand) {
|
if( *ppvDestination == pvComparand )
|
||||||
*ppvDestination = pvExchange;
|
{
|
||||||
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS;
|
*ppvDestination = pvExchange;
|
||||||
}
|
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
}
|
||||||
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulReturnValue;
|
return ulReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------- Arithmetic ------------------------------*/
|
/*----------------------------- Arithmetic ------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,17 +205,19 @@ static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32(void *volatil
|
|||||||
*
|
*
|
||||||
* @return previous *pulAddend value.
|
* @return previous *pulAddend value.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_Add_u32(uint32_t volatile *pulAddend, uint32_t ulCount) {
|
static portFORCE_INLINE uint32_t Atomic_Add_u32( uint32_t volatile * pulAddend,
|
||||||
uint32_t ulCurrent;
|
uint32_t ulCount )
|
||||||
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulAddend;
|
ulCurrent = *pulAddend;
|
||||||
*pulAddend += ulCount;
|
*pulAddend += ulCount;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -216,17 +233,19 @@ static portFORCE_INLINE uint32_t Atomic_Add_u32(uint32_t volatile *pulAddend, ui
|
|||||||
*
|
*
|
||||||
* @return previous *pulAddend value.
|
* @return previous *pulAddend value.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_Subtract_u32(uint32_t volatile *pulAddend, uint32_t ulCount) {
|
static portFORCE_INLINE uint32_t Atomic_Subtract_u32( uint32_t volatile * pulAddend,
|
||||||
uint32_t ulCurrent;
|
uint32_t ulCount )
|
||||||
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulAddend;
|
ulCurrent = *pulAddend;
|
||||||
*pulAddend -= ulCount;
|
*pulAddend -= ulCount;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -240,17 +259,18 @@ static portFORCE_INLINE uint32_t Atomic_Subtract_u32(uint32_t volatile *pulAdden
|
|||||||
*
|
*
|
||||||
* @return *pulAddend value before increment.
|
* @return *pulAddend value before increment.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_Increment_u32(uint32_t volatile *pulAddend) {
|
static portFORCE_INLINE uint32_t Atomic_Increment_u32( uint32_t volatile * pulAddend )
|
||||||
uint32_t ulCurrent;
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulAddend;
|
ulCurrent = *pulAddend;
|
||||||
*pulAddend += 1;
|
*pulAddend += 1;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -264,17 +284,18 @@ static portFORCE_INLINE uint32_t Atomic_Increment_u32(uint32_t volatile *pulAdde
|
|||||||
*
|
*
|
||||||
* @return *pulAddend value before decrement.
|
* @return *pulAddend value before decrement.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_Decrement_u32(uint32_t volatile *pulAddend) {
|
static portFORCE_INLINE uint32_t Atomic_Decrement_u32( uint32_t volatile * pulAddend )
|
||||||
uint32_t ulCurrent;
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulAddend;
|
ulCurrent = *pulAddend;
|
||||||
*pulAddend -= 1;
|
*pulAddend -= 1;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------- Bitwise Logical ------------------------------*/
|
/*----------------------------- Bitwise Logical ------------------------------*/
|
||||||
@@ -290,17 +311,19 @@ static portFORCE_INLINE uint32_t Atomic_Decrement_u32(uint32_t volatile *pulAdde
|
|||||||
*
|
*
|
||||||
* @return The original value of *pulDestination.
|
* @return The original value of *pulDestination.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_OR_u32(uint32_t volatile *pulDestination, uint32_t ulValue) {
|
static portFORCE_INLINE uint32_t Atomic_OR_u32( uint32_t volatile * pulDestination,
|
||||||
uint32_t ulCurrent;
|
uint32_t ulValue )
|
||||||
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulDestination;
|
ulCurrent = *pulDestination;
|
||||||
*pulDestination |= ulValue;
|
*pulDestination |= ulValue;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -315,17 +338,19 @@ static portFORCE_INLINE uint32_t Atomic_OR_u32(uint32_t volatile *pulDestination
|
|||||||
*
|
*
|
||||||
* @return The original value of *pulDestination.
|
* @return The original value of *pulDestination.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_AND_u32(uint32_t volatile *pulDestination, uint32_t ulValue) {
|
static portFORCE_INLINE uint32_t Atomic_AND_u32( uint32_t volatile * pulDestination,
|
||||||
uint32_t ulCurrent;
|
uint32_t ulValue )
|
||||||
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulDestination;
|
ulCurrent = *pulDestination;
|
||||||
*pulDestination &= ulValue;
|
*pulDestination &= ulValue;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -340,17 +365,19 @@ static portFORCE_INLINE uint32_t Atomic_AND_u32(uint32_t volatile *pulDestinatio
|
|||||||
*
|
*
|
||||||
* @return The original value of *pulDestination.
|
* @return The original value of *pulDestination.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_NAND_u32(uint32_t volatile *pulDestination, uint32_t ulValue) {
|
static portFORCE_INLINE uint32_t Atomic_NAND_u32( uint32_t volatile * pulDestination,
|
||||||
uint32_t ulCurrent;
|
uint32_t ulValue )
|
||||||
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulDestination;
|
ulCurrent = *pulDestination;
|
||||||
*pulDestination = ~(ulCurrent & ulValue);
|
*pulDestination = ~( ulCurrent & ulValue );
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -365,17 +392,19 @@ static portFORCE_INLINE uint32_t Atomic_NAND_u32(uint32_t volatile *pulDestinati
|
|||||||
*
|
*
|
||||||
* @return The original value of *pulDestination.
|
* @return The original value of *pulDestination.
|
||||||
*/
|
*/
|
||||||
static portFORCE_INLINE uint32_t Atomic_XOR_u32(uint32_t volatile *pulDestination, uint32_t ulValue) {
|
static portFORCE_INLINE uint32_t Atomic_XOR_u32( uint32_t volatile * pulDestination,
|
||||||
uint32_t ulCurrent;
|
uint32_t ulValue )
|
||||||
|
{
|
||||||
|
uint32_t ulCurrent;
|
||||||
|
|
||||||
ATOMIC_ENTER_CRITICAL();
|
ATOMIC_ENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
ulCurrent = *pulDestination;
|
ulCurrent = *pulDestination;
|
||||||
*pulDestination ^= ulValue;
|
*pulDestination ^= ulValue;
|
||||||
}
|
}
|
||||||
ATOMIC_EXIT_CRITICAL();
|
ATOMIC_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ulCurrent;
|
return ulCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#define CO_ROUTINE_H
|
#define CO_ROUTINE_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include croutine.h"
|
#error "include FreeRTOS.h must appear in source files before include croutine.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
@@ -41,19 +41,20 @@ extern "C" {
|
|||||||
/* Used to hide the implementation of the co-routine control block. The
|
/* Used to hide the implementation of the co-routine control block. The
|
||||||
control block structure however has to be included in the header due to
|
control block structure however has to be included in the header due to
|
||||||
the macro implementation of the co-routine functionality. */
|
the macro implementation of the co-routine functionality. */
|
||||||
typedef void *CoRoutineHandle_t;
|
typedef void * CoRoutineHandle_t;
|
||||||
|
|
||||||
/* Defines the prototype to which co-routine functions must conform. */
|
/* Defines the prototype to which co-routine functions must conform. */
|
||||||
typedef void (*crCOROUTINE_CODE)(CoRoutineHandle_t, UBaseType_t);
|
typedef void (*crCOROUTINE_CODE)( CoRoutineHandle_t, UBaseType_t );
|
||||||
|
|
||||||
typedef struct corCoRoutineControlBlock {
|
typedef struct corCoRoutineControlBlock
|
||||||
crCOROUTINE_CODE pxCoRoutineFunction;
|
{
|
||||||
ListItem_t xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */
|
crCOROUTINE_CODE pxCoRoutineFunction;
|
||||||
ListItem_t xEventListItem; /*< List item used to place the CRCB in event lists. */
|
ListItem_t xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */
|
||||||
UBaseType_t uxPriority; /*< The priority of the co-routine in relation to other co-routines. */
|
ListItem_t xEventListItem; /*< List item used to place the CRCB in event lists. */
|
||||||
UBaseType_t uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
|
UBaseType_t uxPriority; /*< The priority of the co-routine in relation to other co-routines. */
|
||||||
uint16_t uxState; /*< Used internally by the co-routine implementation. */
|
UBaseType_t uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
|
||||||
} CRCB_t; /* Co-routine control block. Note must be identical in size down to uxPriority with TCB_t. */
|
uint16_t uxState; /*< Used internally by the co-routine implementation. */
|
||||||
|
} CRCB_t; /* Co-routine control block. Note must be identical in size down to uxPriority with TCB_t. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -127,7 +128,8 @@ typedef struct corCoRoutineControlBlock {
|
|||||||
* \defgroup xCoRoutineCreate xCoRoutineCreate
|
* \defgroup xCoRoutineCreate xCoRoutineCreate
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
BaseType_t xCoRoutineCreate(crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex);
|
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -151,7 +153,7 @@ BaseType_t xCoRoutineCreate(crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPrio
|
|||||||
// The rest of the idle task will execute between co-routine calls.
|
// The rest of the idle task will execute between co-routine calls.
|
||||||
void vApplicationIdleHook( void )
|
void vApplicationIdleHook( void )
|
||||||
{
|
{
|
||||||
vCoRoutineSchedule();
|
vCoRoutineSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alternatively, if you do not require any other part of the idle task to
|
// Alternatively, if you do not require any other part of the idle task to
|
||||||
@@ -168,7 +170,7 @@ BaseType_t xCoRoutineCreate(crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPrio
|
|||||||
* \defgroup vCoRoutineSchedule vCoRoutineSchedule
|
* \defgroup vCoRoutineSchedule vCoRoutineSchedule
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
void vCoRoutineSchedule(void);
|
void vCoRoutineSchedule( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -199,9 +201,7 @@ void vCoRoutineSchedule(void);
|
|||||||
* \defgroup crSTART crSTART
|
* \defgroup crSTART crSTART
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crSTART(pxCRCB) \
|
#define crSTART( pxCRCB ) switch( ( ( CRCB_t * )( pxCRCB ) )->uxState ) { case 0:
|
||||||
switch (((CRCB_t *)(pxCRCB))->uxState) { \
|
|
||||||
case 0:
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -238,14 +238,8 @@ void vCoRoutineSchedule(void);
|
|||||||
* These macros are intended for internal use by the co-routine implementation
|
* These macros are intended for internal use by the co-routine implementation
|
||||||
* only. The macros should not be used directly by application writers.
|
* only. The macros should not be used directly by application writers.
|
||||||
*/
|
*/
|
||||||
#define crSET_STATE0(xHandle) \
|
#define crSET_STATE0( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
|
||||||
((CRCB_t *)(xHandle))->uxState = (__LINE__ * 2); \
|
#define crSET_STATE1( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
|
||||||
return; \
|
|
||||||
case (__LINE__ * 2):
|
|
||||||
#define crSET_STATE1(xHandle) \
|
|
||||||
((CRCB_t *)(xHandle))->uxState = ((__LINE__ * 2) + 1); \
|
|
||||||
return; \
|
|
||||||
case ((__LINE__ * 2) + 1):
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -293,11 +287,12 @@ void vCoRoutineSchedule(void);
|
|||||||
* \defgroup crDELAY crDELAY
|
* \defgroup crDELAY crDELAY
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crDELAY(xHandle, xTicksToDelay) \
|
#define crDELAY( xHandle, xTicksToDelay ) \
|
||||||
if ((xTicksToDelay) > 0) { \
|
if( ( xTicksToDelay ) > 0 ) \
|
||||||
vCoRoutineAddToDelayedList((xTicksToDelay), NULL); \
|
{ \
|
||||||
} \
|
vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
|
||||||
crSET_STATE0((xHandle));
|
} \
|
||||||
|
crSET_STATE0( ( xHandle ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -382,18 +377,20 @@ void vCoRoutineSchedule(void);
|
|||||||
* \defgroup crQUEUE_SEND crQUEUE_SEND
|
* \defgroup crQUEUE_SEND crQUEUE_SEND
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_SEND(xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult) \
|
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
|
||||||
{ \
|
{ \
|
||||||
*(pxResult) = xQueueCRSend((pxQueue), (pvItemToQueue), (xTicksToWait)); \
|
*( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) ); \
|
||||||
if (*(pxResult) == errQUEUE_BLOCKED) { \
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
crSET_STATE0((xHandle)); \
|
{ \
|
||||||
*pxResult = xQueueCRSend((pxQueue), (pvItemToQueue), 0); \
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
} \
|
*pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 ); \
|
||||||
if (*pxResult == errQUEUE_YIELD) { \
|
} \
|
||||||
crSET_STATE1((xHandle)); \
|
if( *pxResult == errQUEUE_YIELD ) \
|
||||||
*pxResult = pdPASS; \
|
{ \
|
||||||
} \
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
}
|
*pxResult = pdPASS; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -472,18 +469,20 @@ void vCoRoutineSchedule(void);
|
|||||||
* \defgroup crQUEUE_RECEIVE crQUEUE_RECEIVE
|
* \defgroup crQUEUE_RECEIVE crQUEUE_RECEIVE
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_RECEIVE(xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult) \
|
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
|
||||||
{ \
|
{ \
|
||||||
*(pxResult) = xQueueCRReceive((pxQueue), (pvBuffer), (xTicksToWait)); \
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) ); \
|
||||||
if (*(pxResult) == errQUEUE_BLOCKED) { \
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
crSET_STATE0((xHandle)); \
|
{ \
|
||||||
*(pxResult) = xQueueCRReceive((pxQueue), (pvBuffer), 0); \
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
} \
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 ); \
|
||||||
if (*(pxResult) == errQUEUE_YIELD) { \
|
} \
|
||||||
crSET_STATE1((xHandle)); \
|
if( *( pxResult ) == errQUEUE_YIELD ) \
|
||||||
*(pxResult) = pdPASS; \
|
{ \
|
||||||
} \
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
}
|
*( pxResult ) = pdPASS; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -579,7 +578,8 @@ void vCoRoutineSchedule(void);
|
|||||||
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
|
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_SEND_FROM_ISR(pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken) xQueueCRSendFromISR((pxQueue), (pvItemToQueue), (xCoRoutinePreviouslyWoken))
|
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
@@ -645,25 +645,25 @@ void vCoRoutineSchedule(void);
|
|||||||
{
|
{
|
||||||
// The character was successfully posted to the queue.
|
// The character was successfully posted to the queue.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Could not post the character to the queue.
|
// Could not post the character to the queue.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable the UART Tx interrupt to cause an interrupt in this
|
// Enable the UART Tx interrupt to cause an interrupt in this
|
||||||
// hypothetical UART. The interrupt will obtain the character
|
// hypothetical UART. The interrupt will obtain the character
|
||||||
// from the queue and send it.
|
// from the queue and send it.
|
||||||
ENABLE_RX_INTERRUPT();
|
ENABLE_RX_INTERRUPT();
|
||||||
|
|
||||||
// Increment to the next character then block for a fixed period.
|
// Increment to the next character then block for a fixed period.
|
||||||
// cCharToTx will maintain its value across the delay as it is
|
// cCharToTx will maintain its value across the delay as it is
|
||||||
// declared static.
|
// declared static.
|
||||||
cCharToTx++;
|
cCharToTx++;
|
||||||
if( cCharToTx > 'x' )
|
if( cCharToTx > 'x' )
|
||||||
{
|
{
|
||||||
cCharToTx = 'a';
|
cCharToTx = 'a';
|
||||||
}
|
}
|
||||||
crDELAY( 100 );
|
crDELAY( 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// All co-routines must end with a call to crEND().
|
// All co-routines must end with a call to crEND().
|
||||||
@@ -679,19 +679,19 @@ void vCoRoutineSchedule(void);
|
|||||||
while( UART_TX_REG_EMPTY() )
|
while( UART_TX_REG_EMPTY() )
|
||||||
{
|
{
|
||||||
// Are there any characters in the queue waiting to be sent?
|
// Are there any characters in the queue waiting to be sent?
|
||||||
// xCRWokenByPost will automatically be set to pdTRUE if a co-routine
|
// xCRWokenByPost will automatically be set to pdTRUE if a co-routine
|
||||||
// is woken by the post - ensuring that only a single co-routine is
|
// is woken by the post - ensuring that only a single co-routine is
|
||||||
// woken no matter how many times we go around this loop.
|
// woken no matter how many times we go around this loop.
|
||||||
if( crQUEUE_RECEIVE_FROM_ISR( pxQueue, &cCharToTx, &xCRWokenByPost ) )
|
if( crQUEUE_RECEIVE_FROM_ISR( pxQueue, &cCharToTx, &xCRWokenByPost ) )
|
||||||
{
|
{
|
||||||
SEND_CHARACTER( cCharToTx );
|
SEND_CHARACTER( cCharToTx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
|
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_RECEIVE_FROM_ISR(pxQueue, pvBuffer, pxCoRoutineWoken) xQueueCRReceiveFromISR((pxQueue), (pvBuffer), (pxCoRoutineWoken))
|
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is intended for internal use by the co-routine macros only.
|
* This function is intended for internal use by the co-routine macros only.
|
||||||
@@ -702,7 +702,7 @@ void vCoRoutineSchedule(void);
|
|||||||
* Removes the current co-routine from its ready list and places it in the
|
* Removes the current co-routine from its ready list and places it in the
|
||||||
* appropriate delayed list.
|
* appropriate delayed list.
|
||||||
*/
|
*/
|
||||||
void vCoRoutineAddToDelayedList(TickType_t xTicksToDelay, List_t *pxEventList);
|
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is intended for internal use by the queue implementation only.
|
* This function is intended for internal use by the queue implementation only.
|
||||||
@@ -711,7 +711,7 @@ void vCoRoutineAddToDelayedList(TickType_t xTicksToDelay, List_t *pxEventList);
|
|||||||
* Removes the highest priority co-routine from the event list and places it in
|
* Removes the highest priority co-routine from the event list and places it in
|
||||||
* the pending ready list.
|
* the pending ready list.
|
||||||
*/
|
*/
|
||||||
BaseType_t xCoRoutineRemoveFromEventList(const List_t *pxEventList);
|
BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#define EVENT_GROUPS_H
|
#define EVENT_GROUPS_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h" must appear in source files before "include event_groups.h"
|
#error "include FreeRTOS.h" must appear in source files before "include event_groups.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FreeRTOS includes. */
|
/* FreeRTOS includes. */
|
||||||
@@ -66,6 +66,8 @@ extern "C" {
|
|||||||
* \defgroup EventGroup
|
* \defgroup EventGroup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*
|
*
|
||||||
@@ -77,7 +79,7 @@ extern "C" {
|
|||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
struct EventGroupDef_t;
|
struct EventGroupDef_t;
|
||||||
typedef struct EventGroupDef_t *EventGroupHandle_t;
|
typedef struct EventGroupDef_t * EventGroupHandle_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The type that holds event bits always matches TickType_t - therefore the
|
* The type that holds event bits always matches TickType_t - therefore the
|
||||||
@@ -121,28 +123,28 @@ typedef TickType_t EventBits_t;
|
|||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
<pre>
|
<pre>
|
||||||
// Declare a variable to hold the created event group.
|
// Declare a variable to hold the created event group.
|
||||||
EventGroupHandle_t xCreatedEventGroup;
|
EventGroupHandle_t xCreatedEventGroup;
|
||||||
|
|
||||||
// Attempt to create the event group.
|
// Attempt to create the event group.
|
||||||
xCreatedEventGroup = xEventGroupCreate();
|
xCreatedEventGroup = xEventGroupCreate();
|
||||||
|
|
||||||
// Was the event group created successfully?
|
// Was the event group created successfully?
|
||||||
if( xCreatedEventGroup == NULL )
|
if( xCreatedEventGroup == NULL )
|
||||||
{
|
{
|
||||||
// The event group was not created because there was insufficient
|
// The event group was not created because there was insufficient
|
||||||
// FreeRTOS heap available.
|
// FreeRTOS heap available.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The event group was created.
|
// The event group was created.
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupCreate xEventGroupCreate
|
* \defgroup xEventGroupCreate xEventGroupCreate
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
|
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
EventGroupHandle_t xEventGroupCreate(void) PRIVILEGED_FUNCTION;
|
EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,32 +182,32 @@ EventGroupHandle_t xEventGroupCreate(void) PRIVILEGED_FUNCTION;
|
|||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
<pre>
|
<pre>
|
||||||
// StaticEventGroup_t is a publicly accessible structure that has the same
|
// StaticEventGroup_t is a publicly accessible structure that has the same
|
||||||
// size and alignment requirements as the real event group structure. It is
|
// size and alignment requirements as the real event group structure. It is
|
||||||
// provided as a mechanism for applications to know the size of the event
|
// provided as a mechanism for applications to know the size of the event
|
||||||
// group (which is dependent on the architecture and configuration file
|
// group (which is dependent on the architecture and configuration file
|
||||||
// settings) without breaking the strict data hiding policy by exposing the
|
// settings) without breaking the strict data hiding policy by exposing the
|
||||||
// real event group internals. This StaticEventGroup_t variable is passed
|
// real event group internals. This StaticEventGroup_t variable is passed
|
||||||
// into the xSemaphoreCreateEventGroupStatic() function and is used to store
|
// into the xSemaphoreCreateEventGroupStatic() function and is used to store
|
||||||
// the event group's data structures
|
// the event group's data structures
|
||||||
StaticEventGroup_t xEventGroupBuffer;
|
StaticEventGroup_t xEventGroupBuffer;
|
||||||
|
|
||||||
// Create the event group without dynamically allocating any memory.
|
// Create the event group without dynamically allocating any memory.
|
||||||
xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );
|
xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );
|
||||||
</pre>
|
</pre>
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_STATIC_ALLOCATION == 1)
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
EventGroupHandle_t xEventGroupCreateStatic(StaticEventGroup_t *pxEventGroupBuffer) PRIVILEGED_FUNCTION;
|
EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
const EventBits_t uxBitsToWaitFor,
|
const EventBits_t uxBitsToWaitFor,
|
||||||
const BaseType_t xClearOnExit,
|
const BaseType_t xClearOnExit,
|
||||||
const BaseType_t xWaitForAllBits,
|
const BaseType_t xWaitForAllBits,
|
||||||
const TickType_t xTicksToWait );
|
const TickType_t xTicksToWait );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* [Potentially] block to wait for one or more bits to be set within a
|
* [Potentially] block to wait for one or more bits to be set within a
|
||||||
@@ -259,44 +261,43 @@ EventGroupHandle_t xEventGroupCreateStatic(StaticEventGroup_t *pxEventGroupBuffe
|
|||||||
EventBits_t uxBits;
|
EventBits_t uxBits;
|
||||||
const TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;
|
const TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;
|
||||||
|
|
||||||
// Wait a maximum of 100ms for either bit 0 or bit 4 to be set within
|
// Wait a maximum of 100ms for either bit 0 or bit 4 to be set within
|
||||||
// the event group. Clear the bits before exiting.
|
// the event group. Clear the bits before exiting.
|
||||||
uxBits = xEventGroupWaitBits(
|
uxBits = xEventGroupWaitBits(
|
||||||
xEventGroup, // The event group being tested.
|
xEventGroup, // The event group being tested.
|
||||||
BIT_0 | BIT_4, // The bits within the event group to wait for.
|
BIT_0 | BIT_4, // The bits within the event group to wait for.
|
||||||
pdTRUE, // BIT_0 and BIT_4 should be cleared before returning.
|
pdTRUE, // BIT_0 and BIT_4 should be cleared before returning.
|
||||||
pdFALSE, // Don't wait for both bits, either bit will do.
|
pdFALSE, // Don't wait for both bits, either bit will do.
|
||||||
xTicksToWait ); // Wait a maximum of 100ms for either bit to be set.
|
xTicksToWait ); // Wait a maximum of 100ms for either bit to be set.
|
||||||
|
|
||||||
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
||||||
{
|
{
|
||||||
// xEventGroupWaitBits() returned because both bits were set.
|
// xEventGroupWaitBits() returned because both bits were set.
|
||||||
}
|
}
|
||||||
else if( ( uxBits & BIT_0 ) != 0 )
|
else if( ( uxBits & BIT_0 ) != 0 )
|
||||||
{
|
{
|
||||||
// xEventGroupWaitBits() returned because just BIT_0 was set.
|
// xEventGroupWaitBits() returned because just BIT_0 was set.
|
||||||
}
|
}
|
||||||
else if( ( uxBits & BIT_4 ) != 0 )
|
else if( ( uxBits & BIT_4 ) != 0 )
|
||||||
{
|
{
|
||||||
// xEventGroupWaitBits() returned because just BIT_4 was set.
|
// xEventGroupWaitBits() returned because just BIT_4 was set.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// xEventGroupWaitBits() returned because xTicksToWait ticks passed
|
// xEventGroupWaitBits() returned because xTicksToWait ticks passed
|
||||||
// without either BIT_0 or BIT_4 becoming set.
|
// without either BIT_0 or BIT_4 becoming set.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupWaitBits xEventGroupWaitBits
|
* \defgroup xEventGroupWaitBits xEventGroupWaitBits
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
EventBits_t xEventGroupWaitBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits,
|
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
TickType_t xTicksToWait) PRIVILEGED_FUNCTION;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
|
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* Clear bits within an event group. This function cannot be called from an
|
* Clear bits within an event group. This function cannot be called from an
|
||||||
@@ -319,41 +320,41 @@ EventBits_t xEventGroupWaitBits(EventGroupHandle_t xEventGroup, const EventBits_
|
|||||||
{
|
{
|
||||||
EventBits_t uxBits;
|
EventBits_t uxBits;
|
||||||
|
|
||||||
// Clear bit 0 and bit 4 in xEventGroup.
|
// Clear bit 0 and bit 4 in xEventGroup.
|
||||||
uxBits = xEventGroupClearBits(
|
uxBits = xEventGroupClearBits(
|
||||||
xEventGroup, // The event group being updated.
|
xEventGroup, // The event group being updated.
|
||||||
BIT_0 | BIT_4 );// The bits being cleared.
|
BIT_0 | BIT_4 );// The bits being cleared.
|
||||||
|
|
||||||
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
||||||
{
|
{
|
||||||
// Both bit 0 and bit 4 were set before xEventGroupClearBits() was
|
// Both bit 0 and bit 4 were set before xEventGroupClearBits() was
|
||||||
// called. Both will now be clear (not set).
|
// called. Both will now be clear (not set).
|
||||||
}
|
}
|
||||||
else if( ( uxBits & BIT_0 ) != 0 )
|
else if( ( uxBits & BIT_0 ) != 0 )
|
||||||
{
|
{
|
||||||
// Bit 0 was set before xEventGroupClearBits() was called. It will
|
// Bit 0 was set before xEventGroupClearBits() was called. It will
|
||||||
// now be clear.
|
// now be clear.
|
||||||
}
|
}
|
||||||
else if( ( uxBits & BIT_4 ) != 0 )
|
else if( ( uxBits & BIT_4 ) != 0 )
|
||||||
{
|
{
|
||||||
// Bit 4 was set before xEventGroupClearBits() was called. It will
|
// Bit 4 was set before xEventGroupClearBits() was called. It will
|
||||||
// now be clear.
|
// now be clear.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Neither bit 0 nor bit 4 were set in the first place.
|
// Neither bit 0 nor bit 4 were set in the first place.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupClearBits xEventGroupClearBits
|
* \defgroup xEventGroupClearBits xEventGroupClearBits
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
EventBits_t xEventGroupClearBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear) PRIVILEGED_FUNCTION;
|
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* A version of xEventGroupClearBits() that can be called from an interrupt.
|
* A version of xEventGroupClearBits() that can be called from an interrupt.
|
||||||
@@ -389,30 +390,30 @@ EventBits_t xEventGroupClearBits(EventGroupHandle_t xEventGroup, const EventBits
|
|||||||
|
|
||||||
void anInterruptHandler( void )
|
void anInterruptHandler( void )
|
||||||
{
|
{
|
||||||
// Clear bit 0 and bit 4 in xEventGroup.
|
// Clear bit 0 and bit 4 in xEventGroup.
|
||||||
xResult = xEventGroupClearBitsFromISR(
|
xResult = xEventGroupClearBitsFromISR(
|
||||||
xEventGroup, // The event group being updated.
|
xEventGroup, // The event group being updated.
|
||||||
BIT_0 | BIT_4 ); // The bits being set.
|
BIT_0 | BIT_4 ); // The bits being set.
|
||||||
|
|
||||||
if( xResult == pdPASS )
|
if( xResult == pdPASS )
|
||||||
{
|
{
|
||||||
// The message was posted successfully.
|
// The message was posted successfully.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR
|
* \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
#if (configUSE_TRACE_FACILITY == 1)
|
#if( configUSE_TRACE_FACILITY == 1 )
|
||||||
BaseType_t xEventGroupClearBitsFromISR(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear) PRIVILEGED_FUNCTION;
|
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
|
||||||
#else
|
#else
|
||||||
#define xEventGroupClearBitsFromISR(xEventGroup, uxBitsToClear) xTimerPendFunctionCallFromISR(vEventGroupClearBitsCallback, (void *)xEventGroup, (uint32_t)uxBitsToClear, NULL)
|
#define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* Set bits within an event group.
|
* Set bits within an event group.
|
||||||
@@ -447,46 +448,46 @@ BaseType_t xEventGroupClearBitsFromISR(EventGroupHandle_t xEventGroup, const Eve
|
|||||||
{
|
{
|
||||||
EventBits_t uxBits;
|
EventBits_t uxBits;
|
||||||
|
|
||||||
// Set bit 0 and bit 4 in xEventGroup.
|
// Set bit 0 and bit 4 in xEventGroup.
|
||||||
uxBits = xEventGroupSetBits(
|
uxBits = xEventGroupSetBits(
|
||||||
xEventGroup, // The event group being updated.
|
xEventGroup, // The event group being updated.
|
||||||
BIT_0 | BIT_4 );// The bits being set.
|
BIT_0 | BIT_4 );// The bits being set.
|
||||||
|
|
||||||
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
||||||
{
|
{
|
||||||
// Both bit 0 and bit 4 remained set when the function returned.
|
// Both bit 0 and bit 4 remained set when the function returned.
|
||||||
}
|
}
|
||||||
else if( ( uxBits & BIT_0 ) != 0 )
|
else if( ( uxBits & BIT_0 ) != 0 )
|
||||||
{
|
{
|
||||||
// Bit 0 remained set when the function returned, but bit 4 was
|
// Bit 0 remained set when the function returned, but bit 4 was
|
||||||
// cleared. It might be that bit 4 was cleared automatically as a
|
// cleared. It might be that bit 4 was cleared automatically as a
|
||||||
// task that was waiting for bit 4 was removed from the Blocked
|
// task that was waiting for bit 4 was removed from the Blocked
|
||||||
// state.
|
// state.
|
||||||
}
|
}
|
||||||
else if( ( uxBits & BIT_4 ) != 0 )
|
else if( ( uxBits & BIT_4 ) != 0 )
|
||||||
{
|
{
|
||||||
// Bit 4 remained set when the function returned, but bit 0 was
|
// Bit 4 remained set when the function returned, but bit 0 was
|
||||||
// cleared. It might be that bit 0 was cleared automatically as a
|
// cleared. It might be that bit 0 was cleared automatically as a
|
||||||
// task that was waiting for bit 0 was removed from the Blocked
|
// task that was waiting for bit 0 was removed from the Blocked
|
||||||
// state.
|
// state.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Neither bit 0 nor bit 4 remained set. It might be that a task
|
// Neither bit 0 nor bit 4 remained set. It might be that a task
|
||||||
// was waiting for both of the bits to be set, and the bits were
|
// was waiting for both of the bits to be set, and the bits were
|
||||||
// cleared as the task left the Blocked state.
|
// cleared as the task left the Blocked state.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupSetBits xEventGroupSetBits
|
* \defgroup xEventGroupSetBits xEventGroupSetBits
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
EventBits_t xEventGroupSetBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet) PRIVILEGED_FUNCTION;
|
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
|
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* A version of xEventGroupSetBits() that can be called from an interrupt.
|
* A version of xEventGroupSetBits() that can be called from an interrupt.
|
||||||
@@ -532,43 +533,42 @@ EventBits_t xEventGroupSetBits(EventGroupHandle_t xEventGroup, const EventBits_t
|
|||||||
{
|
{
|
||||||
BaseType_t xHigherPriorityTaskWoken, xResult;
|
BaseType_t xHigherPriorityTaskWoken, xResult;
|
||||||
|
|
||||||
// xHigherPriorityTaskWoken must be initialised to pdFALSE.
|
// xHigherPriorityTaskWoken must be initialised to pdFALSE.
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
// Set bit 0 and bit 4 in xEventGroup.
|
// Set bit 0 and bit 4 in xEventGroup.
|
||||||
xResult = xEventGroupSetBitsFromISR(
|
xResult = xEventGroupSetBitsFromISR(
|
||||||
xEventGroup, // The event group being updated.
|
xEventGroup, // The event group being updated.
|
||||||
BIT_0 | BIT_4 // The bits being set.
|
BIT_0 | BIT_4 // The bits being set.
|
||||||
&xHigherPriorityTaskWoken );
|
&xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
// Was the message posted successfully?
|
// Was the message posted successfully?
|
||||||
if( xResult == pdPASS )
|
if( xResult == pdPASS )
|
||||||
{
|
{
|
||||||
// If xHigherPriorityTaskWoken is now set to pdTRUE then a context
|
// If xHigherPriorityTaskWoken is now set to pdTRUE then a context
|
||||||
// switch should be requested. The macro used is port specific and
|
// switch should be requested. The macro used is port specific and
|
||||||
// will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
// will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
||||||
// refer to the documentation page for the port being used.
|
// refer to the documentation page for the port being used.
|
||||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
#if (configUSE_TRACE_FACILITY == 1)
|
#if( configUSE_TRACE_FACILITY == 1 )
|
||||||
BaseType_t xEventGroupSetBitsFromISR(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION;
|
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
#else
|
#else
|
||||||
#define xEventGroupSetBitsFromISR(xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken) \
|
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken )
|
||||||
xTimerPendFunctionCallFromISR(vEventGroupSetBitsCallback, (void *)xEventGroup, (uint32_t)uxBitsToSet, pxHigherPriorityTaskWoken)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
const EventBits_t uxBitsToSet,
|
const EventBits_t uxBitsToSet,
|
||||||
const EventBits_t uxBitsToWaitFor,
|
const EventBits_t uxBitsToWaitFor,
|
||||||
TickType_t xTicksToWait );
|
TickType_t xTicksToWait );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* Atomically set bits within an event group, then wait for a combination of
|
* Atomically set bits within an event group, then wait for a combination of
|
||||||
@@ -625,73 +625,74 @@ BaseType_t xEventGroupSetBitsFromISR(EventGroupHandle_t xEventGroup, const Event
|
|||||||
EventBits_t uxReturn;
|
EventBits_t uxReturn;
|
||||||
TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;
|
TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
// Perform task functionality here.
|
// Perform task functionality here.
|
||||||
|
|
||||||
// Set bit 0 in the event flag to note this task has reached the
|
// Set bit 0 in the event flag to note this task has reached the
|
||||||
// sync point. The other two tasks will set the other two bits defined
|
// sync point. The other two tasks will set the other two bits defined
|
||||||
// by ALL_SYNC_BITS. All three tasks have reached the synchronisation
|
// by ALL_SYNC_BITS. All three tasks have reached the synchronisation
|
||||||
// point when all the ALL_SYNC_BITS are set. Wait a maximum of 100ms
|
// point when all the ALL_SYNC_BITS are set. Wait a maximum of 100ms
|
||||||
// for this to happen.
|
// for this to happen.
|
||||||
uxReturn = xEventGroupSync( xEventBits, TASK_0_BIT, ALL_SYNC_BITS, xTicksToWait );
|
uxReturn = xEventGroupSync( xEventBits, TASK_0_BIT, ALL_SYNC_BITS, xTicksToWait );
|
||||||
|
|
||||||
if( ( uxReturn & ALL_SYNC_BITS ) == ALL_SYNC_BITS )
|
if( ( uxReturn & ALL_SYNC_BITS ) == ALL_SYNC_BITS )
|
||||||
{
|
{
|
||||||
// All three tasks reached the synchronisation point before the call
|
// All three tasks reached the synchronisation point before the call
|
||||||
// to xEventGroupSync() timed out.
|
// to xEventGroupSync() timed out.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vTask1( void *pvParameters )
|
void vTask1( void *pvParameters )
|
||||||
{
|
{
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
// Perform task functionality here.
|
// Perform task functionality here.
|
||||||
|
|
||||||
// Set bit 1 in the event flag to note this task has reached the
|
// Set bit 1 in the event flag to note this task has reached the
|
||||||
// synchronisation point. The other two tasks will set the other two
|
// synchronisation point. The other two tasks will set the other two
|
||||||
// bits defined by ALL_SYNC_BITS. All three tasks have reached the
|
// bits defined by ALL_SYNC_BITS. All three tasks have reached the
|
||||||
// synchronisation point when all the ALL_SYNC_BITS are set. Wait
|
// synchronisation point when all the ALL_SYNC_BITS are set. Wait
|
||||||
// indefinitely for this to happen.
|
// indefinitely for this to happen.
|
||||||
xEventGroupSync( xEventBits, TASK_1_BIT, ALL_SYNC_BITS, portMAX_DELAY );
|
xEventGroupSync( xEventBits, TASK_1_BIT, ALL_SYNC_BITS, portMAX_DELAY );
|
||||||
|
|
||||||
// xEventGroupSync() was called with an indefinite block time, so
|
// xEventGroupSync() was called with an indefinite block time, so
|
||||||
// this task will only reach here if the syncrhonisation was made by all
|
// this task will only reach here if the syncrhonisation was made by all
|
||||||
// three tasks, so there is no need to test the return value.
|
// three tasks, so there is no need to test the return value.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vTask2( void *pvParameters )
|
void vTask2( void *pvParameters )
|
||||||
{
|
{
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
// Perform task functionality here.
|
// Perform task functionality here.
|
||||||
|
|
||||||
// Set bit 2 in the event flag to note this task has reached the
|
// Set bit 2 in the event flag to note this task has reached the
|
||||||
// synchronisation point. The other two tasks will set the other two
|
// synchronisation point. The other two tasks will set the other two
|
||||||
// bits defined by ALL_SYNC_BITS. All three tasks have reached the
|
// bits defined by ALL_SYNC_BITS. All three tasks have reached the
|
||||||
// synchronisation point when all the ALL_SYNC_BITS are set. Wait
|
// synchronisation point when all the ALL_SYNC_BITS are set. Wait
|
||||||
// indefinitely for this to happen.
|
// indefinitely for this to happen.
|
||||||
xEventGroupSync( xEventBits, TASK_2_BIT, ALL_SYNC_BITS, portMAX_DELAY );
|
xEventGroupSync( xEventBits, TASK_2_BIT, ALL_SYNC_BITS, portMAX_DELAY );
|
||||||
|
|
||||||
// xEventGroupSync() was called with an indefinite block time, so
|
// xEventGroupSync() was called with an indefinite block time, so
|
||||||
// this task will only reach here if the syncrhonisation was made by all
|
// this task will only reach here if the syncrhonisation was made by all
|
||||||
// three tasks, so there is no need to test the return value.
|
// three tasks, so there is no need to test the return value.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
* \defgroup xEventGroupSync xEventGroupSync
|
* \defgroup xEventGroupSync xEventGroupSync
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
EventBits_t xEventGroupSync(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait) PRIVILEGED_FUNCTION;
|
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );
|
EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* Returns the current value of the bits in an event group. This function
|
* Returns the current value of the bits in an event group. This function
|
||||||
@@ -704,12 +705,12 @@ EventBits_t xEventGroupSync(EventGroupHandle_t xEventGroup, const EventBits_t ux
|
|||||||
* \defgroup xEventGroupGetBits xEventGroupGetBits
|
* \defgroup xEventGroupGetBits xEventGroupGetBits
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
#define xEventGroupGetBits(xEventGroup) xEventGroupClearBits(xEventGroup, 0)
|
#define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
|
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* A version of xEventGroupGetBits() that can be called from an ISR.
|
* A version of xEventGroupGetBits() that can be called from an ISR.
|
||||||
@@ -721,12 +722,12 @@ EventBits_t xEventGroupSync(EventGroupHandle_t xEventGroup, const EventBits_t ux
|
|||||||
* \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR
|
* \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR
|
||||||
* \ingroup EventGroup
|
* \ingroup EventGroup
|
||||||
*/
|
*/
|
||||||
EventBits_t xEventGroupGetBitsFromISR(EventGroupHandle_t xEventGroup) PRIVILEGED_FUNCTION;
|
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event_groups.h
|
* event_groups.h
|
||||||
*<pre>
|
*<pre>
|
||||||
void xEventGroupDelete( EventGroupHandle_t xEventGroup );
|
void xEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* Delete an event group that was previously created by a call to
|
* Delete an event group that was previously created by a call to
|
||||||
@@ -735,15 +736,16 @@ EventBits_t xEventGroupGetBitsFromISR(EventGroupHandle_t xEventGroup) PRIVILEGED
|
|||||||
*
|
*
|
||||||
* @param xEventGroup The event group being deleted.
|
* @param xEventGroup The event group being deleted.
|
||||||
*/
|
*/
|
||||||
void vEventGroupDelete(EventGroupHandle_t xEventGroup) PRIVILEGED_FUNCTION;
|
void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* For internal use only. */
|
/* For internal use only. */
|
||||||
void vEventGroupSetBitsCallback(void *pvEventGroup, const uint32_t ulBitsToSet) PRIVILEGED_FUNCTION;
|
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
|
||||||
void vEventGroupClearBitsCallback(void *pvEventGroup, const uint32_t ulBitsToClear) PRIVILEGED_FUNCTION;
|
void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
#if (configUSE_TRACE_FACILITY == 1)
|
#if (configUSE_TRACE_FACILITY == 1)
|
||||||
UBaseType_t uxEventGroupGetNumber(void *xEventGroup) PRIVILEGED_FUNCTION;
|
UBaseType_t uxEventGroupGetNumber( void* xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
void vEventGroupSetNumber(void *xEventGroup, UBaseType_t uxEventGroupNumber) PRIVILEGED_FUNCTION;
|
void vEventGroupSetNumber( void* xEventGroup, UBaseType_t uxEventGroupNumber ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -751,3 +753,5 @@ void vEventGroupSetNumber(void *xEventGroup, UBaseType_t uxEventGroupNumb
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* EVENT_GROUPS_H */
|
#endif /* EVENT_GROUPS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error FreeRTOS.h must be included before list.h
|
#error FreeRTOS.h must be included before list.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LIST_H
|
#ifndef LIST_H
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
* "#define configLIST_VOLATILE volatile"
|
* "#define configLIST_VOLATILE volatile"
|
||||||
*/
|
*/
|
||||||
#ifndef configLIST_VOLATILE
|
#ifndef configLIST_VOLATILE
|
||||||
#define configLIST_VOLATILE
|
#define configLIST_VOLATILE
|
||||||
#endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */
|
#endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -101,69 +101,73 @@ then check that the known values do not get corrupted during the execution of
|
|||||||
the application. These may catch the list data structures being overwritten in
|
the application. These may catch the list data structures being overwritten in
|
||||||
memory. They will not catch data errors caused by incorrect configuration or
|
memory. They will not catch data errors caused by incorrect configuration or
|
||||||
use of FreeRTOS.*/
|
use of FreeRTOS.*/
|
||||||
#if (configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0)
|
#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
|
||||||
/* Define the macros to do nothing. */
|
/* Define the macros to do nothing. */
|
||||||
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
||||||
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
||||||
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE
|
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE
|
||||||
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE
|
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE
|
||||||
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE(pxItem)
|
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
|
||||||
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE(pxItem)
|
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
|
||||||
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE(pxList)
|
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
|
||||||
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE(pxList)
|
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
|
||||||
#define listTEST_LIST_ITEM_INTEGRITY(pxItem)
|
#define listTEST_LIST_ITEM_INTEGRITY( pxItem )
|
||||||
#define listTEST_LIST_INTEGRITY(pxList)
|
#define listTEST_LIST_INTEGRITY( pxList )
|
||||||
#else
|
#else
|
||||||
/* Define macros that add new members into the list structures. */
|
/* Define macros that add new members into the list structures. */
|
||||||
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue1;
|
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue1;
|
||||||
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue2;
|
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue2;
|
||||||
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue1;
|
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue1;
|
||||||
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue2;
|
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue2;
|
||||||
|
|
||||||
/* Define macros that set the new structure members to known values. */
|
/* Define macros that set the new structure members to known values. */
|
||||||
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE(pxItem) (pxItem)->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||||
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE(pxItem) (pxItem)->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||||
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE(pxList) (pxList)->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||||
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE(pxList) (pxList)->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||||
|
|
||||||
/* Define macros that will assert if one of the structure members does not
|
/* Define macros that will assert if one of the structure members does not
|
||||||
contain its expected value. */
|
contain its expected value. */
|
||||||
#define listTEST_LIST_ITEM_INTEGRITY(pxItem) configASSERT(((pxItem)->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE) && ((pxItem)->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE))
|
#define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||||
#define listTEST_LIST_INTEGRITY(pxList) configASSERT(((pxList)->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE) && ((pxList)->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE))
|
#define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||||
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
|
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition of the only type of object that a list can contain.
|
* Definition of the only type of object that a list can contain.
|
||||||
*/
|
*/
|
||||||
struct xLIST;
|
struct xLIST;
|
||||||
struct xLIST_ITEM {
|
struct xLIST_ITEM
|
||||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
{
|
||||||
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
struct xLIST_ITEM *configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||||
struct xLIST_ITEM *configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||||
void *pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
||||||
struct xLIST *configLIST_VOLATILE pxContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||||
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
struct xLIST * configLIST_VOLATILE pxContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||||
|
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
};
|
};
|
||||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||||
|
|
||||||
struct xMINI_LIST_ITEM {
|
struct xMINI_LIST_ITEM
|
||||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
{
|
||||||
configLIST_VOLATILE TickType_t xItemValue;
|
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
struct xLIST_ITEM *configLIST_VOLATILE pxNext;
|
configLIST_VOLATILE TickType_t xItemValue;
|
||||||
struct xLIST_ITEM *configLIST_VOLATILE pxPrevious;
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||||
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||||
};
|
};
|
||||||
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition of the type of queue used by the scheduler.
|
* Definition of the type of queue used by the scheduler.
|
||||||
*/
|
*/
|
||||||
typedef struct xLIST {
|
typedef struct xLIST
|
||||||
listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
{
|
||||||
volatile UBaseType_t uxNumberOfItems;
|
listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
ListItem_t *configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
volatile UBaseType_t uxNumberOfItems;
|
||||||
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||||
listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||||
|
listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
} List_t;
|
} List_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -173,7 +177,7 @@ typedef struct xLIST {
|
|||||||
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listSET_LIST_ITEM_OWNER(pxListItem, pxOwner) ((pxListItem)->pvOwner = (void *)(pxOwner))
|
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to get the owner of a list item. The owner of a list item
|
* Access macro to get the owner of a list item. The owner of a list item
|
||||||
@@ -182,7 +186,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
* \page listGET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_LIST_ITEM_OWNER(pxListItem) ((pxListItem)->pvOwner)
|
#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to set the value of the list item. In most cases the value is
|
* Access macro to set the value of the list item. In most cases the value is
|
||||||
@@ -191,7 +195,7 @@ typedef struct xLIST {
|
|||||||
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listSET_LIST_ITEM_VALUE(pxListItem, xValue) ((pxListItem)->xItemValue = (xValue))
|
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to retrieve the value of the list item. The value can
|
* Access macro to retrieve the value of the list item. The value can
|
||||||
@@ -201,7 +205,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_LIST_ITEM_VALUE(pxListItem) ((pxListItem)->xItemValue)
|
#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to retrieve the value of the list item at the head of a given
|
* Access macro to retrieve the value of the list item at the head of a given
|
||||||
@@ -210,7 +214,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_ITEM_VALUE_OF_HEAD_ENTRY(pxList) (((pxList)->xListEnd).pxNext->xItemValue)
|
#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the list item at the head of the list.
|
* Return the list item at the head of the list.
|
||||||
@@ -218,7 +222,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
|
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_HEAD_ENTRY(pxList) (((pxList)->xListEnd).pxNext)
|
#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the next list item.
|
* Return the next list item.
|
||||||
@@ -226,7 +230,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_NEXT listGET_NEXT
|
* \page listGET_NEXT listGET_NEXT
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_NEXT(pxListItem) ((pxListItem)->pxNext)
|
#define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the list item that marks the end of the list
|
* Return the list item that marks the end of the list
|
||||||
@@ -234,7 +238,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_END_MARKER listGET_END_MARKER
|
* \page listGET_END_MARKER listGET_END_MARKER
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_END_MARKER(pxList) ((ListItem_t const *)(&((pxList)->xListEnd)))
|
#define listGET_END_MARKER( pxList ) ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to determine if a list contains any items. The macro will
|
* Access macro to determine if a list contains any items. The macro will
|
||||||
@@ -243,12 +247,12 @@ typedef struct xLIST {
|
|||||||
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listLIST_IS_EMPTY(pxList) (((pxList)->uxNumberOfItems == (UBaseType_t)0) ? pdTRUE : pdFALSE)
|
#define listLIST_IS_EMPTY( pxList ) ( ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? pdTRUE : pdFALSE )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to return the number of items in the list.
|
* Access macro to return the number of items in the list.
|
||||||
*/
|
*/
|
||||||
#define listCURRENT_LIST_LENGTH(pxList) ((pxList)->uxNumberOfItems)
|
#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access function to obtain the owner of the next entry in a list.
|
* Access function to obtain the owner of the next entry in a list.
|
||||||
@@ -270,17 +274,19 @@ typedef struct xLIST {
|
|||||||
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_OWNER_OF_NEXT_ENTRY(pxTCB, pxList) \
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
{ \
|
{ \
|
||||||
List_t *const pxConstList = (pxList); \
|
List_t * const pxConstList = ( pxList ); \
|
||||||
/* Increment the index to the next item and return the item, ensuring */ \
|
/* Increment the index to the next item and return the item, ensuring */ \
|
||||||
/* we don't return the marker used at the end of the list. */ \
|
/* we don't return the marker used at the end of the list. */ \
|
||||||
(pxConstList)->pxIndex = (pxConstList)->pxIndex->pxNext; \
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
if ((void *)(pxConstList)->pxIndex == (void *)&((pxConstList)->xListEnd)) { \
|
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
|
||||||
(pxConstList)->pxIndex = (pxConstList)->pxIndex->pxNext; \
|
{ \
|
||||||
} \
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
(pxTCB) = (pxConstList)->pxIndex->pvOwner; \
|
} \
|
||||||
}
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access function to obtain the owner of the first entry in a list. Lists
|
* Access function to obtain the owner of the first entry in a list. Lists
|
||||||
@@ -298,7 +304,7 @@ typedef struct xLIST {
|
|||||||
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_OWNER_OF_HEAD_ENTRY(pxList) ((&((pxList)->xListEnd))->pxNext->pvOwner)
|
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if a list item is within a list. The list item maintains a
|
* Check to see if a list item is within a list. The list item maintains a
|
||||||
@@ -309,7 +315,7 @@ typedef struct xLIST {
|
|||||||
* @param pxListItem The list item we want to know if is in the list.
|
* @param pxListItem The list item we want to know if is in the list.
|
||||||
* @return pdTRUE if the list item is in the list, otherwise pdFALSE.
|
* @return pdTRUE if the list item is in the list, otherwise pdFALSE.
|
||||||
*/
|
*/
|
||||||
#define listIS_CONTAINED_WITHIN(pxList, pxListItem) (((pxListItem)->pxContainer == (pxList)) ? (pdTRUE) : (pdFALSE))
|
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( ( pxListItem )->pxContainer == ( pxList ) ) ? ( pdTRUE ) : ( pdFALSE ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the list a list item is contained within (referenced from).
|
* Return the list a list item is contained within (referenced from).
|
||||||
@@ -317,14 +323,14 @@ typedef struct xLIST {
|
|||||||
* @param pxListItem The list item being queried.
|
* @param pxListItem The list item being queried.
|
||||||
* @return A pointer to the List_t object that references the pxListItem
|
* @return A pointer to the List_t object that references the pxListItem
|
||||||
*/
|
*/
|
||||||
#define listLIST_ITEM_CONTAINER(pxListItem) ((pxListItem)->pxContainer)
|
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pxContainer )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This provides a crude means of knowing if a list has been initialised, as
|
* This provides a crude means of knowing if a list has been initialised, as
|
||||||
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()
|
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()
|
||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
#define listLIST_IS_INITIALISED(pxList) ((pxList)->xListEnd.xItemValue == portMAX_DELAY)
|
#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be called before a list is used! This initialises all the members
|
* Must be called before a list is used! This initialises all the members
|
||||||
@@ -336,7 +342,7 @@ typedef struct xLIST {
|
|||||||
* \page vListInitialise vListInitialise
|
* \page vListInitialise vListInitialise
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
void vListInitialise(List_t *const pxList) PRIVILEGED_FUNCTION;
|
void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be called before a list item is used. This sets the list container to
|
* Must be called before a list item is used. This sets the list container to
|
||||||
@@ -347,7 +353,7 @@ void vListInitialise(List_t *const pxList) PRIVILEGED_FUNCTION;
|
|||||||
* \page vListInitialiseItem vListInitialiseItem
|
* \page vListInitialiseItem vListInitialiseItem
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
void vListInitialiseItem(ListItem_t *const pxItem) PRIVILEGED_FUNCTION;
|
void vListInitialiseItem( ListItem_t * const pxItem ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert a list item into a list. The item will be inserted into the list in
|
* Insert a list item into a list. The item will be inserted into the list in
|
||||||
@@ -360,7 +366,7 @@ void vListInitialiseItem(ListItem_t *const pxItem) PRIVILEGED_FUNCTION;
|
|||||||
* \page vListInsert vListInsert
|
* \page vListInsert vListInsert
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
void vListInsert(List_t *const pxList, ListItem_t *const pxNewListItem) PRIVILEGED_FUNCTION;
|
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert a list item into a list. The item will be inserted in a position
|
* Insert a list item into a list. The item will be inserted in a position
|
||||||
@@ -381,7 +387,7 @@ void vListInsert(List_t *const pxList, ListItem_t *const pxNewListItem) PRIVILEG
|
|||||||
* \page vListInsertEnd vListInsertEnd
|
* \page vListInsertEnd vListInsertEnd
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
void vListInsertEnd(List_t *const pxList, ListItem_t *const pxNewListItem) PRIVILEGED_FUNCTION;
|
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove an item from a list. The list item has a pointer to the list that
|
* Remove an item from a list. The list item has a pointer to the list that
|
||||||
@@ -396,10 +402,11 @@ void vListInsertEnd(List_t *const pxList, ListItem_t *const pxNewListItem) PRIVI
|
|||||||
* \page uxListRemove uxListRemove
|
* \page uxListRemove uxListRemove
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
UBaseType_t uxListRemove(ListItem_t *const pxItemToRemove) PRIVILEGED_FUNCTION;
|
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
* 1 tab == 4 spaces!
|
* 1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Message buffers build functionality on top of FreeRTOS stream buffers.
|
* Message buffers build functionality on top of FreeRTOS stream buffers.
|
||||||
* Whereas stream buffers are used to send a continuous stream of data from one
|
* Whereas stream buffers are used to send a continuous stream of data from one
|
||||||
@@ -62,13 +63,13 @@
|
|||||||
#define FREERTOS_MESSAGE_BUFFER_H
|
#define FREERTOS_MESSAGE_BUFFER_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include message_buffer.h"
|
#error "include FreeRTOS.h must appear in source files before include message_buffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Message buffers are built onto of stream buffers. */
|
/* Message buffers are built onto of stream buffers. */
|
||||||
#include "stream_buffer.h"
|
#include "stream_buffer.h"
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined( __cplusplus )
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ extern "C" {
|
|||||||
* then be used as a parameter to xMessageBufferSend(), xMessageBufferReceive(),
|
* then be used as a parameter to xMessageBufferSend(), xMessageBufferReceive(),
|
||||||
* etc.
|
* etc.
|
||||||
*/
|
*/
|
||||||
typedef void *MessageBufferHandle_t;
|
typedef void * MessageBufferHandle_t;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ const size_t xMessageBufferSizeBytes = 100;
|
|||||||
* \defgroup xMessageBufferCreate xMessageBufferCreate
|
* \defgroup xMessageBufferCreate xMessageBufferCreate
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferCreate(xBufferSizeBytes) (MessageBufferHandle_t) xStreamBufferGenericCreate(xBufferSizeBytes, (size_t)0, pdTRUE)
|
#define xMessageBufferCreate( xBufferSizeBytes ) ( MessageBufferHandle_t ) xStreamBufferGenericCreate( xBufferSizeBytes, ( size_t ) 0, pdTRUE )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -204,8 +205,7 @@ MessageBufferHandle_t xMessageBuffer;
|
|||||||
* \defgroup xMessageBufferCreateStatic xMessageBufferCreateStatic
|
* \defgroup xMessageBufferCreateStatic xMessageBufferCreateStatic
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferCreateStatic(xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer) \
|
#define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer )
|
||||||
(MessageBufferHandle_t) xStreamBufferGenericCreateStatic(xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -304,7 +304,7 @@ const TickType_t x100ms = pdMS_TO_TICKS( 100 );
|
|||||||
* \defgroup xMessageBufferSend xMessageBufferSend
|
* \defgroup xMessageBufferSend xMessageBufferSend
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferSend(xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait) xStreamBufferSend((StreamBufferHandle_t)xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait)
|
#define xMessageBufferSend( xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) xStreamBufferSend( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -408,8 +408,7 @@ BaseType_t xHigherPriorityTaskWoken = pdFALSE; // Initialised to pdFALSE.
|
|||||||
* \defgroup xMessageBufferSendFromISR xMessageBufferSendFromISR
|
* \defgroup xMessageBufferSendFromISR xMessageBufferSendFromISR
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferSendFromISR(xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken) \
|
#define xMessageBufferSendFromISR( xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) xStreamBufferSendFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken )
|
||||||
xStreamBufferSendFromISR((StreamBufferHandle_t)xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -497,7 +496,8 @@ const TickType_t xBlockTime = pdMS_TO_TICKS( 20 );
|
|||||||
* \defgroup xMessageBufferReceive xMessageBufferReceive
|
* \defgroup xMessageBufferReceive xMessageBufferReceive
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferReceive(xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait) xStreamBufferReceive((StreamBufferHandle_t)xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait)
|
#define xMessageBufferReceive( xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait ) xStreamBufferReceive( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -597,8 +597,7 @@ BaseType_t xHigherPriorityTaskWoken = pdFALSE; // Initialised to pdFALSE.
|
|||||||
* \defgroup xMessageBufferReceiveFromISR xMessageBufferReceiveFromISR
|
* \defgroup xMessageBufferReceiveFromISR xMessageBufferReceiveFromISR
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferReceiveFromISR(xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken) \
|
#define xMessageBufferReceiveFromISR( xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) xStreamBufferReceiveFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken )
|
||||||
xStreamBufferReceiveFromISR((StreamBufferHandle_t)xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -618,7 +617,7 @@ void vMessageBufferDelete( MessageBufferHandle_t xMessageBuffer );
|
|||||||
* @param xMessageBuffer The handle of the message buffer to be deleted.
|
* @param xMessageBuffer The handle of the message buffer to be deleted.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define vMessageBufferDelete(xMessageBuffer) vStreamBufferDelete((StreamBufferHandle_t)xMessageBuffer)
|
#define vMessageBufferDelete( xMessageBuffer ) vStreamBufferDelete( ( StreamBufferHandle_t ) xMessageBuffer )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -635,7 +634,7 @@ BaseType_t xMessageBufferIsFull( MessageBufferHandle_t xMessageBuffer ) );
|
|||||||
* @return If the message buffer referenced by xMessageBuffer is full then
|
* @return If the message buffer referenced by xMessageBuffer is full then
|
||||||
* pdTRUE is returned. Otherwise pdFALSE is returned.
|
* pdTRUE is returned. Otherwise pdFALSE is returned.
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferIsFull(xMessageBuffer) xStreamBufferIsFull((StreamBufferHandle_t)xMessageBuffer)
|
#define xMessageBufferIsFull( xMessageBuffer ) xStreamBufferIsFull( ( StreamBufferHandle_t ) xMessageBuffer )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -651,7 +650,7 @@ BaseType_t xMessageBufferIsEmpty( MessageBufferHandle_t xMessageBuffer ) );
|
|||||||
* pdTRUE is returned. Otherwise pdFALSE is returned.
|
* pdTRUE is returned. Otherwise pdFALSE is returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferIsEmpty(xMessageBuffer) xStreamBufferIsEmpty((StreamBufferHandle_t)xMessageBuffer)
|
#define xMessageBufferIsEmpty( xMessageBuffer ) xStreamBufferIsEmpty( ( StreamBufferHandle_t ) xMessageBuffer )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -674,7 +673,8 @@ BaseType_t xMessageBufferReset( MessageBufferHandle_t xMessageBuffer );
|
|||||||
* \defgroup xMessageBufferReset xMessageBufferReset
|
* \defgroup xMessageBufferReset xMessageBufferReset
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferReset(xMessageBuffer) xStreamBufferReset((StreamBufferHandle_t)xMessageBuffer)
|
#define xMessageBufferReset( xMessageBuffer ) xStreamBufferReset( ( StreamBufferHandle_t ) xMessageBuffer )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -695,8 +695,8 @@ size_t xMessageBufferSpaceAvailable( MessageBufferHandle_t xMessageBuffer ) );
|
|||||||
* \defgroup xMessageBufferSpaceAvailable xMessageBufferSpaceAvailable
|
* \defgroup xMessageBufferSpaceAvailable xMessageBufferSpaceAvailable
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferSpaceAvailable(xMessageBuffer) xStreamBufferSpacesAvailable((StreamBufferHandle_t)xMessageBuffer)
|
#define xMessageBufferSpaceAvailable( xMessageBuffer ) xStreamBufferSpacesAvailable( ( StreamBufferHandle_t ) xMessageBuffer )
|
||||||
#define xMessageBufferSpacesAvailable(xMessageBuffer) xStreamBufferSpacesAvailable((StreamBufferHandle_t)xMessageBuffer) /* Corrects typo in original macro name. */
|
#define xMessageBufferSpacesAvailable( xMessageBuffer ) xStreamBufferSpacesAvailable( ( StreamBufferHandle_t ) xMessageBuffer ) /* Corrects typo in original macro name. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -715,7 +715,7 @@ size_t xMessageBufferSpaceAvailable( MessageBufferHandle_t xMessageBuffer ) );
|
|||||||
* \defgroup xMessageBufferNextLengthBytes xMessageBufferNextLengthBytes
|
* \defgroup xMessageBufferNextLengthBytes xMessageBufferNextLengthBytes
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferNextLengthBytes(xMessageBuffer) xStreamBufferNextMessageLengthBytes((StreamBufferHandle_t)xMessageBuffer) PRIVILEGED_FUNCTION;
|
#define xMessageBufferNextLengthBytes( xMessageBuffer ) xStreamBufferNextMessageLengthBytes( ( StreamBufferHandle_t ) xMessageBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -754,7 +754,7 @@ BaseType_t xMessageBufferSendCompletedFromISR( MessageBufferHandle_t xStreamBuff
|
|||||||
* \defgroup xMessageBufferSendCompletedFromISR xMessageBufferSendCompletedFromISR
|
* \defgroup xMessageBufferSendCompletedFromISR xMessageBufferSendCompletedFromISR
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferSendCompletedFromISR(xMessageBuffer, pxHigherPriorityTaskWoken) xStreamBufferSendCompletedFromISR((StreamBufferHandle_t)xMessageBuffer, pxHigherPriorityTaskWoken)
|
#define xMessageBufferSendCompletedFromISR( xMessageBuffer, pxHigherPriorityTaskWoken ) xStreamBufferSendCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -794,10 +794,10 @@ BaseType_t xMessageBufferReceiveCompletedFromISR( MessageBufferHandle_t xStreamB
|
|||||||
* \defgroup xMessageBufferReceiveCompletedFromISR xMessageBufferReceiveCompletedFromISR
|
* \defgroup xMessageBufferReceiveCompletedFromISR xMessageBufferReceiveCompletedFromISR
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferReceiveCompletedFromISR(xMessageBuffer, pxHigherPriorityTaskWoken) xStreamBufferReceiveCompletedFromISR((StreamBufferHandle_t)xMessageBuffer, pxHigherPriorityTaskWoken)
|
#define xMessageBufferReceiveCompletedFromISR( xMessageBuffer, pxHigherPriorityTaskWoken ) xStreamBufferReceiveCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken )
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined( __cplusplus )
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* !defined( FREERTOS_MESSAGE_BUFFER_H ) */
|
#endif /* !defined( FREERTOS_MESSAGE_BUFFER_H ) */
|
||||||
|
|||||||
@@ -33,132 +33,128 @@
|
|||||||
* so the kernel code always runs will full privileges.
|
* so the kernel code always runs will full privileges.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef MPU_PROTOTYPES_H
|
#ifndef MPU_PROTOTYPES_H
|
||||||
#define MPU_PROTOTYPES_H
|
#define MPU_PROTOTYPES_H
|
||||||
|
|
||||||
/* MPU versions of tasks.h API functions. */
|
/* MPU versions of tasks.h API functions. */
|
||||||
BaseType_t MPU_xTaskCreate(TaskFunction_t pxTaskCode, const char *const pcName, const uint16_t usStackDepth, void *const pvParameters, UBaseType_t uxPriority,
|
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t *const pxCreatedTask) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xTaskCreateStatic(TaskFunction_t pxTaskCode, const char *const pcName, const uint32_t ulStackDepth, void *const pvParameters, UBaseType_t uxPriority,
|
BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) FREERTOS_SYSTEM_CALL;
|
||||||
StackType_t *const puxStackBuffer, StaticTask_t *const pxTaskBuffer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskCreateRestricted(const TaskParameters_t *const pxTaskDefinition, TaskHandle_t *pxCreatedTask) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskCreateRestrictedStatic(const TaskParameters_t *const pxTaskDefinition, TaskHandle_t *pxCreatedTask) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskAllocateMPURegions(TaskHandle_t xTask, const MemoryRegion_t *const pxRegions) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskDelete(TaskHandle_t xTaskToDelete) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskDelay(const TickType_t xTicksToDelay) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskDelayUntil(TickType_t *const pxPreviousWakeTime, const TickType_t xTimeIncrement) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskAbortDelay(TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTaskPriorityGet(const TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ) FREERTOS_SYSTEM_CALL;
|
||||||
eTaskState MPU_eTaskGetState(TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskGetInfo(TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskSuspend(TaskHandle_t xTaskToSuspend) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskStartScheduler( void ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskResume(TaskHandle_t xTaskToResume) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskSuspendAll( void ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskStartScheduler(void) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskResumeAll( void ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskSuspendAll(void) FREERTOS_SYSTEM_CALL;
|
TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskResumeAll(void) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL;
|
||||||
TickType_t MPU_xTaskGetTickCount(void) FREERTOS_SYSTEM_CALL;
|
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTaskGetNumberOfTasks(void) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xTaskGetHandle( const char *pcNameToQuery ) FREERTOS_SYSTEM_CALL;
|
||||||
char * MPU_pcTaskGetName(TaskHandle_t xTaskToQuery) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xTaskGetHandle(const char *pcNameToQuery) FREERTOS_SYSTEM_CALL;
|
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTaskGetStackHighWaterMark(TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ) FREERTOS_SYSTEM_CALL;
|
||||||
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2(TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskSetApplicationTaskTag(TaskHandle_t xTask, TaskHookFunction_t pxHookFunction) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag(TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskSetThreadLocalStoragePointer(TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) FREERTOS_SYSTEM_CALL;
|
||||||
void * MPU_pvTaskGetThreadLocalStoragePointer(TaskHandle_t xTaskToQuery, BaseType_t xIndex) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskCallApplicationTaskHook(TaskHandle_t xTask, void *pvParameter) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xTaskGetIdleTaskHandle(void) FREERTOS_SYSTEM_CALL;
|
uint32_t MPU_ulTaskGetIdleRunTimeCounter( void ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTaskGetSystemState(TaskStatus_t *const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t *const pulTotalRunTime) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskList( char * pcWriteBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
uint32_t MPU_ulTaskGetIdleRunTimeCounter(void) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskList(char *pcWriteBuffer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskGetRunTimeStats(char *pcWriteBuffer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskGenericNotify(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue) FREERTOS_SYSTEM_CALL;
|
uint32_t MPU_ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskNotifyWait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskNotifyStateClear( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
uint32_t MPU_ulTaskNotifyTake(BaseType_t xClearCountOnExit, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
uint32_t MPU_ulTaskNotifyValueClear( TaskHandle_t xTask, uint32_t ulBitsToClear ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskNotifyStateClear(TaskHandle_t xTask) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskIncrementTick( void ) FREERTOS_SYSTEM_CALL;
|
||||||
uint32_t MPU_ulTaskNotifyValueClear(TaskHandle_t xTask, uint32_t ulBitsToClear) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskIncrementTick(void) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xTaskGetCurrentTaskHandle(void) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskSetTimeOutState(TimeOut_t *const pxTimeOut) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskMissedYield( void ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskCheckForTimeOut(TimeOut_t *const pxTimeOut, TickType_t *const pxTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskMissedYield(void) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskGetSchedulerState(void) FREERTOS_SYSTEM_CALL;
|
|
||||||
BaseType_t MPU_xTaskCatchUpTicks(TickType_t xTicksToCatchUp) FREERTOS_SYSTEM_CALL;
|
|
||||||
|
|
||||||
/* MPU versions of queue.h API functions. */
|
/* MPU versions of queue.h API functions. */
|
||||||
BaseType_t MPU_xQueueGenericSend(QueueHandle_t xQueue, const void *const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueReceive(QueueHandle_t xQueue, void *const pvBuffer, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueuePeek(QueueHandle_t xQueue, void *const pvBuffer, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueSemaphoreTake(QueueHandle_t xQueue, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxQueueMessagesWaiting(const QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxQueueSpacesAvailable(const QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vQueueDelete(QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
void MPU_vQueueDelete( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueHandle_t MPU_xQueueCreateMutex(const uint8_t ucQueueType) FREERTOS_SYSTEM_CALL;
|
QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueHandle_t MPU_xQueueCreateMutexStatic(const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue) FREERTOS_SYSTEM_CALL;
|
QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueHandle_t MPU_xQueueCreateCountingSemaphore(const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount) FREERTOS_SYSTEM_CALL;
|
QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic(const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue) FREERTOS_SYSTEM_CALL;
|
QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xQueueGetMutexHolder(QueueHandle_t xSemaphore) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueTakeMutexRecursive(QueueHandle_t xMutex, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueGiveMutexRecursive(QueueHandle_t pxMutex) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vQueueAddToRegistry(QueueHandle_t xQueue, const char *pcName) FREERTOS_SYSTEM_CALL;
|
void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vQueueUnregisterQueue(QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
const char * MPU_pcQueueGetName(QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueHandle_t MPU_xQueueGenericCreate(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType) FREERTOS_SYSTEM_CALL;
|
QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueHandle_t MPU_xQueueGenericCreateStatic(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue,
|
QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
|
||||||
const uint8_t ucQueueType) FREERTOS_SYSTEM_CALL;
|
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueSetHandle_t MPU_xQueueCreateSet(const UBaseType_t uxEventQueueLength) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueAddToSet(QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueRemoveFromSet(QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet) FREERTOS_SYSTEM_CALL;
|
QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
QueueSetMemberHandle_t MPU_xQueueSelectFromSet(QueueSetHandle_t xQueueSet, const TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xQueueGenericReset(QueueHandle_t xQueue, BaseType_t xNewQueue) FREERTOS_SYSTEM_CALL;
|
void MPU_vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vQueueSetQueueNumber(QueueHandle_t xQueue, UBaseType_t uxQueueNumber) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxQueueGetQueueNumber( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxQueueGetQueueNumber(QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
uint8_t MPU_ucQueueGetQueueType(QueueHandle_t xQueue) FREERTOS_SYSTEM_CALL;
|
|
||||||
|
|
||||||
/* MPU versions of timers.h API functions. */
|
/* MPU versions of timers.h API functions. */
|
||||||
TimerHandle_t MPU_xTimerCreate(const char *const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void *const pvTimerID,
|
TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction ) FREERTOS_SYSTEM_CALL;
|
||||||
TimerCallbackFunction_t pxCallbackFunction) FREERTOS_SYSTEM_CALL;
|
TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
TimerHandle_t MPU_xTimerCreateStatic(const char *const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void *const pvTimerID,
|
void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer) FREERTOS_SYSTEM_CALL;
|
void MPU_vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ) FREERTOS_SYSTEM_CALL;
|
||||||
void * MPU_pvTimerGetTimerID(const TimerHandle_t xTimer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTimerSetTimerID(TimerHandle_t xTimer, void *pvNewID) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTimerIsTimerActive(TimerHandle_t xTimer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle(void) FREERTOS_SYSTEM_CALL;
|
const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTimerPendFunctionCall(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL;
|
||||||
const char * MPU_pcTimerGetName(TimerHandle_t xTimer) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTimerSetReloadMode(TimerHandle_t xTimer, const UBaseType_t uxAutoReload) FREERTOS_SYSTEM_CALL;
|
TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTimerGetReloadMode(TimerHandle_t xTimer) FREERTOS_SYSTEM_CALL;
|
TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
TickType_t MPU_xTimerGetPeriod(TimerHandle_t xTimer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTimerCreateTimerTask( void ) FREERTOS_SYSTEM_CALL;
|
||||||
TickType_t MPU_xTimerGetExpiryTime(TimerHandle_t xTimer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTimerCreateTimerTask(void) FREERTOS_SYSTEM_CALL;
|
|
||||||
BaseType_t MPU_xTimerGenericCommand(TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t *const pxHigherPriorityTaskWoken,
|
|
||||||
const TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
|
||||||
|
|
||||||
/* MPU versions of event_group.h API functions. */
|
/* MPU versions of event_group.h API functions. */
|
||||||
EventGroupHandle_t MPU_xEventGroupCreate(void) FREERTOS_SYSTEM_CALL;
|
EventGroupHandle_t MPU_xEventGroupCreate( void ) FREERTOS_SYSTEM_CALL;
|
||||||
EventGroupHandle_t MPU_xEventGroupCreateStatic(StaticEventGroup_t *pxEventGroupBuffer) FREERTOS_SYSTEM_CALL;
|
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
EventBits_t MPU_xEventGroupWaitBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits,
|
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL;
|
||||||
EventBits_t MPU_xEventGroupClearBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear) FREERTOS_SYSTEM_CALL;
|
EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) FREERTOS_SYSTEM_CALL;
|
||||||
EventBits_t MPU_xEventGroupSetBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet) FREERTOS_SYSTEM_CALL;
|
EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
EventBits_t MPU_xEventGroupSync(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vEventGroupDelete(EventGroupHandle_t xEventGroup) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxEventGroupGetNumber( void* xEventGroup ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxEventGroupGetNumber(void *xEventGroup) FREERTOS_SYSTEM_CALL;
|
|
||||||
|
|
||||||
/* MPU versions of message/stream_buffer.h API functions. */
|
/* MPU versions of message/stream_buffer.h API functions. */
|
||||||
size_t MPU_xStreamBufferSend(StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
size_t MPU_xStreamBufferReceive(StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait) FREERTOS_SYSTEM_CALL;
|
size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
size_t MPU_xStreamBufferNextMessageLengthBytes(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vStreamBufferDelete(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xStreamBufferIsFull(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xStreamBufferIsEmpty(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xStreamBufferReset(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
size_t MPU_xStreamBufferSpacesAvailable(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
size_t MPU_xStreamBufferBytesAvailable(StreamBufferHandle_t xStreamBuffer) FREERTOS_SYSTEM_CALL;
|
size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xStreamBufferSetTriggerLevel(StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel ) FREERTOS_SYSTEM_CALL;
|
||||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreate(size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer) FREERTOS_SYSTEM_CALL;
|
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic(size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer, uint8_t *const pucStreamBufferStorageArea,
|
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer, uint8_t * const pucStreamBufferStorageArea, StaticStreamBuffer_t * const pxStaticStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
StaticStreamBuffer_t *const pxStaticStreamBuffer) FREERTOS_SYSTEM_CALL;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* MPU_PROTOTYPES_H */
|
#endif /* MPU_PROTOTYPES_H */
|
||||||
|
|
||||||
|
|||||||
@@ -32,155 +32,158 @@
|
|||||||
only for ports that are using the MPU. */
|
only for ports that are using the MPU. */
|
||||||
#ifdef portUSING_MPU_WRAPPERS
|
#ifdef portUSING_MPU_WRAPPERS
|
||||||
|
|
||||||
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
|
||||||
included from queue.c or task.c to prevent it from having an effect within
|
included from queue.c or task.c to prevent it from having an effect within
|
||||||
those files. */
|
those files. */
|
||||||
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map standard (non MPU) API functions to equivalents that start
|
* Map standard (non MPU) API functions to equivalents that start
|
||||||
* "MPU_". This will cause the application code to call the MPU_
|
* "MPU_". This will cause the application code to call the MPU_
|
||||||
* version, which wraps the non-MPU version with privilege promoting
|
* version, which wraps the non-MPU version with privilege promoting
|
||||||
* then demoting code, so the kernel code always runs will full
|
* then demoting code, so the kernel code always runs will full
|
||||||
* privileges.
|
* privileges.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Map standard tasks.h API functions to the MPU equivalents. */
|
/* Map standard tasks.h API functions to the MPU equivalents. */
|
||||||
#define xTaskCreate MPU_xTaskCreate
|
#define xTaskCreate MPU_xTaskCreate
|
||||||
#define xTaskCreateStatic MPU_xTaskCreateStatic
|
#define xTaskCreateStatic MPU_xTaskCreateStatic
|
||||||
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
||||||
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||||
#define vTaskDelete MPU_vTaskDelete
|
#define vTaskDelete MPU_vTaskDelete
|
||||||
#define vTaskDelay MPU_vTaskDelay
|
#define vTaskDelay MPU_vTaskDelay
|
||||||
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
||||||
#define xTaskAbortDelay MPU_xTaskAbortDelay
|
#define xTaskAbortDelay MPU_xTaskAbortDelay
|
||||||
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||||
#define eTaskGetState MPU_eTaskGetState
|
#define eTaskGetState MPU_eTaskGetState
|
||||||
#define vTaskGetInfo MPU_vTaskGetInfo
|
#define vTaskGetInfo MPU_vTaskGetInfo
|
||||||
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||||
#define vTaskSuspend MPU_vTaskSuspend
|
#define vTaskSuspend MPU_vTaskSuspend
|
||||||
#define vTaskResume MPU_vTaskResume
|
#define vTaskResume MPU_vTaskResume
|
||||||
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||||
#define xTaskResumeAll MPU_xTaskResumeAll
|
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||||
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||||
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||||
#define pcTaskGetName MPU_pcTaskGetName
|
#define pcTaskGetName MPU_pcTaskGetName
|
||||||
#define xTaskGetHandle MPU_xTaskGetHandle
|
#define xTaskGetHandle MPU_xTaskGetHandle
|
||||||
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||||
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
|
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
|
||||||
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||||
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
||||||
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
|
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
|
||||||
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
|
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
|
||||||
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||||
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
||||||
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
||||||
#define vTaskList MPU_vTaskList
|
#define vTaskList MPU_vTaskList
|
||||||
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
||||||
#define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter
|
#define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter
|
||||||
#define xTaskGenericNotify MPU_xTaskGenericNotify
|
#define xTaskGenericNotify MPU_xTaskGenericNotify
|
||||||
#define xTaskNotifyWait MPU_xTaskNotifyWait
|
#define xTaskNotifyWait MPU_xTaskNotifyWait
|
||||||
#define ulTaskNotifyTake MPU_ulTaskNotifyTake
|
#define ulTaskNotifyTake MPU_ulTaskNotifyTake
|
||||||
#define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
|
#define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
|
||||||
#define ulTaskNotifyValueClear MPU_ulTaskNotifyValueClear
|
#define ulTaskNotifyValueClear MPU_ulTaskNotifyValueClear
|
||||||
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
|
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
|
||||||
|
|
||||||
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
||||||
#define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
|
#define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
|
||||||
#define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
|
#define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
|
||||||
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
||||||
|
|
||||||
/* Map standard queue.h API functions to the MPU equivalents. */
|
/* Map standard queue.h API functions to the MPU equivalents. */
|
||||||
#define xQueueGenericSend MPU_xQueueGenericSend
|
#define xQueueGenericSend MPU_xQueueGenericSend
|
||||||
#define xQueueReceive MPU_xQueueReceive
|
#define xQueueReceive MPU_xQueueReceive
|
||||||
#define xQueuePeek MPU_xQueuePeek
|
#define xQueuePeek MPU_xQueuePeek
|
||||||
#define xQueueSemaphoreTake MPU_xQueueSemaphoreTake
|
#define xQueueSemaphoreTake MPU_xQueueSemaphoreTake
|
||||||
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
||||||
#define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
|
#define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
|
||||||
#define vQueueDelete MPU_vQueueDelete
|
#define vQueueDelete MPU_vQueueDelete
|
||||||
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
||||||
#define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
|
#define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
|
||||||
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
||||||
#define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
|
#define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
|
||||||
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
||||||
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
||||||
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
||||||
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
||||||
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
||||||
#define xQueueCreateSet MPU_xQueueCreateSet
|
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||||
#define xQueueAddToSet MPU_xQueueAddToSet
|
#define xQueueAddToSet MPU_xQueueAddToSet
|
||||||
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||||
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
||||||
#define xQueueGenericReset MPU_xQueueGenericReset
|
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||||
|
|
||||||
#if (configQUEUE_REGISTRY_SIZE > 0)
|
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||||
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
||||||
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
||||||
#define pcQueueGetName MPU_pcQueueGetName
|
#define pcQueueGetName MPU_pcQueueGetName
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Map standard timer.h API functions to the MPU equivalents. */
|
/* Map standard timer.h API functions to the MPU equivalents. */
|
||||||
#define xTimerCreate MPU_xTimerCreate
|
#define xTimerCreate MPU_xTimerCreate
|
||||||
#define xTimerCreateStatic MPU_xTimerCreateStatic
|
#define xTimerCreateStatic MPU_xTimerCreateStatic
|
||||||
#define pvTimerGetTimerID MPU_pvTimerGetTimerID
|
#define pvTimerGetTimerID MPU_pvTimerGetTimerID
|
||||||
#define vTimerSetTimerID MPU_vTimerSetTimerID
|
#define vTimerSetTimerID MPU_vTimerSetTimerID
|
||||||
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
||||||
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
||||||
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
|
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
|
||||||
#define pcTimerGetName MPU_pcTimerGetName
|
#define pcTimerGetName MPU_pcTimerGetName
|
||||||
#define vTimerSetReloadMode MPU_vTimerSetReloadMode
|
#define vTimerSetReloadMode MPU_vTimerSetReloadMode
|
||||||
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
|
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
|
||||||
#define xTimerGetPeriod MPU_xTimerGetPeriod
|
#define xTimerGetPeriod MPU_xTimerGetPeriod
|
||||||
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
||||||
#define xTimerGenericCommand MPU_xTimerGenericCommand
|
#define xTimerGenericCommand MPU_xTimerGenericCommand
|
||||||
|
|
||||||
/* Map standard event_group.h API functions to the MPU equivalents. */
|
/* Map standard event_group.h API functions to the MPU equivalents. */
|
||||||
#define xEventGroupCreate MPU_xEventGroupCreate
|
#define xEventGroupCreate MPU_xEventGroupCreate
|
||||||
#define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
|
#define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
|
||||||
#define xEventGroupWaitBits MPU_xEventGroupWaitBits
|
#define xEventGroupWaitBits MPU_xEventGroupWaitBits
|
||||||
#define xEventGroupClearBits MPU_xEventGroupClearBits
|
#define xEventGroupClearBits MPU_xEventGroupClearBits
|
||||||
#define xEventGroupSetBits MPU_xEventGroupSetBits
|
#define xEventGroupSetBits MPU_xEventGroupSetBits
|
||||||
#define xEventGroupSync MPU_xEventGroupSync
|
#define xEventGroupSync MPU_xEventGroupSync
|
||||||
#define vEventGroupDelete MPU_vEventGroupDelete
|
#define vEventGroupDelete MPU_vEventGroupDelete
|
||||||
|
|
||||||
/* Map standard message/stream_buffer.h API functions to the MPU
|
/* Map standard message/stream_buffer.h API functions to the MPU
|
||||||
equivalents. */
|
equivalents. */
|
||||||
#define xStreamBufferSend MPU_xStreamBufferSend
|
#define xStreamBufferSend MPU_xStreamBufferSend
|
||||||
#define xStreamBufferReceive MPU_xStreamBufferReceive
|
#define xStreamBufferReceive MPU_xStreamBufferReceive
|
||||||
#define xStreamBufferNextMessageLengthBytes MPU_xStreamBufferNextMessageLengthBytes
|
#define xStreamBufferNextMessageLengthBytes MPU_xStreamBufferNextMessageLengthBytes
|
||||||
#define vStreamBufferDelete MPU_vStreamBufferDelete
|
#define vStreamBufferDelete MPU_vStreamBufferDelete
|
||||||
#define xStreamBufferIsFull MPU_xStreamBufferIsFull
|
#define xStreamBufferIsFull MPU_xStreamBufferIsFull
|
||||||
#define xStreamBufferIsEmpty MPU_xStreamBufferIsEmpty
|
#define xStreamBufferIsEmpty MPU_xStreamBufferIsEmpty
|
||||||
#define xStreamBufferReset MPU_xStreamBufferReset
|
#define xStreamBufferReset MPU_xStreamBufferReset
|
||||||
#define xStreamBufferSpacesAvailable MPU_xStreamBufferSpacesAvailable
|
#define xStreamBufferSpacesAvailable MPU_xStreamBufferSpacesAvailable
|
||||||
#define xStreamBufferBytesAvailable MPU_xStreamBufferBytesAvailable
|
#define xStreamBufferBytesAvailable MPU_xStreamBufferBytesAvailable
|
||||||
#define xStreamBufferSetTriggerLevel MPU_xStreamBufferSetTriggerLevel
|
#define xStreamBufferSetTriggerLevel MPU_xStreamBufferSetTriggerLevel
|
||||||
#define xStreamBufferGenericCreate MPU_xStreamBufferGenericCreate
|
#define xStreamBufferGenericCreate MPU_xStreamBufferGenericCreate
|
||||||
#define xStreamBufferGenericCreateStatic MPU_xStreamBufferGenericCreateStatic
|
#define xStreamBufferGenericCreateStatic MPU_xStreamBufferGenericCreateStatic
|
||||||
|
|
||||||
/* Remove the privileged function macro, but keep the PRIVILEGED_DATA
|
|
||||||
macro so applications can place data in privileged access sections
|
|
||||||
(useful when using statically allocated objects). */
|
|
||||||
#define PRIVILEGED_FUNCTION
|
|
||||||
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
|
||||||
#define FREERTOS_SYSTEM_CALL
|
|
||||||
|
|
||||||
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
/* Remove the privileged function macro, but keep the PRIVILEGED_DATA
|
||||||
|
macro so applications can place data in privileged access sections
|
||||||
|
(useful when using statically allocated objects). */
|
||||||
|
#define PRIVILEGED_FUNCTION
|
||||||
|
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
||||||
|
#define FREERTOS_SYSTEM_CALL
|
||||||
|
|
||||||
/* Ensure API functions go in the privileged execution section. */
|
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
|
||||||
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
|
||||||
#define FREERTOS_SYSTEM_CALL __attribute__((section("freertos_system_calls")))
|
|
||||||
|
|
||||||
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
/* Ensure API functions go in the privileged execution section. */
|
||||||
|
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
||||||
|
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
||||||
|
#define FREERTOS_SYSTEM_CALL __attribute__((section( "freertos_system_calls")))
|
||||||
|
|
||||||
|
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
#else /* portUSING_MPU_WRAPPERS */
|
#else /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
#define PRIVILEGED_FUNCTION
|
#define PRIVILEGED_FUNCTION
|
||||||
#define PRIVILEGED_DATA
|
#define PRIVILEGED_DATA
|
||||||
#define FREERTOS_SYSTEM_CALL
|
#define FREERTOS_SYSTEM_CALL
|
||||||
#define portUSING_MPU_WRAPPERS 0
|
#define portUSING_MPU_WRAPPERS 0
|
||||||
|
|
||||||
#endif /* portUSING_MPU_WRAPPERS */
|
#endif /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
|
|
||||||
#endif /* MPU_WRAPPERS_H */
|
#endif /* MPU_WRAPPERS_H */
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ must be set in the compiler's include path. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mpu_wrappers.h"
|
#include "mpu_wrappers.h"
|
||||||
@@ -105,9 +106,9 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#if (portUSING_MPU_WRAPPERS == 1)
|
#if (portUSING_MPU_WRAPPERS == 1)
|
||||||
#if (portHAS_STACK_OVERFLOW_CHECKING == 1)
|
#if (portHAS_STACK_OVERFLOW_CHECKING == 1)
|
||||||
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, StackType_t *pxEndOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged) PRIVILEGED_FUNCTION;
|
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, StackType_t *pxEndOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged) PRIVILEGED_FUNCTION;
|
||||||
#else
|
#else
|
||||||
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged) PRIVILEGED_FUNCTION;
|
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if (portHAS_STACK_OVERFLOW_CHECKING == 1)
|
#if (portHAS_STACK_OVERFLOW_CHECKING == 1)
|
||||||
@@ -117,25 +118,27 @@ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxC
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Used by heap_5.c to define the start address and size of each memory region
|
/* Used by heap_5.c to define the start address and size of each memory region
|
||||||
that together comprise the total FreeRTOS heap space. */
|
that together comprise the total FreeRTOS heap space. */
|
||||||
typedef struct HeapRegion {
|
typedef struct HeapRegion
|
||||||
uint8_t *pucStartAddress;
|
{
|
||||||
size_t xSizeInBytes;
|
uint8_t *pucStartAddress;
|
||||||
} HeapRegion_t;
|
size_t xSizeInBytes;
|
||||||
|
} HeapRegion_t;
|
||||||
|
|
||||||
/* Used to pass information about the heap out of vPortGetHeapStats(). */
|
/* Used to pass information about the heap out of vPortGetHeapStats(). */
|
||||||
typedef struct xHeapStats {
|
typedef struct xHeapStats
|
||||||
size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */
|
{
|
||||||
size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
|
size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */
|
||||||
size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
|
size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
|
||||||
size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */
|
size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
|
||||||
size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */
|
size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */
|
||||||
size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */
|
size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */
|
||||||
size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */
|
size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */
|
||||||
} HeapStats_t;
|
size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */
|
||||||
|
} HeapStats_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Used to define multiple heap regions for use by heap_5.c. This function
|
* Used to define multiple heap regions for use by heap_5.c. This function
|
||||||
* must be called before any calls to pvPortMalloc() - not creating a task,
|
* must be called before any calls to pvPortMalloc() - not creating a task,
|
||||||
* queue, semaphore, mutex, software timer, event group, etc. will result in
|
* queue, semaphore, mutex, software timer, event group, etc. will result in
|
||||||
@@ -146,35 +149,35 @@ typedef struct xHeapStats {
|
|||||||
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
||||||
* with the lowest start address must appear first in the array.
|
* with the lowest start address must appear first in the array.
|
||||||
*/
|
*/
|
||||||
void vPortDefineHeapRegions(const HeapRegion_t *const pxHeapRegions) PRIVILEGED_FUNCTION;
|
void vPortDefineHeapRegions(const HeapRegion_t *const pxHeapRegions) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a HeapStats_t structure filled with information about the current
|
* Returns a HeapStats_t structure filled with information about the current
|
||||||
* heap state.
|
* heap state.
|
||||||
*/
|
*/
|
||||||
void vPortGetHeapStats(HeapStats_t *pxHeapStats);
|
void vPortGetHeapStats(HeapStats_t *pxHeapStats);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map to the memory management routines required for the port.
|
* Map to the memory management routines required for the port.
|
||||||
*/
|
*/
|
||||||
void * pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION;
|
void *pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION;
|
||||||
void vPortFree(void *pv) PRIVILEGED_FUNCTION;
|
void vPortFree(void *pv) PRIVILEGED_FUNCTION;
|
||||||
void vPortInitialiseBlocks(void) PRIVILEGED_FUNCTION;
|
void vPortInitialiseBlocks(void) PRIVILEGED_FUNCTION;
|
||||||
size_t xPortGetFreeHeapSize(void) PRIVILEGED_FUNCTION;
|
size_t xPortGetFreeHeapSize(void) PRIVILEGED_FUNCTION;
|
||||||
size_t xPortGetMinimumEverFreeHeapSize(void) PRIVILEGED_FUNCTION;
|
size_t xPortGetMinimumEverFreeHeapSize(void) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup the hardware ready for the scheduler to take control. This generally
|
* Setup the hardware ready for the scheduler to take control. This generally
|
||||||
* sets up a tick interrupt and sets timers for the correct tick frequency.
|
* sets up a tick interrupt and sets timers for the correct tick frequency.
|
||||||
*/
|
*/
|
||||||
BaseType_t xPortStartScheduler(void) PRIVILEGED_FUNCTION;
|
BaseType_t xPortStartScheduler(void) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
|
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
|
||||||
* the hardware is left in its original condition after the scheduler stops
|
* the hardware is left in its original condition after the scheduler stops
|
||||||
* executing.
|
* executing.
|
||||||
*/
|
*/
|
||||||
void vPortEndScheduler(void) PRIVILEGED_FUNCTION;
|
void vPortEndScheduler(void) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The structures and methods of manipulating the MPU are contained within the
|
* The structures and methods of manipulating the MPU are contained within the
|
||||||
@@ -184,8 +187,8 @@ void vPortEndScheduler(void) PRIVILEGED_FUNCTION;
|
|||||||
* contained in xRegions.
|
* contained in xRegions.
|
||||||
*/
|
*/
|
||||||
#if (portUSING_MPU_WRAPPERS == 1)
|
#if (portUSING_MPU_WRAPPERS == 1)
|
||||||
struct xMEMORY_REGION;
|
struct xMEMORY_REGION;
|
||||||
void vPortStoreTaskMPUSettings(xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION *const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth) PRIVILEGED_FUNCTION;
|
void vPortStoreTaskMPUSettings(xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION *const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -32,89 +32,93 @@
|
|||||||
* Defines the prototype to which task functions must conform. Defined in this
|
* Defines the prototype to which task functions must conform. Defined in this
|
||||||
* file to ensure the type is known before portable.h is included.
|
* file to ensure the type is known before portable.h is included.
|
||||||
*/
|
*/
|
||||||
typedef void (*TaskFunction_t)(void *);
|
typedef void (*TaskFunction_t)( void * );
|
||||||
|
|
||||||
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
||||||
overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
||||||
definition here is not suitable for your application. */
|
definition here is not suitable for your application. */
|
||||||
#ifndef pdMS_TO_TICKS
|
#ifndef pdMS_TO_TICKS
|
||||||
#define pdMS_TO_TICKS(xTimeInMs) ((TickType_t)(((TickType_t)(xTimeInMs) * (TickType_t)configTICK_RATE_HZ) / (TickType_t)1000))
|
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define pdFALSE ((BaseType_t)0)
|
#define pdFALSE ( ( BaseType_t ) 0 )
|
||||||
#define pdTRUE ((BaseType_t)1)
|
#define pdTRUE ( ( BaseType_t ) 1 )
|
||||||
|
|
||||||
#define pdPASS (pdTRUE)
|
#define pdPASS ( pdTRUE )
|
||||||
#define pdFAIL (pdFALSE)
|
#define pdFAIL ( pdFALSE )
|
||||||
#define errQUEUE_EMPTY ((BaseType_t)0)
|
#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
|
||||||
#define errQUEUE_FULL ((BaseType_t)0)
|
#define errQUEUE_FULL ( ( BaseType_t ) 0 )
|
||||||
|
|
||||||
/* FreeRTOS error definitions. */
|
/* FreeRTOS error definitions. */
|
||||||
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY (-1)
|
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||||
#define errQUEUE_BLOCKED (-4)
|
#define errQUEUE_BLOCKED ( -4 )
|
||||||
#define errQUEUE_YIELD (-5)
|
#define errQUEUE_YIELD ( -5 )
|
||||||
|
|
||||||
/* Macros used for basic data corruption checks. */
|
/* Macros used for basic data corruption checks. */
|
||||||
#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
|
#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
|
||||||
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
|
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (configUSE_16_BIT_TICKS == 1)
|
#if( configUSE_16_BIT_TICKS == 1 )
|
||||||
#define pdINTEGRITY_CHECK_VALUE 0x5a5a
|
#define pdINTEGRITY_CHECK_VALUE 0x5a5a
|
||||||
#else
|
#else
|
||||||
#define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
|
#define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The following errno values are used by FreeRTOS+ components, not FreeRTOS
|
/* The following errno values are used by FreeRTOS+ components, not FreeRTOS
|
||||||
itself. */
|
itself. */
|
||||||
#define pdFREERTOS_ERRNO_NONE 0 /* No errors */
|
#define pdFREERTOS_ERRNO_NONE 0 /* No errors */
|
||||||
#define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
|
#define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
|
||||||
#define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
|
#define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
|
||||||
#define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
|
#define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
|
||||||
#define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
|
#define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
|
||||||
#define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
|
#define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
|
||||||
#define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
|
#define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
|
||||||
#define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
|
#define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
|
||||||
#define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
|
#define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
|
||||||
#define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
|
#define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
|
||||||
#define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
|
#define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
|
||||||
#define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
|
#define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
|
||||||
#define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
|
#define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
|
||||||
#define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
|
#define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
|
||||||
#define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
|
#define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
|
||||||
#define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
|
#define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
|
||||||
#define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
|
#define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
|
||||||
#define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
|
#define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
|
||||||
#define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
|
#define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
|
||||||
#define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
|
#define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
|
||||||
#define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
|
#define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
|
||||||
#define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
|
#define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
|
||||||
#define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
|
#define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
|
||||||
#define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
|
#define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
|
||||||
#define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
|
#define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
|
||||||
#define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
|
#define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
|
||||||
#define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
|
#define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
|
||||||
#define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
#define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||||
#define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
|
#define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
|
||||||
#define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
|
#define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
|
||||||
#define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
|
#define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
|
||||||
#define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
|
#define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
|
||||||
#define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
|
#define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
|
||||||
#define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
|
#define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
|
||||||
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
|
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
|
||||||
#define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
|
#define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
|
||||||
#define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
|
#define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
|
||||||
#define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
|
#define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
|
||||||
#define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
|
#define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
|
||||||
#define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
|
#define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
|
||||||
|
|
||||||
/* The following endian values are used by FreeRTOS+ components, not FreeRTOS
|
/* The following endian values are used by FreeRTOS+ components, not FreeRTOS
|
||||||
itself. */
|
itself. */
|
||||||
#define pdFREERTOS_LITTLE_ENDIAN 0
|
#define pdFREERTOS_LITTLE_ENDIAN 0
|
||||||
#define pdFREERTOS_BIG_ENDIAN 1
|
#define pdFREERTOS_BIG_ENDIAN 1
|
||||||
|
|
||||||
/* Re-defining endian values for generic naming. */
|
/* Re-defining endian values for generic naming. */
|
||||||
#define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
|
#define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
|
||||||
#define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
|
#define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
|
||||||
|
|
||||||
|
|
||||||
#endif /* PROJDEFS_H */
|
#endif /* PROJDEFS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -29,16 +29,17 @@
|
|||||||
#define SEMAPHORE_H
|
#define SEMAPHORE_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h" must appear in source files before "include semphr.h"
|
#error "include FreeRTOS.h" must appear in source files before "include semphr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
typedef QueueHandle_t SemaphoreHandle_t;
|
typedef QueueHandle_t SemaphoreHandle_t;
|
||||||
|
|
||||||
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ((uint8_t)1U)
|
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( uint8_t ) 1U )
|
||||||
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ((uint8_t)0U)
|
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U )
|
||||||
#define semGIVE_BLOCK_TIME ((TickType_t)0U)
|
#define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
@@ -89,14 +90,15 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
|
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
#define vSemaphoreCreateBinary(xSemaphore) \
|
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||||
{ \
|
{ \
|
||||||
(xSemaphore) = xQueueGenericCreate((UBaseType_t)1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE); \
|
( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||||
if ((xSemaphore) != NULL) { \
|
if( ( xSemaphore ) != NULL ) \
|
||||||
(void)xSemaphoreGive((xSemaphore)); \
|
{ \
|
||||||
} \
|
( void ) xSemaphoreGive( ( xSemaphore ) ); \
|
||||||
}
|
} \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,8 +158,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary
|
* \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
|
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
#define xSemaphoreCreateBinary() xQueueGenericCreate((UBaseType_t)1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE)
|
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,8 +217,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic
|
* \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_STATIC_ALLOCATION == 1)
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
#define xSemaphoreCreateBinaryStatic(pxStaticSemaphore) xQueueGenericCreateStatic((UBaseType_t)1, semSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticSemaphore, queueQUEUE_TYPE_BINARY_SEMAPHORE)
|
#define xSemaphoreCreateBinaryStatic( pxStaticSemaphore ) xQueueGenericCreateStatic( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticSemaphore, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,7 +286,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreTake xSemaphoreTake
|
* \defgroup xSemaphoreTake xSemaphoreTake
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreTake(xSemaphore, xBlockTime) xQueueSemaphoreTake((xSemaphore), (xBlockTime))
|
#define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueSemaphoreTake( ( xSemaphore ), ( xBlockTime ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
@@ -377,8 +379,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
|
* \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configUSE_RECURSIVE_MUTEXES == 1)
|
#if( configUSE_RECURSIVE_MUTEXES == 1 )
|
||||||
#define xSemaphoreTakeRecursive(xMutex, xBlockTime) xQueueTakeMutexRecursive((xMutex), (xBlockTime))
|
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -442,7 +444,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreGive xSemaphoreGive
|
* \defgroup xSemaphoreGive xSemaphoreGive
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreGive(xSemaphore) xQueueGenericSend((QueueHandle_t)(xSemaphore), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK)
|
#define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
@@ -496,24 +498,24 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
|
|
||||||
// ...
|
// ...
|
||||||
// For some reason due to the nature of the code further calls to
|
// For some reason due to the nature of the code further calls to
|
||||||
// xSemaphoreTakeRecursive() are made on the same mutex. In real
|
// xSemaphoreTakeRecursive() are made on the same mutex. In real
|
||||||
// code these would not be just sequential calls as this would make
|
// code these would not be just sequential calls as this would make
|
||||||
// no sense. Instead the calls are likely to be buried inside
|
// no sense. Instead the calls are likely to be buried inside
|
||||||
// a more complex call structure.
|
// a more complex call structure.
|
||||||
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||||
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||||
|
|
||||||
// The mutex has now been 'taken' three times, so will not be
|
// The mutex has now been 'taken' three times, so will not be
|
||||||
// available to another task until it has also been given back
|
// available to another task until it has also been given back
|
||||||
// three times. Again it is unlikely that real code would have
|
// three times. Again it is unlikely that real code would have
|
||||||
// these calls sequentially, it would be more likely that the calls
|
// these calls sequentially, it would be more likely that the calls
|
||||||
// to xSemaphoreGiveRecursive() would be called as a call stack
|
// to xSemaphoreGiveRecursive() would be called as a call stack
|
||||||
// unwound. This is just for demonstrative purposes.
|
// unwound. This is just for demonstrative purposes.
|
||||||
xSemaphoreGiveRecursive( xMutex );
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
xSemaphoreGiveRecursive( xMutex );
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
xSemaphoreGiveRecursive( xMutex );
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
|
||||||
// Now the mutex can be taken by other tasks.
|
// Now the mutex can be taken by other tasks.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -526,8 +528,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive
|
* \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configUSE_RECURSIVE_MUTEXES == 1)
|
#if( configUSE_RECURSIVE_MUTEXES == 1 )
|
||||||
#define xSemaphoreGiveRecursive(xMutex) xQueueGiveMutexRecursive((xMutex))
|
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -581,7 +583,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
// We have finished our task. Return to the top of the loop where
|
// We have finished our task. Return to the top of the loop where
|
||||||
// we will block on the semaphore until it is time to execute
|
// we will block on the semaphore until it is time to execute
|
||||||
// again. Note when using the semaphore for synchronisation with an
|
// again. Note when using the semaphore for synchronisation with an
|
||||||
// ISR in this manner there is no need to 'give' the semaphore back.
|
// ISR in this manner there is no need to 'give' the semaphore back.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -597,7 +599,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
// ... Do other time functions.
|
// ... Do other time functions.
|
||||||
|
|
||||||
// Is it time for vATask () to run?
|
// Is it time for vATask () to run?
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
ucLocalTickCount++;
|
ucLocalTickCount++;
|
||||||
if( ucLocalTickCount >= TICKS_TO_WAIT )
|
if( ucLocalTickCount >= TICKS_TO_WAIT )
|
||||||
{
|
{
|
||||||
@@ -619,7 +621,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken) xQueueGiveFromISR((QueueHandle_t)(xSemaphore), (pxHigherPriorityTaskWoken))
|
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
@@ -653,7 +655,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* @return pdTRUE if the semaphore was successfully taken, otherwise
|
* @return pdTRUE if the semaphore was successfully taken, otherwise
|
||||||
* pdFALSE
|
* pdFALSE
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken) xQueueReceiveFromISR((QueueHandle_t)(xSemaphore), NULL, (pxHigherPriorityTaskWoken))
|
#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
@@ -710,8 +712,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex
|
* \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
|
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
#define xSemaphoreCreateMutex() xQueueCreateMutex(queueQUEUE_TYPE_MUTEX)
|
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -771,10 +773,11 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic
|
* \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_STATIC_ALLOCATION == 1)
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
#define xSemaphoreCreateMutexStatic(pxMutexBuffer) xQueueCreateMutexStatic(queueQUEUE_TYPE_MUTEX, (pxMutexBuffer))
|
#define xSemaphoreCreateMutexStatic( pxMutexBuffer ) xQueueCreateMutexStatic( queueQUEUE_TYPE_MUTEX, ( pxMutexBuffer ) )
|
||||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
* <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )</pre>
|
* <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )</pre>
|
||||||
@@ -838,8 +841,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateRecursiveMutex xSemaphoreCreateRecursiveMutex
|
* \defgroup xSemaphoreCreateRecursiveMutex xSemaphoreCreateRecursiveMutex
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if ((configSUPPORT_DYNAMIC_ALLOCATION == 1) && (configUSE_RECURSIVE_MUTEXES == 1))
|
#if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
|
||||||
#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex(queueQUEUE_TYPE_RECURSIVE_MUTEX)
|
#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -911,8 +914,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateRecursiveMutexStatic xSemaphoreCreateRecursiveMutexStatic
|
* \defgroup xSemaphoreCreateRecursiveMutexStatic xSemaphoreCreateRecursiveMutexStatic
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if ((configSUPPORT_STATIC_ALLOCATION == 1) && (configUSE_RECURSIVE_MUTEXES == 1))
|
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
|
||||||
#define xSemaphoreCreateRecursiveMutexStatic(pxStaticSemaphore) xQueueCreateMutexStatic(queueQUEUE_TYPE_RECURSIVE_MUTEX, pxStaticSemaphore)
|
#define xSemaphoreCreateRecursiveMutexStatic( pxStaticSemaphore ) xQueueCreateMutexStatic( queueQUEUE_TYPE_RECURSIVE_MUTEX, pxStaticSemaphore )
|
||||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -991,8 +994,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting
|
* \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
|
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
#define xSemaphoreCreateCounting(uxMaxCount, uxInitialCount) xQueueCreateCountingSemaphore((uxMaxCount), (uxInitialCount))
|
#define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1076,8 +1079,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic
|
* \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_STATIC_ALLOCATION == 1)
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
#define xSemaphoreCreateCountingStatic(uxMaxCount, uxInitialCount, pxSemaphoreBuffer) xQueueCreateCountingSemaphoreStatic((uxMaxCount), (uxInitialCount), (pxSemaphoreBuffer))
|
#define xSemaphoreCreateCountingStatic( uxMaxCount, uxInitialCount, pxSemaphoreBuffer ) xQueueCreateCountingSemaphoreStatic( ( uxMaxCount ), ( uxInitialCount ), ( pxSemaphoreBuffer ) )
|
||||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1092,7 +1095,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* \defgroup vSemaphoreDelete vSemaphoreDelete
|
* \defgroup vSemaphoreDelete vSemaphoreDelete
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#define vSemaphoreDelete(xSemaphore) vQueueDelete((QueueHandle_t)(xSemaphore))
|
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr.h
|
* semphr.h
|
||||||
@@ -1107,7 +1110,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* the holder may change between the function exiting and the returned value
|
* the holder may change between the function exiting and the returned value
|
||||||
* being tested.
|
* being tested.
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreGetMutexHolder(xSemaphore) xQueueGetMutexHolder((xSemaphore))
|
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr.h
|
* semphr.h
|
||||||
@@ -1118,7 +1121,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* by a task), return NULL.
|
* by a task), return NULL.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreGetMutexHolderFromISR(xSemaphore) xQueueGetMutexHolderFromISR((xSemaphore))
|
#define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr.h
|
* semphr.h
|
||||||
@@ -1130,6 +1133,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
|||||||
* semaphore is not available.
|
* semaphore is not available.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define uxSemaphoreGetCount(xSemaphore) uxQueueMessagesWaiting((QueueHandle_t)(xSemaphore))
|
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
|
||||||
|
|
||||||
#endif /* SEMAPHORE_H */
|
#endif /* SEMAPHORE_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,73 +44,86 @@
|
|||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW == 1) && (portSTACK_GROWTH < 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if (pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack) { \
|
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
{ \
|
||||||
} \
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
}
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW == 1) && (portSTACK_GROWTH > 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
\
|
\
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if (pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack) { \
|
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
{ \
|
||||||
} \
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
}
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW > 1) && (portSTACK_GROWTH < 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
const uint32_t *const pulStack = (uint32_t *)pxCurrentTCB->pxStack; \
|
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
||||||
const uint32_t ulCheckValue = (uint32_t)0xa5a5a5a5; \
|
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
|
||||||
\
|
\
|
||||||
if ((pulStack[0] != ulCheckValue) || (pulStack[1] != ulCheckValue) || (pulStack[2] != ulCheckValue) || (pulStack[3] != ulCheckValue)) { \
|
if( ( pulStack[ 0 ] != ulCheckValue ) || \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
( pulStack[ 1 ] != ulCheckValue ) || \
|
||||||
} \
|
( pulStack[ 2 ] != ulCheckValue ) || \
|
||||||
}
|
( pulStack[ 3 ] != ulCheckValue ) ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ((configCHECK_FOR_STACK_OVERFLOW > 1) && (portSTACK_GROWTH > 0))
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
int8_t * pcEndOfStack = (int8_t *)pxCurrentTCB->pxEndOfStack; \
|
int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
||||||
static const uint8_t ucExpectedStackBytes[] = {tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE}; \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
\
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
pcEndOfStack -= sizeof(ucExpectedStackBytes); \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
||||||
\
|
\
|
||||||
/* Has the extremity of the task stack ever been written over? */ \
|
\
|
||||||
if (memcmp((void *)pcEndOfStack, (void *)ucExpectedStackBytes, sizeof(ucExpectedStackBytes)) != 0) { \
|
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
||||||
vApplicationStackOverflowHook((TaskHandle_t)pxCurrentTCB, pxCurrentTCB->pcTaskName); \
|
\
|
||||||
} \
|
/* Has the extremity of the task stack ever been written over? */ \
|
||||||
}
|
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Remove stack overflow macro if not being used. */
|
/* Remove stack overflow macro if not being used. */
|
||||||
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW()
|
#define taskCHECK_FOR_STACK_OVERFLOW()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* STACK_MACROS_H */
|
#endif /* STACK_MACROS_H */
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,10 @@
|
|||||||
#define STREAM_BUFFER_H
|
#define STREAM_BUFFER_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include stream_buffer.h"
|
#error "include FreeRTOS.h must appear in source files before include stream_buffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined( __cplusplus )
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -66,7 +66,8 @@ extern "C" {
|
|||||||
* etc.
|
* etc.
|
||||||
*/
|
*/
|
||||||
struct StreamBufferDef_t;
|
struct StreamBufferDef_t;
|
||||||
typedef struct StreamBufferDef_t *StreamBufferHandle_t;
|
typedef struct StreamBufferDef_t * StreamBufferHandle_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
@@ -133,7 +134,7 @@ const size_t xStreamBufferSizeBytes = 100, xTriggerLevel = 10;
|
|||||||
* \defgroup xStreamBufferCreate xStreamBufferCreate
|
* \defgroup xStreamBufferCreate xStreamBufferCreate
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xStreamBufferCreate(xBufferSizeBytes, xTriggerLevelBytes) xStreamBufferGenericCreate(xBufferSizeBytes, xTriggerLevelBytes, pdFALSE)
|
#define xStreamBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -214,8 +215,7 @@ const size_t xTriggerLevel = 1;
|
|||||||
* \defgroup xStreamBufferCreateStatic xStreamBufferCreateStatic
|
* \defgroup xStreamBufferCreateStatic xStreamBufferCreateStatic
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xStreamBufferCreateStatic(xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer) \
|
#define xStreamBufferCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer )
|
||||||
xStreamBufferGenericCreateStatic(xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -309,7 +309,10 @@ const TickType_t x100ms = pdMS_TO_TICKS( 100 );
|
|||||||
* \defgroup xStreamBufferSend xStreamBufferSend
|
* \defgroup xStreamBufferSend xStreamBufferSend
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
size_t xStreamBufferSend(StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
|
||||||
|
const void *pvTxData,
|
||||||
|
size_t xDataLengthBytes,
|
||||||
|
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -407,7 +410,10 @@ BaseType_t xHigherPriorityTaskWoken = pdFALSE; // Initialised to pdFALSE.
|
|||||||
* \defgroup xStreamBufferSendFromISR xStreamBufferSendFromISR
|
* \defgroup xStreamBufferSendFromISR xStreamBufferSendFromISR
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
size_t xStreamBufferSendFromISR(StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, BaseType_t *const pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
|
const void *pvTxData,
|
||||||
|
size_t xDataLengthBytes,
|
||||||
|
BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -493,7 +499,10 @@ const TickType_t xBlockTime = pdMS_TO_TICKS( 20 );
|
|||||||
* \defgroup xStreamBufferReceive xStreamBufferReceive
|
* \defgroup xStreamBufferReceive xStreamBufferReceive
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
size_t xStreamBufferReceive(StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
|
||||||
|
void *pvRxData,
|
||||||
|
size_t xBufferLengthBytes,
|
||||||
|
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -576,7 +585,10 @@ BaseType_t xHigherPriorityTaskWoken = pdFALSE; // Initialised to pdFALSE.
|
|||||||
* \defgroup xStreamBufferReceiveFromISR xStreamBufferReceiveFromISR
|
* \defgroup xStreamBufferReceiveFromISR xStreamBufferReceiveFromISR
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
size_t xStreamBufferReceiveFromISR(StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, BaseType_t *const pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
|
void *pvRxData,
|
||||||
|
size_t xBufferLengthBytes,
|
||||||
|
BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -598,7 +610,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer );
|
|||||||
* \defgroup vStreamBufferDelete vStreamBufferDelete
|
* \defgroup vStreamBufferDelete vStreamBufferDelete
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
void vStreamBufferDelete(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -618,7 +630,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer );
|
|||||||
* \defgroup xStreamBufferIsFull xStreamBufferIsFull
|
* \defgroup xStreamBufferIsFull xStreamBufferIsFull
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferIsFull(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -638,7 +650,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer );
|
|||||||
* \defgroup xStreamBufferIsEmpty xStreamBufferIsEmpty
|
* \defgroup xStreamBufferIsEmpty xStreamBufferIsEmpty
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferIsEmpty(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -661,7 +673,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer );
|
|||||||
* \defgroup xStreamBufferReset xStreamBufferReset
|
* \defgroup xStreamBufferReset xStreamBufferReset
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferReset(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -682,7 +694,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer );
|
|||||||
* \defgroup xStreamBufferSpacesAvailable xStreamBufferSpacesAvailable
|
* \defgroup xStreamBufferSpacesAvailable xStreamBufferSpacesAvailable
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
size_t xStreamBufferSpacesAvailable(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -703,7 +715,7 @@ size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer );
|
|||||||
* \defgroup xStreamBufferBytesAvailable xStreamBufferBytesAvailable
|
* \defgroup xStreamBufferBytesAvailable xStreamBufferBytesAvailable
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
size_t xStreamBufferBytesAvailable(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -740,7 +752,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, siz
|
|||||||
* \defgroup xStreamBufferSetTriggerLevel xStreamBufferSetTriggerLevel
|
* \defgroup xStreamBufferSetTriggerLevel xStreamBufferSetTriggerLevel
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferSetTriggerLevel(StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -779,7 +791,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer
|
|||||||
* \defgroup xStreamBufferSendCompletedFromISR xStreamBufferSendCompletedFromISR
|
* \defgroup xStreamBufferSendCompletedFromISR xStreamBufferSendCompletedFromISR
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferSendCompletedFromISR(StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
@@ -819,24 +831,29 @@ BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuf
|
|||||||
* \defgroup xStreamBufferReceiveCompletedFromISR xStreamBufferReceiveCompletedFromISR
|
* \defgroup xStreamBufferReceiveCompletedFromISR xStreamBufferReceiveCompletedFromISR
|
||||||
* \ingroup StreamBufferManagement
|
* \ingroup StreamBufferManagement
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferReceiveCompletedFromISR(StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* Functions below here are not part of the public API. */
|
/* Functions below here are not part of the public API. */
|
||||||
StreamBufferHandle_t xStreamBufferGenericCreate(size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer) PRIVILEGED_FUNCTION;
|
StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
||||||
|
size_t xTriggerLevelBytes,
|
||||||
|
BaseType_t xIsMessageBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
StreamBufferHandle_t xStreamBufferGenericCreateStatic(size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer, uint8_t *const pucStreamBufferStorageArea,
|
StreamBufferHandle_t xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
||||||
StaticStreamBuffer_t *const pxStaticStreamBuffer) PRIVILEGED_FUNCTION;
|
size_t xTriggerLevelBytes,
|
||||||
|
BaseType_t xIsMessageBuffer,
|
||||||
|
uint8_t * const pucStreamBufferStorageArea,
|
||||||
|
StaticStreamBuffer_t * const pxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
size_t xStreamBufferNextMessageLengthBytes(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#if (configUSE_TRACE_FACILITY == 1)
|
#if( configUSE_TRACE_FACILITY == 1 )
|
||||||
void vStreamBufferSetStreamBufferNumber(StreamBufferHandle_t xStreamBuffer, UBaseType_t uxStreamBufferNumber) PRIVILEGED_FUNCTION;
|
void vStreamBufferSetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer, UBaseType_t uxStreamBufferNumber ) PRIVILEGED_FUNCTION;
|
||||||
UBaseType_t uxStreamBufferGetStreamBufferNumber(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
UBaseType_t uxStreamBufferGetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
uint8_t ucStreamBufferGetStreamBufferType(StreamBufferHandle_t xStreamBuffer) PRIVILEGED_FUNCTION;
|
uint8_t ucStreamBufferGetStreamBufferType( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined( __cplusplus )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* !defined( STREAM_BUFFER_H ) */
|
#endif /* !defined( STREAM_BUFFER_H ) */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,11 +25,12 @@
|
|||||||
* 1 tab == 4 spaces!
|
* 1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef TIMERS_H
|
#ifndef TIMERS_H
|
||||||
#define TIMERS_H
|
#define TIMERS_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*lint -save -e537 This headers are only multiply included if the application code
|
/*lint -save -e537 This headers are only multiply included if the application code
|
||||||
@@ -50,20 +51,21 @@ be used solely through the macros that make up the public software timer API,
|
|||||||
as defined below. The commands that are sent from interrupts must use the
|
as defined below. The commands that are sent from interrupts must use the
|
||||||
highest numbers as tmrFIRST_FROM_ISR_COMMAND is used to determine if the task
|
highest numbers as tmrFIRST_FROM_ISR_COMMAND is used to determine if the task
|
||||||
or interrupt version of the queue send function should be used. */
|
or interrupt version of the queue send function should be used. */
|
||||||
#define tmrCOMMAND_EXECUTE_CALLBACK_FROM_ISR ((BaseType_t)-2)
|
#define tmrCOMMAND_EXECUTE_CALLBACK_FROM_ISR ( ( BaseType_t ) -2 )
|
||||||
#define tmrCOMMAND_EXECUTE_CALLBACK ((BaseType_t)-1)
|
#define tmrCOMMAND_EXECUTE_CALLBACK ( ( BaseType_t ) -1 )
|
||||||
#define tmrCOMMAND_START_DONT_TRACE ((BaseType_t)0)
|
#define tmrCOMMAND_START_DONT_TRACE ( ( BaseType_t ) 0 )
|
||||||
#define tmrCOMMAND_START ((BaseType_t)1)
|
#define tmrCOMMAND_START ( ( BaseType_t ) 1 )
|
||||||
#define tmrCOMMAND_RESET ((BaseType_t)2)
|
#define tmrCOMMAND_RESET ( ( BaseType_t ) 2 )
|
||||||
#define tmrCOMMAND_STOP ((BaseType_t)3)
|
#define tmrCOMMAND_STOP ( ( BaseType_t ) 3 )
|
||||||
#define tmrCOMMAND_CHANGE_PERIOD ((BaseType_t)4)
|
#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 4 )
|
||||||
#define tmrCOMMAND_DELETE ((BaseType_t)5)
|
#define tmrCOMMAND_DELETE ( ( BaseType_t ) 5 )
|
||||||
|
|
||||||
|
#define tmrFIRST_FROM_ISR_COMMAND ( ( BaseType_t ) 6 )
|
||||||
|
#define tmrCOMMAND_START_FROM_ISR ( ( BaseType_t ) 6 )
|
||||||
|
#define tmrCOMMAND_RESET_FROM_ISR ( ( BaseType_t ) 7 )
|
||||||
|
#define tmrCOMMAND_STOP_FROM_ISR ( ( BaseType_t ) 8 )
|
||||||
|
#define tmrCOMMAND_CHANGE_PERIOD_FROM_ISR ( ( BaseType_t ) 9 )
|
||||||
|
|
||||||
#define tmrFIRST_FROM_ISR_COMMAND ((BaseType_t)6)
|
|
||||||
#define tmrCOMMAND_START_FROM_ISR ((BaseType_t)6)
|
|
||||||
#define tmrCOMMAND_RESET_FROM_ISR ((BaseType_t)7)
|
|
||||||
#define tmrCOMMAND_STOP_FROM_ISR ((BaseType_t)8)
|
|
||||||
#define tmrCOMMAND_CHANGE_PERIOD_FROM_ISR ((BaseType_t)9)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type by which software timers are referenced. For example, a call to
|
* Type by which software timers are referenced. For example, a call to
|
||||||
@@ -72,18 +74,18 @@ or interrupt version of the queue send function should be used. */
|
|||||||
* (for example, xTimerStart(), xTimerReset(), etc.).
|
* (for example, xTimerStart(), xTimerReset(), etc.).
|
||||||
*/
|
*/
|
||||||
struct tmrTimerControl; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
struct tmrTimerControl; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||||
typedef struct tmrTimerControl *TimerHandle_t;
|
typedef struct tmrTimerControl * TimerHandle_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines the prototype to which timer callback functions must conform.
|
* Defines the prototype to which timer callback functions must conform.
|
||||||
*/
|
*/
|
||||||
typedef void (*TimerCallbackFunction_t)(TimerHandle_t xTimer);
|
typedef void (*TimerCallbackFunction_t)( TimerHandle_t xTimer );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines the prototype to which functions used with the
|
* Defines the prototype to which functions used with the
|
||||||
* xTimerPendFunctionCallFromISR() function must conform.
|
* xTimerPendFunctionCallFromISR() function must conform.
|
||||||
*/
|
*/
|
||||||
typedef void (*PendedFunction_t)(void *, uint32_t);
|
typedef void (*PendedFunction_t)( void *, uint32_t );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
* TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||||
@@ -222,9 +224,12 @@ typedef void (*PendedFunction_t)(void *, uint32_t);
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
|
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
TimerHandle_t xTimerCreate(const char *const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
TimerHandle_t xTimerCreate( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||||
const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void *const pvTimerID, TimerCallbackFunction_t pxCallbackFunction) PRIVILEGED_FUNCTION;
|
const TickType_t xTimerPeriodInTicks,
|
||||||
|
const UBaseType_t uxAutoReload,
|
||||||
|
void * const pvTimerID,
|
||||||
|
TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,10 +354,13 @@ TimerHandle_t xTimerCreate(const char *const pcTimerName, /*lint !e971 Unqualifi
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#if (configSUPPORT_STATIC_ALLOCATION == 1)
|
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
TimerHandle_t xTimerCreateStatic(const char *const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||||
const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void *const pvTimerID, TimerCallbackFunction_t pxCallbackFunction,
|
const TickType_t xTimerPeriodInTicks,
|
||||||
StaticTimer_t *pxTimerBuffer) PRIVILEGED_FUNCTION;
|
const UBaseType_t uxAutoReload,
|
||||||
|
void * const pvTimerID,
|
||||||
|
TimerCallbackFunction_t pxCallbackFunction,
|
||||||
|
StaticTimer_t *pxTimerBuffer ) PRIVILEGED_FUNCTION;
|
||||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -375,7 +383,7 @@ TimerHandle_t xTimerCreateStatic(const char *const pcTimerName, /*lint !e971 Unq
|
|||||||
*
|
*
|
||||||
* See the xTimerCreate() API function example usage scenario.
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
*/
|
*/
|
||||||
void *pvTimerGetTimerID(const TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
void *pvTimerGetTimerID( const TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );
|
* void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );
|
||||||
@@ -396,7 +404,7 @@ void *pvTimerGetTimerID(const TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
|||||||
*
|
*
|
||||||
* See the xTimerCreate() API function example usage scenario.
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
*/
|
*/
|
||||||
void vTimerSetTimerID(TimerHandle_t xTimer, void *pvNewID) PRIVILEGED_FUNCTION;
|
void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );
|
* BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );
|
||||||
@@ -433,7 +441,7 @@ void vTimerSetTimerID(TimerHandle_t xTimer, void *pvNewID) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
BaseType_t xTimerIsTimerActive(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
* TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||||
@@ -441,7 +449,7 @@ BaseType_t xTimerIsTimerActive(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
|||||||
* Simply returns the handle of the timer service/daemon task. It it not valid
|
* Simply returns the handle of the timer service/daemon task. It it not valid
|
||||||
* to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started.
|
* to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started.
|
||||||
*/
|
*/
|
||||||
TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerStart( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
* BaseType_t xTimerStart( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
||||||
@@ -493,7 +501,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* See the xTimerCreate() API function example usage scenario.
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define xTimerStart(xTimer, xTicksToWait) xTimerGenericCommand((xTimer), tmrCOMMAND_START, (xTaskGetTickCount()), NULL, (xTicksToWait))
|
#define xTimerStart( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xTicksToWait ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerStop( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
* BaseType_t xTimerStop( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
||||||
@@ -535,7 +543,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* See the xTimerCreate() API function example usage scenario.
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define xTimerStop(xTimer, xTicksToWait) xTimerGenericCommand((xTimer), tmrCOMMAND_STOP, 0U, NULL, (xTicksToWait))
|
#define xTimerStop( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0U, NULL, ( xTicksToWait ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerChangePeriod( TimerHandle_t xTimer,
|
* BaseType_t xTimerChangePeriod( TimerHandle_t xTimer,
|
||||||
@@ -615,7 +623,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define xTimerChangePeriod(xTimer, xNewPeriod, xTicksToWait) xTimerGenericCommand((xTimer), tmrCOMMAND_CHANGE_PERIOD, (xNewPeriod), NULL, (xTicksToWait))
|
#define xTimerChangePeriod( xTimer, xNewPeriod, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xTicksToWait ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerDelete( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
* BaseType_t xTimerDelete( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
||||||
@@ -653,7 +661,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
*
|
*
|
||||||
* See the xTimerChangePeriod() API function example usage scenario.
|
* See the xTimerChangePeriod() API function example usage scenario.
|
||||||
*/
|
*/
|
||||||
#define xTimerDelete(xTimer, xTicksToWait) xTimerGenericCommand((xTimer), tmrCOMMAND_DELETE, 0U, NULL, (xTicksToWait))
|
#define xTimerDelete( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xTicksToWait ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
* BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
||||||
@@ -777,7 +785,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define xTimerReset(xTimer, xTicksToWait) xTimerGenericCommand((xTimer), tmrCOMMAND_RESET, (xTaskGetTickCount()), NULL, (xTicksToWait))
|
#define xTimerReset( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET, ( xTaskGetTickCount() ), NULL, ( xTicksToWait ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerStartFromISR( TimerHandle_t xTimer,
|
* BaseType_t xTimerStartFromISR( TimerHandle_t xTimer,
|
||||||
@@ -863,7 +871,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define xTimerStartFromISR(xTimer, pxHigherPriorityTaskWoken) xTimerGenericCommand((xTimer), tmrCOMMAND_START_FROM_ISR, (xTaskGetTickCountFromISR()), (pxHigherPriorityTaskWoken), 0U)
|
#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerStopFromISR( TimerHandle_t xTimer,
|
* BaseType_t xTimerStopFromISR( TimerHandle_t xTimer,
|
||||||
@@ -926,7 +934,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define xTimerStopFromISR(xTimer, pxHigherPriorityTaskWoken) xTimerGenericCommand((xTimer), tmrCOMMAND_STOP_FROM_ISR, 0, (pxHigherPriorityTaskWoken), 0U)
|
#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP_FROM_ISR, 0, ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer,
|
* BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer,
|
||||||
@@ -999,7 +1007,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define xTimerChangePeriodFromISR(xTimer, xNewPeriod, pxHigherPriorityTaskWoken) xTimerGenericCommand((xTimer), tmrCOMMAND_CHANGE_PERIOD_FROM_ISR, (xNewPeriod), (pxHigherPriorityTaskWoken), 0U)
|
#define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD_FROM_ISR, ( xNewPeriod ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerResetFromISR( TimerHandle_t xTimer,
|
* BaseType_t xTimerResetFromISR( TimerHandle_t xTimer,
|
||||||
@@ -1085,7 +1093,8 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define xTimerResetFromISR(xTimer, pxHigherPriorityTaskWoken) xTimerGenericCommand((xTimer), tmrCOMMAND_RESET_FROM_ISR, (xTaskGetTickCountFromISR()), (pxHigherPriorityTaskWoken), 0U)
|
#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
|
* BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
|
||||||
@@ -1175,41 +1184,41 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION;
|
|||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
BaseType_t xTimerPendFunctionCallFromISR(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION;
|
BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
* BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
||||||
* void *pvParameter1,
|
* void *pvParameter1,
|
||||||
* uint32_t ulParameter2,
|
* uint32_t ulParameter2,
|
||||||
* TickType_t xTicksToWait );
|
* TickType_t xTicksToWait );
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Used to defer the execution of a function to the RTOS daemon task (the timer
|
* Used to defer the execution of a function to the RTOS daemon task (the timer
|
||||||
* service task, hence this function is implemented in timers.c and is prefixed
|
* service task, hence this function is implemented in timers.c and is prefixed
|
||||||
* with 'Timer').
|
* with 'Timer').
|
||||||
*
|
*
|
||||||
* @param xFunctionToPend The function to execute from the timer service/
|
* @param xFunctionToPend The function to execute from the timer service/
|
||||||
* daemon task. The function must conform to the PendedFunction_t
|
* daemon task. The function must conform to the PendedFunction_t
|
||||||
* prototype.
|
* prototype.
|
||||||
*
|
*
|
||||||
* @param pvParameter1 The value of the callback function's first parameter.
|
* @param pvParameter1 The value of the callback function's first parameter.
|
||||||
* The parameter has a void * type to allow it to be used to pass any type.
|
* The parameter has a void * type to allow it to be used to pass any type.
|
||||||
* For example, unsigned longs can be cast to a void *, or the void * can be
|
* For example, unsigned longs can be cast to a void *, or the void * can be
|
||||||
* used to point to a structure.
|
* used to point to a structure.
|
||||||
*
|
*
|
||||||
* @param ulParameter2 The value of the callback function's second parameter.
|
* @param ulParameter2 The value of the callback function's second parameter.
|
||||||
*
|
*
|
||||||
* @param xTicksToWait Calling this function will result in a message being
|
* @param xTicksToWait Calling this function will result in a message being
|
||||||
* sent to the timer daemon task on a queue. xTicksToWait is the amount of
|
* sent to the timer daemon task on a queue. xTicksToWait is the amount of
|
||||||
* time the calling task should remain in the Blocked state (so not using any
|
* time the calling task should remain in the Blocked state (so not using any
|
||||||
* processing time) for space to become available on the timer queue if the
|
* processing time) for space to become available on the timer queue if the
|
||||||
* queue is found to be full.
|
* queue is found to be full.
|
||||||
*
|
*
|
||||||
* @return pdPASS is returned if the message was successfully sent to the
|
* @return pdPASS is returned if the message was successfully sent to the
|
||||||
* timer daemon task, otherwise pdFALSE is returned.
|
* timer daemon task, otherwise pdFALSE is returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
BaseType_t xTimerPendFunctionCall(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait) PRIVILEGED_FUNCTION;
|
BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* const char * const pcTimerGetName( TimerHandle_t xTimer );
|
* const char * const pcTimerGetName( TimerHandle_t xTimer );
|
||||||
@@ -1220,7 +1229,7 @@ BaseType_t xTimerPendFunctionCall(PendedFunction_t xFunctionToPend, void *pvPara
|
|||||||
*
|
*
|
||||||
* @return The name assigned to the timer specified by the xTimer parameter.
|
* @return The name assigned to the timer specified by the xTimer parameter.
|
||||||
*/
|
*/
|
||||||
const char *pcTimerGetName(TimerHandle_t xTimer) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* void vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload );
|
* void vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload );
|
||||||
@@ -1237,21 +1246,21 @@ const char *pcTimerGetName(TimerHandle_t xTimer) PRIVILEGED_FUNCTION; /*lint !e9
|
|||||||
* uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and
|
* uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and
|
||||||
* enter the dormant state after it expires.
|
* enter the dormant state after it expires.
|
||||||
*/
|
*/
|
||||||
void vTimerSetReloadMode(TimerHandle_t xTimer, const UBaseType_t uxAutoReload) PRIVILEGED_FUNCTION;
|
void vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer );
|
* UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer );
|
||||||
*
|
*
|
||||||
* Queries a timer to determine if it is an auto-reload timer, in which case the timer
|
* Queries a timer to determine if it is an auto-reload timer, in which case the timer
|
||||||
* automatically resets itself each time it expires, or a one-shot timer, in
|
* automatically resets itself each time it expires, or a one-shot timer, in
|
||||||
* which case the timer will only expire once unless it is manually restarted.
|
* which case the timer will only expire once unless it is manually restarted.
|
||||||
*
|
*
|
||||||
* @param xTimer The handle of the timer being queried.
|
* @param xTimer The handle of the timer being queried.
|
||||||
*
|
*
|
||||||
* @return If the timer is an auto-reload timer then pdTRUE is returned, otherwise
|
* @return If the timer is an auto-reload timer then pdTRUE is returned, otherwise
|
||||||
* pdFALSE is returned.
|
* pdFALSE is returned.
|
||||||
*/
|
*/
|
||||||
UBaseType_t uxTimerGetReloadMode(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TickType_t xTimerGetPeriod( TimerHandle_t xTimer );
|
* TickType_t xTimerGetPeriod( TimerHandle_t xTimer );
|
||||||
@@ -1262,37 +1271,39 @@ UBaseType_t uxTimerGetReloadMode(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
|||||||
*
|
*
|
||||||
* @return The period of the timer in ticks.
|
* @return The period of the timer in ticks.
|
||||||
*/
|
*/
|
||||||
TickType_t xTimerGetPeriod(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer );
|
* TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer );
|
||||||
*
|
*
|
||||||
* Returns the time in ticks at which the timer will expire. If this is less
|
* Returns the time in ticks at which the timer will expire. If this is less
|
||||||
* than the current tick count then the expiry time has overflowed from the
|
* than the current tick count then the expiry time has overflowed from the
|
||||||
* current time.
|
* current time.
|
||||||
*
|
*
|
||||||
* @param xTimer The handle of the timer being queried.
|
* @param xTimer The handle of the timer being queried.
|
||||||
*
|
*
|
||||||
* @return If the timer is running then the time in ticks at which the timer
|
* @return If the timer is running then the time in ticks at which the timer
|
||||||
* will next expire is returned. If the timer is not running then the return
|
* will next expire is returned. If the timer is not running then the return
|
||||||
* value is undefined.
|
* value is undefined.
|
||||||
*/
|
*/
|
||||||
TickType_t xTimerGetExpiryTime(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions beyond this part are not part of the public API and are intended
|
* Functions beyond this part are not part of the public API and are intended
|
||||||
* for use by the kernel only.
|
* for use by the kernel only.
|
||||||
*/
|
*/
|
||||||
BaseType_t xTimerCreateTimerTask(void) PRIVILEGED_FUNCTION;
|
BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t xTimerGenericCommand(TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t *const pxHigherPriorityTaskWoken,
|
BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
const TickType_t xTicksToWait) PRIVILEGED_FUNCTION;
|
|
||||||
|
|
||||||
#if (configUSE_TRACE_FACILITY == 1)
|
#if( configUSE_TRACE_FACILITY == 1 )
|
||||||
void vTimerSetTimerNumber(TimerHandle_t xTimer, UBaseType_t uxTimerNumber) PRIVILEGED_FUNCTION;
|
void vTimerSetTimerNumber( TimerHandle_t xTimer, UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION;
|
||||||
UBaseType_t uxTimerGetTimerNumber(TimerHandle_t xTimer) PRIVILEGED_FUNCTION;
|
UBaseType_t uxTimerGetTimerNumber( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* TIMERS_H */
|
#endif /* TIMERS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,164 +25,174 @@
|
|||||||
* 1 tab == 4 spaces!
|
* 1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "list.h"
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* PUBLIC LIST API documented in list.h
|
* PUBLIC LIST API documented in list.h
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
void vListInitialise(List_t *const pxList) {
|
void vListInitialise( List_t * const pxList )
|
||||||
/* The list structure contains a list item which is used to mark the
|
{
|
||||||
end of the list. To initialise the list the list end is inserted
|
/* The list structure contains a list item which is used to mark the
|
||||||
as the only list entry. */
|
end of the list. To initialise the list the list end is inserted
|
||||||
pxList->pxIndex = (ListItem_t *)&(pxList->xListEnd); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
as the only list entry. */
|
||||||
|
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
|
|
||||||
/* The list end value is the highest possible value in the list to
|
/* The list end value is the highest possible value in the list to
|
||||||
ensure it remains at the end of the list. */
|
ensure it remains at the end of the list. */
|
||||||
pxList->xListEnd.xItemValue = portMAX_DELAY;
|
pxList->xListEnd.xItemValue = portMAX_DELAY;
|
||||||
|
|
||||||
/* The list end next and previous pointers point to itself so we know
|
/* The list end next and previous pointers point to itself so we know
|
||||||
when the list is empty. */
|
when the list is empty. */
|
||||||
pxList->xListEnd.pxNext = (ListItem_t *)&(pxList->xListEnd); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
pxList->xListEnd.pxPrevious = (ListItem_t *)&(pxList->xListEnd); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
|
|
||||||
pxList->uxNumberOfItems = (UBaseType_t)0U;
|
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
||||||
|
|
||||||
/* Write known values into the list if
|
/* Write known values into the list if
|
||||||
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
listSET_LIST_INTEGRITY_CHECK_1_VALUE(pxList);
|
listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
|
||||||
listSET_LIST_INTEGRITY_CHECK_2_VALUE(pxList);
|
listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vListInitialiseItem(ListItem_t *const pxItem) {
|
void vListInitialiseItem( ListItem_t * const pxItem )
|
||||||
/* Make sure the list item is not recorded as being on a list. */
|
{
|
||||||
pxItem->pxContainer = NULL;
|
/* Make sure the list item is not recorded as being on a list. */
|
||||||
|
pxItem->pxContainer = NULL;
|
||||||
|
|
||||||
/* Write known values into the list item if
|
/* Write known values into the list item if
|
||||||
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE(pxItem);
|
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
||||||
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE(pxItem);
|
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vListInsertEnd(List_t *const pxList, ListItem_t *const pxNewListItem) {
|
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||||
ListItem_t *const pxIndex = pxList->pxIndex;
|
{
|
||||||
|
ListItem_t * const pxIndex = pxList->pxIndex;
|
||||||
|
|
||||||
/* Only effective when configASSERT() is also defined, these tests may catch
|
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||||
the list data structures being overwritten in memory. They will not catch
|
the list data structures being overwritten in memory. They will not catch
|
||||||
data errors caused by incorrect configuration or use of FreeRTOS. */
|
data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||||
listTEST_LIST_INTEGRITY(pxList);
|
listTEST_LIST_INTEGRITY( pxList );
|
||||||
listTEST_LIST_ITEM_INTEGRITY(pxNewListItem);
|
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
|
||||||
|
|
||||||
/* Insert a new list item into pxList, but rather than sort the list,
|
/* Insert a new list item into pxList, but rather than sort the list,
|
||||||
makes the new list item the last item to be removed by a call to
|
makes the new list item the last item to be removed by a call to
|
||||||
listGET_OWNER_OF_NEXT_ENTRY(). */
|
listGET_OWNER_OF_NEXT_ENTRY(). */
|
||||||
pxNewListItem->pxNext = pxIndex;
|
pxNewListItem->pxNext = pxIndex;
|
||||||
pxNewListItem->pxPrevious = pxIndex->pxPrevious;
|
pxNewListItem->pxPrevious = pxIndex->pxPrevious;
|
||||||
|
|
||||||
/* Only used during decision coverage testing. */
|
/* Only used during decision coverage testing. */
|
||||||
mtCOVERAGE_TEST_DELAY();
|
mtCOVERAGE_TEST_DELAY();
|
||||||
|
|
||||||
pxIndex->pxPrevious->pxNext = pxNewListItem;
|
pxIndex->pxPrevious->pxNext = pxNewListItem;
|
||||||
pxIndex->pxPrevious = pxNewListItem;
|
pxIndex->pxPrevious = pxNewListItem;
|
||||||
|
|
||||||
/* Remember which list the item is in. */
|
/* Remember which list the item is in. */
|
||||||
pxNewListItem->pxContainer = pxList;
|
pxNewListItem->pxContainer = pxList;
|
||||||
|
|
||||||
(pxList->uxNumberOfItems)++;
|
( pxList->uxNumberOfItems )++;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vListInsert(List_t *const pxList, ListItem_t *const pxNewListItem) {
|
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||||
ListItem_t * pxIterator;
|
{
|
||||||
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
ListItem_t *pxIterator;
|
||||||
|
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||||
|
|
||||||
/* Only effective when configASSERT() is also defined, these tests may catch
|
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||||
the list data structures being overwritten in memory. They will not catch
|
the list data structures being overwritten in memory. They will not catch
|
||||||
data errors caused by incorrect configuration or use of FreeRTOS. */
|
data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||||
listTEST_LIST_INTEGRITY(pxList);
|
listTEST_LIST_INTEGRITY( pxList );
|
||||||
listTEST_LIST_ITEM_INTEGRITY(pxNewListItem);
|
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
|
||||||
|
|
||||||
/* Insert the new list item into the list, sorted in xItemValue order.
|
/* Insert the new list item into the list, sorted in xItemValue order.
|
||||||
|
|
||||||
If the list already contains a list item with the same item value then the
|
If the list already contains a list item with the same item value then the
|
||||||
new list item should be placed after it. This ensures that TCBs which are
|
new list item should be placed after it. This ensures that TCBs which are
|
||||||
stored in ready lists (all of which have the same xItemValue value) get a
|
stored in ready lists (all of which have the same xItemValue value) get a
|
||||||
share of the CPU. However, if the xItemValue is the same as the back marker
|
share of the CPU. However, if the xItemValue is the same as the back marker
|
||||||
the iteration loop below will not end. Therefore the value is checked
|
the iteration loop below will not end. Therefore the value is checked
|
||||||
first, and the algorithm slightly modified if necessary. */
|
first, and the algorithm slightly modified if necessary. */
|
||||||
if (xValueOfInsertion == portMAX_DELAY) {
|
if( xValueOfInsertion == portMAX_DELAY )
|
||||||
pxIterator = pxList->xListEnd.pxPrevious;
|
{
|
||||||
} else {
|
pxIterator = pxList->xListEnd.pxPrevious;
|
||||||
/* *** NOTE ***********************************************************
|
}
|
||||||
If you find your application is crashing here then likely causes are
|
else
|
||||||
listed below. In addition see https://www.freertos.org/FAQHelp.html for
|
{
|
||||||
more tips, and ensure configASSERT() is defined!
|
/* *** NOTE ***********************************************************
|
||||||
https://www.freertos.org/a00110.html#configASSERT
|
If you find your application is crashing here then likely causes are
|
||||||
|
listed below. In addition see https://www.freertos.org/FAQHelp.html for
|
||||||
|
more tips, and ensure configASSERT() is defined!
|
||||||
|
https://www.freertos.org/a00110.html#configASSERT
|
||||||
|
|
||||||
1) Stack overflow -
|
1) Stack overflow -
|
||||||
see https://www.freertos.org/Stacks-and-stack-overflow-checking.html
|
see https://www.freertos.org/Stacks-and-stack-overflow-checking.html
|
||||||
2) Incorrect interrupt priority assignment, especially on Cortex-M
|
2) Incorrect interrupt priority assignment, especially on Cortex-M
|
||||||
parts where numerically high priority values denote low actual
|
parts where numerically high priority values denote low actual
|
||||||
interrupt priorities, which can seem counter intuitive. See
|
interrupt priorities, which can seem counter intuitive. See
|
||||||
https://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition
|
https://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition
|
||||||
of configMAX_SYSCALL_INTERRUPT_PRIORITY on
|
of configMAX_SYSCALL_INTERRUPT_PRIORITY on
|
||||||
https://www.freertos.org/a00110.html
|
https://www.freertos.org/a00110.html
|
||||||
3) Calling an API function from within a critical section or when
|
3) Calling an API function from within a critical section or when
|
||||||
the scheduler is suspended, or calling an API function that does
|
the scheduler is suspended, or calling an API function that does
|
||||||
not end in "FromISR" from an interrupt.
|
not end in "FromISR" from an interrupt.
|
||||||
4) Using a queue or semaphore before it has been initialised or
|
4) Using a queue or semaphore before it has been initialised or
|
||||||
before the scheduler has been started (are interrupts firing
|
before the scheduler has been started (are interrupts firing
|
||||||
before vTaskStartScheduler() has been called?).
|
before vTaskStartScheduler() has been called?).
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
for (pxIterator = (ListItem_t *)&(pxList->xListEnd); pxIterator->pxNext->xItemValue <= xValueOfInsertion;
|
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. *//*lint !e440 The iterator moves to a different value, not xValueOfInsertion. */
|
||||||
pxIterator
|
{
|
||||||
= pxIterator->pxNext) /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */ /*lint !e440 The iterator moves to a
|
/* There is nothing to do here, just iterating to the wanted
|
||||||
different value, not xValueOfInsertion. */
|
insertion position. */
|
||||||
{
|
}
|
||||||
/* There is nothing to do here, just iterating to the wanted
|
}
|
||||||
insertion position. */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pxNewListItem->pxNext = pxIterator->pxNext;
|
pxNewListItem->pxNext = pxIterator->pxNext;
|
||||||
pxNewListItem->pxNext->pxPrevious = pxNewListItem;
|
pxNewListItem->pxNext->pxPrevious = pxNewListItem;
|
||||||
pxNewListItem->pxPrevious = pxIterator;
|
pxNewListItem->pxPrevious = pxIterator;
|
||||||
pxIterator->pxNext = pxNewListItem;
|
pxIterator->pxNext = pxNewListItem;
|
||||||
|
|
||||||
/* Remember which list the item is in. This allows fast removal of the
|
/* Remember which list the item is in. This allows fast removal of the
|
||||||
item later. */
|
item later. */
|
||||||
pxNewListItem->pxContainer = pxList;
|
pxNewListItem->pxContainer = pxList;
|
||||||
|
|
||||||
(pxList->uxNumberOfItems)++;
|
( pxList->uxNumberOfItems )++;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
UBaseType_t uxListRemove(ListItem_t *const pxItemToRemove) {
|
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
|
||||||
/* The list item knows which list it is in. Obtain the list from the list
|
{
|
||||||
item. */
|
/* The list item knows which list it is in. Obtain the list from the list
|
||||||
List_t *const pxList = pxItemToRemove->pxContainer;
|
item. */
|
||||||
|
List_t * const pxList = pxItemToRemove->pxContainer;
|
||||||
|
|
||||||
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
||||||
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
||||||
|
|
||||||
/* Only used during decision coverage testing. */
|
/* Only used during decision coverage testing. */
|
||||||
mtCOVERAGE_TEST_DELAY();
|
mtCOVERAGE_TEST_DELAY();
|
||||||
|
|
||||||
/* Make sure the index is left pointing to a valid item. */
|
/* Make sure the index is left pointing to a valid item. */
|
||||||
if (pxList->pxIndex == pxItemToRemove) {
|
if( pxList->pxIndex == pxItemToRemove )
|
||||||
pxList->pxIndex = pxItemToRemove->pxPrevious;
|
{
|
||||||
} else {
|
pxList->pxIndex = pxItemToRemove->pxPrevious;
|
||||||
mtCOVERAGE_TEST_MARKER();
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
mtCOVERAGE_TEST_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
pxItemToRemove->pxContainer = NULL;
|
pxItemToRemove->pxContainer = NULL;
|
||||||
(pxList->uxNumberOfItems)--;
|
( pxList->uxNumberOfItems )--;
|
||||||
|
|
||||||
return pxList->uxNumberOfItems;
|
return pxList->uxNumberOfItems;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
4705
source/Middlewares/Third_Party/FreeRTOS/Source/queue.c
vendored
4705
source/Middlewares/Third_Party/FreeRTOS/Source/queue.c
vendored
File diff suppressed because it is too large
Load Diff
7612
source/Middlewares/Third_Party/FreeRTOS/Source/tasks.c
vendored
7612
source/Middlewares/Third_Party/FreeRTOS/Source/tasks.c
vendored
File diff suppressed because it is too large
Load Diff
1632
source/Middlewares/Third_Party/FreeRTOS/Source/timers.c
vendored
1632
source/Middlewares/Third_Party/FreeRTOS/Source/timers.c
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user