mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Replace standard types with stdint.h types.
Replace #define types with typedefs. Rename all typedefs to have a _t extension. Add #defines to automatically convert old FreeRTOS specific types to their new names (with the _t).
This commit is contained in:
parent
f292243dcf
commit
3e20aa7d60
|
@ -77,17 +77,17 @@
|
|||
|
||||
|
||||
/* Lists for ready and blocked co-routines. --------------------*/
|
||||
static xList pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */
|
||||
static xList xDelayedCoRoutineList1; /*< Delayed co-routines. */
|
||||
static xList xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
|
||||
static xList * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */
|
||||
static xList * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
|
||||
static xList 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. */
|
||||
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready 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 * 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 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. */
|
||||
|
||||
/* Other file private variables. --------------------------------*/
|
||||
corCRCB * pxCurrentCoRoutine = NULL;
|
||||
static unsigned portBASE_TYPE uxTopCoRoutineReadyPriority = 0;
|
||||
static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;
|
||||
CRCB_t * pxCurrentCoRoutine = NULL;
|
||||
static UBaseType_t uxTopCoRoutineReadyPriority = 0;
|
||||
static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;
|
||||
|
||||
/* The initial state of the co-routine when it is created. */
|
||||
#define corINITIAL_STATE ( 0 )
|
||||
|
@ -105,7 +105,7 @@ static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks =
|
|||
{ \
|
||||
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \
|
||||
} \
|
||||
vListInsertEnd( ( xList * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \
|
||||
vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -134,13 +134,13 @@ static void prvCheckDelayedList( void );
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex )
|
||||
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
corCRCB *pxCoRoutine;
|
||||
BaseType_t xReturn;
|
||||
CRCB_t *pxCoRoutine;
|
||||
|
||||
/* Allocate the memory that will store the co-routine control block. */
|
||||
pxCoRoutine = ( corCRCB * ) pvPortMalloc( sizeof( corCRCB ) );
|
||||
pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );
|
||||
if( pxCoRoutine )
|
||||
{
|
||||
/* If pxCurrentCoRoutine is NULL then this is the first co-routine to
|
||||
|
@ -167,14 +167,14 @@ corCRCB *pxCoRoutine;
|
|||
vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) );
|
||||
vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );
|
||||
|
||||
/* Set the co-routine control block as a link back from the xListItem.
|
||||
/* 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
|
||||
in a list. */
|
||||
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );
|
||||
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
|
||||
|
||||
/* Event lists are always in priority order. */
|
||||
listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( portTickType ) configMAX_CO_ROUTINE_PRIORITIES - ( portTickType ) 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
|
||||
list at the correct priority. */
|
||||
|
@ -191,9 +191,9 @@ corCRCB *pxCoRoutine;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList )
|
||||
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList )
|
||||
{
|
||||
portTickType xTimeToWake;
|
||||
TickType_t xTimeToWake;
|
||||
|
||||
/* Calculate the time to wake - this may overflow but this is
|
||||
not a problem. */
|
||||
|
@ -202,7 +202,7 @@ portTickType xTimeToWake;
|
|||
/* We must remove ourselves from the ready list before adding
|
||||
ourselves to the blocked list as the same list item is used for
|
||||
both lists. */
|
||||
( void ) uxListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
( void ) uxListRemove( ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
|
||||
/* The list item will be inserted in wake time order. */
|
||||
listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
|
||||
|
@ -211,13 +211,13 @@ portTickType xTimeToWake;
|
|||
{
|
||||
/* Wake time has overflowed. Place this item in the
|
||||
overflow list. */
|
||||
vListInsert( ( xList * ) pxOverflowDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
vListInsert( ( List_t * ) pxOverflowDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The wake time has not overflowed, so we can use the
|
||||
current block list. */
|
||||
vListInsert( ( xList * ) pxDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
vListInsert( ( List_t * ) pxDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
|
||||
}
|
||||
|
||||
if( pxEventList )
|
||||
|
@ -236,12 +236,12 @@ static void prvCheckPendingReadyList( void )
|
|||
the ready lists itself. */
|
||||
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )
|
||||
{
|
||||
corCRCB *pxUnblockedCRCB;
|
||||
CRCB_t *pxUnblockedCRCB;
|
||||
|
||||
/* The pending ready list can be accessed by an ISR. */
|
||||
portDISABLE_INTERRUPTS();
|
||||
{
|
||||
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
|
||||
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );
|
||||
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
}
|
||||
portENABLE_INTERRUPTS();
|
||||
|
@ -254,7 +254,7 @@ static void prvCheckPendingReadyList( void )
|
|||
|
||||
static void prvCheckDelayedList( void )
|
||||
{
|
||||
corCRCB *pxCRCB;
|
||||
CRCB_t *pxCRCB;
|
||||
|
||||
xPassedTicks = xTaskGetTickCount() - xLastTickCount;
|
||||
while( xPassedTicks )
|
||||
|
@ -265,7 +265,7 @@ corCRCB *pxCRCB;
|
|||
/* If the tick count has overflowed we need to swap the ready lists. */
|
||||
if( xCoRoutineTickCount == 0 )
|
||||
{
|
||||
xList * pxTemp;
|
||||
List_t * pxTemp;
|
||||
|
||||
/* 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! */
|
||||
|
@ -277,7 +277,7 @@ corCRCB *pxCRCB;
|
|||
/* See if this tick has made a timeout expire. */
|
||||
while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )
|
||||
{
|
||||
pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
|
||||
pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
|
||||
|
||||
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
|
||||
{
|
||||
|
@ -342,16 +342,16 @@ void vCoRoutineSchedule( void )
|
|||
|
||||
static void prvInitialiseCoRoutineLists( void )
|
||||
{
|
||||
unsigned portBASE_TYPE uxPriority;
|
||||
UBaseType_t uxPriority;
|
||||
|
||||
for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ )
|
||||
{
|
||||
vListInitialise( ( xList * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );
|
||||
vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );
|
||||
}
|
||||
|
||||
vListInitialise( ( xList * ) &xDelayedCoRoutineList1 );
|
||||
vListInitialise( ( xList * ) &xDelayedCoRoutineList2 );
|
||||
vListInitialise( ( xList * ) &xPendingReadyCoRoutineList );
|
||||
vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 );
|
||||
vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 );
|
||||
vListInitialise( ( List_t * ) &xPendingReadyCoRoutineList );
|
||||
|
||||
/* Start with pxDelayedCoRoutineList using list1 and the
|
||||
pxOverflowDelayedCoRoutineList using list2. */
|
||||
|
@ -360,17 +360,17 @@ unsigned portBASE_TYPE uxPriority;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList )
|
||||
BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList )
|
||||
{
|
||||
corCRCB *pxUnblockedCRCB;
|
||||
signed portBASE_TYPE xReturn;
|
||||
CRCB_t *pxUnblockedCRCB;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* This function is called from within an interrupt. It can only access
|
||||
event lists and the pending ready list. This function assumes that a
|
||||
check has already been made to ensure pxEventList is not empty. */
|
||||
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
||||
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
||||
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
vListInsertEnd( ( xList * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );
|
||||
vListInsertEnd( ( List_t * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );
|
||||
|
||||
if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )
|
||||
{
|
||||
|
|
|
@ -106,18 +106,11 @@ taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
|
|||
#define eventEVENT_BITS_CONTROL_BYTES 0xff000000UL
|
||||
#endif
|
||||
|
||||
typedef struct EventBitsDefinition
|
||||
typedef struct EVENT_GROUP_DEFINITION
|
||||
{
|
||||
xEventBitsType uxEventBits;
|
||||
xList xTasksWaitingForBits; /*< List of tasks waiting for a bit to be set. */
|
||||
} xEVENT_BITS;
|
||||
|
||||
/* Used internally only. */
|
||||
typedef struct EVENT_GROUP_CALLBACK_PARAMTERS
|
||||
{
|
||||
xEventGroupHandle xTargetEventGroup;
|
||||
xEventBitsType xBitsToSet;
|
||||
} xEventGroupCallbackParameters;
|
||||
EventBits_t uxEventBits;
|
||||
List_t xTasksWaitingForBits; /*< List of tasks waiting for a bit to be set. */
|
||||
} EventGroup_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -129,15 +122,15 @@ typedef struct EVENT_GROUP_CALLBACK_PARAMTERS
|
|||
* wait condition is met if any of the bits set in uxBitsToWait for are also set
|
||||
* in uxCurrentEventBits.
|
||||
*/
|
||||
static portBASE_TYPE prvTestWaitCondition( const xEventBitsType uxCurrentEventBits, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xWaitForAllBits );
|
||||
static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xEventGroupHandle xEventGroupCreate( void )
|
||||
EventGroupHandle_t xEventGroupCreate( void )
|
||||
{
|
||||
xEVENT_BITS *pxEventBits;
|
||||
EventGroup_t *pxEventBits;
|
||||
|
||||
pxEventBits = pvPortMalloc( sizeof( xEVENT_BITS ) );
|
||||
pxEventBits = pvPortMalloc( sizeof( EventGroup_t ) );
|
||||
if( pxEventBits != NULL )
|
||||
{
|
||||
pxEventBits->uxEventBits = 0;
|
||||
|
@ -149,15 +142,15 @@ xEVENT_BITS *pxEventBits;
|
|||
traceEVENT_GROUP_CREATE_FAILED();
|
||||
}
|
||||
|
||||
return ( xEventGroupHandle ) pxEventBits;
|
||||
return ( EventGroupHandle_t ) pxEventBits;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet, const xEventBitsType uxBitsToWaitFor, portTickType xTicksToWait )
|
||||
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait )
|
||||
{
|
||||
xEventBitsType uxOriginalBitValue, uxReturn;
|
||||
xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup;
|
||||
portBASE_TYPE xAlreadyYielded;
|
||||
EventBits_t uxOriginalBitValue, uxReturn;
|
||||
EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;
|
||||
BaseType_t xAlreadyYielded;
|
||||
|
||||
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||
configASSERT( uxBitsToWaitFor != 0 );
|
||||
|
@ -188,7 +181,7 @@ portBASE_TYPE xAlreadyYielded;
|
|||
}
|
||||
else
|
||||
{
|
||||
if( xTicksToWait != ( portTickType ) 0 )
|
||||
if( xTicksToWait != ( TickType_t ) 0 )
|
||||
{
|
||||
/* Store the bits that the calling task is waiting for in the
|
||||
task's event list item so the kernel knows when a match is
|
||||
|
@ -211,7 +204,7 @@ portBASE_TYPE xAlreadyYielded;
|
|||
}
|
||||
xAlreadyYielded = xTaskResumeAll();
|
||||
|
||||
if( xTicksToWait != ( portTickType ) 0 )
|
||||
if( xTicksToWait != ( TickType_t ) 0 )
|
||||
{
|
||||
if( xAlreadyYielded == pdFALSE )
|
||||
{
|
||||
|
@ -228,7 +221,7 @@ portBASE_TYPE xAlreadyYielded;
|
|||
event list item, and they should now be retrieved then cleared. */
|
||||
uxReturn = uxTaskResetEventItemValue();
|
||||
|
||||
if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( xEventBitsType ) 0 )
|
||||
if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 )
|
||||
{
|
||||
/* The task timed out, just return the current event bit value. */
|
||||
taskENTER_CRITICAL();
|
||||
|
@ -263,11 +256,11 @@ portBASE_TYPE xAlreadyYielded;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xClearOnExit, const portBASE_TYPE xWaitForAllBits, portTickType xTicksToWait )
|
||||
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait )
|
||||
{
|
||||
xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup;
|
||||
xEventBitsType uxReturn, uxControlBits = 0;
|
||||
portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
||||
EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;
|
||||
EventBits_t uxReturn, uxControlBits = 0;
|
||||
BaseType_t xWaitConditionMet, xAlreadyYielded;
|
||||
|
||||
/* Check the user is not attempting to wait on the bits used by the kernel
|
||||
itself, and that at least one bit is being requested. */
|
||||
|
@ -281,7 +274,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
|||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
const xEventBitsType uxCurrentEventBits = pxEventBits->uxEventBits;
|
||||
const EventBits_t uxCurrentEventBits = pxEventBits->uxEventBits;
|
||||
|
||||
traceEVENT_GROUP_WAIT_BITS_START( xEventGroup, uxBitsToWaitFor );
|
||||
|
||||
|
@ -293,7 +286,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
|||
/* The wait condition has already been met so there is no need to
|
||||
block. */
|
||||
uxReturn = uxCurrentEventBits;
|
||||
xTicksToWait = ( portTickType ) 0;
|
||||
xTicksToWait = ( TickType_t ) 0;
|
||||
|
||||
/* Clear the wait bits if requested to do so. */
|
||||
if( xClearOnExit != pdFALSE )
|
||||
|
@ -305,7 +298,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
|||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
else if( xTicksToWait == ( portTickType ) 0 )
|
||||
else if( xTicksToWait == ( TickType_t ) 0 )
|
||||
{
|
||||
/* The wait condition has not been met, but no block time was
|
||||
specified, so just return the current value. */
|
||||
|
@ -348,7 +341,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
|||
}
|
||||
xAlreadyYielded = xTaskResumeAll();
|
||||
|
||||
if( xTicksToWait != ( portTickType ) 0 )
|
||||
if( xTicksToWait != ( TickType_t ) 0 )
|
||||
{
|
||||
if( xAlreadyYielded == pdFALSE )
|
||||
{
|
||||
|
@ -365,7 +358,7 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
|||
event list item, and they should now be retrieved then cleared. */
|
||||
uxReturn = uxTaskResetEventItemValue();
|
||||
|
||||
if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( xEventBitsType ) 0 )
|
||||
if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 )
|
||||
{
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
|
@ -405,10 +398,10 @@ portBASE_TYPE xWaitConditionMet, xAlreadyYielded;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToClear )
|
||||
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )
|
||||
{
|
||||
xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup;
|
||||
xEventBitsType uxReturn;
|
||||
EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;
|
||||
EventBits_t uxReturn;
|
||||
|
||||
/* Check the user is not attempting to clear the bits used by the kernel
|
||||
itself. */
|
||||
|
@ -431,14 +424,14 @@ xEventBitsType uxReturn;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet )
|
||||
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet )
|
||||
{
|
||||
xListItem *pxListItem, *pxNext;
|
||||
xListItem const *pxListEnd;
|
||||
xList *pxList;
|
||||
xEventBitsType uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;
|
||||
xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup;
|
||||
portBASE_TYPE xMatchFound = pdFALSE;
|
||||
ListItem_t *pxListItem, *pxNext;
|
||||
ListItem_t const *pxListEnd;
|
||||
List_t *pxList;
|
||||
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;
|
||||
EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;
|
||||
BaseType_t xMatchFound = pdFALSE;
|
||||
|
||||
/* Check the user is not attempting to set the bits used by the kernel
|
||||
itself. */
|
||||
|
@ -466,10 +459,10 @@ portBASE_TYPE xMatchFound = pdFALSE;
|
|||
uxControlBits = uxBitsWaitedFor & eventEVENT_BITS_CONTROL_BYTES;
|
||||
uxBitsWaitedFor &= ~eventEVENT_BITS_CONTROL_BYTES;
|
||||
|
||||
if( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( xEventBitsType ) 0 )
|
||||
if( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( EventBits_t ) 0 )
|
||||
{
|
||||
/* Just looking for single bit being set. */
|
||||
if( ( uxBitsWaitedFor & pxEventBits->uxEventBits ) != ( xEventBitsType ) 0 )
|
||||
if( ( uxBitsWaitedFor & pxEventBits->uxEventBits ) != ( EventBits_t ) 0 )
|
||||
{
|
||||
xMatchFound = pdTRUE;
|
||||
}
|
||||
|
@ -491,7 +484,7 @@ portBASE_TYPE xMatchFound = pdFALSE;
|
|||
if( xMatchFound != pdFALSE )
|
||||
{
|
||||
/* The bits match. Should the bits be cleared on exit? */
|
||||
if( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( xEventBitsType ) 0 )
|
||||
if( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( EventBits_t ) 0 )
|
||||
{
|
||||
uxBitsToClear |= uxBitsWaitedFor;
|
||||
}
|
||||
|
@ -524,21 +517,21 @@ portBASE_TYPE xMatchFound = pdFALSE;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vEventGroupDelete( xEventGroupHandle xEventGroup )
|
||||
void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||
{
|
||||
xEVENT_BITS *pxEventBits = ( xEVENT_BITS * ) xEventGroup;
|
||||
const xList *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
|
||||
EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;
|
||||
const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
traceEVENT_GROUP_DELETE( xEventGroup );
|
||||
|
||||
while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( unsigned portBASE_TYPE ) 0 )
|
||||
while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( UBaseType_t ) 0 )
|
||||
{
|
||||
/* Unblock the task, returning 0 as the event list is being deleted
|
||||
and cannot therefore have any bits set. */
|
||||
configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( xListItem * ) &( pxTasksWaitingForBits->xListEnd ) );
|
||||
( void ) xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, ( portTickType ) eventUNBLOCKED_DUE_TO_BIT_SET );
|
||||
configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( ListItem_t * ) &( pxTasksWaitingForBits->xListEnd ) );
|
||||
( void ) xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, ( TickType_t ) eventUNBLOCKED_DUE_TO_BIT_SET );
|
||||
}
|
||||
|
||||
vPortFree( pxEventBits );
|
||||
|
@ -549,21 +542,21 @@ const xList *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
|
|||
|
||||
/* For internal use only - execute a 'set bits' command that was pended from
|
||||
an interrupt. */
|
||||
void vEventGroupSetBitsCallback( void *pvEventGroup, const unsigned long ulBitsToSet )
|
||||
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet )
|
||||
{
|
||||
( void ) xEventGroupSetBits( pvEventGroup, ( xEventBitsType ) ulBitsToSet );
|
||||
( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvTestWaitCondition( const xEventBitsType uxCurrentEventBits, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xWaitForAllBits )
|
||||
static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits )
|
||||
{
|
||||
portBASE_TYPE xWaitConditionMet = pdFALSE;
|
||||
BaseType_t xWaitConditionMet = pdFALSE;
|
||||
|
||||
if( xWaitForAllBits == pdFALSE )
|
||||
{
|
||||
/* Task only has to wait for one bit within uxBitsToWaitFor to be
|
||||
set. Is one already set? */
|
||||
if( ( uxCurrentEventBits & uxBitsToWaitFor ) != ( xEventBitsType ) 0 )
|
||||
if( ( uxCurrentEventBits & uxBitsToWaitFor ) != ( EventBits_t ) 0 )
|
||||
{
|
||||
xWaitConditionMet = pdTRUE;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
* Include the generic headers required for the FreeRTOS port being used.
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Basic FreeRTOS definitions. */
|
||||
#include "projdefs.h"
|
||||
|
@ -90,12 +91,12 @@ is included as it is used by the port layer. */
|
|||
|
||||
/* Defines the prototype to which the application task hook function must
|
||||
conform. */
|
||||
typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||
typedef BaseType_t (*pdTASK_HOOK_CODE)( void * );
|
||||
|
||||
/* The type that holds event bits always matches portTickType - therefore the
|
||||
/* The type that holds event bits always matches TickType_t - therefore the
|
||||
number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1,
|
||||
32 bits if set to 0. */
|
||||
typedef portTickType xEventBitsType;
|
||||
typedef TickType_t EventBits_t;
|
||||
|
||||
/*
|
||||
* Check all the required application specific macros have been defined.
|
||||
|
@ -312,7 +313,7 @@ typedef portTickType xEventBitsType;
|
|||
#endif
|
||||
|
||||
#ifndef portPOINTER_SIZE_TYPE
|
||||
#define portPOINTER_SIZE_TYPE unsigned long
|
||||
#define portPOINTER_SIZE_TYPE uint32_t
|
||||
#endif
|
||||
|
||||
/* Remove any unused trace macros. */
|
||||
|
@ -618,7 +619,7 @@ typedef portTickType xEventBitsType;
|
|||
#endif
|
||||
|
||||
#ifndef portPRIVILEGE_BIT
|
||||
#define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
|
||||
#define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
|
||||
#endif
|
||||
|
||||
#ifndef portYIELD_WITHIN_API
|
||||
|
@ -693,8 +694,20 @@ typedef portTickType xEventBitsType;
|
|||
#define mtCOVERAGE_TEST_MARKER()
|
||||
#endif
|
||||
|
||||
/* For backward compatability. */
|
||||
/* For backward compatibility. */
|
||||
#define eTaskStateGet eTaskGetState
|
||||
#define portTickType TickType_t
|
||||
#define xTaskHandle TaskHandle_t
|
||||
#define xQueueHandle QueueHandle_t
|
||||
#define xSemaphoreHandle SemaphoreHandle_t
|
||||
#define xQueueSetHandle QueueSetHandle_t
|
||||
#define xQueueSetMemberHandle QueueSetMember_t
|
||||
#define xTimeoutType TimeOut_t
|
||||
#define xMemoryRegion MemoryRegion_t
|
||||
#define xTaskParameters TaskParameters_t
|
||||
#define xTaskStatusType TaskStatus_t
|
||||
#define xTimerHandle TimerHandle_t
|
||||
#define xCoRoutineHandle CoRoutineHandle_t
|
||||
|
||||
#endif /* INC_FREERTOS_H */
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@
|
|||
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -133,20 +133,20 @@
|
|||
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
static const unsigned char 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 }; \
|
||||
\
|
||||
\
|
||||
/* Has the extremity of the task stack ever been written over? */ \
|
||||
if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
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 }; \
|
||||
\
|
||||
\
|
||||
/* Has the extremity of the task stack ever been written over? */ \
|
||||
if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||
|
@ -154,23 +154,23 @@
|
|||
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \
|
||||
static const unsigned char 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 }; \
|
||||
\
|
||||
\
|
||||
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
||||
\
|
||||
/* Has the extremity of the task stack ever been written over? */ \
|
||||
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
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, 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 ); \
|
||||
\
|
||||
/* 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 ) */
|
||||
|
|
|
@ -79,28 +79,28 @@ extern "C" {
|
|||
/* 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
|
||||
the macro implementation of the co-routine functionality. */
|
||||
typedef void * xCoRoutineHandle;
|
||||
typedef void * CoRoutineHandle_t;
|
||||
|
||||
/* Defines the prototype to which co-routine functions must conform. */
|
||||
typedef void (*crCOROUTINE_CODE)( xCoRoutineHandle, unsigned portBASE_TYPE );
|
||||
typedef void (*crCOROUTINE_CODE)( CoRoutineHandle_t, UBaseType_t );
|
||||
|
||||
typedef struct corCoRoutineControlBlock
|
||||
{
|
||||
crCOROUTINE_CODE pxCoRoutineFunction;
|
||||
xListItem xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */
|
||||
xListItem xEventListItem; /*< List item used to place the CRCB in event lists. */
|
||||
unsigned portBASE_TYPE uxPriority; /*< The priority of the co-routine in relation to other co-routines. */
|
||||
unsigned portBASE_TYPE uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
|
||||
unsigned short uxState; /*< Used internally by the co-routine implementation. */
|
||||
} corCRCB; /* Co-routine control block. Note must be identical in size down to uxPriority with tskTCB. */
|
||||
crCOROUTINE_CODE pxCoRoutineFunction;
|
||||
ListItem_t xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */
|
||||
ListItem_t xEventListItem; /*< List item used to place the CRCB in event lists. */
|
||||
UBaseType_t uxPriority; /*< The priority of the co-routine in relation to other co-routines. */
|
||||
UBaseType_t uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
|
||||
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
|
||||
*<pre>
|
||||
portBASE_TYPE xCoRoutineCreate(
|
||||
BaseType_t xCoRoutineCreate(
|
||||
crCOROUTINE_CODE pxCoRoutineCode,
|
||||
unsigned portBASE_TYPE uxPriority,
|
||||
unsigned portBASE_TYPE uxIndex
|
||||
UBaseType_t uxPriority,
|
||||
UBaseType_t uxIndex
|
||||
);</pre>
|
||||
*
|
||||
* Create a new co-routine and add it to the list of co-routines that are
|
||||
|
@ -123,12 +123,12 @@ typedef struct corCoRoutineControlBlock
|
|||
* Example usage:
|
||||
<pre>
|
||||
// Co-routine to be created.
|
||||
void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
void vFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||
// This may not be necessary for const variables.
|
||||
static const char cLedToFlash[ 2 ] = { 5, 6 };
|
||||
static const portTickType uxFlashRates[ 2 ] = { 200, 400 };
|
||||
static const TickType_t uxFlashRates[ 2 ] = { 200, 400 };
|
||||
|
||||
// Must start every co-routine with a call to crSTART();
|
||||
crSTART( xHandle );
|
||||
|
@ -138,7 +138,7 @@ typedef struct corCoRoutineControlBlock
|
|||
// This co-routine just delays for a fixed period, then toggles
|
||||
// an LED. Two co-routines are created using this function, so
|
||||
// the uxIndex parameter is used to tell the co-routine which
|
||||
// LED to flash and how long to delay. This assumes xQueue has
|
||||
// LED to flash and how int32_t to delay. This assumes xQueue has
|
||||
// already been created.
|
||||
vParTestToggleLED( cLedToFlash[ uxIndex ] );
|
||||
crDELAY( xHandle, uxFlashRates[ uxIndex ] );
|
||||
|
@ -151,8 +151,8 @@ typedef struct corCoRoutineControlBlock
|
|||
// Function that creates two co-routines.
|
||||
void vOtherFunction( void )
|
||||
{
|
||||
unsigned char ucParameterToPass;
|
||||
xTaskHandle xHandle;
|
||||
uint8_t ucParameterToPass;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create two co-routines at priority 0. The first is given index 0
|
||||
// so (from the code above) toggles LED 5 every 200 ticks. The second
|
||||
|
@ -166,7 +166,7 @@ typedef struct corCoRoutineControlBlock
|
|||
* \defgroup xCoRoutineCreate xCoRoutineCreate
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex );
|
||||
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -213,17 +213,17 @@ void vCoRoutineSchedule( void );
|
|||
/**
|
||||
* croutine. h
|
||||
* <pre>
|
||||
crSTART( xCoRoutineHandle xHandle );</pre>
|
||||
crSTART( CoRoutineHandle_t xHandle );</pre>
|
||||
*
|
||||
* This macro MUST always be called at the start of a co-routine function.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
// Co-routine to be created.
|
||||
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||
static long ulAVariable;
|
||||
static int32_t ulAVariable;
|
||||
|
||||
// Must start every co-routine with a call to crSTART();
|
||||
crSTART( xHandle );
|
||||
|
@ -239,7 +239,7 @@ void vCoRoutineSchedule( void );
|
|||
* \defgroup crSTART crSTART
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:
|
||||
#define crSTART( pxCRCB ) switch( ( ( CRCB_t * )( pxCRCB ) )->uxState ) { case 0:
|
||||
|
||||
/**
|
||||
* croutine. h
|
||||
|
@ -251,10 +251,10 @@ void vCoRoutineSchedule( void );
|
|||
* Example usage:
|
||||
<pre>
|
||||
// Co-routine to be created.
|
||||
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||
static long ulAVariable;
|
||||
static int32_t ulAVariable;
|
||||
|
||||
// Must start every co-routine with a call to crSTART();
|
||||
crSTART( xHandle );
|
||||
|
@ -276,13 +276,13 @@ void vCoRoutineSchedule( void );
|
|||
* These macros are intended for internal use by the co-routine implementation
|
||||
* only. The macros should not be used directly by application writers.
|
||||
*/
|
||||
#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
|
||||
#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
|
||||
#define crSET_STATE0( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
|
||||
#define crSET_STATE1( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
|
||||
|
||||
/**
|
||||
* croutine. h
|
||||
*<pre>
|
||||
crDELAY( xCoRoutineHandle xHandle, portTickType xTicksToDelay );</pre>
|
||||
crDELAY( CoRoutineHandle_t xHandle, TickType_t xTicksToDelay );</pre>
|
||||
*
|
||||
* Delay a co-routine for a fixed period of time.
|
||||
*
|
||||
|
@ -301,7 +301,7 @@ void vCoRoutineSchedule( void );
|
|||
* Example usage:
|
||||
<pre>
|
||||
// Co-routine to be created.
|
||||
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||
// This may not be necessary for const variables.
|
||||
|
@ -335,11 +335,11 @@ void vCoRoutineSchedule( void );
|
|||
/**
|
||||
* <pre>
|
||||
crQUEUE_SEND(
|
||||
xCoRoutineHandle xHandle,
|
||||
xQueueHandle pxQueue,
|
||||
CoRoutineHandle_t xHandle,
|
||||
QueueHandle_t pxQueue,
|
||||
void *pvItemToQueue,
|
||||
portTickType xTicksToWait,
|
||||
portBASE_TYPE *pxResult
|
||||
TickType_t xTicksToWait,
|
||||
BaseType_t *pxResult
|
||||
)</pre>
|
||||
*
|
||||
* The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
|
||||
|
@ -383,11 +383,11 @@ void vCoRoutineSchedule( void );
|
|||
<pre>
|
||||
// Co-routine function that blocks for a fixed period then posts a number onto
|
||||
// a queue.
|
||||
static void prvCoRoutineFlashTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void prvCoRoutineFlashTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||
static portBASE_TYPE xNumberToPost = 0;
|
||||
static portBASE_TYPE xResult;
|
||||
static BaseType_t xNumberToPost = 0;
|
||||
static BaseType_t xResult;
|
||||
|
||||
// Co-routines must begin with a call to crSTART().
|
||||
crSTART( xHandle );
|
||||
|
@ -434,11 +434,11 @@ void vCoRoutineSchedule( void );
|
|||
* croutine. h
|
||||
* <pre>
|
||||
crQUEUE_RECEIVE(
|
||||
xCoRoutineHandle xHandle,
|
||||
xQueueHandle pxQueue,
|
||||
CoRoutineHandle_t xHandle,
|
||||
QueueHandle_t pxQueue,
|
||||
void *pvBuffer,
|
||||
portTickType xTicksToWait,
|
||||
portBASE_TYPE *pxResult
|
||||
TickType_t xTicksToWait,
|
||||
BaseType_t *pxResult
|
||||
)</pre>
|
||||
*
|
||||
* The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
|
||||
|
@ -481,11 +481,11 @@ void vCoRoutineSchedule( void );
|
|||
<pre>
|
||||
// A co-routine receives the number of an LED to flash from a queue. It
|
||||
// blocks on the queue until the number is received.
|
||||
static void prvCoRoutineFlashWorkTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void prvCoRoutineFlashWorkTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||
static portBASE_TYPE xResult;
|
||||
static unsigned portBASE_TYPE uxLEDToFlash;
|
||||
static BaseType_t xResult;
|
||||
static UBaseType_t uxLEDToFlash;
|
||||
|
||||
// All co-routines must start with a call to crSTART().
|
||||
crSTART( xHandle );
|
||||
|
@ -526,9 +526,9 @@ void vCoRoutineSchedule( void );
|
|||
* croutine. h
|
||||
* <pre>
|
||||
crQUEUE_SEND_FROM_ISR(
|
||||
xQueueHandle pxQueue,
|
||||
QueueHandle_t pxQueue,
|
||||
void *pvItemToQueue,
|
||||
portBASE_TYPE xCoRoutinePreviouslyWoken
|
||||
BaseType_t xCoRoutinePreviouslyWoken
|
||||
)</pre>
|
||||
*
|
||||
* The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the
|
||||
|
@ -566,10 +566,10 @@ void vCoRoutineSchedule( void );
|
|||
* Example usage:
|
||||
<pre>
|
||||
// A co-routine that blocks on a queue waiting for characters to be received.
|
||||
static void vReceivingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void vReceivingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
char cRxedChar;
|
||||
portBASE_TYPE xResult;
|
||||
BaseType_t xResult;
|
||||
|
||||
// All co-routines must start with a call to crSTART().
|
||||
crSTART( xHandle );
|
||||
|
@ -596,7 +596,7 @@ void vCoRoutineSchedule( void );
|
|||
void vUART_ISR( void )
|
||||
{
|
||||
char cRxedChar;
|
||||
portBASE_TYPE xCRWokenByPost = pdFALSE;
|
||||
BaseType_t xCRWokenByPost = pdFALSE;
|
||||
|
||||
// We loop around reading characters until there are none left in the UART.
|
||||
while( UART_RX_REG_NOT_EMPTY() )
|
||||
|
@ -623,9 +623,9 @@ void vCoRoutineSchedule( void );
|
|||
* croutine. h
|
||||
* <pre>
|
||||
crQUEUE_SEND_FROM_ISR(
|
||||
xQueueHandle pxQueue,
|
||||
QueueHandle_t pxQueue,
|
||||
void *pvBuffer,
|
||||
portBASE_TYPE * pxCoRoutineWoken
|
||||
BaseType_t * pxCoRoutineWoken
|
||||
)</pre>
|
||||
*
|
||||
* The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the
|
||||
|
@ -664,12 +664,12 @@ void vCoRoutineSchedule( void );
|
|||
<pre>
|
||||
// A co-routine that posts a character to a queue then blocks for a fixed
|
||||
// period. The character is incremented each time.
|
||||
static void vSendingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void vSendingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
// cChar holds its value while this co-routine is blocked and must therefore
|
||||
// be declared static.
|
||||
static char cCharToTx = 'a';
|
||||
portBASE_TYPE xResult;
|
||||
BaseType_t xResult;
|
||||
|
||||
// All co-routines must start with a call to crSTART().
|
||||
crSTART( xHandle );
|
||||
|
@ -712,7 +712,7 @@ void vCoRoutineSchedule( void );
|
|||
void vUART_ISR( void )
|
||||
{
|
||||
char cCharToTx;
|
||||
portBASE_TYPE xCRWokenByPost = pdFALSE;
|
||||
BaseType_t xCRWokenByPost = pdFALSE;
|
||||
|
||||
while( UART_TX_REG_EMPTY() )
|
||||
{
|
||||
|
@ -740,7 +740,7 @@ void vCoRoutineSchedule( void );
|
|||
* Removes the current co-routine from its ready list and places it in the
|
||||
* appropriate delayed list.
|
||||
*/
|
||||
void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList );
|
||||
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList );
|
||||
|
||||
/*
|
||||
* This function is intended for internal use by the queue implementation only.
|
||||
|
@ -749,7 +749,7 @@ void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList
|
|||
* Removes the highest priority co-routine from the event list and places it in
|
||||
* the pending ready list.
|
||||
*/
|
||||
signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList );
|
||||
BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -109,18 +109,18 @@ extern "C" {
|
|||
* event_groups.h
|
||||
*
|
||||
* Type by which event groups are referenced. For example, a call to
|
||||
* xEventGroupCreate() returns an xEventGroupHandle variable that can then
|
||||
* xEventGroupCreate() returns an EventGroupHandle_t variable that can then
|
||||
* be used as a parameter to other event group functions.
|
||||
*
|
||||
* \defgroup xEventGroupHandle xEventGroupHandle
|
||||
* \defgroup EventGroupHandle_t EventGroupHandle_t
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
typedef void * xEventGroupHandle;
|
||||
typedef void * EventGroupHandle_t;
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
xEventGroupHandle xEventGroupCreate( void );
|
||||
EventGroupHandle_t xEventGroupCreate( void );
|
||||
</pre>
|
||||
*
|
||||
* Create a new event group. This function cannot be called from an interrupt.
|
||||
|
@ -130,7 +130,7 @@ typedef void * xEventGroupHandle;
|
|||
* on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h. If
|
||||
* configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit
|
||||
* 0 to bit 7). If configUSE_16_BIT_TICKS is set to 0 then each event group has
|
||||
* 24 usable bits (bit 0 to bit 23). The xEventBitsType type is used to store
|
||||
* 24 usable bits (bit 0 to bit 23). The EventBits_t type is used to store
|
||||
* event bits within an event group.
|
||||
*
|
||||
* @return If the event group was created then a handle to the event group is
|
||||
|
@ -140,7 +140,7 @@ typedef void * xEventGroupHandle;
|
|||
* Example usage:
|
||||
<pre>
|
||||
// Declare a variable to hold the created event group.
|
||||
xEventGroupHandle xCreatedEventGroup;
|
||||
EventGroupHandle_t xCreatedEventGroup;
|
||||
|
||||
// Attempt to create the event group.
|
||||
xCreatedEventGroup = xEventGroupCreate();
|
||||
|
@ -159,16 +159,16 @@ typedef void * xEventGroupHandle;
|
|||
* \defgroup xEventGroupCreate xEventGroupCreate
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
xEventGroupHandle xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||
EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup,
|
||||
const xEventBitsType uxBitsToWaitFor,
|
||||
const portBASE_TYPE xClearOnExit,
|
||||
const portBASE_TYPE xWaitForAllBits,
|
||||
const portTickType xTicksToWait );
|
||||
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||
const EventBits_t uxBitsToWaitFor,
|
||||
const BaseType_t xClearOnExit,
|
||||
const BaseType_t xWaitForAllBits,
|
||||
const TickType_t xTicksToWait );
|
||||
</pre>
|
||||
*
|
||||
* [Potentially] block to wait for one or more bits to be set within a
|
||||
|
@ -217,10 +217,10 @@ xEventGroupHandle xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
|||
#define BIT_0 ( 1 << 0 )
|
||||
#define BIT_4 ( 1 << 4 )
|
||||
|
||||
void aFunction( xEventGroupHandle xEventGroup )
|
||||
void aFunction( EventGroupHandle_t xEventGroup )
|
||||
{
|
||||
xEventBitsType uxBits;
|
||||
const portTickType xTicksToWait = 100 / portTICK_RATE_MS;
|
||||
EventBits_t uxBits;
|
||||
const TickType_t xTicksToWait = 100 / portTICK_RATE_MS;
|
||||
|
||||
// Wait a maximum of 100ms for either bit 0 or bit 4 to be set within
|
||||
// the event group. Clear the bits before exiting.
|
||||
|
@ -253,12 +253,12 @@ xEventGroupHandle xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup xEventGroupWaitBits xEventGroupWaitBits
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToWaitFor, const portBASE_TYPE xClearOnExit, const portBASE_TYPE xWaitForAllBits, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToClear );
|
||||
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
|
||||
</pre>
|
||||
*
|
||||
* Clear bits within an event group. This function cannot be called from an
|
||||
|
@ -277,9 +277,9 @@ xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventB
|
|||
#define BIT_0 ( 1 << 0 )
|
||||
#define BIT_4 ( 1 << 4 )
|
||||
|
||||
void aFunction( xEventGroupHandle xEventGroup )
|
||||
void aFunction( EventGroupHandle_t xEventGroup )
|
||||
{
|
||||
xEventBitsType uxBits;
|
||||
EventBits_t uxBits;
|
||||
|
||||
// Clear bit 0 and bit 4 in xEventGroup.
|
||||
uxBits = xEventGroupClearBits(
|
||||
|
@ -310,12 +310,12 @@ xEventBitsType xEventGroupWaitBits( xEventGroupHandle xEventGroup, const xEventB
|
|||
* \defgroup xEventGroupClearBits xEventGroupClearBits
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToClear ) PRIVILEGED_FUNCTION;
|
||||
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet );
|
||||
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||
</pre>
|
||||
*
|
||||
* Set bits within an event group.
|
||||
|
@ -346,9 +346,9 @@ xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEvent
|
|||
#define BIT_0 ( 1 << 0 )
|
||||
#define BIT_4 ( 1 << 4 )
|
||||
|
||||
void aFunction( xEventGroupHandle xEventGroup )
|
||||
void aFunction( EventGroupHandle_t xEventGroup )
|
||||
{
|
||||
xEventBitsType uxBits;
|
||||
EventBits_t uxBits;
|
||||
|
||||
// Set bit 0 and bit 4 in xEventGroup.
|
||||
uxBits = xEventGroupSetBits(
|
||||
|
@ -384,12 +384,12 @@ xEventBitsType xEventGroupClearBits( xEventGroupHandle xEventGroup, const xEvent
|
|||
* \defgroup xEventGroupSetBits xEventGroupSetBits
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet ) PRIVILEGED_FUNCTION;
|
||||
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
xEventBitsType xEventGroupSetBitsFromISR( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet, portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
EventBits_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
|
||||
</pre>
|
||||
*
|
||||
* A version of xEventGroupSetBits() that can be called from an interrupt.
|
||||
|
@ -429,11 +429,11 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi
|
|||
|
||||
// An event group which it is assumed has already been created by a call to
|
||||
// xEventGroupCreate().
|
||||
xEventGroupHandle xEventGroup;
|
||||
EventGroupHandle_t xEventGroup;
|
||||
|
||||
void anInterruptHandler( void )
|
||||
{
|
||||
portBASE_TYPE xHigherPriorityTaskWoken;
|
||||
BaseType_t xHigherPriorityTaskWoken;
|
||||
|
||||
// xHigherPriorityTaskWoken must be initialised to pdFALSE.
|
||||
xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
@ -454,15 +454,15 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi
|
|||
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendCallbackFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( unsigned long ) uxBitsToSet, pxHigherPriorityTaskWoken )
|
||||
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendCallbackFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken )
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup,
|
||||
const xEventBitsType uxBitsToSet,
|
||||
const xEventBitsType uxBitsToWaitFor,
|
||||
portTickType xTicksToWait );
|
||||
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||
const EventBits_t uxBitsToSet,
|
||||
const EventBits_t uxBitsToWaitFor,
|
||||
TickType_t xTicksToWait );
|
||||
</pre>
|
||||
*
|
||||
* Atomically set bits within an event group, then wait for a combination of
|
||||
|
@ -512,12 +512,12 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi
|
|||
|
||||
// Use an event group to synchronise three tasks. It is assumed this event
|
||||
// group has already been created elsewhere.
|
||||
xEventGroupHandle xEventBits;
|
||||
EventGroupHandle_t xEventBits;
|
||||
|
||||
void vTask0( void *pvParameters )
|
||||
{
|
||||
xEventBitsType uxReturn;
|
||||
portTickType xTicksToWait = 100 / portTICK_RATE_MS;
|
||||
EventBits_t uxReturn;
|
||||
TickType_t xTicksToWait = 100 / portTICK_RATE_MS;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -580,13 +580,13 @@ xEventBitsType xEventGroupSetBits( xEventGroupHandle xEventGroup, const xEventBi
|
|||
* \defgroup xEventGroupSync xEventGroupSync
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsType uxBitsToSet, const xEventBitsType uxBitsToWaitFor, portTickType 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
|
||||
*<pre>
|
||||
xEventBitsType xEventGroupGetBits( xEventGroupHandle xEventGroup );
|
||||
EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );
|
||||
</pre>
|
||||
*
|
||||
* Returns the current value of the bits in an event group. This function
|
||||
|
@ -604,7 +604,7 @@ xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsT
|
|||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
void xEventGroupDelete( xEventGroupHandle xEventGroup );
|
||||
void xEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||
</pre>
|
||||
*
|
||||
* Delete an event group that was previously created by a call to
|
||||
|
@ -613,10 +613,10 @@ xEventBitsType xEventGroupSync( xEventGroupHandle xEventGroup, const xEventBitsT
|
|||
*
|
||||
* @param xEventGroup The event group being deleted.
|
||||
*/
|
||||
void vEventGroupDelete( xEventGroupHandle xEventGroup );
|
||||
void vEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||
|
||||
/* For internal use only. */
|
||||
void vEventGroupSetBitsCallback( void *pvEventGroup, const unsigned long ulBitsToSet );
|
||||
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
* heavily for the schedulers needs, it is also available for use by
|
||||
* application code.
|
||||
*
|
||||
* xLists can only store pointers to xListItems. Each xListItem contains a
|
||||
* list_ts can only store pointers to list_item_ts. Each ListItem_t contains a
|
||||
* numeric value (xItemValue). Most of the time the lists are sorted in
|
||||
* descending item value order.
|
||||
*
|
||||
|
@ -135,31 +135,31 @@ extern "C" {
|
|||
*/
|
||||
struct xLIST_ITEM
|
||||
{
|
||||
configLIST_VOLATILE portTickType xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next xListItem in the list. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;/*< Pointer to the previous xListItem 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. */
|
||||
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||
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 pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous 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. */
|
||||
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||
};
|
||||
typedef struct xLIST_ITEM xListItem; /* 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
|
||||
{
|
||||
configLIST_VOLATILE portTickType xItemValue;
|
||||
configLIST_VOLATILE TickType_t xItemValue;
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||
};
|
||||
typedef struct xMINI_LIST_ITEM xMiniListItem;
|
||||
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||
|
||||
/*
|
||||
* Definition of the type of queue used by the scheduler.
|
||||
*/
|
||||
typedef struct xLIST
|
||||
{
|
||||
configLIST_VOLATILE unsigned portBASE_TYPE uxNumberOfItems;
|
||||
xListItem * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||
xMiniListItem 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. */
|
||||
} xList;
|
||||
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
||||
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 (). */
|
||||
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. */
|
||||
} List_t;
|
||||
|
||||
/*
|
||||
* Access macro to set the owner of a list item. The owner of a list item
|
||||
|
@ -177,7 +177,7 @@ typedef struct xLIST
|
|||
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||
* \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
|
||||
|
@ -186,7 +186,7 @@ typedef struct xLIST
|
|||
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||
* \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
|
||||
|
@ -196,7 +196,7 @@ typedef struct xLIST
|
|||
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||
* \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
|
||||
|
@ -205,7 +205,7 @@ typedef struct xLIST
|
|||
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||
* \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.
|
||||
|
@ -213,7 +213,7 @@ typedef struct xLIST
|
|||
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext )
|
||||
#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext )
|
||||
|
||||
/*
|
||||
* Return the list item at the head of the list.
|
||||
|
@ -221,7 +221,7 @@ typedef struct xLIST
|
|||
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
|
||||
* \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
|
||||
|
@ -229,7 +229,7 @@ typedef struct xLIST
|
|||
* \page listGET_END_MARKER listGET_END_MARKER
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_END_MARKER( pxList ) ( ( xListItem 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
|
||||
|
@ -238,12 +238,12 @@ typedef struct xLIST
|
|||
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listLIST_IS_EMPTY( pxList ) ( ( portBASE_TYPE ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) )
|
||||
#define listLIST_IS_EMPTY( pxList ) ( ( BaseType_t ) ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) )
|
||||
|
||||
/*
|
||||
* 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.
|
||||
|
@ -267,7 +267,7 @@ typedef struct xLIST
|
|||
*/
|
||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||
{ \
|
||||
xList * const pxConstList = ( pxList ); \
|
||||
List_t * const pxConstList = ( pxList ); \
|
||||
/* 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. */ \
|
||||
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||
|
@ -306,13 +306,13 @@ xList * const pxConstList = ( pxList ); \
|
|||
* @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.
|
||||
*/
|
||||
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( portBASE_TYPE ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )
|
||||
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( BaseType_t ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )
|
||||
|
||||
/*
|
||||
* Return the list a list item is contained within (referenced from).
|
||||
*
|
||||
* @param pxListItem The list item being queried.
|
||||
* @return A pointer to the xList object that references the pxListItem
|
||||
* @return A pointer to the List_t object that references the pxListItem
|
||||
*/
|
||||
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pvContainer )
|
||||
|
||||
|
@ -333,7 +333,7 @@ xList * const pxConstList = ( pxList ); \
|
|||
* \page vListInitialise vListInitialise
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInitialise( xList * const pxList );
|
||||
void vListInitialise( List_t * const pxList );
|
||||
|
||||
/*
|
||||
* Must be called before a list item is used. This sets the list container to
|
||||
|
@ -344,7 +344,7 @@ void vListInitialise( xList * const pxList );
|
|||
* \page vListInitialiseItem vListInitialiseItem
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInitialiseItem( xListItem * const pxItem );
|
||||
void vListInitialiseItem( ListItem_t * const pxItem );
|
||||
|
||||
/*
|
||||
* Insert a list item into a list. The item will be inserted into the list in
|
||||
|
@ -357,7 +357,7 @@ void vListInitialiseItem( xListItem * const pxItem );
|
|||
* \page vListInsert vListInsert
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInsert( xList * const pxList, xListItem * const pxNewListItem );
|
||||
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||
|
||||
/*
|
||||
* Insert a list item into a list. The item will be inserted in a position
|
||||
|
@ -378,7 +378,7 @@ void vListInsert( xList * const pxList, xListItem * const pxNewListItem );
|
|||
* \page vListInsertEnd vListInsertEnd
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem );
|
||||
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||
|
||||
/*
|
||||
* Remove an item from a list. The list item has a pointer to the list that
|
||||
|
@ -393,7 +393,7 @@ void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem );
|
|||
* \page uxListRemove uxListRemove
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove );
|
||||
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -70,8 +70,10 @@
|
|||
#ifndef PORTABLE_H
|
||||
#define PORTABLE_H
|
||||
|
||||
/* Include the macro file relevant to the port being used. */
|
||||
|
||||
/* Include the macro file relevant to the port being used.
|
||||
NOTE: The following definitions are *DEPRECATED* as it is preferred to instead
|
||||
just add the path to the correct portmacro.h header file to the compiler's
|
||||
include path. */
|
||||
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
|
@ -356,9 +358,9 @@ extern "C" {
|
|||
*
|
||||
*/
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
|
||||
#else
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -374,7 +376,7 @@ size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
|||
* 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.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
|
||||
|
@ -392,7 +394,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
|||
*/
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
struct xMEMORY_REGION;
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -71,15 +71,15 @@ typedef void (*pdTASK_CODE)( void * );
|
|||
|
||||
/* Defines the prototype to which callback functions called from the RTOS/timer
|
||||
daemon task must conform. */
|
||||
typedef void (*pdAPPLICATION_CALLBACK_CODE)( void *, unsigned long );
|
||||
typedef void (*pdAPPLICATION_CALLBACK_CODE)( void *, uint32_t );
|
||||
|
||||
#define pdFALSE ( ( portBASE_TYPE ) 0 )
|
||||
#define pdTRUE ( ( portBASE_TYPE ) 1 )
|
||||
#define pdFALSE ( ( BaseType_t ) 0 )
|
||||
#define pdTRUE ( ( BaseType_t ) 1 )
|
||||
|
||||
#define pdPASS ( pdTRUE )
|
||||
#define pdFAIL ( pdFALSE )
|
||||
#define errQUEUE_EMPTY ( ( portBASE_TYPE ) 0 )
|
||||
#define errQUEUE_FULL ( ( portBASE_TYPE ) 0 )
|
||||
#define pdPASS ( pdTRUE )
|
||||
#define pdFAIL ( pdFALSE )
|
||||
#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
|
||||
#define errQUEUE_FULL ( ( BaseType_t ) 0 )
|
||||
|
||||
/* Error definitions. */
|
||||
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||
|
|
|
@ -78,44 +78,44 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* Type by which queues are referenced. For example, a call to xQueueCreate()
|
||||
* returns an xQueueHandle variable that can then be used as a parameter to
|
||||
* returns an QueueHandle_t variable that can then be used as a parameter to
|
||||
* xQueueSend(), xQueueReceive(), etc.
|
||||
*/
|
||||
typedef void * xQueueHandle;
|
||||
typedef void * QueueHandle_t;
|
||||
|
||||
/**
|
||||
* Type by which queue sets are referenced. For example, a call to
|
||||
* xQueueCreateSet() returns an xQueueSet variable that can then be used as a
|
||||
* parameter to xQueueSelectFromSet(), xQueueAddToSet(), etc.
|
||||
*/
|
||||
typedef void * xQueueSetHandle;
|
||||
typedef void * QueueSetHandle_t;
|
||||
|
||||
/**
|
||||
* Queue sets can contain both queues and semaphores, so the
|
||||
* xQueueSetMemberHandle is defined as a type to be used where a parameter or
|
||||
* return value can be either an xQueueHandle or an xSemaphoreHandle.
|
||||
* QueueSetMember_t is defined as a type to be used where a parameter or
|
||||
* return value can be either an QueueHandle_t or an SemaphoreHandle_t.
|
||||
*/
|
||||
typedef void * xQueueSetMemberHandle;
|
||||
typedef void * QueueSetMember_t;
|
||||
|
||||
/* For internal use only. */
|
||||
#define queueSEND_TO_BACK ( ( portBASE_TYPE ) 0 )
|
||||
#define queueSEND_TO_FRONT ( ( portBASE_TYPE ) 1 )
|
||||
#define queueOVERWRITE ( ( portBASE_TYPE ) 2 )
|
||||
#define queueSEND_TO_BACK ( ( BaseType_t ) 0 )
|
||||
#define queueSEND_TO_FRONT ( ( BaseType_t ) 1 )
|
||||
#define queueOVERWRITE ( ( BaseType_t ) 2 )
|
||||
|
||||
/* For internal use only. These definitions *must* match those in queue.c. */
|
||||
#define queueQUEUE_TYPE_BASE ( ( unsigned char ) 0U )
|
||||
#define queueQUEUE_TYPE_SET ( ( unsigned char ) 0U )
|
||||
#define queueQUEUE_TYPE_MUTEX ( ( unsigned char ) 1U )
|
||||
#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( unsigned char ) 2U )
|
||||
#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( unsigned char ) 3U )
|
||||
#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( unsigned char ) 4U )
|
||||
#define queueQUEUE_TYPE_BASE ( ( uint8_t ) 0U )
|
||||
#define queueQUEUE_TYPE_SET ( ( uint8_t ) 0U )
|
||||
#define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U )
|
||||
#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( uint8_t ) 2U )
|
||||
#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( uint8_t ) 3U )
|
||||
#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( uint8_t ) 4U )
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
xQueueHandle xQueueCreate(
|
||||
unsigned portBASE_TYPE uxQueueLength,
|
||||
unsigned portBASE_TYPE uxItemSize
|
||||
QueueHandle_t xQueueCreate(
|
||||
UBaseType_t uxQueueLength,
|
||||
UBaseType_t uxItemSize
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -143,10 +143,10 @@ typedef void * xQueueSetMemberHandle;
|
|||
|
||||
void vATask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue1, xQueue2;
|
||||
QueueHandle_t xQueue1, xQueue2;
|
||||
|
||||
// Create a queue capable of containing 10 unsigned long values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
|
||||
// Create a queue capable of containing 10 uint32_t values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
||||
if( xQueue1 == 0 )
|
||||
{
|
||||
// Queue was not created and must not be used.
|
||||
|
@ -171,10 +171,10 @@ typedef void * xQueueSetMemberHandle;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueSendToToFront(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueSendToToFront(
|
||||
QueueHandle_t xQueue,
|
||||
const void * pvItemToQueue,
|
||||
portTickType xTicksToWait
|
||||
TickType_t xTicksToWait
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -208,15 +208,15 @@ typedef void * xQueueSetMemberHandle;
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
unsigned long ulVar = 10UL;
|
||||
uint32_t ulVar = 10UL;
|
||||
|
||||
void vATask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue1, xQueue2;
|
||||
QueueHandle_t xQueue1, xQueue2;
|
||||
struct AMessage *pxMessage;
|
||||
|
||||
// Create a queue capable of containing 10 unsigned long values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
|
||||
// Create a queue capable of containing 10 uint32_t values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
||||
|
||||
// Create a queue capable of containing 10 pointers to AMessage structures.
|
||||
// These should be passed by pointer as they contain a lot of data.
|
||||
|
@ -226,9 +226,9 @@ typedef void * xQueueSetMemberHandle;
|
|||
|
||||
if( xQueue1 != 0 )
|
||||
{
|
||||
// Send an unsigned long. Wait for 10 ticks for space to become
|
||||
// Send an uint32_t. Wait for 10 ticks for space to become
|
||||
// available if necessary.
|
||||
if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
|
||||
if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )
|
||||
{
|
||||
// Failed to post the message, even after 10 ticks.
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ typedef void * xQueueSetMemberHandle;
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
|
||||
xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );
|
||||
}
|
||||
|
||||
// ... Rest of task code.
|
||||
|
@ -253,10 +253,10 @@ typedef void * xQueueSetMemberHandle;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueSendToBack(
|
||||
xQueueHandle xQueue,
|
||||
const void * pvItemToQueue,
|
||||
portTickType xTicksToWait
|
||||
BaseType_t xQueueSendToBack(
|
||||
QueueHandle_t xQueue,
|
||||
const void *pvItemToQueue,
|
||||
TickType_t xTicksToWait
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -290,15 +290,15 @@ typedef void * xQueueSetMemberHandle;
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
unsigned long ulVar = 10UL;
|
||||
uint32_t ulVar = 10UL;
|
||||
|
||||
void vATask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue1, xQueue2;
|
||||
QueueHandle_t xQueue1, xQueue2;
|
||||
struct AMessage *pxMessage;
|
||||
|
||||
// Create a queue capable of containing 10 unsigned long values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
|
||||
// Create a queue capable of containing 10 uint32_t values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
||||
|
||||
// Create a queue capable of containing 10 pointers to AMessage structures.
|
||||
// These should be passed by pointer as they contain a lot of data.
|
||||
|
@ -308,9 +308,9 @@ typedef void * xQueueSetMemberHandle;
|
|||
|
||||
if( xQueue1 != 0 )
|
||||
{
|
||||
// Send an unsigned long. Wait for 10 ticks for space to become
|
||||
// Send an uint32_t. Wait for 10 ticks for space to become
|
||||
// available if necessary.
|
||||
if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
|
||||
if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )
|
||||
{
|
||||
// Failed to post the message, even after 10 ticks.
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ typedef void * xQueueSetMemberHandle;
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
|
||||
xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );
|
||||
}
|
||||
|
||||
// ... Rest of task code.
|
||||
|
@ -335,10 +335,10 @@ typedef void * xQueueSetMemberHandle;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueSend(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueSend(
|
||||
QueueHandle_t xQueue,
|
||||
const void * pvItemToQueue,
|
||||
portTickType xTicksToWait
|
||||
TickType_t xTicksToWait
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -374,15 +374,15 @@ typedef void * xQueueSetMemberHandle;
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
unsigned long ulVar = 10UL;
|
||||
uint32_t ulVar = 10UL;
|
||||
|
||||
void vATask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue1, xQueue2;
|
||||
QueueHandle_t xQueue1, xQueue2;
|
||||
struct AMessage *pxMessage;
|
||||
|
||||
// Create a queue capable of containing 10 unsigned long values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
|
||||
// Create a queue capable of containing 10 uint32_t values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
||||
|
||||
// Create a queue capable of containing 10 pointers to AMessage structures.
|
||||
// These should be passed by pointer as they contain a lot of data.
|
||||
|
@ -392,9 +392,9 @@ typedef void * xQueueSetMemberHandle;
|
|||
|
||||
if( xQueue1 != 0 )
|
||||
{
|
||||
// Send an unsigned long. Wait for 10 ticks for space to become
|
||||
// Send an uint32_t. Wait for 10 ticks for space to become
|
||||
// available if necessary.
|
||||
if( xQueueSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )
|
||||
if( xQueueSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )
|
||||
{
|
||||
// Failed to post the message, even after 10 ticks.
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ typedef void * xQueueSetMemberHandle;
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );
|
||||
xQueueSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );
|
||||
}
|
||||
|
||||
// ... Rest of task code.
|
||||
|
@ -419,8 +419,8 @@ typedef void * xQueueSetMemberHandle;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueOverwrite(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueOverwrite(
|
||||
QueueHandle_t xQueue,
|
||||
const void * pvItemToQueue
|
||||
);
|
||||
* </pre>
|
||||
|
@ -451,14 +451,14 @@ typedef void * xQueueSetMemberHandle;
|
|||
|
||||
void vFunction( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue;
|
||||
unsigned long ulVarToSend, ulValReceived;
|
||||
QueueHandle_t xQueue;
|
||||
uint32_t ulVarToSend, ulValReceived;
|
||||
|
||||
// Create a queue to hold one unsigned long value. It is strongly
|
||||
// Create a queue to hold one uint32_t value. It is strongly
|
||||
// recommended *not* to use xQueueOverwrite() on queues that can
|
||||
// contain more than one value, and doing so will trigger an assertion
|
||||
// if configASSERT() is defined.
|
||||
xQueue = xQueueCreate( 1, sizeof( unsigned long ) );
|
||||
xQueue = xQueueCreate( 1, sizeof( uint32_t ) );
|
||||
|
||||
// Write the value 10 to the queue using xQueueOverwrite().
|
||||
ulVarToSend = 10;
|
||||
|
@ -503,11 +503,11 @@ typedef void * xQueueSetMemberHandle;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueGenericSend(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueGenericSend(
|
||||
QueueHandle_t xQueue,
|
||||
const void * pvItemToQueue,
|
||||
portTickType xTicksToWait
|
||||
portBASE_TYPE xCopyPosition
|
||||
TickType_t xTicksToWait
|
||||
BaseType_t xCopyPosition
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -545,15 +545,15 @@ typedef void * xQueueSetMemberHandle;
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
unsigned long ulVar = 10UL;
|
||||
uint32_t ulVar = 10UL;
|
||||
|
||||
void vATask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue1, xQueue2;
|
||||
QueueHandle_t xQueue1, xQueue2;
|
||||
struct AMessage *pxMessage;
|
||||
|
||||
// Create a queue capable of containing 10 unsigned long values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
|
||||
// Create a queue capable of containing 10 uint32_t values.
|
||||
xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
||||
|
||||
// Create a queue capable of containing 10 pointers to AMessage structures.
|
||||
// These should be passed by pointer as they contain a lot of data.
|
||||
|
@ -563,9 +563,9 @@ typedef void * xQueueSetMemberHandle;
|
|||
|
||||
if( xQueue1 != 0 )
|
||||
{
|
||||
// Send an unsigned long. Wait for 10 ticks for space to become
|
||||
// Send an uint32_t. Wait for 10 ticks for space to become
|
||||
// available if necessary.
|
||||
if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10, queueSEND_TO_BACK ) != pdPASS )
|
||||
if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10, queueSEND_TO_BACK ) != pdPASS )
|
||||
{
|
||||
// Failed to post the message, even after 10 ticks.
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ typedef void * xQueueSetMemberHandle;
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0, queueSEND_TO_BACK );
|
||||
xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0, queueSEND_TO_BACK );
|
||||
}
|
||||
|
||||
// ... Rest of task code.
|
||||
|
@ -585,15 +585,15 @@ typedef void * xQueueSetMemberHandle;
|
|||
* \defgroup xQueueSend xQueueSend
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, const portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueuePeek(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueuePeek(
|
||||
QueueHandle_t xQueue,
|
||||
void *pvBuffer,
|
||||
portTickType xTicksToWait
|
||||
TickType_t xTicksToWait
|
||||
);</pre>
|
||||
*
|
||||
* This is a macro that calls the xQueueGenericReceive() function.
|
||||
|
@ -634,7 +634,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
// Task to create a queue and post a value.
|
||||
void vATask( void *pvParameters )
|
||||
|
@ -654,7 +654,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
|
||||
xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );
|
||||
|
||||
// ... Rest of task code.
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
|||
{
|
||||
// Peek a message on the created queue. Block for 10 ticks if a
|
||||
// message is not immediately available.
|
||||
if( xQueuePeek( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
|
||||
if( xQueuePeek( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )
|
||||
{
|
||||
// pcRxedMessage now points to the struct AMessage variable posted
|
||||
// by vATask, but the item still remains on the queue.
|
||||
|
@ -686,8 +686,8 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueuePeekFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueuePeekFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
void *pvBuffer,
|
||||
);</pre>
|
||||
*
|
||||
|
@ -714,15 +714,15 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
|||
* \defgroup xQueuePeekFromISR xQueuePeekFromISR
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueReceive(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueReceive(
|
||||
QueueHandle_t xQueue,
|
||||
void *pvBuffer,
|
||||
portTickType xTicksToWait
|
||||
TickType_t xTicksToWait
|
||||
);</pre>
|
||||
*
|
||||
* This is a macro that calls the xQueueGenericReceive() function.
|
||||
|
@ -760,7 +760,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
// Task to create a queue and post a value.
|
||||
void vATask( void *pvParameters )
|
||||
|
@ -780,7 +780,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
|
||||
xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );
|
||||
|
||||
// ... Rest of task code.
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
{
|
||||
// Receive a message on the created queue. Block for 10 ticks if a
|
||||
// message is not immediately available.
|
||||
if( xQueueReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
|
||||
if( xQueueReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )
|
||||
{
|
||||
// pcRxedMessage now points to the struct AMessage variable posted
|
||||
// by vATask.
|
||||
|
@ -813,11 +813,11 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueGenericReceive(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueGenericReceive(
|
||||
QueueHandle_t xQueue,
|
||||
void *pvBuffer,
|
||||
portTickType xTicksToWait
|
||||
portBASE_TYPE xJustPeek
|
||||
TickType_t xTicksToWait
|
||||
BaseType_t xJustPeek
|
||||
);</pre>
|
||||
*
|
||||
* It is preferred that the macro xQueueReceive() be used rather than calling
|
||||
|
@ -859,7 +859,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
char ucData[ 20 ];
|
||||
} xMessage;
|
||||
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
// Task to create a queue and post a value.
|
||||
void vATask( void *pvParameters )
|
||||
|
@ -879,7 +879,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
// Send a pointer to a struct AMessage object. Don't block if the
|
||||
// queue is already full.
|
||||
pxMessage = & xMessage;
|
||||
xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );
|
||||
xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );
|
||||
|
||||
// ... Rest of task code.
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
{
|
||||
// Receive a message on the created queue. Block for 10 ticks if a
|
||||
// message is not immediately available.
|
||||
if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )
|
||||
if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )
|
||||
{
|
||||
// pcRxedMessage now points to the struct AMessage variable posted
|
||||
// by vATask.
|
||||
|
@ -906,11 +906,11 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
|||
* \defgroup xQueueReceive xQueueReceive
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, const portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeek ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );</pre>
|
||||
* <pre>UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue );</pre>
|
||||
*
|
||||
* Return the number of messages stored in a queue.
|
||||
*
|
||||
|
@ -921,11 +921,11 @@ signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvB
|
|||
* \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue );</pre>
|
||||
* <pre>UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue );</pre>
|
||||
*
|
||||
* Return the number of free spaces available in a queue. This is equal to the
|
||||
* number of items that can be sent to the queue before the queue becomes full
|
||||
|
@ -938,11 +938,11 @@ unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVI
|
|||
* \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>void vQueueDelete( xQueueHandle xQueue );</pre>
|
||||
* <pre>void vQueueDelete( QueueHandle_t xQueue );</pre>
|
||||
*
|
||||
* Delete a queue - freeing all the memory allocated for storing of items
|
||||
* placed on the queue.
|
||||
|
@ -952,15 +952,15 @@ unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) PRIVI
|
|||
* \defgroup vQueueDelete vQueueDelete
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueSendToFrontFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueSendToFrontFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
const void *pvItemToQueue,
|
||||
portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||
BaseType_t *pxHigherPriorityTaskWoken
|
||||
);
|
||||
</pre>
|
||||
*
|
||||
|
@ -995,7 +995,7 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
|||
void vBufferISR( void )
|
||||
{
|
||||
char cIn;
|
||||
portBASE_TYPE xHigherPrioritTaskWoken;
|
||||
BaseType_t xHigherPrioritTaskWoken;
|
||||
|
||||
// We have not woken a task at the start of the ISR.
|
||||
xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
@ -1028,10 +1028,10 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueSendToBackFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueSendToBackFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
const void *pvItemToQueue,
|
||||
portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||
BaseType_t *pxHigherPriorityTaskWoken
|
||||
);
|
||||
</pre>
|
||||
*
|
||||
|
@ -1066,7 +1066,7 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
|||
void vBufferISR( void )
|
||||
{
|
||||
char cIn;
|
||||
portBASE_TYPE xHigherPriorityTaskWoken;
|
||||
BaseType_t xHigherPriorityTaskWoken;
|
||||
|
||||
// We have not woken a task at the start of the ISR.
|
||||
xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
@ -1098,10 +1098,10 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueOverwriteFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueOverwriteFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
const void * pvItemToQueue,
|
||||
portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||
BaseType_t *pxHigherPriorityTaskWoken
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1136,22 +1136,22 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
|||
* Example usage:
|
||||
<pre>
|
||||
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
void vFunction( void *pvParameters )
|
||||
{
|
||||
// Create a queue to hold one unsigned long value. It is strongly
|
||||
// Create a queue to hold one uint32_t value. It is strongly
|
||||
// recommended *not* to use xQueueOverwriteFromISR() on queues that can
|
||||
// contain more than one value, and doing so will trigger an assertion
|
||||
// if configASSERT() is defined.
|
||||
xQueue = xQueueCreate( 1, sizeof( unsigned long ) );
|
||||
xQueue = xQueueCreate( 1, sizeof( uint32_t ) );
|
||||
}
|
||||
|
||||
void vAnInterruptHandler( void )
|
||||
{
|
||||
// xHigherPriorityTaskWoken must be set to pdFALSE before it is used.
|
||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
unsigned long ulVarToSend, ulValReceived;
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
uint32_t ulVarToSend, ulValReceived;
|
||||
|
||||
// Write the value 10 to the queue using xQueueOverwriteFromISR().
|
||||
ulVarToSend = 10;
|
||||
|
@ -1185,10 +1185,10 @@ unsigned long ulVarToSend, ulValReceived;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueSendFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueSendFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
const void *pvItemToQueue,
|
||||
portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||
BaseType_t *pxHigherPriorityTaskWoken
|
||||
);
|
||||
</pre>
|
||||
*
|
||||
|
@ -1226,7 +1226,7 @@ unsigned long ulVarToSend, ulValReceived;
|
|||
void vBufferISR( void )
|
||||
{
|
||||
char cIn;
|
||||
portBASE_TYPE xHigherPriorityTaskWoken;
|
||||
BaseType_t xHigherPriorityTaskWoken;
|
||||
|
||||
// We have not woken a task at the start of the ISR.
|
||||
xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
@ -1259,11 +1259,11 @@ unsigned long ulVarToSend, ulValReceived;
|
|||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueGenericSendFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueGenericSendFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
const void *pvItemToQueue,
|
||||
portBASE_TYPE *pxHigherPriorityTaskWoken,
|
||||
portBASE_TYPE xCopyPosition
|
||||
BaseType_t *pxHigherPriorityTaskWoken,
|
||||
BaseType_t xCopyPosition
|
||||
);
|
||||
</pre>
|
||||
*
|
||||
|
@ -1304,7 +1304,7 @@ unsigned long ulVarToSend, ulValReceived;
|
|||
void vBufferISR( void )
|
||||
{
|
||||
char cIn;
|
||||
portBASE_TYPE xHigherPriorityTaskWokenByPost;
|
||||
BaseType_t xHigherPriorityTaskWokenByPost;
|
||||
|
||||
// We have not woken a task at the start of the ISR.
|
||||
xHigherPriorityTaskWokenByPost = pdFALSE;
|
||||
|
@ -1332,15 +1332,15 @@ unsigned long ulVarToSend, ulValReceived;
|
|||
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void * const pvItemToQueue, signed portBASE_TYPE * const pxHigherPriorityTaskWoken, const portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
portBASE_TYPE xQueueReceiveFromISR(
|
||||
xQueueHandle xQueue,
|
||||
BaseType_t xQueueReceiveFromISR(
|
||||
QueueHandle_t xQueue,
|
||||
void *pvBuffer,
|
||||
portBASE_TYPE *pxTaskWoken
|
||||
BaseType_t *pxTaskWoken
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1364,13 +1364,13 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
|
|||
* Example usage:
|
||||
<pre>
|
||||
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
// Function to create a queue and post some values.
|
||||
void vAFunction( void *pvParameters )
|
||||
{
|
||||
char cValueToPost;
|
||||
const portTickType xBlockTime = ( portTickType )0xff;
|
||||
const TickType_t xBlockTime = ( TickType_t )0xff;
|
||||
|
||||
// Create a queue capable of containing 10 characters.
|
||||
xQueue = xQueueCreate( 10, sizeof( char ) );
|
||||
|
@ -1398,7 +1398,7 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
|
|||
// ISR that outputs all the characters received on the queue.
|
||||
void vISR_Routine( void )
|
||||
{
|
||||
portBASE_TYPE xTaskWokenByReceive = pdFALSE;
|
||||
BaseType_t xTaskWokenByReceive = pdFALSE;
|
||||
char cRxedChar;
|
||||
|
||||
while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) )
|
||||
|
@ -1421,15 +1421,15 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
|
|||
* \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Utilities to query queues that are safe to use from an ISR. These utilities
|
||||
* should be used only from witin an ISR, or within a critical section.
|
||||
*/
|
||||
signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1446,8 +1446,8 @@ unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue
|
|||
* responsiveness to gain execution speed, whereas the fully featured API
|
||||
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||
*/
|
||||
signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
|
||||
signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );
|
||||
BaseType_t xQueueAltGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition );
|
||||
BaseType_t xQueueAltGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking );
|
||||
#define xQueueAltSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT )
|
||||
#define xQueueAltSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )
|
||||
#define xQueueAltReceive( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdFALSE )
|
||||
|
@ -1462,26 +1462,26 @@ signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle xQueue, void * const
|
|||
* should not be called directly from application code. Instead use the macro
|
||||
* wrappers defined within croutine.h.
|
||||
*/
|
||||
signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle xQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken );
|
||||
signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle xQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken );
|
||||
signed portBASE_TYPE xQueueCRSend( xQueueHandle xQueue, const void *pvItemToQueue, portTickType xTicksToWait );
|
||||
signed portBASE_TYPE xQueueCRReceive( xQueueHandle xQueue, void *pvBuffer, portTickType xTicksToWait );
|
||||
BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken );
|
||||
BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxTaskWoken );
|
||||
BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait );
|
||||
BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait );
|
||||
|
||||
/*
|
||||
* For internal use only. Use xSemaphoreCreateMutex(),
|
||||
* xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
|
||||
* these functions directly.
|
||||
*/
|
||||
xQueueHandle xQueueCreateMutex( const unsigned char ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
xQueueHandle xQueueCreateCountingSemaphore( const unsigned portBASE_TYPE uxMaxCount, const unsigned portBASE_TYPE uxInitialCount ) PRIVILEGED_FUNCTION;
|
||||
void* xQueueGetMutexHolder( xQueueHandle xSemaphore ) PRIVILEGED_FUNCTION;
|
||||
QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
|
||||
void* xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
||||
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
|
||||
*/
|
||||
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ) PRIVILEGED_FUNCTION;
|
||||
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Reset a queue back to its original empty state. pdPASS is returned if the
|
||||
|
@ -1514,7 +1514,7 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
|
|||
* preferably in ROM/Flash), not on the stack.
|
||||
*/
|
||||
#if configQUEUE_REGISTRY_SIZE > 0
|
||||
void vQueueAddToRegistry( xQueueHandle xQueue, char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
void vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1528,14 +1528,14 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
|
|||
* @param xQueue The handle of the queue being removed from the registry.
|
||||
*/
|
||||
#if configQUEUE_REGISTRY_SIZE > 0
|
||||
void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
void vQueueUnregisterQueue( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic version of the queue creation function, which is in turn called by
|
||||
* any queue, semaphore or mutex creation function or macro.
|
||||
*/
|
||||
xQueueHandle xQueueGenericCreate( const unsigned portBASE_TYPE uxQueueLength, const unsigned portBASE_TYPE uxItemSize, const unsigned char ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Queue sets provide a mechanism to allow a task to block (pend) on a read
|
||||
|
@ -1585,7 +1585,7 @@ xQueueHandle xQueueGenericCreate( const unsigned portBASE_TYPE uxQueueLength, co
|
|||
* @return If the queue set is created successfully then a handle to the created
|
||||
* queue set is returned. Otherwise NULL is returned.
|
||||
*/
|
||||
xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
||||
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Adds a queue or semaphore to a queue set that was previously created by a
|
||||
|
@ -1599,7 +1599,7 @@ xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength
|
|||
* a call to xQueueSelectFromSet() has first returned a handle to that set member.
|
||||
*
|
||||
* @param xQueueOrSemaphore The handle of the queue or semaphore being added to
|
||||
* the queue set (cast to an xQueueSetMemberHandle type).
|
||||
* the queue set (cast to an QueueSetMember_t type).
|
||||
*
|
||||
* @param xQueueSet The handle of the queue set to which the queue or semaphore
|
||||
* is being added.
|
||||
|
@ -1609,7 +1609,7 @@ xQueueSetHandle xQueueCreateSet( const unsigned portBASE_TYPE uxEventQueueLength
|
|||
* queue set because it is already a member of a different queue set then pdFAIL
|
||||
* is returned.
|
||||
*/
|
||||
portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Removes a queue or semaphore from a queue set. A queue or semaphore can only
|
||||
|
@ -1619,7 +1619,7 @@ portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSet
|
|||
* function.
|
||||
*
|
||||
* @param xQueueOrSemaphore The handle of the queue or semaphore being removed
|
||||
* from the queue set (cast to an xQueueSetMemberHandle type).
|
||||
* from the queue set (cast to an QueueSetMember_t type).
|
||||
*
|
||||
* @param xQueueSet The handle of the queue set in which the queue or semaphore
|
||||
* is included.
|
||||
|
@ -1628,7 +1628,7 @@ portBASE_TYPE xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSet
|
|||
* then pdPASS is returned. If the queue was not in the queue set, or the
|
||||
* queue (or semaphore) was not empty, then pdFAIL is returned.
|
||||
*/
|
||||
portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* xQueueSelectFromSet() selects from the members of a queue set a queue or
|
||||
|
@ -1659,24 +1659,24 @@ portBASE_TYPE xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQue
|
|||
* operation.
|
||||
*
|
||||
* @return xQueueSelectFromSet() will return the handle of a queue (cast to
|
||||
* a xQueueSetMemberHandle type) contained in the queue set that contains data,
|
||||
* or the handle of a semaphore (cast to a xQueueSetMemberHandle type) contained
|
||||
* a QueueSetMember_t type) contained in the queue set that contains data,
|
||||
* or the handle of a semaphore (cast to a QueueSetMember_t type) contained
|
||||
* in the queue set that is available, or NULL if no such queue or semaphore
|
||||
* exists before before the specified block time expires.
|
||||
*/
|
||||
xQueueSetMemberHandle xQueueSelectFromSet( xQueueSetHandle xQueueSet, const portTickType xBlockTimeTicks ) PRIVILEGED_FUNCTION;
|
||||
QueueSetMember_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const TickType_t xBlockTimeTicks ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* A version of xQueueSelectFromSet() that can be used from an ISR.
|
||||
*/
|
||||
xQueueSetMemberHandle xQueueSelectFromSetFromISR( xQueueSetHandle xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
QueueSetMember_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/* Not public API functions. */
|
||||
void vQueueWaitForMessageRestricted( xQueueHandle xQueue, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
portBASE_TYPE xQueueGenericReset( xQueueHandle xQueue, portBASE_TYPE xNewQueue ) PRIVILEGED_FUNCTION;
|
||||
void vQueueSetQueueNumber( xQueueHandle xQueue, unsigned portBASE_TYPE uxQueueNumber ) PRIVILEGED_FUNCTION;
|
||||
unsigned portBASE_TYPE uxQueueGetQueueNumber( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
unsigned char ucQueueGetQueueType( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
|
||||
void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -72,16 +72,16 @@
|
|||
|
||||
#include "queue.h"
|
||||
|
||||
typedef xQueueHandle xSemaphoreHandle;
|
||||
typedef QueueHandle_t SemaphoreHandle_t;
|
||||
|
||||
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( unsigned char ) 1U )
|
||||
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned char ) 0U )
|
||||
#define semGIVE_BLOCK_TIME ( ( portTickType ) 0U )
|
||||
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( uint8_t ) 1U )
|
||||
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U )
|
||||
#define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U )
|
||||
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>vSemaphoreCreateBinary( xSemaphoreHandle xSemaphore )</pre>
|
||||
* <pre>vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore )</pre>
|
||||
*
|
||||
* This old vSemaphoreCreateBinary() macro is now deprecated in favour of the
|
||||
* xSemaphoreCreateBinary() function. Note that binary semaphores created using
|
||||
|
@ -102,11 +102,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* semaphore does not use a priority inheritance mechanism. For an alternative
|
||||
* that does use priority inheritance see xSemaphoreCreateMutex().
|
||||
*
|
||||
* @param xSemaphore Handle to the created semaphore. Should be of type xSemaphoreHandle.
|
||||
* @param xSemaphore Handle to the created semaphore. Should be of type SemaphoreHandle_t.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore = NULL;
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
|
@ -124,18 +124,18 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||
{ \
|
||||
( xSemaphore ) = xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||
if( ( xSemaphore ) != NULL ) \
|
||||
{ \
|
||||
( void ) xSemaphoreGive( ( xSemaphore ) ); \
|
||||
} \
|
||||
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||
{ \
|
||||
( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||
if( ( xSemaphore ) != NULL ) \
|
||||
{ \
|
||||
( void ) xSemaphoreGive( ( xSemaphore ) ); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreHandle xSemaphoreCreateBinary( void )</pre>
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateBinary( void )</pre>
|
||||
*
|
||||
* The old vSemaphoreCreateBinary() macro is now deprecated in favour of this
|
||||
* xSemaphoreCreateBinary() function. Note that binary semaphores created using
|
||||
|
@ -160,7 +160,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore = NULL;
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
|
@ -178,13 +178,13 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreTake(
|
||||
* xSemaphoreHandle xSemaphore,
|
||||
* portTickType xBlockTime
|
||||
* SemaphoreHandle_t xSemaphore,
|
||||
* TickType_t xBlockTime
|
||||
* )</pre>
|
||||
*
|
||||
* <i>Macro</i> to obtain a semaphore. The semaphore must have previously been
|
||||
|
@ -205,7 +205,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore = NULL;
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
// A task that creates a semaphore.
|
||||
void vATask( void * pvParameters )
|
||||
|
@ -223,7 +223,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
{
|
||||
// See if we can obtain the semaphore. If the semaphore is not available
|
||||
// wait 10 ticks to see if it becomes free.
|
||||
if( xSemaphoreTake( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
|
||||
if( xSemaphoreTake( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )
|
||||
{
|
||||
// We were able to obtain the semaphore and can now access the
|
||||
// shared resource.
|
||||
|
@ -245,13 +245,13 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \defgroup xSemaphoreTake xSemaphoreTake
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueGenericReceive( ( xQueueHandle ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||
#define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* xSemaphoreTakeRecursive(
|
||||
* xSemaphoreHandle xMutex,
|
||||
* portTickType xBlockTime
|
||||
* SemaphoreHandle_t xMutex,
|
||||
* TickType_t xBlockTime
|
||||
* )
|
||||
*
|
||||
* <i>Macro</i> to recursively obtain, or 'take', a mutex type semaphore.
|
||||
|
@ -284,7 +284,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xMutex = NULL;
|
||||
SemaphoreHandle_t xMutex = NULL;
|
||||
|
||||
// A task that creates a mutex.
|
||||
void vATask( void * pvParameters )
|
||||
|
@ -302,7 +302,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
{
|
||||
// See if we can obtain the mutex. If the mutex is not available
|
||||
// wait 10 ticks to see if it becomes free.
|
||||
if( xSemaphoreTakeRecursive( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
|
||||
if( xSemaphoreTakeRecursive( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )
|
||||
{
|
||||
// We were able to obtain the mutex and can now access the
|
||||
// shared resource.
|
||||
|
@ -313,8 +313,8 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
// code these would not be just sequential calls as this would make
|
||||
// no sense. Instead the calls are likely to be buried inside
|
||||
// a more complex call structure.
|
||||
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||
|
||||
// The mutex has now been 'taken' three times, so will not be
|
||||
// available to another task until it has also been given back
|
||||
|
@ -353,11 +353,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* responsiveness to gain execution speed, whereas the fully featured API
|
||||
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||
*/
|
||||
#define xSemaphoreAltTake( xSemaphore, xBlockTime ) xQueueAltGenericReceive( ( xQueueHandle ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||
#define xSemaphoreAltTake( xSemaphore, xBlockTime ) xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreGive( xSemaphoreHandle xSemaphore )</pre>
|
||||
* <pre>xSemaphoreGive( SemaphoreHandle_t xSemaphore )</pre>
|
||||
*
|
||||
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||
|
@ -379,7 +379,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore = NULL;
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
|
@ -396,7 +396,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
|
||||
// Obtain the semaphore - don't block if the semaphore is not
|
||||
// immediately available.
|
||||
if( xSemaphoreTake( xSemaphore, ( portTickType ) 0 ) )
|
||||
if( xSemaphoreTake( xSemaphore, ( TickType_t ) 0 ) )
|
||||
{
|
||||
// We now have the semaphore and can access the shared resource.
|
||||
|
||||
|
@ -416,11 +416,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \defgroup xSemaphoreGive xSemaphoreGive
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( xQueueHandle ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||
#define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreGiveRecursive( xSemaphoreHandle xMutex )</pre>
|
||||
* <pre>xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex )</pre>
|
||||
*
|
||||
* <i>Macro</i> to recursively release, or 'give', a mutex type semaphore.
|
||||
* The mutex must have previously been created using a call to
|
||||
|
@ -445,7 +445,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xMutex = NULL;
|
||||
SemaphoreHandle_t xMutex = NULL;
|
||||
|
||||
// A task that creates a mutex.
|
||||
void vATask( void * pvParameters )
|
||||
|
@ -463,7 +463,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
{
|
||||
// See if we can obtain the mutex. If the mutex is not available
|
||||
// wait 10 ticks to see if it becomes free.
|
||||
if( xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 ) == pdTRUE )
|
||||
if( xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 ) == pdTRUE )
|
||||
{
|
||||
// We were able to obtain the mutex and can now access the
|
||||
// shared resource.
|
||||
|
@ -474,8 +474,8 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
// code these would not be just sequential calls as this would make
|
||||
// no sense. Instead the calls are likely to be buried inside
|
||||
// a more complex call structure.
|
||||
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||
|
||||
// The mutex has now been 'taken' three times, so will not be
|
||||
// available to another task until it has also been given back
|
||||
|
@ -514,14 +514,14 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* responsiveness to gain execution speed, whereas the fully featured API
|
||||
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||
*/
|
||||
#define xSemaphoreAltGive( xSemaphore ) xQueueAltGenericSend( ( xQueueHandle ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||
#define xSemaphoreAltGive( xSemaphore ) xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>
|
||||
xSemaphoreGiveFromISR(
|
||||
xSemaphoreHandle xSemaphore,
|
||||
signed portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||
SemaphoreHandle_t xSemaphore,
|
||||
BaseType_t *pxHigherPriorityTaskWoken
|
||||
)</pre>
|
||||
*
|
||||
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||
|
@ -547,7 +547,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
<pre>
|
||||
\#define LONG_TIME 0xffff
|
||||
\#define TICKS_TO_WAIT 10
|
||||
xSemaphoreHandle xSemaphore = NULL;
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
// Repetitive task.
|
||||
void vATask( void * pvParameters )
|
||||
|
@ -575,8 +575,8 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
// Timer ISR
|
||||
void vTimerISR( void * pvParameters )
|
||||
{
|
||||
static unsigned char ucLocalTickCount = 0;
|
||||
static signed portBASE_TYPE xHigherPriorityTaskWoken;
|
||||
static uint8_t ucLocalTickCount = 0;
|
||||
static BaseType_t xHigherPriorityTaskWoken;
|
||||
|
||||
// A timer tick has occurred.
|
||||
|
||||
|
@ -605,14 +605,14 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueueHandle ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
|
||||
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>
|
||||
xSemaphoreTakeFromISR(
|
||||
xSemaphoreHandle xSemaphore,
|
||||
signed portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||
SemaphoreHandle_t xSemaphore,
|
||||
BaseType_t *pxHigherPriorityTaskWoken
|
||||
)</pre>
|
||||
*
|
||||
* <i>Macro</i> to take a semaphore from an ISR. The semaphore must have
|
||||
|
@ -639,11 +639,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* @return pdTRUE if the semaphore was successfully taken, otherwise
|
||||
* pdFALSE
|
||||
*/
|
||||
#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( xQueueHandle ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||
#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreHandle xSemaphoreCreateMutex( void )</pre>
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateMutex( void )</pre>
|
||||
*
|
||||
* <i>Macro</i> that implements a mutex semaphore by using the existing queue
|
||||
* mechanism.
|
||||
|
@ -664,11 +664,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* service routines.
|
||||
*
|
||||
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||
* xSemaphoreHandle.
|
||||
* SemaphoreHandle_t.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore;
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
|
@ -691,7 +691,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreHandle xSemaphoreCreateRecursiveMutex( void )</pre>
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )</pre>
|
||||
*
|
||||
* <i>Macro</i> that implements a recursive mutex by using the existing queue
|
||||
* mechanism.
|
||||
|
@ -719,11 +719,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* service routines.
|
||||
*
|
||||
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||
* xSemaphoreHandle.
|
||||
* SemaphoreHandle_t.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore;
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
|
@ -745,7 +745,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreHandle xSemaphoreCreateCounting( unsigned portBASE_TYPE uxMaxCount, unsigned portBASE_TYPE uxInitialCount )</pre>
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount )</pre>
|
||||
*
|
||||
* <i>Macro</i> that creates a counting semaphore by using the existing
|
||||
* queue mechanism.
|
||||
|
@ -783,11 +783,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
xSemaphoreHandle xSemaphore;
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
xSemaphoreHandle xSemaphore = NULL;
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
// Semaphore cannot be used before a call to xSemaphoreCreateCounting().
|
||||
// The max value to which the semaphore can count should be 10, and the
|
||||
|
@ -808,7 +808,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>void vSemaphoreDelete( xSemaphoreHandle xSemaphore );</pre>
|
||||
* <pre>void vSemaphoreDelete( SemaphoreHandle_t xSemaphore );</pre>
|
||||
*
|
||||
* Delete a semaphore. This function must be used with care. For example,
|
||||
* do not delete a mutex type semaphore if the mutex is held by a task.
|
||||
|
@ -818,11 +818,11 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \defgroup vSemaphoreDelete vSemaphoreDelete
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( xQueueHandle ) ( xSemaphore ) )
|
||||
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
|
||||
|
||||
/**
|
||||
* semphr.h
|
||||
* <pre>xTaskHandle xSemaphoreGetMutexHolder( xSemaphoreHandle xMutex );</pre>
|
||||
* <pre>TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );</pre>
|
||||
*
|
||||
* If xMutex is indeed a mutex type semaphore, return the current mutex holder.
|
||||
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
|
||||
|
|
|
@ -87,13 +87,13 @@ extern "C" {
|
|||
* task. h
|
||||
*
|
||||
* Type by which tasks are referenced. For example, a call to xTaskCreate
|
||||
* returns (via a pointer parameter) an xTaskHandle variable that can then
|
||||
* returns (via a pointer parameter) an TaskHandle_t variable that can then
|
||||
* be used as a parameter to vTaskDelete to delete the task.
|
||||
*
|
||||
* \defgroup xTaskHandle xTaskHandle
|
||||
* \defgroup TaskHandle_t TaskHandle_t
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
typedef void * xTaskHandle;
|
||||
typedef void * TaskHandle_t;
|
||||
|
||||
/* Task states returned by eTaskGetState. */
|
||||
typedef enum
|
||||
|
@ -110,9 +110,9 @@ typedef enum
|
|||
*/
|
||||
typedef struct xTIME_OUT
|
||||
{
|
||||
portBASE_TYPE xOverflowCount;
|
||||
portTickType xTimeOnEntering;
|
||||
} xTimeOutType;
|
||||
BaseType_t xOverflowCount;
|
||||
TickType_t xTimeOnEntering;
|
||||
} TimeOut_t;
|
||||
|
||||
/*
|
||||
* Defines the memory ranges allocated to the task when an MPU is used.
|
||||
|
@ -120,9 +120,9 @@ typedef struct xTIME_OUT
|
|||
typedef struct xMEMORY_REGION
|
||||
{
|
||||
void *pvBaseAddress;
|
||||
unsigned long ulLengthInBytes;
|
||||
unsigned long ulParameters;
|
||||
} xMemoryRegion;
|
||||
uint32_t ulLengthInBytes;
|
||||
uint32_t ulParameters;
|
||||
} MemoryRegion_t;
|
||||
|
||||
/*
|
||||
* Parameters required to create an MPU protected task.
|
||||
|
@ -131,26 +131,26 @@ typedef struct xTASK_PARAMETERS
|
|||
{
|
||||
pdTASK_CODE pvTaskCode;
|
||||
const char * const pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
unsigned short usStackDepth;
|
||||
uint16_t usStackDepth;
|
||||
void *pvParameters;
|
||||
unsigned portBASE_TYPE uxPriority;
|
||||
portSTACK_TYPE *puxStackBuffer;
|
||||
xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];
|
||||
} xTaskParameters;
|
||||
UBaseType_t uxPriority;
|
||||
StackType_t *puxStackBuffer;
|
||||
MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];
|
||||
} TaskParameters_t;
|
||||
|
||||
/* Used with the uxTaskGetSystemState() function to return the state of each task
|
||||
in the system. */
|
||||
typedef struct xTASK_STATUS
|
||||
{
|
||||
xTaskHandle xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
|
||||
const char *pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
unsigned portBASE_TYPE xTaskNumber; /* A number unique to the task. */
|
||||
eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */
|
||||
unsigned portBASE_TYPE uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
|
||||
unsigned portBASE_TYPE uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
|
||||
unsigned long ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
|
||||
unsigned short usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
|
||||
} xTaskStatusType;
|
||||
TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
|
||||
const char *pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
UBaseType_t xTaskNumber; /* A number unique to the task. */
|
||||
eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */
|
||||
UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
|
||||
UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
|
||||
uint32_t ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
|
||||
uint16_t usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
|
||||
} TaskStatus_t;
|
||||
|
||||
/* Possible return values for eTaskConfirmSleepModeStatus(). */
|
||||
typedef enum
|
||||
|
@ -166,7 +166,7 @@ typedef enum
|
|||
*
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
#define tskIDLE_PRIORITY ( ( unsigned portBASE_TYPE ) 0U )
|
||||
#define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U )
|
||||
|
||||
/**
|
||||
* task. h
|
||||
|
@ -229,9 +229,9 @@ typedef enum
|
|||
/* Definitions returned by xTaskGetSchedulerState(). taskSCHEDULER_SUSPENDED is
|
||||
0 to generate more optimal code when configASSERT() is defined as the constant
|
||||
is used in assert() statements. */
|
||||
#define taskSCHEDULER_SUSPENDED ( ( portBASE_TYPE ) 0 )
|
||||
#define taskSCHEDULER_NOT_STARTED ( ( portBASE_TYPE ) 1 )
|
||||
#define taskSCHEDULER_RUNNING ( ( portBASE_TYPE ) 2 )
|
||||
#define taskSCHEDULER_SUSPENDED ( ( BaseType_t ) 0 )
|
||||
#define taskSCHEDULER_NOT_STARTED ( ( BaseType_t ) 1 )
|
||||
#define taskSCHEDULER_RUNNING ( ( BaseType_t ) 2 )
|
||||
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
|
@ -241,13 +241,13 @@ is used in assert() statements. */
|
|||
/**
|
||||
* task. h
|
||||
*<pre>
|
||||
portBASE_TYPE xTaskCreate(
|
||||
BaseType_t xTaskCreate(
|
||||
pdTASK_CODE pvTaskCode,
|
||||
const char * const pcName,
|
||||
unsigned short usStackDepth,
|
||||
uint16_t usStackDepth,
|
||||
void *pvParameters,
|
||||
unsigned portBASE_TYPE uxPriority,
|
||||
xTaskHandle *pvCreatedTask
|
||||
UBaseType_t uxPriority,
|
||||
TaskHandle_t *pvCreatedTask
|
||||
);</pre>
|
||||
*
|
||||
* Create a new task and add it to the list of tasks that are ready to run.
|
||||
|
@ -298,8 +298,8 @@ is used in assert() statements. */
|
|||
// Function that creates a task.
|
||||
void vOtherFunction( void )
|
||||
{
|
||||
static unsigned char ucParameterToPass;
|
||||
xTaskHandle xHandle = NULL;
|
||||
static uint8_t ucParameterToPass;
|
||||
TaskHandle_t xHandle = NULL;
|
||||
|
||||
// Create the task, storing the handle. Note that the passed parameter ucParameterToPass
|
||||
// must exist for the lifetime of the task, so in this case is declared static. If it was just an
|
||||
|
@ -323,7 +323,7 @@ is used in assert() statements. */
|
|||
/**
|
||||
* task. h
|
||||
*<pre>
|
||||
portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle *pxCreatedTask );</pre>
|
||||
BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask );</pre>
|
||||
*
|
||||
* xTaskCreateRestricted() should only be used in systems that include an MPU
|
||||
* implementation.
|
||||
|
@ -345,8 +345,8 @@ is used in assert() statements. */
|
|||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
// Create an xTaskParameters structure that defines the task to be created.
|
||||
static const xTaskParameters xCheckTaskParameters =
|
||||
// Create an TaskParameters_t structure that defines the task to be created.
|
||||
static const TaskParameters_t xCheckTaskParameters =
|
||||
{
|
||||
vATask, // pvTaskCode - the function that implements the task.
|
||||
"ATask", // pcName - just a text name for the task to assist debugging.
|
||||
|
@ -369,7 +369,7 @@ static const xTaskParameters xCheckTaskParameters =
|
|||
|
||||
int main( void )
|
||||
{
|
||||
xTaskHandle xHandle;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create a task from the const structure defined above. The task handle
|
||||
// is requested (the second parameter is not NULL) but in this case just for
|
||||
|
@ -392,7 +392,7 @@ xTaskHandle xHandle;
|
|||
/**
|
||||
* task. h
|
||||
*<pre>
|
||||
void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions );</pre>
|
||||
void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );</pre>
|
||||
*
|
||||
* Memory regions are assigned to a restricted task when the task is created by
|
||||
* a call to xTaskCreateRestricted(). These regions can be redefined using
|
||||
|
@ -400,16 +400,16 @@ xTaskHandle xHandle;
|
|||
*
|
||||
* @param xTask The handle of the task being updated.
|
||||
*
|
||||
* @param xRegions A pointer to an xMemoryRegion structure that contains the
|
||||
* @param xRegions A pointer to an MemoryRegion_t structure that contains the
|
||||
* new memory region definitions.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
// Define an array of xMemoryRegion structures that configures an MPU region
|
||||
// Define an array of MemoryRegion_t structures that configures an MPU region
|
||||
// allowing read/write access for 1024 bytes starting at the beginning of the
|
||||
// ucOneKByte array. The other two of the maximum 3 definable regions are
|
||||
// unused so set to zero.
|
||||
static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
|
||||
static const MemoryRegion_t xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
|
||||
{
|
||||
// Base address Length Parameters
|
||||
{ ucOneKByte, 1024, portMPU_REGION_READ_WRITE },
|
||||
|
@ -435,11 +435,11 @@ void vATask( void *pvParameters )
|
|||
* \defgroup xTaskCreateRestricted xTaskCreateRestricted
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions ) PRIVILEGED_FUNCTION;
|
||||
void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskDelete( xTaskHandle xTask );</pre>
|
||||
* <pre>void vTaskDelete( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* INCLUDE_vTaskDelete must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -464,7 +464,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
|
|||
<pre>
|
||||
void vOtherFunction( void )
|
||||
{
|
||||
xTaskHandle xHandle;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create the task, storing the handle.
|
||||
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
|
||||
|
@ -476,7 +476,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
|
|||
* \defgroup vTaskDelete vTaskDelete
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
|
||||
void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* TASK CONTROL API
|
||||
|
@ -484,7 +484,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
|
|||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskDelay( const portTickType xTicksToDelay );</pre>
|
||||
* <pre>void vTaskDelay( const TickType_t xTicksToDelay );</pre>
|
||||
*
|
||||
* Delay a task for a given number of ticks. The actual time that the
|
||||
* task remains blocked depends on the tick rate. The constant
|
||||
|
@ -515,7 +515,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
|
|||
void vTaskFunction( void * pvParameters )
|
||||
{
|
||||
// Block for 500ms.
|
||||
const portTickType xDelay = 500 / portTICK_RATE_MS;
|
||||
const TickType_t xDelay = 500 / portTICK_RATE_MS;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -528,11 +528,11 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup vTaskDelay vTaskDelay
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
|
||||
void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, const portTickType xTimeIncrement );</pre>
|
||||
* <pre>void vTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );</pre>
|
||||
*
|
||||
* INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -570,8 +570,8 @@ void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
|
|||
// Perform an action every 10 ticks.
|
||||
void vTaskFunction( void * pvParameters )
|
||||
{
|
||||
portTickType xLastWakeTime;
|
||||
const portTickType xFrequency = 10;
|
||||
TickType_t xLastWakeTime;
|
||||
const TickType_t xFrequency = 10;
|
||||
|
||||
// Initialise the xLastWakeTime variable with the current time.
|
||||
xLastWakeTime = xTaskGetTickCount ();
|
||||
|
@ -587,11 +587,11 @@ void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup vTaskDelayUntil vTaskDelayUntil
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) PRIVILEGED_FUNCTION;
|
||||
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask );</pre>
|
||||
* <pre>UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -607,7 +607,7 @@ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickTyp
|
|||
<pre>
|
||||
void vAFunction( void )
|
||||
{
|
||||
xTaskHandle xHandle;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create a task, storing the handle.
|
||||
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
|
||||
|
@ -634,11 +634,11 @@ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickTyp
|
|||
* \defgroup uxTaskPriorityGet uxTaskPriorityGet
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>eTaskState eTaskGetState( xTaskHandle xTask );</pre>
|
||||
* <pre>eTaskState eTaskGetState( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* INCLUDE_eTaskGetState must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -652,11 +652,11 @@ unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) PRIVILEGED_FUNCTIO
|
|||
* state of the task might change between the function being called, and the
|
||||
* functions return value being tested by the calling task.
|
||||
*/
|
||||
eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
||||
eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority );</pre>
|
||||
* <pre>void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority );</pre>
|
||||
*
|
||||
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -675,7 +675,7 @@ eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
|||
<pre>
|
||||
void vAFunction( void )
|
||||
{
|
||||
xTaskHandle xHandle;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create a task, storing the handle.
|
||||
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
|
||||
|
@ -694,11 +694,11 @@ eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup vTaskPrioritySet vTaskPrioritySet
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskSuspend( xTaskHandle xTaskToSuspend );</pre>
|
||||
* <pre>void vTaskSuspend( TaskHandle_t xTaskToSuspend );</pre>
|
||||
*
|
||||
* INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -717,7 +717,7 @@ void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
|
|||
<pre>
|
||||
void vAFunction( void )
|
||||
{
|
||||
xTaskHandle xHandle;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create a task, storing the handle.
|
||||
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
|
||||
|
@ -745,11 +745,11 @@ void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
|
|||
* \defgroup vTaskSuspend vTaskSuspend
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
|
||||
void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskResume( xTaskHandle xTaskToResume );</pre>
|
||||
* <pre>void vTaskResume( TaskHandle_t xTaskToResume );</pre>
|
||||
*
|
||||
* INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.
|
||||
* See the configuration section for more information.
|
||||
|
@ -766,7 +766,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
|
|||
<pre>
|
||||
void vAFunction( void )
|
||||
{
|
||||
xTaskHandle xHandle;
|
||||
TaskHandle_t xHandle;
|
||||
|
||||
// Create a task, storing the handle.
|
||||
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
|
||||
|
@ -794,11 +794,11 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup vTaskResume vTaskResume
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;
|
||||
void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void xTaskResumeFromISR( xTaskHandle xTaskToResume );</pre>
|
||||
* <pre>void xTaskResumeFromISR( TaskHandle_t xTaskToResume );</pre>
|
||||
*
|
||||
* INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be
|
||||
* available. See the configuration section for more information.
|
||||
|
@ -823,7 +823,7 @@ void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup vTaskResumeFromISR vTaskResumeFromISR
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* SCHEDULER CONTROL
|
||||
|
@ -967,7 +967,7 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
|
|||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>char xTaskResumeAll( void );</pre>
|
||||
* <pre>BaseType_t xTaskResumeAll( void );</pre>
|
||||
*
|
||||
* Resumes scheduler activity after it was suspended by a call to
|
||||
* vTaskSuspendAll().
|
||||
|
@ -1017,18 +1017,18 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup xTaskResumeAll xTaskResumeAll
|
||||
* \ingroup SchedulerControl
|
||||
*/
|
||||
signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask );</pre>
|
||||
* <pre>BaseType_t xTaskIsTaskSuspended( const TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* Utility task that simply returns pdTRUE if the task referenced by xTask is
|
||||
* currently in the Suspended state, or pdFALSE if the task referenced by xTask
|
||||
* is in any other state.
|
||||
*
|
||||
*/
|
||||
signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskIsTaskSuspended( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* TASK UTILITIES
|
||||
|
@ -1036,34 +1036,34 @@ signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_
|
|||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>portTickType xTaskGetTickCount( void );</PRE>
|
||||
* <PRE>TickType_t xTaskGetTickCount( void );</PRE>
|
||||
*
|
||||
* @return The count of ticks since vTaskStartScheduler was called.
|
||||
*
|
||||
* \defgroup xTaskGetTickCount xTaskGetTickCount
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
|
||||
TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>portTickType xTaskGetTickCountFromISR( void );</PRE>
|
||||
* <PRE>TickType_t xTaskGetTickCountFromISR( void );</PRE>
|
||||
*
|
||||
* @return The count of ticks since vTaskStartScheduler was called.
|
||||
*
|
||||
* This is a version of xTaskGetTickCount() that is safe to be called from an
|
||||
* ISR - provided that portTickType is the natural word size of the
|
||||
* ISR - provided that TickType_t is the natural word size of the
|
||||
* microcontroller being used or interrupt nesting is either not supported or
|
||||
* not being used.
|
||||
*
|
||||
* \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
|
||||
TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE>
|
||||
* <PRE>uint16_t uxTaskGetNumberOfTasks( void );</PRE>
|
||||
*
|
||||
* @return The number of tasks that the real time kernel is currently managing.
|
||||
* This includes all ready, blocked and suspended tasks. A task that
|
||||
|
@ -1073,11 +1073,11 @@ portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );</PRE>
|
||||
* <PRE>char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery );</PRE>
|
||||
*
|
||||
* @return The text (human readable) name of the task referenced by the handle
|
||||
* xTaskToQuery. A task can query its own name by either passing in its own
|
||||
|
@ -1087,11 +1087,11 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
|
|||
* \defgroup pcTaskGetTaskName pcTaskGetTaskName
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/**
|
||||
* task.h
|
||||
* <PRE>unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );</PRE>
|
||||
* <PRE>UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );</PRE>
|
||||
*
|
||||
* INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for
|
||||
* this function to be available.
|
||||
|
@ -1108,7 +1108,7 @@ char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint
|
|||
* actual spaces on the stack rather than bytes) since the task referenced by
|
||||
* xTask was created.
|
||||
*/
|
||||
unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/* When using trace macros it is sometimes necessary to include task.h before
|
||||
FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined,
|
||||
|
@ -1120,27 +1120,27 @@ constant. */
|
|||
#if configUSE_APPLICATION_TASK_TAG == 1
|
||||
/**
|
||||
* task.h
|
||||
* <pre>void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
|
||||
* <pre>void vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
|
||||
*
|
||||
* Sets pxHookFunction to be the task hook function used by the task xTask.
|
||||
* Passing xTask as NULL has the effect of setting the calling tasks hook
|
||||
* function.
|
||||
*/
|
||||
void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION;
|
||||
void vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task.h
|
||||
* <pre>void xTaskGetApplicationTaskTag( xTaskHandle xTask );</pre>
|
||||
* <pre>void xTaskGetApplicationTaskTag( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* Returns the pxHookFunction value assigned to the task xTask.
|
||||
*/
|
||||
pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
||||
pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
#endif /* configUSE_APPLICATION_TASK_TAG ==1 */
|
||||
#endif /* ifdef configUSE_APPLICATION_TASK_TAG */
|
||||
|
||||
/**
|
||||
* task.h
|
||||
* <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );</pre>
|
||||
* <pre>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>
|
||||
*
|
||||
* Calls the hook function associated with xTask. Passing xTask as NULL has
|
||||
* the effect of calling the Running tasks (the calling task) hook function.
|
||||
|
@ -1149,7 +1149,7 @@ constant. */
|
|||
* wants. The return value is the value returned by the task hook function
|
||||
* registered by the user.
|
||||
*/
|
||||
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* xTaskGetIdleTaskHandle() is only available if
|
||||
|
@ -1158,29 +1158,29 @@ portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter
|
|||
* Simply returns the handle of the idle task. It is not valid to call
|
||||
* xTaskGetIdleTaskHandle() before the scheduler has been started.
|
||||
*/
|
||||
xTaskHandle xTaskGetIdleTaskHandle( void );
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( void );
|
||||
|
||||
/**
|
||||
* configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for
|
||||
* uxTaskGetSystemState() to be available.
|
||||
*
|
||||
* uxTaskGetSystemState() populates an xTaskStatusType structure for each task in
|
||||
* the system. xTaskStatusType structures contain, among other things, members
|
||||
* uxTaskGetSystemState() populates an TaskStatus_t structure for each task in
|
||||
* the system. TaskStatus_t structures contain, among other things, members
|
||||
* for the task handle, task name, task priority, task state, and total amount
|
||||
* of run time consumed by the task. See the xTaskStatusType structure
|
||||
* of run time consumed by the task. See the TaskStatus_t structure
|
||||
* definition in this file for the full member list.
|
||||
*
|
||||
* NOTE: This function is intended for debugging use only as its use results in
|
||||
* the scheduler remaining suspended for an extended period.
|
||||
*
|
||||
* @param pxTaskStatusArray A pointer to an array of xTaskStatusType structures.
|
||||
* The array must contain at least one xTaskStatusType structure for each task
|
||||
* @param pxTaskStatusArray A pointer to an array of TaskStatus_t structures.
|
||||
* The array must contain at least one TaskStatus_t structure for each task
|
||||
* that is under the control of the RTOS. The number of tasks under the control
|
||||
* of the RTOS can be determined using the uxTaskGetNumberOfTasks() API function.
|
||||
*
|
||||
* @param uxArraySize The size of the array pointed to by the pxTaskStatusArray
|
||||
* parameter. The size is specified as the number of indexes in the array, or
|
||||
* the number of xTaskStatusType structures contained in the array, not by the
|
||||
* the number of TaskStatus_t structures contained in the array, not by the
|
||||
* number of bytes in the array.
|
||||
*
|
||||
* @param pulTotalRunTime If configGENERATE_RUN_TIME_STATS is set to 1 in
|
||||
|
@ -1189,7 +1189,7 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
|
|||
* http://www.freertos.org/rtos-run-time-stats.html) since the target booted.
|
||||
* pulTotalRunTime can be set to NULL to omit the total run time information.
|
||||
*
|
||||
* @return The number of xTaskStatusType structures that were populated by
|
||||
* @return The number of TaskStatus_t structures that were populated by
|
||||
* uxTaskGetSystemState(). This should equal the number returned by the
|
||||
* uxTaskGetNumberOfTasks() API function, but will be zero if the value passed
|
||||
* in the uxArraySize parameter was too small.
|
||||
|
@ -1201,9 +1201,9 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
|
|||
// The human readable table is written to pcWriteBuffer
|
||||
void vTaskGetRunTimeStats( char *pcWriteBuffer )
|
||||
{
|
||||
xTaskStatusType *pxTaskStatusArray;
|
||||
volatile unsigned portBASE_TYPE uxArraySize, x;
|
||||
unsigned long ulTotalRunTime, ulStatsAsPercentage;
|
||||
TaskStatus_t *pxTaskStatusArray;
|
||||
volatile UBaseType_t uxArraySize, x;
|
||||
uint32_t ulTotalRunTime, ulStatsAsPercentage;
|
||||
|
||||
// Make sure the write buffer does not contain a string.
|
||||
*pcWriteBuffer = 0x00;
|
||||
|
@ -1212,9 +1212,9 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
|
|||
// function is executing.
|
||||
uxArraySize = uxTaskGetNumberOfTasks();
|
||||
|
||||
// Allocate a xTaskStatusType structure for each task. An array could be
|
||||
// Allocate a TaskStatus_t structure for each task. An array could be
|
||||
// allocated statically at compile time.
|
||||
pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( xTaskStatusType ) );
|
||||
pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) );
|
||||
|
||||
if( pxTaskStatusArray != NULL )
|
||||
{
|
||||
|
@ -1257,7 +1257,7 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
|
|||
}
|
||||
</pre>
|
||||
*/
|
||||
unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType * const pxTaskStatusArray, const unsigned portBASE_TYPE uxArraySize, unsigned long * const pulTotalRunTime );
|
||||
UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime );
|
||||
|
||||
/**
|
||||
* task. h
|
||||
|
@ -1379,7 +1379,7 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9
|
|||
* + Time slicing is in use and there is a task of equal priority to the
|
||||
* currently running task.
|
||||
*/
|
||||
portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||
|
@ -1412,8 +1412,8 @@ portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
|
|||
* portTICK_RATE_MS can be used to convert kernel ticks into a real time
|
||||
* period.
|
||||
*/
|
||||
void vTaskPlaceOnEventList( xList * const pxEventList, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPlaceOnUnorderedEventList( xList * pxEventList, const portTickType xItemValue, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||
|
@ -1426,7 +1426,7 @@ void vTaskPlaceOnUnorderedEventList( xList * pxEventList, const portTickType xIt
|
|||
* indefinitely, whereas vTaskPlaceOnEventList() does.
|
||||
*
|
||||
*/
|
||||
void vTaskPlaceOnEventListRestricted( xList * const pxEventList, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||
|
@ -1452,8 +1452,8 @@ void vTaskPlaceOnEventListRestricted( xList * const pxEventList, const portTickT
|
|||
* @return pdTRUE if the task being removed has a higher priority than the task
|
||||
* making the call, otherwise pdFALSE.
|
||||
*/
|
||||
signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList ) PRIVILEGED_FUNCTION;
|
||||
signed portBASE_TYPE xTaskRemoveFromUnorderedEventList( xListItem * pxEventListItem, const portTickType xItemValue ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
|
||||
|
@ -1469,23 +1469,23 @@ void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;
|
|||
* THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE. THEY ARE USED BY
|
||||
* THE EVENT BITS MODULE.
|
||||
*/
|
||||
portTickType uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION;
|
||||
TickType_t uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Return the handle of the calling task.
|
||||
*/
|
||||
xTaskHandle xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||
TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Capture the current time status for future reference.
|
||||
*/
|
||||
void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) PRIVILEGED_FUNCTION;
|
||||
void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Compare the time status now with that previously captured to see if the
|
||||
* timeout has expired.
|
||||
*/
|
||||
portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Shortcut used by the queue implementation to prevent unnecessary call to
|
||||
|
@ -1497,36 +1497,36 @@ void vTaskMissedYield( void ) PRIVILEGED_FUNCTION;
|
|||
* Returns the scheduler state as taskSCHEDULER_RUNNING,
|
||||
* taskSCHEDULER_NOT_STARTED or taskSCHEDULER_SUSPENDED.
|
||||
*/
|
||||
portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Raises the priority of the mutex holder to that of the calling task should
|
||||
* the mutex holder have a priority less than the calling task.
|
||||
*/
|
||||
void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Set the priority of a task back to its proper priority in the case that it
|
||||
* inherited a higher priority while it was holding a semaphore.
|
||||
*/
|
||||
void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Generic version of the task creation function which is in turn called by the
|
||||
* xTaskCreate() and xTaskCreateRestricted() macros.
|
||||
*/
|
||||
signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const char * const pcName, const unsigned short usStackDepth, void * const pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle * const pxCreatedTask, portSTACK_TYPE * const puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
BaseType_t xTaskGenericCreate( pdTASK_CODE pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/*
|
||||
* Get the uxTCBNumber assigned to the task referenced by the xTask parameter.
|
||||
*/
|
||||
unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Set the uxTaskNumber of the task referenced by the xTask parameter to
|
||||
* uxHandle.
|
||||
*/
|
||||
void vTaskSetTaskNumber( xTaskHandle xTask, const unsigned portBASE_TYPE uxHandle ) PRIVILEGED_FUNCTION;
|
||||
void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Only available when configUSE_TICKLESS_IDLE is set to 1.
|
||||
|
@ -1536,7 +1536,7 @@ void vTaskSetTaskNumber( xTaskHandle xTask, const unsigned portBASE_TYPE uxHandl
|
|||
* to date with the actual execution time by being skipped forward by a time
|
||||
* equal to the idle period.
|
||||
*/
|
||||
void vTaskStepTick( const portTickType xTicksToJump ) PRIVILEGED_FUNCTION;
|
||||
void vTaskStepTick( const TickType_t xTicksToJump ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Only avilable when configUSE_TICKLESS_IDLE is set to 1.
|
||||
|
|
|
@ -87,27 +87,27 @@ extern "C" {
|
|||
/* IDs for commands that can be sent/received on the timer queue. These are to
|
||||
be used solely through the macros that make up the public software timer API,
|
||||
as defined below. */
|
||||
#define tmrCOMMAND_EXECUTE_CALLBACK ( ( portBASE_TYPE ) -1 )
|
||||
#define tmrCOMMAND_START ( ( portBASE_TYPE ) 0 )
|
||||
#define tmrCOMMAND_STOP ( ( portBASE_TYPE ) 1 )
|
||||
#define tmrCOMMAND_CHANGE_PERIOD ( ( portBASE_TYPE ) 2 )
|
||||
#define tmrCOMMAND_DELETE ( ( portBASE_TYPE ) 3 )
|
||||
#define tmrCOMMAND_EXECUTE_CALLBACK ( ( BaseType_t ) -1 )
|
||||
#define tmrCOMMAND_START ( ( BaseType_t ) 0 )
|
||||
#define tmrCOMMAND_STOP ( ( BaseType_t ) 1 )
|
||||
#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 2 )
|
||||
#define tmrCOMMAND_DELETE ( ( BaseType_t ) 3 )
|
||||
|
||||
/**
|
||||
* Type by which software timers are referenced. For example, a call to
|
||||
* xTimerCreate() returns an xTimerHandle variable that can then be used to
|
||||
* xTimerCreate() returns an TimerHandle_t variable that can then be used to
|
||||
* reference the subject timer in calls to other software timer API functions
|
||||
* (for example, xTimerStart(), xTimerReset(), etc.).
|
||||
*/
|
||||
typedef void * xTimerHandle;
|
||||
typedef void * TimerHandle_t;
|
||||
|
||||
/* Define the prototype to which timer callback functions must conform. */
|
||||
typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
||||
typedef void (*tmrTIMER_CALLBACK)( TimerHandle_t xTimer );
|
||||
|
||||
/**
|
||||
* xTimerHandle xTimerCreate( const char * const pcTimerName,
|
||||
* portTickType xTimerPeriodInTicks,
|
||||
* unsigned portBASE_TYPE uxAutoReload,
|
||||
* TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||
* TickType_t xTimerPeriodInTicks,
|
||||
* UBaseType_t uxAutoReload,
|
||||
* void * pvTimerID,
|
||||
* tmrTIMER_CALLBACK pxCallbackFunction );
|
||||
*
|
||||
|
@ -117,23 +117,24 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
|||
*
|
||||
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),
|
||||
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and
|
||||
* xTimerChangePeriodFromISR() API functions can all be used to transition a timer into the
|
||||
* active state.
|
||||
* xTimerChangePeriodFromISR() API functions can all be used to transition a
|
||||
* timer into the active state.
|
||||
*
|
||||
* @param pcTimerName A text name that is assigned to the timer. This is done
|
||||
* purely to assist debugging. The kernel itself only ever references a timer by
|
||||
* its handle, and never by its name.
|
||||
* purely to assist debugging. The kernel itself only ever references a timer
|
||||
* by its handle, and never by its name.
|
||||
*
|
||||
* @param xTimerPeriodInTicks The timer period. The time is defined in tick periods so
|
||||
* the constant portTICK_RATE_MS can be used to convert a time that has been
|
||||
* specified in milliseconds. For example, if the timer must expire after 100
|
||||
* ticks, then xTimerPeriodInTicks should be set to 100. Alternatively, if the timer
|
||||
* must expire after 500ms, then xPeriod can be set to ( 500 / portTICK_RATE_MS )
|
||||
* provided configTICK_RATE_HZ is less than or equal to 1000.
|
||||
* @param xTimerPeriodInTicks The timer period. The time is defined in tick
|
||||
* periods so the constant portTICK_RATE_MS can be used to convert a time that
|
||||
* has been specified in milliseconds. For example, if the timer must expire
|
||||
* after 100 ticks, then xTimerPeriodInTicks should be set to 100.
|
||||
* Alternatively, if the timer must expire after 500ms, then xPeriod can be set
|
||||
* to ( 500 / portTICK_RATE_MS ) provided configTICK_RATE_HZ is less than or
|
||||
* equal to 1000.
|
||||
*
|
||||
* @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will
|
||||
* expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter. If
|
||||
* uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and
|
||||
* expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.
|
||||
* If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and
|
||||
* enter the dormant state after it expires.
|
||||
*
|
||||
* @param pvTimerID An identifier that is assigned to the timer being created.
|
||||
|
@ -143,7 +144,7 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
|||
*
|
||||
* @param pxCallbackFunction The function to call when the timer expires.
|
||||
* Callback functions must have the prototype defined by tmrTIMER_CALLBACK,
|
||||
* which is "void vCallbackFunction( xTimerHandle xTimer );".
|
||||
* which is "void vCallbackFunction( TimerHandle_t xTimer );".
|
||||
*
|
||||
* @return If the timer is successfully created then a handle to the newly
|
||||
* created timer is returned. If the timer cannot be created (because either
|
||||
|
@ -155,25 +156,25 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
|||
* #define NUM_TIMERS 5
|
||||
*
|
||||
* // An array to hold handles to the created timers.
|
||||
* xTimerHandle xTimers[ NUM_TIMERS ];
|
||||
* TimerHandle_t xTimers[ NUM_TIMERS ];
|
||||
*
|
||||
* // An array to hold a count of the number of times each timer expires.
|
||||
* long lExpireCounters[ NUM_TIMERS ] = { 0 };
|
||||
* int32_t lExpireCounters[ NUM_TIMERS ] = { 0 };
|
||||
*
|
||||
* // Define a callback function that will be used by multiple timer instances.
|
||||
* // The callback function does nothing but count the number of times the
|
||||
* // associated timer expires, and stop the timer once the timer has expired
|
||||
* // 10 times.
|
||||
* void vTimerCallback( xTimerHandle pxTimer )
|
||||
* void vTimerCallback( TimerHandle_t pxTimer )
|
||||
* {
|
||||
* long lArrayIndex;
|
||||
* const long xMaxExpiryCountBeforeStopping = 10;
|
||||
* int32_t lArrayIndex;
|
||||
* const int32_t xMaxExpiryCountBeforeStopping = 10;
|
||||
*
|
||||
* // Optionally do something if the pxTimer parameter is NULL.
|
||||
* configASSERT( pxTimer );
|
||||
*
|
||||
* // Which timer expired?
|
||||
* lArrayIndex = ( long ) pvTimerGetTimerID( pxTimer );
|
||||
* lArrayIndex = ( int32_t ) pvTimerGetTimerID( pxTimer );
|
||||
*
|
||||
* // Increment the number of times that pxTimer has expired.
|
||||
* lExpireCounters[ lArrayIndex ] += 1;
|
||||
|
@ -189,18 +190,18 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
|||
*
|
||||
* void main( void )
|
||||
* {
|
||||
* long x;
|
||||
* int32_t x;
|
||||
*
|
||||
* // Create then start some timers. Starting the timers before the scheduler
|
||||
* // has been started means the timers will start running immediately that
|
||||
* // the scheduler starts.
|
||||
* for( x = 0; x < NUM_TIMERS; x++ )
|
||||
* {
|
||||
* xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel.
|
||||
* ( 100 * x ), // The timer period in ticks.
|
||||
* pdTRUE, // The timers will auto-reload themselves when they expire.
|
||||
* ( void * ) x, // Assign each timer a unique id equal to its array index.
|
||||
* vTimerCallback // Each timer calls the same callback when it expires.
|
||||
* xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel.
|
||||
* ( 100 * x ), // The timer period in ticks.
|
||||
* pdTRUE, // The timers will auto-reload themselves when they expire.
|
||||
* ( void * ) x, // Assign each timer a unique id equal to its array index.
|
||||
* vTimerCallback // Each timer calls the same callback when it expires.
|
||||
* );
|
||||
*
|
||||
* if( xTimers[ x ] == NULL )
|
||||
|
@ -232,10 +233,10 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
|||
* }
|
||||
* @endverbatim
|
||||
*/
|
||||
xTimerHandle xTimerCreate( const char * const pcTimerName, const portTickType xTimerPeriodInTicks, const unsigned portBASE_TYPE uxAutoReload, void * const pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/**
|
||||
* void *pvTimerGetTimerID( xTimerHandle xTimer );
|
||||
* void *pvTimerGetTimerID( TimerHandle_t xTimer );
|
||||
*
|
||||
* Returns the ID assigned to the timer.
|
||||
*
|
||||
|
@ -254,10 +255,10 @@ xTimerHandle xTimerCreate( const char * const pcTimerName, const portTickType xT
|
|||
*
|
||||
* See the xTimerCreate() API function example usage scenario.
|
||||
*/
|
||||
void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
||||
void *pvTimerGetTimerID( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer );
|
||||
* BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );
|
||||
*
|
||||
* Queries a timer to see if it is active or dormant.
|
||||
*
|
||||
|
@ -278,7 +279,7 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
|||
* Example usage:
|
||||
* @verbatim
|
||||
* // This function assumes xTimer has already been created.
|
||||
* void vAFunction( xTimerHandle xTimer )
|
||||
* void vAFunction( TimerHandle_t xTimer )
|
||||
* {
|
||||
* if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )"
|
||||
* {
|
||||
|
@ -291,10 +292,10 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
|||
* }
|
||||
* @endverbatim
|
||||
*/
|
||||
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
||||
* TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||
*
|
||||
* xTimerGetTimerDaemonTaskHandle() is only available if
|
||||
* INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h.
|
||||
|
@ -302,10 +303,10 @@ portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
|||
* Simply returns the handle of the timer service/daemon task. It it not valid
|
||||
* to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started.
|
||||
*/
|
||||
xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
||||
TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerStart( xTimerHandle xTimer, portTickType xBlockTime );
|
||||
* BaseType_t xTimerStart( TimerHandle_t xTimer, TickType_t xBlockTime );
|
||||
*
|
||||
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||
* public FreeRTOS timer API functions send commands to the timer service task
|
||||
|
@ -357,7 +358,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerStart( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerStop( xTimerHandle xTimer, portTickType xBlockTime );
|
||||
* BaseType_t xTimerStop( TimerHandle_t xTimer, TickType_t xBlockTime );
|
||||
*
|
||||
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||
* public FreeRTOS timer API functions send commands to the timer service task
|
||||
|
@ -399,9 +400,9 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerStop( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0U, NULL, ( xBlockTime ) )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerChangePeriod( xTimerHandle xTimer,
|
||||
* portTickType xNewPeriod,
|
||||
* portTickType xBlockTime );
|
||||
* BaseType_t xTimerChangePeriod( TimerHandle_t xTimer,
|
||||
* TickType_t xNewPeriod,
|
||||
* TickType_t xBlockTime );
|
||||
*
|
||||
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||
* public FreeRTOS timer API functions send commands to the timer service task
|
||||
|
@ -450,7 +451,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // is deleted. If the timer referenced by xTimer is not active when it is
|
||||
* // called, then the period of the timer is set to 500ms and the timer is
|
||||
* // started.
|
||||
* void vAFunction( xTimerHandle xTimer )
|
||||
* void vAFunction( TimerHandle_t xTimer )
|
||||
* {
|
||||
* if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )"
|
||||
* {
|
||||
|
@ -479,7 +480,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerChangePeriod( xTimer, xNewPeriod, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xBlockTime ) )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerDelete( xTimerHandle xTimer, portTickType xBlockTime );
|
||||
* BaseType_t xTimerDelete( TimerHandle_t xTimer, TickType_t xBlockTime );
|
||||
*
|
||||
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||
* public FreeRTOS timer API functions send commands to the timer service task
|
||||
|
@ -517,7 +518,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerDelete( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xBlockTime ) )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerReset( xTimerHandle xTimer, portTickType xBlockTime );
|
||||
* BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xBlockTime );
|
||||
*
|
||||
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||
* public FreeRTOS timer API functions send commands to the timer service task
|
||||
|
@ -569,11 +570,11 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // without a key being pressed, then the LCD back-light is switched off. In
|
||||
* // this case, the timer is a one-shot timer.
|
||||
*
|
||||
* xTimerHandle xBacklightTimer = NULL;
|
||||
* TimerHandle_t xBacklightTimer = NULL;
|
||||
*
|
||||
* // The callback function assigned to the one-shot timer. In this case the
|
||||
* // parameter is not used.
|
||||
* void vBacklightTimerCallback( xTimerHandle pxTimer )
|
||||
* void vBacklightTimerCallback( TimerHandle_t pxTimer )
|
||||
* {
|
||||
* // The timer expired, therefore 5 seconds must have passed since a key
|
||||
* // was pressed. Switch off the LCD back-light.
|
||||
|
@ -599,7 +600,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
*
|
||||
* void main( void )
|
||||
* {
|
||||
* long x;
|
||||
* int32_t x;
|
||||
*
|
||||
* // Create then start the one-shot timer that is responsible for turning
|
||||
* // the back-light off if no keys are pressed within a 5 second period.
|
||||
|
@ -641,8 +642,8 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerStartFromISR( xTimerHandle xTimer,
|
||||
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
* BaseType_t xTimerStartFromISR( TimerHandle_t xTimer,
|
||||
* BaseType_t *pxHigherPriorityTaskWoken );
|
||||
*
|
||||
* A version of xTimerStart() that can be called from an interrupt service
|
||||
* routine.
|
||||
|
@ -666,8 +667,9 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* successfully sent to the timer command queue. When the command is actually
|
||||
* processed will depend on the priority of the timer service/daemon task
|
||||
* relative to other tasks in the system, although the timers expiry time is
|
||||
* relative to when xTimerStartFromISR() is actually called. The timer service/daemon
|
||||
* task priority is set by the configTIMER_TASK_PRIORITY configuration constant.
|
||||
* relative to when xTimerStartFromISR() is actually called. The timer
|
||||
* service/daemon task priority is set by the configTIMER_TASK_PRIORITY
|
||||
* configuration constant.
|
||||
*
|
||||
* Example usage:
|
||||
* @verbatim
|
||||
|
@ -680,7 +682,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
*
|
||||
* // The callback function assigned to the one-shot timer. In this case the
|
||||
* // parameter is not used.
|
||||
* void vBacklightTimerCallback( xTimerHandle pxTimer )
|
||||
* void vBacklightTimerCallback( TimerHandle_t pxTimer )
|
||||
* {
|
||||
* // The timer expired, therefore 5 seconds must have passed since a key
|
||||
* // was pressed. Switch off the LCD back-light.
|
||||
|
@ -690,7 +692,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // The key press interrupt service routine.
|
||||
* void vKeyPressEventInterruptHandler( void )
|
||||
* {
|
||||
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
* BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
*
|
||||
* // Ensure the LCD back-light is on, then restart the timer that is
|
||||
* // responsible for turning the back-light off after 5 seconds of
|
||||
|
@ -726,8 +728,8 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerStopFromISR( xTimerHandle xTimer,
|
||||
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
* BaseType_t xTimerStopFromISR( TimerHandle_t xTimer,
|
||||
* BaseType_t *pxHigherPriorityTaskWoken );
|
||||
*
|
||||
* A version of xTimerStop() that can be called from an interrupt service
|
||||
* routine.
|
||||
|
@ -761,7 +763,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // The interrupt service routine that stops the timer.
|
||||
* void vAnExampleInterruptServiceRoutine( void )
|
||||
* {
|
||||
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
* BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
*
|
||||
* // The interrupt has occurred - simply stop the timer.
|
||||
* // xHigherPriorityTaskWoken was set to pdFALSE where it was defined
|
||||
|
@ -789,9 +791,9 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0, ( pxHigherPriorityTaskWoken ), 0U )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerChangePeriodFromISR( xTimerHandle xTimer,
|
||||
* portTickType xNewPeriod,
|
||||
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
* BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer,
|
||||
* TickType_t xNewPeriod,
|
||||
* BaseType_t *pxHigherPriorityTaskWoken );
|
||||
*
|
||||
* A version of xTimerChangePeriod() that can be called from an interrupt
|
||||
* service routine.
|
||||
|
@ -834,7 +836,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // The interrupt service routine that changes the period of xTimer.
|
||||
* void vAnExampleInterruptServiceRoutine( void )
|
||||
* {
|
||||
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
* BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
*
|
||||
* // The interrupt has occurred - change the period of xTimer to 500ms.
|
||||
* // xHigherPriorityTaskWoken was set to pdFALSE where it was defined
|
||||
|
@ -862,8 +864,8 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
#define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerResetFromISR( xTimerHandle xTimer,
|
||||
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
* BaseType_t xTimerResetFromISR( TimerHandle_t xTimer,
|
||||
* BaseType_t *pxHigherPriorityTaskWoken );
|
||||
*
|
||||
* A version of xTimerReset() that can be called from an interrupt service
|
||||
* routine.
|
||||
|
@ -902,7 +904,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
*
|
||||
* // The callback function assigned to the one-shot timer. In this case the
|
||||
* // parameter is not used.
|
||||
* void vBacklightTimerCallback( xTimerHandle pxTimer )
|
||||
* void vBacklightTimerCallback( TimerHandle_t pxTimer )
|
||||
* {
|
||||
* // The timer expired, therefore 5 seconds must have passed since a key
|
||||
* // was pressed. Switch off the LCD back-light.
|
||||
|
@ -912,7 +914,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // The key press interrupt service routine.
|
||||
* void vKeyPressEventInterruptHandler( void )
|
||||
* {
|
||||
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
* BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
*
|
||||
* // Ensure the LCD back-light is on, then reset the timer that is
|
||||
* // responsible for turning the back-light off after 5 seconds of
|
||||
|
@ -949,10 +951,10 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
|
||||
|
||||
/**
|
||||
* portBASE_TYPE xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction,
|
||||
* BaseType_t xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction,
|
||||
* void *pvParameter1,
|
||||
* unsigned long ulParameter2,
|
||||
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
* uint32_t ulParameter2,
|
||||
* BaseType_t *pxHigherPriorityTaskWoken );
|
||||
*
|
||||
*
|
||||
* Can be used by interrupt service routines to request that a function (the
|
||||
|
@ -1001,13 +1003,13 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
*
|
||||
* // The callback function that will execute in the context of the daemon task.
|
||||
* // Note callback functions must all use this same prototype.
|
||||
* void vProcessInterface( void *pvParameter1, unsigned long ulParameter2 )
|
||||
* void vProcessInterface( void *pvParameter1, uint32_t ulParameter2 )
|
||||
* {
|
||||
* portBASE_TYPE xInterfaceToService;
|
||||
* BaseType_t xInterfaceToService;
|
||||
*
|
||||
* // The interface that requires servicing is passed in the second
|
||||
* // parameter. The first parameter is not used in this case.
|
||||
* xInterfaceToService = ( portBASE_TYPE ) ulParameter2;
|
||||
* xInterfaceToService = ( BaseType_t ) ulParameter2;
|
||||
*
|
||||
* // ...Perform the processing here...
|
||||
* }
|
||||
|
@ -1015,7 +1017,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // An ISR that receives data packets from multiple interfaces
|
||||
* void vAnISR( void )
|
||||
* {
|
||||
* portBASE_TYPE xInterfaceToService, xHigherPriorityTaskWoken;
|
||||
* BaseType_t xInterfaceToService, xHigherPriorityTaskWoken;
|
||||
*
|
||||
* // Query the hardware to determine which interface needs processing.
|
||||
* xInterfaceToService = prvCheckInterfaces();
|
||||
|
@ -1026,7 +1028,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* // service is passed in the second parameter. The first parameter is
|
||||
* // not used in this case.
|
||||
* xHigherPriorityTaskWoken = pdFALSE;
|
||||
* xTimerPendCallbackFromISR( vProcessInterface, NULL, ( unsigned long ) xInterfaceToService, &xHigherPriorityTaskWoken );
|
||||
* xTimerPendCallbackFromISR( vProcessInterface, NULL, ( uint32_t ) xInterfaceToService, &xHigherPriorityTaskWoken );
|
||||
*
|
||||
* // If xHigherPriorityTaskWoken is now set to pdTRUE then a context
|
||||
* // switch should be requested. The macro used is port specific and will
|
||||
|
@ -1037,14 +1039,14 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
|||
* }
|
||||
* @endverbatim
|
||||
*/
|
||||
portBASE_TYPE xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, void *pvParameter1, unsigned long ulParameter2, portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||
BaseType_t xTimerPendCallbackFromISR( pdAPPLICATION_CALLBACK_CODE pvCallbackFunction, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken );
|
||||
|
||||
/*
|
||||
* Functions beyond this part are not part of the public API and are intended
|
||||
* for use by the kernel only.
|
||||
*/
|
||||
portBASE_TYPE xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;
|
||||
portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, const portBASE_TYPE xCommandID, const portTickType xOptionalValue, signed portBASE_TYPE * const pxHigherPriorityTaskWoken, const portTickType xBlockTime ) 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, const TickType_t xBlockTime ) PRIVILEGED_FUNCTION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -72,12 +72,12 @@
|
|||
* PUBLIC LIST API documented in list.h
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
void vListInitialise( xList * 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
|
||||
as the only list entry. */
|
||||
pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 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
|
||||
ensure it remains at the end of the list. */
|
||||
|
@ -85,23 +85,23 @@ void vListInitialise( xList * const pxList )
|
|||
|
||||
/* The list end next and previous pointers point to itself so we know
|
||||
when the list is empty. */
|
||||
pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );/*lint !e826 !e740 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 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 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
|
||||
pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;
|
||||
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vListInitialiseItem( xListItem * const pxItem )
|
||||
void vListInitialiseItem( ListItem_t * const pxItem )
|
||||
{
|
||||
/* Make sure the list item is not recorded as being on a list. */
|
||||
pxItem->pvContainer = NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem )
|
||||
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||
{
|
||||
xListItem * const pxIndex = pxList->pxIndex;
|
||||
ListItem_t * const pxIndex = pxList->pxIndex;
|
||||
|
||||
/* 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
|
||||
|
@ -118,10 +118,10 @@ xListItem * const pxIndex = pxList->pxIndex;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vListInsert( xList * const pxList, xListItem * const pxNewListItem )
|
||||
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||
{
|
||||
xListItem *pxIterator;
|
||||
const portTickType xValueOfInsertion = pxNewListItem->xItemValue;
|
||||
ListItem_t *pxIterator;
|
||||
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||
|
||||
/* Insert the new list item into the list, sorted in xItemValue order.
|
||||
|
||||
|
@ -152,10 +152,11 @@ const portTickType xValueOfInsertion = pxNewListItem->xItemValue;
|
|||
4) Using a queue or semaphore before it has been initialised or
|
||||
before the scheduler has been started (are interrupts firing
|
||||
before vTaskStartScheduler() has been called?).
|
||||
See http://www.freertos.org/FAQHelp.html for more tips.
|
||||
See http://www.freertos.org/FAQHelp.html for more tips, and ensure
|
||||
configASSERT() is defined! http://www.freertos.org/a00110.html#configASSERT
|
||||
**********************************************************************/
|
||||
|
||||
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
{
|
||||
/* There is nothing to do here, we are just iterating to the
|
||||
wanted insertion position. */
|
||||
|
@ -175,11 +176,11 @@ const portTickType xValueOfInsertion = pxNewListItem->xItemValue;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned portBASE_TYPE uxListRemove( xListItem * 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. */
|
||||
xList * const pxList = ( xList * ) pxItemToRemove->pvContainer;
|
||||
List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer;
|
||||
|
||||
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
||||
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
||||
|
|
|
@ -92,15 +92,15 @@ Changes from V2.6.1
|
|||
/*lint -e950 Non ANSI reserved words okay in this file only. */
|
||||
|
||||
#define portTIMER_EOI_TYPE ( 8 )
|
||||
#define portRESET_PIC() portOUTPUT_WORD( ( unsigned short ) 0xff22, portTIMER_EOI_TYPE )
|
||||
#define portRESET_PIC() portOUTPUT_WORD( ( uint16_t ) 0xff22, portTIMER_EOI_TYPE )
|
||||
#define portTIMER_INT_NUMBER 0x12
|
||||
|
||||
#define portTIMER_1_CONTROL_REGISTER ( ( unsigned short ) 0xff5e )
|
||||
#define portTIMER_0_CONTROL_REGISTER ( ( unsigned short ) 0xff56 )
|
||||
#define portTIMER_INTERRUPT_ENABLE ( ( unsigned short ) 0x2000 )
|
||||
#define portTIMER_1_CONTROL_REGISTER ( ( uint16_t ) 0xff5e )
|
||||
#define portTIMER_0_CONTROL_REGISTER ( ( uint16_t ) 0xff56 )
|
||||
#define portTIMER_INTERRUPT_ENABLE ( ( uint16_t ) 0x2000 )
|
||||
|
||||
/* Setup the hardware to generate the required tick frequency. */
|
||||
static void prvSetTickFrequency( unsigned long ulTickRateHz );
|
||||
static void prvSetTickFrequency( uint32_t ulTickRateHz );
|
||||
|
||||
/* Set the hardware back to the state as per before the scheduler started. */
|
||||
static void prvExitFunction( void );
|
||||
|
@ -123,7 +123,7 @@ static void __interrupt __far prvYieldProcessor( void );
|
|||
/*lint -e956 File scopes necessary here. */
|
||||
|
||||
/* Set true when the vectors are set so the scheduler will service the tick. */
|
||||
static portBASE_TYPE xSchedulerRunning = pdFALSE;
|
||||
static BaseType_t xSchedulerRunning = pdFALSE;
|
||||
|
||||
/* Points to the original routine installed on the vector we use for manual
|
||||
context switches. This is then used to restore the original routine during
|
||||
|
@ -136,7 +136,7 @@ static jmp_buf xJumpBuf;
|
|||
/*lint +e956 */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* This is called with interrupts already disabled. */
|
||||
|
||||
|
@ -224,8 +224,8 @@ void vPortEndScheduler( void )
|
|||
|
||||
static void prvExitFunction( void )
|
||||
{
|
||||
const unsigned short usTimerDisable = 0x0000;
|
||||
unsigned short usTimer0Control;
|
||||
const uint16_t usTimerDisable = 0x0000;
|
||||
uint16_t usTimer0Control;
|
||||
|
||||
/* Interrupts should be disabled here anyway - but no
|
||||
harm in making sure. */
|
||||
|
@ -252,23 +252,23 @@ unsigned short usTimer0Control;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetTickFrequency( unsigned long ulTickRateHz )
|
||||
static void prvSetTickFrequency( uint32_t ulTickRateHz )
|
||||
{
|
||||
const unsigned short usMaxCountRegister = 0xff5a;
|
||||
const unsigned short usTimerPriorityRegister = 0xff32;
|
||||
const unsigned short usTimerEnable = 0xC000;
|
||||
const unsigned short usRetrigger = 0x0001;
|
||||
const unsigned short usTimerHighPriority = 0x0000;
|
||||
unsigned short usTimer0Control;
|
||||
const uint16_t usMaxCountRegister = 0xff5a;
|
||||
const uint16_t usTimerPriorityRegister = 0xff32;
|
||||
const uint16_t usTimerEnable = 0xC000;
|
||||
const uint16_t usRetrigger = 0x0001;
|
||||
const uint16_t usTimerHighPriority = 0x0000;
|
||||
uint16_t usTimer0Control;
|
||||
|
||||
/* ( CPU frequency / 4 ) / clock 2 max count [inpw( 0xff62 ) = 7] */
|
||||
|
||||
const unsigned long ulClockFrequency = ( unsigned long ) 0x7f31a0UL;
|
||||
const uint32_t ulClockFrequency = ( uint32_t ) 0x7f31a0UL;
|
||||
|
||||
unsigned long ulTimerCount = ulClockFrequency / ulTickRateHz;
|
||||
uint32_t ulTimerCount = ulClockFrequency / ulTickRateHz;
|
||||
|
||||
portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerEnable | portTIMER_INTERRUPT_ENABLE | usRetrigger );
|
||||
portOUTPUT_WORD( usMaxCountRegister, ( unsigned short ) ulTimerCount );
|
||||
portOUTPUT_WORD( usMaxCountRegister, ( uint16_t ) ulTimerCount );
|
||||
portOUTPUT_WORD( usTimerPriorityRegister, usTimerHighPriority );
|
||||
|
||||
/* Stop the DOS tick - don't do this if you want to maintain a TOD clock. */
|
||||
|
|
|
@ -82,15 +82,19 @@
|
|||
#define portDOUBLE long
|
||||
#define portLONG long
|
||||
#define portSHORT int
|
||||
#define portSTACK_TYPE unsigned portSHORT
|
||||
#define portSTACK_TYPE uint16_t
|
||||
#define portBASE_TYPE portSHORT
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef short BaseType_t;
|
||||
typedef unsigned short UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -110,7 +114,7 @@
|
|||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portSWITCH_INT_NUMBER 0x80
|
||||
#define portYIELD() __asm{ int portSWITCH_INT_NUMBER }
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -93,7 +93,7 @@ Changes from V4.0.1
|
|||
#define portTIMER_INT_NUMBER 0x08
|
||||
|
||||
/* Setup hardware for required tick interrupt rate. */
|
||||
static void prvSetTickFrequency( unsigned long ulTickRateHz );
|
||||
static void prvSetTickFrequency( uint32_t ulTickRateHz );
|
||||
|
||||
/* Restore hardware to as it was prior to starting the scheduler. */
|
||||
static void prvExitFunction( void );
|
||||
|
@ -125,10 +125,10 @@ static void prvSetTickFrequencyDefault( void );
|
|||
/*lint -e956 File scopes necessary here. */
|
||||
|
||||
/* Used to signal when to chain to the DOS tick, and when to just clear the PIC ourselves. */
|
||||
static short sDOSTickCounter;
|
||||
static int16_t sDOSTickCounter;
|
||||
|
||||
/* Set true when the vectors are set so the scheduler will service the tick. */
|
||||
static portBASE_TYPE xSchedulerRunning = pdFALSE;
|
||||
static BaseType_t xSchedulerRunning = pdFALSE;
|
||||
|
||||
/* Points to the original routine installed on the vector we use for manual context switches. This is then used to restore the original routine during prvExitFunction(). */
|
||||
static void ( __interrupt __far *pxOldSwitchISR )();
|
||||
|
@ -142,7 +142,7 @@ static jmp_buf xJumpBuf;
|
|||
/*lint +e956 */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
pxISR pxOriginalTickISR;
|
||||
|
||||
|
@ -243,7 +243,7 @@ static void prvPortResetPIC( void )
|
|||
--sDOSTickCounter;
|
||||
if( sDOSTickCounter <= 0 )
|
||||
{
|
||||
sDOSTickCounter = ( short ) portTICKS_PER_DOS_TICK;
|
||||
sDOSTickCounter = ( int16_t ) portTICKS_PER_DOS_TICK;
|
||||
__asm{ int portSWITCH_INT_NUMBER + 1 };
|
||||
}
|
||||
else
|
||||
|
@ -293,28 +293,28 @@ void ( __interrupt __far *pxOriginalTickISR )();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetTickFrequency( unsigned long ulTickRateHz )
|
||||
static void prvSetTickFrequency( uint32_t ulTickRateHz )
|
||||
{
|
||||
const unsigned short usPIT_MODE = ( unsigned short ) 0x43;
|
||||
const unsigned short usPIT0 = ( unsigned short ) 0x40;
|
||||
const unsigned long ulPIT_CONST = ( unsigned long ) 1193180UL;
|
||||
const unsigned short us8254_CTR0_MODE3 = ( unsigned short ) 0x36;
|
||||
unsigned long ulOutput;
|
||||
const uint16_t usPIT_MODE = ( uint16_t ) 0x43;
|
||||
const uint16_t usPIT0 = ( uint16_t ) 0x40;
|
||||
const uint32_t ulPIT_CONST = ( uint32_t ) 1193180UL;
|
||||
const uint16_t us8254_CTR0_MODE3 = ( uint16_t ) 0x36;
|
||||
uint32_t ulOutput;
|
||||
|
||||
/* Setup the 8245 to tick at the wanted frequency. */
|
||||
portOUTPUT_BYTE( usPIT_MODE, us8254_CTR0_MODE3 );
|
||||
ulOutput = ulPIT_CONST / ulTickRateHz;
|
||||
portOUTPUT_BYTE( usPIT0, ( unsigned short )( ulOutput & ( unsigned long ) 0xff ) );
|
||||
portOUTPUT_BYTE( usPIT0, ( uint16_t )( ulOutput & ( uint32_t ) 0xff ) );
|
||||
ulOutput >>= 8;
|
||||
portOUTPUT_BYTE( usPIT0, ( unsigned short ) ( ulOutput & ( unsigned long ) 0xff ) );
|
||||
portOUTPUT_BYTE( usPIT0, ( uint16_t ) ( ulOutput & ( uint32_t ) 0xff ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetTickFrequencyDefault( void )
|
||||
{
|
||||
const unsigned short usPIT_MODE = ( unsigned short ) 0x43;
|
||||
const unsigned short usPIT0 = ( unsigned short ) 0x40;
|
||||
const unsigned short us8254_CTR0_MODE3 = ( unsigned short ) 0x36;
|
||||
const uint16_t usPIT_MODE = ( uint16_t ) 0x43;
|
||||
const uint16_t usPIT0 = ( uint16_t ) 0x40;
|
||||
const uint16_t us8254_CTR0_MODE3 = ( uint16_t ) 0x36;
|
||||
|
||||
portOUTPUT_BYTE( usPIT_MODE, us8254_CTR0_MODE3 );
|
||||
portOUTPUT_BYTE( usPIT0,0 );
|
||||
|
|
|
@ -82,15 +82,19 @@
|
|||
#define portDOUBLE long
|
||||
#define portLONG long
|
||||
#define portSHORT int
|
||||
#define portSTACK_TYPE unsigned portSHORT
|
||||
#define portSTACK_TYPE uint16_t
|
||||
#define portBASE_TYPE portSHORT
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef short BaseType_t;
|
||||
typedef unsigned short UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -111,8 +115,8 @@
|
|||
#define portSWITCH_INT_NUMBER 0x80
|
||||
#define portYIELD() __asm{ int portSWITCH_INT_NUMBER }
|
||||
#define portDOS_TICK_RATE ( 18.20648 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICKS_PER_DOS_TICK ( ( unsigned portSHORT ) ( ( ( portDOUBLE ) configTICK_RATE_HZ / portDOS_TICK_RATE ) + 0.5 ) )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICKS_PER_DOS_TICK ( ( uint16_t ) ( ( ( portDOUBLE ) configTICK_RATE_HZ / portDOS_TICK_RATE ) + 0.5 ) )
|
||||
#define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */
|
||||
#define portBYTE_ALIGNMENT ( 2 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef PORT_ASM_H
|
||||
#define PORT_ASM_H
|
||||
|
||||
typedef void tskTCB;
|
||||
extern volatile tskTCB * volatile pxCurrentTCB;
|
||||
typedef void TCB_t;
|
||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||
extern void vTaskSwitchContext( void );
|
||||
|
||||
/*
|
||||
|
|
|
@ -83,9 +83,9 @@ Changes from V2.6.1
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* See header file for description. */
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE DS_Reg = 0;
|
||||
StackType_t DS_Reg = 0;
|
||||
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
This is just useful for debugging. */
|
||||
|
@ -128,15 +128,15 @@ portSTACK_TYPE DS_Reg = 0;
|
|||
/* The remaining registers would be pushed on the stack by our context
|
||||
switch function. These are loaded with values simply to make debugging
|
||||
easier. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xAAAA; /* AX */
|
||||
*pxTopOfStack = ( StackType_t ) 0xAAAA; /* AX */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BX */
|
||||
*pxTopOfStack = ( StackType_t ) 0xBBBB; /* BX */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xCCCC; /* CX */
|
||||
*pxTopOfStack = ( StackType_t ) 0xCCCC; /* CX */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DX */
|
||||
*pxTopOfStack = ( StackType_t ) 0xDDDD; /* DX */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xEEEE; /* ES */
|
||||
*pxTopOfStack = ( StackType_t ) 0xEEEE; /* ES */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* We need the true data segment. */
|
||||
|
@ -144,11 +144,11 @@ portSTACK_TYPE DS_Reg = 0;
|
|||
|
||||
*pxTopOfStack = DS_Reg; /* DS */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0123; /* SI */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0123; /* SI */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DI */
|
||||
*pxTopOfStack = ( StackType_t ) 0xDDDD; /* DI */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BP */
|
||||
*pxTopOfStack = ( StackType_t ) 0xBBBB; /* BP */
|
||||
|
||||
/*lint +e950 +e611 +e923 */
|
||||
|
||||
|
|
|
@ -70,29 +70,29 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Count of the critical section nesting depth. */
|
||||
unsigned portLONG ulCriticalNesting = 9999;
|
||||
uint32_t ulCriticalNesting = 9999;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Registers required to configure the RTI. */
|
||||
#define portRTI_GCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC00 ) )
|
||||
#define portRTI_TBCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC04 ) )
|
||||
#define portRTI_COMPCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC0C ) )
|
||||
#define portRTI_CNT0_FRC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC10 ) )
|
||||
#define portRTI_CNT0_UC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC14 ) )
|
||||
#define portRTI_CNT0_CPUC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC18 ) )
|
||||
#define portRTI_CNT0_COMP0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC50 ) )
|
||||
#define portRTI_CNT0_UDCP0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC54 ) )
|
||||
#define portRTI_SETINTENA_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC80 ) )
|
||||
#define portRTI_CLEARINTENA_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC84 ) )
|
||||
#define portRTI_INTFLAG_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC88 ) )
|
||||
#define portRTI_GCTRL_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC00 ) )
|
||||
#define portRTI_TBCTRL_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC04 ) )
|
||||
#define portRTI_COMPCTRL_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC0C ) )
|
||||
#define portRTI_CNT0_FRC0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC10 ) )
|
||||
#define portRTI_CNT0_UC0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC14 ) )
|
||||
#define portRTI_CNT0_CPUC0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC18 ) )
|
||||
#define portRTI_CNT0_COMP0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC50 ) )
|
||||
#define portRTI_CNT0_UDCP0_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC54 ) )
|
||||
#define portRTI_SETINTENA_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC80 ) )
|
||||
#define portRTI_CLEARINTENA_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC84 ) )
|
||||
#define portRTI_INTFLAG_REG ( * ( ( volatile uint32_t * ) 0xFFFFFC88 ) )
|
||||
|
||||
|
||||
/* Constants required to set up the initial stack of each task. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1F )
|
||||
#define portINITIAL_FPSCR ( ( portSTACK_TYPE ) 0x00 )
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 0x04 )
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1F )
|
||||
#define portINITIAL_FPSCR ( ( StackType_t ) 0x00 )
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 0x04 )
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
|
||||
/* The number of words on the stack frame between the saved Top Of Stack and
|
||||
R0 (in which the parameters are passed. */
|
||||
|
@ -107,7 +107,7 @@ extern void vPortStartFirstTask( void );
|
|||
|
||||
/* Saved as part of the task context. Set to pdFALSE if the task does not
|
||||
require an FPU context. */
|
||||
unsigned long ulTaskHasFPUContext = 0;
|
||||
uint32_t ulTaskHasFPUContext = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -115,9 +115,9 @@ unsigned long ulTaskHasFPUContext = 0;
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxOriginalTOS;
|
||||
StackType_t *pxOriginalTOS;
|
||||
|
||||
pxOriginalTOS = pxTopOfStack;
|
||||
|
||||
|
@ -134,39 +134,39 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
/* First on the stack is the return address - which is the start of the as
|
||||
the task has not executed yet. The offset is added to make the return
|
||||
address appear as it would within an IRQ ISR. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
pxTopOfStack--;
|
||||
|
||||
#ifdef portPRELOAD_TASK_REGISTERS
|
||||
{
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#else
|
||||
|
@ -176,13 +176,13 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
#endif
|
||||
|
||||
/* Function parameters are passed in R0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Set the status register for system mode, with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ( _get_CPSR() & ~0xFF ) | portINITIAL_SPSR );
|
||||
*pxTopOfStack = ( StackType_t ) ( ( _get_CPSR() & ~0xFF ) | portINITIAL_SPSR );
|
||||
|
||||
if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 )
|
||||
if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00 )
|
||||
{
|
||||
/* The task will start in thumb mode. */
|
||||
*pxTopOfStack |= portTHUMB_MODE_BIT;
|
||||
|
@ -236,7 +236,7 @@ static void prvSetupTimerInterrupt(void)
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler(void)
|
||||
BaseType_t xPortStartScheduler(void)
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
|
|
@ -82,21 +82,25 @@
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if (configUSE_16_BIT_TICKS == 1)
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY (portTickType) 0xFFFF
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY (TickType_t) 0xFFFF
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY (portTickType) 0xFFFFFFFFF
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY (TickType_t) 0xFFFFFFFFF
|
||||
#endif
|
||||
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH (-1)
|
||||
#define portTICK_RATE_MS ((portTickType) 1000 / configTICK_RATE_HZ)
|
||||
#define portTICK_RATE_MS ((TickType_t) 1000 / configTICK_RATE_HZ)
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
|
||||
/* Critical section handling. */
|
||||
|
@ -111,7 +115,7 @@ extern void vPortExitCritical(void);
|
|||
#pragma SWI_ALIAS( vPortYield, 0 )
|
||||
extern void vPortYield( void );
|
||||
#define portYIELD() vPortYield()
|
||||
#define portSYS_SSIR1_REG ( * ( ( volatile unsigned long * ) 0xFFFFFFB0 ) )
|
||||
#define portSYS_SSIR1_REG ( * ( ( volatile uint32_t * ) 0xFFFFFFB0 ) )
|
||||
#define portSYS_SSIR1_SSKEY ( 0x7500UL )
|
||||
#define portYIELD_WITHIN_API() { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; asm( " DSB " ); asm( " ISB " ); }
|
||||
#define portYIELD_FROM_ISR( x ) if( x != pdFALSE ){ portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; ( void ) portSYS_SSIR1_REG; }
|
||||
|
|
|
@ -73,14 +73,14 @@
|
|||
|
||||
/* Constants required for hardware setup. The tick ISR runs off the ACLK,
|
||||
not the MCLK. */
|
||||
#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 )
|
||||
#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 )
|
||||
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 )
|
||||
#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 )
|
||||
#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 )
|
||||
#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 )
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
typedef void tskTCB;
|
||||
extern volatile tskTCB * volatile pxCurrentTCB;
|
||||
typedef void TCB_t;
|
||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||
|
||||
/* Each task maintains a count of the critical section nesting depth. Each
|
||||
time a critical section is entered the count is incremented. Each time a
|
||||
|
@ -90,7 +90,7 @@ being re-enabled if the count is zero.
|
|||
usCriticalNesting will get set to zero when the scheduler starts, but must
|
||||
not be initialised to zero as this will cause problems during the startup
|
||||
sequence. */
|
||||
volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -107,83 +107,83 @@ void vPortSetupTimerInterrupt( void );
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
unsigned short *pusTopOfStack;
|
||||
unsigned long *pulTopOfStack, ulTemp;
|
||||
uint16_t *pusTopOfStack;
|
||||
uint32_t *pulTopOfStack, ulTemp;
|
||||
|
||||
/*
|
||||
Place a few bytes of known values on the bottom of the stack.
|
||||
This is just useful for debugging and can be included if required.
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1111;
|
||||
*pxTopOfStack = ( StackType_t ) 0x1111;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x2222;
|
||||
*pxTopOfStack = ( StackType_t ) 0x2222;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x3333;
|
||||
*pxTopOfStack = ( StackType_t ) 0x3333;
|
||||
pxTopOfStack--;
|
||||
*/
|
||||
|
||||
/* Data types are need either 16 bits or 32 bits depending on the data
|
||||
and code model used. */
|
||||
if( sizeof( pxCode ) == sizeof( unsigned short ) )
|
||||
if( sizeof( pxCode ) == sizeof( uint16_t ) )
|
||||
{
|
||||
pusTopOfStack = ( unsigned short * ) pxTopOfStack;
|
||||
ulTemp = ( unsigned long ) pxCode;
|
||||
*pusTopOfStack = ( unsigned short ) ulTemp;
|
||||
pusTopOfStack = ( uint16_t * ) pxTopOfStack;
|
||||
ulTemp = ( uint32_t ) pxCode;
|
||||
*pusTopOfStack = ( uint16_t ) ulTemp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make room for a 20 bit value stored as a 32 bit value. */
|
||||
pusTopOfStack = ( unsigned short * ) pxTopOfStack;
|
||||
pusTopOfStack = ( uint16_t * ) pxTopOfStack;
|
||||
pusTopOfStack--;
|
||||
pulTopOfStack = ( unsigned long * ) pusTopOfStack;
|
||||
*pulTopOfStack = ( unsigned long ) pxCode;
|
||||
pulTopOfStack = ( uint32_t * ) pusTopOfStack;
|
||||
*pulTopOfStack = ( uint32_t ) pxCode;
|
||||
}
|
||||
|
||||
pusTopOfStack--;
|
||||
*pusTopOfStack = portFLAGS_INT_ENABLED;
|
||||
pusTopOfStack -= ( sizeof( portSTACK_TYPE ) / 2 );
|
||||
pusTopOfStack -= ( sizeof( StackType_t ) / 2 );
|
||||
|
||||
/* From here on the size of stacked items depends on the memory model. */
|
||||
pxTopOfStack = ( portSTACK_TYPE * ) pusTopOfStack;
|
||||
pxTopOfStack = ( StackType_t * ) pusTopOfStack;
|
||||
|
||||
/* Next the general purpose registers. */
|
||||
#ifdef PRELOAD_REGISTER_VALUES
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xffff;
|
||||
*pxTopOfStack = ( StackType_t ) 0xffff;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xeeee;
|
||||
*pxTopOfStack = ( StackType_t ) 0xeeee;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xdddd;
|
||||
*pxTopOfStack = ( StackType_t ) 0xdddd;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb;
|
||||
*pxTopOfStack = ( StackType_t ) 0xbbbb;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa;
|
||||
*pxTopOfStack = ( StackType_t ) 0xaaaa;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x9999;
|
||||
*pxTopOfStack = ( StackType_t ) 0x9999;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x8888;
|
||||
*pxTopOfStack = ( StackType_t ) 0x8888;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x5555;
|
||||
*pxTopOfStack = ( StackType_t ) 0x5555;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x6666;
|
||||
*pxTopOfStack = ( StackType_t ) 0x6666;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x5555;
|
||||
*pxTopOfStack = ( StackType_t ) 0x5555;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x4444;
|
||||
*pxTopOfStack = ( StackType_t ) 0x4444;
|
||||
pxTopOfStack--;
|
||||
#else
|
||||
pxTopOfStack -= 3;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack -= 9;
|
||||
#endif
|
||||
|
||||
/* A variable is used to keep track of the critical section nesting.
|
||||
This variable has to be stored as part of the task context and is
|
||||
initially set to zero. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;
|
||||
*pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
|
||||
/* Return a pointer to the top of the stack we have generated so this can
|
||||
be stored in the task control block for the task. */
|
||||
|
|
|
@ -89,17 +89,21 @@
|
|||
|
||||
/* The stack type changes depending on the data model. */
|
||||
#ifdef __LARGE_DATA_MODEL__
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#else
|
||||
#define portSTACK_TYPE unsigned short
|
||||
#define portSTACK_TYPE uint16_t
|
||||
#endif
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef short BaseType_t;
|
||||
typedef unsigned short UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -110,11 +114,11 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Critical section control macros. */
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
|
||||
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned short usCriticalNesting; \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
|
@ -126,7 +130,7 @@ extern volatile unsigned short usCriticalNesting; \
|
|||
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned short usCriticalNesting; \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
|
@ -155,7 +159,7 @@ extern void vPortYield( void );
|
|||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() __no_operation()
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -68,49 +68,49 @@
|
|||
#include "task.h"
|
||||
|
||||
|
||||
#define portINITIAL_FORMAT_VECTOR ( ( portSTACK_TYPE ) 0x4000 )
|
||||
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
|
||||
|
||||
/* Supervisor mode set. */
|
||||
#define portINITIAL_STATUS_REGISTER ( ( portSTACK_TYPE ) 0x2000)
|
||||
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000)
|
||||
|
||||
/* The clock prescale into the timer peripheral. */
|
||||
#define portPRESCALE_VALUE ( ( unsigned char ) 10 )
|
||||
#define portPRESCALE_VALUE ( ( uint8_t ) 10 )
|
||||
|
||||
/* The clock frequency into the RTC. */
|
||||
#define portRTC_CLOCK_HZ ( ( unsigned long ) 1000 )
|
||||
#define portRTC_CLOCK_HZ ( ( uint32_t ) 1000 )
|
||||
|
||||
asm void interrupt VectorNumber_VL1swi vPortYieldISR( void );
|
||||
static void prvSetupTimerInterrupt( void );
|
||||
|
||||
/* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This
|
||||
will be set to 0 prior to the first task being started. */
|
||||
static unsigned long ulCriticalNesting = 0x9999UL;
|
||||
static uint32_t ulCriticalNesting = 0x9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
|
||||
unsigned long ulOriginalA5;
|
||||
uint32_t ulOriginalA5;
|
||||
|
||||
__asm{ MOVE.L A5, ulOriginalA5 };
|
||||
|
||||
|
||||
*pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF;
|
||||
*pxTopOfStack = (StackType_t) 0xDEADBEEF;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Exception stack frame starts with the return address. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0; /*FP*/
|
||||
*pxTopOfStack = ( StackType_t ) 0x0; /*FP*/
|
||||
pxTopOfStack -= 14; /* A5 to D0. */
|
||||
|
||||
/* Parameter in A0. */
|
||||
*( pxTopOfStack + 8 ) = ( portSTACK_TYPE ) pvParameters;
|
||||
*( pxTopOfStack + 8 ) = ( StackType_t ) pvParameters;
|
||||
|
||||
/* A5 must be maintained as it is resurved by the compiler. */
|
||||
*( pxTopOfStack + 13 ) = ulOriginalA5;
|
||||
|
@ -119,7 +119,7 @@ unsigned long ulOriginalA5;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void vPortStartFirstTask( void );
|
||||
|
||||
|
@ -189,7 +189,7 @@ void vPortExitCritical( void )
|
|||
|
||||
void vPortYieldHandler( void )
|
||||
{
|
||||
unsigned long ulSavedInterruptMask;
|
||||
uint32_t ulSavedInterruptMask;
|
||||
|
||||
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ unsigned long ulSavedInterruptMask;
|
|||
|
||||
void interrupt VectorNumber_Vrtc vPortTickISR( void )
|
||||
{
|
||||
unsigned long ulSavedInterruptMask;
|
||||
uint32_t ulSavedInterruptMask;
|
||||
|
||||
/* Clear the interrupt. */
|
||||
RTCSC |= RTCSC_RTIF_MASK;
|
||||
|
|
|
@ -86,25 +86,30 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portSTACK_GROWTH -1
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned portLONG ulPortSetIPL( unsigned portLONG );
|
||||
uint32_t ulPortSetIPL( uint32_t );
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define portENABLE_INTERRUPTS() ulPortSetIPL( 0 )
|
||||
|
||||
|
@ -114,8 +119,8 @@ extern void vPortExitCritical( void );
|
|||
#define portENTER_CRITICAL() vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() vPortExitCritical()
|
||||
|
||||
extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void );
|
||||
extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE );
|
||||
extern UBaseType_t uxPortSetInterruptMaskFromISR( void );
|
||||
extern void vPortClearInterruptMaskFromISR( UBaseType_t );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister )
|
||||
|
||||
|
|
|
@ -68,14 +68,14 @@
|
|||
#include "task.h"
|
||||
|
||||
|
||||
#define portINITIAL_FORMAT_VECTOR ( ( portSTACK_TYPE ) 0x4000 )
|
||||
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
|
||||
|
||||
/* Supervisor mode set. */
|
||||
#define portINITIAL_STATUS_REGISTER ( ( portSTACK_TYPE ) 0x2000)
|
||||
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000)
|
||||
|
||||
/* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This
|
||||
will be set to 0 prior to the first task being started. */
|
||||
static unsigned long ulCriticalNesting = 0x9999UL;
|
||||
static uint32_t ulCriticalNesting = 0x9999UL;
|
||||
|
||||
|
||||
#define portSAVE_CONTEXT() \
|
||||
|
@ -95,29 +95,29 @@ static unsigned long ulCriticalNesting = 0x9999UL;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF;
|
||||
*pxTopOfStack = (StackType_t) 0xDEADBEEF;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Exception stack frame starts with the return address. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0; /*FP*/
|
||||
*pxTopOfStack = ( StackType_t ) 0x0; /*FP*/
|
||||
pxTopOfStack -= 14; /* A5 to D0. */
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void vPortStartFirstTask( void );
|
||||
|
||||
|
@ -173,7 +173,7 @@ void vPortExitCritical( void )
|
|||
|
||||
void vPortYieldHandler( void )
|
||||
{
|
||||
unsigned long ulSavedInterruptMask;
|
||||
uint32_t ulSavedInterruptMask;
|
||||
|
||||
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
/* Note this will clear all forced interrupts - this is done for speed. */
|
||||
|
|
|
@ -86,24 +86,28 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portSTACK_GROWTH -1
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
unsigned portLONG ulPortSetIPL( unsigned portLONG );
|
||||
uint32_t ulPortSetIPL( uint32_t );
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define portENABLE_INTERRUPTS() ulPortSetIPL( 0 )
|
||||
|
||||
|
@ -113,8 +117,8 @@ extern void vPortExitCritical( void );
|
|||
#define portENTER_CRITICAL() vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() vPortExitCritical()
|
||||
|
||||
extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void );
|
||||
extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE );
|
||||
extern UBaseType_t uxPortSetInterruptMaskFromISR( void );
|
||||
extern void vPortClearInterruptMaskFromISR( UBaseType_t );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister )
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ scheduler startup function. */
|
|||
start the scheduler directly because the header file containing the
|
||||
xPortStartScheduler() prototype is part of the common kernel code, and
|
||||
therefore cannot use the CODE_SEG pragma. */
|
||||
static portBASE_TYPE xBankedStartScheduler( void );
|
||||
static BaseType_t xBankedStartScheduler( void );
|
||||
|
||||
#pragma CODE_SEG DEFAULT
|
||||
|
||||
|
@ -103,24 +103,24 @@ until the nesting depth reaches 0. This variable simply tracks the nesting
|
|||
depth. Each task maintains it's own critical nesting depth variable so
|
||||
uxCriticalNesting is saved and restored from the task stack during a context
|
||||
switch. */
|
||||
volatile unsigned portBASE_TYPE uxCriticalNesting = 0xff;
|
||||
volatile UBaseType_t uxCriticalNesting = 0xff;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/*
|
||||
Place a few bytes of known values on the bottom of the stack.
|
||||
This can be uncommented to provide useful stack markers when debugging.
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11;
|
||||
*pxTopOfStack = ( StackType_t ) 0x11;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x22;
|
||||
*pxTopOfStack = ( StackType_t ) 0x22;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x33;
|
||||
*pxTopOfStack = ( StackType_t ) 0x33;
|
||||
pxTopOfStack--;
|
||||
*/
|
||||
|
||||
|
@ -132,47 +132,47 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
|
||||
|
||||
/* The address of the task function is placed in the stack byte at a time. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 1 );
|
||||
*pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 1 );
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 0 );
|
||||
*pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 0 );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Next are all the registers that form part of the task context. */
|
||||
|
||||
/* Y register */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xff;
|
||||
*pxTopOfStack = ( StackType_t ) 0xff;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xee;
|
||||
*pxTopOfStack = ( StackType_t ) 0xee;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* X register */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xdd;
|
||||
*pxTopOfStack = ( StackType_t ) 0xdd;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xcc;
|
||||
*pxTopOfStack = ( StackType_t ) 0xcc;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* A register contains parameter high byte. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 0 );
|
||||
*pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 0 );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* B register contains parameter low byte. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 1 );
|
||||
*pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 1 );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* CCR: Note that when the task starts interrupts will be enabled since
|
||||
"I" bit of CCR is cleared */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00;
|
||||
pxTopOfStack--;
|
||||
|
||||
#ifdef BANKED_MODEL
|
||||
/* The page of the task. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ( int ) pxCode );
|
||||
*pxTopOfStack = ( StackType_t ) ( ( int ) pxCode );
|
||||
pxTopOfStack--;
|
||||
#endif
|
||||
|
||||
/* Finally the critical nesting depth is initialised with 0 (not within
|
||||
a critical section). */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00;
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* xPortStartScheduler() does not start the scheduler directly because
|
||||
the header file containing the xPortStartScheduler() prototype is part
|
||||
|
@ -205,7 +205,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
|
||||
#pragma CODE_SEG __NEAR_SEG NON_BANKED
|
||||
|
||||
static portBASE_TYPE xBankedStartScheduler( void )
|
||||
static BaseType_t xBankedStartScheduler( void )
|
||||
{
|
||||
/* Configure the timer that will generate the RTOS tick. Interrupts are
|
||||
disabled when this function is called. */
|
||||
|
|
|
@ -83,22 +83,26 @@
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portCHAR
|
||||
#define portSTACK_TYPE uint8_t
|
||||
#define portBASE_TYPE char
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef signed char BaseType_t;
|
||||
typedef unsigned char UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 1
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portYIELD() __asm( "swi" );
|
||||
#define portNOP() __asm( "nop" );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -115,7 +119,7 @@
|
|||
*/
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
uxCriticalNesting++; \
|
||||
|
@ -128,7 +132,7 @@
|
|||
*/
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
uxCriticalNesting--; \
|
||||
if( uxCriticalNesting == 0 ) \
|
||||
|
@ -159,7 +163,7 @@
|
|||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * pxCurrentTCB; \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
__asm( "ldx pxCurrentTCB" ); \
|
||||
__asm( "lds 0, x" ); \
|
||||
|
@ -177,7 +181,7 @@
|
|||
#define portSAVE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * pxCurrentTCB; \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
__asm( "ldaa 0x30" ); /* 0x30 = PPAGE */ \
|
||||
__asm( "psha" ); \
|
||||
|
@ -196,7 +200,7 @@
|
|||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * pxCurrentTCB; \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
__asm( "ldx pxCurrentTCB" ); \
|
||||
__asm( "lds 0, x" ); \
|
||||
|
@ -207,7 +211,7 @@
|
|||
#define portSAVE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * pxCurrentTCB; \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
__asm( "ldaa uxCriticalNesting" ); \
|
||||
__asm( "psha" ); \
|
||||
|
|
|
@ -87,10 +87,10 @@
|
|||
#include "tc.h"
|
||||
|
||||
/* Constants required to setup the task context. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 )
|
||||
#define portTICK_PRIORITY_6 ( 6 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -111,9 +111,9 @@ extern void vPortISRStartFirstTask( void );
|
|||
*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxOriginalTOS;
|
||||
StackType_t *pxOriginalTOS;
|
||||
|
||||
pxOriginalTOS = pxTopOfStack;
|
||||
|
||||
|
@ -127,46 +127,46 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
/* First on the stack is the return address - which in this case is the
|
||||
start of the task. The offset is added to make the return address appear
|
||||
as it would within an IRQ ISR. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* When the task starts is will expect to find the function parameter in
|
||||
R0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The last thing onto the stack is the status register, which is set for
|
||||
system mode, with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||
*pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
|
||||
|
||||
#ifdef THUMB_INTERWORK
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||
here already. */
|
||||
|
@ -213,7 +213,7 @@ void vPortEndScheduler( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
volatile unsigned long ulDummy;
|
||||
volatile uint32_t ulDummy;
|
||||
|
||||
/* Enable clock to the tick timer... */
|
||||
AT91C_BASE_PS->PS_PCER = portTIMER_CLK_ENABLE_BIT;
|
||||
|
@ -233,12 +233,12 @@ volatile unsigned long ulDummy;
|
|||
#if configUSE_PREEMPTION == 1
|
||||
{
|
||||
extern void ( vPreemptiveTick )( void );
|
||||
AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( unsigned long ) vPreemptiveTick;
|
||||
AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( uint32_t ) vPreemptiveTick;
|
||||
}
|
||||
#else // else use cooperative scheduler
|
||||
{
|
||||
extern void ( vNonPreemptiveTick )( void );
|
||||
AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( unsigned long ) vNonPreemptiveTick;
|
||||
AT91C_BASE_AIC->AIC_SVR[portTIMER_AIC_CHANNEL] = ( uint32_t ) vNonPreemptiveTick;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -83,11 +83,11 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to handle interrupts. */
|
||||
#define portCLEAR_AIC_INTERRUPT ( ( unsigned long ) 0 )
|
||||
#define portCLEAR_AIC_INTERRUPT ( ( uint32_t ) 0 )
|
||||
|
||||
/* Constants required to handle critical sections. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
volatile unsigned long ulCriticalNesting = 9999UL;
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -147,7 +147,7 @@ void vPortYieldProcessor( void )
|
|||
void vNonPreemptiveTick( void ) __attribute__ ((interrupt ("IRQ")));
|
||||
void vNonPreemptiveTick( void )
|
||||
{
|
||||
static volatile unsigned long ulDummy;
|
||||
static volatile uint32_t ulDummy;
|
||||
|
||||
/* Clear tick timer interrupt indication. */
|
||||
ulDummy = portTIMER_REG_BASE_PTR->TC_SR;
|
||||
|
@ -170,7 +170,7 @@ void vPortYieldProcessor( void )
|
|||
|
||||
/* WARNING - Do not use local (stack) variables here. Use globals
|
||||
if you must! */
|
||||
static volatile unsigned long ulDummy;
|
||||
static volatile uint32_t ulDummy;
|
||||
|
||||
/* Clear tick timer interrupt indication. */
|
||||
ulDummy = portTIMER_REG_BASE_PTR->TC_SR;
|
||||
|
|
|
@ -109,21 +109,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portYIELD() asm volatile ( "SWI 0" )
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
|
@ -135,7 +139,7 @@ extern "C" {
|
|||
*/
|
||||
#define portTIMER_REG_BASE_PTR AT91C_BASE_TC0
|
||||
#define portTIMER_CLK_ENABLE_BIT AT91C_PS_TC0
|
||||
#define portTIMER_AIC_CHANNEL ( ( unsigned portLONG ) 4 )
|
||||
#define portTIMER_AIC_CHANNEL ( ( uint32_t ) 4 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task utilities. */
|
||||
|
@ -150,7 +154,7 @@ extern "C" {
|
|||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Set the LR to the task stack. */ \
|
||||
asm volatile ( \
|
||||
|
@ -187,7 +191,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \
|
|||
#define portSAVE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Push R0 as we are going to use the register. */ \
|
||||
asm volatile ( \
|
||||
|
|
|
@ -2262,7 +2262,7 @@ __inline unsigned int AT91F_US_ReceiveFrame (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_US_SetIrdaFilter (
|
||||
AT91PS_USART pUSART,
|
||||
unsigned char value
|
||||
uint8_t value
|
||||
)
|
||||
{
|
||||
pUSART->US_IF = value;
|
||||
|
@ -2704,7 +2704,7 @@ __inline void AT91F_UDP_DisableIt (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_SetAddress (
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char address) // \arg new UDP address
|
||||
uint8_t address) // \arg new UDP address
|
||||
{
|
||||
pUDP->UDP_FADDR = (AT91C_UDP_FEN | address);
|
||||
}
|
||||
|
@ -2715,7 +2715,7 @@ __inline void AT91F_UDP_SetAddress (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_EnableEp (
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint) // \arg endpoint number
|
||||
uint8_t endpoint) // \arg endpoint number
|
||||
{
|
||||
pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS;
|
||||
}
|
||||
|
@ -2726,7 +2726,7 @@ __inline void AT91F_UDP_EnableEp (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_DisableEp (
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint) // \arg endpoint number
|
||||
uint8_t endpoint) // \arg endpoint number
|
||||
{
|
||||
pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS;
|
||||
}
|
||||
|
@ -2771,7 +2771,7 @@ __inline void AT91F_UDP_ResetEp ( // \return the UDP device state
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_EpStall(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint) // \arg endpoint number
|
||||
uint8_t endpoint) // \arg endpoint number
|
||||
{
|
||||
pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL;
|
||||
}
|
||||
|
@ -2782,8 +2782,8 @@ __inline void AT91F_UDP_EpStall(
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_EpWrite(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint, // \arg endpoint number
|
||||
unsigned char value) // \arg value to be written in the DPR
|
||||
uint8_t endpoint, // \arg endpoint number
|
||||
uint8_t value) // \arg value to be written in the DPR
|
||||
{
|
||||
pUDP->UDP_FDR[endpoint] = value;
|
||||
}
|
||||
|
@ -2794,7 +2794,7 @@ __inline void AT91F_UDP_EpWrite(
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline unsigned int AT91F_UDP_EpRead(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint) // \arg endpoint number
|
||||
uint8_t endpoint) // \arg endpoint number
|
||||
{
|
||||
return pUDP->UDP_FDR[endpoint];
|
||||
}
|
||||
|
@ -2805,7 +2805,7 @@ __inline unsigned int AT91F_UDP_EpRead(
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_EpEndOfWr(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint) // \arg endpoint number
|
||||
uint8_t endpoint) // \arg endpoint number
|
||||
{
|
||||
pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY;
|
||||
}
|
||||
|
@ -2816,7 +2816,7 @@ __inline void AT91F_UDP_EpEndOfWr(
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_EpClear(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint, // \arg endpoint number
|
||||
uint8_t endpoint, // \arg endpoint number
|
||||
unsigned int flag) // \arg flag to be cleared
|
||||
{
|
||||
pUDP->UDP_CSR[endpoint] &= ~(flag);
|
||||
|
@ -2828,7 +2828,7 @@ __inline void AT91F_UDP_EpClear(
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_UDP_EpSet(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint, // \arg endpoint number
|
||||
uint8_t endpoint, // \arg endpoint number
|
||||
unsigned int flag) // \arg flag to be cleared
|
||||
{
|
||||
pUDP->UDP_CSR[endpoint] |= flag;
|
||||
|
@ -2840,7 +2840,7 @@ __inline void AT91F_UDP_EpSet(
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline unsigned int AT91F_UDP_EpStatus(
|
||||
AT91PS_UDP pUDP, // \arg pointer to a UDP controller
|
||||
unsigned char endpoint) // \arg endpoint number
|
||||
uint8_t endpoint) // \arg endpoint number
|
||||
{
|
||||
return pUDP->UDP_CSR[endpoint];
|
||||
}
|
||||
|
@ -3158,7 +3158,7 @@ __inline unsigned int AT91F_CAN_GetMessageModeReg (
|
|||
__inline void AT91F_CAN_CfgMessageIDReg (
|
||||
AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
|
||||
unsigned int id,
|
||||
unsigned char version)
|
||||
uint8_t version)
|
||||
{
|
||||
if(version==0) // IDvA Standard Format
|
||||
CAN_Mailbox->CAN_MB_MID = id<<18;
|
||||
|
@ -3680,7 +3680,7 @@ __inline void AT91F_AES_LoadNewSeed (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_AES_SetCryptoKey (
|
||||
AT91PS_AES pAES, // pointer to a AES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int keyword
|
||||
)
|
||||
{
|
||||
|
@ -3693,7 +3693,7 @@ __inline void AT91F_AES_SetCryptoKey (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_AES_InputData (
|
||||
AT91PS_AES pAES, // pointer to a AES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int indata
|
||||
)
|
||||
{
|
||||
|
@ -3706,7 +3706,7 @@ __inline void AT91F_AES_InputData (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline unsigned int AT91F_AES_GetOutputData (
|
||||
AT91PS_AES pAES, // pointer to a AES controller
|
||||
unsigned char index
|
||||
uint8_t index
|
||||
)
|
||||
{
|
||||
return pAES->AES_ODATAxR[index];
|
||||
|
@ -3718,7 +3718,7 @@ __inline unsigned int AT91F_AES_GetOutputData (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_AES_SetInitializationVector (
|
||||
AT91PS_AES pAES, // pointer to a AES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int initvector
|
||||
)
|
||||
{
|
||||
|
@ -3845,7 +3845,7 @@ __inline void AT91F_TDES_SoftReset (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_TDES_SetCryptoKey1 (
|
||||
AT91PS_TDES pTDES, // pointer to a TDES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int keyword
|
||||
)
|
||||
{
|
||||
|
@ -3858,7 +3858,7 @@ __inline void AT91F_TDES_SetCryptoKey1 (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_TDES_SetCryptoKey2 (
|
||||
AT91PS_TDES pTDES, // pointer to a TDES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int keyword
|
||||
)
|
||||
{
|
||||
|
@ -3871,7 +3871,7 @@ __inline void AT91F_TDES_SetCryptoKey2 (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_TDES_SetCryptoKey3 (
|
||||
AT91PS_TDES pTDES, // pointer to a TDES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int keyword
|
||||
)
|
||||
{
|
||||
|
@ -3884,7 +3884,7 @@ __inline void AT91F_TDES_SetCryptoKey3 (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_TDES_InputData (
|
||||
AT91PS_TDES pTDES, // pointer to a TDES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int indata
|
||||
)
|
||||
{
|
||||
|
@ -3897,7 +3897,7 @@ __inline void AT91F_TDES_InputData (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline unsigned int AT91F_TDES_GetOutputData (
|
||||
AT91PS_TDES pTDES, // pointer to a TDES controller
|
||||
unsigned char index
|
||||
uint8_t index
|
||||
)
|
||||
{
|
||||
return pTDES->TDES_ODATAxR[index];
|
||||
|
@ -3909,7 +3909,7 @@ __inline unsigned int AT91F_TDES_GetOutputData (
|
|||
//*----------------------------------------------------------------------------
|
||||
__inline void AT91F_TDES_SetInitializationVector (
|
||||
AT91PS_TDES pTDES, // pointer to a TDES controller
|
||||
unsigned char index,
|
||||
uint8_t index,
|
||||
unsigned int initvector
|
||||
)
|
||||
{
|
||||
|
|
|
@ -83,24 +83,24 @@
|
|||
#include "AT91SAM7X256.h"
|
||||
|
||||
/* Constants required to setup the task context. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 )
|
||||
|
||||
/* Constants required to setup the tick ISR. */
|
||||
#define portENABLE_TIMER ( ( unsigned char ) 0x01 )
|
||||
#define portENABLE_TIMER ( ( uint8_t ) 0x01 )
|
||||
#define portPRESCALE_VALUE 0x00
|
||||
#define portINTERRUPT_ON_MATCH ( ( unsigned long ) 0x01 )
|
||||
#define portRESET_COUNT_ON_MATCH ( ( unsigned long ) 0x02 )
|
||||
#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 )
|
||||
#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 )
|
||||
|
||||
/* Constants required to setup the PIT. */
|
||||
#define portPIT_CLOCK_DIVISOR ( ( unsigned long ) 16 )
|
||||
#define portPIT_CLOCK_DIVISOR ( ( uint32_t ) 16 )
|
||||
#define portPIT_COUNTER_VALUE ( ( ( configCPU_CLOCK_HZ / portPIT_CLOCK_DIVISOR ) / 1000UL ) * portTICK_RATE_MS )
|
||||
|
||||
#define portINT_LEVEL_SENSITIVE 0
|
||||
#define portPIT_ENABLE ( ( unsigned short ) 0x1 << 24 )
|
||||
#define portPIT_INT_ENABLE ( ( unsigned short ) 0x1 << 25 )
|
||||
#define portPIT_ENABLE ( ( uint16_t ) 0x1 << 24 )
|
||||
#define portPIT_INT_ENABLE ( ( uint16_t ) 0x1 << 25 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Setup the timer to generate the tick interrupts. */
|
||||
|
@ -120,9 +120,9 @@ extern void vPortISRStartFirstTask( void );
|
|||
*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxOriginalTOS;
|
||||
StackType_t *pxOriginalTOS;
|
||||
|
||||
pxOriginalTOS = pxTopOfStack;
|
||||
|
||||
|
@ -136,46 +136,46 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
/* First on the stack is the return address - which in this case is the
|
||||
start of the task. The offset is added to make the return address appear
|
||||
as it would within an IRQ ISR. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* When the task starts is will expect to find the function parameter in
|
||||
R0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The last thing onto the stack is the status register, which is set for
|
||||
system mode, with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||
*pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
|
||||
|
||||
#ifdef THUMB_INTERWORK
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||
here already. */
|
||||
|
|
|
@ -84,12 +84,12 @@
|
|||
#include "AT91SAM7X256.h"
|
||||
|
||||
/* Constants required to handle interrupts. */
|
||||
#define portTIMER_MATCH_ISR_BIT ( ( unsigned char ) 0x01 )
|
||||
#define portCLEAR_VIC_INTERRUPT ( ( unsigned long ) 0 )
|
||||
#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 )
|
||||
#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 )
|
||||
|
||||
/* Constants required to handle critical sections. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
volatile unsigned long ulCriticalNesting = 9999UL;
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -149,7 +149,7 @@ void vPortYieldProcessor( void )
|
|||
void vNonPreemptiveTick( void ) __attribute__ ((interrupt ("IRQ")));
|
||||
void vNonPreemptiveTick( void )
|
||||
{
|
||||
unsigned long ulDummy;
|
||||
uint32_t ulDummy;
|
||||
|
||||
/* Increment the tick count - which may wake some tasks but as the
|
||||
preemptive scheduler is not being used any woken task is not given
|
||||
|
|
|
@ -109,21 +109,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE portLONG
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portNOP() asm volatile ( "NOP" );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -141,7 +145,7 @@ extern "C" {
|
|||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Set the LR to the task stack. */ \
|
||||
asm volatile ( \
|
||||
|
@ -178,7 +182,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \
|
|||
#define portSAVE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Push R0 as we are going to use the register. */ \
|
||||
asm volatile ( \
|
||||
|
|
|
@ -81,21 +81,21 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to setup the task context. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 )
|
||||
|
||||
/* Constants required to setup the tick ISR. */
|
||||
#define portENABLE_TIMER ( ( unsigned char ) 0x01 )
|
||||
#define portENABLE_TIMER ( ( uint8_t ) 0x01 )
|
||||
#define portPRESCALE_VALUE 0x00
|
||||
#define portINTERRUPT_ON_MATCH ( ( unsigned long ) 0x01 )
|
||||
#define portRESET_COUNT_ON_MATCH ( ( unsigned long ) 0x02 )
|
||||
#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 )
|
||||
#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 )
|
||||
|
||||
/* Constants required to setup the VIC for the tick ISR. */
|
||||
#define portTIMER_VIC_CHANNEL ( ( unsigned long ) 0x0004 )
|
||||
#define portTIMER_VIC_CHANNEL_BIT ( ( unsigned long ) 0x0010 )
|
||||
#define portTIMER_VIC_ENABLE ( ( unsigned long ) 0x0020 )
|
||||
#define portTIMER_VIC_CHANNEL ( ( uint32_t ) 0x0004 )
|
||||
#define portTIMER_VIC_CHANNEL_BIT ( ( uint32_t ) 0x0010 )
|
||||
#define portTIMER_VIC_ENABLE ( ( uint32_t ) 0x0020 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -116,9 +116,9 @@ extern void vPortISRStartFirstTask( void );
|
|||
*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxOriginalTOS;
|
||||
StackType_t *pxOriginalTOS;
|
||||
|
||||
pxOriginalTOS = pxTopOfStack;
|
||||
|
||||
|
@ -132,48 +132,48 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
/* First on the stack is the return address - which in this case is the
|
||||
start of the task. The offset is added to make the return address appear
|
||||
as it would within an IRQ ISR. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* When the task starts is will expect to find the function parameter in
|
||||
R0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The last thing onto the stack is the status register, which is set for
|
||||
system mode, with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||
*pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
|
||||
|
||||
if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 )
|
||||
if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00 )
|
||||
{
|
||||
/* We want the task to start in thumb mode. */
|
||||
*pxTopOfStack |= portTHUMB_MODE_BIT;
|
||||
|
@ -191,7 +191,7 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||
here already. */
|
||||
|
@ -217,7 +217,7 @@ void vPortEndScheduler( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
unsigned long ulCompareMatch;
|
||||
uint32_t ulCompareMatch;
|
||||
extern void ( vTickISR )( void );
|
||||
|
||||
/* A 1ms tick does not require the use of the timer prescale. This is
|
||||
|
@ -246,7 +246,7 @@ extern void ( vTickISR )( void );
|
|||
/* The ISR installed depends on whether the preemptive or cooperative
|
||||
scheduler is being used. */
|
||||
|
||||
VICVectAddr0 = ( long ) vTickISR;
|
||||
VICVectAddr0 = ( int32_t ) vTickISR;
|
||||
VICVectCntl0 = portTIMER_VIC_CHANNEL | portTIMER_VIC_ENABLE;
|
||||
|
||||
/* Start the timer - interrupts are disabled when this function is called
|
||||
|
|
|
@ -93,12 +93,12 @@
|
|||
#include "FreeRTOS.h"
|
||||
|
||||
/* Constants required to handle interrupts. */
|
||||
#define portTIMER_MATCH_ISR_BIT ( ( unsigned char ) 0x01 )
|
||||
#define portCLEAR_VIC_INTERRUPT ( ( unsigned long ) 0 )
|
||||
#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 )
|
||||
#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 )
|
||||
|
||||
/* Constants required to handle critical sections. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
volatile unsigned long ulCriticalNesting = 9999UL;
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -86,21 +86,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE portLONG
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portNOP() __asm volatile ( "NOP" );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -118,7 +122,7 @@ extern "C" {
|
|||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Set the LR to the task stack. */ \
|
||||
__asm volatile ( \
|
||||
|
@ -155,7 +159,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \
|
|||
#define portSAVE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Push R0 as we are going to use the register. */ \
|
||||
__asm volatile ( \
|
||||
|
|
|
@ -81,21 +81,21 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to setup the task context. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( StackType_t ) 0 )
|
||||
|
||||
/* Constants required to setup the tick ISR. */
|
||||
#define portENABLE_TIMER ( ( unsigned portCHAR ) 0x01 )
|
||||
#define portENABLE_TIMER ( ( uint8_t ) 0x01 )
|
||||
#define portPRESCALE_VALUE 0x00
|
||||
#define portINTERRUPT_ON_MATCH ( ( unsigned portLONG ) 0x01 )
|
||||
#define portRESET_COUNT_ON_MATCH ( ( unsigned portLONG ) 0x02 )
|
||||
#define portINTERRUPT_ON_MATCH ( ( uint32_t ) 0x01 )
|
||||
#define portRESET_COUNT_ON_MATCH ( ( uint32_t ) 0x02 )
|
||||
|
||||
/* Constants required to setup the VIC for the tick ISR. */
|
||||
#define portTIMER_VIC_CHANNEL ( ( unsigned portLONG ) 0x0004 )
|
||||
#define portTIMER_VIC_CHANNEL_BIT ( ( unsigned portLONG ) 0x0010 )
|
||||
#define portTIMER_VIC_ENABLE ( ( unsigned portLONG ) 0x0020 )
|
||||
#define portTIMER_VIC_CHANNEL ( ( uint32_t ) 0x0004 )
|
||||
#define portTIMER_VIC_CHANNEL_BIT ( ( uint32_t ) 0x0010 )
|
||||
#define portTIMER_VIC_ENABLE ( ( uint32_t ) 0x0020 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -116,9 +116,9 @@ extern void vPortISRStartFirstTask( void );
|
|||
*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxOriginalTOS;
|
||||
StackType_t *pxOriginalTOS;
|
||||
|
||||
pxOriginalTOS = pxTopOfStack;
|
||||
|
||||
|
@ -132,48 +132,48 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
/* First on the stack is the return address - which in this case is the
|
||||
start of the task. The offset is added to make the return address appear
|
||||
as it would within an IRQ ISR. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* When the task starts is will expect to find the function parameter in
|
||||
R0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The last thing onto the stack is the status register, which is set for
|
||||
system mode, with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||
*pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
|
||||
|
||||
if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 )
|
||||
if( ( ( uint32_t ) pxCode & 0x01UL ) != 0x00 )
|
||||
{
|
||||
/* We want the task to start in thumb mode. */
|
||||
*pxTopOfStack |= portTHUMB_MODE_BIT;
|
||||
|
@ -191,7 +191,7 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||
here already. */
|
||||
|
@ -217,7 +217,7 @@ void vPortEndScheduler( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
unsigned portLONG ulCompareMatch;
|
||||
uint32_t ulCompareMatch;
|
||||
|
||||
PCLKSEL0 = (PCLKSEL0 & (~(0x3<<2))) | (0x01 << 2);
|
||||
T0TCR = 2; /* Stop and reset the timer */
|
||||
|
@ -250,12 +250,12 @@ unsigned portLONG ulCompareMatch;
|
|||
#if configUSE_PREEMPTION == 1
|
||||
{
|
||||
extern void ( vPreemptiveTick )( void );
|
||||
VICVectAddr4 = ( portLONG ) vPreemptiveTick;
|
||||
VICVectAddr4 = ( int32_t ) vPreemptiveTick;
|
||||
}
|
||||
#else
|
||||
{
|
||||
extern void ( vNonPreemptiveTick )( void );
|
||||
VICVectAddr4 = ( portLONG ) vNonPreemptiveTick;
|
||||
VICVectAddr4 = ( int32_t ) vNonPreemptiveTick;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -75,12 +75,12 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to handle interrupts. */
|
||||
#define portTIMER_MATCH_ISR_BIT ( ( unsigned portCHAR ) 0x01 )
|
||||
#define portCLEAR_VIC_INTERRUPT ( ( unsigned portLONG ) 0 )
|
||||
#define portTIMER_MATCH_ISR_BIT ( ( uint8_t ) 0x01 )
|
||||
#define portCLEAR_VIC_INTERRUPT ( ( uint32_t ) 0 )
|
||||
|
||||
/* Constants required to handle critical sections. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 )
|
||||
volatile unsigned portLONG ulCriticalNesting = 9999UL;
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -109,21 +109,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE portLONG
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portNOP() __asm volatile ( "NOP" );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -141,7 +145,7 @@ extern "C" {
|
|||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Set the LR to the task stack. */ \
|
||||
__asm volatile ( \
|
||||
|
@ -178,7 +182,7 @@ extern volatile unsigned portLONG ulCriticalNesting; \
|
|||
#define portSAVE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile void * volatile pxCurrentTCB; \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
\
|
||||
/* Push R0 as we are going to use the register. */ \
|
||||
__asm volatile ( \
|
||||
|
|
|
@ -72,10 +72,10 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to manipulate the NVIC. */
|
||||
#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long *) 0xe000e010 )
|
||||
#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long *) 0xe000e014 )
|
||||
#define portNVIC_INT_CTRL ( ( volatile unsigned long *) 0xe000ed04 )
|
||||
#define portNVIC_SYSPRI2 ( ( volatile unsigned long *) 0xe000ed20 )
|
||||
#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t *) 0xe000e010 )
|
||||
#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t *) 0xe000e014 )
|
||||
#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 )
|
||||
#define portNVIC_SYSPRI2 ( ( volatile uint32_t *) 0xe000ed20 )
|
||||
#define portNVIC_SYSTICK_CLK 0x00000004
|
||||
#define portNVIC_SYSTICK_INT 0x00000002
|
||||
#define portNVIC_SYSTICK_ENABLE 0x00000001
|
||||
|
@ -98,7 +98,7 @@ debugger. */
|
|||
|
||||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts.
|
||||
|
@ -127,18 +127,18 @@ static void prvTaskExitError( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
*pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack -= 8; /* R11..R4. */
|
||||
|
||||
return pxTopOfStack;
|
||||
|
@ -193,7 +193,7 @@ void vPortStartFirstTask( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Make PendSV, CallSV and SysTick the same priroity as the kernel. */
|
||||
*(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI;
|
||||
|
@ -260,7 +260,7 @@ void vPortExitCritical( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulSetInterruptMaskFromISR( void )
|
||||
uint32_t ulSetInterruptMaskFromISR( void )
|
||||
{
|
||||
__asm volatile(
|
||||
" mrs r0, PRIMASK \n"
|
||||
|
@ -273,7 +273,7 @@ unsigned long ulSetInterruptMaskFromISR( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vClearInterruptMaskFromISR( unsigned long ulMask )
|
||||
void vClearInterruptMaskFromISR( uint32_t ulMask )
|
||||
{
|
||||
__asm volatile(
|
||||
" msr PRIMASK, r0 \n"
|
||||
|
@ -335,7 +335,7 @@ void xPortPendSVHandler( void )
|
|||
|
||||
void xPortSysTickHandler( void )
|
||||
{
|
||||
unsigned long ulPreviousMask;
|
||||
uint32_t ulPreviousMask;
|
||||
|
||||
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
|
|
|
@ -87,28 +87,32 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||
|
@ -119,8 +123,8 @@ extern void vPortYield( void );
|
|||
/* Critical section management. */
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulSetInterruptMaskFromISR( void ) __attribute__((naked));
|
||||
extern void vClearInterruptMaskFromISR( unsigned long ulMask ) __attribute__((naked));
|
||||
extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__((naked));
|
||||
extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__((naked));
|
||||
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x )
|
||||
|
|
|
@ -89,10 +89,10 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */
|
|||
#endif
|
||||
|
||||
/* Constants required to manipulate the core. Registers first... */
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) )
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) )
|
||||
/* ...then bits in the registers. */
|
||||
#define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL )
|
||||
#define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL )
|
||||
|
@ -100,16 +100,16 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */
|
|||
#define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL )
|
||||
#define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL )
|
||||
|
||||
#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
|
||||
/* Constants required to check the validity of an interrupt priority. */
|
||||
#define portFIRST_USER_INTERRUPT_NUMBER ( 16 )
|
||||
#define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 )
|
||||
#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 )
|
||||
#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 )
|
||||
#define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL )
|
||||
#define portPRIGROUP_SHIFT ( 8UL )
|
||||
|
||||
|
@ -135,7 +135,7 @@ debugger. */
|
|||
|
||||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts. The implementation in this
|
||||
|
@ -167,7 +167,7 @@ static void prvTaskExitError( void );
|
|||
* The number of SysTick increments that make up one tick period.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulTimerCountsForOneTick = 0;
|
||||
static uint32_t ulTimerCountsForOneTick = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -175,7 +175,7 @@ static void prvTaskExitError( void );
|
|||
* 24 bit resolution of the SysTick timer.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long xMaximumPossibleSuppressedTicks = 0;
|
||||
static uint32_t xMaximumPossibleSuppressedTicks = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -183,7 +183,7 @@ static void prvTaskExitError( void );
|
|||
* power functionality only.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulStoppedTimerCompensation = 0;
|
||||
static uint32_t ulStoppedTimerCompensation = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -192,9 +192,9 @@ static void prvTaskExitError( void );
|
|||
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
|
||||
*/
|
||||
#if ( configASSERT_DEFINED == 1 )
|
||||
static unsigned char ucMaxSysCallPriority = 0;
|
||||
static unsigned long ulMaxPRIGROUPValue = 0;
|
||||
static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
static uint8_t ucMaxSysCallPriority = 0;
|
||||
static uint32_t ulMaxPRIGROUPValue = 0;
|
||||
static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -202,18 +202,18 @@ static void prvTaskExitError( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
*pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack -= 8; /* R11, R10, R9, R8, R7, R6, R5 and R4. */
|
||||
|
||||
return pxTopOfStack;
|
||||
|
@ -273,7 +273,7 @@ static void prvPortStartFirstTask( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
|
@ -281,9 +281,9 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
|
||||
#if( configASSERT_DEFINED == 1 )
|
||||
{
|
||||
volatile unsigned long ulOriginalPriority;
|
||||
volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile unsigned char ucMaxPriorityValue;
|
||||
volatile uint32_t ulOriginalPriority;
|
||||
volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile uint8_t ucMaxPriorityValue;
|
||||
|
||||
/* Determine the maximum priority from which ISR safe FreeRTOS API
|
||||
functions can be called. ISR safe functions are those that end in
|
||||
|
@ -309,7 +309,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )
|
||||
{
|
||||
ulMaxPRIGROUPValue--;
|
||||
ucMaxPriorityValue <<= ( unsigned char ) 0x01;
|
||||
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
|
||||
}
|
||||
|
||||
/* Shift the priority group value back to its position within the AIRCR
|
||||
|
@ -388,7 +388,7 @@ void vPortExitCritical( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__(( naked )) unsigned long ulPortSetInterruptMask( void )
|
||||
__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void )
|
||||
{
|
||||
__asm volatile \
|
||||
( \
|
||||
|
@ -405,7 +405,7 @@ __attribute__(( naked )) unsigned long ulPortSetInterruptMask( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__(( naked )) void vPortClearInterruptMask( unsigned long ulNewMaskValue )
|
||||
__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue )
|
||||
{
|
||||
__asm volatile \
|
||||
( \
|
||||
|
@ -478,10 +478,10 @@ void xPortSysTickHandler( void )
|
|||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||
__attribute__((weak)) void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
portTickType xModifiableIdleTime;
|
||||
uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
TickType_t xModifiableIdleTime;
|
||||
|
||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||
|
@ -567,7 +567,7 @@ void xPortSysTickHandler( void )
|
|||
|
||||
if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
|
||||
{
|
||||
unsigned long ulCalculatedLoadValue;
|
||||
uint32_t ulCalculatedLoadValue;
|
||||
|
||||
/* The tick interrupt has already executed, and the SysTick
|
||||
count reloaded with ulReloadValue. Reset the
|
||||
|
@ -653,8 +653,8 @@ __attribute__(( weak )) void vPortSetupTimerInterrupt( void )
|
|||
|
||||
void vPortValidateInterruptPriority( void )
|
||||
{
|
||||
unsigned long ulCurrentInterrupt;
|
||||
unsigned char ucCurrentPriority;
|
||||
uint32_t ulCurrentInterrupt;
|
||||
uint8_t ucCurrentPriority;
|
||||
|
||||
/* Obtain the number of the currently executing interrupt. */
|
||||
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );
|
||||
|
|
|
@ -87,28 +87,32 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||
|
@ -118,8 +122,8 @@ extern void vPortYield( void );
|
|||
/* Critical section management. */
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( unsigned long ulNewMaskValue );
|
||||
extern uint32_t ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
|
||||
|
@ -137,7 +141,7 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
|
||||
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -146,9 +150,9 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
|
||||
|
||||
/* Generic helper function. */
|
||||
__attribute__( ( always_inline ) ) static inline unsigned char ucPortCountLeadingZeros( unsigned long ulBitmap )
|
||||
__attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
|
||||
{
|
||||
unsigned char ucReturn;
|
||||
uint8_t ucReturn;
|
||||
|
||||
__asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) );
|
||||
return ucReturn;
|
||||
|
|
|
@ -80,18 +80,18 @@ task.h is included from an application file. */
|
|||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
/* Constants required to access and manipulate the NVIC. */
|
||||
#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long * ) 0xe000e010 )
|
||||
#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long * ) 0xe000e014 )
|
||||
#define portNVIC_SYSPRI2 ( ( volatile unsigned long * ) 0xe000ed20 )
|
||||
#define portNVIC_SYSPRI1 ( ( volatile unsigned long * ) 0xe000ed1c )
|
||||
#define portNVIC_SYS_CTRL_STATE ( ( volatile unsigned long * ) 0xe000ed24 )
|
||||
#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t * ) 0xe000e010 )
|
||||
#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t * ) 0xe000e014 )
|
||||
#define portNVIC_SYSPRI2 ( ( volatile uint32_t * ) 0xe000ed20 )
|
||||
#define portNVIC_SYSPRI1 ( ( volatile uint32_t * ) 0xe000ed1c )
|
||||
#define portNVIC_SYS_CTRL_STATE ( ( volatile uint32_t * ) 0xe000ed24 )
|
||||
#define portNVIC_MEM_FAULT_ENABLE ( 1UL << 16UL )
|
||||
|
||||
/* Constants required to access and manipulate the MPU. */
|
||||
#define portMPU_TYPE ( ( volatile unsigned long * ) 0xe000ed90 )
|
||||
#define portMPU_REGION_BASE_ADDRESS ( ( volatile unsigned long * ) 0xe000ed9C )
|
||||
#define portMPU_REGION_ATTRIBUTE ( ( volatile unsigned long * ) 0xe000edA0 )
|
||||
#define portMPU_CTRL ( ( volatile unsigned long * ) 0xe000ed94 )
|
||||
#define portMPU_TYPE ( ( volatile uint32_t * ) 0xe000ed90 )
|
||||
#define portMPU_REGION_BASE_ADDRESS ( ( volatile uint32_t * ) 0xe000ed9C )
|
||||
#define portMPU_REGION_ATTRIBUTE ( ( volatile uint32_t * ) 0xe000edA0 )
|
||||
#define portMPU_CTRL ( ( volatile uint32_t * ) 0xe000ed94 )
|
||||
#define portEXPECTED_MPU_TYPE_VALUE ( 8UL << 8UL ) /* 8 regions, unified. */
|
||||
#define portMPU_ENABLE ( 0x01UL )
|
||||
#define portMPU_BACKGROUND_ENABLE ( 1UL << 2UL )
|
||||
|
@ -105,9 +105,9 @@ task.h is included from an application file. */
|
|||
#define portNVIC_SYSTICK_CLK ( 0x00000004UL )
|
||||
#define portNVIC_SYSTICK_INT ( 0x00000002UL )
|
||||
#define portNVIC_SYSTICK_ENABLE ( 0x00000001UL )
|
||||
#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_SVC_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_SVC_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
|
||||
/* Constants required to set up the initial stack. */
|
||||
#define portINITIAL_XPSR ( 0x01000000 )
|
||||
|
@ -123,7 +123,7 @@ task.h is included from an application file. */
|
|||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. Note this is not saved as part of the task context as context
|
||||
switches can only occur when uxCriticalNesting is zero. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts.
|
||||
|
@ -140,14 +140,14 @@ static void prvSetupMPU( void ) PRIVILEGED_FUNCTION;
|
|||
* into. The region size is returned as the value that should be programmed
|
||||
* into the region attribute register for that region.
|
||||
*/
|
||||
static unsigned long prvGetMPURegionSizeSetting( unsigned long ulActualSizeInBytes ) PRIVILEGED_FUNCTION;
|
||||
static uint32_t prvGetMPURegionSizeSetting( uint32_t ulActualSizeInBytes ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Checks to see if being called from the context of an unprivileged task, and
|
||||
* if so raises the privilege level and returns false - otherwise does nothing
|
||||
* other than return true.
|
||||
*/
|
||||
static portBASE_TYPE prvRaisePrivilege( void ) __attribute__(( naked ));
|
||||
static BaseType_t prvRaisePrivilege( void ) __attribute__(( naked ));
|
||||
|
||||
/*
|
||||
* Standard FreeRTOS exception handlers.
|
||||
|
@ -165,76 +165,76 @@ static void prvRestoreContextOfFirstTask( void ) __attribute__(( naked )) PRIVIL
|
|||
* C portion of the SVC handler. The SVC handler is split between an asm entry
|
||||
* and a C wrapper for simplicity of coding and maintenance.
|
||||
*/
|
||||
static void prvSVCHandler( unsigned long *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION;
|
||||
static void prvSVCHandler( uint32_t *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Prototypes for all the MPU wrappers.
|
||||
*/
|
||||
signed portBASE_TYPE MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions );
|
||||
void MPU_vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const xRegions );
|
||||
void MPU_vTaskDelete( xTaskHandle pxTaskToDelete );
|
||||
void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement );
|
||||
void MPU_vTaskDelay( portTickType xTicksToDelay );
|
||||
unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask );
|
||||
void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority );
|
||||
eTaskState MPU_eTaskGetState( xTaskHandle pxTask );
|
||||
void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend );
|
||||
signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask );
|
||||
void MPU_vTaskResume( xTaskHandle pxTaskToResume );
|
||||
BaseType_t MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask, StackType_t *puxStackBuffer, const MemoryRegion_t * const xRegions );
|
||||
void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions );
|
||||
void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete );
|
||||
void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement );
|
||||
void MPU_vTaskDelay( TickType_t xTicksToDelay );
|
||||
UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask );
|
||||
void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority );
|
||||
eTaskState MPU_eTaskGetState( TaskHandle_t pxTask );
|
||||
void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend );
|
||||
BaseType_t MPU_xTaskIsTaskSuspended( TaskHandle_t xTask );
|
||||
void MPU_vTaskResume( TaskHandle_t pxTaskToResume );
|
||||
void MPU_vTaskSuspendAll( void );
|
||||
signed portBASE_TYPE MPU_xTaskResumeAll( void );
|
||||
portTickType MPU_xTaskGetTickCount( void );
|
||||
unsigned portBASE_TYPE MPU_uxTaskGetNumberOfTasks( void );
|
||||
BaseType_t MPU_xTaskResumeAll( void );
|
||||
TickType_t MPU_xTaskGetTickCount( void );
|
||||
UBaseType_t MPU_uxTaskGetNumberOfTasks( void );
|
||||
void MPU_vTaskList( char *pcWriteBuffer );
|
||||
void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||
void MPU_vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxTagValue );
|
||||
pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask );
|
||||
portBASE_TYPE MPU_xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );
|
||||
unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask );
|
||||
xTaskHandle MPU_xTaskGetCurrentTaskHandle( void );
|
||||
portBASE_TYPE MPU_xTaskGetSchedulerState( void );
|
||||
xTaskHandle MPU_xTaskGetIdleTaskHandle( void );
|
||||
unsigned portBASE_TYPE MPU_uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime );
|
||||
xQueueHandle MPU_xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType );
|
||||
signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
|
||||
portBASE_TYPE MPU_xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue );
|
||||
unsigned portBASE_TYPE MPU_uxQueueMessagesWaiting( const xQueueHandle pxQueue );
|
||||
signed portBASE_TYPE MPU_xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );
|
||||
xQueueHandle MPU_xQueueCreateMutex( void );
|
||||
xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount );
|
||||
portBASE_TYPE MPU_xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime );
|
||||
portBASE_TYPE MPU_xQueueGiveMutexRecursive( xQueueHandle xMutex );
|
||||
signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
|
||||
signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );
|
||||
void MPU_vQueueAddToRegistry( xQueueHandle xQueue, char *pcName );
|
||||
void MPU_vQueueDelete( xQueueHandle xQueue );
|
||||
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxTagValue );
|
||||
pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask );
|
||||
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );
|
||||
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask );
|
||||
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void );
|
||||
BaseType_t MPU_xTaskGetSchedulerState( void );
|
||||
TaskHandle_t MPU_xTaskGetIdleTaskHandle( void );
|
||||
UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t *pxTaskStatusArray, UBaseType_t uxArraySize, uint32_t *pulTotalRunTime );
|
||||
QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType );
|
||||
BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition );
|
||||
BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue );
|
||||
UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue );
|
||||
BaseType_t MPU_xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking );
|
||||
QueueHandle_t MPU_xQueueCreateMutex( void );
|
||||
QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount );
|
||||
BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime );
|
||||
BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex );
|
||||
BaseType_t MPU_xQueueAltGenericSend( QueueHandle_t pxQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition );
|
||||
BaseType_t MPU_xQueueAltGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking );
|
||||
void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName );
|
||||
void MPU_vQueueDelete( QueueHandle_t xQueue );
|
||||
void *MPU_pvPortMalloc( size_t xSize );
|
||||
void MPU_vPortFree( void *pv );
|
||||
void MPU_vPortInitialiseBlocks( void );
|
||||
size_t MPU_xPortGetFreeHeapSize( void );
|
||||
xQueueSetHandle MPU_xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength );
|
||||
xQueueSetMemberHandle MPU_xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks );
|
||||
portBASE_TYPE MPU_xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet );
|
||||
portBASE_TYPE MPU_xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet );
|
||||
signed portBASE_TYPE MPU_xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer );
|
||||
QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength );
|
||||
QueueSetMember_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t xBlockTimeTicks );
|
||||
BaseType_t MPU_xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet );
|
||||
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet );
|
||||
BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, BaseType_t xRunPrivileged )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0; /* LR */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack -= 9; /* R11, R10, R9, R8, R7, R6, R5 and R4. */
|
||||
|
||||
if( xRunPrivileged == pdTRUE )
|
||||
|
@ -269,13 +269,13 @@ void vPortSVCHandler( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSVCHandler( unsigned long *pulParam )
|
||||
static void prvSVCHandler( uint32_t *pulParam )
|
||||
{
|
||||
unsigned char ucSVCNumber;
|
||||
uint8_t ucSVCNumber;
|
||||
|
||||
/* The stack contains: r0, r1, r2, r3, r12, r14, the return address and
|
||||
xPSR. The first argument (r0) is pulParam[ 0 ]. */
|
||||
ucSVCNumber = ( ( unsigned char * ) pulParam[ portOFFSET_TO_PC ] )[ -2 ];
|
||||
ucSVCNumber = ( ( uint8_t * ) pulParam[ portOFFSET_TO_PC ] )[ -2 ];
|
||||
switch( ucSVCNumber )
|
||||
{
|
||||
case portSVC_START_SCHEDULER : *(portNVIC_SYSPRI1) |= portNVIC_SVC_PRI;
|
||||
|
@ -339,7 +339,7 @@ static void prvRestoreContextOfFirstTask( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See
|
||||
http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
|
@ -378,7 +378,7 @@ void vPortEndScheduler( void )
|
|||
|
||||
void vPortEnterCritical( void )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
portDISABLE_INTERRUPTS();
|
||||
uxCriticalNesting++;
|
||||
|
@ -389,7 +389,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
|
||||
void vPortExitCritical( void )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
configASSERT( uxCriticalNesting );
|
||||
uxCriticalNesting--;
|
||||
|
@ -445,7 +445,7 @@ void xPortPendSVHandler( void )
|
|||
|
||||
void xPortSysTickHandler( void )
|
||||
{
|
||||
unsigned long ulDummy;
|
||||
uint32_t ulDummy;
|
||||
|
||||
ulDummy = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
|
@ -474,46 +474,46 @@ static void prvSetupTimerInterrupt( void )
|
|||
|
||||
static void prvSetupMPU( void )
|
||||
{
|
||||
extern unsigned long __privileged_functions_end__[];
|
||||
extern unsigned long __FLASH_segment_start__[];
|
||||
extern unsigned long __FLASH_segment_end__[];
|
||||
extern unsigned long __privileged_data_start__[];
|
||||
extern unsigned long __privileged_data_end__[];
|
||||
extern uint32_t __privileged_functions_end__[];
|
||||
extern uint32_t __FLASH_segment_start__[];
|
||||
extern uint32_t __FLASH_segment_end__[];
|
||||
extern uint32_t __privileged_data_start__[];
|
||||
extern uint32_t __privileged_data_end__[];
|
||||
|
||||
/* Check the expected MPU is present. */
|
||||
if( *portMPU_TYPE == portEXPECTED_MPU_TYPE_VALUE )
|
||||
{
|
||||
/* First setup the entire flash for unprivileged read only access. */
|
||||
*portMPU_REGION_BASE_ADDRESS = ( ( unsigned long ) __FLASH_segment_start__ ) | /* Base address. */
|
||||
*portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portUNPRIVILEGED_FLASH_REGION );
|
||||
|
||||
*portMPU_REGION_ATTRIBUTE = ( portMPU_REGION_READ_ONLY ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
( prvGetMPURegionSizeSetting( ( unsigned long ) __FLASH_segment_end__ - ( unsigned long ) __FLASH_segment_start__ ) ) |
|
||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __FLASH_segment_end__ - ( uint32_t ) __FLASH_segment_start__ ) ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
|
||||
/* Setup the first 16K for privileged only access (even though less
|
||||
than 10K is actually being used). This is where the kernel code is
|
||||
placed. */
|
||||
*portMPU_REGION_BASE_ADDRESS = ( ( unsigned long ) __FLASH_segment_start__ ) | /* Base address. */
|
||||
*portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portPRIVILEGED_FLASH_REGION );
|
||||
|
||||
*portMPU_REGION_ATTRIBUTE = ( portMPU_REGION_PRIVILEGED_READ_ONLY ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
( prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_functions_end__ - ( unsigned long ) __FLASH_segment_start__ ) ) |
|
||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_functions_end__ - ( uint32_t ) __FLASH_segment_start__ ) ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
|
||||
/* Setup the privileged data RAM region. This is where the kernel data
|
||||
is placed. */
|
||||
*portMPU_REGION_BASE_ADDRESS = ( ( unsigned long ) __privileged_data_start__ ) | /* Base address. */
|
||||
*portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __privileged_data_start__ ) | /* Base address. */
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portPRIVILEGED_RAM_REGION );
|
||||
|
||||
*portMPU_REGION_ATTRIBUTE = ( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_data_end__ - ( unsigned long ) __privileged_data_start__ ) |
|
||||
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
|
||||
/* By default allow everything to access the general peripherals. The
|
||||
|
@ -535,9 +535,9 @@ extern unsigned long __privileged_data_end__[];
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static unsigned long prvGetMPURegionSizeSetting( unsigned long ulActualSizeInBytes )
|
||||
static uint32_t prvGetMPURegionSizeSetting( uint32_t ulActualSizeInBytes )
|
||||
{
|
||||
unsigned long ulRegionSize, ulReturnValue = 4;
|
||||
uint32_t ulRegionSize, ulReturnValue = 4;
|
||||
|
||||
/* 32 is the smallest region size, 31 is the largest valid value for
|
||||
ulReturnValue. */
|
||||
|
@ -559,7 +559,7 @@ unsigned long ulRegionSize, ulReturnValue = 4;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvRaisePrivilege( void )
|
||||
static BaseType_t prvRaisePrivilege( void )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
|
@ -577,40 +577,40 @@ static portBASE_TYPE prvRaisePrivilege( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth )
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth )
|
||||
{
|
||||
extern unsigned long __SRAM_segment_start__[];
|
||||
extern unsigned long __SRAM_segment_end__[];
|
||||
extern unsigned long __privileged_data_start__[];
|
||||
extern unsigned long __privileged_data_end__[];
|
||||
long lIndex;
|
||||
unsigned long ul;
|
||||
extern uint32_t __SRAM_segment_start__[];
|
||||
extern uint32_t __SRAM_segment_end__[];
|
||||
extern uint32_t __privileged_data_start__[];
|
||||
extern uint32_t __privileged_data_end__[];
|
||||
int32_t lIndex;
|
||||
uint32_t ul;
|
||||
|
||||
if( xRegions == NULL )
|
||||
{
|
||||
/* No MPU regions are specified so allow access to all RAM. */
|
||||
xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress =
|
||||
( ( unsigned long ) __SRAM_segment_start__ ) | /* Base address. */
|
||||
( ( uint32_t ) __SRAM_segment_start__ ) | /* Base address. */
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portSTACK_REGION );
|
||||
|
||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||
( portMPU_REGION_READ_WRITE ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
( prvGetMPURegionSizeSetting( ( unsigned long ) __SRAM_segment_end__ - ( unsigned long ) __SRAM_segment_start__ ) ) |
|
||||
( prvGetMPURegionSizeSetting( ( uint32_t ) __SRAM_segment_end__ - ( uint32_t ) __SRAM_segment_start__ ) ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
|
||||
/* Re-instate the privileged only RAM region as xRegion[ 0 ] will have
|
||||
just removed the privileged only parameters. */
|
||||
xMPUSettings->xRegion[ 1 ].ulRegionBaseAddress =
|
||||
( ( unsigned long ) __privileged_data_start__ ) | /* Base address. */
|
||||
( ( uint32_t ) __privileged_data_start__ ) | /* Base address. */
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portSTACK_REGION + 1 );
|
||||
|
||||
xMPUSettings->xRegion[ 1 ].ulRegionAttribute =
|
||||
( portMPU_REGION_PRIVILEGED_READ_WRITE ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
prvGetMPURegionSizeSetting( ( unsigned long ) __privileged_data_end__ - ( unsigned long ) __privileged_data_start__ ) |
|
||||
prvGetMPURegionSizeSetting( ( uint32_t ) __privileged_data_end__ - ( uint32_t ) __privileged_data_start__ ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
|
||||
/* Invalidate all other regions. */
|
||||
|
@ -630,13 +630,13 @@ unsigned long ul;
|
|||
{
|
||||
/* Define the region that allows access to the stack. */
|
||||
xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress =
|
||||
( ( unsigned long ) pxBottomOfStack ) |
|
||||
( ( uint32_t ) pxBottomOfStack ) |
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portSTACK_REGION ); /* Region number. */
|
||||
|
||||
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =
|
||||
( portMPU_REGION_READ_WRITE ) | /* Read and write. */
|
||||
( prvGetMPURegionSizeSetting( ( unsigned long ) usStackDepth * ( unsigned long ) sizeof( portSTACK_TYPE ) ) ) |
|
||||
( prvGetMPURegionSizeSetting( ( uint32_t ) usStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |
|
||||
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |
|
||||
( portMPU_REGION_ENABLE );
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ unsigned long ul;
|
|||
xRegions into the CM3 specific MPU settings that are then
|
||||
stored in xMPUSettings. */
|
||||
xMPUSettings->xRegion[ ul ].ulRegionBaseAddress =
|
||||
( ( unsigned long ) xRegions[ lIndex ].pvBaseAddress ) |
|
||||
( ( uint32_t ) xRegions[ lIndex ].pvBaseAddress ) |
|
||||
( portMPU_REGION_VALID ) |
|
||||
( portSTACK_REGION + ul ); /* Region number. */
|
||||
|
||||
|
@ -673,10 +673,10 @@ unsigned long ul;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions )
|
||||
BaseType_t MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask, StackType_t *puxStackBuffer, const MemoryRegion_t * const xRegions )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskGenericCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, puxStackBuffer, xRegions );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -684,9 +684,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void MPU_vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const xRegions )
|
||||
void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskAllocateMPURegions( xTask, xRegions );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -694,9 +694,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskDelete == 1 )
|
||||
void MPU_vTaskDelete( xTaskHandle pxTaskToDelete )
|
||||
void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskDelete( pxTaskToDelete );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -705,9 +705,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskDelayUntil == 1 )
|
||||
void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement )
|
||||
void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -716,9 +716,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskDelay == 1 )
|
||||
void MPU_vTaskDelay( portTickType xTicksToDelay )
|
||||
void MPU_vTaskDelay( TickType_t xTicksToDelay )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskDelay( xTicksToDelay );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -727,10 +727,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_uxTaskPriorityGet == 1 )
|
||||
unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask )
|
||||
UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask )
|
||||
{
|
||||
unsigned portBASE_TYPE uxReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
UBaseType_t uxReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
uxReturn = uxTaskPriorityGet( pxTask );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -740,9 +740,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskPrioritySet == 1 )
|
||||
void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )
|
||||
void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskPrioritySet( pxTask, uxNewPriority );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -751,9 +751,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_eTaskGetState == 1 )
|
||||
eTaskState MPU_eTaskGetState( xTaskHandle pxTask )
|
||||
eTaskState MPU_eTaskGetState( TaskHandle_t pxTask )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
eTaskState eReturn;
|
||||
|
||||
eReturn = eTaskGetState( pxTask );
|
||||
|
@ -764,10 +764,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
|
||||
xTaskHandle MPU_xTaskGetIdleTaskHandle( void )
|
||||
TaskHandle_t MPU_xTaskGetIdleTaskHandle( void )
|
||||
{
|
||||
xTaskHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
TaskHandle_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskGetIdleTaskHandle();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -777,9 +777,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||
void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend )
|
||||
void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskSuspend( pxTaskToSuspend );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -788,10 +788,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||
signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask )
|
||||
BaseType_t MPU_xTaskIsTaskSuspended( TaskHandle_t xTask )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskIsTaskSuspended( xTask );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -801,9 +801,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||
void MPU_vTaskResume( xTaskHandle pxTaskToResume )
|
||||
void MPU_vTaskResume( TaskHandle_t pxTaskToResume )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskResume( pxTaskToResume );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -813,17 +813,17 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
|
||||
void MPU_vTaskSuspendAll( void )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskSuspendAll();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE MPU_xTaskResumeAll( void )
|
||||
BaseType_t MPU_xTaskResumeAll( void )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskResumeAll();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -831,10 +831,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portTickType MPU_xTaskGetTickCount( void )
|
||||
TickType_t MPU_xTaskGetTickCount( void )
|
||||
{
|
||||
portTickType xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
TickType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskGetTickCount();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -842,10 +842,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned portBASE_TYPE MPU_uxTaskGetNumberOfTasks( void )
|
||||
UBaseType_t MPU_uxTaskGetNumberOfTasks( void )
|
||||
{
|
||||
unsigned portBASE_TYPE uxReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
UBaseType_t uxReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
uxReturn = uxTaskGetNumberOfTasks();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -856,7 +856,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
void MPU_vTaskList( char *pcWriteBuffer )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskList( pcWriteBuffer );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -867,7 +867,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskGetRunTimeStats( pcWriteBuffer );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -876,9 +876,9 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
|
||||
void MPU_vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxTagValue )
|
||||
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, pdTASK_HOOK_CODE pxTagValue )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vTaskSetApplicationTaskTag( xTask, pxTagValue );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -887,10 +887,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
|
||||
pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask )
|
||||
pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask )
|
||||
{
|
||||
pdTASK_HOOK_CODE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskGetApplicationTaskTag( xTask );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -900,10 +900,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
|
||||
portBASE_TYPE MPU_xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter )
|
||||
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -913,10 +913,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
unsigned portBASE_TYPE MPU_uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime )
|
||||
UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t *pxTaskStatusArray, UBaseType_t uxArraySize, uint32_t *pulTotalRunTime )
|
||||
{
|
||||
unsigned portBASE_TYPE uxReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
UBaseType_t uxReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -926,10 +926,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
|
||||
unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask )
|
||||
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask )
|
||||
{
|
||||
unsigned portBASE_TYPE uxReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
UBaseType_t uxReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
uxReturn = uxTaskGetStackHighWaterMark( xTask );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -939,10 +939,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_xTaskGetCurrentTaskHandle == 1 )
|
||||
xTaskHandle MPU_xTaskGetCurrentTaskHandle( void )
|
||||
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void )
|
||||
{
|
||||
xTaskHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
TaskHandle_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskGetCurrentTaskHandle();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -952,10 +952,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_xTaskGetSchedulerState == 1 )
|
||||
portBASE_TYPE MPU_xTaskGetSchedulerState( void )
|
||||
BaseType_t MPU_xTaskGetSchedulerState( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xTaskGetSchedulerState();
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -964,10 +964,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
xQueueHandle MPU_xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType )
|
||||
QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType )
|
||||
{
|
||||
xQueueHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
QueueHandle_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -975,10 +975,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE MPU_xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue )
|
||||
BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueGenericReset( pxQueue, xNewQueue );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -986,10 +986,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )
|
||||
BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -997,10 +997,10 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned portBASE_TYPE MPU_uxQueueMessagesWaiting( const xQueueHandle pxQueue )
|
||||
UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
unsigned portBASE_TYPE uxReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
UBaseType_t uxReturn;
|
||||
|
||||
uxReturn = uxQueueMessagesWaiting( pxQueue );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1008,10 +1008,10 @@ unsigned portBASE_TYPE uxReturn;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE MPU_xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
|
||||
BaseType_t MPU_xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
signed portBASE_TYPE xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
|
||||
xReturn = xQueueGenericReceive( pxQueue, pvBuffer, xTicksToWait, xJustPeeking );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1019,10 +1019,10 @@ signed portBASE_TYPE xReturn;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE MPU_xQueuePeekFromISR( xQueueHandle pxQueue, void * const pvBuffer )
|
||||
BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t pxQueue, void * const pvBuffer )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
signed portBASE_TYPE xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
|
||||
xReturn = xQueuePeekFromISR( pxQueue, pvBuffer );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1031,10 +1031,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
xQueueHandle MPU_xQueueCreateMutex( void )
|
||||
QueueHandle_t MPU_xQueueCreateMutex( void )
|
||||
{
|
||||
xQueueHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
QueueHandle_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueCreateMutex( queueQUEUE_TYPE_MUTEX );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1044,10 +1044,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if configUSE_COUNTING_SEMAPHORES == 1
|
||||
xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount )
|
||||
QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount )
|
||||
{
|
||||
xQueueHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
QueueHandle_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1057,10 +1057,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
portBASE_TYPE MPU_xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime )
|
||||
BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueTakeMutexRecursive( xMutex, xBlockTime );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1070,10 +1070,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
portBASE_TYPE MPU_xQueueGiveMutexRecursive( xQueueHandle xMutex )
|
||||
BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueGiveMutexRecursive( xMutex );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1083,10 +1083,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_QUEUE_SETS == 1 )
|
||||
xQueueSetHandle MPU_xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength )
|
||||
QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength )
|
||||
{
|
||||
xQueueSetHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
QueueSetHandle_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueCreateSet( uxEventQueueLength );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1096,10 +1096,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_QUEUE_SETS == 1 )
|
||||
xQueueSetMemberHandle MPU_xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks )
|
||||
QueueSetMember_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t xBlockTimeTicks )
|
||||
{
|
||||
xQueueSetMemberHandle xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
QueueSetMember_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueSelectFromSet( xQueueSet, xBlockTimeTicks );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1109,10 +1109,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_QUEUE_SETS == 1 )
|
||||
portBASE_TYPE MPU_xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
|
||||
BaseType_t MPU_xQueueAddToSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1122,10 +1122,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_QUEUE_SETS == 1 )
|
||||
portBASE_TYPE MPU_xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet )
|
||||
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMember_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1135,12 +1135,12 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if configUSE_ALTERNATIVE_API == 1
|
||||
signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )
|
||||
BaseType_t MPU_xQueueAltGenericSend( QueueHandle_t pxQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = signed portBASE_TYPE xQueueAltGenericSend( pxQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
|
||||
xReturn = BaseType_t xQueueAltGenericSend( pxQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -1148,10 +1148,10 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if configUSE_ALTERNATIVE_API == 1
|
||||
signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
|
||||
BaseType_t MPU_xQueueAltGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xQueueAltGenericReceive( pxQueue, pvBuffer, xTicksToWait, xJustPeeking );
|
||||
portRESET_PRIVILEGE( xRunningPrivileged );
|
||||
|
@ -1161,9 +1161,9 @@ signed portBASE_TYPE xReturn;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if configQUEUE_REGISTRY_SIZE > 0
|
||||
void MPU_vQueueAddToRegistry( xQueueHandle xQueue, char *pcName )
|
||||
void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vQueueAddToRegistry( xQueue, pcName );
|
||||
|
||||
|
@ -1172,9 +1172,9 @@ signed portBASE_TYPE xReturn;
|
|||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void MPU_vQueueDelete( xQueueHandle xQueue )
|
||||
void MPU_vQueueDelete( QueueHandle_t xQueue )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
void *MPU_pvPortMalloc( size_t xSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
pvReturn = pvPortMalloc( xSize );
|
||||
|
||||
|
@ -1197,7 +1197,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
|
||||
void MPU_vPortFree( void *pv )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vPortFree( pv );
|
||||
|
||||
|
@ -1207,7 +1207,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
|
||||
void MPU_vPortInitialiseBlocks( void )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
vPortInitialiseBlocks();
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
|||
size_t MPU_xPortGetFreeHeapSize( void )
|
||||
{
|
||||
size_t xReturn;
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
xReturn = xPortGetFreeHeapSize();
|
||||
|
||||
|
@ -1234,7 +1234,7 @@ equals the privilege state on entry. For example:
|
|||
|
||||
void MPU_FunctionName( [parameters ] )
|
||||
{
|
||||
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
|
||||
BaseType_t xRunningPrivileged = prvRaisePrivilege();
|
||||
|
||||
FunctionName( [parameters ] );
|
||||
|
||||
|
|
|
@ -87,15 +87,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -124,8 +128,8 @@ extern "C" {
|
|||
|
||||
typedef struct MPU_REGION_REGISTERS
|
||||
{
|
||||
unsigned portLONG ulRegionBaseAddress;
|
||||
unsigned portLONG ulRegionAttribute;
|
||||
uint32_t ulRegionBaseAddress;
|
||||
uint32_t ulRegionAttribute;
|
||||
} xMPU_REGION_REGISTERS;
|
||||
|
||||
/* Plus 1 to create space for the stack region. */
|
||||
|
@ -136,7 +140,7 @@ typedef struct MPU_SETTINGS
|
|||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -150,7 +154,7 @@ typedef struct MPU_SETTINGS
|
|||
#define portYIELD() __asm volatile ( " SVC %0 \n" :: "i" (portSVC_YIELD) )
|
||||
#define portYIELD_WITHIN_API() *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET
|
||||
|
||||
#define portNVIC_INT_CTRL ( ( volatile unsigned portLONG *) 0xe000ed04 )
|
||||
#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 )
|
||||
#define portNVIC_PENDSVSET 0x10000000
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET
|
||||
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||
|
|
|
@ -86,10 +86,10 @@
|
|||
#endif
|
||||
|
||||
/* Constants required to manipulate the core. Registers first... */
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) )
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) )
|
||||
/* ...then bits in the registers. */
|
||||
#define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL )
|
||||
#define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL )
|
||||
|
@ -97,21 +97,21 @@
|
|||
#define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL )
|
||||
#define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL )
|
||||
|
||||
#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
|
||||
/* Constants required to check the validity of an interrupt priority. */
|
||||
#define portFIRST_USER_INTERRUPT_NUMBER ( 16 )
|
||||
#define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 )
|
||||
#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 )
|
||||
#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 )
|
||||
#define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL )
|
||||
#define portPRIGROUP_SHIFT ( 8UL )
|
||||
|
||||
/* Constants required to manipulate the VFP. */
|
||||
#define portFPCCR ( ( volatile unsigned long * ) 0xe000ef34 ) /* Floating point context control register. */
|
||||
#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */
|
||||
#define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL )
|
||||
|
||||
/* Constants required to set up the initial stack. */
|
||||
|
@ -137,7 +137,7 @@ debugger. */
|
|||
|
||||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts. The implementation in this
|
||||
|
@ -174,7 +174,7 @@ static void prvTaskExitError( void );
|
|||
* The number of SysTick increments that make up one tick period.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulTimerCountsForOneTick = 0;
|
||||
static uint32_t ulTimerCountsForOneTick = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -182,7 +182,7 @@ static void prvTaskExitError( void );
|
|||
* 24 bit resolution of the SysTick timer.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long xMaximumPossibleSuppressedTicks = 0;
|
||||
static uint32_t xMaximumPossibleSuppressedTicks = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -190,7 +190,7 @@ static void prvTaskExitError( void );
|
|||
* power functionality only.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulStoppedTimerCompensation = 0;
|
||||
static uint32_t ulStoppedTimerCompensation = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -199,9 +199,9 @@ static void prvTaskExitError( void );
|
|||
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
|
||||
*/
|
||||
#if ( configASSERT_DEFINED == 1 )
|
||||
static unsigned char ucMaxSysCallPriority = 0;
|
||||
static unsigned long ulMaxPRIGROUPValue = 0;
|
||||
static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
static uint8_t ucMaxSysCallPriority = 0;
|
||||
static uint32_t ulMaxPRIGROUPValue = 0;
|
||||
static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -209,7 +209,7 @@ static void prvTaskExitError( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
|
@ -220,13 +220,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
*pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
|
||||
/* Save code space by skipping register initialisation. */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
|
||||
/* A save method is being used that requires each task to maintain its
|
||||
own exec return value. */
|
||||
|
@ -291,7 +291,7 @@ static void prvPortStartFirstTask( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
|
@ -299,9 +299,9 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
|
||||
#if( configASSERT_DEFINED == 1 )
|
||||
{
|
||||
volatile unsigned long ulOriginalPriority;
|
||||
volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile unsigned char ucMaxPriorityValue;
|
||||
volatile uint32_t ulOriginalPriority;
|
||||
volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile uint8_t ucMaxPriorityValue;
|
||||
|
||||
/* Determine the maximum priority from which ISR safe FreeRTOS API
|
||||
functions can be called. ISR safe functions are those that end in
|
||||
|
@ -327,7 +327,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )
|
||||
{
|
||||
ulMaxPRIGROUPValue--;
|
||||
ucMaxPriorityValue <<= ( unsigned char ) 0x01;
|
||||
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
|
||||
}
|
||||
|
||||
/* Shift the priority group value back to its position within the AIRCR
|
||||
|
@ -412,7 +412,7 @@ void vPortExitCritical( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__(( naked )) unsigned long ulPortSetInterruptMask( void )
|
||||
__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void )
|
||||
{
|
||||
__asm volatile \
|
||||
( \
|
||||
|
@ -429,7 +429,7 @@ __attribute__(( naked )) unsigned long ulPortSetInterruptMask( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__(( naked )) void vPortClearInterruptMask( unsigned long ulNewMaskValue )
|
||||
__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue )
|
||||
{
|
||||
__asm volatile \
|
||||
( \
|
||||
|
@ -521,10 +521,10 @@ void xPortSysTickHandler( void )
|
|||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
__attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||
__attribute__((weak)) void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
portTickType xModifiableIdleTime;
|
||||
uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
TickType_t xModifiableIdleTime;
|
||||
|
||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||
|
@ -610,7 +610,7 @@ void xPortSysTickHandler( void )
|
|||
|
||||
if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
|
||||
{
|
||||
unsigned long ulCalculatedLoadValue;
|
||||
uint32_t ulCalculatedLoadValue;
|
||||
|
||||
/* The tick interrupt has already executed, and the SysTick
|
||||
count reloaded with ulReloadValue. Reset the
|
||||
|
@ -711,8 +711,8 @@ static void vPortEnableVFP( void )
|
|||
|
||||
void vPortValidateInterruptPriority( void )
|
||||
{
|
||||
unsigned long ulCurrentInterrupt;
|
||||
unsigned char ucCurrentPriority;
|
||||
uint32_t ulCurrentInterrupt;
|
||||
uint8_t ucCurrentPriority;
|
||||
|
||||
/* Obtain the number of the currently executing interrupt. */
|
||||
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );
|
||||
|
|
|
@ -87,28 +87,32 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||
|
@ -118,8 +122,8 @@ extern void vPortYield( void );
|
|||
/* Critical section management. */
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( unsigned long ulNewMaskValue );
|
||||
extern uint32_t ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
|
||||
|
@ -138,7 +142,7 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
|
||||
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -147,9 +151,9 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
|
||||
|
||||
/* Generic helper function. */
|
||||
__attribute__( ( always_inline ) ) static inline unsigned char ucPortCountLeadingZeros( unsigned long ulBitmap )
|
||||
__attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
|
||||
{
|
||||
unsigned char ucReturn;
|
||||
uint8_t ucReturn;
|
||||
|
||||
__asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) );
|
||||
return ucReturn;
|
||||
|
|
|
@ -83,20 +83,20 @@ Changes from V2.6.0
|
|||
*----------------------------------------------------------*/
|
||||
|
||||
/* Start tasks with interrupts enables. */
|
||||
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 )
|
||||
#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x80 )
|
||||
|
||||
/* Hardware constants for timer 1. */
|
||||
#define portCLEAR_COUNTER_ON_MATCH ( ( unsigned char ) 0x08 )
|
||||
#define portPRESCALE_64 ( ( unsigned char ) 0x03 )
|
||||
#define portCLOCK_PRESCALER ( ( unsigned long ) 64 )
|
||||
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( unsigned char ) 0x10 )
|
||||
#define portCLEAR_COUNTER_ON_MATCH ( ( uint8_t ) 0x08 )
|
||||
#define portPRESCALE_64 ( ( uint8_t ) 0x03 )
|
||||
#define portCLOCK_PRESCALER ( ( uint32_t ) 64 )
|
||||
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( uint8_t ) 0x10 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
typedef void tskTCB;
|
||||
extern volatile tskTCB * volatile pxCurrentTCB;
|
||||
typedef void TCB_t;
|
||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -220,9 +220,9 @@ static void prvSetupTimerInterrupt( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
unsigned short usAddress;
|
||||
uint16_t usAddress;
|
||||
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
This is just useful for debugging. */
|
||||
|
@ -241,92 +241,92 @@ unsigned short usAddress;
|
|||
|
||||
/* The start of the task code will be popped off the stack last, so place
|
||||
it on first. */
|
||||
usAddress = ( unsigned short ) pxCode;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
usAddress = ( uint16_t ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Next simulate the stack as if after a call to portSAVE_CONTEXT().
|
||||
portSAVE_CONTEXT places the flags on the stack immediately after r0
|
||||
to ensure the interrupts get disabled as soon as possible, and so ensuring
|
||||
the stack use is minimal should a context switch interrupt occur. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R0 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portFLAGS_INT_ENABLED;
|
||||
pxTopOfStack--;
|
||||
|
||||
|
||||
/* Now the remaining registers. The compiler expects R1 to be 0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R13 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x13; /* R13 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x14; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R15 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x15; /* R15 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R16 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x16; /* R16 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R17 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x17; /* R17 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R18 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x18; /* R18 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R19 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x19; /* R19 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x20; /* R20 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x20; /* R20 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x21; /* R21 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x21; /* R21 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x22; /* R22 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x22; /* R22 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x23; /* R23 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x23; /* R23 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Place the parameter on the stack in the expected location. */
|
||||
usAddress = ( unsigned short ) pvParameters;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
usAddress = ( uint16_t ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x26; /* R26 X */
|
||||
*pxTopOfStack = ( StackType_t ) 0x26; /* R26 X */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x27; /* R27 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x27; /* R27 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x28; /* R28 Y */
|
||||
*pxTopOfStack = ( StackType_t ) 0x28; /* R28 Y */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x29; /* R29 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x29; /* R29 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x30; /* R30 Z */
|
||||
*pxTopOfStack = ( StackType_t ) 0x30; /* R30 Z */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x031; /* R31 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x031; /* R31 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/*lint +e950 +e611 +e923 */
|
||||
|
@ -335,7 +335,7 @@ unsigned short usAddress;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
@ -399,8 +399,8 @@ void vPortYieldFromTick( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
unsigned long ulCompareMatch;
|
||||
unsigned char ucHighByte, ucLowByte;
|
||||
uint32_t ulCompareMatch;
|
||||
uint8_t ucHighByte, ucLowByte;
|
||||
|
||||
/* Using 16bit timer 1 to generate the tick. Correct fuses must be
|
||||
selected for the configCPU_CLOCK_HZ clock. */
|
||||
|
@ -411,13 +411,13 @@ unsigned char ucHighByte, ucLowByte;
|
|||
ulCompareMatch /= portCLOCK_PRESCALER;
|
||||
|
||||
/* Adjust for correct value. */
|
||||
ulCompareMatch -= ( unsigned long ) 1;
|
||||
ulCompareMatch -= ( uint32_t ) 1;
|
||||
|
||||
/* Setup compare match value for compare match A. Interrupts are disabled
|
||||
before this is called so we need not worry here. */
|
||||
ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
|
||||
ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||
ulCompareMatch >>= 8;
|
||||
ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
|
||||
ucHighByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||
OCR1AH = ucHighByte;
|
||||
OCR1AL = ucLowByte;
|
||||
|
||||
|
|
|
@ -93,15 +93,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT int
|
||||
#define portSTACK_TYPE unsigned portCHAR
|
||||
#define portSTACK_TYPE uint8_t
|
||||
#define portBASE_TYPE char
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef signed char BaseType_t;
|
||||
typedef unsigned char UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -119,7 +123,7 @@ extern "C" {
|
|||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 1
|
||||
#define portNOP() asm volatile ( "nop" );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -96,12 +96,12 @@
|
|||
|
||||
|
||||
/* Constants required to setup the task context. */
|
||||
#define portINITIAL_SR ( ( portSTACK_TYPE ) 0x00400000 ) /* AVR32 : [M2:M0]=001 I1M=0 I0M=0, GM=0 */
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 0 )
|
||||
#define portINITIAL_SR ( ( StackType_t ) 0x00400000 ) /* AVR32 : [M2:M0]=001 I1M=0 I0M=0, GM=0 */
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 0 )
|
||||
|
||||
/* Each task maintains its own critical nesting variable. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
volatile unsigned long ulCriticalNesting = 9999UL;
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
#if( configTICK_USE_TC==0 )
|
||||
static void prvScheduleNextTick( void );
|
||||
|
@ -130,7 +130,7 @@ void _init_startup(void)
|
|||
#if configHEAP_INIT
|
||||
extern void __heap_start__;
|
||||
extern void __heap_end__;
|
||||
portBASE_TYPE *pxMem;
|
||||
BaseType_t *pxMem;
|
||||
#endif
|
||||
|
||||
/* Load the Exception Vector Base Address in the corresponding system register. */
|
||||
|
@ -145,7 +145,7 @@ void _init_startup(void)
|
|||
#if configHEAP_INIT
|
||||
|
||||
/* Initialize the heap used by malloc. */
|
||||
for( pxMem = &__heap_start__; pxMem < ( portBASE_TYPE * )&__heap_end__; )
|
||||
for( pxMem = &__heap_start__; pxMem < ( BaseType_t * )&__heap_end__; )
|
||||
{
|
||||
*pxMem++ = 0xA5A5A5A5;
|
||||
}
|
||||
|
@ -298,36 +298,36 @@ __attribute__((__noinline__)) void vPortExitCritical( void )
|
|||
*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Setup the initial stack of the task. The stack is set exactly as
|
||||
expected by the portRESTORE_CONTEXT() macro. */
|
||||
|
||||
/* When the task starts, it will expect to find the function parameter in R12. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x0A0A0A0A; /* R10 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x0B0B0B0B; /* R11 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) pvParameters; /* R12 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0xDEADBEEF; /* R14/LR */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) portINITIAL_SR; /* SR */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0xFF0000FF; /* R0 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack-- = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x0A0A0A0A; /* R10 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x0B0B0B0B; /* R11 */
|
||||
*pxTopOfStack-- = ( StackType_t ) pvParameters; /* R12 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xDEADBEEF; /* R14/LR */
|
||||
*pxTopOfStack-- = ( StackType_t ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */
|
||||
*pxTopOfStack-- = ( StackType_t ) portINITIAL_SR; /* SR */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0xFF0000FF; /* R0 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack-- = ( StackType_t ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||
here already. */
|
||||
|
@ -353,7 +353,7 @@ clock cycles from now. */
|
|||
#if( configTICK_USE_TC==0 )
|
||||
static void prvScheduleFirstTick(void)
|
||||
{
|
||||
unsigned long lCycles;
|
||||
uint32_t lCycles;
|
||||
|
||||
lCycles = Get_system_register(AVR32_COUNT);
|
||||
lCycles += (configCPU_CLOCK_HZ/configTICK_RATE_HZ);
|
||||
|
@ -368,7 +368,7 @@ clock cycles from now. */
|
|||
|
||||
__attribute__((__noinline__)) static void prvScheduleNextTick(void)
|
||||
{
|
||||
unsigned long lCycles, lCount;
|
||||
uint32_t lCycles, lCount;
|
||||
|
||||
lCycles = Get_system_register(AVR32_COMPARE);
|
||||
lCycles += (configCPU_CLOCK_HZ/configTICK_RATE_HZ);
|
||||
|
|
|
@ -105,8 +105,12 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portBASE_TYPE portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#define TASK_DELAY_MS(x) ( (x) /portTICK_RATE_MS )
|
||||
#define TASK_DELAY_S(x) ( (x)*1000 /portTICK_RATE_MS )
|
||||
|
@ -115,17 +119,17 @@ extern "C" {
|
|||
#define configTICK_TC_IRQ ATPASTE2(AVR32_TC_IRQ, configTICK_TC_CHANNEL)
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portNOP() {__asm__ __volatile__ ("nop");}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -193,7 +197,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portRESTORE_CONTEXT() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
__asm__ __volatile__ ( \
|
||||
|
@ -299,7 +303,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portSAVE_CONTEXT_OS_INT() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
/* When we come here */ \
|
||||
|
@ -351,7 +355,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portRESTORE_CONTEXT_OS_INT() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
/* Check if INT0 or higher were being handled (case where the OS tick interrupted another */ \
|
||||
|
@ -417,7 +421,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portSAVE_CONTEXT_SCALL() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
/* Warning: the stack layout after SCALL doesn't match the one after an interrupt. */ \
|
||||
|
@ -484,7 +488,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portRESTORE_CONTEXT_SCALL() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
/* Restore all registers */ \
|
||||
|
@ -576,7 +580,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portENTER_SWITCHING_ISR() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
/* When we come here */ \
|
||||
|
@ -624,7 +628,7 @@ extern void *pvPortRealloc( void *pv, size_t xSize );
|
|||
*/
|
||||
#define portEXIT_SWITCHING_ISR() \
|
||||
{ \
|
||||
extern volatile unsigned portLONG ulCriticalNesting; \
|
||||
extern volatile uint32_t ulCriticalNesting; \
|
||||
extern volatile void *volatile pxCurrentTCB; \
|
||||
\
|
||||
__asm__ __volatile__ ( \
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
static void prvSetupTimerInterrupt( void );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Make space on the stack for the context - this leaves a couple of spaces
|
||||
empty. */
|
||||
|
@ -95,7 +95,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_COD
|
|||
/* Fill the registers with known values to assist debugging. */
|
||||
pxTopOfStack[ 16 ] = 0;
|
||||
pxTopOfStack[ 15 ] = portINITIAL_PSR;
|
||||
pxTopOfStack[ 14 ] = ( unsigned long ) pxCode;
|
||||
pxTopOfStack[ 14 ] = ( uint32_t ) pxCode;
|
||||
pxTopOfStack[ 13 ] = 0x00000000UL; /* R15. */
|
||||
pxTopOfStack[ 12 ] = 0x00000000UL; /* R14. */
|
||||
pxTopOfStack[ 11 ] = 0x0d0d0d0dUL;
|
||||
|
@ -109,13 +109,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_COD
|
|||
pxTopOfStack[ 3 ] = 0x05050505UL;
|
||||
pxTopOfStack[ 2 ] = 0x04040404UL;
|
||||
pxTopOfStack[ 1 ] = 0x03030303UL;
|
||||
pxTopOfStack[ 0 ] = ( unsigned long ) pvParameters;
|
||||
pxTopOfStack[ 0 ] = ( uint32_t ) pvParameters;
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Set-up the timer interrupt. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
|
|
@ -88,21 +88,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portBASE_TYPE portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portNOP() __asm__ volatile ( "mov r0, r0" )
|
||||
#define portCRITICAL_NESTING_IN_TCB 1
|
||||
|
|
|
@ -67,40 +67,40 @@
|
|||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#define portINITIAL_FORMAT_VECTOR ( ( portSTACK_TYPE ) 0x4000 )
|
||||
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
|
||||
|
||||
/* Supervisor mode set. */
|
||||
#define portINITIAL_STATUS_REGISTER ( ( portSTACK_TYPE ) 0x2000)
|
||||
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000)
|
||||
|
||||
/* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This
|
||||
will be set to 0 prior to the first task being started. */
|
||||
static unsigned long ulCriticalNesting = 0x9999UL;
|
||||
static uint32_t ulCriticalNesting = 0x9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = (portSTACK_TYPE) 0xDEADBEEF;
|
||||
*pxTopOfStack = (StackType_t) 0xDEADBEEF;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Exception stack frame starts with the return address. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0; /*FP*/
|
||||
*pxTopOfStack = ( StackType_t ) 0x0; /*FP*/
|
||||
pxTopOfStack -= 14; /* A5 to D0. */
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void vPortStartFirstTask( void );
|
||||
|
||||
|
@ -156,7 +156,7 @@ void vPortExitCritical( void )
|
|||
|
||||
void vPortYieldHandler( void )
|
||||
{
|
||||
unsigned long ulSavedInterruptMask;
|
||||
uint32_t ulSavedInterruptMask;
|
||||
|
||||
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
/* Note this will clear all forced interrupts - this is done for speed. */
|
||||
|
|
|
@ -86,24 +86,28 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portSTACK_GROWTH -1
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
unsigned portLONG ulPortSetIPL( unsigned portLONG );
|
||||
uint32_t ulPortSetIPL( uint32_t );
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define portENABLE_INTERRUPTS() ulPortSetIPL( 0 )
|
||||
|
||||
|
@ -113,8 +117,8 @@ extern void vPortExitCritical( void );
|
|||
#define portENTER_CRITICAL() vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() vPortExitCritical()
|
||||
|
||||
extern unsigned portBASE_TYPE uxPortSetInterruptMaskFromISR( void );
|
||||
extern void vPortClearInterruptMaskFromISR( unsigned portBASE_TYPE );
|
||||
extern UBaseType_t uxPortSetInterruptMaskFromISR( void );
|
||||
extern void vPortClearInterruptMaskFromISR( UBaseType_t );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister )
|
||||
|
||||
|
|
|
@ -76,15 +76,15 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* When the task starts interrupts should be enabled. */
|
||||
#define portINITIAL_CCR ( ( portSTACK_TYPE ) 0x00 )
|
||||
#define portINITIAL_CCR ( ( StackType_t ) 0x00 )
|
||||
|
||||
/* Hardware specific constants used to generate the RTOS tick from the TPU. */
|
||||
#define portCLEAR_ON_TGRA_COMPARE_MATCH ( ( unsigned char ) 0x20 )
|
||||
#define portCLOCK_DIV_64 ( ( unsigned char ) 0x03 )
|
||||
#define portCLOCK_DIV ( ( unsigned long ) 64 )
|
||||
#define portTGRA_INTERRUPT_ENABLE ( ( unsigned char ) 0x01 )
|
||||
#define portTIMER_CHANNEL ( ( unsigned char ) 0x02 )
|
||||
#define portMSTP13 ( ( unsigned short ) 0x2000 )
|
||||
#define portCLEAR_ON_TGRA_COMPARE_MATCH ( ( uint8_t ) 0x20 )
|
||||
#define portCLOCK_DIV_64 ( ( uint8_t ) 0x03 )
|
||||
#define portCLOCK_DIV ( ( uint32_t ) 64 )
|
||||
#define portTGRA_INTERRUPT_ENABLE ( ( uint8_t ) 0x01 )
|
||||
#define portTIMER_CHANNEL ( ( uint8_t ) 0x02 )
|
||||
#define portMSTP13 ( ( uint16_t ) 0x2000 )
|
||||
|
||||
/*
|
||||
* Setup TPU channel one for the RTOS tick at the requested frequency.
|
||||
|
@ -101,12 +101,12 @@ void vPortYield( void ) __attribute__ ( ( saveall, interrupt_handler ) );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
unsigned long ulValue;
|
||||
uint32_t ulValue;
|
||||
|
||||
/* This requires an even address. */
|
||||
ulValue = ( unsigned long ) pxTopOfStack;
|
||||
ulValue = ( uint32_t ) pxTopOfStack;
|
||||
if( ulValue & 1UL )
|
||||
{
|
||||
pxTopOfStack = pxTopOfStack - 1;
|
||||
|
@ -125,16 +125,16 @@ unsigned long ulValue;
|
|||
|
||||
/* The initial stack mimics an interrupt stack. First there is the program
|
||||
counter (24 bits). */
|
||||
ulValue = ( unsigned long ) pxCode;
|
||||
ulValue = ( uint32_t ) pxCode;
|
||||
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
pxTopOfStack--;
|
||||
ulValue >>= 8UL;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
pxTopOfStack--;
|
||||
ulValue >>= 8UL;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
|
||||
/* Followed by the CCR. */
|
||||
pxTopOfStack--;
|
||||
|
@ -155,19 +155,19 @@ unsigned long ulValue;
|
|||
*pxTopOfStack = 0x66;
|
||||
|
||||
/* ER0 */
|
||||
ulValue = ( unsigned long ) pvParameters;
|
||||
ulValue = ( uint32_t ) pvParameters;
|
||||
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
pxTopOfStack--;
|
||||
ulValue >>= 8UL;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
pxTopOfStack--;
|
||||
ulValue >>= 8UL;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
pxTopOfStack--;
|
||||
ulValue >>= 8UL;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( ulValue & 0xff );
|
||||
*pxTopOfStack = ( StackType_t ) ( ulValue & 0xff );
|
||||
|
||||
/* ER1 */
|
||||
pxTopOfStack--;
|
||||
|
@ -223,7 +223,7 @@ unsigned long ulValue;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void * pxCurrentTCB;
|
||||
|
||||
|
@ -319,7 +319,7 @@ void vPortYield( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
const unsigned long ulCompareMatch = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / portCLOCK_DIV;
|
||||
const uint32_t ulCompareMatch = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / portCLOCK_DIV;
|
||||
|
||||
/* Turn the module on. */
|
||||
MSTPCR &= ~portMSTP13;
|
||||
|
|
|
@ -87,22 +87,26 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portCHAR
|
||||
#define portSTACK_TYPE uint8_t
|
||||
#define portBASE_TYPE char
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef signed char BaseType_t;
|
||||
typedef unsigned char UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portYIELD() asm volatile( "TRAPA #0" )
|
||||
#define portNOP() asm volatile( "NOP" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -96,7 +96,7 @@ void ATTR_NEAR vPortYield( void );
|
|||
void ATTR_NEAR vPortTickInterrupt( void );
|
||||
|
||||
/* Function in non-banked memory which actually switches to first task. */
|
||||
portBASE_TYPE ATTR_NEAR xStartSchedulerNear( void );
|
||||
BaseType_t ATTR_NEAR xStartSchedulerNear( void );
|
||||
|
||||
/* Calls to portENTER_CRITICAL() can be nested. When they are nested the
|
||||
critical section should not be left (i.e. interrupts should not be re-enabled)
|
||||
|
@ -104,14 +104,14 @@ until the nesting depth reaches 0. This variable simply tracks the nesting
|
|||
depth. Each task maintains it's own critical nesting depth variable so
|
||||
uxCriticalNesting is saved and restored from the task stack during a context
|
||||
switch. */
|
||||
volatile unsigned portBASE_TYPE uxCriticalNesting = 0x80; // un-initialized
|
||||
volatile UBaseType_t uxCriticalNesting = 0x80; // un-initialized
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
|
||||
|
||||
|
@ -121,28 +121,28 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
|
||||
|
||||
/* The address of the task function is placed in the stack byte at a time. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 1 );
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pxCode) ) + 0 );
|
||||
*pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 1 );
|
||||
*--pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pxCode) ) + 0 );
|
||||
|
||||
/* Next are all the registers that form part of the task context. */
|
||||
|
||||
/* Y register */
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) 0xff;
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) 0xee;
|
||||
*--pxTopOfStack = ( StackType_t ) 0xff;
|
||||
*--pxTopOfStack = ( StackType_t ) 0xee;
|
||||
|
||||
/* X register */
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) 0xdd;
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) 0xcc;
|
||||
*--pxTopOfStack = ( StackType_t ) 0xdd;
|
||||
*--pxTopOfStack = ( StackType_t ) 0xcc;
|
||||
|
||||
/* A register contains parameter high byte. */
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 0 );
|
||||
*--pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 0 );
|
||||
|
||||
/* B register contains parameter low byte. */
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) *( ((portSTACK_TYPE *) (&pvParameters) ) + 1 );
|
||||
*--pxTopOfStack = ( StackType_t ) *( ((StackType_t *) (&pvParameters) ) + 1 );
|
||||
|
||||
/* CCR: Note that when the task starts interrupts will be enabled since
|
||||
"I" bit of CCR is cleared */
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) 0x80; // keeps Stop disabled (MCU default)
|
||||
*--pxTopOfStack = ( StackType_t ) 0x80; // keeps Stop disabled (MCU default)
|
||||
|
||||
/* tmp softregs used by GCC. Values right now don't matter. */
|
||||
__asm("\n\
|
||||
|
@ -161,7 +161,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
|
||||
/* The critical nesting depth is initialised with 0 (meaning not in
|
||||
a critical section). */
|
||||
*--pxTopOfStack = ( portSTACK_TYPE ) 0x00;
|
||||
*--pxTopOfStack = ( StackType_t ) 0x00;
|
||||
|
||||
|
||||
return pxTopOfStack;
|
||||
|
@ -183,7 +183,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* xPortStartScheduler() does not start the scheduler directly because
|
||||
the header file containing the xPortStartScheduler() prototype is part
|
||||
|
@ -191,13 +191,13 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
Instead it simply calls the locally defined xNearStartScheduler() -
|
||||
which does use the CODE_SEG pragma. */
|
||||
|
||||
short register d;
|
||||
int16_t register d;
|
||||
__asm ("jmp xStartSchedulerNear ; will never return": "=d"(d));
|
||||
return d;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xStartSchedulerNear( void )
|
||||
BaseType_t xStartSchedulerNear( void )
|
||||
{
|
||||
/* Configure the timer that will generate the RTOS tick. Interrupts are
|
||||
disabled when this function is called. */
|
||||
|
|
|
@ -87,22 +87,27 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portCHAR
|
||||
#define portSTACK_TYPE uint8_t
|
||||
#define portBASE_TYPE char
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef signed char BaseType_t;
|
||||
typedef unsigned char UBaseType_t;
|
||||
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 1
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portYIELD() __asm( "swi" );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -118,7 +123,7 @@ extern "C" {
|
|||
*/
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
uxCriticalNesting++; \
|
||||
|
@ -131,7 +136,7 @@ extern "C" {
|
|||
*/
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
\
|
||||
uxCriticalNesting--; \
|
||||
if( uxCriticalNesting == 0 ) \
|
||||
|
|
|
@ -58,9 +58,9 @@
|
|||
#include "task.h"
|
||||
|
||||
/* ------------------------ Types ----------------------------------------- */
|
||||
typedef volatile unsigned long vuint32;
|
||||
typedef volatile unsigned short vuint16;
|
||||
typedef volatile unsigned char vuint8;
|
||||
typedef volatile uint32_t vuint32;
|
||||
typedef volatile uint16_t vuint16;
|
||||
typedef volatile uint8_t vuint8;
|
||||
|
||||
/* ------------------------ Defines --------------------------------------- */
|
||||
#define portVECTOR_TABLE __RAMVEC
|
||||
|
@ -86,11 +86,11 @@ typedef volatile unsigned char vuint8;
|
|||
#define MCF_INTC0_ICRn_IP(x) ( ( ( x ) & 0x07 ) << 0 )
|
||||
#define MCF_INTC0_ICRn_IL(x) ( ( ( x ) & 0x07 ) << 3 )
|
||||
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
#define portINITIAL_CRITICAL_NESTING ( ( unsigned long ) 10 )
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
#define portINITIAL_CRITICAL_NESTING ( ( uint32_t ) 10 )
|
||||
|
||||
/* ------------------------ Static variables ------------------------------ */
|
||||
volatile unsigned long ulCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
volatile uint32_t ulCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
|
||||
/* ------------------------ Static functions ------------------------------ */
|
||||
#if configUSE_PREEMPTION == 0
|
||||
|
@ -101,22 +101,22 @@ static void prvPortPreemptiveTick ( void );
|
|||
|
||||
/* ------------------------ Start implementation -------------------------- */
|
||||
|
||||
portSTACK_TYPE *
|
||||
pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode,
|
||||
StackType_t *
|
||||
pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode,
|
||||
void *pvParameters )
|
||||
{
|
||||
/* Place the parameter on the stack in the expected location. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Place dummy return address on stack. Tasks should never terminate so
|
||||
* we can set this to anything. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0;
|
||||
*pxTopOfStack = ( StackType_t ) 0;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Create a Motorola Coldfire exception stack frame. First comes the return
|
||||
* address. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Format, fault-status, vector number for exception stack frame. Task
|
||||
|
@ -129,35 +129,35 @@ pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode,
|
|||
*pxTopOfStack = 0;
|
||||
*pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA6; /* A6 / FP */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA6; /* A6 / FP */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA5; /* A5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA5; /* A5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA4; /* A4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA4; /* A4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA3; /* A3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA3; /* A3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA2; /* A2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA2; /* A2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA1; /* A1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA1; /* A1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xA0; /* A0 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xA0; /* A0 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD7; /* D7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD7; /* D7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD6; /* D6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD6; /* D6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD5; /* D5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD5; /* D5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD4; /* D4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD4; /* D4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD3; /* D3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD3; /* D3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD2; /* D2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD2; /* D2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD1; /* D1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD1; /* D1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xD0; /* D0 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xD0; /* D0 */
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ vPortExitCritical()
|
|||
}
|
||||
}
|
||||
|
||||
portBASE_TYPE
|
||||
BaseType_t
|
||||
xPortStartScheduler( void )
|
||||
{
|
||||
extern void ( *portVECTOR_TABLE[ ] ) ( );
|
||||
|
|
|
@ -67,17 +67,21 @@ extern "C" {
|
|||
#define portSTACK_TYPE unsigned int
|
||||
#define portBASE_TYPE int
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
|
||||
/* ------------------------ Architecture specifics ------------------------ */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
|
||||
#define portTRAP_YIELD 0 /* Trap 0 */
|
||||
|
@ -160,7 +164,7 @@ extern "C" {
|
|||
/* ------------------------ Function prototypes --------------------------- */
|
||||
void vPortEnterCritical( void );
|
||||
void vPortExitCritical( void );
|
||||
int asm_set_ipl( unsigned long int uiNewIPL );
|
||||
int asm_set_ipl( uint32_t int uiNewIPL );
|
||||
|
||||
/* ------------------------ Compiler specifics ---------------------------- */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) \
|
||||
|
|
|
@ -83,14 +83,14 @@
|
|||
|
||||
/* Constants required for hardware setup. The tick ISR runs off the ACLK,
|
||||
not the MCLK. */
|
||||
#define portACLK_FREQUENCY_HZ ( ( portTickType ) 32768 )
|
||||
#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 )
|
||||
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x08 )
|
||||
#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 )
|
||||
#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 )
|
||||
#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 )
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
typedef void tskTCB;
|
||||
extern volatile tskTCB * volatile pxCurrentTCB;
|
||||
typedef void TCB_t;
|
||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||
|
||||
/* Most ports implement critical sections by placing the interrupt flags on
|
||||
the stack before disabling interrupts. Exiting the critical section is then
|
||||
|
@ -104,7 +104,7 @@ with interrupts only being re-enabled if the count is zero.
|
|||
usCriticalNesting will get set to zero when the scheduler starts, but must
|
||||
not be initialised to zero as this will cause problems during the startup
|
||||
sequence. */
|
||||
volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
@ -178,17 +178,17 @@ static void prvSetupTimerInterrupt( void );
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/*
|
||||
Place a few bytes of known values on the bottom of the stack.
|
||||
This is just useful for debugging and can be included if required.
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1111;
|
||||
*pxTopOfStack = ( StackType_t ) 0x1111;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x2222;
|
||||
*pxTopOfStack = ( StackType_t ) 0x2222;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x3333;
|
||||
*pxTopOfStack = ( StackType_t ) 0x3333;
|
||||
pxTopOfStack--;
|
||||
*/
|
||||
|
||||
|
@ -196,38 +196,38 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
executing an ISR. We want the stack to look just as if this has happened
|
||||
so place a pointer to the start of the task on the stack first - followed
|
||||
by the flags we want the task to use when it starts up. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portFLAGS_INT_ENABLED;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Next the general purpose registers. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x4444;
|
||||
*pxTopOfStack = ( StackType_t ) 0x4444;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x5555;
|
||||
*pxTopOfStack = ( StackType_t ) 0x5555;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x6666;
|
||||
*pxTopOfStack = ( StackType_t ) 0x6666;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x7777;
|
||||
*pxTopOfStack = ( StackType_t ) 0x7777;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x8888;
|
||||
*pxTopOfStack = ( StackType_t ) 0x8888;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x9999;
|
||||
*pxTopOfStack = ( StackType_t ) 0x9999;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa;
|
||||
*pxTopOfStack = ( StackType_t ) 0xaaaa;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb;
|
||||
*pxTopOfStack = ( StackType_t ) 0xbbbb;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xcccc;
|
||||
*pxTopOfStack = ( StackType_t ) 0xcccc;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xdddd;
|
||||
*pxTopOfStack = ( StackType_t ) 0xdddd;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xeeee;
|
||||
*pxTopOfStack = ( StackType_t ) 0xeeee;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* When the task starts is will expect to find the function parameter in
|
||||
R15. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The code generated by the mspgcc compiler does not maintain separate
|
||||
|
@ -235,7 +235,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
use the stack as per other ports. Instead a variable is used to keep
|
||||
track of the critical section nesting. This variable has to be stored
|
||||
as part of the task context and is initially set to zero. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;
|
||||
*pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
|
||||
/* Return a pointer to the top of the stack we have generated so this can
|
||||
be stored in the task control block for the task. */
|
||||
|
@ -243,7 +243,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. Interrupts are disabled when
|
||||
this function is called. */
|
||||
|
|
|
@ -86,15 +86,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT int
|
||||
#define portSTACK_TYPE unsigned portSHORT
|
||||
#define portBASE_TYPE portSHORT
|
||||
#define portSTACK_TYPE uint16_t
|
||||
#define portBASE_TYPE short
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef short BaseType_t;
|
||||
typedef unsigned short UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -104,11 +108,11 @@ extern "C" {
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Critical section control macros. */
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
|
||||
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portSHORT usCriticalNesting; \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
|
@ -120,7 +124,7 @@ extern volatile unsigned portSHORT usCriticalNesting; \
|
|||
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portSHORT usCriticalNesting; \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
|
@ -146,7 +150,7 @@ extern void vPortYield( void ) __attribute__ ( ( naked ) );
|
|||
/* Hardwware specifics. */
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
#include <xtmrctr.h>
|
||||
|
||||
/* Tasks are started with interrupts enabled. */
|
||||
#define portINITIAL_MSR_STATE ( ( portSTACK_TYPE ) 0x02 )
|
||||
#define portINITIAL_MSR_STATE ( ( StackType_t ) 0x02 )
|
||||
|
||||
/* Tasks are started with a critical section nesting of 0 - however prior
|
||||
to the scheduler being commenced we don't want the critical nesting level
|
||||
|
@ -98,11 +98,11 @@ debugging. */
|
|||
/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task
|
||||
maintains it's own count, so this variable is saved as part of the task
|
||||
context. */
|
||||
volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;
|
||||
volatile UBaseType_t uxCriticalNesting = portINITIAL_NESTING_VALUE;
|
||||
|
||||
/* To limit the amount of stack required by each task, this port uses a
|
||||
separate stack for interrupts. */
|
||||
unsigned long *pulISRStack;
|
||||
uint32_t *pulISRStack;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -119,93 +119,93 @@ static void prvSetupTimerInterrupt( void );
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
extern void *_SDA2_BASE_, *_SDA_BASE_;
|
||||
const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_;
|
||||
const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
||||
const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_;
|
||||
const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
|
||||
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
This is essential for the Microblaze port and these lines must
|
||||
not be omitted. The parameter value will overwrite the
|
||||
0x22222222 value during the function prologue. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111;
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x22222222;
|
||||
*pxTopOfStack = ( StackType_t ) 0x22222222;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x33333333;
|
||||
*pxTopOfStack = ( StackType_t ) 0x33333333;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* First stack an initial value for the critical section nesting. This
|
||||
is initialised to zero as tasks are started with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R0. */
|
||||
|
||||
/* Place an initial value for all the general purpose registers. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ulR2; /* R2 - small data area. */
|
||||
*pxTopOfStack = ( StackType_t ) ulR2; /* R2 - small data area. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03; /* R3. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04; /* R4. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;/* R5 contains the function call parameters. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06; /* R6. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07; /* R7. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08; /* R8. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09; /* R9. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0a; /* R10. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0a; /* R10. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0b; /* R11. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0b; /* R11. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0c; /* R12. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0c; /* R12. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - small data read write area. */
|
||||
*pxTopOfStack = ( StackType_t ) ulR13; /* R13 - small data read write area. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14. */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* R14. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0f; /* R15. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0f; /* R15. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10; /* R16. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R17. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11; /* R17. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12; /* R18. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R19. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x13; /* R19. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x14; /* R20. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R21. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x15; /* R21. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R22. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x16; /* R22. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R23. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x17; /* R23. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R24. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x18; /* R24. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R25. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x19; /* R25. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1a; /* R26. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1a; /* R26. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1b; /* R27. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1b; /* R27. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1c; /* R28. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1c; /* R28. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1d; /* R29. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1d; /* R29. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1e; /* R30. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1e; /* R30. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The MSR is stacked between R30 and R31. */
|
||||
*pxTopOfStack = portINITIAL_MSR_STATE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1f; /* R31. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1f; /* R31. */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Return a pointer to the top of the stack we have generated so this can
|
||||
|
@ -214,7 +214,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void ( __FreeRTOS_interrupt_Handler )( void );
|
||||
extern void ( vStartFirstTask )( void );
|
||||
|
@ -232,13 +232,13 @@ extern void ( vStartFirstTask )( void );
|
|||
prvSetupTimerInterrupt();
|
||||
|
||||
/* Allocate the stack to be used by the interrupt handler. */
|
||||
pulISRStack = ( unsigned long * ) pvPortMalloc( configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ) );
|
||||
pulISRStack = ( uint32_t * ) pvPortMalloc( configMINIMAL_STACK_SIZE * sizeof( StackType_t ) );
|
||||
|
||||
/* Restore the context of the first task that is going to run. */
|
||||
if( pulISRStack != NULL )
|
||||
{
|
||||
/* Fill the ISR stack with a known value to facilitate debugging. */
|
||||
memset( pulISRStack, portISR_STACK_FILL_VALUE, configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ) );
|
||||
memset( pulISRStack, portISR_STACK_FILL_VALUE, configMINIMAL_STACK_SIZE * sizeof( StackType_t ) );
|
||||
pulISRStack += ( configMINIMAL_STACK_SIZE - 1 );
|
||||
|
||||
/* Kick off the first task. */
|
||||
|
@ -281,8 +281,8 @@ extern void VPortYieldASM( void );
|
|||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
XTmrCtr xTimer;
|
||||
const unsigned long ulCounterValue = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
|
||||
unsigned portBASE_TYPE uxMask;
|
||||
const uint32_t ulCounterValue = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
|
||||
UBaseType_t uxMask;
|
||||
|
||||
/* The OPB timer1 is used to generate the tick. Use the provided library
|
||||
functions to enable the timer and set the tick frequency. */
|
||||
|
@ -311,7 +311,7 @@ unsigned portBASE_TYPE uxMask;
|
|||
*/
|
||||
void vTaskISRHandler( void )
|
||||
{
|
||||
static unsigned long ulPending;
|
||||
static uint32_t ulPending;
|
||||
|
||||
/* Which interrupts are pending? */
|
||||
ulPending = XIntc_In32( ( XPAR_INTC_SINGLE_BASEADDR + XIN_IVR_OFFSET ) );
|
||||
|
@ -320,12 +320,12 @@ static unsigned long ulPending;
|
|||
{
|
||||
static XIntc_VectorTableEntry *pxTablePtr;
|
||||
static XIntc_Config *pxConfig;
|
||||
static unsigned long ulInterruptMask;
|
||||
static uint32_t ulInterruptMask;
|
||||
|
||||
ulInterruptMask = ( unsigned long ) 1 << ulPending;
|
||||
ulInterruptMask = ( uint32_t ) 1 << ulPending;
|
||||
|
||||
/* Get the configuration data using the device ID */
|
||||
pxConfig = &XIntc_ConfigTable[ ( unsigned long ) XPAR_INTC_SINGLE_DEVICE_ID ];
|
||||
pxConfig = &XIntc_ConfigTable[ ( uint32_t ) XPAR_INTC_SINGLE_DEVICE_ID ];
|
||||
|
||||
pxTablePtr = &( pxConfig->HandlerTable[ ulPending ] );
|
||||
if( pxConfig->AckBeforeService & ( ulInterruptMask ) )
|
||||
|
@ -347,7 +347,7 @@ static unsigned long ulPending;
|
|||
*/
|
||||
void vTickISR( void *pvBaseAddress )
|
||||
{
|
||||
unsigned long ulCSR;
|
||||
uint32_t ulCSR;
|
||||
|
||||
/* Increment the RTOS tick - this might cause a task to unblock. */
|
||||
if( xTaskIncrementTick() != pdFALSE )
|
||||
|
|
|
@ -86,15 +86,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portBASE_TYPE portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -109,13 +113,13 @@ void microblaze_enable_interrupts( void );
|
|||
void vPortEnterCritical( void );
|
||||
void vPortExitCritical( void );
|
||||
#define portENTER_CRITICAL() { \
|
||||
extern unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern UBaseType_t uxCriticalNesting; \
|
||||
microblaze_disable_interrupts(); \
|
||||
uxCriticalNesting++; \
|
||||
}
|
||||
|
||||
#define portEXIT_CRITICAL() { \
|
||||
extern unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern UBaseType_t uxCriticalNesting; \
|
||||
/* Interrupts are disabled, so we can */ \
|
||||
/* access the variable directly. */ \
|
||||
uxCriticalNesting--; \
|
||||
|
@ -140,7 +144,7 @@ void vTaskSwitchContext();
|
|||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -98,24 +98,24 @@ created. */
|
|||
/*
|
||||
* Initialise the interrupt controller instance.
|
||||
*/
|
||||
static long prvInitialiseInterruptController( void );
|
||||
static int32_t prvInitialiseInterruptController( void );
|
||||
|
||||
/* Ensure the interrupt controller instance variable is initialised before it is
|
||||
* used, and that the initialisation only happens once.
|
||||
*/
|
||||
static long prvEnsureInterruptControllerIsInitialised( void );
|
||||
static int32_t prvEnsureInterruptControllerIsInitialised( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task
|
||||
maintains its own count, so this variable is saved as part of the task
|
||||
context. */
|
||||
volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;
|
||||
volatile UBaseType_t uxCriticalNesting = portINITIAL_NESTING_VALUE;
|
||||
|
||||
/* This port uses a separate stack for interrupts. This prevents the stack of
|
||||
every task needing to be large enough to hold an entire interrupt stack on top
|
||||
of the task stack. */
|
||||
unsigned long *pulISRStack;
|
||||
uint32_t *pulISRStack;
|
||||
|
||||
/* If an interrupt requests a context switch, then ulTaskSwitchRequested will
|
||||
get set to 1. ulTaskSwitchRequested is inspected just before the main interrupt
|
||||
|
@ -125,7 +125,7 @@ the interrupt exists is the highest priority task that is able to run. This is
|
|||
an unusual mechanism, but is used for this port because a single interrupt can
|
||||
cause the servicing of multiple peripherals - and it is inefficient to call
|
||||
vTaskSwitchContext() multiple times as each peripheral is serviced. */
|
||||
volatile unsigned long ulTaskSwitchRequested = 0UL;
|
||||
volatile uint32_t ulTaskSwitchRequested = 0UL;
|
||||
|
||||
/* The instance of the interrupt controller used by this port. This is required
|
||||
by the Xilinx library API functions. */
|
||||
|
@ -139,20 +139,20 @@ static XIntc xInterruptControllerInstance;
|
|||
*
|
||||
* See the portable.h header file.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
extern void *_SDA2_BASE_, *_SDA_BASE_;
|
||||
const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_;
|
||||
const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
||||
const uint32_t ulR2 = ( uint32_t ) &_SDA2_BASE_;
|
||||
const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
|
||||
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
This is essential for the Microblaze port and these lines must
|
||||
not be omitted. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000;
|
||||
pxTopOfStack--;
|
||||
|
||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
||||
|
@ -169,86 +169,86 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
|||
|
||||
/* First stack an initial value for the critical section nesting. This
|
||||
is initialised to zero. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00;
|
||||
|
||||
/* R0 is always zero. */
|
||||
/* R1 is the SP. */
|
||||
|
||||
/* Place an initial value for all the general purpose registers. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ulR2; /* R2 - read only small data area. */
|
||||
*pxTopOfStack = ( StackType_t ) ulR2; /* R2 - read only small data area. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 - return values and temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03; /* R3 - return values and temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 - return values and temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04; /* R4 - return values and temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;/* R5 contains the function call parameters. */
|
||||
|
||||
#ifdef portPRE_LOAD_STACK_FOR_DEBUGGING
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 - other parameters and temporaries. Used as the return address from vPortTaskEntryPoint. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06; /* R6 - other parameters and temporaries. Used as the return address from vPortTaskEntryPoint. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 - other parameters and temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07; /* R7 - other parameters and temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 - other parameters and temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08; /* R8 - other parameters and temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 - other parameters and temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09; /* R9 - other parameters and temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0a; /* R10 - other parameters and temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0a; /* R10 - other parameters and temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0b; /* R11 - temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0b; /* R11 - temporaries. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0c; /* R12 - temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0c; /* R12 - temporaries. */
|
||||
pxTopOfStack--;
|
||||
#else
|
||||
pxTopOfStack-= 8;
|
||||
#endif
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - read/write small data area. */
|
||||
*pxTopOfStack = ( StackType_t ) ulR13; /* R13 - read/write small data area. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* R14 - return address for interrupt. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) NULL; /* R15 - return address for subroutine. */
|
||||
*pxTopOfStack = ( StackType_t ) NULL; /* R15 - return address for subroutine. */
|
||||
|
||||
#ifdef portPRE_LOAD_STACK_FOR_DEBUGGING
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10; /* R16 - return address for trap (debugger). */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R17 - return address for exceptions, if configured. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11; /* R17 - return address for exceptions, if configured. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */
|
||||
pxTopOfStack--;
|
||||
#else
|
||||
pxTopOfStack -= 4;
|
||||
#endif
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */
|
||||
|
||||
#ifdef portPRE_LOAD_STACK_FOR_DEBUGGING
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R21 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x15; /* R21 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R22 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x16; /* R22 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R23 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x17; /* R23 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R24 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x18; /* R24 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R25 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x19; /* R25 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1a; /* R26 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1a; /* R26 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1b; /* R27 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1b; /* R27 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1c; /* R28 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1c; /* R28 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1d; /* R29 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1d; /* R29 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1e; /* R30 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1e; /* R30 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1f; /* R31 - must be saved across function calls. Callee-save. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x1f; /* R31 - must be saved across function calls. Callee-save. */
|
||||
pxTopOfStack--;
|
||||
#else
|
||||
pxTopOfStack -= 13;
|
||||
|
@ -260,10 +260,10 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void ( vPortStartFirstTask )( void );
|
||||
extern unsigned long _stack[];
|
||||
extern uint32_t _stack[];
|
||||
|
||||
/* Setup the hardware to generate the tick. Interrupts are disabled when
|
||||
this function is called.
|
||||
|
@ -277,7 +277,7 @@ extern unsigned long _stack[];
|
|||
vApplicationSetupTimerInterrupt();
|
||||
|
||||
/* Reuse the stack from main() as the stack for the interrupts/exceptions. */
|
||||
pulISRStack = ( unsigned long * ) _stack;
|
||||
pulISRStack = ( uint32_t * ) _stack;
|
||||
|
||||
/* Ensure there is enough space for the functions called from the interrupt
|
||||
service routines to write back into the stack frame of the caller. */
|
||||
|
@ -321,9 +321,9 @@ extern void VPortYieldASM( void );
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortEnableInterrupt( unsigned char ucInterruptID )
|
||||
void vPortEnableInterrupt( uint8_t ucInterruptID )
|
||||
{
|
||||
long lReturn;
|
||||
int32_t lReturn;
|
||||
|
||||
/* An API function is provided to enable an interrupt in the interrupt
|
||||
controller because the interrupt controller instance variable is private
|
||||
|
@ -338,9 +338,9 @@ long lReturn;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortDisableInterrupt( unsigned char ucInterruptID )
|
||||
void vPortDisableInterrupt( uint8_t ucInterruptID )
|
||||
{
|
||||
long lReturn;
|
||||
int32_t lReturn;
|
||||
|
||||
/* An API function is provided to disable an interrupt in the interrupt
|
||||
controller because the interrupt controller instance variable is private
|
||||
|
@ -356,9 +356,9 @@ long lReturn;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef )
|
||||
BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef )
|
||||
{
|
||||
long lReturn;
|
||||
int32_t lReturn;
|
||||
|
||||
/* An API function is provided to install an interrupt handler because the
|
||||
interrupt controller instance variable is private to this file. */
|
||||
|
@ -381,10 +381,10 @@ long lReturn;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static long prvEnsureInterruptControllerIsInitialised( void )
|
||||
static int32_t prvEnsureInterruptControllerIsInitialised( void )
|
||||
{
|
||||
static long lInterruptControllerInitialised = pdFALSE;
|
||||
long lReturn;
|
||||
static int32_t lInterruptControllerInitialised = pdFALSE;
|
||||
int32_t lReturn;
|
||||
|
||||
/* Ensure the interrupt controller instance variable is initialised before
|
||||
it is used, and that the initialisation only happens once. */
|
||||
|
@ -434,9 +434,9 @@ extern void vApplicationClearTimerInterrupt( void );
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static long prvInitialiseInterruptController( void )
|
||||
static int32_t prvInitialiseInterruptController( void )
|
||||
{
|
||||
long lStatus;
|
||||
int32_t lStatus;
|
||||
|
||||
lStatus = XIntc_Initialize( &xInterruptControllerInstance, configINTERRUPT_CONTROLLER_TO_USE );
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ configINSTALL_EXCEPTION_HANDLERS is not set to 1. */
|
|||
|
||||
/* This variable is set in the exception entry code, before
|
||||
vPortExceptionHandler is called. */
|
||||
unsigned long *pulStackPointerOnFunctionEntry = NULL;
|
||||
uint32_t *pulStackPointerOnFunctionEntry = NULL;
|
||||
|
||||
/* This is the structure that is filled with the MicroBlaze context as it
|
||||
existed immediately prior to the exception occurrence. A pointer to this
|
||||
|
@ -186,7 +186,7 @@ extern void *pxCurrentTCB;
|
|||
xRegisterDump.ulR29 = mfgpr( R29 );
|
||||
xRegisterDump.ulR30 = mfgpr( R30 );
|
||||
xRegisterDump.ulR31 = mfgpr( R31 );
|
||||
xRegisterDump.ulR1_SP = ( ( unsigned long ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE;
|
||||
xRegisterDump.ulR1_SP = ( ( uint32_t ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE;
|
||||
xRegisterDump.ulEAR = mfear();
|
||||
xRegisterDump.ulESR = mfesr();
|
||||
xRegisterDump.ulEDR = mfedr();
|
||||
|
@ -209,40 +209,40 @@ extern void *pxCurrentTCB;
|
|||
/* Also fill in a string that describes what type of exception this is.
|
||||
The string uses the same ID names as defined in the MicroBlaze standard
|
||||
library exception header files. */
|
||||
switch( ( unsigned long ) pvExceptionID )
|
||||
switch( ( uint32_t ) pvExceptionID )
|
||||
{
|
||||
case XEXC_ID_FSL :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_FSL";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FSL";
|
||||
break;
|
||||
|
||||
case XEXC_ID_UNALIGNED_ACCESS :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_UNALIGNED_ACCESS";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_UNALIGNED_ACCESS";
|
||||
break;
|
||||
|
||||
case XEXC_ID_ILLEGAL_OPCODE :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_ILLEGAL_OPCODE";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_ILLEGAL_OPCODE";
|
||||
break;
|
||||
|
||||
case XEXC_ID_M_AXI_I_EXCEPTION :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_M_AXI_I_EXCEPTION or XEXC_ID_IPLB_EXCEPTION";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_M_AXI_I_EXCEPTION or XEXC_ID_IPLB_EXCEPTION";
|
||||
break;
|
||||
|
||||
case XEXC_ID_M_AXI_D_EXCEPTION :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_M_AXI_D_EXCEPTION or XEXC_ID_DPLB_EXCEPTION";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_M_AXI_D_EXCEPTION or XEXC_ID_DPLB_EXCEPTION";
|
||||
break;
|
||||
|
||||
case XEXC_ID_DIV_BY_ZERO :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_DIV_BY_ZERO";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_DIV_BY_ZERO";
|
||||
break;
|
||||
|
||||
case XEXC_ID_STACK_VIOLATION :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU";
|
||||
break;
|
||||
|
||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
||||
|
||||
case XEXC_ID_FPU :
|
||||
xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_FPU see ulFSR value";
|
||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value";
|
||||
break;
|
||||
|
||||
#endif /* XPAR_MICROBLAZE_0_USE_FPU */
|
||||
|
@ -265,7 +265,7 @@ extern void *pxCurrentTCB;
|
|||
|
||||
void vPortExceptionsInstallHandlers( void )
|
||||
{
|
||||
static unsigned long ulHandlersAlreadyInstalled = pdFALSE;
|
||||
static uint32_t ulHandlersAlreadyInstalled = pdFALSE;
|
||||
|
||||
if( ulHandlersAlreadyInstalled == pdFALSE )
|
||||
{
|
||||
|
|
|
@ -90,15 +90,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -114,13 +118,13 @@ void microblaze_enable_interrupts( void );
|
|||
void vPortEnterCritical( void );
|
||||
void vPortExitCritical( void );
|
||||
#define portENTER_CRITICAL() { \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
microblaze_disable_interrupts(); \
|
||||
uxCriticalNesting++; \
|
||||
}
|
||||
|
||||
#define portEXIT_CRITICAL() { \
|
||||
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
|
||||
extern volatile UBaseType_t uxCriticalNesting; \
|
||||
/* Interrupts are disabled, so we can */ \
|
||||
/* access the variable directly. */ \
|
||||
uxCriticalNesting--; \
|
||||
|
@ -144,14 +148,14 @@ then checks this flag, and calls vTaskSwitchContext() before restoring a task
|
|||
context, if the flag is not false. This is done to prevent multiple calls to
|
||||
vTaskSwitchContext() being made from a single interrupt, as a single interrupt
|
||||
can result in multiple peripherals being serviced. */
|
||||
extern volatile unsigned long ulTaskSwitchRequested;
|
||||
extern volatile uint32_t ulTaskSwitchRequested;
|
||||
#define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) ulTaskSwitchRequested = 1
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -167,53 +171,53 @@ typedef struct PORT_REGISTER_DUMP
|
|||
{
|
||||
/* The following structure members hold the values of the MicroBlaze
|
||||
registers at the time the exception was raised. */
|
||||
unsigned long ulR1_SP;
|
||||
unsigned long ulR2_small_data_area;
|
||||
unsigned long ulR3;
|
||||
unsigned long ulR4;
|
||||
unsigned long ulR5;
|
||||
unsigned long ulR6;
|
||||
unsigned long ulR7;
|
||||
unsigned long ulR8;
|
||||
unsigned long ulR9;
|
||||
unsigned long ulR10;
|
||||
unsigned long ulR11;
|
||||
unsigned long ulR12;
|
||||
unsigned long ulR13_read_write_small_data_area;
|
||||
unsigned long ulR14_return_address_from_interrupt;
|
||||
unsigned long ulR15_return_address_from_subroutine;
|
||||
unsigned long ulR16_return_address_from_trap;
|
||||
unsigned long ulR17_return_address_from_exceptions; /* The exception entry code will copy the BTR into R17 if the exception occurred in the delay slot of a branch instruction. */
|
||||
unsigned long ulR18;
|
||||
unsigned long ulR19;
|
||||
unsigned long ulR20;
|
||||
unsigned long ulR21;
|
||||
unsigned long ulR22;
|
||||
unsigned long ulR23;
|
||||
unsigned long ulR24;
|
||||
unsigned long ulR25;
|
||||
unsigned long ulR26;
|
||||
unsigned long ulR27;
|
||||
unsigned long ulR28;
|
||||
unsigned long ulR29;
|
||||
unsigned long ulR30;
|
||||
unsigned long ulR31;
|
||||
unsigned long ulPC;
|
||||
unsigned long ulESR;
|
||||
unsigned long ulMSR;
|
||||
unsigned long ulEAR;
|
||||
unsigned long ulFSR;
|
||||
unsigned long ulEDR;
|
||||
uint32_t ulR1_SP;
|
||||
uint32_t ulR2_small_data_area;
|
||||
uint32_t ulR3;
|
||||
uint32_t ulR4;
|
||||
uint32_t ulR5;
|
||||
uint32_t ulR6;
|
||||
uint32_t ulR7;
|
||||
uint32_t ulR8;
|
||||
uint32_t ulR9;
|
||||
uint32_t ulR10;
|
||||
uint32_t ulR11;
|
||||
uint32_t ulR12;
|
||||
uint32_t ulR13_read_write_small_data_area;
|
||||
uint32_t ulR14_return_address_from_interrupt;
|
||||
uint32_t ulR15_return_address_from_subroutine;
|
||||
uint32_t ulR16_return_address_from_trap;
|
||||
uint32_t ulR17_return_address_from_exceptions; /* The exception entry code will copy the BTR into R17 if the exception occurred in the delay slot of a branch instruction. */
|
||||
uint32_t ulR18;
|
||||
uint32_t ulR19;
|
||||
uint32_t ulR20;
|
||||
uint32_t ulR21;
|
||||
uint32_t ulR22;
|
||||
uint32_t ulR23;
|
||||
uint32_t ulR24;
|
||||
uint32_t ulR25;
|
||||
uint32_t ulR26;
|
||||
uint32_t ulR27;
|
||||
uint32_t ulR28;
|
||||
uint32_t ulR29;
|
||||
uint32_t ulR30;
|
||||
uint32_t ulR31;
|
||||
uint32_t ulPC;
|
||||
uint32_t ulESR;
|
||||
uint32_t ulMSR;
|
||||
uint32_t ulEAR;
|
||||
uint32_t ulFSR;
|
||||
uint32_t ulEDR;
|
||||
|
||||
/* A human readable description of the exception cause. The strings used
|
||||
are the same as the #define constant names found in the
|
||||
microblaze_exceptions_i.h header file */
|
||||
signed char *pcExceptionCause;
|
||||
int8_t *pcExceptionCause;
|
||||
|
||||
/* The human readable name of the task that was running at the time the
|
||||
exception occurred. This is the name that was given to the task when the
|
||||
task was created using the FreeRTOS xTaskCreate() API function. */
|
||||
signed char *pcCurrentTaskName;
|
||||
int8_t *pcCurrentTaskName;
|
||||
|
||||
/* The handle of the task that was running a the time the exception
|
||||
occurred. */
|
||||
|
@ -257,7 +261,7 @@ typedef struct PORT_REGISTER_DUMP
|
|||
* pdPASS is returned if the function executes successfully. Any other value
|
||||
* being returned indicates that the function did not execute correctly.
|
||||
*/
|
||||
portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
|
||||
BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
|
||||
|
||||
|
||||
/*
|
||||
|
@ -278,7 +282,7 @@ portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterr
|
|||
* XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs.
|
||||
*
|
||||
*/
|
||||
void vPortEnableInterrupt( unsigned char ucInterruptID );
|
||||
void vPortEnableInterrupt( uint8_t ucInterruptID );
|
||||
|
||||
/*
|
||||
* Disables the interrupt, within the interrupt controller, for the peripheral
|
||||
|
@ -298,7 +302,7 @@ void vPortEnableInterrupt( unsigned char ucInterruptID );
|
|||
* XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs.
|
||||
*
|
||||
*/
|
||||
void vPortDisableInterrupt( unsigned char ucInterruptID );
|
||||
void vPortDisableInterrupt( uint8_t ucInterruptID );
|
||||
|
||||
/*
|
||||
* This is an application defined callback function used to install the tick
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Interrupts are enabled. */
|
||||
#define portINITIAL_ESTATUS ( portSTACK_TYPE ) 0x01
|
||||
#define portINITIAL_ESTATUS ( StackType_t ) 0x01
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -97,7 +97,7 @@ void vPortSysTickHandler( void * context, alt_u32 id );
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvReadGp( unsigned long *ulValue )
|
||||
static void prvReadGp( uint32_t *ulValue )
|
||||
{
|
||||
asm( "stw gp, (%0)" :: "r"(ulValue) );
|
||||
}
|
||||
|
@ -106,10 +106,10 @@ static void prvReadGp( unsigned long *ulValue )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxFramePointer = pxTopOfStack - 1;
|
||||
portSTACK_TYPE xGlobalPointer;
|
||||
StackType_t *pxFramePointer = pxTopOfStack - 1;
|
||||
StackType_t xGlobalPointer;
|
||||
|
||||
prvReadGp( &xGlobalPointer );
|
||||
|
||||
|
@ -117,7 +117,7 @@ portSTACK_TYPE xGlobalPointer;
|
|||
*pxTopOfStack = 0xdeadbeef;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxFramePointer;
|
||||
*pxTopOfStack = ( StackType_t ) pxFramePointer;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = xGlobalPointer;
|
||||
|
@ -125,7 +125,7 @@ portSTACK_TYPE xGlobalPointer;
|
|||
/* Space for R23 to R16. */
|
||||
pxTopOfStack -= 9;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = portINITIAL_ESTATUS;
|
||||
|
@ -133,7 +133,7 @@ portSTACK_TYPE xGlobalPointer;
|
|||
/* Space for R15 to R5. */
|
||||
pxTopOfStack -= 12;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
|
||||
/* Space for R3 to R1, muldiv and RA. */
|
||||
pxTopOfStack -= 5;
|
||||
|
@ -145,7 +145,7 @@ portSTACK_TYPE xGlobalPointer;
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||
here already. */
|
||||
|
|
|
@ -88,21 +88,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
#define portCRITICAL_NESTING_IN_TCB 1
|
||||
|
|
|
@ -134,7 +134,7 @@ static XIntc xInterruptController;
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Place a known value at the bottom of the stack for debugging. */
|
||||
*pxTopOfStack = 0xDEADBEEF;
|
||||
|
@ -144,15 +144,15 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack -= 20; /* Previous backchain and LR, R31 to R4 inclusive. */
|
||||
|
||||
/* Parameters in R13. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) &_SDA_BASE_; /* address of the first small data area */
|
||||
*pxTopOfStack = ( StackType_t ) &_SDA_BASE_; /* address of the first small data area */
|
||||
pxTopOfStack -= 10;
|
||||
|
||||
/* Parameters in R3. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Parameters in R2. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) &_SDA2_BASE_; /* address of the second small data area */
|
||||
*pxTopOfStack = ( StackType_t ) &_SDA2_BASE_; /* address of the second small data area */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* R1 is the stack pointer so is omitted. */
|
||||
|
@ -167,13 +167,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x00000000UL; /* CTR. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler; /* LR. */
|
||||
*pxTopOfStack = ( StackType_t ) vPortEndScheduler; /* LR. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* SRR0. */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* SRR0. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portINITIAL_MSR;/* SRR1. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler;/* Next LR. */
|
||||
*pxTopOfStack = ( StackType_t ) vPortEndScheduler;/* Next LR. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x00000000UL;/* Backchain. */
|
||||
|
||||
|
@ -181,7 +181,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
prvSetupTimerInterrupt();
|
||||
XExc_RegisterHandler( XEXC_ID_SYSTEM_CALL, ( XExceptionHandler ) vPortYield, ( void * ) 0 );
|
||||
|
@ -204,7 +204,7 @@ void vPortEndScheduler( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL );
|
||||
const uint32_t ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL );
|
||||
|
||||
XTime_PITClearInterrupt();
|
||||
XTime_FITClearInterrupt();
|
||||
|
@ -222,8 +222,8 @@ const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) -
|
|||
|
||||
void vPortISRHandler( void *pvNullDoNotUse )
|
||||
{
|
||||
unsigned long ulInterruptStatus, ulInterruptMask = 1UL;
|
||||
portBASE_TYPE xInterruptNumber;
|
||||
uint32_t ulInterruptStatus, ulInterruptMask = 1UL;
|
||||
BaseType_t xInterruptNumber;
|
||||
XIntc_Config *pxInterruptController;
|
||||
XIntc_VectorTableEntry *pxTable;
|
||||
|
||||
|
@ -281,9 +281,9 @@ extern void vPortISRWrapper( void );
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef )
|
||||
BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef )
|
||||
{
|
||||
portBASE_TYPE xReturn = pdFAIL;
|
||||
BaseType_t xReturn = pdFAIL;
|
||||
|
||||
/* This function is defined here so the scope of xInterruptController can
|
||||
remain within this file. */
|
||||
|
|
|
@ -88,15 +88,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portBASE_TYPE portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -128,7 +132,7 @@ void vPortYield( void );
|
|||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
|
||||
/* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */
|
||||
|
@ -142,7 +146,7 @@ void vPortYield( void );
|
|||
|
||||
/* Port specific interrupt handling functions. */
|
||||
void vPortSetupInterruptController( void );
|
||||
portBASE_TYPE xPortInstallInterruptHandler( unsigned portCHAR ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
|
||||
BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ static XIntc xInterruptController;
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Place a known value at the bottom of the stack for debugging. */
|
||||
*pxTopOfStack = 0xDEADBEEF;
|
||||
|
@ -144,15 +144,15 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack -= 20; /* Previous backchain and LR, R31 to R4 inclusive. */
|
||||
|
||||
/* Parameters in R13. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) &_SDA_BASE_; /* address of the first small data area */
|
||||
*pxTopOfStack = ( StackType_t ) &_SDA_BASE_; /* address of the first small data area */
|
||||
pxTopOfStack -= 10;
|
||||
|
||||
/* Parameters in R3. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Parameters in R2. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) &_SDA2_BASE_; /* address of the second small data area */
|
||||
*pxTopOfStack = ( StackType_t ) &_SDA2_BASE_; /* address of the second small data area */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* R1 is the stack pointer so is omitted. */
|
||||
|
@ -167,13 +167,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x00000000UL; /* CTR. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler; /* LR. */
|
||||
*pxTopOfStack = ( StackType_t ) vPortEndScheduler; /* LR. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* SRR0. */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* SRR0. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portINITIAL_MSR;/* SRR1. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler;/* Next LR. */
|
||||
*pxTopOfStack = ( StackType_t ) vPortEndScheduler;/* Next LR. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x00000000UL;/* Backchain. */
|
||||
|
||||
|
@ -181,7 +181,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
prvSetupTimerInterrupt();
|
||||
XExc_RegisterHandler( XEXC_ID_SYSTEM_CALL, ( XExceptionHandler ) vPortYield, ( void * ) 0 );
|
||||
|
@ -204,7 +204,7 @@ void vPortEndScheduler( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL );
|
||||
const uint32_t ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL );
|
||||
|
||||
XTime_DECClearInterrupt();
|
||||
XTime_FITClearInterrupt();
|
||||
|
@ -222,8 +222,8 @@ const unsigned long ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) -
|
|||
|
||||
void vPortISRHandler( void *pvNullDoNotUse )
|
||||
{
|
||||
unsigned long ulInterruptStatus, ulInterruptMask = 1UL;
|
||||
portBASE_TYPE xInterruptNumber;
|
||||
uint32_t ulInterruptStatus, ulInterruptMask = 1UL;
|
||||
BaseType_t xInterruptNumber;
|
||||
XIntc_Config *pxInterruptController;
|
||||
XIntc_VectorTableEntry *pxTable;
|
||||
|
||||
|
@ -281,9 +281,9 @@ extern void vPortISRWrapper( void );
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef )
|
||||
BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef )
|
||||
{
|
||||
portBASE_TYPE xReturn = pdFAIL;
|
||||
BaseType_t xReturn = pdFAIL;
|
||||
|
||||
/* This function is defined here so the scope of xInterruptController can
|
||||
remain within this file. */
|
||||
|
|
|
@ -88,15 +88,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portBASE_TYPE portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -128,7 +132,7 @@ void vPortYield( void );
|
|||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
|
||||
/* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */
|
||||
|
@ -142,7 +146,7 @@ void vPortYield( void );
|
|||
|
||||
/* Port specific interrupt handling functions. */
|
||||
void vPortSetupInterruptController( void );
|
||||
portBASE_TYPE xPortInstallInterruptHandler( unsigned portCHAR ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
|
||||
BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
/* Tasks should start with interrupts enabled and in Supervisor mode, therefore
|
||||
PSW is set with U and I set, and PM and IPL clear. */
|
||||
#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 )
|
||||
#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 )
|
||||
|
||||
/* The peripheral clock is divided by this value before being supplying the
|
||||
CMT. */
|
||||
|
@ -153,7 +153,7 @@ static void prvSetupTimerInterrupt( void );
|
|||
* instruction.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static void prvSleep( portTickType xExpectedIdleTime );
|
||||
static void prvSleep( TickType_t xExpectedIdleTime );
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -162,7 +162,7 @@ static void prvSetupTimerInterrupt( void );
|
|||
extern void *pxCurrentTCB;
|
||||
|
||||
/* Calculate how many clock increments make up a single tick period. */
|
||||
static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ );
|
||||
static const uint32_t ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ );
|
||||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
|
@ -170,7 +170,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H
|
|||
basically how far into the future an interrupt can be generated. Set
|
||||
during initialisation. This is the maximum possible value that the
|
||||
compare match register can hold divided by ulMatchValueForOneTick. */
|
||||
static const portTickType xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ );
|
||||
static const TickType_t xMaximumPossibleSuppressedTicks = USHRT_MAX / ( ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) / configTICK_RATE_HZ );
|
||||
|
||||
/* Flag set from the tick interrupt to allow the sleep processing to know if
|
||||
sleep mode was exited because of a tick interrupt, or an interrupt
|
||||
|
@ -183,7 +183,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H
|
|||
compensate for the lost time. The large difference between the divided CMT
|
||||
clock and the CPU clock means it is likely ulStoppedTimerCompensation will
|
||||
equal zero - and be optimised away. */
|
||||
static const unsigned long ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) );
|
||||
static const uint32_t ulStoppedTimerCompensation = 100UL / ( configCPU_CLOCK_HZ / ( configPERIPHERAL_CLOCK_HZ / portCLOCK_DIVISOR ) );
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -192,7 +192,7 @@ static const unsigned long ulMatchValueForOneTick = ( ( configPERIPHERAL_CLOCK_H
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Offset to end up on 8 byte boundary. */
|
||||
pxTopOfStack--;
|
||||
|
@ -204,7 +204,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack--;
|
||||
*pxTopOfStack = portINITIAL_PSW;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
|
||||
/* When debugging it can be useful if every register is set to a known
|
||||
value. Otherwise code space can be saved by just setting the registers
|
||||
|
@ -249,7 +249,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
#endif
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x12345678; /* Accumulator. */
|
||||
pxTopOfStack--;
|
||||
|
@ -259,7 +259,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Use pxCurrentTCB just so it does not get optimised away. */
|
||||
if( pxCurrentTCB != NULL )
|
||||
|
@ -446,13 +446,13 @@ void vPortTickISR( void )
|
|||
|
||||
/* If this is the first tick since exiting tickless mode then the CMT
|
||||
compare match value needs resetting. */
|
||||
CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick;
|
||||
CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulPortGetIPL( void )
|
||||
uint32_t ulPortGetIPL( void )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
|
@ -466,7 +466,7 @@ unsigned long ulPortGetIPL( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortSetIPL( unsigned long ulNewIPL )
|
||||
void vPortSetIPL( uint32_t ulNewIPL )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
|
@ -497,7 +497,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
CMT0.CMCR.BIT.CMIE = 1;
|
||||
|
||||
/* Set the compare match value. */
|
||||
CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick;
|
||||
CMT0.CMCOR = ( uint16_t ) ulMatchValueForOneTick;
|
||||
|
||||
/* Divide the PCLK. */
|
||||
#if portCLOCK_DIVISOR == 512
|
||||
|
@ -535,7 +535,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
static void prvSleep( portTickType xExpectedIdleTime )
|
||||
static void prvSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
/* Allow the application to define some pre-sleep processing. */
|
||||
configPRE_SLEEP_PROCESSING( xExpectedIdleTime );
|
||||
|
@ -557,9 +557,9 @@ static void prvSetupTimerInterrupt( void )
|
|||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||
void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
unsigned long ulMatchValue, ulCompleteTickPeriods, ulCurrentCount;
|
||||
uint32_t ulMatchValue, ulCompleteTickPeriods, ulCurrentCount;
|
||||
eSleepModeStatus eSleepAction;
|
||||
|
||||
/* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */
|
||||
|
@ -642,8 +642,8 @@ static void prvSetupTimerInterrupt( void )
|
|||
|
||||
/* Adjust the match value to take into account that the current
|
||||
time slice is already partially complete. */
|
||||
ulMatchValue -= ( unsigned long ) CMT0.CMCNT;
|
||||
CMT0.CMCOR = ( unsigned short ) ulMatchValue;
|
||||
ulMatchValue -= ( uint32_t ) CMT0.CMCNT;
|
||||
CMT0.CMCOR = ( uint16_t ) ulMatchValue;
|
||||
|
||||
/* Restart the CMT to count up to the new match value. */
|
||||
CMT0.CMCNT = 0;
|
||||
|
@ -663,7 +663,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
/* Nothing to do here. */
|
||||
}
|
||||
|
||||
ulCurrentCount = ( unsigned long ) CMT0.CMCNT;
|
||||
ulCurrentCount = ( uint32_t ) CMT0.CMCNT;
|
||||
|
||||
if( ulTickFlag != pdFALSE )
|
||||
{
|
||||
|
@ -673,7 +673,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
exited. Reset the match value with whatever remains of this
|
||||
tick period. */
|
||||
ulMatchValue = ulMatchValueForOneTick - ulCurrentCount;
|
||||
CMT0.CMCOR = ( unsigned short ) ulMatchValue;
|
||||
CMT0.CMCOR = ( uint16_t ) ulMatchValue;
|
||||
|
||||
/* The tick interrupt handler will already have pended the tick
|
||||
processing in the kernel. As the pending tick will be
|
||||
|
@ -693,7 +693,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
/* The match value is set to whatever fraction of a single tick
|
||||
period remains. */
|
||||
ulMatchValue = ulCurrentCount - ( ulCompleteTickPeriods * ulMatchValueForOneTick );
|
||||
CMT0.CMCOR = ( unsigned short ) ulMatchValue;
|
||||
CMT0.CMCOR = ( uint16_t ) ulMatchValue;
|
||||
}
|
||||
|
||||
/* Restart the CMT so it runs up to the match value. The match value
|
||||
|
|
|
@ -88,22 +88,26 @@ portSTACK_TYPE and portBASE_TYPE. */
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */
|
||||
#define portSTACK_GROWTH -1
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() __asm volatile( "NOP" )
|
||||
|
||||
/* Save clobbered register, set ITU SWINR (at address 0x872E0), read the value
|
||||
|
@ -147,15 +151,15 @@ extern void vTaskExitCritical( void );
|
|||
#define portEXIT_CRITICAL() vTaskExitCritical()
|
||||
|
||||
/* As this port allows interrupt nesting... */
|
||||
unsigned long ulPortGetIPL( void ) __attribute__((naked));
|
||||
void vPortSetIPL( unsigned long ulNewIPL ) __attribute__((naked));
|
||||
uint32_t ulPortGetIPL( void ) __attribute__((naked));
|
||||
void vPortSetIPL( uint32_t ulNewIPL ) __attribute__((naked));
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortGetIPL(); portDISABLE_INTERRUPTS()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) vPortSetIPL( uxSavedInterruptStatus )
|
||||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
|
||||
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -81,8 +81,8 @@
|
|||
|
||||
/* Tasks should start with interrupts enabled and in Supervisor mode, therefore
|
||||
PSW is set with U and I set, and PM and IPL clear. */
|
||||
#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 )
|
||||
#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 )
|
||||
#define portINITIAL_PSW ( ( StackType_t ) 0x00030000 )
|
||||
#define portINITIAL_FPSW ( ( StackType_t ) 0x00000100 )
|
||||
|
||||
/* These macros allow a critical section to be added around the call to
|
||||
xTaskIncrementTick(), which is only ever called from interrupts at the kernel
|
||||
|
@ -121,7 +121,7 @@ extern void *pxCurrentTCB;
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* R0 is not included as it is the stack pointer. */
|
||||
|
||||
|
@ -129,7 +129,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack--;
|
||||
*pxTopOfStack = portINITIAL_PSW;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
|
||||
/* When debugging it can be useful if every register is set to a known
|
||||
value. Otherwise code space can be saved by just setting the registers
|
||||
|
@ -172,7 +172,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
#endif
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portINITIAL_FPSW;
|
||||
pxTopOfStack--;
|
||||
|
@ -184,7 +184,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void vApplicationSetupTimerInterrupt( void );
|
||||
|
||||
|
@ -366,7 +366,7 @@ void vTickISR( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulPortGetIPL( void )
|
||||
uint32_t ulPortGetIPL( void )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
|
@ -380,7 +380,7 @@ unsigned long ulPortGetIPL( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortSetIPL( unsigned long ulNewIPL )
|
||||
void vPortSetIPL( uint32_t ulNewIPL )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
|
|
|
@ -88,22 +88,26 @@ portSTACK_TYPE and portBASE_TYPE. */
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */
|
||||
#define portSTACK_GROWTH -1
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portNOP() __asm volatile( "NOP" )
|
||||
|
||||
/* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;"
|
||||
|
@ -149,8 +153,8 @@ extern void vTaskExitCritical( void );
|
|||
#define portEXIT_CRITICAL() vTaskExitCritical()
|
||||
|
||||
/* As this port allows interrupt nesting... */
|
||||
unsigned long ulPortGetIPL( void ) __attribute__((naked));
|
||||
void vPortSetIPL( unsigned long ulNewIPL ) __attribute__((naked));
|
||||
uint32_t ulPortGetIPL( void ) __attribute__((naked));
|
||||
void vPortSetIPL( uint32_t ulNewIPL ) __attribute__((naked));
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortGetIPL(); portDISABLE_INTERRUPTS()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) vPortSetIPL( uxSavedInterruptStatus )
|
||||
|
||||
|
|
|
@ -77,12 +77,12 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to setup the initial stack. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
#define portINSTRUCTION_SIZE ( ( StackType_t ) 4 )
|
||||
|
||||
/* Constants required to handle critical sections. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
|
||||
/* Prescale used on the timer clock when calculating the tick period. */
|
||||
#define portPRESCALE 20
|
||||
|
@ -101,9 +101,9 @@ static void prvSetupTimerInterrupt( void );
|
|||
*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
portSTACK_TYPE *pxOriginalTOS;
|
||||
StackType_t *pxOriginalTOS;
|
||||
|
||||
pxOriginalTOS = pxTopOfStack;
|
||||
|
||||
|
@ -117,45 +117,45 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
/* First on the stack is the return address - which in this case is the
|
||||
start of the task. The offset is added to make the return address appear
|
||||
as it would within an IRQ ISR. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0xaaaaaaaa; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* When the task starts is will expect to find the function parameter in
|
||||
R0. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The status register is set for system mode, with interrupts enabled. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||
*pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
|
||||
|
||||
#ifdef THUMB_INTERWORK
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ portSTACK_TYPE *pxOriginalTOS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void vPortISRStartFirstTask( void );
|
||||
|
||||
|
|
|
@ -78,9 +78,9 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to handle critical sections. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
|
||||
volatile unsigned long ulCriticalNesting = 9999UL;
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -87,21 +87,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portBASE_TYPE portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portYIELD() asm volatile ( "SWI 0" )
|
||||
#define portNOP() asm volatile ( "NOP" )
|
||||
|
|
|
@ -126,17 +126,17 @@ static void prvInterruptYield( int iTrapIdentification );
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This reference is required by the save/restore context macros. */
|
||||
extern volatile unsigned long *pxCurrentTCB;
|
||||
extern volatile uint32_t *pxCurrentTCB;
|
||||
|
||||
/* Precalculate the compare match value at compile time. */
|
||||
static const unsigned long ulCompareMatchValue = ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ );
|
||||
static const uint32_t ulCompareMatchValue = ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
unsigned long *pulUpperCSA = NULL;
|
||||
unsigned long *pulLowerCSA = NULL;
|
||||
uint32_t *pulUpperCSA = NULL;
|
||||
uint32_t *pulLowerCSA = NULL;
|
||||
|
||||
/* 16 Address Registers (4 Address registers are global), 16 Data
|
||||
Registers, and 3 System Registers.
|
||||
|
@ -189,24 +189,24 @@ unsigned long *pulLowerCSA = NULL;
|
|||
portEXIT_CRITICAL();
|
||||
|
||||
/* Clear the upper CSA. */
|
||||
memset( pulUpperCSA, 0, portNUM_WORDS_IN_CSA * sizeof( unsigned long ) );
|
||||
memset( pulUpperCSA, 0, portNUM_WORDS_IN_CSA * sizeof( uint32_t ) );
|
||||
|
||||
/* Upper Context. */
|
||||
pulUpperCSA[ 2 ] = ( unsigned long )pxTopOfStack; /* A10; Stack Return aka Stack Pointer */
|
||||
pulUpperCSA[ 2 ] = ( uint32_t )pxTopOfStack; /* A10; Stack Return aka Stack Pointer */
|
||||
pulUpperCSA[ 1 ] = portSYSTEM_PROGRAM_STATUS_WORD; /* PSW */
|
||||
|
||||
/* Clear the lower CSA. */
|
||||
memset( pulLowerCSA, 0, portNUM_WORDS_IN_CSA * sizeof( unsigned long ) );
|
||||
memset( pulLowerCSA, 0, portNUM_WORDS_IN_CSA * sizeof( uint32_t ) );
|
||||
|
||||
/* Lower Context. */
|
||||
pulLowerCSA[ 8 ] = ( unsigned long ) pvParameters; /* A4; Address Type Parameter Register */
|
||||
pulLowerCSA[ 1 ] = ( unsigned long ) pxCode; /* A11; Return Address aka RA */
|
||||
pulLowerCSA[ 8 ] = ( uint32_t ) pvParameters; /* A4; Address Type Parameter Register */
|
||||
pulLowerCSA[ 1 ] = ( uint32_t ) pxCode; /* A11; Return Address aka RA */
|
||||
|
||||
/* PCXI pointing to the Upper context. */
|
||||
pulLowerCSA[ 0 ] = ( portINITIAL_PCXI_UPPER_CONTEXT_WORD | ( unsigned long ) portADDRESS_TO_CSA( pulUpperCSA ) );
|
||||
pulLowerCSA[ 0 ] = ( portINITIAL_PCXI_UPPER_CONTEXT_WORD | ( uint32_t ) portADDRESS_TO_CSA( pulUpperCSA ) );
|
||||
|
||||
/* Save the link to the CSA in the top of stack. */
|
||||
pxTopOfStack = (unsigned long * ) portADDRESS_TO_CSA( pulLowerCSA );
|
||||
pxTopOfStack = (uint32_t * ) portADDRESS_TO_CSA( pulLowerCSA );
|
||||
|
||||
/* DSync to ensure that buffering is not a problem. */
|
||||
_dsync();
|
||||
|
@ -215,12 +215,12 @@ unsigned long *pulLowerCSA = NULL;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
long xPortStartScheduler( void )
|
||||
int32_t xPortStartScheduler( void )
|
||||
{
|
||||
extern void vTrapInstallHandlers( void );
|
||||
unsigned long ulMFCR = 0UL;
|
||||
unsigned long *pulUpperCSA = NULL;
|
||||
unsigned long *pulLowerCSA = NULL;
|
||||
uint32_t ulMFCR = 0UL;
|
||||
uint32_t *pulUpperCSA = NULL;
|
||||
uint32_t *pulLowerCSA = NULL;
|
||||
|
||||
/* Interrupts at or below configMAX_SYSCALL_INTERRUPT_PRIORITY are disable
|
||||
when this function is called. */
|
||||
|
@ -322,11 +322,11 @@ static void prvSetupTimerInterrupt( void )
|
|||
|
||||
static void prvSystemTickHandler( int iArg )
|
||||
{
|
||||
unsigned long ulSavedInterruptMask;
|
||||
unsigned long *pxUpperCSA = NULL;
|
||||
unsigned long xUpperCSA = 0UL;
|
||||
extern volatile unsigned long *pxCurrentTCB;
|
||||
long lYieldRequired;
|
||||
uint32_t ulSavedInterruptMask;
|
||||
uint32_t *pxUpperCSA = NULL;
|
||||
uint32_t xUpperCSA = 0UL;
|
||||
extern volatile uint32_t *pxCurrentTCB;
|
||||
int32_t lYieldRequired;
|
||||
|
||||
/* Just to avoid compiler warnings about unused parameters. */
|
||||
( void ) iArg;
|
||||
|
@ -413,10 +413,10 @@ long lYieldRequired;
|
|||
* than they can be freed assuming that tasks are being spawned and
|
||||
* deleted frequently.
|
||||
*/
|
||||
void vPortReclaimCSA( unsigned long *pxTCB )
|
||||
void vPortReclaimCSA( uint32_t *pxTCB )
|
||||
{
|
||||
unsigned long pxHeadCSA, pxTailCSA, pxFreeCSA;
|
||||
unsigned long *pulNextCSA;
|
||||
uint32_t pxHeadCSA, pxTailCSA, pxFreeCSA;
|
||||
uint32_t *pulNextCSA;
|
||||
|
||||
/* A pointer to the first CSA in the list of CSAs consumed by the task is
|
||||
stored in the first element of the tasks TCB structure (where the stack
|
||||
|
@ -476,9 +476,9 @@ void vPortEndScheduler( void )
|
|||
|
||||
static void prvTrapYield( int iTrapIdentification )
|
||||
{
|
||||
unsigned long *pxUpperCSA = NULL;
|
||||
unsigned long xUpperCSA = 0UL;
|
||||
extern volatile unsigned long *pxCurrentTCB;
|
||||
uint32_t *pxUpperCSA = NULL;
|
||||
uint32_t xUpperCSA = 0UL;
|
||||
extern volatile uint32_t *pxCurrentTCB;
|
||||
|
||||
switch( iTrapIdentification )
|
||||
{
|
||||
|
@ -523,9 +523,9 @@ extern volatile unsigned long *pxCurrentTCB;
|
|||
|
||||
static void prvInterruptYield( int iId )
|
||||
{
|
||||
unsigned long *pxUpperCSA = NULL;
|
||||
unsigned long xUpperCSA = 0UL;
|
||||
extern volatile unsigned long *pxCurrentTCB;
|
||||
uint32_t *pxUpperCSA = NULL;
|
||||
uint32_t xUpperCSA = 0UL;
|
||||
extern volatile uint32_t *pxCurrentTCB;
|
||||
|
||||
/* Just to remove compiler warnings. */
|
||||
( void ) iId;
|
||||
|
@ -561,9 +561,9 @@ extern volatile unsigned long *pxCurrentTCB;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long uxPortSetInterruptMaskFromISR( void )
|
||||
uint32_t uxPortSetInterruptMaskFromISR( void )
|
||||
{
|
||||
unsigned long uxReturn = 0UL;
|
||||
uint32_t uxReturn = 0UL;
|
||||
|
||||
_disable();
|
||||
uxReturn = _mfcr( $ICR );
|
||||
|
|
|
@ -90,21 +90,25 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portNOP() __asm volatile( " nop " )
|
||||
#define portCRITICAL_NESTING_IN_TCB 1
|
||||
|
@ -113,7 +117,7 @@ extern "C" {
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct MPU_SETTINGS { unsigned long ulNotUsed; } xMPU_SETTINGS;
|
||||
typedef struct MPU_SETTINGS { uint32_t ulNotUsed; } xMPU_SETTINGS;
|
||||
|
||||
/* Define away the instruction from the Restore Context Macro. */
|
||||
#define portPRIVILEGE_BIT 0x0UL
|
||||
|
@ -127,8 +131,8 @@ extern void vTaskExitCritical( void );
|
|||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* CSA Manipulation. */
|
||||
#define portCSA_TO_ADDRESS( pCSA ) ( ( unsigned long * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) )
|
||||
#define portADDRESS_TO_CSA( pAddress ) ( ( unsigned long )( ( ( ( (unsigned long)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( unsigned long )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) )
|
||||
#define portCSA_TO_ADDRESS( pCSA ) ( ( uint32_t * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) )
|
||||
#define portADDRESS_TO_CSA( pAddress ) ( ( uint32_t )( ( ( ( (uint32_t)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( uint32_t )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) )
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#define portYIELD() _syscall( 0 )
|
||||
|
@ -141,7 +145,7 @@ extern void vTaskExitCritical( void );
|
|||
|
||||
/* Set ICR.CCPN to configMAX_SYSCALL_INTERRUPT_PRIORITY. */
|
||||
#define portDISABLE_INTERRUPTS() { \
|
||||
unsigned long ulICR; \
|
||||
uint32_t ulICR; \
|
||||
_disable(); \
|
||||
ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \
|
||||
ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \
|
||||
|
@ -153,7 +157,7 @@ extern void vTaskExitCritical( void );
|
|||
|
||||
/* Clear ICR.CCPN to allow all interrupt priorities. */
|
||||
#define portENABLE_INTERRUPTS() { \
|
||||
unsigned long ulICR; \
|
||||
uint32_t ulICR; \
|
||||
_disable(); \
|
||||
ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \
|
||||
ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \
|
||||
|
@ -164,7 +168,7 @@ extern void vTaskExitCritical( void );
|
|||
|
||||
/* Set ICR.CCPN to uxSavedMaskValue. */
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedMaskValue ) { \
|
||||
unsigned long ulICR; \
|
||||
uint32_t ulICR; \
|
||||
_disable(); \
|
||||
ulICR = _mfcr( $ICR ); /* Get current ICR value. */ \
|
||||
ulICR &= ~portCCPN_MASK; /* Clear down mask bits. */ \
|
||||
|
@ -176,7 +180,7 @@ extern void vTaskExitCritical( void );
|
|||
|
||||
|
||||
/* Set ICR.CCPN to configMAX_SYSCALL_INTERRUPT_PRIORITY */
|
||||
extern unsigned long uxPortSetInterruptMaskFromISR( void );
|
||||
extern uint32_t uxPortSetInterruptMaskFromISR( void );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMaskFromISR()
|
||||
|
||||
/* Pend a priority 1 interrupt, which will take care of the context switch. */
|
||||
|
@ -193,8 +197,8 @@ extern unsigned long uxPortSetInterruptMaskFromISR( void );
|
|||
* Port specific clean up macro required to free the CSAs that were consumed by
|
||||
* a task that has since been deleted.
|
||||
*/
|
||||
void vPortReclaimCSA( unsigned long *pxTCB );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) vPortReclaimCSA( ( unsigned long * ) ( pxTCB ) )
|
||||
void vPortReclaimCSA( uint32_t *pxTCB );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) vPortReclaimCSA( ( uint32_t * ) ( pxTCB ) )
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
/*
|
||||
* This reference is required by the Save/Restore Context Macros.
|
||||
*/
|
||||
extern volatile unsigned long *pxCurrentTCB;
|
||||
extern volatile uint32_t *pxCurrentTCB;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
|
||||
/* The critical nesting value is initialised to a non zero value to ensure
|
||||
interrupts don't accidentally become enabled before the scheduler is started. */
|
||||
#define portINITIAL_CRITICAL_NESTING (( unsigned short ) 10)
|
||||
#define portINITIAL_CRITICAL_NESTING (( uint16_t ) 10)
|
||||
|
||||
/* Initial PSW value allocated to a newly created task.
|
||||
* 1100011000000000
|
||||
|
@ -89,8 +89,8 @@ interrupts don't accidentally become enabled before the scheduler is started. */
|
|||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
typedef void tskTCB;
|
||||
extern volatile tskTCB * volatile pxCurrentTCB;
|
||||
typedef void TCB_t;
|
||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||
|
||||
/* Most ports implement critical sections by placing the interrupt flags on
|
||||
the stack before disabling interrupts. Exiting the critical section is then
|
||||
|
@ -104,7 +104,7 @@ with interrupts only being re-enabled if the count is zero.
|
|||
usCriticalNesting will get set to zero when the scheduler starts, but must
|
||||
not be initialised to zero as this will cause problems during the startup
|
||||
sequence. */
|
||||
volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
@ -119,9 +119,9 @@ static void prvSetupTimerInterrupt( void );
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
unsigned long *pulLocal;
|
||||
uint32_t *pulLocal;
|
||||
|
||||
#if configMEMORY_MODE == 1
|
||||
{
|
||||
|
@ -130,15 +130,15 @@ unsigned long *pulLocal;
|
|||
pxTopOfStack--;
|
||||
|
||||
/* Write in the parameter value. */
|
||||
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||
*pulLocal = ( unsigned long ) pvParameters;
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( uint32_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* These values are just spacers. The return address of the function
|
||||
would normally be written here. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd;
|
||||
*pxTopOfStack = ( StackType_t ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd;
|
||||
*pxTopOfStack = ( StackType_t ) 0xcdcd;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The start address / PSW value is also written in as a 32bit value,
|
||||
|
@ -146,12 +146,12 @@ unsigned long *pulLocal;
|
|||
pxTopOfStack--;
|
||||
|
||||
/* Task function start address combined with the PSW. */
|
||||
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* An initial value for the AX register. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1111;
|
||||
*pxTopOfStack = ( StackType_t ) 0x1111;
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#else
|
||||
|
@ -162,33 +162,33 @@ unsigned long *pulLocal;
|
|||
pxTopOfStack--;
|
||||
|
||||
/* Task function start address combined with the PSW. */
|
||||
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pulLocal = ( uint32_t * ) pxTopOfStack;
|
||||
*pulLocal = ( ( ( uint32_t ) pxCode ) | ( portPSW << 24UL ) );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The parameter is passed in AX. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||
pxTopOfStack--;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* An initial value for the HL register. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x2222;
|
||||
*pxTopOfStack = ( StackType_t ) 0x2222;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* CS and ES registers. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0F00;
|
||||
*pxTopOfStack = ( StackType_t ) 0x0F00;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Finally the remaining general purpose registers DE and BC */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xDEDE;
|
||||
*pxTopOfStack = ( StackType_t ) 0xDEDE;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0xBCBC;
|
||||
*pxTopOfStack = ( StackType_t ) 0xBCBC;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Finally the critical section nesting count is set to zero when the task
|
||||
first starts. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;
|
||||
*pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
|
||||
/* Return a pointer to the top of the stack we have generated so this can
|
||||
be stored in the task control block for the task. */
|
||||
|
@ -196,7 +196,7 @@ unsigned long *pulLocal;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. Interrupts are disabled when
|
||||
this function is called. */
|
||||
|
@ -242,7 +242,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
TMR05 = 0x0000;
|
||||
|
||||
/* Set the compare match value according to the tick rate we want. */
|
||||
TDR05 = ( portTickType ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );
|
||||
TDR05 = ( TickType_t ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );
|
||||
|
||||
/* Set Timer Array Unit Channel 5 output mode */
|
||||
TOM0 &= ~0x0020;
|
||||
|
|
|
@ -87,15 +87,19 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned short
|
||||
#define portSTACK_TYPE uint16_t
|
||||
#define portBASE_TYPE short
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef short BaseType_t;
|
||||
typedef unsigned short UBaseType_t;
|
||||
|
||||
#if (configUSE_16_BIT_TICKS==1)
|
||||
typedef unsigned int portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef unsigned int TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned long portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -105,11 +109,11 @@ extern "C" {
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Critical section control macros. */
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 )
|
||||
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
|
||||
|
||||
#define portENTER_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portSHORT usCriticalNesting; \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
portDISABLE_INTERRUPTS(); \
|
||||
\
|
||||
|
@ -121,7 +125,7 @@ extern volatile unsigned portSHORT usCriticalNesting; \
|
|||
|
||||
#define portEXIT_CRITICAL() \
|
||||
{ \
|
||||
extern volatile unsigned portSHORT usCriticalNesting; \
|
||||
extern volatile uint16_t usCriticalNesting; \
|
||||
\
|
||||
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
|
||||
{ \
|
||||
|
@ -148,7 +152,7 @@ extern void vPortStart( void );
|
|||
/* Hardwware specifics. */
|
||||
#define portBYTE_ALIGNMENT 2
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
/* A critical section is exited when the critical section nesting count reaches
|
||||
this value. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
|
||||
#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
|
||||
|
||||
/* In all GICs 255 can be written to the priority mask register to unmask all
|
||||
(but the lowest) interrupt priority. */
|
||||
|
@ -126,17 +126,17 @@ floating point context after they have been created. A variable is stored as
|
|||
part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task
|
||||
does not have an FPU context, or any other value if the task does have an FPU
|
||||
context. */
|
||||
#define portNO_FLOATING_POINT_CONTEXT ( ( portSTACK_TYPE ) 0 )
|
||||
#define portNO_FLOATING_POINT_CONTEXT ( ( StackType_t ) 0 )
|
||||
|
||||
/* Constants required to setup the initial task context. */
|
||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||
#define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||
#define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
|
||||
#define portINTERRUPT_ENABLE_BIT ( 0x80UL )
|
||||
#define portTHUMB_MODE_ADDRESS ( 0x01UL )
|
||||
|
||||
/* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary
|
||||
point is zero. */
|
||||
#define portBINARY_POINT_BITS ( ( unsigned char ) 0x03 )
|
||||
#define portBINARY_POINT_BITS ( ( uint8_t ) 0x03 )
|
||||
|
||||
/* Masks all bits in the APSR other than the mode bits. */
|
||||
#define portAPSR_MODE_BITS_MASK ( 0x1F )
|
||||
|
@ -170,18 +170,18 @@ variable has to be stored as part of the task context and must be initialised to
|
|||
a non zero value to ensure interrupts don't inadvertently become unmasked before
|
||||
the scheduler starts. As it is stored as part of the task context it will
|
||||
automatically be set to 0 when the first task is started. */
|
||||
volatile unsigned long ulCriticalNesting = 9999UL;
|
||||
volatile uint32_t ulCriticalNesting = 9999UL;
|
||||
|
||||
/* Saved as part of the task context. If ulPortTaskHasFPUContext is non-zero then
|
||||
a floating point context must be saved and restored for the task. */
|
||||
unsigned long ulPortTaskHasFPUContext = pdFALSE;
|
||||
uint32_t ulPortTaskHasFPUContext = pdFALSE;
|
||||
|
||||
/* Set to 1 to pend a context switch from an ISR. */
|
||||
unsigned long ulPortYieldRequired = pdFALSE;
|
||||
uint32_t ulPortYieldRequired = pdFALSE;
|
||||
|
||||
/* Counts the interrupt nesting depth. A context switch is only performed if
|
||||
if the nesting depth is 0. */
|
||||
unsigned long ulPortInterruptNesting = 0UL;
|
||||
uint32_t ulPortInterruptNesting = 0UL;
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -189,7 +189,7 @@ unsigned long ulPortInterruptNesting = 0UL;
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Setup the initial stack of the task. The stack is set exactly as
|
||||
expected by the portRESTORE_CONTEXT() macro.
|
||||
|
@ -203,9 +203,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack--;
|
||||
*pxTopOfStack = NULL;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||
*pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
|
||||
|
||||
if( ( ( unsigned long ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL )
|
||||
if( ( ( uint32_t ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL )
|
||||
{
|
||||
/* The task will start in THUMB mode. */
|
||||
*pxTopOfStack |= portTHUMB_MODE_BIT;
|
||||
|
@ -214,37 +214,37 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
pxTopOfStack--;
|
||||
|
||||
/* Next the return address, which in this case is the start of the task. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Next all the registers other than the stack pointer. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The task will start with a critical nesting count of 0 as interrupts are
|
||||
|
@ -261,9 +261,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
unsigned long ulAPSR;
|
||||
uint32_t ulAPSR;
|
||||
|
||||
/* Only continue if the CPU is not in User mode. The CPU must be in a
|
||||
Privileged mode for the scheduler to start. */
|
||||
|
@ -359,7 +359,7 @@ void FreeRTOS_Tick_Handler( void )
|
|||
|
||||
void vPortTaskUsesFPU( void )
|
||||
{
|
||||
unsigned long ulInitialFPSCR = 0;
|
||||
uint32_t ulInitialFPSCR = 0;
|
||||
|
||||
/* A task is registering the fact that it needs an FPU context. Set the
|
||||
FPU flag (which is saved as part of the task context). */
|
||||
|
@ -370,7 +370,7 @@ unsigned long ulInitialFPSCR = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortClearInterruptMask( unsigned long ulNewMaskValue )
|
||||
void vPortClearInterruptMask( uint32_t ulNewMaskValue )
|
||||
{
|
||||
if( ulNewMaskValue == pdFALSE )
|
||||
{
|
||||
|
@ -379,9 +379,9 @@ void vPortClearInterruptMask( unsigned long ulNewMaskValue )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulPortSetInterruptMask( void )
|
||||
uint32_t ulPortSetInterruptMask( void )
|
||||
{
|
||||
unsigned long ulReturn;
|
||||
uint32_t ulReturn;
|
||||
|
||||
__disable_irq();
|
||||
if( portICCPMR_PRIORITY_MASK_REGISTER == ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) )
|
||||
|
|
|
@ -91,16 +91,21 @@
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned long
|
||||
#define portBASE_TYPE portLONG
|
||||
typedef unsigned long portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -110,7 +115,7 @@
|
|||
/* Called at the end of an ISR that can cause a context switch. */
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired )\
|
||||
{ \
|
||||
extern unsigned long ulPortYieldRequired; \
|
||||
extern uint32_t ulPortYieldRequired; \
|
||||
\
|
||||
if( xSwitchRequired != pdFALSE ) \
|
||||
{ \
|
||||
|
@ -128,8 +133,8 @@
|
|||
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( unsigned long ulNewMaskValue );
|
||||
extern uint32_t ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );
|
||||
|
||||
/* These macros do not globally disable/enable interrupts. They do mask off
|
||||
interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */
|
||||
|
@ -157,7 +162,7 @@
|
|||
void vPortTaskUsesFPU( void );
|
||||
#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU()
|
||||
|
||||
#define portLOWEST_INTERRUPT_PRIORITY ( ( ( unsigned long ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL )
|
||||
#define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL )
|
||||
#define portLOWEST_USABLE_INTERRUPT_PRIORITY ( portLOWEST_INTERRUPT_PRIORITY - 1UL )
|
||||
|
||||
/* Architecture specific optimisations. */
|
||||
|
@ -223,12 +228,12 @@ number of bits implemented by the interrupt controller. */
|
|||
#define portICCRPR_RUNNING_PRIORITY_OFFSET ( 0x14 )
|
||||
|
||||
#define portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET )
|
||||
#define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile unsigned char * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) )
|
||||
#define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile uint8_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) )
|
||||
#define portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET )
|
||||
#define portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCEOIR_END_OF_INTERRUPT_OFFSET )
|
||||
#define portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET )
|
||||
#define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile unsigned long * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) )
|
||||
#define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile unsigned char * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) )
|
||||
#define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) )
|
||||
#define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile uint8_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) )
|
||||
|
||||
#endif /* PORTMACRO_H */
|
||||
|
||||
|
|
|
@ -75,9 +75,9 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Constants required to manipulate the NVIC. */
|
||||
#define portNVIC_SYSTICK_CTRL ( ( volatile unsigned long *) 0xe000e010 )
|
||||
#define portNVIC_SYSTICK_LOAD ( ( volatile unsigned long *) 0xe000e014 )
|
||||
#define portNVIC_SYSPRI2 ( ( volatile unsigned long *) 0xe000ed20 )
|
||||
#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t *) 0xe000e010 )
|
||||
#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t *) 0xe000e014 )
|
||||
#define portNVIC_SYSPRI2 ( ( volatile uint32_t *) 0xe000ed20 )
|
||||
#define portNVIC_SYSTICK_CLK 0x00000004
|
||||
#define portNVIC_SYSTICK_INT 0x00000002
|
||||
#define portNVIC_SYSTICK_ENABLE 0x00000001
|
||||
|
@ -97,7 +97,7 @@ FreeRTOS.org versions prior to V4.3.0 did not include this definition. */
|
|||
|
||||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts.
|
||||
|
@ -124,18 +124,18 @@ static void prvTaskExitError( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */
|
||||
*pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack -= 8; /* R11..R4. */
|
||||
|
||||
return pxTopOfStack;
|
||||
|
@ -159,7 +159,7 @@ static void prvTaskExitError( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Make PendSV and SysTick the lowest priority interrupts. */
|
||||
*(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI;
|
||||
|
@ -222,7 +222,7 @@ void vPortExitCritical( void )
|
|||
|
||||
void xPortSysTickHandler( void )
|
||||
{
|
||||
unsigned long ulPreviousMask;
|
||||
uint32_t ulPreviousMask;
|
||||
|
||||
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
|
|
|
@ -87,28 +87,33 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portNVIC_INT_CTRL ( ( volatile unsigned long *) 0xe000ed04 )
|
||||
#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 )
|
||||
#define portNVIC_PENDSVSET 0x10000000
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET
|
||||
|
@ -120,8 +125,8 @@ extern void vPortYield( void );
|
|||
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulSetInterruptMaskFromISR( void );
|
||||
extern void vClearInterruptMaskFromISR( unsigned long ulMask );
|
||||
extern uint32_t ulSetInterruptMaskFromISR( void );
|
||||
extern void vClearInterruptMaskFromISR( uint32_t ulMask );
|
||||
|
||||
#define portDISABLE_INTERRUPTS() __asm volatile( "cpsid i" )
|
||||
#define portENABLE_INTERRUPTS() __asm volatile( "cpsie i" )
|
||||
|
|
|
@ -89,10 +89,10 @@
|
|||
#endif
|
||||
|
||||
/* Constants required to manipulate the core. Registers first... */
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) )
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) )
|
||||
/* ...then bits in the registers. */
|
||||
#define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL )
|
||||
#define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL )
|
||||
|
@ -100,16 +100,16 @@
|
|||
#define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL )
|
||||
#define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL )
|
||||
|
||||
#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
|
||||
/* Constants required to check the validity of an interrupt priority. */
|
||||
#define portFIRST_USER_INTERRUPT_NUMBER ( 16 )
|
||||
#define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 )
|
||||
#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 )
|
||||
#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 )
|
||||
#define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL )
|
||||
#define portPRIGROUP_SHIFT ( 8UL )
|
||||
|
||||
|
@ -133,7 +133,7 @@ FreeRTOS.org versions prior to V4.3.0 did not include this definition. */
|
|||
|
||||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts. The implementation in this
|
||||
|
@ -163,7 +163,7 @@ static void prvTaskExitError( void );
|
|||
* The number of SysTick increments that make up one tick period.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulTimerCountsForOneTick = 0;
|
||||
static uint32_t ulTimerCountsForOneTick = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -171,7 +171,7 @@ static void prvTaskExitError( void );
|
|||
* 24 bit resolution of the SysTick timer.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long xMaximumPossibleSuppressedTicks = 0;
|
||||
static uint32_t xMaximumPossibleSuppressedTicks = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -179,7 +179,7 @@ static void prvTaskExitError( void );
|
|||
* power functionality only.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulStoppedTimerCompensation = 0;
|
||||
static uint32_t ulStoppedTimerCompensation = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -188,9 +188,9 @@ static void prvTaskExitError( void );
|
|||
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
|
||||
*/
|
||||
#if ( configASSERT_DEFINED == 1 )
|
||||
static unsigned char ucMaxSysCallPriority = 0;
|
||||
static unsigned long ulMaxPRIGROUPValue = 0;
|
||||
static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
static uint8_t ucMaxSysCallPriority = 0;
|
||||
static uint32_t ulMaxPRIGROUPValue = 0;
|
||||
static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -198,18 +198,18 @@ static void prvTaskExitError( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */
|
||||
*pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
pxTopOfStack -= 8; /* R11, R10, R9, R8, R7, R6, R5 and R4. */
|
||||
|
||||
return pxTopOfStack;
|
||||
|
@ -233,13 +233,13 @@ static void prvTaskExitError( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
#if( configASSERT_DEFINED == 1 )
|
||||
{
|
||||
volatile unsigned long ulOriginalPriority;
|
||||
volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile unsigned char ucMaxPriorityValue;
|
||||
volatile uint32_t ulOriginalPriority;
|
||||
volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile uint8_t ucMaxPriorityValue;
|
||||
|
||||
/* Determine the maximum priority from which ISR safe FreeRTOS API
|
||||
functions can be called. ISR safe functions are those that end in
|
||||
|
@ -265,7 +265,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )
|
||||
{
|
||||
ulMaxPRIGROUPValue--;
|
||||
ucMaxPriorityValue <<= ( unsigned char ) 0x01;
|
||||
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
|
||||
}
|
||||
|
||||
/* Shift the priority group value back to its position within the AIRCR
|
||||
|
@ -360,10 +360,10 @@ void xPortSysTickHandler( void )
|
|||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||
__weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
portTickType xModifiableIdleTime;
|
||||
uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
TickType_t xModifiableIdleTime;
|
||||
|
||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||
|
@ -449,7 +449,7 @@ void xPortSysTickHandler( void )
|
|||
|
||||
if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
|
||||
{
|
||||
unsigned long ulCalculatedLoadValue;
|
||||
uint32_t ulCalculatedLoadValue;
|
||||
|
||||
/* The tick interrupt has already executed, and the SysTick
|
||||
count reloaded with ulReloadValue. Reset the
|
||||
|
@ -535,8 +535,8 @@ __weak void vPortSetupTimerInterrupt( void )
|
|||
|
||||
void vPortValidateInterruptPriority( void )
|
||||
{
|
||||
unsigned long ulCurrentInterrupt;
|
||||
unsigned char ucCurrentPriority;
|
||||
uint32_t ulCurrentInterrupt;
|
||||
uint8_t ucCurrentPriority;
|
||||
|
||||
/* Obtain the number of the currently executing interrupt. */
|
||||
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );
|
||||
|
|
|
@ -87,27 +87,31 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04UL ) )
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04UL ) )
|
||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||
|
@ -137,8 +141,8 @@ extern void vPortYield( void );
|
|||
/* Critical section management. */
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( unsigned long ulNewMask );
|
||||
extern uint32_t ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( uint32_t ulNewMask );
|
||||
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
|
||||
#define portENABLE_INTERRUPTS() vPortClearInterruptMask( 0 )
|
||||
|
@ -150,7 +154,7 @@ extern void vPortClearInterruptMask( unsigned long ulNewMask );
|
|||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
|
||||
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -93,10 +93,10 @@
|
|||
#endif
|
||||
|
||||
/* Constants required to manipulate the core. Registers first... */
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) )
|
||||
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) )
|
||||
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) )
|
||||
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) )
|
||||
#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) )
|
||||
/* ...then bits in the registers. */
|
||||
#define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL )
|
||||
#define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL )
|
||||
|
@ -104,21 +104,21 @@
|
|||
#define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL )
|
||||
#define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL )
|
||||
|
||||
#define portNVIC_PENDSV_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
|
||||
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
|
||||
|
||||
/* Constants required to check the validity of an interrupt priority. */
|
||||
#define portFIRST_USER_INTERRUPT_NUMBER ( 16 )
|
||||
#define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 )
|
||||
#define portAIRCR_REG ( * ( ( volatile unsigned long * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( unsigned char ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( unsigned char ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( unsigned char ) 7 )
|
||||
#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) )
|
||||
#define portMAX_8_BIT_VALUE ( ( int8_t ) 0xff )
|
||||
#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 )
|
||||
#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 )
|
||||
#define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL )
|
||||
#define portPRIGROUP_SHIFT ( 8UL )
|
||||
|
||||
/* Constants required to manipulate the VFP. */
|
||||
#define portFPCCR ( ( volatile unsigned long * ) 0xe000ef34 ) /* Floating point context control register. */
|
||||
#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */
|
||||
#define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL )
|
||||
|
||||
/* Constants required to set up the initial stack. */
|
||||
|
@ -136,7 +136,7 @@ calculations. */
|
|||
|
||||
/* Each task maintains its own interrupt status in the critical nesting
|
||||
variable. */
|
||||
static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;
|
||||
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
|
||||
|
||||
/*
|
||||
* Setup the timer to generate the tick interrupts. The implementation in this
|
||||
|
@ -171,7 +171,7 @@ static void prvTaskExitError( void );
|
|||
* The number of SysTick increments that make up one tick period.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulTimerCountsForOneTick = 0;
|
||||
static uint32_t ulTimerCountsForOneTick = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -179,7 +179,7 @@ static void prvTaskExitError( void );
|
|||
* 24 bit resolution of the SysTick timer.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long xMaximumPossibleSuppressedTicks = 0;
|
||||
static uint32_t xMaximumPossibleSuppressedTicks = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -187,7 +187,7 @@ static void prvTaskExitError( void );
|
|||
* power functionality only.
|
||||
*/
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
static unsigned long ulStoppedTimerCompensation = 0;
|
||||
static uint32_t ulStoppedTimerCompensation = 0;
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
/*
|
||||
|
@ -196,9 +196,9 @@ static void prvTaskExitError( void );
|
|||
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
|
||||
*/
|
||||
#if ( configASSERT_DEFINED == 1 )
|
||||
static unsigned char ucMaxSysCallPriority = 0;
|
||||
static unsigned long ulMaxPRIGROUPValue = 0;
|
||||
static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
static uint8_t ucMaxSysCallPriority = 0;
|
||||
static uint32_t ulMaxPRIGROUPValue = 0;
|
||||
static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16;
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -206,7 +206,7 @@ static void prvTaskExitError( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
interrupt. */
|
||||
|
@ -217,13 +217,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */
|
||||
*pxTopOfStack = ( StackType_t ) prvTaskExitError; /* LR */
|
||||
|
||||
/* Save code space by skipping register initialisation. */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
|
||||
|
||||
/* A save method is being used that requires each task to maintain its
|
||||
own exec return value. */
|
||||
|
@ -253,13 +253,13 @@ static void prvTaskExitError( void )
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
#if( configASSERT_DEFINED == 1 )
|
||||
{
|
||||
volatile unsigned long ulOriginalPriority;
|
||||
volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile unsigned char ucMaxPriorityValue;
|
||||
volatile uint32_t ulOriginalPriority;
|
||||
volatile int8_t * const pcFirstUserPriorityRegister = ( volatile int8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
|
||||
volatile uint8_t ucMaxPriorityValue;
|
||||
|
||||
/* Determine the maximum priority from which ISR safe FreeRTOS API
|
||||
functions can be called. ISR safe functions are those that end in
|
||||
|
@ -285,7 +285,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )
|
||||
{
|
||||
ulMaxPRIGROUPValue--;
|
||||
ucMaxPriorityValue <<= ( unsigned char ) 0x01;
|
||||
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
|
||||
}
|
||||
|
||||
/* Shift the priority group value back to its position within the AIRCR
|
||||
|
@ -386,10 +386,10 @@ void xPortSysTickHandler( void )
|
|||
|
||||
#if configUSE_TICKLESS_IDLE == 1
|
||||
|
||||
__weak void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||
__weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
portTickType xModifiableIdleTime;
|
||||
uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;
|
||||
TickType_t xModifiableIdleTime;
|
||||
|
||||
/* Make sure the SysTick reload value does not overflow the counter. */
|
||||
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
|
||||
|
@ -475,7 +475,7 @@ void xPortSysTickHandler( void )
|
|||
|
||||
if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
|
||||
{
|
||||
unsigned long ulCalculatedLoadValue;
|
||||
uint32_t ulCalculatedLoadValue;
|
||||
|
||||
/* The tick interrupt has already executed, and the SysTick
|
||||
count reloaded with ulReloadValue. Reset the
|
||||
|
@ -561,8 +561,8 @@ __weak void vPortSetupTimerInterrupt( void )
|
|||
|
||||
void vPortValidateInterruptPriority( void )
|
||||
{
|
||||
unsigned long ulCurrentInterrupt;
|
||||
unsigned char ucCurrentPriority;
|
||||
uint32_t ulCurrentInterrupt;
|
||||
uint8_t ucCurrentPriority;
|
||||
|
||||
/* Obtain the number of the currently executing interrupt. */
|
||||
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );
|
||||
|
|
|
@ -87,27 +87,31 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE unsigned portLONG
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||
|
@ -137,8 +141,8 @@ extern void vPortYield( void );
|
|||
/* Critical section management. */
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern unsigned long ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( unsigned long ulNewMask );
|
||||
extern uint32_t ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( uint32_t ulNewMask );
|
||||
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
|
||||
#define portENABLE_INTERRUPTS() vPortClearInterruptMask( 0 )
|
||||
|
@ -150,7 +154,7 @@ extern void vPortClearInterruptMask( unsigned long ulNewMask );
|
|||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
|
||||
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
|
||||
|
|
|
@ -73,13 +73,13 @@
|
|||
*----------------------------------------------------------*/
|
||||
|
||||
/* Start tasks with interrupts enables. */
|
||||
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 )
|
||||
#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x80 )
|
||||
|
||||
/* Hardware constants for timer 1. */
|
||||
#define portCLEAR_COUNTER_ON_MATCH ( ( unsigned char ) 0x08 )
|
||||
#define portPRESCALE_64 ( ( unsigned char ) 0x03 )
|
||||
#define portCLOCK_PRESCALER ( ( unsigned long ) 64 )
|
||||
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( unsigned char ) 0x10 )
|
||||
#define portCLEAR_COUNTER_ON_MATCH ( ( uint8_t ) 0x08 )
|
||||
#define portPRESCALE_64 ( ( uint8_t ) 0x03 )
|
||||
#define portCLOCK_PRESCALER ( ( uint32_t ) 64 )
|
||||
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( uint8_t ) 0x10 )
|
||||
|
||||
/* The number of bytes used on the hardware stack by the task start address. */
|
||||
#define portBYTES_USED_BY_RETURN_ADDRESS ( 2 )
|
||||
|
@ -87,8 +87,8 @@
|
|||
|
||||
/* Stores the critical section nesting. This must not be initialised to 0.
|
||||
It will be initialised when a task starts. */
|
||||
#define portNO_CRITICAL_NESTING ( ( unsigned portBASE_TYPE ) 0 )
|
||||
unsigned portBASE_TYPE uxCriticalNesting = 0x50;
|
||||
#define portNO_CRITICAL_NESTING ( ( UBaseType_t ) 0 )
|
||||
UBaseType_t uxCriticalNesting = 0x50;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -108,10 +108,10 @@ extern void vPortStart( void );
|
|||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||
{
|
||||
unsigned short usAddress;
|
||||
portSTACK_TYPE *pxTopOfHardwareStack;
|
||||
uint16_t usAddress;
|
||||
StackType_t *pxTopOfHardwareStack;
|
||||
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
This is just useful for debugging. */
|
||||
|
@ -149,12 +149,12 @@ portSTACK_TYPE *pxTopOfHardwareStack;
|
|||
|
||||
The first part of the stack is the hardware stack. Place the start
|
||||
address of the task on the hardware stack. */
|
||||
usAddress = ( unsigned short ) pxCode;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
usAddress = ( uint16_t ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
|
||||
|
@ -169,7 +169,7 @@ portSTACK_TYPE *pxTopOfHardwareStack;
|
|||
portSAVE_CONTEXT places the flags on the stack immediately after r0
|
||||
to ensure the interrupts get disabled as soon as possible, and so ensuring
|
||||
the stack use is minimal should a context switch interrupt occur. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R0 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portFLAGS_INT_ENABLED;
|
||||
pxTopOfStack--;
|
||||
|
@ -177,88 +177,88 @@ portSTACK_TYPE *pxTopOfHardwareStack;
|
|||
/* Next place the address of the hardware stack. This is required so
|
||||
the AVR stack pointer can be restored to point to the hardware stack. */
|
||||
pxTopOfHardwareStack -= portBYTES_USED_BY_RETURN_ADDRESS;
|
||||
usAddress = ( unsigned short ) pxTopOfHardwareStack;
|
||||
usAddress = ( uint16_t ) pxTopOfHardwareStack;
|
||||
|
||||
/* SPL */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* SPH */
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Now the remaining registers. */
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x01; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x01; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x02; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x02; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x03; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x04; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x05; /* R5 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x05; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x06; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x07; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x08; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x09; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x10; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x12; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R13 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x13; /* R13 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x14; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R15 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x15; /* R15 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Place the parameter on the stack in the expected location. */
|
||||
usAddress = ( unsigned short ) pvParameters;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
usAddress = ( uint16_t ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned short ) 0x00ff );
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R18 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x18; /* R18 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R19 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x19; /* R19 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x20; /* R20 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x20; /* R20 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x21; /* R21 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x21; /* R21 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x22; /* R22 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x22; /* R22 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x23; /* R23 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x23; /* R23 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x24; /* R24 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x24; /* R24 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x25; /* R25 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x25; /* R25 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x26; /* R26 X */
|
||||
*pxTopOfStack = ( StackType_t ) 0x26; /* R26 X */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x27; /* R27 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x27; /* R27 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The Y register is not stored as it is used as the software stack and
|
||||
gets saved into the task control block. */
|
||||
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x30; /* R30 Z */
|
||||
*pxTopOfStack = ( StackType_t ) 0x30; /* R30 Z */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x031; /* R31 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x031; /* R31 */
|
||||
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portNO_CRITICAL_NESTING; /* Critical nesting is zero when the task starts. */
|
||||
|
@ -269,7 +269,7 @@ portSTACK_TYPE *pxTopOfHardwareStack;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xPortStartScheduler( void )
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
@ -296,8 +296,8 @@ void vPortEndScheduler( void )
|
|||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
unsigned long ulCompareMatch;
|
||||
unsigned char ucHighByte, ucLowByte;
|
||||
uint32_t ulCompareMatch;
|
||||
uint8_t ucHighByte, ucLowByte;
|
||||
|
||||
/* Using 16bit timer 1 to generate the tick. Correct fuses must be
|
||||
selected for the configCPU_CLOCK_HZ clock. */
|
||||
|
@ -308,13 +308,13 @@ unsigned char ucHighByte, ucLowByte;
|
|||
ulCompareMatch /= portCLOCK_PRESCALER;
|
||||
|
||||
/* Adjust for correct value. */
|
||||
ulCompareMatch -= ( unsigned long ) 1;
|
||||
ulCompareMatch -= ( uint32_t ) 1;
|
||||
|
||||
/* Setup compare match value for compare match A. Interrupts are disabled
|
||||
before this is called so we need not worry here. */
|
||||
ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
|
||||
ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||
ulCompareMatch >>= 8;
|
||||
ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
|
||||
ucHighByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||
OCR1AH = ucHighByte;
|
||||
OCR1AL = ucLowByte;
|
||||
|
||||
|
|
|
@ -93,16 +93,20 @@ extern "C" {
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT int
|
||||
#define portSTACK_TYPE unsigned portCHAR
|
||||
#define portBASE_TYPE portCHAR
|
||||
#define portPOINTER_SIZE_TYPE unsigned short
|
||||
#define portSTACK_TYPE uint8_t
|
||||
#define portBASE_TYPE char
|
||||
#define portPOINTER_SIZE_TYPE uint16_t
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef signed char BaseType_t;
|
||||
typedef unsigned char UBaseType_t;
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef unsigned portSHORT portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef unsigned portLONG portTickType;
|
||||
#define portMAX_DELAY ( portTickType ) 0xffffffffUL
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -119,7 +123,7 @@ extern void vPortExitCritical( void );
|
|||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||
#define portTICK_RATE_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 1
|
||||
#define portNOP() asm( "nop" )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue