mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Make changes required for MISRA 2004 compliance.
This commit is contained in:
parent
c26b230d28
commit
a5820e2b2a
|
@ -415,7 +415,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef pvPortMallocAligned
|
#ifndef pvPortMallocAligned
|
||||||
#define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) )
|
#define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef vPortFreeAligned
|
#ifndef vPortFreeAligned
|
||||||
|
|
|
@ -93,8 +93,6 @@
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \
|
|
||||||
\
|
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -110,7 +108,6 @@
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \
|
|
||||||
\
|
\
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
|
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
|
||||||
|
@ -126,7 +123,6 @@
|
||||||
|
|
||||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \
|
|
||||||
static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
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, \
|
||||||
|
@ -148,7 +144,6 @@
|
||||||
|
|
||||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
{ \
|
{ \
|
||||||
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \
|
|
||||||
char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \
|
char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \
|
||||||
static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
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, \
|
||||||
|
|
|
@ -51,16 +51,13 @@
|
||||||
licensing and training services.
|
licensing and training services.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef CO_ROUTINE_H
|
||||||
|
#define CO_ROUTINE_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include croutine.h"
|
#error "include FreeRTOS.h must appear in source files before include croutine.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef CO_ROUTINE_H
|
|
||||||
#define CO_ROUTINE_H
|
|
||||||
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -230,7 +227,7 @@ void vCoRoutineSchedule( void );
|
||||||
* \defgroup crSTART crSTART
|
* \defgroup crSTART crSTART
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crSTART( pxCRCB ) switch( ( ( corCRCB * )pxCRCB )->uxState ) { case 0:
|
#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
|
@ -267,8 +264,8 @@ void vCoRoutineSchedule( void );
|
||||||
* These macros are intended for internal use by the co-routine implementation
|
* These macros are intended for internal use by the co-routine implementation
|
||||||
* only. The macros should not be used directly by application writers.
|
* only. The macros should not be used directly by application writers.
|
||||||
*/
|
*/
|
||||||
#define crSET_STATE0( xHandle ) ( ( corCRCB * )xHandle)->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
|
#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_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* croutine. h
|
* croutine. h
|
||||||
|
@ -317,11 +314,11 @@ void vCoRoutineSchedule( void );
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crDELAY( xHandle, xTicksToDelay ) \
|
#define crDELAY( xHandle, xTicksToDelay ) \
|
||||||
if( xTicksToDelay > 0 ) \
|
if( ( xTicksToDelay ) > 0 ) \
|
||||||
{ \
|
{ \
|
||||||
vCoRoutineAddToDelayedList( xTicksToDelay, NULL ); \
|
vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
|
||||||
} \
|
} \
|
||||||
crSET_STATE0( xHandle );
|
crSET_STATE0( ( xHandle ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -408,15 +405,15 @@ void vCoRoutineSchedule( void );
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
|
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
|
||||||
{ \
|
{ \
|
||||||
*pxResult = xQueueCRSend( pxQueue, pvItemToQueue, xTicksToWait ); \
|
*( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) ); \
|
||||||
if( *pxResult == errQUEUE_BLOCKED ) \
|
if( *pxResult == errQUEUE_BLOCKED ) \
|
||||||
{ \
|
{ \
|
||||||
crSET_STATE0( xHandle ); \
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
*pxResult = xQueueCRSend( pxQueue, pvItemToQueue, 0 ); \
|
*pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 ); \
|
||||||
} \
|
} \
|
||||||
if( *pxResult == errQUEUE_YIELD ) \
|
if( *pxResult == errQUEUE_YIELD ) \
|
||||||
{ \
|
{ \
|
||||||
crSET_STATE1( xHandle ); \
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
*pxResult = pdPASS; \
|
*pxResult = pdPASS; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -500,16 +497,16 @@ void vCoRoutineSchedule( void );
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
|
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
|
||||||
{ \
|
{ \
|
||||||
*pxResult = xQueueCRReceive( pxQueue, pvBuffer, xTicksToWait ); \
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) ); \
|
||||||
if( *pxResult == errQUEUE_BLOCKED ) \
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
{ \
|
{ \
|
||||||
crSET_STATE0( xHandle ); \
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
*pxResult = xQueueCRReceive( pxQueue, pvBuffer, 0 ); \
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 ); \
|
||||||
} \
|
} \
|
||||||
if( *pxResult == errQUEUE_YIELD ) \
|
if( *( pxResult ) == errQUEUE_YIELD ) \
|
||||||
{ \
|
{ \
|
||||||
crSET_STATE1( xHandle ); \
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
*pxResult = pdPASS; \
|
*( pxResult ) = pdPASS; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,7 +604,7 @@ void vCoRoutineSchedule( void );
|
||||||
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
|
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken )
|
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -720,7 +717,7 @@ void vCoRoutineSchedule( void );
|
||||||
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
|
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( pxQueue, pvBuffer, pxCoRoutineWoken )
|
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is intended for internal use by the co-routine macros only.
|
* This function is intended for internal use by the co-routine macros only.
|
||||||
|
|
|
@ -130,7 +130,7 @@ typedef struct xLIST
|
||||||
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( pxListItem )->pvOwner = ( void * ) pxOwner
|
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( pxListItem )->pvOwner = ( void * ) ( pxOwner )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to set the value of the list item. In most cases the value is
|
* Access macro to set the value of the list item. In most cases the value is
|
||||||
|
@ -139,7 +139,7 @@ typedef struct xLIST
|
||||||
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( pxListItem )->xItemValue = xValue
|
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( pxListItem )->xItemValue = ( xValue )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro the retrieve the value of the list item. The value can
|
* Access macro the retrieve the value of the list item. The value can
|
||||||
|
@ -186,7 +186,7 @@ typedef struct xLIST
|
||||||
*/
|
*/
|
||||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
{ \
|
{ \
|
||||||
xList * const pxConstList = pxList; \
|
xList * const pxConstList = ( pxList ); \
|
||||||
/* Increment the index to the next item and return the item, ensuring */ \
|
/* Increment the index to the next item and return the item, ensuring */ \
|
||||||
/* we don't return the marker used at the end of the list. */ \
|
/* we don't return the marker used at the end of the list. */ \
|
||||||
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
|
@ -194,7 +194,7 @@ xList * const pxConstList = pxList; \
|
||||||
{ \
|
{ \
|
||||||
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
} \
|
} \
|
||||||
pxTCB = ( pxConstList )->pxIndex->pvOwner; \
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ xList * const pxConstList = pxList; \
|
||||||
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( (&( pxList->xListEnd ))->pxNext->pvOwner )
|
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if a list item is within a list. The list item maintains a
|
* Check to see if a list item is within a list. The list item maintains a
|
||||||
|
@ -226,7 +226,7 @@ xList * const pxConstList = pxList; \
|
||||||
* @return pdTRUE is the list item is in the list, otherwise pdFALSE.
|
* @return pdTRUE is the list item is in the list, otherwise pdFALSE.
|
||||||
* pointer against
|
* pointer against
|
||||||
*/
|
*/
|
||||||
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) pxList )
|
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be called before a list is used! This initialises all the members
|
* Must be called before a list is used! This initialises all the members
|
||||||
|
|
|
@ -469,7 +469,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
|
||||||
* \defgroup xQueueSend xQueueSend
|
* \defgroup xQueueSend xQueueSend
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
|
signed portBASE_TYPE xQueueGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -784,7 +784,7 @@ unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );
|
||||||
* \page vQueueDelete vQueueDelete
|
* \page vQueueDelete vQueueDelete
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
void vQueueDelete( xQueueHandle xQueue );
|
void vQueueDelete( xQueueHandle pxQueue );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -1223,8 +1223,8 @@ xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue,
|
||||||
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
||||||
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
|
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
|
||||||
*/
|
*/
|
||||||
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime );
|
portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle pxMutex, portTickType xBlockTime );
|
||||||
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex );
|
portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The registry is provided as a means for kernel aware debuggers to
|
* The registry is provided as a means for kernel aware debuggers to
|
||||||
|
|
|
@ -52,15 +52,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef TASK_H
|
||||||
|
#define TASK_H
|
||||||
|
|
||||||
#ifndef INC_FREERTOS_H
|
#ifndef INC_FREERTOS_H
|
||||||
#error "include FreeRTOS.h must appear in source files before include task.h"
|
#error "include FreeRTOS.h must appear in source files before include task.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TASK_H
|
|
||||||
#define TASK_H
|
|
||||||
|
|
||||||
#include "portable.h"
|
#include "portable.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
@ -427,8 +425,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
|
||||||
* \defgroup vTaskDelete vTaskDelete
|
* \defgroup vTaskDelete vTaskDelete
|
||||||
* \ingroup Tasks
|
* \ingroup Tasks
|
||||||
*/
|
*/
|
||||||
void vTaskDelete( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
|
void vTaskDelete( xTaskHandle pxTaskToDelete ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* TASK CONTROL API
|
* TASK CONTROL API
|
||||||
|
@ -1278,7 +1275,7 @@ void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUN
|
||||||
* Generic version of the task creation function which is in turn called by the
|
* Generic version of the task creation function which is in turn called by the
|
||||||
* xTaskCreate() and xTaskCreateRestricted() macros.
|
* xTaskCreate() and xTaskCreateRestricted() macros.
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pvTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;
|
signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ void vListInitialise( xList *pxList )
|
||||||
pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );
|
pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );
|
||||||
pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );
|
pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );
|
||||||
|
|
||||||
pxList->uxNumberOfItems = 0;
|
pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,15 @@ portSTACK_TYPE and portBASE_TYPE. */
|
||||||
/* The location of the software interrupt register. Software interrupts use
|
/* The location of the software interrupt register. Software interrupts use
|
||||||
vector 27. */
|
vector 27. */
|
||||||
#define portITU_SWINTR ( ( unsigned char * ) 0x000872E0 )
|
#define portITU_SWINTR ( ( unsigned char * ) 0x000872E0 )
|
||||||
#define portYIELD() *portITU_SWINTR = 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()
|
#define portYIELD() *portITU_SWINTR = ( unsigned char ) 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()
|
||||||
#define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD()
|
#define portYIELD_FROM_ISR( x ) if( ( x ) != pdFALSE ) portYIELD()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These macros should be called directly, but through the taskENTER_CRITICAL()
|
* These macros should be called directly, but through the taskENTER_CRITICAL()
|
||||||
* and taskEXIT_CRITICAL() macros.
|
* and taskEXIT_CRITICAL() macros.
|
||||||
*/
|
*/
|
||||||
#define portENABLE_INTERRUPTS() __set_interrupt_level( 0 )
|
#define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 )
|
||||||
#define portDISABLE_INTERRUPTS() __set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
#define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||||
|
|
||||||
/* Critical nesting counts are stored in the TCB. */
|
/* Critical nesting counts are stored in the TCB. */
|
||||||
#define portCRITICAL_NESTING_IN_TCB ( 1 )
|
#define portCRITICAL_NESTING_IN_TCB ( 1 )
|
||||||
|
@ -115,14 +115,14 @@ vector 27. */
|
||||||
/* The critical nesting functions defined within tasks.c. */
|
/* The critical nesting functions defined within tasks.c. */
|
||||||
extern void vTaskEnterCritical( void );
|
extern void vTaskEnterCritical( void );
|
||||||
extern void vTaskExitCritical( void );
|
extern void vTaskExitCritical( void );
|
||||||
#define portENTER_CRITICAL() vTaskEnterCritical();
|
#define portENTER_CRITICAL() vTaskEnterCritical()
|
||||||
#define portEXIT_CRITICAL() vTaskExitCritical();
|
#define portEXIT_CRITICAL() vTaskExitCritical()
|
||||||
|
|
||||||
/* As this port allows interrupt nesting... */
|
/* As this port allows interrupt nesting... */
|
||||||
unsigned long ulPortGetIPL( void );
|
unsigned long ulPortGetIPL( void );
|
||||||
void vPortSetIPL( unsigned long ulNewIPL );
|
void vPortSetIPL( unsigned long ulNewIPL );
|
||||||
#define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS()
|
#define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS()
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( uxSavedInterruptStatus )
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) )
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -223,20 +223,18 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
|
||||||
* accessing the queue event lists.
|
* accessing the queue event lists.
|
||||||
*/
|
*/
|
||||||
#define prvLockQueue( pxQueue ) \
|
#define prvLockQueue( pxQueue ) \
|
||||||
{ \
|
|
||||||
taskENTER_CRITICAL(); \
|
taskENTER_CRITICAL(); \
|
||||||
{ \
|
{ \
|
||||||
if( pxQueue->xRxLock == queueUNLOCKED ) \
|
if( ( pxQueue )->xRxLock == queueUNLOCKED ) \
|
||||||
{ \
|
{ \
|
||||||
pxQueue->xRxLock = queueLOCKED_UNMODIFIED; \
|
( pxQueue )->xRxLock = queueLOCKED_UNMODIFIED; \
|
||||||
} \
|
} \
|
||||||
if( pxQueue->xTxLock == queueUNLOCKED ) \
|
if( ( pxQueue )->xTxLock == queueUNLOCKED ) \
|
||||||
{ \
|
{ \
|
||||||
pxQueue->xTxLock = queueLOCKED_UNMODIFIED; \
|
( pxQueue )->xTxLock = queueLOCKED_UNMODIFIED; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
taskEXIT_CRITICAL(); \
|
taskEXIT_CRITICAL()
|
||||||
}
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,6 +246,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
|
||||||
{
|
{
|
||||||
xQUEUE *pxNewQueue;
|
xQUEUE *pxNewQueue;
|
||||||
size_t xQueueSizeInBytes;
|
size_t xQueueSizeInBytes;
|
||||||
|
xQueueHandle xReturn = NULL;
|
||||||
|
|
||||||
/* Allocate the new queue structure. */
|
/* Allocate the new queue structure. */
|
||||||
if( uxQueueLength > ( unsigned portBASE_TYPE ) 0 )
|
if( uxQueueLength > ( unsigned portBASE_TYPE ) 0 )
|
||||||
|
@ -265,9 +264,9 @@ size_t xQueueSizeInBytes;
|
||||||
/* Initialise the queue members as described above where the
|
/* Initialise the queue members as described above where the
|
||||||
queue type is defined. */
|
queue type is defined. */
|
||||||
pxNewQueue->pcTail = pxNewQueue->pcHead + ( uxQueueLength * uxItemSize );
|
pxNewQueue->pcTail = pxNewQueue->pcHead + ( uxQueueLength * uxItemSize );
|
||||||
pxNewQueue->uxMessagesWaiting = 0;
|
pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;
|
||||||
pxNewQueue->pcWriteTo = pxNewQueue->pcHead;
|
pxNewQueue->pcWriteTo = pxNewQueue->pcHead;
|
||||||
pxNewQueue->pcReadFrom = pxNewQueue->pcHead + ( ( uxQueueLength - 1 ) * uxItemSize );
|
pxNewQueue->pcReadFrom = pxNewQueue->pcHead + ( ( uxQueueLength - ( unsigned portBASE_TYPE ) 1U ) * uxItemSize );
|
||||||
pxNewQueue->uxLength = uxQueueLength;
|
pxNewQueue->uxLength = uxQueueLength;
|
||||||
pxNewQueue->uxItemSize = uxItemSize;
|
pxNewQueue->uxItemSize = uxItemSize;
|
||||||
pxNewQueue->xRxLock = queueUNLOCKED;
|
pxNewQueue->xRxLock = queueUNLOCKED;
|
||||||
|
@ -278,7 +277,7 @@ size_t xQueueSizeInBytes;
|
||||||
vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );
|
vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );
|
||||||
|
|
||||||
traceQUEUE_CREATE( pxNewQueue );
|
traceQUEUE_CREATE( pxNewQueue );
|
||||||
return pxNewQueue;
|
xReturn = pxNewQueue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -288,9 +287,7 @@ size_t xQueueSizeInBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Will only reach here if we could not allocate enough memory or no memory
|
return xReturn;
|
||||||
was required. */
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -316,9 +313,9 @@ size_t xQueueSizeInBytes;
|
||||||
/* Each mutex has a length of 1 (like a binary semaphore) and
|
/* Each mutex has a length of 1 (like a binary semaphore) and
|
||||||
an item size of 0 as nothing is actually copied into or out
|
an item size of 0 as nothing is actually copied into or out
|
||||||
of the mutex. */
|
of the mutex. */
|
||||||
pxNewQueue->uxMessagesWaiting = 0;
|
pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;
|
||||||
pxNewQueue->uxLength = 1;
|
pxNewQueue->uxLength = ( unsigned portBASE_TYPE ) 1U;
|
||||||
pxNewQueue->uxItemSize = 0;
|
pxNewQueue->uxItemSize = ( unsigned portBASE_TYPE ) 0U;
|
||||||
pxNewQueue->xRxLock = queueUNLOCKED;
|
pxNewQueue->xRxLock = queueUNLOCKED;
|
||||||
pxNewQueue->xTxLock = queueUNLOCKED;
|
pxNewQueue->xTxLock = queueUNLOCKED;
|
||||||
|
|
||||||
|
@ -327,7 +324,7 @@ size_t xQueueSizeInBytes;
|
||||||
vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );
|
vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );
|
||||||
|
|
||||||
/* Start with the semaphore in the expected state. */
|
/* Start with the semaphore in the expected state. */
|
||||||
xQueueGenericSend( pxNewQueue, NULL, 0, queueSEND_TO_BACK );
|
xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );
|
||||||
|
|
||||||
traceCREATE_MUTEX( pxNewQueue );
|
traceCREATE_MUTEX( pxNewQueue );
|
||||||
}
|
}
|
||||||
|
|
100
Source/tasks.c
100
Source/tasks.c
|
@ -177,7 +177,7 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime = ( portTickType )
|
||||||
* The value used to fill the stack of a task when the task is created. This
|
* The value used to fill the stack of a task when the task is created. This
|
||||||
* is used purely for checking the high water mark for tasks.
|
* is used purely for checking the high water mark for tasks.
|
||||||
*/
|
*/
|
||||||
#define tskSTACK_FILL_BYTE ( 0xa5 )
|
#define tskSTACK_FILL_BYTE ( 0xa5U )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros used by vListTask to indicate which state a task is in.
|
* Macros used by vListTask to indicate which state a task is in.
|
||||||
|
@ -197,7 +197,7 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime = ( portTickType )
|
||||||
PRIVILEGED_DATA static signed char *pcTraceBufferStart;
|
PRIVILEGED_DATA static signed char *pcTraceBufferStart;
|
||||||
PRIVILEGED_DATA static signed char *pcTraceBufferEnd;
|
PRIVILEGED_DATA static signed char *pcTraceBufferEnd;
|
||||||
PRIVILEGED_DATA static signed portBASE_TYPE xTracing = pdFALSE;
|
PRIVILEGED_DATA static signed portBASE_TYPE xTracing = pdFALSE;
|
||||||
static unsigned portBASE_TYPE uxPreviousTask = 255;
|
static unsigned portBASE_TYPE uxPreviousTask = 255U;
|
||||||
PRIVILEGED_DATA static char pcStatusString[ 50 ];
|
PRIVILEGED_DATA static char pcStatusString[ 50 ];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -249,13 +249,11 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime = ( portTickType )
|
||||||
* executing task has been rescheduled.
|
* executing task has been rescheduled.
|
||||||
*/
|
*/
|
||||||
#define prvAddTaskToReadyQueue( pxTCB ) \
|
#define prvAddTaskToReadyQueue( pxTCB ) \
|
||||||
{ \
|
if( ( pxTCB )->uxPriority > uxTopReadyPriority ) \
|
||||||
if( pxTCB->uxPriority > uxTopReadyPriority ) \
|
|
||||||
{ \
|
{ \
|
||||||
uxTopReadyPriority = pxTCB->uxPriority; \
|
uxTopReadyPriority = ( pxTCB )->uxPriority; \
|
||||||
} \
|
} \
|
||||||
vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ); \
|
vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
|
||||||
}
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -326,8 +324,10 @@ portTickType xItemValue; \
|
||||||
* task should be used in place of the parameter. This macro simply checks to
|
* task should be used in place of the parameter. This macro simply checks to
|
||||||
* see if the parameter is NULL and returns a pointer to the appropriate TCB.
|
* see if the parameter is NULL and returns a pointer to the appropriate TCB.
|
||||||
*/
|
*/
|
||||||
#define prvGetTCBFromHandle( pxHandle ) ( ( pxHandle == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) pxHandle )
|
#define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )
|
||||||
|
|
||||||
|
/* Callback function prototypes. --------------------------*/
|
||||||
|
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );
|
||||||
|
|
||||||
/* File private functions. --------------------------------*/
|
/* File private functions. --------------------------------*/
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ tskTCB * pxNewTCB;
|
||||||
required by the port. */
|
required by the port. */
|
||||||
#if( portSTACK_GROWTH < 0 )
|
#if( portSTACK_GROWTH < 0 )
|
||||||
{
|
{
|
||||||
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - 1 );
|
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );
|
||||||
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK ) );
|
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK ) );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -497,7 +497,7 @@ tskTCB * pxNewTCB;
|
||||||
|
|
||||||
/* We are going to manipulate the task queues to add this task to a
|
/* We are going to manipulate the task queues to add this task to a
|
||||||
ready list, so must make sure no interrupts occur. */
|
ready list, so must make sure no interrupts occur. */
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
uxCurrentNumberOfTasks++;
|
uxCurrentNumberOfTasks++;
|
||||||
if( pxCurrentTCB == NULL )
|
if( pxCurrentTCB == NULL )
|
||||||
|
@ -548,7 +548,7 @@ tskTCB * pxNewTCB;
|
||||||
xReturn = pdPASS;
|
xReturn = pdPASS;
|
||||||
traceTASK_CREATE( pxNewTCB );
|
traceTASK_CREATE( pxNewTCB );
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -579,7 +579,7 @@ tskTCB * pxNewTCB;
|
||||||
{
|
{
|
||||||
tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* Ensure a yield is performed if the current task is being
|
/* Ensure a yield is performed if the current task is being
|
||||||
deleted. */
|
deleted. */
|
||||||
|
@ -616,7 +616,7 @@ tskTCB * pxNewTCB;
|
||||||
|
|
||||||
traceTASK_DELETE( pxTCB );
|
traceTASK_DELETE( pxTCB );
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
/* Force a reschedule if we have just deleted the current task. */
|
/* Force a reschedule if we have just deleted the current task. */
|
||||||
if( xSchedulerRunning != pdFALSE )
|
if( xSchedulerRunning != pdFALSE )
|
||||||
|
@ -754,14 +754,14 @@ tskTCB * pxNewTCB;
|
||||||
tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
unsigned portBASE_TYPE uxReturn;
|
unsigned portBASE_TYPE uxReturn;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* If null is passed in here then we are changing the
|
/* If null is passed in here then we are changing the
|
||||||
priority of the calling function. */
|
priority of the calling function. */
|
||||||
pxTCB = prvGetTCBFromHandle( pxTask );
|
pxTCB = prvGetTCBFromHandle( pxTask );
|
||||||
uxReturn = pxTCB->uxPriority;
|
uxReturn = pxTCB->uxPriority;
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
}
|
}
|
||||||
|
@ -774,15 +774,16 @@ tskTCB * pxNewTCB;
|
||||||
void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )
|
void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )
|
||||||
{
|
{
|
||||||
tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
unsigned portBASE_TYPE uxCurrentPriority, xYieldRequired = pdFALSE;
|
unsigned portBASE_TYPE uxCurrentPriority;
|
||||||
|
portBASE_TYPE xYieldRequired = pdFALSE;
|
||||||
|
|
||||||
/* Ensure the new priority is valid. */
|
/* Ensure the new priority is valid. */
|
||||||
if( uxNewPriority >= configMAX_PRIORITIES )
|
if( uxNewPriority >= configMAX_PRIORITIES )
|
||||||
{
|
{
|
||||||
uxNewPriority = configMAX_PRIORITIES - 1;
|
uxNewPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if( pxTask == pxCurrentTCB )
|
if( pxTask == pxCurrentTCB )
|
||||||
{
|
{
|
||||||
|
@ -868,7 +869,7 @@ tskTCB * pxNewTCB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -880,7 +881,7 @@ tskTCB * pxNewTCB;
|
||||||
{
|
{
|
||||||
tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* Ensure a yield is performed if the current task is being
|
/* Ensure a yield is performed if the current task is being
|
||||||
suspended. */
|
suspended. */
|
||||||
|
@ -905,7 +906,7 @@ tskTCB * pxNewTCB;
|
||||||
|
|
||||||
vListInsertEnd( ( xList * ) &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );
|
vListInsertEnd( ( xList * ) &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
if( ( void * ) pxTaskToSuspend == NULL )
|
if( ( void * ) pxTaskToSuspend == NULL )
|
||||||
{
|
{
|
||||||
|
@ -919,7 +920,7 @@ tskTCB * pxNewTCB;
|
||||||
/* The scheduler is not running, but the task that was pointed
|
/* The scheduler is not running, but the task that was pointed
|
||||||
to by pxCurrentTCB has just been suspended and pxCurrentTCB
|
to by pxCurrentTCB has just been suspended and pxCurrentTCB
|
||||||
must be adjusted to point to a different task. */
|
must be adjusted to point to a different task. */
|
||||||
if( uxCurrentNumberOfTasks == 1 )
|
if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1U )
|
||||||
{
|
{
|
||||||
/* No other tasks are defined, so set pxCurrentTCB back to
|
/* No other tasks are defined, so set pxCurrentTCB back to
|
||||||
NULL so when the next task is created pxCurrentTCB will
|
NULL so when the next task is created pxCurrentTCB will
|
||||||
|
@ -983,7 +984,7 @@ tskTCB * pxNewTCB;
|
||||||
currently executing task. */
|
currently executing task. */
|
||||||
if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) )
|
if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) )
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )
|
if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )
|
||||||
{
|
{
|
||||||
|
@ -1003,7 +1004,7 @@ tskTCB * pxNewTCB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1124,7 @@ signed portBASE_TYPE xAlreadyYielded = pdFALSE;
|
||||||
removed task will have been added to the xPendingReadyList. Once the
|
removed task will have been added to the xPendingReadyList. Once the
|
||||||
scheduler has been resumed it is safe to move all the pending ready
|
scheduler has been resumed it is safe to move all the pending ready
|
||||||
tasks from this list into their appropriate ready list. */
|
tasks from this list into their appropriate ready list. */
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
--uxSchedulerSuspended;
|
--uxSchedulerSuspended;
|
||||||
|
|
||||||
|
@ -1180,7 +1181,7 @@ signed portBASE_TYPE xAlreadyYielded = pdFALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return xAlreadyYielded;
|
return xAlreadyYielded;
|
||||||
}
|
}
|
||||||
|
@ -1201,11 +1202,11 @@ portTickType xTaskGetTickCount( void )
|
||||||
portTickType xTicks;
|
portTickType xTicks;
|
||||||
|
|
||||||
/* Critical section required if running on a 16 bit processor. */
|
/* Critical section required if running on a 16 bit processor. */
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
xTicks = xTickCount;
|
xTicks = xTickCount;
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return xTicks;
|
return xTicks;
|
||||||
}
|
}
|
||||||
|
@ -1239,10 +1240,10 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
/* Run through all the lists that could potentially contain a TCB and
|
/* Run through all the lists that could potentially contain a TCB and
|
||||||
report the task name, state and stack high water mark. */
|
report the task name, state and stack high water mark. */
|
||||||
|
|
||||||
pcWriteBuffer[ 0 ] = ( signed char ) 0x00;
|
*pcWriteBuffer = ( signed char ) 0x00;
|
||||||
strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );
|
strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );
|
||||||
|
|
||||||
uxQueue = uxTopUsedPriority + 1;
|
uxQueue = uxTopUsedPriority + ( unsigned portBASE_TYPE ) 1U;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1314,10 +1315,10 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
generating a table of run timer percentages in the provided
|
generating a table of run timer percentages in the provided
|
||||||
buffer. */
|
buffer. */
|
||||||
|
|
||||||
pcWriteBuffer[ 0 ] = ( signed char ) 0x00;
|
*pcWriteBuffer = ( signed char ) 0x00;
|
||||||
strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );
|
strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );
|
||||||
|
|
||||||
uxQueue = uxTopUsedPriority + 1;
|
uxQueue = uxTopUsedPriority + ( unsigned portBASE_TYPE ) 1U;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1367,14 +1368,14 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
|
|
||||||
void vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize )
|
void vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize )
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
pcTraceBuffer = ( signed char * )pcBuffer;
|
pcTraceBuffer = ( signed char * )pcBuffer;
|
||||||
pcTraceBufferStart = pcBuffer;
|
pcTraceBufferStart = pcBuffer;
|
||||||
pcTraceBufferEnd = pcBuffer + ( ulBufferSize - tskSIZE_OF_EACH_TRACE_LINE );
|
pcTraceBufferEnd = pcBuffer + ( ulBufferSize - tskSIZE_OF_EACH_TRACE_LINE );
|
||||||
xTracing = pdTRUE;
|
xTracing = pdTRUE;
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1386,9 +1387,9 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
{
|
{
|
||||||
unsigned long ulBufferLength;
|
unsigned long ulBufferLength;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
xTracing = pdFALSE;
|
xTracing = pdFALSE;
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
ulBufferLength = ( unsigned long ) ( pcTraceBuffer - pcTraceBufferStart );
|
ulBufferLength = ( unsigned long ) ( pcTraceBuffer - pcTraceBufferStart );
|
||||||
|
|
||||||
|
@ -1551,9 +1552,9 @@ void vTaskIncrementTick( void )
|
||||||
|
|
||||||
/* Save the hook function in the TCB. A critical section is required as
|
/* Save the hook function in the TCB. A critical section is required as
|
||||||
the value can be accessed from an interrupt. */
|
the value can be accessed from an interrupt. */
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
xTCB->pxTaskTag = pxTagValue;
|
xTCB->pxTaskTag = pxTagValue;
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1578,9 +1579,9 @@ void vTaskIncrementTick( void )
|
||||||
|
|
||||||
/* Save the hook function in the TCB. A critical section is required as
|
/* Save the hook function in the TCB. A critical section is required as
|
||||||
the value can be accessed from an interrupt. */
|
the value can be accessed from an interrupt. */
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
xReturn = xTCB->pxTaskTag;
|
xReturn = xTCB->pxTaskTag;
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
@ -1627,9 +1628,9 @@ void vTaskSwitchContext( void )
|
||||||
/* The scheduler is currently suspended - do not allow a context
|
/* The scheduler is currently suspended - do not allow a context
|
||||||
switch. */
|
switch. */
|
||||||
xMissedYield = pdTRUE;
|
xMissedYield = pdTRUE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
traceTASK_SWITCHED_OUT();
|
traceTASK_SWITCHED_OUT();
|
||||||
|
|
||||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||||
|
@ -1667,6 +1668,7 @@ void vTaskSwitchContext( void )
|
||||||
|
|
||||||
traceTASK_SWITCHED_IN();
|
traceTASK_SWITCHED_IN();
|
||||||
vWriteTraceToBuffer();
|
vWriteTraceToBuffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -1777,7 +1779,7 @@ portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType
|
||||||
{
|
{
|
||||||
portBASE_TYPE xReturn;
|
portBASE_TYPE xReturn;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||||
/* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is
|
/* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is
|
||||||
|
@ -1810,7 +1812,7 @@ portBASE_TYPE xReturn;
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
@ -1906,13 +1908,13 @@ static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const
|
||||||
strncpy( ( char * ) pxTCB->pcTaskName, ( const char * ) pcName, ( unsigned short ) configMAX_TASK_NAME_LEN );
|
strncpy( ( char * ) pxTCB->pcTaskName, ( const char * ) pcName, ( unsigned short ) configMAX_TASK_NAME_LEN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pxTCB->pcTaskName[ ( unsigned short ) configMAX_TASK_NAME_LEN - ( unsigned short ) 1 ] = '\0';
|
pxTCB->pcTaskName[ ( unsigned short ) configMAX_TASK_NAME_LEN - ( unsigned short ) 1 ] = ( signed char ) '\0';
|
||||||
|
|
||||||
/* This is used as an array index so must ensure it's not too large. First
|
/* This is used as an array index so must ensure it's not too large. First
|
||||||
remove the privilege bit if one is present. */
|
remove the privilege bit if one is present. */
|
||||||
if( uxPriority >= configMAX_PRIORITIES )
|
if( uxPriority >= configMAX_PRIORITIES )
|
||||||
{
|
{
|
||||||
uxPriority = configMAX_PRIORITIES - 1;
|
uxPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
pxTCB->uxPriority = uxPriority;
|
pxTCB->uxPriority = uxPriority;
|
||||||
|
@ -1987,7 +1989,7 @@ static void prvInitialiseTaskLists( void )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE uxPriority;
|
unsigned portBASE_TYPE uxPriority;
|
||||||
|
|
||||||
for( uxPriority = 0; uxPriority < configMAX_PRIORITIES; uxPriority++ )
|
for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < configMAX_PRIORITIES; uxPriority++ )
|
||||||
{
|
{
|
||||||
vListInitialise( ( xList * ) &( pxReadyTasksLists[ uxPriority ] ) );
|
vListInitialise( ( xList * ) &( pxReadyTasksLists[ uxPriority ] ) );
|
||||||
}
|
}
|
||||||
|
@ -2033,14 +2035,14 @@ static void prvCheckTasksWaitingTermination( void )
|
||||||
{
|
{
|
||||||
tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xTasksWaitingTermination ) );
|
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xTasksWaitingTermination ) );
|
||||||
vListRemove( &( pxTCB->xGenericListItem ) );
|
vListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
--uxCurrentNumberOfTasks;
|
--uxCurrentNumberOfTasks;
|
||||||
--uxTasksDeleted;
|
--uxTasksDeleted;
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
prvDeleteTCB( pxTCB );
|
prvDeleteTCB( pxTCB );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue