mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 17:48:33 -04:00
Update the demo directory to use the version 8 type naming conventions.
This commit is contained in:
parent
c6d8892b0d
commit
5a2a8fc319
639 changed files with 3127 additions and 3470 deletions
|
@ -106,8 +106,8 @@
|
|||
/* Structure used to pass parameters to the blocking queue tasks. */
|
||||
typedef struct BLOCKING_QUEUE_PARAMETERS
|
||||
{
|
||||
xQueueHandle xQueue; /*< The queue to be used by the task. */
|
||||
portTickType xBlockTime; /*< The block time to use on queue reads/writes. */
|
||||
QueueHandle_t xQueue; /*< The queue to be used by the task. */
|
||||
TickType_t xBlockTime; /*< The block time to use on queue reads/writes. */
|
||||
volatile short *psCheckVariable; /*< Incremented on each successful cycle to check the task is still running. */
|
||||
} xBlockingQueueParameters;
|
||||
|
||||
|
@ -135,8 +135,8 @@ xBlockingQueueParameters *pxQueueParameters1, *pxQueueParameters2;
|
|||
xBlockingQueueParameters *pxQueueParameters3, *pxQueueParameters4;
|
||||
xBlockingQueueParameters *pxQueueParameters5, *pxQueueParameters6;
|
||||
const unsigned portBASE_TYPE uxQueueSize1 = 1, uxQueueSize5 = 5;
|
||||
const portTickType xBlockTime = ( portTickType ) 1000 / portTICK_RATE_MS;
|
||||
const portTickType xDontBlock = ( portTickType ) 0;
|
||||
const TickType_t xBlockTime = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
|
||||
const TickType_t xDontBlock = ( TickType_t ) 0;
|
||||
|
||||
/* Create the first two tasks as described at the top of the file. */
|
||||
|
||||
|
|
|
@ -85,19 +85,19 @@
|
|||
|
||||
/* Task behaviour. */
|
||||
#define bktQUEUE_LENGTH ( 5 )
|
||||
#define bktSHORT_WAIT ( ( ( portTickType ) 20 ) / portTICK_RATE_MS )
|
||||
#define bktSHORT_WAIT ( ( ( TickType_t ) 20 ) / portTICK_PERIOD_MS )
|
||||
#define bktPRIMARY_BLOCK_TIME ( 10 )
|
||||
#define bktALLOWABLE_MARGIN ( 12 )
|
||||
#define bktTIME_TO_BLOCK ( 175 )
|
||||
#define bktDONT_BLOCK ( ( portTickType ) 0 )
|
||||
#define bktDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
#define bktRUN_INDICATOR ( ( unsigned portBASE_TYPE ) 0x55 )
|
||||
|
||||
/* The queue on which the tasks block. */
|
||||
static xQueueHandle xTestQueue;
|
||||
static QueueHandle_t xTestQueue;
|
||||
|
||||
/* Handle to the secondary task is required by the primary task for calls
|
||||
to vTaskSuspend/Resume(). */
|
||||
static xTaskHandle xSecondary;
|
||||
static TaskHandle_t xSecondary;
|
||||
|
||||
/* Used to ensure that tasks are still executing without error. */
|
||||
static portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||
|
@ -136,8 +136,8 @@ void vCreateAltBlockTimeTasks( void )
|
|||
static void vPrimaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
portBASE_TYPE xItem, xData;
|
||||
portTickType xTimeWhenBlocking;
|
||||
portTickType xTimeToBlock, xBlockedTime;
|
||||
TickType_t xTimeWhenBlocking;
|
||||
TickType_t xTimeToBlock, xBlockedTime;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -415,7 +415,7 @@ portTickType xTimeToBlock, xBlockedTime;
|
|||
|
||||
static void vSecondaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
portTickType xTimeWhenBlocking, xBlockedTime;
|
||||
TickType_t xTimeWhenBlocking, xBlockedTime;
|
||||
portBASE_TYPE xData;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
Changes from V2.0.0
|
||||
|
||||
+ Delay periods are now specified using variables and constants of
|
||||
portTickType rather than unsigned long.
|
||||
TickType_t rather than unsigned long.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -103,9 +103,9 @@ Changes from V2.0.0
|
|||
|
||||
#define pollqSTACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define pollqQUEUE_SIZE ( 10 )
|
||||
#define pollqPRODUCER_DELAY ( ( portTickType ) 200 / portTICK_RATE_MS )
|
||||
#define pollqCONSUMER_DELAY ( pollqPRODUCER_DELAY - ( portTickType ) ( 20 / portTICK_RATE_MS ) )
|
||||
#define pollqNO_DELAY ( ( portTickType ) 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 )
|
||||
|
||||
|
@ -123,7 +123,7 @@ static volatile signed portBASE_TYPE xPollingConsumerCount = pollqINITIAL_VALUE,
|
|||
|
||||
void vStartAltPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
{
|
||||
static xQueueHandle xPolledQueue;
|
||||
static QueueHandle_t xPolledQueue;
|
||||
|
||||
/* Create the queue used by the producer and consumer. */
|
||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
|
@ -138,8 +138,8 @@ static xQueueHandle xPolledQueue;
|
|||
|
||||
|
||||
/* Spawn the producer and consumer. */
|
||||
xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -162,7 +162,7 @@ signed portBASE_TYPE xError = pdFALSE, xLoop;
|
|||
for( xLoop = 0; xLoop < pollqVALUES_TO_PRODUCE; xLoop++ )
|
||||
{
|
||||
/* Send an incrementing number on the queue without blocking. */
|
||||
if( xQueueAltSendToBack( *( ( xQueueHandle * ) pvParameters ), ( void * ) &usValue, pollqNO_DELAY ) != pdPASS )
|
||||
if( xQueueAltSendToBack( *( ( QueueHandle_t * ) pvParameters ), ( void * ) &usValue, pollqNO_DELAY ) != pdPASS )
|
||||
{
|
||||
/* We should never find the queue full so if we get here there
|
||||
has been an error. */
|
||||
|
@ -208,9 +208,9 @@ signed portBASE_TYPE xError = pdFALSE;
|
|||
for( ;; )
|
||||
{
|
||||
/* Loop until the queue is empty. */
|
||||
while( uxQueueMessagesWaiting( *( ( xQueueHandle * ) pvParameters ) ) )
|
||||
while( uxQueueMessagesWaiting( *( ( QueueHandle_t * ) pvParameters ) ) )
|
||||
{
|
||||
if( xQueueAltReceive( *( ( xQueueHandle * ) pvParameters ), &usData, pollqNO_DELAY ) == pdPASS )
|
||||
if( xQueueAltReceive( *( ( QueueHandle_t * ) pvParameters ), &usData, pollqNO_DELAY ) == pdPASS )
|
||||
{
|
||||
if( usData != usExpectedValue )
|
||||
{
|
||||
|
|
|
@ -135,14 +135,14 @@ static volatile unsigned long ulGuardedVariable = 0;
|
|||
|
||||
/* Handles used in the mutext test to suspend and resume the high and medium
|
||||
priority mutex test tasks. */
|
||||
static xTaskHandle xHighPriorityMutexTask, xMediumPriorityMutexTask;
|
||||
static TaskHandle_t xHighPriorityMutexTask, xMediumPriorityMutexTask;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartAltGenericQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
{
|
||||
xQueueHandle xQueue;
|
||||
xSemaphoreHandle xMutex;
|
||||
QueueHandle_t xQueue;
|
||||
SemaphoreHandle_t xMutex;
|
||||
|
||||
/* Create the queue that we are going to use for the
|
||||
prvSendFrontAndBackTest demo. */
|
||||
|
@ -170,7 +170,7 @@ xSemaphoreHandle xMutex;
|
|||
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||
defined to be less than 1. */
|
||||
vQueueAddToRegistry( ( xQueueHandle ) xMutex, "Alt_Q_Mutex" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) xMutex, "Alt_Q_Mutex" );
|
||||
|
||||
/* Create the mutex demo tasks and pass it the mutex just created. We are
|
||||
passing the mutex handle by value so it does not matter that it is declared
|
||||
|
@ -184,7 +184,7 @@ xSemaphoreHandle xMutex;
|
|||
static void prvSendFrontAndBackTest( void *pvParameters )
|
||||
{
|
||||
unsigned long ulData, ulData2;
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -195,7 +195,7 @@ xQueueHandle xQueue;
|
|||
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||
#endif
|
||||
|
||||
xQueue = ( xQueueHandle ) pvParameters;
|
||||
xQueue = ( QueueHandle_t ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -411,7 +411,7 @@ xQueueHandle xQueue;
|
|||
|
||||
static void prvLowPriorityMutexTask( void *pvParameters )
|
||||
{
|
||||
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||
SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -530,7 +530,7 @@ static void prvMediumPriorityMutexTask( void *pvParameters )
|
|||
|
||||
static void prvHighPriorityMutexTask( void *pvParameters )
|
||||
{
|
||||
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||
SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;
|
||||
|
||||
( void ) pvParameters;
|
||||
|
||||
|
|
|
@ -103,8 +103,8 @@
|
|||
/* Structure used to pass parameters to the blocking queue tasks. */
|
||||
typedef struct BLOCKING_QUEUE_PARAMETERS
|
||||
{
|
||||
xQueueHandle xQueue; /*< The queue to be used by the task. */
|
||||
portTickType xBlockTime; /*< The block time to use on queue reads/writes. */
|
||||
QueueHandle_t xQueue; /*< The queue to be used by the task. */
|
||||
TickType_t xBlockTime; /*< The block time to use on queue reads/writes. */
|
||||
volatile short *psCheckVariable; /*< Incremented on each successful cycle to check the task is still running. */
|
||||
} xBlockingQueueParameters;
|
||||
|
||||
|
@ -132,8 +132,8 @@ xBlockingQueueParameters *pxQueueParameters1, *pxQueueParameters2;
|
|||
xBlockingQueueParameters *pxQueueParameters3, *pxQueueParameters4;
|
||||
xBlockingQueueParameters *pxQueueParameters5, *pxQueueParameters6;
|
||||
const unsigned portBASE_TYPE uxQueueSize1 = 1, uxQueueSize5 = 5;
|
||||
const portTickType xBlockTime = ( portTickType ) 1000 / portTICK_RATE_MS;
|
||||
const portTickType xDontBlock = ( portTickType ) 0;
|
||||
const TickType_t xBlockTime = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
|
||||
const TickType_t xDontBlock = ( TickType_t ) 0;
|
||||
|
||||
/* Create the first two tasks as described at the top of the file. */
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ that synchronise with the xEventGroupSync() function. */
|
|||
#define ebDONT_BLOCK ( 0 )
|
||||
|
||||
/* A 5ms delay. */
|
||||
#define ebSHORT_DELAY ( 5 / portTICK_RATE_MS )
|
||||
#define ebSHORT_DELAY ( 5 / portTICK_PERIOD_MS )
|
||||
|
||||
/* Used in the selective bits test which checks no, one or both tasks blocked on
|
||||
event bits in a group are unblocked as appropriate as different bits get set. */
|
||||
|
|
|
@ -137,14 +137,14 @@ static volatile unsigned long ulGuardedVariable = 0;
|
|||
|
||||
/* Handles used in the mutext test to suspend and resume the high and medium
|
||||
priority mutex test tasks. */
|
||||
static xTaskHandle xHighPriorityMutexTask, xMediumPriorityMutexTask;
|
||||
static TaskHandle_t xHighPriorityMutexTask, xMediumPriorityMutexTask;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartGenericQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
{
|
||||
xQueueHandle xQueue;
|
||||
xSemaphoreHandle xMutex;
|
||||
QueueHandle_t xQueue;
|
||||
SemaphoreHandle_t xMutex;
|
||||
|
||||
/* Create the queue that we are going to use for the
|
||||
prvSendFrontAndBackTest demo. */
|
||||
|
@ -172,7 +172,7 @@ xSemaphoreHandle xMutex;
|
|||
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||
defined to be less than 1. */
|
||||
vQueueAddToRegistry( ( xQueueHandle ) xMutex, "Gen_Queue_Mutex" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) xMutex, "Gen_Queue_Mutex" );
|
||||
|
||||
/* Create the mutex demo tasks and pass it the mutex just created. We are
|
||||
passing the mutex handle by value so it does not matter that it is declared
|
||||
|
@ -186,7 +186,7 @@ xSemaphoreHandle xMutex;
|
|||
static void prvSendFrontAndBackTest( void *pvParameters )
|
||||
{
|
||||
unsigned long ulData, ulData2;
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -197,7 +197,7 @@ xQueueHandle xQueue;
|
|||
vPrintDisplayMessage( &pcTaskStartMsg );
|
||||
#endif
|
||||
|
||||
xQueue = ( xQueueHandle ) pvParameters;
|
||||
xQueue = ( QueueHandle_t ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -413,7 +413,7 @@ xQueueHandle xQueue;
|
|||
|
||||
static void prvLowPriorityMutexTask( void *pvParameters )
|
||||
{
|
||||
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||
SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
void vPrintDisplayMessage( const char * const * ppcMessageToSend );
|
||||
|
@ -545,7 +545,7 @@ static void prvMediumPriorityMutexTask( void *pvParameters )
|
|||
|
||||
static void prvHighPriorityMutexTask( void *pvParameters )
|
||||
{
|
||||
xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||
SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ an interrupt. */
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The two queues used by the test. */
|
||||
static xQueueHandle xNormallyEmptyQueue, xNormallyFullQueue;
|
||||
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;
|
||||
|
@ -196,7 +196,7 @@ time to each queue. */
|
|||
volatile unsigned portBASE_TYPE uxValueForNormallyEmptyQueue = 0, uxValueForNormallyFullQueue = 0;
|
||||
|
||||
/* A handle to some of the tasks is required so they can be suspended/resumed. */
|
||||
xTaskHandle xHighPriorityNormallyEmptyTask1, xHighPriorityNormallyEmptyTask2, xHighPriorityNormallyFullTask1, xHighPriorityNormallyFullTask2;
|
||||
TaskHandle_t xHighPriorityNormallyEmptyTask1, xHighPriorityNormallyEmptyTask2, xHighPriorityNormallyFullTask1, xHighPriorityNormallyFullTask2;
|
||||
|
||||
/* When a value is received in a queue the value is ticked off in the array
|
||||
the array position of the value is set to a the identifier of the task or
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
Changes from V2.0.0
|
||||
|
||||
+ Delay periods are now specified using variables and constants of
|
||||
portTickType rather than unsigned long.
|
||||
TickType_t rather than unsigned long.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -105,9 +105,9 @@ Changes from V2.0.0
|
|||
|
||||
#define pollqSTACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define pollqQUEUE_SIZE ( 10 )
|
||||
#define pollqPRODUCER_DELAY ( ( portTickType ) 200 / portTICK_RATE_MS )
|
||||
#define pollqCONSUMER_DELAY ( pollqPRODUCER_DELAY - ( portTickType ) ( 20 / portTICK_RATE_MS ) )
|
||||
#define pollqNO_DELAY ( ( portTickType ) 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 )
|
||||
|
||||
|
@ -125,7 +125,7 @@ static volatile signed portBASE_TYPE xPollingConsumerCount = pollqINITIAL_VALUE,
|
|||
|
||||
void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||
{
|
||||
static xQueueHandle xPolledQueue;
|
||||
static QueueHandle_t xPolledQueue;
|
||||
|
||||
/* Create the queue used by the producer and consumer. */
|
||||
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||
|
@ -139,8 +139,8 @@ static xQueueHandle xPolledQueue;
|
|||
vQueueAddToRegistry( xPolledQueue, "Poll_Test_Queue" );
|
||||
|
||||
/* Spawn the producer and consumer. */
|
||||
xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -154,7 +154,7 @@ signed portBASE_TYPE xError = pdFALSE, xLoop;
|
|||
for( xLoop = 0; xLoop < pollqVALUES_TO_PRODUCE; xLoop++ )
|
||||
{
|
||||
/* Send an incrementing number on the queue without blocking. */
|
||||
if( xQueueSend( *( ( xQueueHandle * ) pvParameters ), ( void * ) &usValue, pollqNO_DELAY ) != pdPASS )
|
||||
if( xQueueSend( *( ( QueueHandle_t * ) pvParameters ), ( void * ) &usValue, pollqNO_DELAY ) != pdPASS )
|
||||
{
|
||||
/* We should never find the queue full so if we get here there
|
||||
has been an error. */
|
||||
|
@ -191,9 +191,9 @@ signed portBASE_TYPE xError = pdFALSE;
|
|||
for( ;; )
|
||||
{
|
||||
/* Loop until the queue is empty. */
|
||||
while( uxQueueMessagesWaiting( *( ( xQueueHandle * ) pvParameters ) ) )
|
||||
while( uxQueueMessagesWaiting( *( ( QueueHandle_t * ) pvParameters ) ) )
|
||||
{
|
||||
if( xQueueReceive( *( ( xQueueHandle * ) pvParameters ), &usData, pollqNO_DELAY ) == pdPASS )
|
||||
if( xQueueReceive( *( ( QueueHandle_t * ) pvParameters ), &usData, pollqNO_DELAY ) == pdPASS )
|
||||
{
|
||||
if( usData != usExpectedValue )
|
||||
{
|
||||
|
|
|
@ -113,12 +113,12 @@ detect a stalled task - a test that is no longer running. */
|
|||
static volatile unsigned long ulLoopCounter = 0;
|
||||
|
||||
/* Handles to the test tasks. */
|
||||
xTaskHandle xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
|
||||
TaskHandle_t xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartQueuePeekTasks( void )
|
||||
{
|
||||
xQueueHandle xQueue;
|
||||
QueueHandle_t xQueue;
|
||||
|
||||
/* Create the queue that we are going to use for the test/demo. */
|
||||
xQueue = xQueueCreate( qpeekQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
|
@ -143,7 +143,7 @@ xQueueHandle xQueue;
|
|||
|
||||
static void prvHighestPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
|
||||
#ifdef USE_STDIO
|
||||
|
@ -252,7 +252,7 @@ unsigned long ulValue;
|
|||
|
||||
static void prvHighPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
|
||||
for( ;; )
|
||||
|
@ -307,7 +307,7 @@ unsigned long ulValue;
|
|||
|
||||
static void prvMediumPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
|
||||
for( ;; )
|
||||
|
@ -348,7 +348,7 @@ unsigned long ulValue;
|
|||
|
||||
static void prvLowPriorityPeekTask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
|
||||
unsigned long ulValue;
|
||||
|
||||
for( ;; )
|
||||
|
|
|
@ -95,7 +95,7 @@ static portBASE_TYPE xISRTestStatus = pdPASS;
|
|||
|
||||
/* The queue that is accessed from the ISR. The queue accessed by the task is
|
||||
created inside the task itself. */
|
||||
static xQueueHandle xISRQueue = NULL;
|
||||
static QueueHandle_t xISRQueue = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -109,13 +109,13 @@ const unsigned portBASE_TYPE uxQueueLength = 1;
|
|||
|
||||
/* Create the test task. The queue used by the test task is created inside
|
||||
the task itself. */
|
||||
xTaskCreate( prvQueueOverwriteTask, "QOver", configMINIMAL_STACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( prvQueueOverwriteTask, "QOver", configMINIMAL_STACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueOverwriteTask( void *pvParameters )
|
||||
{
|
||||
xQueueHandle xTaskQueue;
|
||||
QueueHandle_t xTaskQueue;
|
||||
const unsigned portBASE_TYPE uxQueueLength = 1;
|
||||
unsigned long ulValue, ulStatus = pdPASS, x;
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ queuesetPRIORITY_CHANGE_LOOPS number of values are sent to a queue. */
|
|||
/* A delay inserted when the Tx task changes its priority to be above the idle
|
||||
task priority to ensure the idle priority tasks get some CPU time before the
|
||||
next iteration of the queue set Tx task. */
|
||||
#define queuesetTX_LOOP_DELAY ( 200 / portTICK_RATE_MS )
|
||||
#define queuesetTX_LOOP_DELAY ( 200 / portTICK_PERIOD_MS )
|
||||
|
||||
/* The allowable maximum deviation between a received value and the expected
|
||||
received value. A deviation will occur when data is received from a queue
|
||||
|
@ -189,14 +189,14 @@ static void prvSRand( unsigned long ulSeed );
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The queues that are added to the set. */
|
||||
static xQueueHandle xQueues[ queuesetNUM_QUEUES_IN_SET ] = { 0 };
|
||||
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 };
|
||||
|
||||
/* The handle of the queue set to which the queues are added. */
|
||||
static xQueueSetHandle xQueueSet;
|
||||
static QueueSetHandle_t xQueueSet;
|
||||
|
||||
/* If the prvQueueSetReceivingTask() task has not detected any errors then
|
||||
it increments ulCycleCounter on each iteration.
|
||||
|
@ -222,7 +222,7 @@ static volatile unsigned long ulISRTxValue = queuesetINITIAL_ISR_TX_VALUE;
|
|||
static unsigned long ulNextRand = 0;
|
||||
|
||||
/* The task handles are stored so their priorities can be changed. */
|
||||
xTaskHandle xQueueSetSendingTask, xQueueSetReceivingTask;
|
||||
TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -292,7 +292,7 @@ portBASE_TYPE xReturn = pdPASS, x;
|
|||
static void prvQueueSetSendingTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulTaskTxValue = 0, ulQueueToWriteTo;
|
||||
xQueueHandle xQueueInUse;
|
||||
QueueHandle_t xQueueInUse;
|
||||
|
||||
/* Remove compiler warning about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
@ -390,7 +390,7 @@ static eRelativePriorities ePriorities = eEqualPriority;
|
|||
static void prvQueueSetReceivingTask( void *pvParameters )
|
||||
{
|
||||
unsigned long ulReceived;
|
||||
xQueueHandle xActivatedQueue;
|
||||
QueueHandle_t xActivatedQueue;
|
||||
|
||||
/* Remove compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -570,7 +570,7 @@ portBASE_TYPE xReturn = pdPASS;
|
|||
|
||||
static void prvReceiveFromQueueInSetFromISR( void )
|
||||
{
|
||||
xQueueSetMemberHandle xActivatedQueue;
|
||||
QueueSetMemberHandle_t xActivatedQueue;
|
||||
unsigned long ulReceived;
|
||||
|
||||
/* See if any of the queues in the set contain data. */
|
||||
|
|
|
@ -84,8 +84,8 @@
|
|||
#error configTIMER_TASK_PRIORITY must be set to at least 1 for this test/demo to function correctly.
|
||||
#endif
|
||||
|
||||
#define tmrdemoDONT_BLOCK ( ( portTickType ) 0 )
|
||||
#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( portTickType ) 3 )
|
||||
#define tmrdemoDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( TickType_t ) 3 )
|
||||
#define trmdemoNUM_TIMER_RESETS ( ( unsigned char ) 10 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -97,11 +97,11 @@ prvAutoReloadTimerCallback() callback function, and use the ID of the
|
|||
pxExpiredTimer parameter passed into that function to know which counter to
|
||||
increment. The other timers all have their own unique callback function and
|
||||
simply increment their counters without using the callback function parameter. */
|
||||
static void prvAutoReloadTimerCallback( xTimerHandle pxExpiredTimer );
|
||||
static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer );
|
||||
static void prvAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer );
|
||||
static void prvOneShotTimerCallback( TimerHandle_t pxExpiredTimer );
|
||||
static void prvTimerTestTask( void *pvParameters );
|
||||
static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer );
|
||||
static void prvISROneShotTimerCallback( xTimerHandle pxExpiredTimer );
|
||||
static void prvISRAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer );
|
||||
static void prvISROneShotTimerCallback( TimerHandle_t pxExpiredTimer );
|
||||
|
||||
/* The test functions used by the timer test task. These manipulate the auto
|
||||
reload and one shot timers in various ways, then delay, then inspect the timers
|
||||
|
@ -128,33 +128,33 @@ static volatile unsigned long ulLoopCounter = 0;
|
|||
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 xTimerHandle xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };
|
||||
static TimerHandle_t xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };
|
||||
static unsigned char 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 xTimerHandle xOneShotTimer = NULL;
|
||||
static TimerHandle_t xOneShotTimer = NULL;
|
||||
static unsigned char ucOneShotTimerCounter = ( unsigned char ) 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 xTimerHandle xISRAutoReloadTimer = NULL;
|
||||
static TimerHandle_t xISRAutoReloadTimer = NULL;
|
||||
static unsigned char ucISRAutoReloadTimerCounter = ( unsigned char ) 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 xTimerHandle xISROneShotTimer = NULL;
|
||||
static TimerHandle_t xISROneShotTimer = NULL;
|
||||
static unsigned char ucISROneShotTimerCounter = ( unsigned char ) 0;
|
||||
|
||||
/* The period of all the timers are a multiple of the base period. The base
|
||||
period is configured by the parameter to vStartTimerDemoTask(). */
|
||||
static portTickType xBasePeriod = 0;
|
||||
static TickType_t xBasePeriod = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartTimerDemoTask( portTickType xBasePeriodIn )
|
||||
void vStartTimerDemoTask( TickType_t xBasePeriodIn )
|
||||
{
|
||||
/* Start with the timer and counter arrays clear - this is only necessary
|
||||
where the compiler does not clear them automatically on start up. */
|
||||
|
@ -226,17 +226,17 @@ 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( portTickType xCycleFrequency )
|
||||
portBASE_TYPE xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency )
|
||||
{
|
||||
static unsigned long ulLastLoopCounter = 0UL;
|
||||
portTickType xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;
|
||||
static portTickType xIterationsWithoutCounterIncrement = ( portTickType ) 0, xLastCycleFrequency;
|
||||
TickType_t xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;
|
||||
static TickType_t xIterationsWithoutCounterIncrement = ( TickType_t ) 0, xLastCycleFrequency;
|
||||
|
||||
if( xLastCycleFrequency != xCycleFrequency )
|
||||
{
|
||||
/* The cycle frequency has probably become much faster due to an error
|
||||
elsewhere. Start counting Iterations again. */
|
||||
xIterationsWithoutCounterIncrement = ( portTickType ) 0;
|
||||
xIterationsWithoutCounterIncrement = ( TickType_t ) 0;
|
||||
xLastCycleFrequency = xCycleFrequency;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ static portTickType xIterationsWithoutCounterIncrement = ( portTickType ) 0, xLa
|
|||
function to be called without ulLoopCounter being incremented. This is
|
||||
necessary because the tests in this file block for extended periods, and the
|
||||
block period might be longer than the time between calls to this function. */
|
||||
xMaxBlockTimeUsedByTheseTests = ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;
|
||||
xMaxBlockTimeUsedByTheseTests = ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;
|
||||
xLoopCounterIncrementTimeMax = ( xMaxBlockTimeUsedByTheseTests / xCycleFrequency ) + 1;
|
||||
|
||||
/* If the demo task is still running then the loop counter is expected to
|
||||
|
@ -263,7 +263,7 @@ static portTickType xIterationsWithoutCounterIncrement = ( portTickType ) 0, xLa
|
|||
{
|
||||
/* ulLoopCounter changed, so the count of times this function was called
|
||||
without a change can be reset to zero. */
|
||||
xIterationsWithoutCounterIncrement = ( portTickType ) 0;
|
||||
xIterationsWithoutCounterIncrement = ( TickType_t ) 0;
|
||||
}
|
||||
|
||||
ulLastLoopCounter = ulLoopCounter;
|
||||
|
@ -286,7 +286,7 @@ unsigned portBASE_TYPE xTimer;
|
|||
been started, so their block times should get set to zero within the timer
|
||||
API itself. */
|
||||
xAutoReloadTimers[ xTimer ] = xTimerCreate( "FR Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */
|
||||
( ( xTimer + ( portTickType ) 1 ) * xBasePeriod ),/* The period for the timer. The plus 1 ensures a period of zero is not specified. */
|
||||
( ( xTimer + ( TickType_t ) 1 ) * xBasePeriod ),/* The period for the timer. The plus 1 ensures a period of zero is not specified. */
|
||||
pdTRUE, /* Auto-reload is set to true. */
|
||||
( void * ) xTimer, /* An identifier for the timer as all the auto reload timers use the same callback. */
|
||||
prvAutoReloadTimerCallback ); /* The callback to be called when the timer expires. */
|
||||
|
@ -388,14 +388,14 @@ unsigned char ucTimer;
|
|||
static void prvTest3_CheckAutoReloadExpireRates( void )
|
||||
{
|
||||
unsigned char ucMaxAllowableValue, ucMinAllowableValue, ucTimer;
|
||||
portTickType xBlockPeriod, xTimerPeriod, xExpectedNumber;
|
||||
TickType_t xBlockPeriod, xTimerPeriod, xExpectedNumber;
|
||||
|
||||
/* Check the auto reload timers expire at the expected rates. */
|
||||
|
||||
|
||||
/* Delaying for configTIMER_QUEUE_LENGTH * xBasePeriod ticks should allow
|
||||
all the auto reload timers to expire at least once. */
|
||||
xBlockPeriod = ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;
|
||||
xBlockPeriod = ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;
|
||||
vTaskDelay( xBlockPeriod );
|
||||
|
||||
/* Check that all the auto reload timers have called their callback
|
||||
|
@ -404,7 +404,7 @@ portTickType xBlockPeriod, xTimerPeriod, xExpectedNumber;
|
|||
{
|
||||
/* The expected number of expiries is equal to the block period divided
|
||||
by the timer period. */
|
||||
xTimerPeriod = ( ( ( portTickType ) ucTimer + ( portTickType ) 1 ) * xBasePeriod );
|
||||
xTimerPeriod = ( ( ( TickType_t ) ucTimer + ( TickType_t ) 1 ) * xBasePeriod );
|
||||
xExpectedNumber = xBlockPeriod / xTimerPeriod;
|
||||
|
||||
ucMaxAllowableValue = ( ( unsigned char ) xExpectedNumber ) ;
|
||||
|
@ -477,7 +477,7 @@ unsigned char ucTimer;
|
|||
|
||||
/* The timers are now all inactive, so this time, after delaying, none
|
||||
of the callback counters should have incremented. */
|
||||
vTaskDelay( ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );
|
||||
vTaskDelay( ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );
|
||||
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )
|
||||
{
|
||||
if( ucAutoReloadTimerCounters[ ucTimer ] != ( unsigned char ) 0 )
|
||||
|
@ -525,7 +525,7 @@ static void prvTest5_CheckBasicOneShotTimerBehaviour( void )
|
|||
/* Delay for three times as long as the one shot timer period, then check
|
||||
to ensure it has only called its callback once, and is now not in the
|
||||
active state. */
|
||||
vTaskDelay( tmrdemoONE_SHOT_TIMER_PERIOD * ( portTickType ) 3 );
|
||||
vTaskDelay( tmrdemoONE_SHOT_TIMER_PERIOD * ( TickType_t ) 3 );
|
||||
|
||||
if( xTimerIsTimerActive( xOneShotTimer ) != pdFALSE )
|
||||
{
|
||||
|
@ -622,7 +622,7 @@ unsigned char ucTimer;
|
|||
}
|
||||
|
||||
/* Finally delay long enough for both running timers to expire. */
|
||||
vTaskDelay( ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );
|
||||
vTaskDelay( ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );
|
||||
|
||||
/* The timers were not reset during the above delay period so should now
|
||||
both have called their callback functions. */
|
||||
|
@ -715,7 +715,7 @@ unsigned char ucTimer;
|
|||
|
||||
void vTimerPeriodicISRTests( void )
|
||||
{
|
||||
static portTickType uxTick = ( portTickType ) -1;
|
||||
static TickType_t uxTick = ( TickType_t ) -1;
|
||||
|
||||
#if( configTIMER_TASK_PRIORITY != ( configMAX_PRIORITIES - 1 ) )
|
||||
/* The timer service task is not the highest priority task, so it cannot
|
||||
|
@ -737,9 +737,9 @@ static portTickType uxTick = ( portTickType ) -1;
|
|||
will expire when the kernel's tick count is (100 + xBasePeriod). For this
|
||||
reason xMargin is used as an allowable margin for premature timer expiries
|
||||
as well as late timer expiries. */
|
||||
const portTickType xMargin = 6;
|
||||
const TickType_t xMargin = 6;
|
||||
#else
|
||||
const portTickType xMargin = 3;
|
||||
const TickType_t xMargin = 3;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -755,7 +755,7 @@ static portTickType uxTick = ( portTickType ) -1;
|
|||
/* It is possible that the timer task has not yet made room in the
|
||||
timer queue. If the timers cannot be started then reset uxTick so
|
||||
another attempt is made later. */
|
||||
uxTick = ( portTickType ) -1;
|
||||
uxTick = ( TickType_t ) -1;
|
||||
|
||||
/* Try starting first timer. */
|
||||
if( xTimerChangePeriodFromISR( xISRAutoReloadTimer, xBasePeriod, NULL ) == pdPASS )
|
||||
|
@ -822,7 +822,7 @@ static portTickType uxTick = ( portTickType ) -1;
|
|||
configASSERT( xTestStatus );
|
||||
}
|
||||
}
|
||||
else if( uxTick == ( ( 2 * xBasePeriod ) + ( xBasePeriod >> ( portTickType ) 2U ) ) )
|
||||
else if( uxTick == ( ( 2 * xBasePeriod ) + ( xBasePeriod >> ( TickType_t ) 2U ) ) )
|
||||
{
|
||||
/* The auto reload timer will still be active, but the one shot timer
|
||||
should now have stopped. Again though, at this time, neither timer call
|
||||
|
@ -1012,14 +1012,14 @@ static portTickType uxTick = ( portTickType ) -1;
|
|||
configASSERT( xTestStatus );
|
||||
}
|
||||
|
||||
uxTick = ( portTickType ) -1;
|
||||
uxTick = ( TickType_t ) -1;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*** Timer callback functions are defined below here. ***/
|
||||
|
||||
static void prvAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )
|
||||
static void prvAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer )
|
||||
{
|
||||
unsigned long ulTimerID;
|
||||
|
||||
|
@ -1037,7 +1037,7 @@ unsigned long ulTimerID;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer )
|
||||
static void prvOneShotTimerCallback( TimerHandle_t pxExpiredTimer )
|
||||
{
|
||||
/* The parameter is not used in this case as only one timer uses this
|
||||
callback function. */
|
||||
|
@ -1047,7 +1047,7 @@ static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )
|
||||
static void prvISRAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer )
|
||||
{
|
||||
/* The parameter is not used in this case as only one timer uses this
|
||||
callback function. */
|
||||
|
@ -1057,7 +1057,7 @@ static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvISROneShotTimerCallback( xTimerHandle pxExpiredTimer )
|
||||
static void prvISROneShotTimerCallback( TimerHandle_t pxExpiredTimer )
|
||||
{
|
||||
/* The parameter is not used in this case as only one timer uses this
|
||||
callback function. */
|
||||
|
|
|
@ -88,19 +88,19 @@
|
|||
|
||||
/* Task behaviour. */
|
||||
#define bktQUEUE_LENGTH ( 5 )
|
||||
#define bktSHORT_WAIT ( ( ( portTickType ) 20 ) / portTICK_RATE_MS )
|
||||
#define bktSHORT_WAIT ( ( ( TickType_t ) 20 ) / portTICK_PERIOD_MS )
|
||||
#define bktPRIMARY_BLOCK_TIME ( 10 )
|
||||
#define bktALLOWABLE_MARGIN ( 15 )
|
||||
#define bktTIME_TO_BLOCK ( 175 )
|
||||
#define bktDONT_BLOCK ( ( portTickType ) 0 )
|
||||
#define bktDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
#define bktRUN_INDICATOR ( ( unsigned portBASE_TYPE ) 0x55 )
|
||||
|
||||
/* The queue on which the tasks block. */
|
||||
static xQueueHandle xTestQueue;
|
||||
static QueueHandle_t xTestQueue;
|
||||
|
||||
/* Handle to the secondary task is required by the primary task for calls
|
||||
to vTaskSuspend/Resume(). */
|
||||
static xTaskHandle xSecondary;
|
||||
static TaskHandle_t xSecondary;
|
||||
|
||||
/* Used to ensure that tasks are still executing without error. */
|
||||
static volatile portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||
|
@ -138,8 +138,8 @@ void vCreateBlockTimeTasks( void )
|
|||
static void vPrimaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
portBASE_TYPE xItem, xData;
|
||||
portTickType xTimeWhenBlocking;
|
||||
portTickType xTimeToBlock, xBlockedTime;
|
||||
TickType_t xTimeWhenBlocking;
|
||||
TickType_t xTimeToBlock, xBlockedTime;
|
||||
|
||||
( void ) pvParameters;
|
||||
|
||||
|
@ -153,7 +153,7 @@ portTickType xTimeToBlock, xBlockedTime;
|
|||
{
|
||||
/* The queue is empty. Attempt to read from the queue using a block
|
||||
time. When we wake, ensure the delta in time is as expected. */
|
||||
xTimeToBlock = ( portTickType ) ( bktPRIMARY_BLOCK_TIME << xItem );
|
||||
xTimeToBlock = ( TickType_t ) ( bktPRIMARY_BLOCK_TIME << xItem );
|
||||
|
||||
xTimeWhenBlocking = xTaskGetTickCount();
|
||||
|
||||
|
@ -204,7 +204,7 @@ portTickType xTimeToBlock, xBlockedTime;
|
|||
{
|
||||
/* The queue is full. Attempt to write to the queue using a block
|
||||
time. When we wake, ensure the delta in time is as expected. */
|
||||
xTimeToBlock = ( portTickType ) ( bktPRIMARY_BLOCK_TIME << xItem );
|
||||
xTimeToBlock = ( TickType_t ) ( bktPRIMARY_BLOCK_TIME << xItem );
|
||||
|
||||
xTimeWhenBlocking = xTaskGetTickCount();
|
||||
|
||||
|
@ -388,7 +388,7 @@ portTickType xTimeToBlock, xBlockedTime;
|
|||
|
||||
static void vSecondaryBlockTimeTestTask( void *pvParameters )
|
||||
{
|
||||
portTickType xTimeWhenBlocking, xBlockedTime;
|
||||
TickType_t xTimeWhenBlocking, xBlockedTime;
|
||||
portBASE_TYPE xData;
|
||||
|
||||
( void ) pvParameters;
|
||||
|
|
|
@ -112,16 +112,16 @@
|
|||
|
||||
/* The Tx task will transmit the sequence of characters at a pseudo random
|
||||
interval. This is the maximum and minimum block time between sends. */
|
||||
#define comTX_MAX_BLOCK_TIME ( ( portTickType ) 0x96 )
|
||||
#define comTX_MIN_BLOCK_TIME ( ( portTickType ) 0x32 )
|
||||
#define comOFFSET_TIME ( ( portTickType ) 3 )
|
||||
#define comTX_MAX_BLOCK_TIME ( ( TickType_t ) 0x96 )
|
||||
#define comTX_MIN_BLOCK_TIME ( ( TickType_t ) 0x32 )
|
||||
#define comOFFSET_TIME ( ( TickType_t ) 3 )
|
||||
|
||||
/* We should find that each character can be queued for Tx immediately and we
|
||||
don't have to block to send. */
|
||||
#define comNO_BLOCK ( ( portTickType ) 0 )
|
||||
#define comNO_BLOCK ( ( TickType_t ) 0 )
|
||||
|
||||
/* The Rx task will block on the Rx queue for a long period. */
|
||||
#define comRX_BLOCK_TIME ( ( portTickType ) 0xffff )
|
||||
#define comRX_BLOCK_TIME ( ( TickType_t ) 0xffff )
|
||||
|
||||
/* The sequence transmitted is from comFIRST_BYTE to and including comLAST_BYTE. */
|
||||
#define comFIRST_BYTE ( 'A' )
|
||||
|
@ -158,15 +158,15 @@ void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulB
|
|||
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
||||
|
||||
/* The Tx task is spawned with a lower priority than the Rx task. */
|
||||
xTaskCreate( vComTxTask, "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vComTxTask, "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( TaskHandle_t * ) NULL );
|
||||
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portTASK_FUNCTION( vComTxTask, pvParameters )
|
||||
{
|
||||
char cByteToSend;
|
||||
portTickType xTimeToWait;
|
||||
TickType_t xTimeToWait;
|
||||
|
||||
/* Just to stop compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
|
|
@ -119,9 +119,9 @@
|
|||
/* The Tx timer transmits the sequence of characters at a pseudo random
|
||||
interval that is capped between comTX_MAX_BLOCK_TIME and
|
||||
comTX_MIN_BLOCK_TIME. */
|
||||
#define comTX_MAX_BLOCK_TIME ( ( portTickType ) 0x96 )
|
||||
#define comTX_MIN_BLOCK_TIME ( ( portTickType ) 0x32 )
|
||||
#define comOFFSET_TIME ( ( portTickType ) 3 )
|
||||
#define comTX_MAX_BLOCK_TIME ( ( TickType_t ) 0x96 )
|
||||
#define comTX_MIN_BLOCK_TIME ( ( TickType_t ) 0x32 )
|
||||
#define comOFFSET_TIME ( ( TickType_t ) 3 )
|
||||
|
||||
/* States for the simple state machine implemented in the Rx task. */
|
||||
#define comtstWAITING_START_OF_STRING 0
|
||||
|
@ -132,20 +132,20 @@ a bit so more than one character can be processed at a time. This is relative
|
|||
to comTX_MIN_BLOCK_TIME to ensure it is never longer than the shortest gap
|
||||
between transmissions. It could be worked out more scientifically from the
|
||||
baud rate being used. */
|
||||
#define comSHORT_DELAY ( comTX_MIN_BLOCK_TIME >> ( portTickType ) 2 )
|
||||
#define comSHORT_DELAY ( comTX_MIN_BLOCK_TIME >> ( TickType_t ) 2 )
|
||||
|
||||
/* The string that is transmitted and received. */
|
||||
#define comTRANSACTED_STRING "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
||||
|
||||
/* A block time of 0 simply means "don't block". */
|
||||
#define comtstDONT_BLOCK ( portTickType ) 0
|
||||
#define comtstDONT_BLOCK ( TickType_t ) 0
|
||||
|
||||
/* Handle to the com port used by both tasks. */
|
||||
static xComPortHandle xPort = NULL;
|
||||
|
||||
/* The callback function allocated to the transmit timer, as described in the
|
||||
comments at the top of this file. */
|
||||
static void prvComTxTimerCallback( xTimerHandle xTimer );
|
||||
static void prvComTxTimerCallback( TimerHandle_t xTimer );
|
||||
|
||||
/* The receive task as described in the comments at the top of this file. */
|
||||
static void vComRxTask( void *pvParameters );
|
||||
|
@ -161,7 +161,7 @@ static volatile unsigned portBASE_TYPE uxRxLoops = 0UL;
|
|||
|
||||
/* The timer used to periodically transmit the string. This is the timer that
|
||||
has prvComTxTimerCallback allocated to it as its callback function. */
|
||||
static xTimerHandle xTxTimer = NULL;
|
||||
static TimerHandle_t xTxTimer = NULL;
|
||||
|
||||
/* The string length is held at file scope so the Tx timer does not need to
|
||||
calculate it each time it executes. */
|
||||
|
@ -188,15 +188,15 @@ void vStartComTestStringsTasks( unsigned portBASE_TYPE uxPriority, unsigned long
|
|||
|
||||
/* Create the Rx task and the Tx timer. The timer is started from the
|
||||
Rx task. */
|
||||
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
xTxTimer = xTimerCreate( "TxTimer", comTX_MIN_BLOCK_TIME, pdFALSE, NULL, prvComTxTimerCallback );
|
||||
configASSERT( xTxTimer );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvComTxTimerCallback( xTimerHandle xTimer )
|
||||
static void prvComTxTimerCallback( TimerHandle_t xTimer )
|
||||
{
|
||||
portTickType xTimeToWait;
|
||||
TickType_t xTimeToWait;
|
||||
|
||||
/* The parameter is not used in this case. */
|
||||
( void ) xTimer;
|
||||
|
|
|
@ -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( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
|
||||
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
|
||||
|
||||
/*
|
||||
* Utility function to decrement the semaphore count value up from
|
||||
* countMAX_COUNT_VALUE to zero.
|
||||
*/
|
||||
static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
|
||||
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -125,7 +125,7 @@ static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned po
|
|||
typedef struct COUNT_SEM_STRUCT
|
||||
{
|
||||
/* The semaphore to be used for the demo. */
|
||||
xSemaphoreHandle xSemaphore;
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
|
||||
/* 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
|
||||
|
@ -161,8 +161,8 @@ void vStartCountingSemaphoreTasks( void )
|
|||
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||
defined to be less than 1. */
|
||||
vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 0 ].xSemaphore, "Counting_Sem_1" );
|
||||
vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 1 ].xSemaphore, "Counting_Sem_2" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) xParameters[ 0 ].xSemaphore, "Counting_Sem_1" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) xParameters[ 1 ].xSemaphore, "Counting_Sem_2" );
|
||||
|
||||
|
||||
/* Were the semaphores created? */
|
||||
|
@ -175,7 +175,7 @@ void vStartCountingSemaphoreTasks( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
|
||||
static void prvDecrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
|
||||
{
|
||||
unsigned portBASE_TYPE ux;
|
||||
|
||||
|
@ -211,7 +211,7 @@ unsigned portBASE_TYPE ux;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
|
||||
static void prvIncrementSemaphoreCount( SemaphoreHandle_t xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
|
||||
{
|
||||
unsigned portBASE_TYPE ux;
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE
|
|||
|
||||
/* The queue used to pass data between the 'fixed delay' co-routines and the
|
||||
'flash' co-routine. */
|
||||
static xQueueHandle xFlashQueue;
|
||||
static QueueHandle_t xFlashQueue;
|
||||
|
||||
/* This will be set to pdFALSE if we detect an error. */
|
||||
static portBASE_TYPE xCoRoutineFlashStatus = pdPASS;
|
||||
|
@ -170,14 +170,14 @@ static as we do not need it to maintain its state between blocks. */
|
|||
signed portBASE_TYPE 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 portTickType xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_RATE_MS,
|
||||
200 / portTICK_RATE_MS,
|
||||
250 / portTICK_RATE_MS,
|
||||
300 / portTICK_RATE_MS,
|
||||
350 / portTICK_RATE_MS,
|
||||
400 / portTICK_RATE_MS,
|
||||
450 / portTICK_RATE_MS,
|
||||
500 / portTICK_RATE_MS };
|
||||
static const TickType_t xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_PERIOD_MS,
|
||||
200 / portTICK_PERIOD_MS,
|
||||
250 / portTICK_PERIOD_MS,
|
||||
300 / portTICK_PERIOD_MS,
|
||||
350 / portTICK_PERIOD_MS,
|
||||
400 / portTICK_PERIOD_MS,
|
||||
450 / portTICK_PERIOD_MS,
|
||||
500 / portTICK_PERIOD_MS };
|
||||
|
||||
/* Co-routines MUST start with a call to crSTART. */
|
||||
crSTART( xHandle );
|
||||
|
|
|
@ -130,12 +130,12 @@ void vApplicationTickHook( void );
|
|||
/* Queues used to send data FROM a co-routine TO the tick hook function.
|
||||
The hook functions received (Rx's) on these queues. One queue per
|
||||
'hook' co-routine. */
|
||||
static xQueueHandle xHookRxQueues[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
static QueueHandle_t xHookRxQueues[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
|
||||
/* Queues used to send data FROM the tick hook TO a co-routine function.
|
||||
The hood function transmits (Tx's) on these queues. One queue per
|
||||
'hook' co-routine. */
|
||||
static xQueueHandle xHookTxQueues[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
static QueueHandle_t xHookTxQueues[ hookNUM_HOOK_CO_ROUTINES ];
|
||||
|
||||
/* Set to true if an error is detected at any time. */
|
||||
static portBASE_TYPE xCoRoutineErrorDetected = pdFALSE;
|
||||
|
|
|
@ -130,7 +130,7 @@ static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 3;
|
|||
|
||||
/* Used to store a handle to the task that should be killed by a suicidal task,
|
||||
before it kills itself. */
|
||||
xTaskHandle xCreatedTask;
|
||||
TaskHandle_t xCreatedTask;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -168,15 +168,15 @@ unsigned portBASE_TYPE *puxPriority;
|
|||
static portTASK_FUNCTION( vSuicidalTask, pvParameters )
|
||||
{
|
||||
volatile long l1, l2;
|
||||
xTaskHandle xTaskToKill;
|
||||
const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS;
|
||||
TaskHandle_t xTaskToKill;
|
||||
const TickType_t xDelay = ( TickType_t ) 200 / portTICK_PERIOD_MS;
|
||||
|
||||
if( pvParameters != NULL )
|
||||
{
|
||||
/* This task is periodically created four times. Two created tasks are
|
||||
passed a handle to the other task so it can kill it before killing itself.
|
||||
The other task is passed in null. */
|
||||
xTaskToKill = *( xTaskHandle* )pvParameters;
|
||||
xTaskToKill = *( TaskHandle_t* )pvParameters;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS;
|
|||
if( xTaskToKill != NULL )
|
||||
{
|
||||
/* Make sure the other task has a go before we delete it. */
|
||||
vTaskDelay( ( portTickType ) 0 );
|
||||
vTaskDelay( ( TickType_t ) 0 );
|
||||
|
||||
/* Kill the other task that was created by vCreateTasks(). */
|
||||
vTaskDelete( xTaskToKill );
|
||||
|
@ -208,7 +208,7 @@ const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS;
|
|||
|
||||
static portTASK_FUNCTION( vCreateTasks, pvParameters )
|
||||
{
|
||||
const portTickType xDelay = ( portTickType ) 1000 / portTICK_RATE_MS;
|
||||
const TickType_t xDelay = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
|
||||
unsigned portBASE_TYPE uxPriority;
|
||||
|
||||
uxPriority = *( unsigned portBASE_TYPE * ) pvParameters;
|
||||
|
|
|
@ -144,17 +144,17 @@ static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters );
|
|||
|
||||
/* Demo task specific constants. */
|
||||
#define priSTACK_SIZE ( configMINIMAL_STACK_SIZE )
|
||||
#define priSLEEP_TIME ( ( portTickType ) 128 / portTICK_RATE_MS )
|
||||
#define priSLEEP_TIME ( ( TickType_t ) 128 / portTICK_PERIOD_MS )
|
||||
#define priLOOPS ( 5 )
|
||||
#define priMAX_COUNT ( ( unsigned long ) 0xff )
|
||||
#define priNO_BLOCK ( ( portTickType ) 0 )
|
||||
#define priNO_BLOCK ( ( TickType_t ) 0 )
|
||||
#define priSUSPENDED_QUEUE_LENGTH ( 1 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Handles to the two counter tasks. These could be passed in as parameters
|
||||
to the controller task to prevent them having to be file scope. */
|
||||
static xTaskHandle xContinuousIncrementHandle, xLimitedIncrementHandle;
|
||||
static TaskHandle_t xContinuousIncrementHandle, xLimitedIncrementHandle;
|
||||
|
||||
/* The shared counter variable. This is passed in as a parameter to the two
|
||||
counter variables for demonstration purposes. */
|
||||
|
@ -169,7 +169,7 @@ static volatile portBASE_TYPE xSuspendedQueueSendError = pdFALSE;
|
|||
static volatile portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
|
||||
|
||||
/* Queue used by the second test. */
|
||||
xQueueHandle xSuspendedTestQueue;
|
||||
QueueHandle_t xSuspendedTestQueue;
|
||||
|
||||
/* The value the queue receive task expects to receive next. This is file
|
||||
scope so xAreDynamicPriorityTasksStillRunning() can ensure it is still
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
#define ledSTACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define ledNUMBER_OF_LEDS ( 3 )
|
||||
#define ledFLASH_RATE_BASE ( ( portTickType ) 333 )
|
||||
#define ledFLASH_RATE_BASE ( ( TickType_t ) 333 )
|
||||
|
||||
/* Variable used by the created tasks to calculate the LED number to use, and
|
||||
the rate at which they should flash the LED. */
|
||||
|
@ -108,14 +108,14 @@ signed portBASE_TYPE xLEDTask;
|
|||
for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
|
||||
{
|
||||
/* Spawn the task. */
|
||||
xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
|
||||
{
|
||||
portTickType xFlashRate, xLastFlashTime;
|
||||
TickType_t xFlashRate, xLastFlashTime;
|
||||
unsigned portBASE_TYPE uxLED;
|
||||
|
||||
/* The parameters are not used. */
|
||||
|
@ -132,12 +132,12 @@ unsigned portBASE_TYPE uxLED;
|
|||
}
|
||||
portEXIT_CRITICAL();
|
||||
|
||||
xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( portTickType ) uxLED );
|
||||
xFlashRate /= portTICK_RATE_MS;
|
||||
xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( TickType_t ) uxLED );
|
||||
xFlashRate /= portTICK_PERIOD_MS;
|
||||
|
||||
/* We will turn the LED on and off again in the delay period, so each
|
||||
delay is only half the total period. */
|
||||
xFlashRate /= ( portTickType ) 2;
|
||||
xFlashRate /= ( TickType_t ) 2;
|
||||
|
||||
/* We need to initialise xLastFlashTime prior to the first call to
|
||||
vTaskDelayUntil(). */
|
||||
|
|
|
@ -77,10 +77,10 @@
|
|||
#include "flash_timer.h"
|
||||
|
||||
/* The toggle rates are all a multple of ledFLASH_RATE_BASE. */
|
||||
#define ledFLASH_RATE_BASE ( ( ( portTickType ) 333 ) / portTICK_RATE_MS )
|
||||
#define ledFLASH_RATE_BASE ( ( ( TickType_t ) 333 ) / portTICK_PERIOD_MS )
|
||||
|
||||
/* A block time of zero simple means "don't block". */
|
||||
#define ledDONT_BLOCK ( ( portTickType ) 0 )
|
||||
#define ledDONT_BLOCK ( ( TickType_t ) 0 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -89,14 +89,14 @@
|
|||
* this function, and the timer ID is used within the function to determine
|
||||
* which timer has actually expired.
|
||||
*/
|
||||
static void prvLEDTimerCallback( xTimerHandle xTimer );
|
||||
static void prvLEDTimerCallback( TimerHandle_t xTimer );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartLEDFlashTimers( unsigned portBASE_TYPE uxNumberOfLEDs )
|
||||
{
|
||||
unsigned portBASE_TYPE uxLEDTimer;
|
||||
xTimerHandle xTimer;
|
||||
TimerHandle_t xTimer;
|
||||
|
||||
/* Create and start the requested number of timers. */
|
||||
for( uxLEDTimer = 0; uxLEDTimer < uxNumberOfLEDs; ++uxLEDTimer )
|
||||
|
@ -122,7 +122,7 @@ xTimerHandle xTimer;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvLEDTimerCallback( xTimerHandle xTimer )
|
||||
static void prvLEDTimerCallback( TimerHandle_t xTimer )
|
||||
{
|
||||
portBASE_TYPE xTimerID;
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ short sTask;
|
|||
|
||||
for( sTask = 0; sTask < intgNUMBER_OF_TASKS; sTask++ )
|
||||
{
|
||||
xTaskCreate( vCompeteingIntMathTask, "IntMath", intgSTACK_SIZE, ( void * ) &( xTaskCheck[ sTask ] ), uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( vCompeteingIntMathTask, "IntMath", intgSTACK_SIZE, ( void * ) &( xTaskCheck[ sTask ] ), uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -119,9 +119,9 @@ be overridden by a definition in FreeRTOSConfig.h. */
|
|||
#define recmuMAX_COUNT ( 10 )
|
||||
|
||||
/* Misc. */
|
||||
#define recmuSHORT_DELAY ( 20 / portTICK_RATE_MS )
|
||||
#define recmuNO_DELAY ( ( portTickType ) 0 )
|
||||
#define recmuFIVE_TICK_DELAY ( ( portTickType ) 5 )
|
||||
#define recmuSHORT_DELAY ( 20 / portTICK_PERIOD_MS )
|
||||
#define recmuNO_DELAY ( ( TickType_t ) 0 )
|
||||
#define recmuFIVE_TICK_DELAY ( ( TickType_t ) 5 )
|
||||
|
||||
/* The three tasks as described at the top of this file. */
|
||||
static void prvRecursiveMutexControllingTask( void *pvParameters );
|
||||
|
@ -129,7 +129,7 @@ static void prvRecursiveMutexBlockingTask( void *pvParameters );
|
|||
static void prvRecursiveMutexPollingTask( void *pvParameters );
|
||||
|
||||
/* The mutex used by the demo. */
|
||||
static xSemaphoreHandle xMutex;
|
||||
static SemaphoreHandle_t xMutex;
|
||||
|
||||
/* Variables used to detect and latch errors. */
|
||||
static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;
|
||||
|
@ -137,7 +137,7 @@ static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles
|
|||
|
||||
/* Handles of the two higher priority tasks, required so they can be resumed
|
||||
(unsuspended). */
|
||||
static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;
|
||||
static TaskHandle_t xControllingTaskHandle, xBlockingTaskHandle;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -153,7 +153,7 @@ void vStartRecursiveMutexTasks( void )
|
|||
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||
defined to be less than 1. */
|
||||
vQueueAddToRegistry( ( xQueueHandle ) xMutex, "Recursive_Mutex" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) xMutex, "Recursive_Mutex" );
|
||||
|
||||
|
||||
if( xMutex != NULL )
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
#define semtstNUM_TASKS ( 4 )
|
||||
|
||||
#define semtstDELAY_FACTOR ( ( portTickType ) 10 )
|
||||
#define semtstDELAY_FACTOR ( ( TickType_t ) 10 )
|
||||
|
||||
/* The task function as described at the top of the file. */
|
||||
static portTASK_FUNCTION_PROTO( prvSemaphoreTest, pvParameters );
|
||||
|
@ -113,9 +113,9 @@ static portTASK_FUNCTION_PROTO( prvSemaphoreTest, pvParameters );
|
|||
/* Structure used to pass parameters to each task. */
|
||||
typedef struct SEMAPHORE_PARAMETERS
|
||||
{
|
||||
xSemaphoreHandle xSemaphore;
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
volatile unsigned long *pulSharedVariable;
|
||||
portTickType xBlockTime;
|
||||
TickType_t xBlockTime;
|
||||
} xSemaphoreParameters;
|
||||
|
||||
/* Variables used to check that all the tasks are still running without errors. */
|
||||
|
@ -127,7 +127,7 @@ static volatile short sNextCheckVariable = 0;
|
|||
void vStartSemaphoreTasks( unsigned portBASE_TYPE uxPriority )
|
||||
{
|
||||
xSemaphoreParameters *pxFirstSemaphoreParameters, *pxSecondSemaphoreParameters;
|
||||
const portTickType xBlockTime = ( portTickType ) 100;
|
||||
const TickType_t xBlockTime = ( TickType_t ) 100;
|
||||
|
||||
/* Create the structure used to pass parameters to the first two tasks. */
|
||||
pxFirstSemaphoreParameters = ( xSemaphoreParameters * ) pvPortMalloc( sizeof( xSemaphoreParameters ) );
|
||||
|
@ -147,11 +147,11 @@ const portTickType xBlockTime = ( portTickType ) 100;
|
|||
*( pxFirstSemaphoreParameters->pulSharedVariable ) = semtstNON_BLOCKING_EXPECTED_VALUE;
|
||||
|
||||
/* The first two tasks do not block on semaphore calls. */
|
||||
pxFirstSemaphoreParameters->xBlockTime = ( portTickType ) 0;
|
||||
pxFirstSemaphoreParameters->xBlockTime = ( TickType_t ) 0;
|
||||
|
||||
/* Spawn the first two tasks. As they poll they operate at the idle priority. */
|
||||
xTaskCreate( prvSemaphoreTest, "PolSEM1", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( prvSemaphoreTest, "PolSEM2", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( prvSemaphoreTest, "PolSEM1", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL );
|
||||
xTaskCreate( prvSemaphoreTest, "PolSEM2", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,10 +167,10 @@ const portTickType xBlockTime = ( portTickType ) 100;
|
|||
{
|
||||
pxSecondSemaphoreParameters->pulSharedVariable = ( unsigned long * ) pvPortMalloc( sizeof( unsigned long ) );
|
||||
*( pxSecondSemaphoreParameters->pulSharedVariable ) = semtstBLOCKING_EXPECTED_VALUE;
|
||||
pxSecondSemaphoreParameters->xBlockTime = xBlockTime / portTICK_RATE_MS;
|
||||
pxSecondSemaphoreParameters->xBlockTime = xBlockTime / portTICK_PERIOD_MS;
|
||||
|
||||
xTaskCreate( prvSemaphoreTest, "BlkSEM1", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( prvSemaphoreTest, "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
|
||||
xTaskCreate( prvSemaphoreTest, "BlkSEM1", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
xTaskCreate( prvSemaphoreTest, "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( TaskHandle_t * ) NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,8 +180,8 @@ const portTickType xBlockTime = ( portTickType ) 100;
|
|||
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||
defined to be less than 1. */
|
||||
vQueueAddToRegistry( ( xQueueHandle ) pxFirstSemaphoreParameters->xSemaphore, "Counting_Sem_1" );
|
||||
vQueueAddToRegistry( ( xQueueHandle ) pxSecondSemaphoreParameters->xSemaphore, "Counting_Sem_2" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) pxFirstSemaphoreParameters->xSemaphore, "Counting_Sem_1" );
|
||||
vQueueAddToRegistry( ( QueueHandle_t ) pxSecondSemaphoreParameters->xSemaphore, "Counting_Sem_2" );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -206,7 +206,7 @@ short sError = pdFALSE, sCheckVariableToUse;
|
|||
|
||||
/* If we are blocking we use a much higher count to ensure loads of context
|
||||
switches occur during the count. */
|
||||
if( pxParameters->xBlockTime > ( portTickType ) 0 )
|
||||
if( pxParameters->xBlockTime > ( TickType_t ) 0 )
|
||||
{
|
||||
ulExpectedValue = semtstBLOCKING_EXPECTED_VALUE;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ short sError = pdFALSE, sCheckVariableToUse;
|
|||
}
|
||||
else
|
||||
{
|
||||
if( pxParameters->xBlockTime == ( portTickType ) 0 )
|
||||
if( pxParameters->xBlockTime == ( TickType_t ) 0 )
|
||||
{
|
||||
/* We have not got the semaphore yet, so no point using the
|
||||
processor. We are not blocking when attempting to obtain the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue