mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-21 22:11:57 -04:00
Ensure demo app files are using FreeRTOS V8 names - a few were missed previously.
This commit is contained in:
parent
ef254df85f
commit
f46070dc79
|
@ -121,20 +121,20 @@ static portTASK_FUNCTION_PROTO( vBlockingQueueConsumer, pvParameters );
|
|||
/* Variables which are incremented each time an item is removed from a queue, and
|
||||
found to be the expected value.
|
||||
These are used to check that the tasks are still running. */
|
||||
static volatile short sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
static volatile short sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
|
||||
/* Variable which are incremented each time an item is posted on a queue. These
|
||||
are used to check that the tasks are still running. */
|
||||
static volatile short sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
static volatile short sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartAltBlockingQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartAltBlockingQueueTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
xBlockingQueueParameters *pxQueueParameters1, *pxQueueParameters2;
|
||||
xBlockingQueueParameters *pxQueueParameters3, *pxQueueParameters4;
|
||||
xBlockingQueueParameters *pxQueueParameters5, *pxQueueParameters6;
|
||||
const unsigned portBASE_TYPE uxQueueSize1 = 1, uxQueueSize5 = 5;
|
||||
const UBaseType_t uxQueueSize1 = 1, uxQueueSize5 = 5;
|
||||
const TickType_t xBlockTime = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
|
||||
const TickType_t xDontBlock = ( TickType_t ) 0;
|
||||
|
||||
|
@ -145,7 +145,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
|
||||
/* Create the queue used by the first two tasks to pass the incrementing number.
|
||||
Pass a pointer to the queue in the parameter structure. */
|
||||
pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
|
||||
/* The consumer is created first so gets a block time as described above. */
|
||||
pxQueueParameters1->xBlockTime = xBlockTime;
|
||||
|
@ -180,7 +180,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
the same mechanism but reverses the task priorities. */
|
||||
|
||||
pxQueueParameters3 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
||||
pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
pxQueueParameters3->xBlockTime = xDontBlock;
|
||||
pxQueueParameters3->psCheckVariable = &( sBlockingProducerCount[ 1 ] );
|
||||
|
||||
|
@ -197,7 +197,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
/* Create the last two tasks as described above. The mechanism is again just
|
||||
the same. This time both parameter structures are given a block time. */
|
||||
pxQueueParameters5 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
||||
pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
pxQueueParameters5->xBlockTime = xBlockTime;
|
||||
pxQueueParameters5->psCheckVariable = &( sBlockingProducerCount[ 2 ] );
|
||||
|
||||
|
@ -213,7 +213,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
|
||||
static portTASK_FUNCTION( vBlockingQueueProducer, pvParameters )
|
||||
{
|
||||
unsigned short usValue = 0;
|
||||
uint16_t usValue = 0;
|
||||
xBlockingQueueParameters *pxQueueParameters;
|
||||
short sErrorEverOccurred = pdFALSE;
|
||||
|
||||
|
@ -253,7 +253,7 @@ short sErrorEverOccurred = pdFALSE;
|
|||
|
||||
static portTASK_FUNCTION( vBlockingQueueConsumer, pvParameters )
|
||||
{
|
||||
unsigned short usData, usExpectedValue = 0;
|
||||
uint16_t usData, usExpectedValue = 0;
|
||||
xBlockingQueueParameters *pxQueueParameters;
|
||||
short sErrorEverOccurred = pdFALSE;
|
||||
|
||||
|
@ -298,11 +298,11 @@ short sErrorEverOccurred = pdFALSE;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreAltBlockingQueuesStillRunning( void )
|
||||
BaseType_t xAreAltBlockingQueuesStillRunning( void )
|
||||
{
|
||||
static short sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
static short sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
portBASE_TYPE xReturn = pdPASS, xTasks;
|
||||
static short sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
static short sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
BaseType_t xReturn = pdPASS, xTasks;
|
||||
|
||||
/* Not too worried about mutual exclusion on these variables as they are 16
|
||||
bits and we are only reading them. We also only care to see if they have
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
#define bktALLOWABLE_MARGIN ( 12 )
|
||||
#define bktTIME_TO_BLOCK ( 175 )
|
||||
#define bktDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
#define bktRUN_INDICATOR ( ( unsigned portBASE_TYPE ) 0x55 )
|
||||
#define bktRUN_INDICATOR ( ( UBaseType_t ) 0x55 )
|
||||
|
||||
/* The queue on which the tasks block. */
|
||||
static QueueHandle_t xTestQueue;
|
||||
|
@ -100,12 +100,12 @@ to vTaskSuspend/Resume(). */
|
|||
static TaskHandle_t xSecondary;
|
||||
|
||||
/* Used to ensure that tasks are still executing without error. */
|
||||
static portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||
static portBASE_TYPE xErrorOccurred = pdFALSE;
|
||||
static BaseType_t xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||
static BaseType_t xErrorOccurred = pdFALSE;
|
||||
|
||||
/* Provides a simple mechanism for the primary task to know when the
|
||||
secondary task has executed. */
|
||||
static volatile unsigned portBASE_TYPE xRunIndicator;
|
||||
static volatile UBaseType_t xRunIndicator;
|
||||
|
||||
/* The two test tasks. Their behaviour is commented within the files. */
|
||||
static void vPrimaryBlockTimeTestTask( void *pvParameters );
|
||||
|
@ -116,7 +116,7 @@ static void vSecondaryBlockTimeTestTask( void *pvParameters );
|
|||
void vCreateAltBlockTimeTasks( void )
|
||||
{
|
||||
/* Create the queue on which the two tasks block. */
|
||||
xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( portBASE_TYPE ) );
|
||||
xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( BaseType_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -135,7 +135,7 @@ void vCreateAltBlockTimeTasks( void )
|
|||
|
||||
static void vPrimaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
portBASE_TYPE xItem, xData;
|
||||
BaseType_t xItem, xData;
|
||||
TickType_t xTimeWhenBlocking;
|
||||
TickType_t xTimeToBlock, xBlockedTime;
|
||||
|
||||
|
@ -416,7 +416,7 @@ TickType_t xTimeToBlock, xBlockedTime;
|
|||
static void vSecondaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
TickType_t xTimeWhenBlocking, xBlockedTime;
|
||||
portBASE_TYPE xData;
|
||||
BaseType_t xData;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -520,10 +520,10 @@ portBASE_TYPE xData;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreAltBlockTimeTestTasksStillRunning( void )
|
||||
BaseType_t xAreAltBlockTimeTestTasksStillRunning( void )
|
||||
{
|
||||
static portBASE_TYPE xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;
|
||||
portBASE_TYPE xReturn = pdPASS;
|
||||
static BaseType_t xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
|
||||
/* Have both tasks performed at least one cycle since this function was
|
||||
last called? */
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
Changes from V2.0.0
|
||||
|
||||
+ Delay periods are now specified using variables and constants of
|
||||
TickType_t rather than unsigned long.
|
||||
TickType_t rather than uint32_t.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -106,8 +106,8 @@ Changes from V2.0.0
|
|||
#define pollqPRODUCER_DELAY ( ( TickType_t ) 200 / portTICK_PERIOD_MS )
|
||||
#define pollqCONSUMER_DELAY ( pollqPRODUCER_DELAY - ( TickType_t ) ( 20 / portTICK_PERIOD_MS ) )
|
||||
#define pollqNO_DELAY ( ( TickType_t ) 0 )
|
||||
#define pollqVALUES_TO_PRODUCE ( ( signed portBASE_TYPE ) 3 )
|
||||
#define pollqINITIAL_VALUE ( ( signed portBASE_TYPE ) 0 )
|
||||
#define pollqVALUES_TO_PRODUCE ( ( BaseType_t ) 3 )
|
||||
#define pollqINITIAL_VALUE ( ( BaseType_t ) 0 )
|
||||
|
||||
/* The task that posts the incrementing number onto the queue. */
|
||||
static portTASK_FUNCTION_PROTO( vPolledQueueProducer, pvParameters );
|
||||
|
@ -117,16 +117,16 @@ static portTASK_FUNCTION_PROTO( vPolledQueueConsumer, pvParameters );
|
|||
|
||||
/* Variables that are used to check that the tasks are still running with no
|
||||
errors. */
|
||||
static volatile signed portBASE_TYPE xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
|
||||
static volatile BaseType_t xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartAltPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartAltPolledQueueTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
static QueueHandle_t xPolledQueue;
|
||||
|
||||
/* Create the queue used by the producer and consumer. */
|
||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -145,8 +145,8 @@ static QueueHandle_t xPolledQueue;
|
|||
|
||||
static portTASK_FUNCTION( vPolledQueueProducer, pvParameters )
|
||||
{
|
||||
unsigned short usValue = ( unsigned short ) 0;
|
||||
signed portBASE_TYPE xError = pdFALSE, xLoop;
|
||||
uint16_t usValue = ( uint16_t ) 0;
|
||||
BaseType_t xError = pdFALSE, xLoop;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -193,8 +193,8 @@ signed portBASE_TYPE xError = pdFALSE, xLoop;
|
|||
|
||||
static portTASK_FUNCTION( vPolledQueueConsumer, pvParameters )
|
||||
{
|
||||
unsigned short usData, usExpectedValue = ( unsigned short ) 0;
|
||||
signed portBASE_TYPE xError = pdFALSE;
|
||||
uint16_t usData, usExpectedValue = ( uint16_t ) 0;
|
||||
BaseType_t xError = pdFALSE;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -247,9 +247,9 @@ signed portBASE_TYPE xError = pdFALSE;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running with no errors. */
|
||||
portBASE_TYPE xAreAltPollingQueuesStillRunning( void )
|
||||
BaseType_t xAreAltPollingQueuesStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Check both the consumer and producer poll count to check they have both
|
||||
been changed since out last trip round. We do not need a critical section
|
||||
|
|
|
@ -123,15 +123,15 @@ static void prvHighPriorityMutexTask( void *pvParameters );
|
|||
|
||||
/* Flag that will be latched to pdTRUE should any unexpected behaviour be
|
||||
detected in any of the tasks. */
|
||||
static portBASE_TYPE xErrorDetected = pdFALSE;
|
||||
static BaseType_t xErrorDetected = pdFALSE;
|
||||
|
||||
/* Counters that are incremented on each cycle of a test. This is used to
|
||||
detect a stalled task - a test that is no longer running. */
|
||||
static volatile unsigned long ulLoopCounter = 0;
|
||||
static volatile unsigned long ulLoopCounter2 = 0;
|
||||
static volatile uint32_t ulLoopCounter = 0;
|
||||
static volatile uint32_t ulLoopCounter2 = 0;
|
||||
|
||||
/* The variable that is guarded by the mutex in the mutex demo tasks. */
|
||||
static volatile unsigned long ulGuardedVariable = 0;
|
||||
static volatile uint32_t ulGuardedVariable = 0;
|
||||
|
||||
/* Handles used in the mutext test to suspend and resume the high and medium
|
||||
priority mutex test tasks. */
|
||||
|
@ -139,14 +139,14 @@ static TaskHandle_t xHighPriorityMutexTask, xMediumPriorityMutexTask;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartAltGenericQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartAltGenericQueueTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
QueueHandle_t xQueue;
|
||||
SemaphoreHandle_t xMutex;
|
||||
|
||||
/* Create the queue that we are going to use for the
|
||||
prvSendFrontAndBackTest demo. */
|
||||
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -183,7 +183,7 @@ SemaphoreHandle_t xMutex;
|
|||
|
||||
static void prvSendFrontAndBackTest( void *pvParameters )
|
||||
{
|
||||
unsigned long ulData, ulData2;
|
||||
uint32_t ulData, ulData2;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
|
@ -559,9 +559,9 @@ SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreAltGenericQueueTasksStillRunning( void )
|
||||
BaseType_t xAreAltGenericQueueTasksStillRunning( void )
|
||||
{
|
||||
static unsigned long ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
||||
static uint32_t ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
||||
|
||||
/* If the demo task is still running then we expect the loopcounters to
|
||||
have incremented since this function was last called. */
|
||||
|
|
|
@ -118,20 +118,20 @@ static portTASK_FUNCTION_PROTO( vBlockingQueueConsumer, pvParameters );
|
|||
/* Variables which are incremented each time an item is removed from a queue, and
|
||||
found to be the expected value.
|
||||
These are used to check that the tasks are still running. */
|
||||
static volatile short sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
static volatile short sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
|
||||
/* Variable which are incremented each time an item is posted on a queue. These
|
||||
are used to check that the tasks are still running. */
|
||||
static volatile short sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
static volatile short sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartBlockingQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartBlockingQueueTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
xBlockingQueueParameters *pxQueueParameters1, *pxQueueParameters2;
|
||||
xBlockingQueueParameters *pxQueueParameters3, *pxQueueParameters4;
|
||||
xBlockingQueueParameters *pxQueueParameters5, *pxQueueParameters6;
|
||||
const unsigned portBASE_TYPE uxQueueSize1 = 1, uxQueueSize5 = 5;
|
||||
const UBaseType_t uxQueueSize1 = 1, uxQueueSize5 = 5;
|
||||
const TickType_t xBlockTime = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
|
||||
const TickType_t xDontBlock = ( TickType_t ) 0;
|
||||
|
||||
|
@ -142,7 +142,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
|
||||
/* Create the queue used by the first two tasks to pass the incrementing number.
|
||||
Pass a pointer to the queue in the parameter structure. */
|
||||
pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
|
||||
/* The consumer is created first so gets a block time as described above. */
|
||||
pxQueueParameters1->xBlockTime = xBlockTime;
|
||||
|
@ -177,7 +177,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
the same mechanism but reverses the task priorities. */
|
||||
|
||||
pxQueueParameters3 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
||||
pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
pxQueueParameters3->xBlockTime = xDontBlock;
|
||||
pxQueueParameters3->psCheckVariable = &( sBlockingProducerCount[ 1 ] );
|
||||
|
||||
|
@ -194,7 +194,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
/* Create the last two tasks as described above. The mechanism is again just
|
||||
the same. This time both parameter structures are given a block time. */
|
||||
pxQueueParameters5 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
|
||||
pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
pxQueueParameters5->xBlockTime = xBlockTime;
|
||||
pxQueueParameters5->psCheckVariable = &( sBlockingProducerCount[ 2 ] );
|
||||
|
||||
|
@ -210,7 +210,7 @@ const TickType_t xDontBlock = ( TickType_t ) 0;
|
|||
|
||||
static portTASK_FUNCTION( vBlockingQueueProducer, pvParameters )
|
||||
{
|
||||
unsigned short usValue = 0;
|
||||
uint16_t usValue = 0;
|
||||
xBlockingQueueParameters *pxQueueParameters;
|
||||
short sErrorEverOccurred = pdFALSE;
|
||||
|
||||
|
@ -245,7 +245,7 @@ short sErrorEverOccurred = pdFALSE;
|
|||
|
||||
static portTASK_FUNCTION( vBlockingQueueConsumer, pvParameters )
|
||||
{
|
||||
unsigned short usData, usExpectedValue = 0;
|
||||
uint16_t usData, usExpectedValue = 0;
|
||||
xBlockingQueueParameters *pxQueueParameters;
|
||||
short sErrorEverOccurred = pdFALSE;
|
||||
|
||||
|
@ -290,11 +290,11 @@ short sErrorEverOccurred = pdFALSE;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreBlockingQueuesStillRunning( void )
|
||||
BaseType_t xAreBlockingQueuesStillRunning( void )
|
||||
{
|
||||
static short sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
static short sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned short ) 0, ( unsigned short ) 0, ( unsigned short ) 0 };
|
||||
portBASE_TYPE xReturn = pdPASS, xTasks;
|
||||
static short sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
static short sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( uint16_t ) 0, ( uint16_t ) 0, ( uint16_t ) 0 };
|
||||
BaseType_t xReturn = pdPASS, xTasks;
|
||||
|
||||
/* Not too worried about mutual exclusion on these variables as they are 16
|
||||
bits and we are only reading them. We also only care to see if they have
|
||||
|
|
|
@ -188,7 +188,7 @@ static void prvSelectiveBitsTestSlaveFunction( void );
|
|||
|
||||
/* Variables that are incremented by the tasks on each cycle provided no errors
|
||||
have been found. Used to detect an error or stall in the test cycling. */
|
||||
static volatile unsigned long ulTestMasterCycles = 0, ulTestSlaveCycles = 0, ulISRCycles = 0;
|
||||
static volatile uint32_t ulTestMasterCycles = 0, ulTestSlaveCycles = 0, ulISRCycles = 0;
|
||||
|
||||
/* The event group used by all the task based tests. */
|
||||
static EventGroupHandle_t xEventGroup = NULL;
|
||||
|
@ -1045,7 +1045,7 @@ BaseType_t xMessagePosted;
|
|||
/* This is called to check that all the created tasks are still running. */
|
||||
BaseType_t xAreEventGroupTasksStillRunning( void )
|
||||
{
|
||||
static unsigned long ulPreviousWaitBitCycles = 0, ulPreviousSetBitCycles = 0, ulPreviousISRCycles = 0;
|
||||
static uint32_t ulPreviousWaitBitCycles = 0, ulPreviousSetBitCycles = 0, ulPreviousISRCycles = 0;
|
||||
BaseType_t xStatus = pdPASS;
|
||||
|
||||
/* Check the tasks are still cycling without finding any errors. */
|
||||
|
|
|
@ -125,15 +125,15 @@ static void prvHighPriorityMutexTask( void *pvParameters );
|
|||
|
||||
/* Flag that will be latched to pdTRUE should any unexpected behaviour be
|
||||
detected in any of the tasks. */
|
||||
static volatile portBASE_TYPE xErrorDetected = pdFALSE;
|
||||
static volatile BaseType_t xErrorDetected = pdFALSE;
|
||||
|
||||
/* Counters that are incremented on each cycle of a test. This is used to
|
||||
detect a stalled task - a test that is no longer running. */
|
||||
static volatile unsigned long ulLoopCounter = 0;
|
||||
static volatile unsigned long ulLoopCounter2 = 0;
|
||||
static volatile uint32_t ulLoopCounter = 0;
|
||||
static volatile uint32_t ulLoopCounter2 = 0;
|
||||
|
||||
/* The variable that is guarded by the mutex in the mutex demo tasks. */
|
||||
static volatile unsigned long ulGuardedVariable = 0;
|
||||
static volatile uint32_t ulGuardedVariable = 0;
|
||||
|
||||
/* Handles used in the mutext test to suspend and resume the high and medium
|
||||
priority mutex test tasks. */
|
||||
|
@ -141,14 +141,14 @@ static TaskHandle_t xHighPriorityMutexTask, xMediumPriorityMutexTask;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartGenericQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartGenericQueueTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
QueueHandle_t xQueue;
|
||||
SemaphoreHandle_t xMutex;
|
||||
|
||||
/* Create the queue that we are going to use for the
|
||||
prvSendFrontAndBackTest demo. */
|
||||
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -185,7 +185,7 @@ SemaphoreHandle_t xMutex;
|
|||
|
||||
static void prvSendFrontAndBackTest( void *pvParameters )
|
||||
{
|
||||
unsigned long ulData, ulData2;
|
||||
uint32_t ulData, ulData2;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
|
@ -572,9 +572,9 @@ SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreGenericQueueTasksStillRunning( void )
|
||||
BaseType_t xAreGenericQueueTasksStillRunning( void )
|
||||
{
|
||||
static unsigned long ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
||||
static uint32_t ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
||||
|
||||
/* If the demo task is still running then we expect the loopcounters to
|
||||
have incremented since this function was last called. */
|
||||
|
@ -594,7 +594,7 @@ static unsigned long ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
|
|||
/* Errors detected in the task itself will have latched xErrorDetected
|
||||
to true. */
|
||||
|
||||
return ( portBASE_TYPE ) !xErrorDetected;
|
||||
return ( BaseType_t ) !xErrorDetected;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -119,12 +119,12 @@ coverage. */
|
|||
/* Each task and interrupt is given a unique identifier. This value is used to
|
||||
identify which task sent or received each value. The identifier is also used
|
||||
to distinguish between two tasks that are running the same task function. */
|
||||
#define intqHIGH_PRIORITY_TASK1 ( ( unsigned portBASE_TYPE ) 1 )
|
||||
#define intqHIGH_PRIORITY_TASK2 ( ( unsigned portBASE_TYPE ) 2 )
|
||||
#define intqLOW_PRIORITY_TASK ( ( unsigned portBASE_TYPE ) 3 )
|
||||
#define intqFIRST_INTERRUPT ( ( unsigned portBASE_TYPE ) 4 )
|
||||
#define intqSECOND_INTERRUPT ( ( unsigned portBASE_TYPE ) 5 )
|
||||
#define intqQUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 10 )
|
||||
#define intqHIGH_PRIORITY_TASK1 ( ( UBaseType_t ) 1 )
|
||||
#define intqHIGH_PRIORITY_TASK2 ( ( UBaseType_t ) 2 )
|
||||
#define intqLOW_PRIORITY_TASK ( ( UBaseType_t ) 3 )
|
||||
#define intqFIRST_INTERRUPT ( ( UBaseType_t ) 4 )
|
||||
#define intqSECOND_INTERRUPT ( ( UBaseType_t ) 5 )
|
||||
#define intqQUEUE_LENGTH ( ( UBaseType_t ) 10 )
|
||||
|
||||
/* At least intqMIN_ACCEPTABLE_TASK_COUNT values should be sent to/received
|
||||
from each queue by each task, otherwise an error is detected. */
|
||||
|
@ -135,7 +135,7 @@ from within the interrupts. */
|
|||
#define timerNORMALLY_EMPTY_TX() \
|
||||
if( xQueueIsQueueFullFromISR( xNormallyEmptyQueue ) != pdTRUE ) \
|
||||
{ \
|
||||
unsigned portBASE_TYPE uxSavedInterruptStatus; \
|
||||
UBaseType_t uxSavedInterruptStatus; \
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
|
||||
{ \
|
||||
uxValueForNormallyEmptyQueue++; \
|
||||
|
@ -149,7 +149,7 @@ from within the interrupts. */
|
|||
#define timerNORMALLY_FULL_TX() \
|
||||
if( xQueueIsQueueFullFromISR( xNormallyFullQueue ) != pdTRUE ) \
|
||||
{ \
|
||||
unsigned portBASE_TYPE uxSavedInterruptStatus; \
|
||||
UBaseType_t uxSavedInterruptStatus; \
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
|
||||
{ \
|
||||
uxValueForNormallyFullQueue++; \
|
||||
|
@ -185,19 +185,19 @@ an interrupt. */
|
|||
static QueueHandle_t xNormallyEmptyQueue, xNormallyFullQueue;
|
||||
|
||||
/* Variables used to detect a stall in one of the tasks. */
|
||||
static unsigned portBASE_TYPE uxHighPriorityLoops1 = 0, uxHighPriorityLoops2 = 0, uxLowPriorityLoops1 = 0, uxLowPriorityLoops2 = 0;
|
||||
static UBaseType_t uxHighPriorityLoops1 = 0, uxHighPriorityLoops2 = 0, uxLowPriorityLoops1 = 0, uxLowPriorityLoops2 = 0;
|
||||
|
||||
/* Any unexpected behaviour sets xErrorStatus to fail and log the line that
|
||||
caused the error in xErrorLine. */
|
||||
static portBASE_TYPE xErrorStatus = pdPASS;
|
||||
static volatile unsigned portBASE_TYPE xErrorLine = ( unsigned portBASE_TYPE ) 0;
|
||||
static BaseType_t xErrorStatus = pdPASS;
|
||||
static volatile UBaseType_t xErrorLine = ( UBaseType_t ) 0;
|
||||
|
||||
/* Used for sequencing between tasks. */
|
||||
static portBASE_TYPE xWasSuspended = pdFALSE;
|
||||
static BaseType_t xWasSuspended = pdFALSE;
|
||||
|
||||
/* The values that are sent to the queues. An incremented value is sent each
|
||||
time to each queue. */
|
||||
volatile unsigned portBASE_TYPE uxValueForNormallyEmptyQueue = 0, uxValueForNormallyFullQueue = 0;
|
||||
volatile UBaseType_t uxValueForNormallyEmptyQueue = 0, uxValueForNormallyFullQueue = 0;
|
||||
|
||||
/* A handle to some of the tasks is required so they can be suspended/resumed. */
|
||||
TaskHandle_t xHighPriorityNormallyEmptyTask1, xHighPriorityNormallyEmptyTask2, xHighPriorityNormallyFullTask1, xHighPriorityNormallyFullTask2;
|
||||
|
@ -206,8 +206,8 @@ TaskHandle_t xHighPriorityNormallyEmptyTask1, xHighPriorityNormallyEmptyTask2, x
|
|||
the array position of the value is set to a the identifier of the task or
|
||||
interrupt that accessed the queue. This way missing or duplicate values can be
|
||||
detected. */
|
||||
static unsigned char ucNormallyEmptyReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
||||
static unsigned char ucNormallyFullReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
||||
static uint8_t ucNormallyEmptyReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
||||
static uint8_t ucNormallyFullReceivedValues[ intqNUM_VALUES_TO_LOG ] = { 0 };
|
||||
|
||||
/* The test tasks themselves. */
|
||||
static void prvLowerPriorityNormallyEmptyTask( void *pvParameters );
|
||||
|
@ -218,11 +218,11 @@ static void prv2ndHigherPriorityNormallyFullTask( void *pvParameters );
|
|||
|
||||
/* Used to mark the positions within the ucNormallyEmptyReceivedValues and
|
||||
ucNormallyFullReceivedValues arrays, while checking for duplicates. */
|
||||
static void prvRecordValue_NormallyEmpty( unsigned portBASE_TYPE uxValue, unsigned portBASE_TYPE uxSource );
|
||||
static void prvRecordValue_NormallyFull( unsigned portBASE_TYPE uxValue, unsigned portBASE_TYPE uxSource );
|
||||
static void prvRecordValue_NormallyEmpty( UBaseType_t uxValue, UBaseType_t uxSource );
|
||||
static void prvRecordValue_NormallyFull( UBaseType_t uxValue, UBaseType_t uxSource );
|
||||
|
||||
/* Logs the line on which an error occurred. */
|
||||
static void prvQueueAccessLogError( unsigned portBASE_TYPE uxLine );
|
||||
static void prvQueueAccessLogError( UBaseType_t uxLine );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -238,8 +238,8 @@ void vStartInterruptQueueTasks( void )
|
|||
|
||||
/* Create the queues that are accessed by multiple tasks and multiple
|
||||
interrupts. */
|
||||
xNormallyFullQueue = xQueueCreate( intqQUEUE_LENGTH, ( unsigned portBASE_TYPE ) sizeof( unsigned portBASE_TYPE ) );
|
||||
xNormallyEmptyQueue = xQueueCreate( intqQUEUE_LENGTH, ( unsigned portBASE_TYPE ) sizeof( unsigned portBASE_TYPE ) );
|
||||
xNormallyFullQueue = xQueueCreate( intqQUEUE_LENGTH, ( UBaseType_t ) sizeof( UBaseType_t ) );
|
||||
xNormallyEmptyQueue = xQueueCreate( intqQUEUE_LENGTH, ( UBaseType_t ) sizeof( UBaseType_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -252,7 +252,7 @@ void vStartInterruptQueueTasks( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRecordValue_NormallyFull( unsigned portBASE_TYPE uxValue, unsigned portBASE_TYPE uxSource )
|
||||
static void prvRecordValue_NormallyFull( UBaseType_t uxValue, UBaseType_t uxSource )
|
||||
{
|
||||
if( uxValue < intqNUM_VALUES_TO_LOG )
|
||||
{
|
||||
|
@ -264,12 +264,12 @@ static void prvRecordValue_NormallyFull( unsigned portBASE_TYPE uxValue, unsigne
|
|||
}
|
||||
|
||||
/* Log that this value has been received. */
|
||||
ucNormallyFullReceivedValues[ uxValue ] = ( unsigned char ) uxSource;
|
||||
ucNormallyFullReceivedValues[ uxValue ] = ( uint8_t ) uxSource;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRecordValue_NormallyEmpty( unsigned portBASE_TYPE uxValue, unsigned portBASE_TYPE uxSource )
|
||||
static void prvRecordValue_NormallyEmpty( UBaseType_t uxValue, UBaseType_t uxSource )
|
||||
{
|
||||
if( uxValue < intqNUM_VALUES_TO_LOG )
|
||||
{
|
||||
|
@ -281,12 +281,12 @@ static void prvRecordValue_NormallyEmpty( unsigned portBASE_TYPE uxValue, unsign
|
|||
}
|
||||
|
||||
/* Log that this value has been received. */
|
||||
ucNormallyEmptyReceivedValues[ uxValue ] = ( unsigned char ) uxSource;
|
||||
ucNormallyEmptyReceivedValues[ uxValue ] = ( uint8_t ) uxSource;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueAccessLogError( unsigned portBASE_TYPE uxLine )
|
||||
static void prvQueueAccessLogError( UBaseType_t uxLine )
|
||||
{
|
||||
/* Latch the line number that caused the error. */
|
||||
xErrorLine = uxLine;
|
||||
|
@ -296,12 +296,12 @@ static void prvQueueAccessLogError( unsigned portBASE_TYPE uxLine )
|
|||
|
||||
static void prvHigherPriorityNormallyEmptyTask( void *pvParameters )
|
||||
{
|
||||
unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxInterrupts, uxErrorCount1 = 0, uxErrorCount2 = 0;
|
||||
UBaseType_t uxRxed, ux, uxTask1, uxTask2, uxInterrupts, uxErrorCount1 = 0, uxErrorCount2 = 0;
|
||||
|
||||
/* The timer should not be started until after the scheduler has started.
|
||||
More than one task is running this code so we check the parameter value
|
||||
to determine which task should start the timer. */
|
||||
if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )
|
||||
if( ( UBaseType_t ) pvParameters == intqHIGH_PRIORITY_TASK1 )
|
||||
{
|
||||
vInitialiseTimerForIntQueueTest();
|
||||
}
|
||||
|
@ -318,13 +318,13 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxInterrupts, uxErrorCount1
|
|||
{
|
||||
/* Note which value was received so we can check all expected
|
||||
values are received and no values are duplicated. */
|
||||
prvRecordValue_NormallyEmpty( uxRxed, ( unsigned portBASE_TYPE ) pvParameters );
|
||||
prvRecordValue_NormallyEmpty( uxRxed, ( UBaseType_t ) pvParameters );
|
||||
}
|
||||
|
||||
/* Ensure the other task running this code gets a chance to execute. */
|
||||
taskYIELD();
|
||||
|
||||
if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )
|
||||
if( ( UBaseType_t ) pvParameters == intqHIGH_PRIORITY_TASK1 )
|
||||
{
|
||||
/* Have we received all the expected values? */
|
||||
if( uxValueForNormallyEmptyQueue > ( intqNUM_VALUES_TO_LOG + intqVALUE_OVERRUN ) )
|
||||
|
@ -419,7 +419,7 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2, uxInterrupts, uxErrorCount1
|
|||
|
||||
static void prvLowerPriorityNormallyEmptyTask( void *pvParameters )
|
||||
{
|
||||
unsigned portBASE_TYPE uxValue, uxRxed;
|
||||
UBaseType_t uxValue, uxRxed;
|
||||
|
||||
/* The parameters are not being used so avoid compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -467,7 +467,7 @@ unsigned portBASE_TYPE uxValue, uxRxed;
|
|||
|
||||
static void prv1stHigherPriorityNormallyFullTask( void *pvParameters )
|
||||
{
|
||||
unsigned portBASE_TYPE uxValueToTx, ux, uxInterrupts;
|
||||
UBaseType_t uxValueToTx, ux, uxInterrupts;
|
||||
|
||||
/* The parameters are not being used so avoid compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -570,7 +570,7 @@ unsigned portBASE_TYPE uxValueToTx, ux, uxInterrupts;
|
|||
|
||||
static void prv2ndHigherPriorityNormallyFullTask( void *pvParameters )
|
||||
{
|
||||
unsigned portBASE_TYPE uxValueToTx, ux;
|
||||
UBaseType_t uxValueToTx, ux;
|
||||
|
||||
/* The parameters are not being used so avoid compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -616,7 +616,7 @@ unsigned portBASE_TYPE uxValueToTx, ux;
|
|||
|
||||
static void prvLowerPriorityNormallyFullTask( void *pvParameters )
|
||||
{
|
||||
unsigned portBASE_TYPE uxValue, uxTxed = 9999;
|
||||
UBaseType_t uxValue, uxTxed = 9999;
|
||||
|
||||
/* The parameters are not being used so avoid compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -655,18 +655,18 @@ unsigned portBASE_TYPE uxValue, uxTxed = 9999;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xFirstTimerHandler( void )
|
||||
BaseType_t xFirstTimerHandler( void )
|
||||
{
|
||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
unsigned portBASE_TYPE uxRxedValue;
|
||||
static unsigned portBASE_TYPE uxNextOperation = 0;
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
UBaseType_t uxRxedValue;
|
||||
static UBaseType_t uxNextOperation = 0;
|
||||
|
||||
/* Called from a timer interrupt. Perform various read and write
|
||||
accesses on the queues. */
|
||||
|
||||
uxNextOperation++;
|
||||
|
||||
if( uxNextOperation & ( unsigned portBASE_TYPE ) 0x01 )
|
||||
if( uxNextOperation & ( UBaseType_t ) 0x01 )
|
||||
{
|
||||
timerNORMALLY_EMPTY_TX();
|
||||
timerNORMALLY_EMPTY_TX();
|
||||
|
@ -683,18 +683,18 @@ static unsigned portBASE_TYPE uxNextOperation = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xSecondTimerHandler( void )
|
||||
BaseType_t xSecondTimerHandler( void )
|
||||
{
|
||||
unsigned portBASE_TYPE uxRxedValue;
|
||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
static unsigned portBASE_TYPE uxNextOperation = 0;
|
||||
UBaseType_t uxRxedValue;
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
static UBaseType_t uxNextOperation = 0;
|
||||
|
||||
/* Called from a timer interrupt. Perform various read and write
|
||||
accesses on the queues. */
|
||||
|
||||
uxNextOperation++;
|
||||
|
||||
if( uxNextOperation & ( unsigned portBASE_TYPE ) 0x01 )
|
||||
if( uxNextOperation & ( UBaseType_t ) 0x01 )
|
||||
{
|
||||
timerNORMALLY_EMPTY_TX();
|
||||
timerNORMALLY_EMPTY_TX();
|
||||
|
@ -716,9 +716,9 @@ static unsigned portBASE_TYPE uxNextOperation = 0;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
portBASE_TYPE xAreIntQueueTasksStillRunning( void )
|
||||
BaseType_t xAreIntQueueTasksStillRunning( void )
|
||||
{
|
||||
static unsigned portBASE_TYPE uxLastHighPriorityLoops1 = 0, uxLastHighPriorityLoops2 = 0, uxLastLowPriorityLoops1 = 0, uxLastLowPriorityLoops2 = 0;
|
||||
static UBaseType_t uxLastHighPriorityLoops1 = 0, uxLastHighPriorityLoops2 = 0, uxLastLowPriorityLoops1 = 0, uxLastLowPriorityLoops2 = 0;
|
||||
|
||||
/* xErrorStatus can be set outside of this function. This function just
|
||||
checks that all the tasks are still cycling. */
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
Changes from V2.0.0
|
||||
|
||||
+ Delay periods are now specified using variables and constants of
|
||||
TickType_t rather than unsigned long.
|
||||
TickType_t rather than uint32_t.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -108,8 +108,8 @@ Changes from V2.0.0
|
|||
#define pollqPRODUCER_DELAY ( ( TickType_t ) 200 / portTICK_PERIOD_MS )
|
||||
#define pollqCONSUMER_DELAY ( pollqPRODUCER_DELAY - ( TickType_t ) ( 20 / portTICK_PERIOD_MS ) )
|
||||
#define pollqNO_DELAY ( ( TickType_t ) 0 )
|
||||
#define pollqVALUES_TO_PRODUCE ( ( signed portBASE_TYPE ) 3 )
|
||||
#define pollqINITIAL_VALUE ( ( signed portBASE_TYPE ) 0 )
|
||||
#define pollqVALUES_TO_PRODUCE ( ( BaseType_t ) 3 )
|
||||
#define pollqINITIAL_VALUE ( ( BaseType_t ) 0 )
|
||||
|
||||
/* The task that posts the incrementing number onto the queue. */
|
||||
static portTASK_FUNCTION_PROTO( vPolledQueueProducer, pvParameters );
|
||||
|
@ -119,16 +119,16 @@ static portTASK_FUNCTION_PROTO( vPolledQueueConsumer, pvParameters );
|
|||
|
||||
/* Variables that are used to check that the tasks are still running with no
|
||||
errors. */
|
||||
static volatile signed portBASE_TYPE xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
|
||||
static volatile BaseType_t xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartPolledQueueTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
static QueueHandle_t xPolledQueue;
|
||||
|
||||
/* Create the queue used by the producer and consumer. */
|
||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( UBaseType_t ) sizeof( uint16_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -146,8 +146,8 @@ static QueueHandle_t xPolledQueue;
|
|||
|
||||
static portTASK_FUNCTION( vPolledQueueProducer, pvParameters )
|
||||
{
|
||||
unsigned short usValue = ( unsigned short ) 0;
|
||||
signed portBASE_TYPE xError = pdFALSE, xLoop;
|
||||
uint16_t usValue = ( uint16_t ) 0;
|
||||
BaseType_t xError = pdFALSE, xLoop;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -185,8 +185,8 @@ signed portBASE_TYPE xError = pdFALSE, xLoop;
|
|||
|
||||
static portTASK_FUNCTION( vPolledQueueConsumer, pvParameters )
|
||||
{
|
||||
unsigned short usData, usExpectedValue = ( unsigned short ) 0;
|
||||
signed portBASE_TYPE xError = pdFALSE;
|
||||
uint16_t usData, usExpectedValue = ( uint16_t ) 0;
|
||||
BaseType_t xError = pdFALSE;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -230,9 +230,9 @@ signed portBASE_TYPE xError = pdFALSE;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running with no errors. */
|
||||
portBASE_TYPE xArePollingQueuesStillRunning( void )
|
||||
BaseType_t xArePollingQueuesStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Check both the consumer and producer poll count to check they have both
|
||||
been changed since out last trip round. We do not need a critical section
|
||||
|
|
|
@ -106,11 +106,11 @@ static void prvHighestPriorityPeekTask( void *pvParameters );
|
|||
|
||||
/* Flag that will be latched to pdTRUE should any unexpected behaviour be
|
||||
detected in any of the tasks. */
|
||||
static volatile portBASE_TYPE xErrorDetected = pdFALSE;
|
||||
static volatile BaseType_t xErrorDetected = pdFALSE;
|
||||
|
||||
/* Counter that is incremented on each cycle of a test. This is used to
|
||||
detect a stalled task - a test that is no longer running. */
|
||||
static volatile unsigned long ulLoopCounter = 0;
|
||||
static volatile uint32_t ulLoopCounter = 0;
|
||||
|
||||
/* Handles to the test tasks. */
|
||||
TaskHandle_t xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
|
||||
|
@ -121,7 +121,7 @@ void vStartQueuePeekTasks( void )
|
|||
QueueHandle_t xQueue;
|
||||
|
||||
/* Create the queue that we are going to use for the test/demo. */
|
||||
xQueue = xQueueCreate( qpeekQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
xQueue = xQueueCreate( qpeekQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -144,7 +144,7 @@ QueueHandle_t xQueue;
|
|||
static void prvHighestPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
uint32_t ulValue;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ unsigned long ulValue;
|
|||
static void prvHighPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
uint32_t ulValue;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ unsigned long ulValue;
|
|||
static void prvMediumPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
uint32_t ulValue;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -349,7 +349,7 @@ unsigned long ulValue;
|
|||
static void prvLowPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
uint32_t ulValue;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -453,9 +453,9 @@ unsigned long ulValue;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreQueuePeekTasksStillRunning( void )
|
||||
BaseType_t xAreQueuePeekTasksStillRunning( void )
|
||||
{
|
||||
static unsigned long ulLastLoopCounter = 0;
|
||||
static uint32_t ulLastLoopCounter = 0;
|
||||
|
||||
/* If the demo task is still running then we expect the loopcounter to
|
||||
have incremented since this function was last called. */
|
||||
|
@ -469,6 +469,6 @@ static unsigned long ulLastLoopCounter = 0;
|
|||
/* Errors detected in the task itself will have latched xErrorDetected
|
||||
to true. */
|
||||
|
||||
return ( portBASE_TYPE ) !xErrorDetected;
|
||||
return ( BaseType_t ) !xErrorDetected;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,11 +87,11 @@ static void prvQueueOverwriteTask( void *pvParameters );
|
|||
|
||||
/* Variable that is incremented on each loop of prvQueueOverwriteTask() provided
|
||||
prvQueueOverwriteTask() has not found any errors. */
|
||||
static unsigned long ulLoopCounter = 0;
|
||||
static uint32_t ulLoopCounter = 0;
|
||||
|
||||
/* Set to pdFALSE if an error is discovered by the
|
||||
vQueueOverwritePeriodicISRDemo() function. */
|
||||
static portBASE_TYPE xISRTestStatus = pdPASS;
|
||||
static BaseType_t xISRTestStatus = pdPASS;
|
||||
|
||||
/* The queue that is accessed from the ISR. The queue accessed by the task is
|
||||
created inside the task itself. */
|
||||
|
@ -99,13 +99,13 @@ static QueueHandle_t xISRQueue = NULL;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartQueueOverwriteTask( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartQueueOverwriteTask( UBaseType_t uxPriority )
|
||||
{
|
||||
const unsigned portBASE_TYPE uxQueueLength = 1;
|
||||
const UBaseType_t uxQueueLength = 1;
|
||||
|
||||
/* Create the queue used by the ISR. xQueueOverwriteFromISR() should only
|
||||
be used on queues that have a length of 1. */
|
||||
xISRQueue = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( unsigned long ) );
|
||||
xISRQueue = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( uint32_t ) );
|
||||
|
||||
/* Create the test task. The queue used by the test task is created inside
|
||||
the task itself. */
|
||||
|
@ -116,15 +116,15 @@ const unsigned portBASE_TYPE uxQueueLength = 1;
|
|||
static void prvQueueOverwriteTask( void *pvParameters )
|
||||
{
|
||||
QueueHandle_t xTaskQueue;
|
||||
const unsigned portBASE_TYPE uxQueueLength = 1;
|
||||
unsigned long ulValue, ulStatus = pdPASS, x;
|
||||
const UBaseType_t uxQueueLength = 1;
|
||||
uint32_t ulValue, ulStatus = pdPASS, x;
|
||||
|
||||
/* The parameter is not used. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Create the queue. xQueueOverwrite() should only be used on queues that
|
||||
have a length of 1. */
|
||||
xTaskQueue = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( unsigned long ) );
|
||||
xTaskQueue = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( uint32_t ) );
|
||||
configASSERT( xTaskQueue );
|
||||
|
||||
for( ;; )
|
||||
|
@ -186,9 +186,9 @@ unsigned long ulValue, ulStatus = pdPASS, x;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xIsQueueOverwriteTaskStillRunning( void )
|
||||
BaseType_t xIsQueueOverwriteTaskStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
BaseType_t xReturn;
|
||||
|
||||
if( xISRTestStatus != pdPASS )
|
||||
{
|
||||
|
@ -212,9 +212,9 @@ portBASE_TYPE xReturn;
|
|||
|
||||
void vQueueOverwritePeriodicISRDemo( void )
|
||||
{
|
||||
static unsigned long ulCallCount = 0;
|
||||
const unsigned long ulTx1 = 10UL, ulTx2 = 20UL, ulNumberOfSwitchCases = 3UL;
|
||||
unsigned long ulRx;
|
||||
static uint32_t ulCallCount = 0;
|
||||
const uint32_t ulTx1 = 10UL, ulTx2 = 20UL, ulNumberOfSwitchCases = 3UL;
|
||||
uint32_t ulRx;
|
||||
|
||||
/* This function should be called from an interrupt, such as the tick hook
|
||||
function vApplicationTickHook(). */
|
||||
|
|
|
@ -153,7 +153,7 @@ static void prvQueueSetReceivingTask( void *pvParameters );
|
|||
* range of the value being used to distinguish between the two message
|
||||
* sources.
|
||||
*/
|
||||
static void prvCheckReceivedValue( unsigned long ulReceived );
|
||||
static void prvCheckReceivedValue( uint32_t ulReceived );
|
||||
|
||||
/*
|
||||
* For purposes of test coverage, functions that read from and write to a
|
||||
|
@ -172,7 +172,7 @@ static void prvSetupTest( void );
|
|||
* Checks a value received from a queue falls within the range of expected
|
||||
* values.
|
||||
*/
|
||||
static portBASE_TYPE prvCheckReceivedValueWithinExpectedRange( unsigned long ulReceived, unsigned long ulExpectedReceived );
|
||||
static BaseType_t prvCheckReceivedValueWithinExpectedRange( uint32_t ulReceived, uint32_t ulExpectedReceived );
|
||||
|
||||
/*
|
||||
* Increase test coverage by occasionally change the priorities of the two tasks
|
||||
|
@ -183,8 +183,8 @@ static void prvChangeRelativePriorities( void );
|
|||
* Local pseudo random number seed and return functions. Used to avoid calls
|
||||
* to the standard library.
|
||||
*/
|
||||
static unsigned long prvRand( void );
|
||||
static void prvSRand( unsigned long ulSeed );
|
||||
static uint32_t prvRand( void );
|
||||
static void prvSRand( uint32_t ulSeed );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -193,7 +193,7 @@ static QueueHandle_t xQueues[ queuesetNUM_QUEUES_IN_SET ] = { 0 };
|
|||
|
||||
/* Counts how many times each queue in the set is used to ensure all the
|
||||
queues are used. */
|
||||
static unsigned long ulQueueUsedCounter[ queuesetNUM_QUEUES_IN_SET ] = { 0 };
|
||||
static uint32_t ulQueueUsedCounter[ queuesetNUM_QUEUES_IN_SET ] = { 0 };
|
||||
|
||||
/* The handle of the queue set to which the queues are added. */
|
||||
static QueueSetHandle_t xQueueSet;
|
||||
|
@ -203,23 +203,23 @@ it increments ulCycleCounter on each iteration.
|
|||
xAreQueueSetTasksStillRunning() returns pdPASS if the value of
|
||||
ulCycleCounter has changed between consecutive calls, and pdFALSE if
|
||||
ulCycleCounter has stopped incrementing (indicating an error condition). */
|
||||
static volatile unsigned long ulCycleCounter = 0UL;
|
||||
static volatile uint32_t ulCycleCounter = 0UL;
|
||||
|
||||
/* Set to pdFAIL if an error is detected by any queue set task.
|
||||
ulCycleCounter will only be incremented if xQueueSetTasksSatus equals pdPASS. */
|
||||
static volatile portBASE_TYPE xQueueSetTasksStatus = pdPASS;
|
||||
static volatile BaseType_t xQueueSetTasksStatus = pdPASS;
|
||||
|
||||
/* Just a flag to let the function that writes to a queue from an ISR know that
|
||||
the queues are setup and can be used. */
|
||||
static volatile portBASE_TYPE xSetupComplete = pdFALSE;
|
||||
static volatile BaseType_t xSetupComplete = pdFALSE;
|
||||
|
||||
/* The value sent to the queue from the ISR is file scope so the
|
||||
xAreQueeuSetTasksStillRunning() function can check it is incrementing as
|
||||
expected. */
|
||||
static volatile unsigned long ulISRTxValue = queuesetINITIAL_ISR_TX_VALUE;
|
||||
static volatile uint32_t ulISRTxValue = queuesetINITIAL_ISR_TX_VALUE;
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static unsigned long ulNextRand = 0;
|
||||
static uint32_t ulNextRand = 0;
|
||||
|
||||
/* The task handles are stored so their priorities can be changed. */
|
||||
TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask;
|
||||
|
@ -241,11 +241,11 @@ void vStartQueueSetTasks( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreQueueSetTasksStillRunning( void )
|
||||
BaseType_t xAreQueueSetTasksStillRunning( void )
|
||||
{
|
||||
static unsigned long ulLastCycleCounter, ulLastISRTxValue = 0;
|
||||
static unsigned long ulLastQueueUsedCounter[ queuesetNUM_QUEUES_IN_SET ] = { 0 };
|
||||
portBASE_TYPE xReturn = pdPASS, x;
|
||||
static uint32_t ulLastCycleCounter, ulLastISRTxValue = 0;
|
||||
static uint32_t ulLastQueueUsedCounter[ queuesetNUM_QUEUES_IN_SET ] = { 0 };
|
||||
BaseType_t xReturn = pdPASS, x;
|
||||
|
||||
if( ulLastCycleCounter == ulCycleCounter )
|
||||
{
|
||||
|
@ -291,14 +291,14 @@ portBASE_TYPE xReturn = pdPASS, x;
|
|||
|
||||
static void prvQueueSetSendingTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulTaskTxValue = 0, ulQueueToWriteTo;
|
||||
uint32_t ulTaskTxValue = 0, ulQueueToWriteTo;
|
||||
QueueHandle_t xQueueInUse;
|
||||
|
||||
/* Remove compiler warning about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Seed mini pseudo random number generator. */
|
||||
prvSRand( ( unsigned long ) &ulTaskTxValue );
|
||||
prvSRand( ( uint32_t ) &ulTaskTxValue );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ QueueHandle_t xQueueInUse;
|
|||
|
||||
static void prvChangeRelativePriorities( void )
|
||||
{
|
||||
static unsigned portBASE_TYPE ulLoops = 0;
|
||||
static UBaseType_t ulLoops = 0;
|
||||
static eRelativePriorities ePriorities = eEqualPriority;
|
||||
|
||||
/* Occasionally change the task priority relative to the priority of
|
||||
|
@ -389,7 +389,7 @@ static eRelativePriorities ePriorities = eEqualPriority;
|
|||
|
||||
static void prvQueueSetReceivingTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulReceived;
|
||||
uint32_t ulReceived;
|
||||
QueueHandle_t xActivatedQueue;
|
||||
|
||||
/* Remove compiler warnings. */
|
||||
|
@ -440,7 +440,7 @@ QueueHandle_t xActivatedQueue;
|
|||
|
||||
void vQueueSetAccessQueueSetFromISR( void )
|
||||
{
|
||||
static unsigned long ulCallCount = 0;
|
||||
static uint32_t ulCallCount = 0;
|
||||
|
||||
/* xSetupComplete is set to pdTRUE when the queues have been created and
|
||||
are available for use. */
|
||||
|
@ -463,9 +463,9 @@ static unsigned long ulCallCount = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCheckReceivedValue( unsigned long ulReceived )
|
||||
static void prvCheckReceivedValue( uint32_t ulReceived )
|
||||
{
|
||||
static unsigned long ulExpectedReceivedFromTask = 0, ulExpectedReceivedFromISR = queuesetINITIAL_ISR_TX_VALUE;
|
||||
static uint32_t ulExpectedReceivedFromTask = 0, ulExpectedReceivedFromISR = queuesetINITIAL_ISR_TX_VALUE;
|
||||
|
||||
/* Values are received in tasks and interrupts. It is likely that the
|
||||
receiving task will sometimes get preempted by the receiving interrupt
|
||||
|
@ -543,9 +543,9 @@ static unsigned long ulExpectedReceivedFromTask = 0, ulExpectedReceivedFromISR =
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portBASE_TYPE prvCheckReceivedValueWithinExpectedRange( unsigned long ulReceived, unsigned long ulExpectedReceived )
|
||||
static BaseType_t prvCheckReceivedValueWithinExpectedRange( uint32_t ulReceived, uint32_t ulExpectedReceived )
|
||||
{
|
||||
portBASE_TYPE xReturn = pdPASS;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
|
||||
if( ulReceived > ulExpectedReceived )
|
||||
{
|
||||
|
@ -571,7 +571,7 @@ portBASE_TYPE xReturn = pdPASS;
|
|||
static void prvReceiveFromQueueInSetFromISR( void )
|
||||
{
|
||||
QueueSetMemberHandle_t xActivatedQueue;
|
||||
unsigned long ulReceived;
|
||||
uint32_t ulReceived;
|
||||
|
||||
/* See if any of the queues in the set contain data. */
|
||||
xActivatedQueue = xQueueSelectFromSetFromISR( xQueueSet );
|
||||
|
@ -594,7 +594,7 @@ unsigned long ulReceived;
|
|||
|
||||
static void prvSendToQueueInSetFromISR( void )
|
||||
{
|
||||
static portBASE_TYPE xQueueToWriteTo = 0;
|
||||
static BaseType_t xQueueToWriteTo = 0;
|
||||
|
||||
if( xQueueSendFromISR( xQueues[ xQueueToWriteTo ], ( void * ) &ulISRTxValue, NULL ) == pdPASS )
|
||||
{
|
||||
|
@ -619,8 +619,8 @@ static portBASE_TYPE xQueueToWriteTo = 0;
|
|||
|
||||
static void prvSetupTest( void )
|
||||
{
|
||||
portBASE_TYPE x;
|
||||
unsigned long ulValueToSend = 0;
|
||||
BaseType_t x;
|
||||
uint32_t ulValueToSend = 0;
|
||||
|
||||
/* Ensure the queues are created and the queue set configured before the
|
||||
sending task is unsuspended.
|
||||
|
@ -632,8 +632,8 @@ unsigned long ulValueToSend = 0;
|
|||
for( x = 0; x < queuesetNUM_QUEUES_IN_SET; x++ )
|
||||
{
|
||||
/* Create the queue and add it to the set. The queue is just holding
|
||||
unsigned long value. */
|
||||
xQueues[ x ] = xQueueCreate( queuesetQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
uint32_t value. */
|
||||
xQueues[ x ] = xQueueCreate( queuesetQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
configASSERT( xQueues[ x ] );
|
||||
if( xQueueAddToSet( xQueues[ x ], xQueueSet ) != pdPASS )
|
||||
{
|
||||
|
@ -701,14 +701,14 @@ unsigned long ulValueToSend = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static unsigned long prvRand( void )
|
||||
static uint32_t prvRand( void )
|
||||
{
|
||||
ulNextRand = ( ulNextRand * 1103515245UL ) + 12345UL;
|
||||
return ( ulNextRand / 65536UL ) % 32768UL;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( unsigned long ulSeed )
|
||||
static void prvSRand( uint32_t ulSeed )
|
||||
{
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
#define tmrdemoDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( TickType_t ) 3 )
|
||||
#define trmdemoNUM_TIMER_RESETS ( ( unsigned char ) 10 )
|
||||
#define trmdemoNUM_TIMER_RESETS ( ( uint8_t ) 10 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -118,35 +118,35 @@ static void prvResetStartConditionsForNextIteration( void );
|
|||
|
||||
/* Flag that will be latched to pdFAIL should any unexpected behaviour be
|
||||
detected in any of the demo tests. */
|
||||
static volatile portBASE_TYPE xTestStatus = pdPASS;
|
||||
static volatile BaseType_t xTestStatus = pdPASS;
|
||||
|
||||
/* Counter that is incremented on each cycle of a test. This is used to
|
||||
detect a stalled task - a test that is no longer running. */
|
||||
static volatile unsigned long ulLoopCounter = 0;
|
||||
static volatile uint32_t ulLoopCounter = 0;
|
||||
|
||||
/* A set of auto reload timers - each of which use the same callback function.
|
||||
The callback function uses the timer ID to index into, and then increment, a
|
||||
counter in the ucAutoReloadTimerCounters[] array. The auto reload timers
|
||||
referenced from xAutoReloadTimers[] are used by the prvTimerTestTask task. */
|
||||
static TimerHandle_t xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };
|
||||
static unsigned char ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };
|
||||
static uint8_t ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };
|
||||
|
||||
/* The one shot timer is configured to use a callback function that increments
|
||||
ucOneShotTimerCounter each time it gets called. */
|
||||
static TimerHandle_t xOneShotTimer = NULL;
|
||||
static unsigned char ucOneShotTimerCounter = ( unsigned char ) 0;
|
||||
static uint8_t ucOneShotTimerCounter = ( uint8_t ) 0;
|
||||
|
||||
/* The ISR reload timer is controlled from the tick hook to exercise the timer
|
||||
API functions that can be used from an ISR. It is configured to increment
|
||||
ucISRReloadTimerCounter each time its callback function is executed. */
|
||||
static TimerHandle_t xISRAutoReloadTimer = NULL;
|
||||
static unsigned char ucISRAutoReloadTimerCounter = ( unsigned char ) 0;
|
||||
static uint8_t ucISRAutoReloadTimerCounter = ( uint8_t ) 0;
|
||||
|
||||
/* The ISR one shot timer is controlled from the tick hook to exercise the timer
|
||||
API functions that can be used from an ISR. It is configured to increment
|
||||
ucISRReloadTimerCounter each time its callback function is executed. */
|
||||
static TimerHandle_t xISROneShotTimer = NULL;
|
||||
static unsigned char ucISROneShotTimerCounter = ( unsigned char ) 0;
|
||||
static uint8_t ucISROneShotTimerCounter = ( uint8_t ) 0;
|
||||
|
||||
/* The period of all the timers are a multiple of the base period. The base
|
||||
period is configured by the parameter to vStartTimerDemoTask(). */
|
||||
|
@ -226,9 +226,9 @@ static void prvTimerTestTask( void *pvParameters )
|
|||
|
||||
/* This is called to check that the created task is still running and has not
|
||||
detected any errors. */
|
||||
portBASE_TYPE xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency )
|
||||
BaseType_t xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency )
|
||||
{
|
||||
static unsigned long ulLastLoopCounter = 0UL;
|
||||
static uint32_t ulLastLoopCounter = 0UL;
|
||||
TickType_t xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;
|
||||
static TickType_t xIterationsWithoutCounterIncrement = ( TickType_t ) 0, xLastCycleFrequency;
|
||||
|
||||
|
@ -277,7 +277,7 @@ static TickType_t xIterationsWithoutCounterIncrement = ( TickType_t ) 0, xLastCy
|
|||
|
||||
static void prvTest1_CreateTimersWithoutSchedulerRunning( void )
|
||||
{
|
||||
unsigned portBASE_TYPE xTimer;
|
||||
UBaseType_t xTimer;
|
||||
|
||||
for( xTimer = 0; xTimer < configTIMER_QUEUE_LENGTH; xTimer++ )
|
||||
{
|
||||
|
@ -361,7 +361,7 @@ unsigned portBASE_TYPE xTimer;
|
|||
|
||||
static void prvTest2_CheckTaskAndTimersInitialState( void )
|
||||
{
|
||||
unsigned char ucTimer;
|
||||
uint8_t ucTimer;
|
||||
|
||||
/* Ensure all the timers are in their expected initial state. This depends
|
||||
on the timer service task having a higher priority than this task.
|
||||
|
@ -370,7 +370,7 @@ unsigned char ucTimer;
|
|||
and auto reload timer configTIMER_QUEUE_LENGTH should not yet be active (it
|
||||
could not be started prior to the scheduler being started when it was
|
||||
created). */
|
||||
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
{
|
||||
if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ unsigned char ucTimer;
|
|||
|
||||
static void prvTest3_CheckAutoReloadExpireRates( void )
|
||||
{
|
||||
unsigned char ucMaxAllowableValue, ucMinAllowableValue, ucTimer;
|
||||
uint8_t ucMaxAllowableValue, ucMinAllowableValue, ucTimer;
|
||||
TickType_t xBlockPeriod, xTimerPeriod, xExpectedNumber;
|
||||
|
||||
/* Check the auto reload timers expire at the expected rates. */
|
||||
|
@ -402,15 +402,15 @@ TickType_t xBlockPeriod, xTimerPeriod, xExpectedNumber;
|
|||
|
||||
/* Check that all the auto reload timers have called their callback
|
||||
function the expected number of times. */
|
||||
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
{
|
||||
/* The expected number of expiries is equal to the block period divided
|
||||
by the timer period. */
|
||||
xTimerPeriod = ( ( ( TickType_t ) ucTimer + ( TickType_t ) 1 ) * xBasePeriod );
|
||||
xExpectedNumber = xBlockPeriod / xTimerPeriod;
|
||||
|
||||
ucMaxAllowableValue = ( ( unsigned char ) xExpectedNumber ) ;
|
||||
ucMinAllowableValue = ( unsigned char ) ( ( unsigned char ) xExpectedNumber - ( unsigned char ) 1 ); /* Weird casting to try and please all compilers. */
|
||||
ucMaxAllowableValue = ( ( uint8_t ) xExpectedNumber ) ;
|
||||
ucMinAllowableValue = ( uint8_t ) ( ( uint8_t ) xExpectedNumber - ( uint8_t ) 1 ); /* Weird casting to try and please all compilers. */
|
||||
|
||||
if( ( ucAutoReloadTimerCounters[ ucTimer ] < ucMinAllowableValue ) ||
|
||||
( ucAutoReloadTimerCounters[ ucTimer ] > ucMaxAllowableValue )
|
||||
|
@ -432,13 +432,13 @@ TickType_t xBlockPeriod, xTimerPeriod, xExpectedNumber;
|
|||
|
||||
static void prvTest4_CheckAutoReloadTimersCanBeStopped( void )
|
||||
{
|
||||
unsigned char ucTimer;
|
||||
uint8_t ucTimer;
|
||||
|
||||
/* Check the auto reload timers can be stopped correctly, and correctly
|
||||
report their state. */
|
||||
|
||||
/* Stop all the active timers. */
|
||||
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
{
|
||||
/* The timer has not been stopped yet! */
|
||||
if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )
|
||||
|
@ -466,7 +466,7 @@ unsigned char ucTimer;
|
|||
be active. The critical section is used to ensure the timer does
|
||||
not call its callback between the next line running and the array
|
||||
being cleared back to zero, as that would mask an error condition. */
|
||||
if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH ] != ( unsigned char ) 0 )
|
||||
if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH ] != ( uint8_t ) 0 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -480,9 +480,9 @@ unsigned char ucTimer;
|
|||
/* The timers are now all inactive, so this time, after delaying, none
|
||||
of the callback counters should have incremented. */
|
||||
vTaskDelay( ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );
|
||||
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
{
|
||||
if( ucAutoReloadTimerCounters[ ucTimer ] != ( unsigned char ) 0 )
|
||||
if( ucAutoReloadTimerCounters[ ucTimer ] != ( uint8_t ) 0 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -510,7 +510,7 @@ static void prvTest5_CheckBasicOneShotTimerBehaviour( void )
|
|||
configASSERT( xTestStatus );
|
||||
}
|
||||
|
||||
if( ucOneShotTimerCounter != ( unsigned char ) 0 )
|
||||
if( ucOneShotTimerCounter != ( uint8_t ) 0 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -535,7 +535,7 @@ static void prvTest5_CheckBasicOneShotTimerBehaviour( void )
|
|||
configASSERT( xTestStatus );
|
||||
}
|
||||
|
||||
if( ucOneShotTimerCounter != ( unsigned char ) 1 )
|
||||
if( ucOneShotTimerCounter != ( uint8_t ) 1 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -543,7 +543,7 @@ static void prvTest5_CheckBasicOneShotTimerBehaviour( void )
|
|||
else
|
||||
{
|
||||
/* Reset the one shot timer callback count. */
|
||||
ucOneShotTimerCounter = ( unsigned char ) 0;
|
||||
ucOneShotTimerCounter = ( uint8_t ) 0;
|
||||
}
|
||||
|
||||
if( xTestStatus == pdPASS )
|
||||
|
@ -557,7 +557,7 @@ static void prvTest5_CheckBasicOneShotTimerBehaviour( void )
|
|||
|
||||
static void prvTest6_CheckAutoReloadResetBehaviour( void )
|
||||
{
|
||||
unsigned char ucTimer;
|
||||
uint8_t ucTimer;
|
||||
|
||||
/* Check timer reset behaviour. */
|
||||
|
||||
|
@ -593,7 +593,7 @@ unsigned char ucTimer;
|
|||
configASSERT( xTestStatus );
|
||||
}
|
||||
|
||||
if( ucOneShotTimerCounter != ( unsigned char ) 0 )
|
||||
if( ucOneShotTimerCounter != ( uint8_t ) 0 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -605,7 +605,7 @@ unsigned char ucTimer;
|
|||
configASSERT( xTestStatus );
|
||||
}
|
||||
|
||||
if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] != ( unsigned char ) 0 )
|
||||
if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] != ( uint8_t ) 0 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -628,7 +628,7 @@ unsigned char ucTimer;
|
|||
|
||||
/* The timers were not reset during the above delay period so should now
|
||||
both have called their callback functions. */
|
||||
if( ucOneShotTimerCounter != ( unsigned char ) 1 )
|
||||
if( ucOneShotTimerCounter != ( uint8_t ) 1 )
|
||||
{
|
||||
xTestStatus = pdFAIL;
|
||||
configASSERT( xTestStatus );
|
||||
|
@ -665,8 +665,8 @@ unsigned char ucTimer;
|
|||
|
||||
/* Clear the timer callback counts, ready for another iteration of these
|
||||
tests. */
|
||||
ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] = ( unsigned char ) 0;
|
||||
ucOneShotTimerCounter = ( unsigned char ) 0;
|
||||
ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] = ( uint8_t ) 0;
|
||||
ucOneShotTimerCounter = ( uint8_t ) 0;
|
||||
|
||||
if( xTestStatus == pdPASS )
|
||||
{
|
||||
|
@ -679,12 +679,12 @@ unsigned char ucTimer;
|
|||
|
||||
static void prvResetStartConditionsForNextIteration( void )
|
||||
{
|
||||
unsigned char ucTimer;
|
||||
uint8_t ucTimer;
|
||||
|
||||
/* Start the timers again to start all the tests over again. */
|
||||
|
||||
/* Start the timers again. */
|
||||
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
{
|
||||
/* The timer has not been started yet! */
|
||||
if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) != pdFALSE )
|
||||
|
@ -1023,9 +1023,9 @@ static TickType_t uxTick = ( TickType_t ) -1;
|
|||
|
||||
static void prvAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer )
|
||||
{
|
||||
unsigned long ulTimerID;
|
||||
uint32_t ulTimerID;
|
||||
|
||||
ulTimerID = ( unsigned long ) pvTimerGetTimerID( pxExpiredTimer );
|
||||
ulTimerID = ( uint32_t ) pvTimerGetTimerID( pxExpiredTimer );
|
||||
if( ulTimerID <= ( configTIMER_QUEUE_LENGTH + 1 ) )
|
||||
{
|
||||
( ucAutoReloadTimerCounters[ ulTimerID ] )++;
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
#define bktALLOWABLE_MARGIN ( 15 )
|
||||
#define bktTIME_TO_BLOCK ( 175 )
|
||||
#define bktDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
#define bktRUN_INDICATOR ( ( unsigned portBASE_TYPE ) 0x55 )
|
||||
#define bktRUN_INDICATOR ( ( UBaseType_t ) 0x55 )
|
||||
|
||||
/* The queue on which the tasks block. */
|
||||
static QueueHandle_t xTestQueue;
|
||||
|
@ -103,12 +103,12 @@ to vTaskSuspend/Resume(). */
|
|||
static TaskHandle_t xSecondary;
|
||||
|
||||
/* Used to ensure that tasks are still executing without error. */
|
||||
static volatile portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||
static volatile portBASE_TYPE xErrorOccurred = pdFALSE;
|
||||
static volatile BaseType_t xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||
static volatile BaseType_t xErrorOccurred = pdFALSE;
|
||||
|
||||
/* Provides a simple mechanism for the primary task to know when the
|
||||
secondary task has executed. */
|
||||
static volatile unsigned portBASE_TYPE xRunIndicator;
|
||||
static volatile UBaseType_t xRunIndicator;
|
||||
|
||||
/* The two test tasks. Their behaviour is commented within the files. */
|
||||
static void vPrimaryBlockTimeTestTask( void *pvParameters );
|
||||
|
@ -119,7 +119,7 @@ static void vSecondaryBlockTimeTestTask( void *pvParameters );
|
|||
void vCreateBlockTimeTasks( void )
|
||||
{
|
||||
/* Create the queue on which the two tasks block. */
|
||||
xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( portBASE_TYPE ) );
|
||||
xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( BaseType_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -137,7 +137,7 @@ void vCreateBlockTimeTasks( void )
|
|||
|
||||
static void vPrimaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
portBASE_TYPE xItem, xData;
|
||||
BaseType_t xItem, xData;
|
||||
TickType_t xTimeWhenBlocking;
|
||||
TickType_t xTimeToBlock, xBlockedTime;
|
||||
|
||||
|
@ -389,7 +389,7 @@ TickType_t xTimeToBlock, xBlockedTime;
|
|||
static void vSecondaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
TickType_t xTimeWhenBlocking, xBlockedTime;
|
||||
portBASE_TYPE xData;
|
||||
BaseType_t xData;
|
||||
|
||||
( void ) pvParameters;
|
||||
|
||||
|
@ -476,10 +476,10 @@ portBASE_TYPE xData;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreBlockTimeTestTasksStillRunning( void )
|
||||
BaseType_t xAreBlockTimeTestTasksStillRunning( void )
|
||||
{
|
||||
static portBASE_TYPE xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;
|
||||
portBASE_TYPE xReturn = pdPASS;
|
||||
static BaseType_t xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
|
||||
/* Have both tasks performed at least one cycle since this function was
|
||||
last called? */
|
||||
|
|
|
@ -127,7 +127,7 @@ don't have to block to send. */
|
|||
#define comFIRST_BYTE ( 'A' )
|
||||
#define comLAST_BYTE ( 'X' )
|
||||
|
||||
#define comBUFFER_LEN ( ( unsigned portBASE_TYPE ) ( comLAST_BYTE - comFIRST_BYTE ) + ( unsigned portBASE_TYPE ) 1 )
|
||||
#define comBUFFER_LEN ( ( UBaseType_t ) ( comLAST_BYTE - comFIRST_BYTE ) + ( UBaseType_t ) 1 )
|
||||
#define comINITIAL_RX_COUNT_VALUE ( 0 )
|
||||
|
||||
/* Handle to the com port used by both tasks. */
|
||||
|
@ -142,16 +142,16 @@ static portTASK_FUNCTION_PROTO( vComRxTask, pvParameters );
|
|||
/* The LED that should be toggled by the Rx and Tx tasks. The Rx task will
|
||||
toggle LED ( uxBaseLED + comRX_LED_OFFSET). The Tx task will toggle LED
|
||||
( uxBaseLED + comTX_LED_OFFSET ). */
|
||||
static unsigned portBASE_TYPE uxBaseLED = 0;
|
||||
static UBaseType_t uxBaseLED = 0;
|
||||
|
||||
/* Check variable used to ensure no error have occurred. The Rx task will
|
||||
increment this variable after every successfully received sequence. If at any
|
||||
time the sequence is incorrect the the variable will stop being incremented. */
|
||||
static volatile unsigned portBASE_TYPE uxRxLoops = comINITIAL_RX_COUNT_VALUE;
|
||||
static volatile UBaseType_t uxRxLoops = comINITIAL_RX_COUNT_VALUE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED )
|
||||
void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED )
|
||||
{
|
||||
/* Initialise the com port then spawn the Rx and Tx tasks. */
|
||||
uxBaseLED = uxLED;
|
||||
|
@ -208,7 +208,7 @@ TickType_t xTimeToWait;
|
|||
static portTASK_FUNCTION( vComRxTask, pvParameters )
|
||||
{
|
||||
signed char cExpectedByte, cByteRxed;
|
||||
portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;
|
||||
BaseType_t xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;
|
||||
|
||||
/* Just to stop compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -278,9 +278,9 @@ portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;
|
|||
} /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreComTestTasksStillRunning( void )
|
||||
BaseType_t xAreComTestTasksStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* If the count of successful reception loops has not changed than at
|
||||
some time an error occurred (i.e. a character was received out of sequence)
|
||||
|
|
|
@ -152,12 +152,12 @@ static void vComRxTask( void *pvParameters );
|
|||
|
||||
/* The Rx task will toggle LED ( uxBaseLED + comRX_LED_OFFSET). The Tx task
|
||||
will toggle LED ( uxBaseLED + comTX_LED_OFFSET ). */
|
||||
static unsigned portBASE_TYPE uxBaseLED = 0;
|
||||
static UBaseType_t uxBaseLED = 0;
|
||||
|
||||
/* The Rx task toggles uxRxLoops on each successful iteration of its defined
|
||||
function - provided no errors have ever been latched. If this variable stops
|
||||
incrementing, then an error has occurred. */
|
||||
static volatile unsigned portBASE_TYPE uxRxLoops = 0UL;
|
||||
static volatile UBaseType_t uxRxLoops = 0UL;
|
||||
|
||||
/* The timer used to periodically transmit the string. This is the timer that
|
||||
has prvComTxTimerCallback allocated to it as its callback function. */
|
||||
|
@ -169,7 +169,7 @@ static size_t xStringLength = 0U;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartComTestStringsTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED )
|
||||
void vStartComTestStringsTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED )
|
||||
{
|
||||
/* Store values that are used at run time. */
|
||||
uxBaseLED = uxLED;
|
||||
|
@ -232,7 +232,7 @@ TickType_t xTimeToWait;
|
|||
|
||||
static void vComRxTask( void *pvParameters )
|
||||
{
|
||||
portBASE_TYPE xState = comtstWAITING_START_OF_STRING, xErrorOccurred = pdFALSE;
|
||||
BaseType_t xState = comtstWAITING_START_OF_STRING, xErrorOccurred = pdFALSE;
|
||||
char *pcExpectedByte, cRxedChar;
|
||||
const xComPortHandle xPort = NULL;
|
||||
|
||||
|
@ -324,9 +324,9 @@ const xComPortHandle xPort = NULL;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreComTestTasksStillRunning( void )
|
||||
BaseType_t xAreComTestTasksStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* If the count of successful reception loops has not changed than at
|
||||
some time an error occurred (i.e. a character was received out of sequence)
|
||||
|
|
|
@ -95,7 +95,7 @@ count value set to the maximum, and one with the count value set to zero. */
|
|||
|
||||
/* Flag that will be latched to pdTRUE should any unexpected behaviour be
|
||||
detected in any of the tasks. */
|
||||
static volatile portBASE_TYPE xErrorDetected = pdFALSE;
|
||||
static volatile BaseType_t xErrorDetected = pdFALSE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -111,13 +111,13 @@ static void prvCountingSemaphoreTask( void *pvParameters );
|
|||
* Utility function to increment the semaphore count value up from zero to
|
||||
* countMAX_COUNT_VALUE.
|
||||
*/
|
||||
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
|
||||
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter );
|
||||
|
||||
/*
|
||||
* Utility function to decrement the semaphore count value up from
|
||||
* countMAX_COUNT_VALUE to zero.
|
||||
*/
|
||||
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
|
||||
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -130,11 +130,11 @@ typedef struct COUNT_SEM_STRUCT
|
|||
/* Set to countSTART_AT_MAX_COUNT if the semaphore should be created with
|
||||
its count value set to its max count value, or countSTART_AT_ZERO if it
|
||||
should have been created with its count value set to 0. */
|
||||
unsigned portBASE_TYPE uxExpectedStartCount;
|
||||
UBaseType_t uxExpectedStartCount;
|
||||
|
||||
/* Incremented on each cycle of the demo task. Used to detect a stalled
|
||||
task. */
|
||||
unsigned portBASE_TYPE uxLoopCounter;
|
||||
UBaseType_t uxLoopCounter;
|
||||
} xCountSemStruct;
|
||||
|
||||
/* Two structures are defined, one is passed to each test task. */
|
||||
|
@ -175,9 +175,9 @@ void vStartCountingSemaphoreTasks( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
|
||||
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter )
|
||||
{
|
||||
unsigned portBASE_TYPE ux;
|
||||
UBaseType_t ux;
|
||||
|
||||
/* If the semaphore count is at its maximum then we should not be able to
|
||||
'give' the semaphore. */
|
||||
|
@ -211,9 +211,9 @@ unsigned portBASE_TYPE ux;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
|
||||
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, UBaseType_t *puxLoopCounter )
|
||||
{
|
||||
unsigned portBASE_TYPE ux;
|
||||
UBaseType_t ux;
|
||||
|
||||
/* If the semaphore count is zero then we should not be able to 'take'
|
||||
the semaphore. */
|
||||
|
@ -285,10 +285,10 @@ xCountSemStruct *pxParameter;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreCountingSemaphoreTasksStillRunning( void )
|
||||
BaseType_t xAreCountingSemaphoreTasksStillRunning( void )
|
||||
{
|
||||
static unsigned portBASE_TYPE uxLastCount0 = 0, uxLastCount1 = 0;
|
||||
portBASE_TYPE xReturn = pdPASS;
|
||||
static UBaseType_t uxLastCount0 = 0, uxLastCount1 = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
|
||||
/* Return fail if any 'give' or 'take' did not result in the expected
|
||||
behaviour. */
|
||||
|
|
|
@ -118,28 +118,28 @@ created. */
|
|||
/*
|
||||
* The 'fixed delay' co-routine as described at the top of the file.
|
||||
*/
|
||||
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex );
|
||||
|
||||
/*
|
||||
* The 'flash' co-routine as described at the top of the file.
|
||||
*/
|
||||
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex );
|
||||
|
||||
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
||||
'flash' co-routine. */
|
||||
static QueueHandle_t xFlashQueue;
|
||||
|
||||
/* This will be set to pdFALSE if we detect an error. */
|
||||
static portBASE_TYPE xCoRoutineFlashStatus = pdPASS;
|
||||
static BaseType_t xCoRoutineFlashStatus = pdPASS;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* See the header file for details.
|
||||
*/
|
||||
void vStartFlashCoRoutines( unsigned portBASE_TYPE uxNumberToCreate )
|
||||
void vStartFlashCoRoutines( UBaseType_t uxNumberToCreate )
|
||||
{
|
||||
unsigned portBASE_TYPE uxIndex;
|
||||
UBaseType_t uxIndex;
|
||||
|
||||
if( uxNumberToCreate > crfMAX_FLASH_TASKS )
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ unsigned portBASE_TYPE uxIndex;
|
|||
}
|
||||
|
||||
/* Create the queue used to pass data between the co-routines. */
|
||||
xFlashQueue = xQueueCreate( crfQUEUE_LENGTH, sizeof( unsigned portBASE_TYPE ) );
|
||||
xFlashQueue = xQueueCreate( crfQUEUE_LENGTH, sizeof( UBaseType_t ) );
|
||||
|
||||
if( xFlashQueue )
|
||||
{
|
||||
|
@ -163,11 +163,11 @@ unsigned portBASE_TYPE uxIndex;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
/* Even though this is a co-routine the xResult variable does not need to be
|
||||
static as we do not need it to maintain its state between blocks. */
|
||||
signed portBASE_TYPE xResult;
|
||||
BaseType_t xResult;
|
||||
/* The uxIndex parameter of the co-routine function is used as an index into
|
||||
the xFlashRates array to obtain the delay period to use. */
|
||||
static const TickType_t xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_PERIOD_MS,
|
||||
|
@ -204,12 +204,12 @@ static const TickType_t xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_PER
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
/* Even though this is a co-routine the variable do not need to be
|
||||
static as we do not need it to maintain their state between blocks. */
|
||||
signed portBASE_TYPE xResult;
|
||||
unsigned portBASE_TYPE uxLEDToFlash;
|
||||
BaseType_t xResult;
|
||||
UBaseType_t uxLEDToFlash;
|
||||
|
||||
/* Co-routines MUST start with a call to crSTART. */
|
||||
crSTART( xHandle );
|
||||
|
@ -237,7 +237,7 @@ unsigned portBASE_TYPE uxLEDToFlash;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreFlashCoRoutinesStillRunning( void )
|
||||
BaseType_t xAreFlashCoRoutinesStillRunning( void )
|
||||
{
|
||||
/* Return pdPASS or pdFAIL depending on whether an error has been detected
|
||||
or not. */
|
||||
|
|
|
@ -115,7 +115,7 @@ posted to the 'hook' co-routines. */
|
|||
/*
|
||||
* The co-routine function itself.
|
||||
*/
|
||||
static void prvHookCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
|
||||
static void prvHookCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex );
|
||||
|
||||
|
||||
/*
|
||||
|
@ -138,20 +138,20 @@ The hood function transmits (Tx's) on these queues. One queue per
|
|||
static QueueHandle_t xHookTxQueues[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
|
||||
/* Set to true if an error is detected at any time. */
|
||||
static portBASE_TYPE xCoRoutineErrorDetected = pdFALSE;
|
||||
static BaseType_t xCoRoutineErrorDetected = pdFALSE;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartHookCoRoutines( void )
|
||||
{
|
||||
unsigned portBASE_TYPE uxIndex, uxValueToPost = 0;
|
||||
UBaseType_t uxIndex, uxValueToPost = 0;
|
||||
|
||||
for( uxIndex = 0; uxIndex < hookNUM_HOOK_CO_ROUTINES; uxIndex++ )
|
||||
{
|
||||
/* Create a queue to transmit to and receive from each 'hook'
|
||||
co-routine. */
|
||||
xHookRxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( unsigned portBASE_TYPE ) );
|
||||
xHookTxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( unsigned portBASE_TYPE ) );
|
||||
xHookRxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( UBaseType_t ) );
|
||||
xHookTxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( UBaseType_t ) );
|
||||
|
||||
/* To start things off the tick hook function expects the queue it
|
||||
uses to receive data to contain a value. */
|
||||
|
@ -163,11 +163,11 @@ unsigned portBASE_TYPE uxIndex, uxValueToPost = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static unsigned portBASE_TYPE uxCallCounter = 0, uxNumberToPost = 0;
|
||||
static UBaseType_t uxCallCounter = 0, uxNumberToPost = 0;
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
unsigned portBASE_TYPE uxReceivedNumber;
|
||||
signed portBASE_TYPE xIndex, xCoRoutineWoken;
|
||||
UBaseType_t uxReceivedNumber;
|
||||
BaseType_t xIndex, xCoRoutineWoken;
|
||||
|
||||
/* Is it time to talk to the 'hook' co-routines again? */
|
||||
uxCallCounter++;
|
||||
|
@ -217,10 +217,10 @@ signed portBASE_TYPE xIndex, xCoRoutineWoken;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvHookCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
|
||||
static void prvHookCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||
{
|
||||
static unsigned portBASE_TYPE uxReceivedValue[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
portBASE_TYPE xResult;
|
||||
static UBaseType_t uxReceivedValue[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
BaseType_t xResult;
|
||||
|
||||
/* Each co-routine MUST start with a call to crSTART(); */
|
||||
crSTART( xHandle );
|
||||
|
@ -254,7 +254,7 @@ portBASE_TYPE xResult;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portBASE_TYPE xAreHookCoRoutinesStillRunning( void )
|
||||
BaseType_t xAreHookCoRoutinesStillRunning( void )
|
||||
{
|
||||
if( xCoRoutineErrorDetected )
|
||||
{
|
||||
|
|
|
@ -103,17 +103,17 @@ static portTASK_FUNCTION_PROTO( vSuicidalTask, pvParameters );
|
|||
|
||||
/* A variable which is incremented every time the dynamic tasks are created. This
|
||||
is used to check that the task is still running. */
|
||||
static volatile unsigned short usCreationCount = 0;
|
||||
static volatile uint16_t usCreationCount = 0;
|
||||
|
||||
/* Used to store the number of tasks that were originally running so the creator
|
||||
task can tell if any of the suicidal tasks have failed to die.
|
||||
*/
|
||||
static volatile unsigned portBASE_TYPE uxTasksRunningAtStart = 0;
|
||||
static volatile UBaseType_t uxTasksRunningAtStart = 0;
|
||||
|
||||
/* Tasks are deleted by the idle task. Under heavy load the idle task might
|
||||
not get much processing time, so it would be legitimate for several tasks to
|
||||
remain undeleted for a short period. */
|
||||
static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 3;
|
||||
static const UBaseType_t uxMaxNumberOfExtraTasksRunning = 3;
|
||||
|
||||
/* Used to store a handle to the task that should be killed by a suicidal task,
|
||||
before it kills itself. */
|
||||
|
@ -121,20 +121,20 @@ TaskHandle_t xCreatedTask;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vCreateSuicidalTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vCreateSuicidalTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
unsigned portBASE_TYPE *puxPriority;
|
||||
UBaseType_t *puxPriority;
|
||||
|
||||
/* Create the Creator tasks - passing in as a parameter the priority at which
|
||||
the suicidal tasks should be created. */
|
||||
puxPriority = ( unsigned portBASE_TYPE * ) pvPortMalloc( sizeof( unsigned portBASE_TYPE ) );
|
||||
puxPriority = ( UBaseType_t * ) pvPortMalloc( sizeof( UBaseType_t ) );
|
||||
*puxPriority = uxPriority;
|
||||
|
||||
xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) puxPriority, uxPriority, NULL );
|
||||
|
||||
/* Record the number of tasks that are running now so we know if any of the
|
||||
suicidal tasks have failed to be killed. */
|
||||
uxTasksRunningAtStart = ( unsigned portBASE_TYPE ) uxTaskGetNumberOfTasks();
|
||||
uxTasksRunningAtStart = ( UBaseType_t ) uxTaskGetNumberOfTasks();
|
||||
|
||||
/* FreeRTOS.org versions before V3.0 started the idle-task as the very
|
||||
first task. The idle task was then already included in uxTasksRunningAtStart.
|
||||
|
@ -196,9 +196,9 @@ const TickType_t xDelay = ( TickType_t ) 200 / portTICK_PERIOD_MS;
|
|||
static portTASK_FUNCTION( vCreateTasks, pvParameters )
|
||||
{
|
||||
const TickType_t xDelay = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
|
||||
unsigned portBASE_TYPE uxPriority;
|
||||
UBaseType_t uxPriority;
|
||||
|
||||
uxPriority = *( unsigned portBASE_TYPE * ) pvParameters;
|
||||
uxPriority = *( UBaseType_t * ) pvParameters;
|
||||
vPortFree( pvParameters );
|
||||
|
||||
for( ;; )
|
||||
|
@ -218,11 +218,11 @@ unsigned portBASE_TYPE uxPriority;
|
|||
|
||||
/* This is called to check that the creator task is still running and that there
|
||||
are not any more than four extra tasks. */
|
||||
portBASE_TYPE xIsCreateTaskStillRunning( void )
|
||||
BaseType_t xIsCreateTaskStillRunning( void )
|
||||
{
|
||||
static unsigned short usLastCreationCount = 0xfff;
|
||||
portBASE_TYPE xReturn = pdTRUE;
|
||||
static unsigned portBASE_TYPE uxTasksRunningNow;
|
||||
static uint16_t usLastCreationCount = 0xfff;
|
||||
BaseType_t xReturn = pdTRUE;
|
||||
static UBaseType_t uxTasksRunningNow;
|
||||
|
||||
if( usLastCreationCount == usCreationCount )
|
||||
{
|
||||
|
@ -233,7 +233,7 @@ static unsigned portBASE_TYPE uxTasksRunningNow;
|
|||
usLastCreationCount = usCreationCount;
|
||||
}
|
||||
|
||||
uxTasksRunningNow = ( unsigned portBASE_TYPE ) uxTaskGetNumberOfTasks();
|
||||
uxTasksRunningNow = ( UBaseType_t ) uxTaskGetNumberOfTasks();
|
||||
|
||||
if( uxTasksRunningNow < uxTasksRunningAtStart )
|
||||
{
|
||||
|
|
|
@ -146,7 +146,7 @@ static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters );
|
|||
#define priSTACK_SIZE ( configMINIMAL_STACK_SIZE )
|
||||
#define priSLEEP_TIME ( ( TickType_t ) 128 / portTICK_PERIOD_MS )
|
||||
#define priLOOPS ( 5 )
|
||||
#define priMAX_COUNT ( ( unsigned long ) 0xff )
|
||||
#define priMAX_COUNT ( ( uint32_t ) 0xff )
|
||||
#define priNO_BLOCK ( ( TickType_t ) 0 )
|
||||
#define priSUSPENDED_QUEUE_LENGTH ( 1 )
|
||||
|
||||
|
@ -158,15 +158,15 @@ static TaskHandle_t xContinuousIncrementHandle, xLimitedIncrementHandle;
|
|||
|
||||
/* The shared counter variable. This is passed in as a parameter to the two
|
||||
counter variables for demonstration purposes. */
|
||||
static volatile unsigned long ulCounter;
|
||||
static volatile uint32_t ulCounter;
|
||||
|
||||
/* Variables used to check that the tasks are still operating without error.
|
||||
Each complete iteration of the controller task increments this variable
|
||||
provided no errors have been found. The variable maintaining the same value
|
||||
is therefore indication of an error. */
|
||||
static volatile unsigned short usCheckVariable = ( unsigned short ) 0;
|
||||
static volatile portBASE_TYPE xSuspendedQueueSendError = pdFALSE;
|
||||
static volatile portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
|
||||
static volatile uint16_t usCheckVariable = ( uint16_t ) 0;
|
||||
static volatile BaseType_t xSuspendedQueueSendError = pdFALSE;
|
||||
static volatile BaseType_t xSuspendedQueueReceiveError = pdFALSE;
|
||||
|
||||
/* Queue used by the second test. */
|
||||
QueueHandle_t xSuspendedTestQueue;
|
||||
|
@ -174,7 +174,7 @@ QueueHandle_t xSuspendedTestQueue;
|
|||
/* The value the queue receive task expects to receive next. This is file
|
||||
scope so xAreDynamicPriorityTasksStillRunning() can ensure it is still
|
||||
incrementing. */
|
||||
static unsigned long ulExpectedValue = ( unsigned long ) 0;
|
||||
static uint32_t ulExpectedValue = ( uint32_t ) 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/*
|
||||
|
@ -183,7 +183,7 @@ static unsigned long ulExpectedValue = ( unsigned long ) 0;
|
|||
*/
|
||||
void vStartDynamicPriorityTasks( void )
|
||||
{
|
||||
xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
|
||||
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||
in use. The queue registry is provided as a means for kernel aware
|
||||
|
@ -207,11 +207,11 @@ void vStartDynamicPriorityTasks( void )
|
|||
*/
|
||||
static portTASK_FUNCTION( vLimitedIncrementTask, pvParameters )
|
||||
{
|
||||
unsigned long *pulCounter;
|
||||
uint32_t *pulCounter;
|
||||
|
||||
/* Take a pointer to the shared variable from the parameters passed into
|
||||
the task. */
|
||||
pulCounter = ( unsigned long * ) pvParameters;
|
||||
pulCounter = ( uint32_t * ) pvParameters;
|
||||
|
||||
/* This will run before the control task, so the first thing it does is
|
||||
suspend - the control task will resume it when ready. */
|
||||
|
@ -236,12 +236,12 @@ unsigned long *pulCounter;
|
|||
*/
|
||||
static portTASK_FUNCTION( vContinuousIncrementTask, pvParameters )
|
||||
{
|
||||
volatile unsigned long *pulCounter;
|
||||
unsigned portBASE_TYPE uxOurPriority;
|
||||
volatile uint32_t *pulCounter;
|
||||
UBaseType_t uxOurPriority;
|
||||
|
||||
/* Take a pointer to the shared variable from the parameters passed into
|
||||
the task. */
|
||||
pulCounter = ( unsigned long * ) pvParameters;
|
||||
pulCounter = ( uint32_t * ) pvParameters;
|
||||
|
||||
/* Query our priority so we can raise it when exclusive access to the
|
||||
shared variable is required. */
|
||||
|
@ -272,7 +272,7 @@ unsigned portBASE_TYPE uxOurPriority;
|
|||
*/
|
||||
static portTASK_FUNCTION( vCounterControlTask, pvParameters )
|
||||
{
|
||||
unsigned long ulLastCounter;
|
||||
uint32_t ulLastCounter;
|
||||
short sLoops;
|
||||
short sError = pdFALSE;
|
||||
|
||||
|
@ -282,7 +282,7 @@ short sError = pdFALSE;
|
|||
for( ;; )
|
||||
{
|
||||
/* Start with the counter at zero. */
|
||||
ulCounter = ( unsigned long ) 0;
|
||||
ulCounter = ( uint32_t ) 0;
|
||||
|
||||
/* First section : */
|
||||
|
||||
|
@ -340,7 +340,7 @@ short sError = pdFALSE;
|
|||
vTaskSuspend( xContinuousIncrementHandle );
|
||||
|
||||
/* Reset the variable. */
|
||||
ulCounter = ( unsigned long ) 0;
|
||||
ulCounter = ( uint32_t ) 0;
|
||||
|
||||
#if( INCLUDE_eTaskGetState == 1 )
|
||||
{
|
||||
|
@ -391,7 +391,7 @@ short sError = pdFALSE;
|
|||
|
||||
static portTASK_FUNCTION( vQueueSendWhenSuspendedTask, pvParameters )
|
||||
{
|
||||
static unsigned long ulValueToSend = ( unsigned long ) 0;
|
||||
static uint32_t ulValueToSend = ( uint32_t ) 0;
|
||||
|
||||
/* Just to stop warning messages. */
|
||||
( void ) pvParameters;
|
||||
|
@ -417,8 +417,8 @@ static unsigned long ulValueToSend = ( unsigned long ) 0;
|
|||
|
||||
static portTASK_FUNCTION( vQueueReceiveWhenSuspendedTask, pvParameters )
|
||||
{
|
||||
unsigned long ulReceivedValue;
|
||||
portBASE_TYPE xGotValue;
|
||||
uint32_t ulReceivedValue;
|
||||
BaseType_t xGotValue;
|
||||
|
||||
/* Just to stop warning messages. */
|
||||
( void ) pvParameters;
|
||||
|
@ -470,13 +470,13 @@ portBASE_TYPE xGotValue;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Called to check that all the created tasks are still running without error. */
|
||||
portBASE_TYPE xAreDynamicPriorityTasksStillRunning( void )
|
||||
BaseType_t xAreDynamicPriorityTasksStillRunning( void )
|
||||
{
|
||||
/* Keep a history of the check variables so we know if it has been incremented
|
||||
since the last call. */
|
||||
static unsigned short usLastTaskCheck = ( unsigned short ) 0;
|
||||
static unsigned long ulLastExpectedValue = ( unsigned long ) 0U;
|
||||
portBASE_TYPE xReturn = pdTRUE;
|
||||
static uint16_t usLastTaskCheck = ( uint16_t ) 0;
|
||||
static uint32_t ulLastExpectedValue = ( uint32_t ) 0U;
|
||||
BaseType_t xReturn = pdTRUE;
|
||||
|
||||
/* Check the tasks are still running by ensuring the check variable
|
||||
is still incrementing. */
|
||||
|
|
|
@ -93,16 +93,16 @@
|
|||
|
||||
/* Variable used by the created tasks to calculate the LED number to use, and
|
||||
the rate at which they should flash the LED. */
|
||||
static volatile unsigned portBASE_TYPE uxFlashTaskNumber = 0;
|
||||
static volatile UBaseType_t uxFlashTaskNumber = 0;
|
||||
|
||||
/* The task that is created three times. */
|
||||
static portTASK_FUNCTION_PROTO( vLEDFlashTask, pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartLEDFlashTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
signed portBASE_TYPE xLEDTask;
|
||||
BaseType_t xLEDTask;
|
||||
|
||||
/* Create the three tasks. */
|
||||
for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
|
||||
|
@ -116,7 +116,7 @@ signed portBASE_TYPE xLEDTask;
|
|||
static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
|
||||
{
|
||||
TickType_t xFlashRate, xLastFlashTime;
|
||||
unsigned portBASE_TYPE uxLED;
|
||||
UBaseType_t uxLED;
|
||||
|
||||
/* The parameters are not used. */
|
||||
( void ) pvParameters;
|
||||
|
|
|
@ -93,9 +93,9 @@ static void prvLEDTimerCallback( TimerHandle_t xTimer );
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartLEDFlashTimers( unsigned portBASE_TYPE uxNumberOfLEDs )
|
||||
void vStartLEDFlashTimers( UBaseType_t uxNumberOfLEDs )
|
||||
{
|
||||
unsigned portBASE_TYPE uxLEDTimer;
|
||||
UBaseType_t uxLEDTimer;
|
||||
TimerHandle_t xTimer;
|
||||
|
||||
/* Create and start the requested number of timers. */
|
||||
|
@ -124,12 +124,12 @@ TimerHandle_t xTimer;
|
|||
|
||||
static void prvLEDTimerCallback( TimerHandle_t xTimer )
|
||||
{
|
||||
portBASE_TYPE xTimerID;
|
||||
BaseType_t xTimerID;
|
||||
|
||||
/* The timer ID is used to identify the timer that has actually expired as
|
||||
each timer uses the same callback. The ID is then also used as the number
|
||||
of the LED that is to be toggled. */
|
||||
xTimerID = ( portBASE_TYPE ) pvTimerGetTimerID( xTimer );
|
||||
xTimerID = ( BaseType_t ) pvTimerGetTimerID( xTimer );
|
||||
vParTestToggleLED( xTimerID );
|
||||
}
|
||||
|
||||
|
|
|
@ -98,11 +98,11 @@ static portTASK_FUNCTION_PROTO( vCompetingMathTask4, pvParameters );
|
|||
|
||||
/* These variables are used to check that all the tasks are still running. If a
|
||||
task gets a calculation wrong it will stop setting its check variable. */
|
||||
static volatile unsigned short usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };
|
||||
static volatile uint16_t usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( uint16_t ) 0 };
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartMathTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartMathTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
xTaskCreate( vCompetingMathTask1, "Math1", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 0 ] ), uxPriority, NULL );
|
||||
xTaskCreate( vCompetingMathTask2, "Math2", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 1 ] ), uxPriority, NULL );
|
||||
|
@ -114,7 +114,7 @@ void vStartMathTasks( unsigned portBASE_TYPE uxPriority )
|
|||
static portTASK_FUNCTION( vCompetingMathTask1, pvParameters )
|
||||
{
|
||||
volatile portDOUBLE d1, d2, d3, d4;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
volatile portDOUBLE dAnswer;
|
||||
short sError = pdFALSE;
|
||||
|
||||
|
@ -131,7 +131,7 @@ short sError = pdFALSE;
|
|||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
/* Keep performing a calculation and checking the result against a constant. */
|
||||
for(;;)
|
||||
|
@ -172,7 +172,7 @@ short sError = pdFALSE;
|
|||
static portTASK_FUNCTION( vCompetingMathTask2, pvParameters )
|
||||
{
|
||||
volatile portDOUBLE d1, d2, d3, d4;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
volatile portDOUBLE dAnswer;
|
||||
short sError = pdFALSE;
|
||||
|
||||
|
@ -190,7 +190,7 @@ short sError = pdFALSE;
|
|||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
/* Keep performing a calculation and checking the result against a constant. */
|
||||
for( ;; )
|
||||
|
@ -230,7 +230,7 @@ short sError = pdFALSE;
|
|||
static portTASK_FUNCTION( vCompetingMathTask3, pvParameters )
|
||||
{
|
||||
volatile portDOUBLE *pdArray, dTotal1, dTotal2, dDifference;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
const size_t xArraySize = 10;
|
||||
size_t xPosition;
|
||||
short sError = pdFALSE;
|
||||
|
@ -242,7 +242,7 @@ short sError = pdFALSE;
|
|||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
|
||||
|
||||
|
@ -293,7 +293,7 @@ short sError = pdFALSE;
|
|||
static portTASK_FUNCTION( vCompetingMathTask4, pvParameters )
|
||||
{
|
||||
volatile portDOUBLE *pdArray, dTotal1, dTotal2, dDifference;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
const size_t xArraySize = 10;
|
||||
size_t xPosition;
|
||||
short sError = pdFALSE;
|
||||
|
@ -305,7 +305,7 @@ short sError = pdFALSE;
|
|||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
|
||||
|
||||
|
@ -354,9 +354,9 @@ short sError = pdFALSE;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreMathsTaskStillRunning( void )
|
||||
BaseType_t xAreMathsTaskStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn = pdPASS, xTask;
|
||||
BaseType_t xReturn = pdPASS, xTask;
|
||||
|
||||
/* Check the maths tasks are still running by ensuring their check variables
|
||||
have been set to pdPASS. */
|
||||
|
|
|
@ -100,11 +100,11 @@ static portTASK_FUNCTION_PROTO( vCompeteingIntMathTask, pvParameters );
|
|||
that the task is still executing. The check task sets the variable back to
|
||||
false, flagging an error if the variable is still false the next time it
|
||||
is called. */
|
||||
static volatile signed portBASE_TYPE xTaskCheck[ intgNUMBER_OF_TASKS ] = { ( signed portBASE_TYPE ) pdFALSE };
|
||||
static volatile BaseType_t xTaskCheck[ intgNUMBER_OF_TASKS ] = { ( BaseType_t ) pdFALSE };
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartIntegerMathTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartIntegerMathTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
short sTask;
|
||||
|
||||
|
@ -121,12 +121,12 @@ static portTASK_FUNCTION( vCompeteingIntMathTask, pvParameters )
|
|||
ensure the compiler does not just get rid of them. */
|
||||
volatile long lValue;
|
||||
short sError = pdFALSE;
|
||||
volatile signed portBASE_TYPE *pxTaskHasExecuted;
|
||||
volatile BaseType_t *pxTaskHasExecuted;
|
||||
|
||||
/* Set a pointer to the variable we are going to set to true each
|
||||
iteration. This is also a good test of the parameter passing mechanism
|
||||
within each port. */
|
||||
pxTaskHasExecuted = ( volatile signed portBASE_TYPE * ) pvParameters;
|
||||
pxTaskHasExecuted = ( volatile BaseType_t * ) pvParameters;
|
||||
|
||||
/* Keep performing a calculation and checking the result against a constant. */
|
||||
for( ;; )
|
||||
|
@ -176,9 +176,9 @@ volatile signed portBASE_TYPE *pxTaskHasExecuted;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreIntegerMathsTaskStillRunning( void )
|
||||
BaseType_t xAreIntegerMathsTaskStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn = pdTRUE;
|
||||
BaseType_t xReturn = pdTRUE;
|
||||
short sTask;
|
||||
|
||||
/* Check the maths tasks are still running by ensuring their check variables
|
||||
|
|
|
@ -132,8 +132,8 @@ static void prvRecursiveMutexPollingTask( void *pvParameters );
|
|||
static SemaphoreHandle_t xMutex;
|
||||
|
||||
/* Variables used to detect and latch errors. */
|
||||
static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;
|
||||
static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles = 0, uxPollingCycles = 0;
|
||||
static volatile BaseType_t xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;
|
||||
static volatile UBaseType_t uxControllingCycles = 0, uxBlockingCycles = 0, uxPollingCycles = 0;
|
||||
|
||||
/* Handles of the two higher priority tasks, required so they can be resumed
|
||||
(unsuspended). */
|
||||
|
@ -167,7 +167,7 @@ void vStartRecursiveMutexTasks( void )
|
|||
|
||||
static void prvRecursiveMutexControllingTask( void *pvParameters )
|
||||
{
|
||||
unsigned portBASE_TYPE ux;
|
||||
UBaseType_t ux;
|
||||
|
||||
/* Just to remove compiler warning. */
|
||||
( void ) pvParameters;
|
||||
|
@ -388,10 +388,10 @@ static void prvRecursiveMutexPollingTask( void *pvParameters )
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void )
|
||||
BaseType_t xAreRecursiveMutexTasksStillRunning( void )
|
||||
{
|
||||
portBASE_TYPE xReturn;
|
||||
static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;
|
||||
BaseType_t xReturn;
|
||||
static UBaseType_t uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;
|
||||
|
||||
/* Is the controlling task still cycling? */
|
||||
if( uxLastControllingCycles == uxControllingCycles )
|
||||
|
|
|
@ -98,8 +98,8 @@
|
|||
#include "semtest.h"
|
||||
|
||||
/* The value to which the shared variables are counted. */
|
||||
#define semtstBLOCKING_EXPECTED_VALUE ( ( unsigned long ) 0xfff )
|
||||
#define semtstNON_BLOCKING_EXPECTED_VALUE ( ( unsigned long ) 0xff )
|
||||
#define semtstBLOCKING_EXPECTED_VALUE ( ( uint32_t ) 0xfff )
|
||||
#define semtstNON_BLOCKING_EXPECTED_VALUE ( ( uint32_t ) 0xff )
|
||||
|
||||
#define semtstSTACK_SIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
|
@ -114,7 +114,7 @@ static portTASK_FUNCTION_PROTO( prvSemaphoreTest, pvParameters );
|
|||
typedef struct SEMAPHORE_PARAMETERS
|
||||
{
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
volatile unsigned long *pulSharedVariable;
|
||||
volatile uint32_t *pulSharedVariable;
|
||||
TickType_t xBlockTime;
|
||||
} xSemaphoreParameters;
|
||||
|
||||
|
@ -124,7 +124,7 @@ static volatile short sNextCheckVariable = 0;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartSemaphoreTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartSemaphoreTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
xSemaphoreParameters *pxFirstSemaphoreParameters, *pxSecondSemaphoreParameters;
|
||||
const TickType_t xBlockTime = ( TickType_t ) 100;
|
||||
|
@ -141,7 +141,7 @@ const TickType_t xBlockTime = ( TickType_t ) 100;
|
|||
if( pxFirstSemaphoreParameters->xSemaphore != NULL )
|
||||
{
|
||||
/* Create the variable which is to be shared by the first two tasks. */
|
||||
pxFirstSemaphoreParameters->pulSharedVariable = ( unsigned long * ) pvPortMalloc( sizeof( unsigned long ) );
|
||||
pxFirstSemaphoreParameters->pulSharedVariable = ( uint32_t * ) pvPortMalloc( sizeof( uint32_t ) );
|
||||
|
||||
/* Initialise the share variable to the value the tasks expect. */
|
||||
*( pxFirstSemaphoreParameters->pulSharedVariable ) = semtstNON_BLOCKING_EXPECTED_VALUE;
|
||||
|
@ -165,7 +165,7 @@ const TickType_t xBlockTime = ( TickType_t ) 100;
|
|||
|
||||
if( pxSecondSemaphoreParameters->xSemaphore != NULL )
|
||||
{
|
||||
pxSecondSemaphoreParameters->pulSharedVariable = ( unsigned long * ) pvPortMalloc( sizeof( unsigned long ) );
|
||||
pxSecondSemaphoreParameters->pulSharedVariable = ( uint32_t * ) pvPortMalloc( sizeof( uint32_t ) );
|
||||
*( pxSecondSemaphoreParameters->pulSharedVariable ) = semtstBLOCKING_EXPECTED_VALUE;
|
||||
pxSecondSemaphoreParameters->xBlockTime = xBlockTime / portTICK_PERIOD_MS;
|
||||
|
||||
|
@ -188,8 +188,8 @@ const TickType_t xBlockTime = ( TickType_t ) 100;
|
|||
static portTASK_FUNCTION( prvSemaphoreTest, pvParameters )
|
||||
{
|
||||
xSemaphoreParameters *pxParameters;
|
||||
volatile unsigned long *pulSharedVariable, ulExpectedValue;
|
||||
unsigned long ulCounter;
|
||||
volatile uint32_t *pulSharedVariable, ulExpectedValue;
|
||||
uint32_t ulCounter;
|
||||
short sError = pdFALSE, sCheckVariableToUse;
|
||||
|
||||
/* See which check variable to use. sNextCheckVariable is not semaphore
|
||||
|
@ -231,7 +231,7 @@ short sError = pdFALSE, sCheckVariableToUse;
|
|||
/* Clear the variable, then count it back up to the expected value
|
||||
before releasing the semaphore. Would expect a context switch or
|
||||
two during this time. */
|
||||
for( ulCounter = ( unsigned long ) 0; ulCounter <= ulExpectedValue; ulCounter++ )
|
||||
for( ulCounter = ( uint32_t ) 0; ulCounter <= ulExpectedValue; ulCounter++ )
|
||||
{
|
||||
*pulSharedVariable = ulCounter;
|
||||
if( *pulSharedVariable != ulCounter )
|
||||
|
@ -277,10 +277,10 @@ short sError = pdFALSE, sCheckVariableToUse;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreSemaphoreTasksStillRunning( void )
|
||||
BaseType_t xAreSemaphoreTasksStillRunning( void )
|
||||
{
|
||||
static short sLastCheckVariables[ semtstNUM_TASKS ] = { 0 };
|
||||
portBASE_TYPE xTask, xReturn = pdTRUE;
|
||||
BaseType_t xTask, xReturn = pdTRUE;
|
||||
|
||||
for( xTask = 0; xTask < semtstNUM_TASKS; xTask++ )
|
||||
{
|
||||
|
|
|
@ -99,11 +99,11 @@ static portTASK_FUNCTION_PROTO( vCompetingMathTask4, pvParameters );
|
|||
/* These variables are used to check that all the tasks are still running. If a
|
||||
task gets a calculation wrong it will
|
||||
stop incrementing its check variable. */
|
||||
static volatile unsigned short usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };
|
||||
static volatile uint16_t usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( uint16_t ) 0 };
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartMathTasks( unsigned portBASE_TYPE uxPriority )
|
||||
void vStartMathTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
xTaskCreate( vCompetingMathTask1, "Math1", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 0 ] ), uxPriority, NULL );
|
||||
xTaskCreate( vCompetingMathTask2, "Math2", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 1 ] ), uxPriority, NULL );
|
||||
|
@ -119,7 +119,7 @@ void vStartMathTasks( unsigned portBASE_TYPE uxPriority )
|
|||
static portTASK_FUNCTION( vCompetingMathTask1, pvParameters )
|
||||
{
|
||||
volatile float f1, f2, f3, f4;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
volatile float fAnswer;
|
||||
short sError = pdFALSE;
|
||||
|
||||
|
@ -131,7 +131,7 @@ short sError = pdFALSE;
|
|||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
/* Keep performing a calculation and checking the result against a constant. */
|
||||
for(;;)
|
||||
|
@ -171,7 +171,7 @@ short sError = pdFALSE;
|
|||
static portTASK_FUNCTION( vCompetingMathTask2, pvParameters )
|
||||
{
|
||||
volatile float f1, f2, f3, f4;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
volatile float fAnswer;
|
||||
short sError = pdFALSE;
|
||||
|
||||
|
@ -184,7 +184,7 @@ short sError = pdFALSE;
|
|||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
/* Keep performing a calculation and checking the result against a constant. */
|
||||
for( ;; )
|
||||
|
@ -224,14 +224,14 @@ short sError = pdFALSE;
|
|||
static portTASK_FUNCTION( vCompetingMathTask3, pvParameters )
|
||||
{
|
||||
volatile float *pfArray, fTotal1, fTotal2, fDifference, fPosition;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
const size_t xArraySize = 10;
|
||||
size_t xPosition;
|
||||
short sError = pdFALSE;
|
||||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
pfArray = ( float * ) pvPortMalloc( xArraySize * sizeof( float ) );
|
||||
|
||||
|
@ -282,14 +282,14 @@ short sError = pdFALSE;
|
|||
static portTASK_FUNCTION( vCompetingMathTask4, pvParameters )
|
||||
{
|
||||
volatile float *pfArray, fTotal1, fTotal2, fDifference, fPosition;
|
||||
volatile unsigned short *pusTaskCheckVariable;
|
||||
volatile uint16_t *pusTaskCheckVariable;
|
||||
const size_t xArraySize = 10;
|
||||
size_t xPosition;
|
||||
short sError = pdFALSE;
|
||||
|
||||
/* The variable this task increments to show it is still running is passed in
|
||||
as the parameter. */
|
||||
pusTaskCheckVariable = ( unsigned short * ) pvParameters;
|
||||
pusTaskCheckVariable = ( uint16_t * ) pvParameters;
|
||||
|
||||
pfArray = ( float * ) pvPortMalloc( xArraySize * sizeof( float ) );
|
||||
|
||||
|
@ -338,12 +338,12 @@ short sError = pdFALSE;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that all the created tasks are still running. */
|
||||
portBASE_TYPE xAreMathsTaskStillRunning( void )
|
||||
BaseType_t xAreMathsTaskStillRunning( void )
|
||||
{
|
||||
/* Keep a history of the check variables so we know if they have been incremented
|
||||
since the last call. */
|
||||
static unsigned short usLastTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };
|
||||
portBASE_TYPE xReturn = pdTRUE, xTask;
|
||||
static uint16_t usLastTaskCheck[ mathNUMBER_OF_TASKS ] = { ( uint16_t ) 0 };
|
||||
BaseType_t xReturn = pdTRUE, xTask;
|
||||
|
||||
/* Check the maths tasks are still running by ensuring their check variables
|
||||
are still incrementing. */
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef ALT_BLOCK_Q_H
|
||||
#define ALT_BLOCK_Q_H
|
||||
|
||||
void vStartAltBlockingQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreAltBlockingQueuesStillRunning( void );
|
||||
void vStartAltBlockingQueueTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreAltBlockingQueuesStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define FAST_BLOCK_TIME_TEST_H
|
||||
|
||||
void vCreateAltBlockTimeTasks( void );
|
||||
portBASE_TYPE xAreAltBlockTimeTestTasksStillRunning( void );
|
||||
BaseType_t xAreAltBlockTimeTestTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef ALT_POLLED_Q_H
|
||||
#define ALT_POLLED_Q_H
|
||||
|
||||
void vStartAltPolledQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreAltPollingQueuesStillRunning( void );
|
||||
void vStartAltPolledQueueTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreAltPollingQueuesStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef FAST_GEN_Q_TEST_H
|
||||
#define FAST_GEN_Q_TEST_H
|
||||
|
||||
void vStartAltGenericQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreAltGenericQueueTasksStillRunning( void );
|
||||
void vStartAltGenericQueueTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreAltGenericQueueTasksStillRunning( void );
|
||||
|
||||
#endif /* GEN_Q_TEST_H */
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef BLOCK_Q_H
|
||||
#define BLOCK_Q_H
|
||||
|
||||
void vStartBlockingQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreBlockingQueuesStillRunning( void );
|
||||
void vStartBlockingQueueTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreBlockingQueuesStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
#define EVENT_GROUPS_DEMO_H
|
||||
|
||||
void vStartEventGroupTasks( void );
|
||||
portBASE_TYPE xAreEventGroupTasksStillRunning( void );
|
||||
BaseType_t xAreEventGroupTasksStillRunning( void );
|
||||
void vPeriodicEventGroupsProcessing( void );
|
||||
|
||||
#endif /* EVENT_GROUPS_DEMO_H */
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef GEN_Q_TEST_H
|
||||
#define GEN_Q_TEST_H
|
||||
|
||||
void vStartGenericQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreGenericQueueTasksStillRunning( void );
|
||||
void vStartGenericQueueTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreGenericQueueTasksStillRunning( void );
|
||||
|
||||
#endif /* GEN_Q_TEST_H */
|
||||
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
#define QUEUE_ACCESS_TEST
|
||||
|
||||
void vStartInterruptQueueTasks( void );
|
||||
portBASE_TYPE xAreIntQueueTasksStillRunning( void );
|
||||
portBASE_TYPE xFirstTimerHandler( void );
|
||||
portBASE_TYPE xSecondTimerHandler( void );
|
||||
BaseType_t xAreIntQueueTasksStillRunning( void );
|
||||
BaseType_t xFirstTimerHandler( void );
|
||||
BaseType_t xSecondTimerHandler( void );
|
||||
|
||||
#endif /* QUEUE_ACCESS_TEST */
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef POLLED_Q_H
|
||||
#define POLLED_Q_H
|
||||
|
||||
void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xArePollingQueuesStillRunning( void );
|
||||
void vStartPolledQueueTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xArePollingQueuesStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define Q_PEEK_TEST_H
|
||||
|
||||
void vStartQueuePeekTasks( void );
|
||||
portBASE_TYPE xAreQueuePeekTasksStillRunning( void );
|
||||
BaseType_t xAreQueuePeekTasksStillRunning( void );
|
||||
|
||||
#endif /* Q_PEEK_TEST_H */
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef QUEUE_OVERWRITE_H
|
||||
#define QUEUE_OVERWRITE_H
|
||||
|
||||
void vStartQueueOverwriteTask( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xIsQueueOverwriteTaskStillRunning( void );
|
||||
void vStartQueueOverwriteTask( UBaseType_t uxPriority );
|
||||
BaseType_t xIsQueueOverwriteTaskStillRunning( void );
|
||||
void vQueueOverwritePeriodicISRDemo( void );
|
||||
|
||||
#endif /* QUEUE_OVERWRITE_H */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define QUEUE_WAIT_MULTIPLE_H
|
||||
|
||||
void vStartQueueSetTasks( void );
|
||||
portBASE_TYPE xAreQueueSetTasksStillRunning( void );
|
||||
BaseType_t xAreQueueSetTasksStillRunning( void );
|
||||
void vQueueSetAccessQueueSetFromISR( void );
|
||||
|
||||
#endif /* QUEUE_WAIT_MULTIPLE_H */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define TIMER_DEMO_H
|
||||
|
||||
void vStartTimerDemoTask( TickType_t xBaseFrequencyIn );
|
||||
portBASE_TYPE xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency );
|
||||
BaseType_t xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency );
|
||||
void vTimerPeriodicISRTests( void );
|
||||
|
||||
#endif /* TIMER_DEMO_H */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define BLOCK_TIME_TEST_H
|
||||
|
||||
void vCreateBlockTimeTasks( void );
|
||||
portBASE_TYPE xAreBlockTimeTestTasksStillRunning( void );
|
||||
BaseType_t xAreBlockTimeTestTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@
|
|||
#ifndef COMTEST_H
|
||||
#define COMTEST_H
|
||||
|
||||
void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED );
|
||||
void vStartComTestTasks( unsigned portBASE_TYPE uxPriority, eCOMPort ePort, eBaud eBaudRate );
|
||||
portBASE_TYPE xAreComTestTasksStillRunning( void );
|
||||
void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED );
|
||||
void vStartComTestTasks( UBaseType_t uxPriority, eCOMPort ePort, eBaud eBaudRate );
|
||||
BaseType_t xAreComTestTasksStillRunning( void );
|
||||
void vComTestUnsuspendTask( void );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef COMTEST_H
|
||||
#define COMTEST_H
|
||||
|
||||
void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED );
|
||||
portBASE_TYPE xAreComTestTasksStillRunning( void );
|
||||
void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED );
|
||||
BaseType_t xAreComTestTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef COMTEST_STRINGS_H
|
||||
#define COMTEST_STRINGS_H
|
||||
|
||||
void vStartComTestStringsTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED );
|
||||
portBASE_TYPE xAreComTestTasksStillRunning( void );
|
||||
void vStartComTestStringsTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED );
|
||||
BaseType_t xAreComTestTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define COUNT_SEMAPHORE_TEST_H
|
||||
|
||||
void vStartCountingSemaphoreTasks( void );
|
||||
portBASE_TYPE xAreCountingSemaphoreTasksStillRunning( void );
|
||||
BaseType_t xAreCountingSemaphoreTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -73,13 +73,13 @@
|
|||
* also effects the number of LED's that will be utilised. For example,
|
||||
* passing in 3 will cause LED's 0 to 2 to be utilised.
|
||||
*/
|
||||
void vStartFlashCoRoutines( unsigned portBASE_TYPE uxPriority );
|
||||
void vStartFlashCoRoutines( UBaseType_t uxPriority );
|
||||
|
||||
/*
|
||||
* Return pdPASS or pdFAIL depending on whether an error has been detected
|
||||
* or not.
|
||||
*/
|
||||
portBASE_TYPE xAreFlashCoRoutinesStillRunning( void );
|
||||
BaseType_t xAreFlashCoRoutinesStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ void vStartHookCoRoutines( void );
|
|||
* Return pdPASS or pdFAIL depending on whether an error has been detected
|
||||
* or not.
|
||||
*/
|
||||
portBASE_TYPE xAreHookCoRoutinesStillRunning( void );
|
||||
BaseType_t xAreHookCoRoutinesStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef SUICIDE_TASK_H
|
||||
#define SUICIDE_TASK_H
|
||||
|
||||
void vCreateSuicidalTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xIsCreateTaskStillRunning( void );
|
||||
void vCreateSuicidalTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xIsCreateTaskStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define DYNAMIC_MANIPULATION_H
|
||||
|
||||
void vStartDynamicPriorityTasks( void );
|
||||
portBASE_TYPE xAreDynamicPriorityTasksStillRunning( void );
|
||||
BaseType_t xAreDynamicPriorityTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
void vDisplayMessage( const char * const pcMessageToPrint );
|
||||
void vWriteMessageToDisk( const char * const pcMessage );
|
||||
void vWriteBufferToDisk( const char * const pcBuffer, unsigned long ulBufferLength );
|
||||
void vWriteBufferToDisk( const char * const pcBuffer, uint32_t ulBufferLength );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#ifndef FLASH_LED_H
|
||||
#define FLASH_LED_H
|
||||
|
||||
void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority );
|
||||
void vStartLEDFlashTasks( UBaseType_t uxPriority );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -74,6 +74,6 @@
|
|||
* within the callback function to determine which timer has actually expired
|
||||
* (and therefore which LED to toggle).
|
||||
*/
|
||||
void vStartLEDFlashTimers( unsigned portBASE_TYPE uxNumberOfLEDs );
|
||||
void vStartLEDFlashTimers( UBaseType_t uxNumberOfLEDs );
|
||||
|
||||
#endif /* FLASH_TIMER_H */
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef FLOP_TASKS_H
|
||||
#define FLOP_TASKS_H
|
||||
|
||||
void vStartMathTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreMathsTaskStillRunning( void );
|
||||
void vStartMathTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreMathsTaskStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef INTEGER_TASKS_H
|
||||
#define INTEGER_TASKS_H
|
||||
|
||||
void vStartIntegerMathTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreIntegerMathsTaskStillRunning( void );
|
||||
void vStartIntegerMathTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreIntegerMathsTaskStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define EVENTS_TEST_H
|
||||
|
||||
void vStartMultiEventTasks( void );
|
||||
portBASE_TYPE xAreMultiEventTasksStillRunning( void );
|
||||
BaseType_t xAreMultiEventTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,11 +66,11 @@
|
|||
#ifndef PARTEST_H
|
||||
#define PARTEST_H
|
||||
|
||||
#define partstDEFAULT_PORT_ADDRESS ( ( unsigned short ) 0x378 )
|
||||
#define partstDEFAULT_PORT_ADDRESS ( ( uint16_t ) 0x378 )
|
||||
|
||||
void vParTestInitialise( void );
|
||||
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue );
|
||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED );
|
||||
void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue );
|
||||
void vParTestToggleLED( UBaseType_t uxLED );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define RECURSIVE_MUTEX_TEST_H
|
||||
|
||||
void vStartRecursiveMutexTasks( void );
|
||||
portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void );
|
||||
BaseType_t xAreRecursiveMutexTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#ifndef SEMAPHORE_TEST_H
|
||||
#define SEMAPHORE_TEST_H
|
||||
|
||||
void vStartSemaphoreTasks( unsigned portBASE_TYPE uxPriority );
|
||||
portBASE_TYPE xAreSemaphoreTasksStillRunning( void );
|
||||
void vStartSemaphoreTasks( UBaseType_t uxPriority );
|
||||
BaseType_t xAreSemaphoreTasksStillRunning( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -124,12 +124,12 @@ typedef enum
|
|||
ser115200
|
||||
} eBaud;
|
||||
|
||||
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength );
|
||||
xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );
|
||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength );
|
||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime );
|
||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime );
|
||||
portBASE_TYPE xSerialWaitForSemaphore( xComPortHandle xPort );
|
||||
xComPortHandle xSerialPortInitMinimal( uint32_t ulWantedBaud, UBaseType_t uxQueueLength );
|
||||
xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, UBaseType_t uxBufferLength );
|
||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, uint16_t usStringLength );
|
||||
BaseType_t xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime );
|
||||
BaseType_t xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime );
|
||||
BaseType_t xSerialWaitForSemaphore( xComPortHandle xPort );
|
||||
void vSerialClose( xComPortHandle xPort );
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue