mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Linting and MISRA checking
This commit is contained in:
parent
e83b93f5fc
commit
7d1292ced2
|
@ -177,7 +177,7 @@ typedef struct xLIST
|
||||||
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( pxListItem )->pvOwner = ( void * ) ( pxOwner )
|
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to get the owner of a list item. The owner of a list item
|
* Access macro to get the owner of a list item. The owner of a list item
|
||||||
|
@ -195,7 +195,7 @@ typedef struct xLIST
|
||||||
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( pxListItem )->xItemValue = ( xValue )
|
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to retrieve the value of the list item. The value can
|
* Access macro to retrieve the value of the list item. The value can
|
||||||
|
@ -223,7 +223,7 @@ typedef struct xLIST
|
||||||
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listLIST_IS_EMPTY( pxList ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 )
|
#define listLIST_IS_EMPTY( pxList ) ( ( portBASE_TYPE ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access macro to return the number of items in the list.
|
* Access macro to return the number of items in the list.
|
||||||
|
@ -249,17 +249,17 @@ typedef struct xLIST
|
||||||
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
{ \
|
{ \
|
||||||
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; \
|
||||||
if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) ) \
|
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
|
||||||
{ \
|
{ \
|
||||||
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
} \
|
} \
|
||||||
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,7 +291,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 ) ( ( portBASE_TYPE ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the list a list item is contained within (referenced from).
|
* Return the list a list item is contained within (referenced from).
|
||||||
|
|
|
@ -56,19 +56,19 @@
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
license and Real Time Engineers Ltd. contact details.
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
fully thread aware and reentrant UDP/IP stack.
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
Integrity Systems, who sell the code with commercial support,
|
Integrity Systems, who sell the code with commercial support,
|
||||||
indemnification and middleware, under the OpenRTOS brand.
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
engineered and independently SIL3 certified version for use in safety and
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
mission critical applications that require provable dependability.
|
mission critical applications that require provable dependability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -136,9 +136,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IAR_MSP430
|
#ifdef IAR_MSP430
|
||||||
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GCC_MSP430
|
#ifdef GCC_MSP430
|
||||||
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -174,7 +174,7 @@
|
||||||
#ifdef STR75X_IAR
|
#ifdef STR75X_IAR
|
||||||
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STR75X_GCC
|
#ifdef STR75X_GCC
|
||||||
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,7 +182,7 @@
|
||||||
#ifdef STR91X_IAR
|
#ifdef STR91X_IAR
|
||||||
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GCC_H8S
|
#ifdef GCC_H8S
|
||||||
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -210,10 +210,10 @@
|
||||||
#ifdef IAR_ARMCM3_LM
|
#ifdef IAR_ARMCM3_LM
|
||||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HCS12_CODE_WARRIOR
|
#ifdef HCS12_CODE_WARRIOR
|
||||||
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MICROBLAZE_GCC
|
#ifdef MICROBLAZE_GCC
|
||||||
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
||||||
|
@ -313,11 +313,11 @@
|
||||||
#ifdef __IAR_78K0R_Kx3__
|
#ifdef __IAR_78K0R_Kx3__
|
||||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __IAR_78K0R_Kx3L__
|
#ifdef __IAR_78K0R_Kx3L__
|
||||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Catch all to ensure portmacro.h is included in the build. Newer demos
|
/* Catch all to ensure portmacro.h is included in the build. Newer demos
|
||||||
have the path as part of the project options, rather than as relative from
|
have the path as part of the project options, rather than as relative from
|
||||||
the project location. If portENTER_CRITICAL() has not been defined then
|
the project location. If portENTER_CRITICAL() has not been defined then
|
||||||
|
@ -325,9 +325,9 @@ portmacro.h has not yet been included - as every portmacro.h provides a
|
||||||
portENTER_CRITICAL() definition. Check the demo application for your demo
|
portENTER_CRITICAL() definition. Check the demo application for your demo
|
||||||
to find the path to the correct portmacro.h file. */
|
to find the path to the correct portmacro.h file. */
|
||||||
#ifndef portENTER_CRITICAL
|
#ifndef portENTER_CRITICAL
|
||||||
#include "portmacro.h"
|
#include "portmacro.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if portBYTE_ALIGNMENT == 8
|
#if portBYTE_ALIGNMENT == 8
|
||||||
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
||||||
#endif
|
#endif
|
||||||
|
@ -367,7 +367,7 @@ extern "C" {
|
||||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
|
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
|
||||||
#else
|
#else
|
||||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );
|
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -398,7 +398,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
* Fills the xMPUSettings structure with the memory region information
|
* Fills the xMPUSettings structure with the memory region information
|
||||||
* contained in xRegions.
|
* contained in xRegions.
|
||||||
*/
|
*/
|
||||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
struct xMEMORY_REGION;
|
struct xMEMORY_REGION;
|
||||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
|
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,13 +78,13 @@
|
||||||
/* Defines the prototype to which task functions must conform. */
|
/* Defines the prototype to which task functions must conform. */
|
||||||
typedef void (*pdTASK_CODE)( void * );
|
typedef void (*pdTASK_CODE)( void * );
|
||||||
|
|
||||||
#define pdTRUE ( 1 )
|
#define pdFALSE ( ( portBASE_TYPE ) 0 )
|
||||||
#define pdFALSE ( 0 )
|
#define pdTRUE ( ( portBASE_TYPE ) 1 )
|
||||||
|
|
||||||
#define pdPASS ( 1 )
|
#define pdPASS ( pdTRUE )
|
||||||
#define pdFAIL ( 0 )
|
#define pdFAIL ( pdFALSE )
|
||||||
#define errQUEUE_EMPTY ( 0 )
|
#define errQUEUE_EMPTY ( ( portBASE_TYPE ) 0 )
|
||||||
#define errQUEUE_FULL ( 0 )
|
#define errQUEUE_FULL ( ( portBASE_TYPE ) 0 )
|
||||||
|
|
||||||
/* Error definitions. */
|
/* Error definitions. */
|
||||||
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||||
|
|
|
@ -85,8 +85,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "mpu_wrappers.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type by which queues are referenced. For example, a call to xQueueCreate()
|
* 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 xQueueHandle variable that can then be used as a parameter to
|
||||||
|
@ -109,17 +107,17 @@ typedef void * xQueueSetHandle;
|
||||||
typedef void * xQueueSetMemberHandle;
|
typedef void * xQueueSetMemberHandle;
|
||||||
|
|
||||||
/* For internal use only. */
|
/* For internal use only. */
|
||||||
#define queueSEND_TO_BACK ( 0 )
|
#define queueSEND_TO_BACK ( ( portBASE_TYPE ) 0 )
|
||||||
#define queueSEND_TO_FRONT ( 1 )
|
#define queueSEND_TO_FRONT ( ( portBASE_TYPE ) 1 )
|
||||||
#define queueOVERWRITE ( 2 )
|
#define queueOVERWRITE ( ( portBASE_TYPE ) 2 )
|
||||||
|
|
||||||
/* For internal use only. These definitions *must* match those in queue.c. */
|
/* For internal use only. These definitions *must* match those in queue.c. */
|
||||||
#define queueQUEUE_TYPE_BASE ( 0U )
|
#define queueQUEUE_TYPE_BASE ( ( unsigned char ) 0U )
|
||||||
#define queueQUEUE_TYPE_SET ( 0U )
|
#define queueQUEUE_TYPE_SET ( ( unsigned char ) 0U )
|
||||||
#define queueQUEUE_TYPE_MUTEX ( 1U )
|
#define queueQUEUE_TYPE_MUTEX ( ( unsigned char ) 1U )
|
||||||
#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( 2U )
|
#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( unsigned char ) 2U )
|
||||||
#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( 3U )
|
#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( unsigned char ) 3U )
|
||||||
#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( 4U )
|
#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( unsigned char ) 4U )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -724,7 +722,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
|
||||||
* \defgroup xQueuePeekFromISR xQueuePeekFromISR
|
* \defgroup xQueuePeekFromISR xQueuePeekFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION;
|
signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, const void * const pvBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -916,7 +914,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
|
||||||
* \defgroup xQueueReceive xQueueReceive
|
* \defgroup xQueueReceive xQueueReceive
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION;
|
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -1405,7 +1403,7 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
|
||||||
* \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
|
* \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, const void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utilities to query queues that are safe to use from an ISR. These utilities
|
* Utilities to query queues that are safe to use from an ISR. These utilities
|
||||||
|
@ -1495,7 +1493,7 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
|
||||||
* @param pcName The name to be associated with the handle. This is the
|
* @param pcName The name to be associated with the handle. This is the
|
||||||
* name that the kernel aware debugger will display.
|
* name that the kernel aware debugger will display.
|
||||||
*/
|
*/
|
||||||
#if configQUEUE_REGISTRY_SIZE > 0U
|
#if configQUEUE_REGISTRY_SIZE > 0
|
||||||
void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ) PRIVILEGED_FUNCTION;
|
void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1509,7 +1507,7 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
|
||||||
*
|
*
|
||||||
* @param xQueue The handle of the queue being removed from the registry.
|
* @param xQueue The handle of the queue being removed from the registry.
|
||||||
*/
|
*/
|
||||||
#if configQUEUE_REGISTRY_SIZE > 0U
|
#if configQUEUE_REGISTRY_SIZE > 0
|
||||||
void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef TASK_H
|
#ifndef INC_TASK_H
|
||||||
#define TASK_H
|
#define INC_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"
|
||||||
|
@ -236,9 +236,9 @@ typedef enum
|
||||||
#define taskENABLE_INTERRUPTS() portENABLE_INTERRUPTS()
|
#define taskENABLE_INTERRUPTS() portENABLE_INTERRUPTS()
|
||||||
|
|
||||||
/* Definitions returned by xTaskGetSchedulerState(). */
|
/* Definitions returned by xTaskGetSchedulerState(). */
|
||||||
#define taskSCHEDULER_NOT_STARTED 0
|
#define taskSCHEDULER_NOT_STARTED ( ( portBASE_TYPE ) 0 )
|
||||||
#define taskSCHEDULER_RUNNING 1
|
#define taskSCHEDULER_RUNNING ( ( portBASE_TYPE ) 1 )
|
||||||
#define taskSCHEDULER_SUSPENDED 2
|
#define taskSCHEDULER_SUSPENDED ( ( portBASE_TYPE ) 2 )
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* TASK CREATION API
|
* TASK CREATION API
|
||||||
|
@ -1016,7 +1016,7 @@ signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task. h
|
* task. h
|
||||||
* <pre>signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask );</pre>
|
* <pre>signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask );</pre>
|
||||||
*
|
*
|
||||||
* Utility task that simply returns pdTRUE if the task referenced by xTask is
|
* 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
|
* currently in the Suspended state, or pdFALSE if the task referenced by xTask
|
||||||
|
@ -1394,7 +1394,7 @@ portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
|
||||||
* portTICK_RATE_MS can be used to convert kernel ticks into a real time
|
* portTICK_RATE_MS can be used to convert kernel ticks into a real time
|
||||||
* period.
|
* period.
|
||||||
*/
|
*/
|
||||||
void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||||
|
@ -1409,7 +1409,7 @@ void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicks
|
||||||
* @return pdTRUE if the task being removed has a higher priority than the task
|
* @return pdTRUE if the task being removed has a higher priority than the task
|
||||||
* making the call, otherwise pdFALSE.
|
* making the call, otherwise pdFALSE.
|
||||||
*/
|
*/
|
||||||
void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||||
|
@ -1470,13 +1470,13 @@ portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
|
||||||
* Raises the priority of the mutex holder to that of the calling task should
|
* 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.
|
* the mutex holder have a priority less than the calling task.
|
||||||
*/
|
*/
|
||||||
void vTaskPriorityInherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the priority of a task back to its proper priority in the case that it
|
* 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.
|
* inherited a higher priority while it was holding a semaphore.
|
||||||
*/
|
*/
|
||||||
void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
@ -1522,7 +1522,7 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void );
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* TASK_H */
|
#endif /* INC_TASK_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,10 @@
|
||||||
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "portable.h"
|
/*lint -e537 This headers are only multiply included if the application code
|
||||||
#include "list.h"
|
happens to also be including task.h. */
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
/*lint +e956 */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -91,10 +92,10 @@ extern "C" {
|
||||||
/* IDs for commands that can be sent/received on the timer queue. These are to
|
/* 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,
|
be used solely through the macros that make up the public software timer API,
|
||||||
as defined below. */
|
as defined below. */
|
||||||
#define tmrCOMMAND_START 0
|
#define tmrCOMMAND_START ( ( portBASE_TYPE ) 0 )
|
||||||
#define tmrCOMMAND_STOP 1
|
#define tmrCOMMAND_STOP ( ( portBASE_TYPE ) 1 )
|
||||||
#define tmrCOMMAND_CHANGE_PERIOD 2
|
#define tmrCOMMAND_CHANGE_PERIOD ( ( portBASE_TYPE ) 2 )
|
||||||
#define tmrCOMMAND_DELETE 3
|
#define tmrCOMMAND_DELETE ( ( portBASE_TYPE ) 3 )
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* MACROS AND DEFINITIONS
|
* MACROS AND DEFINITIONS
|
||||||
|
|
|
@ -86,7 +86,7 @@ void vListInitialise( xList * const pxList )
|
||||||
/* The list structure contains a list item which is used to mark the
|
/* 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
|
end of the list. To initialise the list the list end is inserted
|
||||||
as the only list entry. */
|
as the only list entry. */
|
||||||
pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd );
|
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. */
|
||||||
|
|
||||||
/* The list end value is the highest possible value in the list to
|
/* The list end value is the highest possible value in the list to
|
||||||
ensure it remains at the end of the list. */
|
ensure it remains at the end of the list. */
|
||||||
|
@ -94,8 +94,8 @@ void vListInitialise( xList * const pxList )
|
||||||
|
|
||||||
/* The list end next and previous pointers point to itself so we know
|
/* The list end next and previous pointers point to itself so we know
|
||||||
when the list is empty. */
|
when the list is empty. */
|
||||||
pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );
|
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 );
|
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->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;
|
pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ portTickType xValueOfInsertion;
|
||||||
See http://www.freertos.org/FAQHelp.html for more tips.
|
See http://www.freertos.org/FAQHelp.html for more tips.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
|
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. */
|
||||||
{
|
{
|
||||||
/* There is nothing to do here, we are just iterating to the
|
/* There is nothing to do here, we are just iterating to the
|
||||||
wanted insertion position. */
|
wanted insertion position. */
|
||||||
|
|
|
@ -101,10 +101,10 @@ extern "C" {
|
||||||
|
|
||||||
#if( configUSE_16_BIT_TICKS == 1 )
|
#if( configUSE_16_BIT_TICKS == 1 )
|
||||||
typedef unsigned portSHORT portTickType;
|
typedef unsigned portSHORT portTickType;
|
||||||
#define portMAX_DELAY ( portTickType ) 0xffff
|
#define portMAX_DELAY 0xffff
|
||||||
#else
|
#else
|
||||||
typedef unsigned portLONG portTickType;
|
typedef unsigned portLONG portTickType;
|
||||||
#define portMAX_DELAY ( portTickType ) 0xffffffff
|
#define portMAX_DELAY 0xffffffffUL
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ extern "C" {
|
||||||
|
|
||||||
/* Scheduler utilities. */
|
/* Scheduler utilities. */
|
||||||
extern void vPortYield( void );
|
extern void vPortYield( void );
|
||||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )
|
#define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04UL ) )
|
||||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||||
#define portYIELD() vPortYield()
|
#define portYIELD() vPortYield()
|
||||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||||
|
@ -132,8 +132,8 @@ extern void vPortYield( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Store/clear the ready priorities in a bit map. */
|
/* Store/clear the ready priorities in a bit map. */
|
||||||
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) )
|
||||||
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
|
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) )
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -88,14 +88,17 @@ task.h is included from an application file. */
|
||||||
#include "croutine.h"
|
#include "croutine.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the
|
||||||
|
MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the
|
||||||
|
header files above, but not in this file, in order to generate the correct
|
||||||
|
privileged Vs unprivileged linkage and placement. */
|
||||||
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */
|
||||||
|
|
||||||
|
|
||||||
/* Constants used with the cRxLock and xTxLock structure members. */
|
/* Constants used with the cRxLock and xTxLock structure members. */
|
||||||
#define queueUNLOCKED ( ( signed portBASE_TYPE ) -1 )
|
#define queueUNLOCKED ( ( signed portBASE_TYPE ) -1 )
|
||||||
#define queueLOCKED_UNMODIFIED ( ( signed portBASE_TYPE ) 0 )
|
#define queueLOCKED_UNMODIFIED ( ( signed portBASE_TYPE ) 0 )
|
||||||
|
|
||||||
#define queueERRONEOUS_UNBLOCK ( -1 )
|
|
||||||
|
|
||||||
/* When the xQUEUE structure is used to represent a base queue its pcHead and
|
/* When the xQUEUE structure is used to represent a base queue its pcHead and
|
||||||
pcTail members are used as pointers into the queue storage area. When the
|
pcTail members are used as pointers into the queue storage area. When the
|
||||||
xQUEUE structure is used to represent a mutex pcHead and pcTail pointers are
|
xQUEUE structure is used to represent a mutex pcHead and pcTail pointers are
|
||||||
|
@ -114,7 +117,6 @@ structure member). */
|
||||||
/* Semaphores do not actually store or copy data, so have an item size of
|
/* Semaphores do not actually store or copy data, so have an item size of
|
||||||
zero. */
|
zero. */
|
||||||
#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 )
|
#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 )
|
||||||
#define queueDONT_BLOCK ( ( portTickType ) 0U )
|
|
||||||
#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0U )
|
#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0U )
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,14 +214,14 @@ static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, port
|
||||||
/*
|
/*
|
||||||
* Copies an item out of a queue.
|
* Copies an item out of a queue.
|
||||||
*/
|
*/
|
||||||
static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer ) PRIVILEGED_FUNCTION;
|
static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#if ( configUSE_QUEUE_SETS == 1 )
|
#if ( configUSE_QUEUE_SETS == 1 )
|
||||||
/*
|
/*
|
||||||
* Checks to see if a queue is a member of a queue set, and if so, notifies
|
* Checks to see if a queue is a member of a queue set, and if so, notifies
|
||||||
* the queue set that the queue contains data.
|
* the queue set that the queue contains data.
|
||||||
*/
|
*/
|
||||||
static portBASE_TYPE prvNotifyQueueSetContainer( xQUEUE *pxQueue, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -306,7 +308,7 @@ xQueueHandle xReturn = NULL;
|
||||||
{
|
{
|
||||||
/* Create the list of pointers to queue items. The queue is one byte
|
/* Create the list of pointers to queue items. The queue is one byte
|
||||||
longer than asked for to make wrap checking easier/faster. */
|
longer than asked for to make wrap checking easier/faster. */
|
||||||
xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ) + ( size_t ) 1;
|
xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ) + ( size_t ) 1; /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
pxNewQueue->pcHead = ( signed char * ) pvPortMalloc( xQueueSizeInBytes );
|
pxNewQueue->pcHead = ( signed char * ) pvPortMalloc( xQueueSizeInBytes );
|
||||||
if( pxNewQueue->pcHead != NULL )
|
if( pxNewQueue->pcHead != NULL )
|
||||||
|
@ -315,7 +317,7 @@ xQueueHandle xReturn = NULL;
|
||||||
queue type is defined. */
|
queue type is defined. */
|
||||||
pxNewQueue->uxLength = uxQueueLength;
|
pxNewQueue->uxLength = uxQueueLength;
|
||||||
pxNewQueue->uxItemSize = uxItemSize;
|
pxNewQueue->uxItemSize = uxItemSize;
|
||||||
xQueueGenericReset( pxNewQueue, pdTRUE );
|
( void ) xQueueGenericReset( pxNewQueue, pdTRUE );
|
||||||
|
|
||||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
{
|
{
|
||||||
|
@ -397,7 +399,7 @@ xQueueHandle xReturn = NULL;
|
||||||
traceCREATE_MUTEX( pxNewQueue );
|
traceCREATE_MUTEX( pxNewQueue );
|
||||||
|
|
||||||
/* Start with the semaphore in the expected state. */
|
/* Start with the semaphore in the expected state. */
|
||||||
xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );
|
( void ) xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -456,7 +458,7 @@ xQueueHandle xReturn = NULL;
|
||||||
this is the only condition we are interested in it does not matter if
|
this is the only condition we are interested in it does not matter if
|
||||||
pxMutexHolder is accessed simultaneously by another task. Therefore no
|
pxMutexHolder is accessed simultaneously by another task. Therefore no
|
||||||
mutual exclusion is required to test the pxMutexHolder variable. */
|
mutual exclusion is required to test the pxMutexHolder variable. */
|
||||||
if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() )
|
if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Not a redundant cast as xTaskHandle is a typedef. */
|
||||||
{
|
{
|
||||||
traceGIVE_MUTEX_RECURSIVE( pxMutex );
|
traceGIVE_MUTEX_RECURSIVE( pxMutex );
|
||||||
|
|
||||||
|
@ -468,11 +470,11 @@ xQueueHandle xReturn = NULL;
|
||||||
( pxMutex->u.uxRecursiveCallCount )--;
|
( pxMutex->u.uxRecursiveCallCount )--;
|
||||||
|
|
||||||
/* Have we unwound the call count? */
|
/* Have we unwound the call count? */
|
||||||
if( pxMutex->u.uxRecursiveCallCount == 0 )
|
if( pxMutex->u.uxRecursiveCallCount == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* Return the mutex. This will automatically unblock any other
|
/* Return the mutex. This will automatically unblock any other
|
||||||
task that might be waiting to access the mutex. */
|
task that might be waiting to access the mutex. */
|
||||||
xQueueGenericSend( pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK );
|
( void ) xQueueGenericSend( pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK );
|
||||||
}
|
}
|
||||||
|
|
||||||
xReturn = pdPASS;
|
xReturn = pdPASS;
|
||||||
|
@ -505,7 +507,7 @@ xQueueHandle xReturn = NULL;
|
||||||
|
|
||||||
traceTAKE_MUTEX_RECURSIVE( pxMutex );
|
traceTAKE_MUTEX_RECURSIVE( pxMutex );
|
||||||
|
|
||||||
if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() )
|
if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */
|
||||||
{
|
{
|
||||||
( pxMutex->u.uxRecursiveCallCount )++;
|
( pxMutex->u.uxRecursiveCallCount )++;
|
||||||
xReturn = pdPASS;
|
xReturn = pdPASS;
|
||||||
|
@ -538,7 +540,7 @@ xQueueHandle xReturn = NULL;
|
||||||
{
|
{
|
||||||
xQueueHandle xHandle;
|
xQueueHandle xHandle;
|
||||||
|
|
||||||
xHandle = xQueueGenericCreate( ( unsigned portBASE_TYPE ) uxCountValue, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE );
|
xHandle = xQueueGenericCreate( uxCountValue, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE );
|
||||||
|
|
||||||
if( xHandle != NULL )
|
if( xHandle != NULL )
|
||||||
{
|
{
|
||||||
|
@ -657,6 +659,10 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
|
||||||
vTaskSetTimeOutState( &xTimeOut );
|
vTaskSetTimeOutState( &xTimeOut );
|
||||||
xEntryTimeSet = pdTRUE;
|
xEntryTimeSet = pdTRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Entry time was already set. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
@ -1036,7 +1042,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
|
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xEntryTimeSet = pdFALSE;
|
signed portBASE_TYPE xEntryTimeSet = pdFALSE;
|
||||||
xTimeOutType xTimeOut;
|
xTimeOutType xTimeOut;
|
||||||
|
@ -1077,7 +1083,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
|
||||||
{
|
{
|
||||||
/* Record the information required to implement
|
/* Record the information required to implement
|
||||||
priority inheritance should it become necessary. */
|
priority inheritance should it become necessary. */
|
||||||
pxQueue->pxMutexHolder = ( void * ) xTaskGetCurrentTaskHandle();
|
pxQueue->pxMutexHolder = ( void * ) xTaskGetCurrentTaskHandle(); /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1132,6 +1138,10 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
|
||||||
vTaskSetTimeOutState( &xTimeOut );
|
vTaskSetTimeOutState( &xTimeOut );
|
||||||
xEntryTimeSet = pdTRUE;
|
xEntryTimeSet = pdTRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Entry time was already set. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
@ -1187,7 +1197,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken )
|
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, const void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
unsigned portBASE_TYPE uxSavedInterruptStatus;
|
unsigned portBASE_TYPE uxSavedInterruptStatus;
|
||||||
|
@ -1262,7 +1272,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer )
|
signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, const void * const pvBuffer )
|
||||||
{
|
{
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
unsigned portBASE_TYPE uxSavedInterruptStatus;
|
unsigned portBASE_TYPE uxSavedInterruptStatus;
|
||||||
|
@ -1326,7 +1336,7 @@ unsigned portBASE_TYPE uxReturn;
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
}
|
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )
|
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )
|
||||||
|
@ -1338,7 +1348,7 @@ unsigned portBASE_TYPE uxReturn;
|
||||||
uxReturn = ( ( xQUEUE * ) xQueue )->uxMessagesWaiting;
|
uxReturn = ( ( xQUEUE * ) xQueue )->uxMessagesWaiting;
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
}
|
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vQueueDelete( xQueueHandle xQueue )
|
void vQueueDelete( xQueueHandle xQueue )
|
||||||
|
@ -1405,25 +1415,25 @@ static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, port
|
||||||
}
|
}
|
||||||
else if( xPosition == queueSEND_TO_BACK )
|
else if( xPosition == queueSEND_TO_BACK )
|
||||||
{
|
{
|
||||||
memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize );
|
( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0. */
|
||||||
pxQueue->pcWriteTo += pxQueue->uxItemSize;
|
pxQueue->pcWriteTo += pxQueue->uxItemSize;
|
||||||
if( pxQueue->pcWriteTo >= pxQueue->pcTail )
|
if( pxQueue->pcWriteTo >= pxQueue->pcTail ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */
|
||||||
{
|
{
|
||||||
pxQueue->pcWriteTo = pxQueue->pcHead;
|
pxQueue->pcWriteTo = pxQueue->pcHead;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy( ( void * ) pxQueue->u.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize );
|
( void ) memcpy( ( void * ) pxQueue->u.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
pxQueue->u.pcReadFrom -= pxQueue->uxItemSize;
|
pxQueue->u.pcReadFrom -= pxQueue->uxItemSize;
|
||||||
if( pxQueue->u.pcReadFrom < pxQueue->pcHead )
|
if( pxQueue->u.pcReadFrom < pxQueue->pcHead ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */
|
||||||
{
|
{
|
||||||
pxQueue->u.pcReadFrom = ( pxQueue->pcTail - pxQueue->uxItemSize );
|
pxQueue->u.pcReadFrom = ( pxQueue->pcTail - pxQueue->uxItemSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xPosition == queueOVERWRITE )
|
if( xPosition == queueOVERWRITE )
|
||||||
{
|
{
|
||||||
if( pxQueue->uxMessagesWaiting > 0 )
|
if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* An item is not being added but overwritten, so subtract
|
/* An item is not being added but overwritten, so subtract
|
||||||
one from the recorded number of items in the queue so when
|
one from the recorded number of items in the queue so when
|
||||||
|
@ -1438,16 +1448,16 @@ static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, port
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
|
static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer )
|
||||||
{
|
{
|
||||||
if( pxQueue->uxQueueType != queueQUEUE_IS_MUTEX )
|
if( pxQueue->uxQueueType != queueQUEUE_IS_MUTEX )
|
||||||
{
|
{
|
||||||
pxQueue->u.pcReadFrom += pxQueue->uxItemSize;
|
pxQueue->u.pcReadFrom += pxQueue->uxItemSize;
|
||||||
if( pxQueue->u.pcReadFrom >= pxQueue->pcTail )
|
if( pxQueue->u.pcReadFrom >= pxQueue->pcTail ) /*lint !e946 MISRA exception justified as use of the relational operator is the cleanest solutions. */
|
||||||
{
|
{
|
||||||
pxQueue->u.pcReadFrom = pxQueue->pcHead;
|
pxQueue->u.pcReadFrom = pxQueue->pcHead;
|
||||||
}
|
}
|
||||||
memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.pcReadFrom, ( size_t ) pxQueue->uxItemSize );
|
( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.pcReadFrom, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports. Also previous logic ensures a null pointer can only be passed to memcpy() when the count is 0. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -1557,7 +1567,7 @@ signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
if( pxQueue->uxMessagesWaiting == 0 )
|
if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
|
@ -1577,7 +1587,7 @@ signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue )
|
||||||
signed portBASE_TYPE xReturn;
|
signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
configASSERT( xQueue );
|
configASSERT( xQueue );
|
||||||
if( ( ( xQUEUE * ) xQueue )->uxMessagesWaiting == 0 )
|
if( ( ( xQUEUE * ) xQueue )->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
|
@ -1587,7 +1597,7 @@ signed portBASE_TYPE xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue )
|
static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue )
|
||||||
|
@ -1626,7 +1636,7 @@ signed portBASE_TYPE xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( configUSE_CO_ROUTINES == 1 )
|
#if ( configUSE_CO_ROUTINES == 1 )
|
||||||
|
@ -1889,7 +1899,7 @@ signed portBASE_TYPE xReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
|
||||||
|
|
||||||
#endif /* configQUEUE_REGISTRY_SIZE */
|
#endif /* configQUEUE_REGISTRY_SIZE */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -1951,7 +1961,7 @@ signed portBASE_TYPE xReturn;
|
||||||
/* Cannot add a queue/semaphore to more than one queue set. */
|
/* Cannot add a queue/semaphore to more than one queue set. */
|
||||||
xReturn = pdFAIL;
|
xReturn = pdFAIL;
|
||||||
}
|
}
|
||||||
else if( ( ( xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != 0 )
|
else if( ( ( xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* Cannot add a queue/semaphore to a queue set if there are already
|
/* Cannot add a queue/semaphore to a queue set if there are already
|
||||||
items in the queue/semaphore. */
|
items in the queue/semaphore. */
|
||||||
|
@ -1985,7 +1995,7 @@ signed portBASE_TYPE xReturn;
|
||||||
/* The queue was not a member of the set. */
|
/* The queue was not a member of the set. */
|
||||||
xReturn = pdFAIL;
|
xReturn = pdFAIL;
|
||||||
}
|
}
|
||||||
else if( pxQueueOrSemaphore->uxMessagesWaiting != 0 )
|
else if( pxQueueOrSemaphore->uxMessagesWaiting != ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* It is dangerous to remove a queue from a set when the queue is
|
/* It is dangerous to remove a queue from a set when the queue is
|
||||||
not empty because the queue set will still hold pending events for
|
not empty because the queue set will still hold pending events for
|
||||||
|
@ -2004,7 +2014,7 @@ signed portBASE_TYPE xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
} /*lint !e818 xQueueSet could not be declared as pointing to const as it is a typedef. */
|
||||||
|
|
||||||
#endif /* configUSE_QUEUE_SETS */
|
#endif /* configUSE_QUEUE_SETS */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -2015,7 +2025,7 @@ signed portBASE_TYPE xReturn;
|
||||||
{
|
{
|
||||||
xQueueSetMemberHandle xReturn = NULL;
|
xQueueSetMemberHandle xReturn = NULL;
|
||||||
|
|
||||||
xQueueGenericReceive( ( xQueueHandle ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE );
|
( void ) xQueueGenericReceive( ( xQueueHandle ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE ); /*lint !e961 Casting from one typedef to another is not redundant. */
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2028,7 +2038,7 @@ signed portBASE_TYPE xReturn;
|
||||||
{
|
{
|
||||||
xQueueSetMemberHandle xReturn = NULL;
|
xQueueSetMemberHandle xReturn = NULL;
|
||||||
|
|
||||||
xQueueReceiveFromISR( ( xQueueHandle ) xQueueSet, &xReturn, NULL );
|
( void ) xQueueReceiveFromISR( ( xQueueHandle ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2037,7 +2047,7 @@ signed portBASE_TYPE xReturn;
|
||||||
|
|
||||||
#if ( configUSE_QUEUE_SETS == 1 )
|
#if ( configUSE_QUEUE_SETS == 1 )
|
||||||
|
|
||||||
static portBASE_TYPE prvNotifyQueueSetContainer( xQUEUE *pxQueue, portBASE_TYPE xCopyPosition )
|
static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition )
|
||||||
{
|
{
|
||||||
xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer;
|
xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer;
|
||||||
portBASE_TYPE xReturn = pdFALSE;
|
portBASE_TYPE xReturn = pdFALSE;
|
||||||
|
|
|
@ -73,7 +73,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -88,7 +87,19 @@ task.h is included from an application file. */
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "StackMacros.h"
|
#include "StackMacros.h"
|
||||||
|
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the
|
||||||
|
MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the
|
||||||
|
header files above, but not in this file, in order to generate the correct
|
||||||
|
privileged Vs unprivileged linkage and placement. */
|
||||||
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */
|
||||||
|
|
||||||
|
#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configINCLUDE_STATS_FORMATTING_FUNCTIONS == 1 ) )
|
||||||
|
/* At the bottom of this file are two optional functions that can be used
|
||||||
|
to generate human readable text from the raw data generated by the
|
||||||
|
xTaskGetSystemState() function. Note the formatting functions are provided
|
||||||
|
for convenience only, and are NOT considered part of the kernel. */
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configINCLUDE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */
|
||||||
|
|
||||||
/* Sanity check the configuration. */
|
/* Sanity check the configuration. */
|
||||||
#if configUSE_TICKLESS_IDLE != 0
|
#if configUSE_TICKLESS_IDLE != 0
|
||||||
|
@ -168,6 +179,9 @@ typedef struct tskTaskControlBlock
|
||||||
#define static
|
#define static
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*lint -e956 A manual analysis and inspection has been used to determine which
|
||||||
|
static variables must be declared volatile. */
|
||||||
|
|
||||||
PRIVILEGED_DATA tskTCB * volatile pxCurrentTCB = NULL;
|
PRIVILEGED_DATA tskTCB * volatile pxCurrentTCB = NULL;
|
||||||
|
|
||||||
/* Lists for ready and blocked tasks. --------------------*/
|
/* Lists for ready and blocked tasks. --------------------*/
|
||||||
|
@ -204,10 +218,10 @@ PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTopReadyPriority = ts
|
||||||
PRIVILEGED_DATA static volatile signed portBASE_TYPE xSchedulerRunning = pdFALSE;
|
PRIVILEGED_DATA static volatile signed portBASE_TYPE xSchedulerRunning = pdFALSE;
|
||||||
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE;
|
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE;
|
||||||
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxPendedTicks = ( unsigned portBASE_TYPE ) 0U;
|
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxPendedTicks = ( unsigned portBASE_TYPE ) 0U;
|
||||||
PRIVILEGED_DATA static volatile portBASE_TYPE xYieldPending = ( portBASE_TYPE ) pdFALSE;
|
PRIVILEGED_DATA static volatile portBASE_TYPE xYieldPending = pdFALSE;
|
||||||
PRIVILEGED_DATA static volatile portBASE_TYPE xNumOfOverflows = ( portBASE_TYPE ) 0;
|
PRIVILEGED_DATA static volatile portBASE_TYPE xNumOfOverflows = ( portBASE_TYPE ) 0;
|
||||||
PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0U;
|
PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0U;
|
||||||
PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = ( portTickType ) portMAX_DELAY;
|
PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = portMAX_DELAY;
|
||||||
|
|
||||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||||
|
|
||||||
|
@ -216,6 +230,8 @@ PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime = ( portTic
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*lint +e956 */
|
||||||
|
|
||||||
/* Debugging and trace facilities private variables and macros. ------------*/
|
/* Debugging and trace facilities private variables and macros. ------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -355,7 +371,7 @@ count overflows. */
|
||||||
#define prvAddTaskToReadyList( pxTCB ) \
|
#define prvAddTaskToReadyList( pxTCB ) \
|
||||||
traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
|
traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
|
||||||
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
|
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
|
||||||
vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
|
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -506,7 +522,7 @@ tskTCB * pxNewTCB;
|
||||||
#if( portSTACK_GROWTH < 0 )
|
#if( portSTACK_GROWTH < 0 )
|
||||||
{
|
{
|
||||||
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );
|
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );
|
||||||
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) );
|
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */
|
||||||
|
|
||||||
/* Check the alignment of the calculated top of stack is correct. */
|
/* Check the alignment of the calculated top of stack is correct. */
|
||||||
configASSERT( ( ( ( unsigned long ) pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
|
configASSERT( ( ( ( unsigned long ) pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
|
||||||
|
@ -645,7 +661,7 @@ tskTCB * pxNewTCB;
|
||||||
This will stop the task from be scheduled. The idle task will check
|
This will stop the task from be scheduled. The idle task will check
|
||||||
the termination list and free up any memory allocated by the
|
the termination list and free up any memory allocated by the
|
||||||
scheduler for the TCB and stack. */
|
scheduler for the TCB and stack. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
||||||
}
|
}
|
||||||
|
@ -653,10 +669,10 @@ tskTCB * pxNewTCB;
|
||||||
/* Is the task waiting on an event also? */
|
/* Is the task waiting on an event also? */
|
||||||
if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
|
if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
|
||||||
{
|
{
|
||||||
uxListRemove( &( pxTCB->xEventListItem ) );
|
( void ) uxListRemove( &( pxTCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
vListInsertEnd( ( xList * ) &xTasksWaitingTermination, &( pxTCB->xGenericListItem ) );
|
vListInsertEnd( &xTasksWaitingTermination, &( pxTCB->xGenericListItem ) );
|
||||||
|
|
||||||
/* Increment the ucTasksDeleted variable so the idle task knows
|
/* Increment the ucTasksDeleted variable so the idle task knows
|
||||||
there is a task that has been deleted and that it should therefore
|
there is a task that has been deleted and that it should therefore
|
||||||
|
@ -674,7 +690,7 @@ tskTCB * pxNewTCB;
|
||||||
/* 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 )
|
||||||
{
|
{
|
||||||
if( ( void * ) xTaskToDelete == NULL )
|
if( ( void * ) xTaskToDelete == NULL ) /*lint !e961 MISRA exception as this is not a redundant cast when used with some supported compilers. */
|
||||||
{
|
{
|
||||||
portYIELD_WITHIN_API();
|
portYIELD_WITHIN_API();
|
||||||
}
|
}
|
||||||
|
@ -736,7 +752,7 @@ tskTCB * pxNewTCB;
|
||||||
/* We must remove ourselves from the ready list before adding
|
/* We must remove ourselves from the ready list before adding
|
||||||
ourselves to the blocked list as the same list item is used for
|
ourselves to the blocked list as the same list item is used for
|
||||||
both lists. */
|
both lists. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* The current task must be in a ready list, so there is
|
/* The current task must be in a ready list, so there is
|
||||||
no need to check, and the port reset macro can be called
|
no need to check, and the port reset macro can be called
|
||||||
|
@ -789,7 +805,7 @@ tskTCB * pxNewTCB;
|
||||||
/* We must remove ourselves from the ready list before adding
|
/* We must remove ourselves from the ready list before adding
|
||||||
ourselves to the blocked list as the same list item is used for
|
ourselves to the blocked list as the same list item is used for
|
||||||
both lists. */
|
both lists. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* The current task must be in a ready list, so there is
|
/* The current task must be in a ready list, so there is
|
||||||
no need to check, and the port reset macro can be called
|
no need to check, and the port reset macro can be called
|
||||||
|
@ -905,9 +921,9 @@ tskTCB * pxNewTCB;
|
||||||
configASSERT( ( uxNewPriority < configMAX_PRIORITIES ) );
|
configASSERT( ( uxNewPriority < configMAX_PRIORITIES ) );
|
||||||
|
|
||||||
/* Ensure the new priority is valid. */
|
/* Ensure the new priority is valid. */
|
||||||
if( uxNewPriority >= configMAX_PRIORITIES )
|
if( uxNewPriority >= ( unsigned portBASE_TYPE ) configMAX_PRIORITIES )
|
||||||
{
|
{
|
||||||
uxNewPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;
|
uxNewPriority = ( unsigned portBASE_TYPE ) configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
|
@ -954,6 +970,10 @@ tskTCB * pxNewTCB;
|
||||||
task of higher priority that is ready to execute. */
|
task of higher priority that is ready to execute. */
|
||||||
xYieldRequired = pdTRUE;
|
xYieldRequired = pdTRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Yield not required. */
|
||||||
|
}
|
||||||
|
|
||||||
/* Remember the ready list the task might be referenced from
|
/* Remember the ready list the task might be referenced from
|
||||||
before its uxPriority member is changed so the
|
before its uxPriority member is changed so the
|
||||||
|
@ -978,18 +998,18 @@ tskTCB * pxNewTCB;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( configMAX_PRIORITIES - ( portTickType ) uxNewPriority ) );
|
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( portTickType ) configMAX_PRIORITIES - ( portTickType ) uxNewPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
/* If the task is in the blocked or suspended list we need do
|
/* If the task is in the blocked or suspended list we need do
|
||||||
nothing more than change it's priority variable. However, if
|
nothing more than change it's priority variable. However, if
|
||||||
the task is in a ready list it needs to be removed and placed
|
the task is in a ready list it needs to be removed and placed
|
||||||
in the queue appropriate to its new priority. */
|
in the queue appropriate to its new priority. */
|
||||||
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ uxCurrentPriority ] ), &( pxTCB->xGenericListItem ) ) )
|
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ uxCurrentPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
||||||
{
|
{
|
||||||
/* The task is currently in its ready list - remove before adding
|
/* The task is currently in its ready list - remove before adding
|
||||||
it to it's new ready list. As we are in a critical section we
|
it to it's new ready list. As we are in a critical section we
|
||||||
can do this even if the scheduler is suspended. */
|
can do this even if the scheduler is suspended. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( uxPriorityUsedOnEntry );
|
taskRESET_READY_PRIORITY( uxPriorityUsedOnEntry );
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1053,7 @@ tskTCB * pxNewTCB;
|
||||||
traceTASK_SUSPEND( pxTCB );
|
traceTASK_SUSPEND( pxTCB );
|
||||||
|
|
||||||
/* Remove task from the ready/delayed list and place in the suspended list. */
|
/* Remove task from the ready/delayed list and place in the suspended list. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
||||||
}
|
}
|
||||||
|
@ -1041,14 +1061,14 @@ tskTCB * pxNewTCB;
|
||||||
/* Is the task waiting on an event also? */
|
/* Is the task waiting on an event also? */
|
||||||
if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
|
if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
|
||||||
{
|
{
|
||||||
uxListRemove( &( pxTCB->xEventListItem ) );
|
( void ) uxListRemove( &( pxTCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
vListInsertEnd( ( xList * ) &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );
|
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );
|
||||||
}
|
}
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
if( ( void * ) xTaskToSuspend == NULL )
|
if( ( void * ) xTaskToSuspend == NULL ) /*lint !e961 MISRA exception justified because it is not a redundant cast for some supported compilers. */
|
||||||
{
|
{
|
||||||
if( xSchedulerRunning != pdFALSE )
|
if( xSchedulerRunning != pdFALSE )
|
||||||
{
|
{
|
||||||
|
@ -1094,13 +1114,13 @@ tskTCB * pxNewTCB;
|
||||||
if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
||||||
{
|
{
|
||||||
/* Has the task already been resumed from within an ISR? */
|
/* Has the task already been resumed from within an ISR? */
|
||||||
if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) != pdTRUE )
|
if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) == pdFALSE )
|
||||||
{
|
{
|
||||||
/* Is it in the suspended list because it is in the
|
/* Is it in the suspended list because it is in the
|
||||||
Suspended state? It is possible to be in the suspended
|
Suspended state? It is possible to be in the suspended
|
||||||
list because it is blocked on a task with no timeout
|
list because it is blocked on a task with no timeout
|
||||||
specified. */
|
specified. */
|
||||||
if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) == pdTRUE )
|
if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) != pdFALSE )
|
||||||
{
|
{
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1128,7 @@ tskTCB * pxNewTCB;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
} /*lint !e818 xTask cannot be a pointer to const because it is a typedef. */
|
||||||
|
|
||||||
#endif /* INCLUDE_vTaskSuspend */
|
#endif /* INCLUDE_vTaskSuspend */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -1134,7 +1154,7 @@ tskTCB * pxNewTCB;
|
||||||
|
|
||||||
/* As we are in a critical section we can access the ready
|
/* As we are in a critical section we can access the ready
|
||||||
lists even if the scheduler is suspended. */
|
lists even if the scheduler is suspended. */
|
||||||
uxListRemove( &( pxTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
prvAddTaskToReadyList( pxTCB );
|
prvAddTaskToReadyList( pxTCB );
|
||||||
|
|
||||||
/* We may have just resumed a higher priority task. */
|
/* We may have just resumed a higher priority task. */
|
||||||
|
@ -1191,7 +1211,7 @@ tskTCB * pxNewTCB;
|
||||||
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
|
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
|
||||||
{
|
{
|
||||||
xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );
|
xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );
|
||||||
uxListRemove( &( pxTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
prvAddTaskToReadyList( pxTCB );
|
prvAddTaskToReadyList( pxTCB );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1199,7 +1219,7 @@ tskTCB * pxNewTCB;
|
||||||
/* We cannot access the delayed or ready lists, so will hold this
|
/* We cannot access the delayed or ready lists, so will hold this
|
||||||
task pending until the scheduler is resumed, at which point a
|
task pending until the scheduler is resumed, at which point a
|
||||||
yield will be performed if necessary. */
|
yield will be performed if necessary. */
|
||||||
vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) );
|
vListInsertEnd( &( xPendingReadyList ), &( pxTCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1220,12 +1240,12 @@ portBASE_TYPE xReturn;
|
||||||
{
|
{
|
||||||
/* Create the idle task, storing its handle in xIdleTaskHandle so it can
|
/* Create the idle task, storing its handle in xIdleTaskHandle so it can
|
||||||
be returned by the xTaskGetIdleTaskHandle() function. */
|
be returned by the xTaskGetIdleTaskHandle() function. */
|
||||||
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle );
|
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
/* Create the idle task without storing its handle. */
|
/* Create the idle task without storing its handle. */
|
||||||
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL );
|
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||||
}
|
}
|
||||||
#endif /* INCLUDE_xTaskGetIdleTaskHandle */
|
#endif /* INCLUDE_xTaskGetIdleTaskHandle */
|
||||||
|
|
||||||
|
@ -1329,8 +1349,8 @@ void vTaskSuspendAll( void )
|
||||||
|
|
||||||
signed portBASE_TYPE xTaskResumeAll( void )
|
signed portBASE_TYPE xTaskResumeAll( void )
|
||||||
{
|
{
|
||||||
register tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
signed portBASE_TYPE xAlreadyYielded = pdFALSE;
|
portBASE_TYPE xAlreadyYielded = pdFALSE;
|
||||||
portBASE_TYPE xYieldRequired = pdFALSE;
|
portBASE_TYPE xYieldRequired = pdFALSE;
|
||||||
|
|
||||||
/* If uxSchedulerSuspended is zero then this function does not match a
|
/* If uxSchedulerSuspended is zero then this function does not match a
|
||||||
|
@ -1352,11 +1372,11 @@ portBASE_TYPE xYieldRequired = pdFALSE;
|
||||||
{
|
{
|
||||||
/* Move any readied tasks from the pending list into the
|
/* Move any readied tasks from the pending list into the
|
||||||
appropriate ready list. */
|
appropriate ready list. */
|
||||||
while( listLIST_IS_EMPTY( ( xList * ) &xPendingReadyList ) == pdFALSE )
|
while( listLIST_IS_EMPTY( &xPendingReadyList ) == pdFALSE )
|
||||||
{
|
{
|
||||||
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xPendingReadyList ) );
|
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList ) );
|
||||||
uxListRemove( &( pxTCB->xEventListItem ) );
|
( void ) uxListRemove( &( pxTCB->xEventListItem ) );
|
||||||
uxListRemove( &( pxTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
prvAddTaskToReadyList( pxTCB );
|
prvAddTaskToReadyList( pxTCB );
|
||||||
|
|
||||||
/* If we have moved a task that has a priority higher than
|
/* If we have moved a task that has a priority higher than
|
||||||
|
@ -1480,9 +1500,9 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uxQueue--;
|
uxQueue--;
|
||||||
uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), ( xList * ) &( pxReadyTasksLists[ uxQueue ] ), eReady );
|
uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &( pxReadyTasksLists[ uxQueue ] ), eReady );
|
||||||
|
|
||||||
}while( uxQueue > ( unsigned short ) tskIDLE_PRIORITY );
|
} while( uxQueue > ( unsigned portBASE_TYPE ) tskIDLE_PRIORITY ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
/* Fill in an xTaskStatusType structure with information on each
|
/* Fill in an xTaskStatusType structure with information on each
|
||||||
task in the Blocked state. */
|
task in the Blocked state. */
|
||||||
|
@ -1522,7 +1542,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xTaskResumeAll();
|
( void ) xTaskResumeAll();
|
||||||
|
|
||||||
return uxTask;
|
return uxTask;
|
||||||
}
|
}
|
||||||
|
@ -1624,13 +1644,13 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It is time to remove the item from the Blocked state. */
|
/* It is time to remove the item from the Blocked state. */
|
||||||
uxListRemove( &( pxTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
|
|
||||||
/* Is the task waiting on an event also? If so remove it
|
/* Is the task waiting on an event also? If so remove it
|
||||||
from the event list. */
|
from the event list. */
|
||||||
if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
|
if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
|
||||||
{
|
{
|
||||||
uxListRemove( &( pxTCB->xEventListItem ) );
|
( void ) uxListRemove( &( pxTCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place the unblocked task into the appropriate ready
|
/* Place the unblocked task into the appropriate ready
|
||||||
|
@ -1661,7 +1681,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
writer has not explicitly turned time slicing off. */
|
writer has not explicitly turned time slicing off. */
|
||||||
#if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
|
#if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
|
||||||
{
|
{
|
||||||
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > 1 )
|
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > ( unsigned portBASE_TYPE ) 1 )
|
||||||
{
|
{
|
||||||
xSwitchRequired = pdTRUE;
|
xSwitchRequired = pdTRUE;
|
||||||
}
|
}
|
||||||
|
@ -1836,7 +1856,7 @@ void vTaskSwitchContext( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicksToWait )
|
void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait )
|
||||||
{
|
{
|
||||||
portTickType xTimeToWake;
|
portTickType xTimeToWake;
|
||||||
|
|
||||||
|
@ -1848,12 +1868,12 @@ portTickType xTimeToWake;
|
||||||
/* Place the event list item of the TCB in the appropriate event list.
|
/* Place the event list item of the TCB in the appropriate event list.
|
||||||
This is placed in the list in priority order so the highest priority task
|
This is placed in the list in priority order so the highest priority task
|
||||||
is the first to be woken by the event. */
|
is the first to be woken by the event. */
|
||||||
vListInsert( ( xList * ) pxEventList, ( xListItem * ) &( pxCurrentTCB->xEventListItem ) );
|
vListInsert( pxEventList, &( pxCurrentTCB->xEventListItem ) );
|
||||||
|
|
||||||
/* We must remove ourselves from the ready list before adding ourselves
|
/* 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. We have
|
to the blocked list as the same list item is used for both lists. We have
|
||||||
exclusive access to the ready lists as the scheduler is locked. */
|
exclusive access to the ready lists as the scheduler is locked. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* The current task must be in a ready list, so there is no need to
|
/* The current task must be in a ready list, so there is no need to
|
||||||
check, and the port reset macro can be called directly. */
|
check, and the port reset macro can be called directly. */
|
||||||
|
@ -1867,7 +1887,7 @@ portTickType xTimeToWake;
|
||||||
/* Add ourselves to the suspended task list instead of a delayed task
|
/* Add ourselves to the suspended task list instead of a delayed task
|
||||||
list to ensure we are not woken by a timing event. We will block
|
list to ensure we are not woken by a timing event. We will block
|
||||||
indefinitely. */
|
indefinitely. */
|
||||||
vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1890,7 +1910,7 @@ portTickType xTimeToWake;
|
||||||
|
|
||||||
#if configUSE_TIMERS == 1
|
#if configUSE_TIMERS == 1
|
||||||
|
|
||||||
void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickType xTicksToWait )
|
void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait )
|
||||||
{
|
{
|
||||||
portTickType xTimeToWake;
|
portTickType xTimeToWake;
|
||||||
|
|
||||||
|
@ -1906,12 +1926,12 @@ portTickType xTimeToWake;
|
||||||
In this case it is assume that this is the only task that is going to
|
In this case it is assume that this is the only task that is going to
|
||||||
be waiting on this event list, so the faster vListInsertEnd() function
|
be waiting on this event list, so the faster vListInsertEnd() function
|
||||||
can be used in place of vListInsert. */
|
can be used in place of vListInsert. */
|
||||||
vListInsertEnd( ( xList * ) pxEventList, ( xListItem * ) &( pxCurrentTCB->xEventListItem ) );
|
vListInsertEnd( pxEventList, &( pxCurrentTCB->xEventListItem ) );
|
||||||
|
|
||||||
/* We must remove this task from the ready list before adding it to the
|
/* We must remove this task from the ready list before adding it to the
|
||||||
blocked list as the same list item is used for both lists. This
|
blocked list as the same list item is used for both lists. This
|
||||||
function is called form a critical section. */
|
function is called form a critical section. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
/* The current task must be in a ready list, so there is no need to
|
/* The current task must be in a ready list, so there is no need to
|
||||||
check, and the port reset macro can be called directly. */
|
check, and the port reset macro can be called directly. */
|
||||||
|
@ -1949,18 +1969,18 @@ portBASE_TYPE xReturn;
|
||||||
pxEventList is not empty. */
|
pxEventList is not empty. */
|
||||||
pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
||||||
configASSERT( pxUnblockedTCB );
|
configASSERT( pxUnblockedTCB );
|
||||||
uxListRemove( &( pxUnblockedTCB->xEventListItem ) );
|
( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) );
|
||||||
|
|
||||||
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
|
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
|
||||||
{
|
{
|
||||||
uxListRemove( &( pxUnblockedTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxUnblockedTCB->xGenericListItem ) );
|
||||||
prvAddTaskToReadyList( pxUnblockedTCB );
|
prvAddTaskToReadyList( pxUnblockedTCB );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We cannot access the delayed or ready lists, so will hold this
|
/* We cannot access the delayed or ready lists, so will hold this
|
||||||
task pending until the scheduler is resumed. */
|
task pending until the scheduler is resumed. */
|
||||||
vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );
|
vListInsertEnd( &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pxUnblockedTCB->uxPriority >= pxCurrentTCB->uxPriority )
|
if( pxUnblockedTCB->uxPriority >= pxCurrentTCB->uxPriority )
|
||||||
|
@ -2011,7 +2031,7 @@ portBASE_TYPE xReturn;
|
||||||
else /* We are not blocking indefinitely, perform the checks below. */
|
else /* We are not blocking indefinitely, perform the checks below. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( ( portTickType ) xConstTickCount >= ( portTickType ) pxTimeOut->xTimeOnEntering ) )
|
if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( xConstTickCount >= pxTimeOut->xTimeOnEntering ) ) /*lint !e525 Indentation preferred as is to make code within pre-processor directives clearer. */
|
||||||
{
|
{
|
||||||
/* The tick count is greater than the time at which vTaskSetTimeout()
|
/* The tick count is greater than the time at which vTaskSetTimeout()
|
||||||
was called, but has also overflowed since vTaskSetTimeOut() was called.
|
was called, but has also overflowed since vTaskSetTimeOut() was called.
|
||||||
|
@ -2019,10 +2039,10 @@ portBASE_TYPE xReturn;
|
||||||
passed since vTaskSetTimeout() was called. */
|
passed since vTaskSetTimeout() was called. */
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
else if( ( ( portTickType ) ( ( portTickType ) xConstTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) ) < ( portTickType ) *pxTicksToWait )
|
else if( ( xConstTickCount - pxTimeOut->xTimeOnEntering ) < *pxTicksToWait )
|
||||||
{
|
{
|
||||||
/* Not a genuine timeout. Adjust parameters for time remaining. */
|
/* Not a genuine timeout. Adjust parameters for time remaining. */
|
||||||
*pxTicksToWait -= ( ( portTickType ) xConstTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering );
|
*pxTicksToWait -= ( xConstTickCount - pxTimeOut->xTimeOnEntering );
|
||||||
vTaskSetTimeOutState( pxTimeOut );
|
vTaskSetTimeOutState( pxTimeOut );
|
||||||
xReturn = pdFALSE;
|
xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
|
@ -2223,10 +2243,10 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||||
|
|
||||||
static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth )
|
static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth )
|
||||||
{
|
{
|
||||||
portBASE_TYPE x;
|
unsigned portBASE_TYPE x;
|
||||||
|
|
||||||
/* Store the task name in the TCB. */
|
/* Store the task name in the TCB. */
|
||||||
for( x = 0; x < configMAX_TASK_NAME_LEN; x++ )
|
for( x = ( unsigned portBASE_TYPE ) 0; x < ( unsigned portBASE_TYPE ) configMAX_TASK_NAME_LEN; x++ )
|
||||||
{
|
{
|
||||||
pxTCB->pcTaskName[ x ] = pcName[ x ];
|
pxTCB->pcTaskName[ x ] = pcName[ x ];
|
||||||
|
|
||||||
|
@ -2245,9 +2265,9 @@ portBASE_TYPE x;
|
||||||
|
|
||||||
/* 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 >= ( unsigned portBASE_TYPE ) configMAX_PRIORITIES )
|
||||||
{
|
{
|
||||||
uxPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;
|
uxPriority = ( unsigned portBASE_TYPE ) configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
pxTCB->uxPriority = uxPriority;
|
pxTCB->uxPriority = uxPriority;
|
||||||
|
@ -2265,7 +2285,7 @@ portBASE_TYPE x;
|
||||||
listSET_LIST_ITEM_OWNER( &( pxTCB->xGenericListItem ), pxTCB );
|
listSET_LIST_ITEM_OWNER( &( pxTCB->xGenericListItem ), pxTCB );
|
||||||
|
|
||||||
/* Event lists are always in priority order. */
|
/* Event lists are always in priority order. */
|
||||||
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );
|
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
listSET_LIST_ITEM_OWNER( &( pxTCB->xEventListItem ), pxTCB );
|
listSET_LIST_ITEM_OWNER( &( pxTCB->xEventListItem ), pxTCB );
|
||||||
|
|
||||||
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
||||||
|
@ -2330,24 +2350,24 @@ static void prvInitialiseTaskLists( void )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE uxPriority;
|
unsigned portBASE_TYPE uxPriority;
|
||||||
|
|
||||||
for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < configMAX_PRIORITIES; uxPriority++ )
|
for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < ( unsigned portBASE_TYPE ) configMAX_PRIORITIES; uxPriority++ )
|
||||||
{
|
{
|
||||||
vListInitialise( ( xList * ) &( pxReadyTasksLists[ uxPriority ] ) );
|
vListInitialise( &( pxReadyTasksLists[ uxPriority ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
vListInitialise( ( xList * ) &xDelayedTaskList1 );
|
vListInitialise( &xDelayedTaskList1 );
|
||||||
vListInitialise( ( xList * ) &xDelayedTaskList2 );
|
vListInitialise( &xDelayedTaskList2 );
|
||||||
vListInitialise( ( xList * ) &xPendingReadyList );
|
vListInitialise( &xPendingReadyList );
|
||||||
|
|
||||||
#if ( INCLUDE_vTaskDelete == 1 )
|
#if ( INCLUDE_vTaskDelete == 1 )
|
||||||
{
|
{
|
||||||
vListInitialise( ( xList * ) &xTasksWaitingTermination );
|
vListInitialise( &xTasksWaitingTermination );
|
||||||
}
|
}
|
||||||
#endif /* INCLUDE_vTaskDelete */
|
#endif /* INCLUDE_vTaskDelete */
|
||||||
|
|
||||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||||
{
|
{
|
||||||
vListInitialise( ( xList * ) &xSuspendedTaskList );
|
vListInitialise( &xSuspendedTaskList );
|
||||||
}
|
}
|
||||||
#endif /* INCLUDE_vTaskSuspend */
|
#endif /* INCLUDE_vTaskSuspend */
|
||||||
|
|
||||||
|
@ -2370,7 +2390,7 @@ static void prvCheckTasksWaitingTermination( void )
|
||||||
{
|
{
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination );
|
xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination );
|
||||||
xTaskResumeAll();
|
( void ) xTaskResumeAll();
|
||||||
|
|
||||||
if( xListIsEmpty == pdFALSE )
|
if( xListIsEmpty == pdFALSE )
|
||||||
{
|
{
|
||||||
|
@ -2378,8 +2398,8 @@ static void prvCheckTasksWaitingTermination( void )
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xTasksWaitingTermination ) );
|
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
|
||||||
uxListRemove( &( pxTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
--uxCurrentNumberOfTasks;
|
--uxCurrentNumberOfTasks;
|
||||||
--uxTasksDeleted;
|
--uxTasksDeleted;
|
||||||
}
|
}
|
||||||
|
@ -2401,12 +2421,12 @@ static void prvAddCurrentTaskToDelayedList( portTickType xTimeToWake )
|
||||||
if( xTimeToWake < xTickCount )
|
if( xTimeToWake < xTickCount )
|
||||||
{
|
{
|
||||||
/* Wake time has overflowed. Place this item in the overflow list. */
|
/* Wake time has overflowed. Place this item in the overflow list. */
|
||||||
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xGenericListItem ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The wake time has not overflowed, so we can use the current block list. */
|
/* The wake time has not overflowed, so we can use the current block list. */
|
||||||
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xGenericListItem ) );
|
||||||
|
|
||||||
/* If the task entering the blocked state was placed at the head of the
|
/* If the task entering the blocked state was placed at the head of the
|
||||||
list of blocked tasks then xNextTaskUnblockTime needs to be updated
|
list of blocked tasks then xNextTaskUnblockTime needs to be updated
|
||||||
|
@ -2432,7 +2452,7 @@ tskTCB *pxNewTCB;
|
||||||
/* Allocate space for the stack used by the task being created.
|
/* Allocate space for the stack used by the task being created.
|
||||||
The base of the stack memory stored in the TCB so the task can
|
The base of the stack memory stored in the TCB so the task can
|
||||||
be deleted later if required. */
|
be deleted later if required. */
|
||||||
pxNewTCB->pxStack = ( portSTACK_TYPE * ) pvPortMallocAligned( ( ( ( size_t )usStackDepth ) * sizeof( portSTACK_TYPE ) ), puxStackBuffer );
|
pxNewTCB->pxStack = ( portSTACK_TYPE * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( portSTACK_TYPE ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
if( pxNewTCB->pxStack == NULL )
|
if( pxNewTCB->pxStack == NULL )
|
||||||
{
|
{
|
||||||
|
@ -2443,7 +2463,7 @@ tskTCB *pxNewTCB;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Just to help debugging. */
|
/* Just to help debugging. */
|
||||||
memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );
|
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2458,7 +2478,7 @@ tskTCB *pxNewTCB;
|
||||||
volatile tskTCB *pxNextTCB, *pxFirstTCB;
|
volatile tskTCB *pxNextTCB, *pxFirstTCB;
|
||||||
unsigned portBASE_TYPE uxTask = 0;
|
unsigned portBASE_TYPE uxTask = 0;
|
||||||
|
|
||||||
if( listCURRENT_LIST_LENGTH( pxList ) > 0 )
|
if( listCURRENT_LIST_LENGTH( pxList ) > ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
||||||
|
|
||||||
|
@ -2630,7 +2650,7 @@ tskTCB *pxNewTCB;
|
||||||
|
|
||||||
#if ( configUSE_MUTEXES == 1 )
|
#if ( configUSE_MUTEXES == 1 )
|
||||||
|
|
||||||
void vTaskPriorityInherit( xTaskHandle * const pxMutexHolder )
|
void vTaskPriorityInherit( xTaskHandle const pxMutexHolder )
|
||||||
{
|
{
|
||||||
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
|
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
|
||||||
|
|
||||||
|
@ -2641,13 +2661,13 @@ tskTCB *pxNewTCB;
|
||||||
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
|
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
|
||||||
{
|
{
|
||||||
/* Adjust the mutex holder state to account for its new priority. */
|
/* Adjust the mutex holder state to account for its new priority. */
|
||||||
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );
|
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
/* If the task being modified is in the ready state it will need to
|
/* If the task being modified is in the ready state it will need to
|
||||||
be moved into a new list. */
|
be moved into a new list. */
|
||||||
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
||||||
{
|
{
|
||||||
if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
||||||
}
|
}
|
||||||
|
@ -2672,7 +2692,7 @@ tskTCB *pxNewTCB;
|
||||||
|
|
||||||
#if ( configUSE_MUTEXES == 1 )
|
#if ( configUSE_MUTEXES == 1 )
|
||||||
|
|
||||||
void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder )
|
void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder )
|
||||||
{
|
{
|
||||||
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
|
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
|
||||||
|
|
||||||
|
@ -2682,7 +2702,7 @@ tskTCB *pxNewTCB;
|
||||||
{
|
{
|
||||||
/* We must be the running task to be able to give the mutex back.
|
/* We must be the running task to be able to give the mutex back.
|
||||||
Remove ourselves from the ready list we currently appear in. */
|
Remove ourselves from the ready list we currently appear in. */
|
||||||
if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )
|
if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
||||||
}
|
}
|
||||||
|
@ -2691,7 +2711,7 @@ tskTCB *pxNewTCB;
|
||||||
ready list. */
|
ready list. */
|
||||||
traceTASK_PRIORITY_DISINHERIT( pxTCB, pxTCB->uxBasePriority );
|
traceTASK_PRIORITY_DISINHERIT( pxTCB, pxTCB->uxBasePriority );
|
||||||
pxTCB->uxPriority = pxTCB->uxBasePriority;
|
pxTCB->uxPriority = pxTCB->uxBasePriority;
|
||||||
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority );
|
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
prvAddTaskToReadyList( pxTCB );
|
prvAddTaskToReadyList( pxTCB );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
mission critical applications that require provable dependability.
|
mission critical applications that require provable dependability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
|
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
|
||||||
all the API functions to use the MPU wrappers. That should only be done when
|
all the API functions to use the MPU wrappers. That should only be done when
|
||||||
task.h is included from an application file. */
|
task.h is included from an application file. */
|
||||||
|
@ -82,7 +85,12 @@ task.h is included from an application file. */
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the
|
||||||
|
MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the
|
||||||
|
header files above, but not in this file, in order to generate the correct
|
||||||
|
privileged Vs unprivileged linkage and placement. */
|
||||||
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */
|
||||||
|
|
||||||
|
|
||||||
/* This entire source file will be skipped if the application is not configured
|
/* This entire source file will be skipped if the application is not configured
|
||||||
to include software timer functionality. This #if is closed at the very bottom
|
to include software timer functionality. This #if is closed at the very bottom
|
||||||
|
@ -113,6 +121,8 @@ typedef struct tmrTimerQueueMessage
|
||||||
xTIMER * pxTimer; /*<< The timer to which the command will be applied. */
|
xTIMER * pxTimer; /*<< The timer to which the command will be applied. */
|
||||||
} xTIMER_MESSAGE;
|
} xTIMER_MESSAGE;
|
||||||
|
|
||||||
|
/*lint -e956 A manual analysis and inspection has been used to determine which
|
||||||
|
static variables must be declared volatile. */
|
||||||
|
|
||||||
/* The list in which active timers are stored. Timers are referenced in expire
|
/* The list in which active timers are stored. Timers are referenced in expire
|
||||||
time order, with the nearest expiry time at the front of the list. Only the
|
time order, with the nearest expiry time at the front of the list. Only the
|
||||||
|
@ -131,6 +141,8 @@ PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*lint +e956 */
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -320,7 +332,7 @@ portBASE_TYPE xResult;
|
||||||
/* Remove the timer from the list of active timers. A check has already
|
/* Remove the timer from the list of active timers. A check has already
|
||||||
been performed to ensure the list is not empty. */
|
been performed to ensure the list is not empty. */
|
||||||
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
uxListRemove( &( pxTimer->xTimerListItem ) );
|
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
traceTIMER_EXPIRED( pxTimer );
|
traceTIMER_EXPIRED( pxTimer );
|
||||||
|
|
||||||
/* If the timer is an auto reload timer then calculate the next
|
/* If the timer is an auto reload timer then calculate the next
|
||||||
|
@ -390,7 +402,7 @@ portBASE_TYPE xTimerListsWereSwitched;
|
||||||
/* The tick count has not overflowed, has the timer expired? */
|
/* The tick count has not overflowed, has the timer expired? */
|
||||||
if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )
|
if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )
|
||||||
{
|
{
|
||||||
xTaskResumeAll();
|
( void ) xTaskResumeAll();
|
||||||
prvProcessExpiredTimer( xNextExpireTime, xTimeNow );
|
prvProcessExpiredTimer( xNextExpireTime, xTimeNow );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -415,7 +427,7 @@ portBASE_TYPE xTimerListsWereSwitched;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xTaskResumeAll();
|
( void ) xTaskResumeAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +462,7 @@ portTickType xNextExpireTime;
|
||||||
static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )
|
static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )
|
||||||
{
|
{
|
||||||
portTickType xTimeNow;
|
portTickType xTimeNow;
|
||||||
PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U;
|
PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e956 Variable is only accessible to one task. */
|
||||||
|
|
||||||
xTimeNow = xTaskGetTickCount();
|
xTimeNow = xTaskGetTickCount();
|
||||||
|
|
||||||
|
@ -481,7 +493,7 @@ portBASE_TYPE xProcessTimerNow = pdFALSE;
|
||||||
{
|
{
|
||||||
/* Has the expiry time elapsed between the command to start/reset a
|
/* Has the expiry time elapsed between the command to start/reset a
|
||||||
timer was issued, and the time the command was processed? */
|
timer was issued, and the time the command was processed? */
|
||||||
if( ( ( portTickType ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )
|
if( ( xTimeNow - xCommandTime ) >= pxTimer->xTimerPeriodInTicks )
|
||||||
{
|
{
|
||||||
/* The time between a command being issued and the command being
|
/* The time between a command being issued and the command being
|
||||||
processed actually exceeds the timers period. */
|
processed actually exceeds the timers period. */
|
||||||
|
@ -518,14 +530,14 @@ xTIMER *pxTimer;
|
||||||
portBASE_TYPE xTimerListsWereSwitched, xResult;
|
portBASE_TYPE xTimerListsWereSwitched, xResult;
|
||||||
portTickType xTimeNow;
|
portTickType xTimeNow;
|
||||||
|
|
||||||
while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL )
|
while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL ) /*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */
|
||||||
{
|
{
|
||||||
pxTimer = xMessage.pxTimer;
|
pxTimer = xMessage.pxTimer;
|
||||||
|
|
||||||
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )
|
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )
|
||||||
{
|
{
|
||||||
/* The timer is in a list, remove it. */
|
/* The timer is in a list, remove it. */
|
||||||
uxListRemove( &( pxTimer->xTimerListItem ) );
|
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );
|
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );
|
||||||
|
@ -565,7 +577,7 @@ portTickType xTimeNow;
|
||||||
case tmrCOMMAND_CHANGE_PERIOD :
|
case tmrCOMMAND_CHANGE_PERIOD :
|
||||||
pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;
|
pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;
|
||||||
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );
|
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );
|
||||||
prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );
|
( void ) prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tmrCOMMAND_DELETE :
|
case tmrCOMMAND_DELETE :
|
||||||
|
@ -602,7 +614,7 @@ portBASE_TYPE xResult;
|
||||||
|
|
||||||
/* Remove the timer from the list. */
|
/* Remove the timer from the list. */
|
||||||
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
uxListRemove( &( pxTimer->xTimerListItem ) );
|
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
|
|
||||||
/* Execute its callback, then send a command to restart the timer if
|
/* Execute its callback, then send a command to restart the timer if
|
||||||
it is an auto-reload timer. It cannot be restarted here as the lists
|
it is an auto-reload timer. It cannot be restarted here as the lists
|
||||||
|
|
Loading…
Reference in a new issue