Update the demo directory to use the version 8 type naming conventions.

This commit is contained in:
Richard Barry 2014-02-11 12:04:59 +00:00
parent c6d8892b0d
commit 5a2a8fc319
639 changed files with 3127 additions and 3470 deletions

View file

@ -99,7 +99,7 @@ Changes from V1.00:
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.
Changes from V4.0.2
@ -125,8 +125,8 @@ Changes from V4.0.2
/* 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;
@ -154,8 +154,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. */

View file

@ -94,7 +94,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>
@ -122,7 +122,7 @@ static volatile short sPollingConsumerCount = 0, sPollingProducerCount = 0;
void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
{
static xQueueHandle xPolledQueue;
static QueueHandle_t xPolledQueue;
const unsigned portBASE_TYPE uxQueueSize = 10;
/* Create the queue used by the producer and consumer. */
@ -137,8 +137,8 @@ const unsigned portBASE_TYPE uxQueueSize = 10;
static void vPolledQueueProducer( void *pvParameters )
{
unsigned short usValue = 0, usLoop;
xQueueHandle *pxQueue;
const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS;
QueueHandle_t *pxQueue;
const TickType_t xDelay = ( TickType_t ) 200 / portTICK_PERIOD_MS;
const unsigned short usNumToProduce = 3;
const char * const pcTaskStartMsg = "Polled queue producer started.\r\n";
const char * const pcTaskErrorMsg = "Could not post on polled queue.\r\n";
@ -148,14 +148,14 @@ short sError = pdFALSE;
vPrintDisplayMessage( &pcTaskStartMsg );
/* The queue being used is passed in as the parameter. */
pxQueue = ( xQueueHandle * ) pvParameters;
pxQueue = ( QueueHandle_t * ) pvParameters;
for( ;; )
{
for( usLoop = 0; usLoop < usNumToProduce; ++usLoop )
{
/* Send an incrementing number on the queue without blocking. */
if( xQueueSendToBack( *pxQueue, ( void * ) &usValue, ( portTickType ) 0 ) != pdPASS )
if( xQueueSendToBack( *pxQueue, ( void * ) &usValue, ( TickType_t ) 0 ) != pdPASS )
{
/* We should never find the queue full - this is an error. */
vPrintDisplayMessage( &pcTaskErrorMsg );
@ -185,8 +185,8 @@ short sError = pdFALSE;
static void vPolledQueueConsumer( void *pvParameters )
{
unsigned short usData, usExpectedValue = 0;
xQueueHandle *pxQueue;
const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS;
QueueHandle_t *pxQueue;
const TickType_t xDelay = ( TickType_t ) 200 / portTICK_PERIOD_MS;
const char * const pcTaskStartMsg = "Polled queue consumer started.\r\n";
const char * const pcTaskErrorMsg = "Incorrect value received on polled queue.\r\n";
short sError = pdFALSE;
@ -195,14 +195,14 @@ short sError = pdFALSE;
vPrintDisplayMessage( &pcTaskStartMsg );
/* The queue being used is passed in as the parameter. */
pxQueue = ( xQueueHandle * ) pvParameters;
pxQueue = ( QueueHandle_t * ) pvParameters;
for( ;; )
{
/* Loop until the queue is empty. */
while( uxQueueMessagesWaiting( *pxQueue ) )
{
if( xQueueReceive( *pxQueue, &usData, ( portTickType ) 0 ) == pdPASS )
if( xQueueReceive( *pxQueue, &usData, ( TickType_t ) 0 ) == pdPASS )
{
if( usData != usExpectedValue )
{

View file

@ -120,7 +120,7 @@ Changed from V1.2.5
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.
+ Slight modification to task priorities.
*/
@ -139,8 +139,8 @@ Changes from V2.0.0
/* 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 ) 0x15e )
#define comTX_MIN_BLOCK_TIME ( ( portTickType ) 0xc8 )
#define comTX_MAX_BLOCK_TIME ( ( TickType_t ) 0x15e )
#define comTX_MIN_BLOCK_TIME ( ( TickType_t ) 0xc8 )
#define comMAX_CONSECUTIVE_ERRORS ( 2 )
@ -169,7 +169,7 @@ check that both tasks are still executing. */
volatile short sTxCount = 0, sRxCount = 0, sSemCount = 0;
/* The handle to the semaphore test task. */
static xTaskHandle xSemTestTaskHandle = NULL;
static TaskHandle_t xSemTestTaskHandle = NULL;
/*-----------------------------------------------------------*/
@ -188,7 +188,7 @@ const unsigned portBASE_TYPE uxBufferLength = 255;
static void vComTxTask( void *pvParameters )
{
const char * const pcTaskStartMsg = "COM Tx task started.\r\n";
portTickType xTimeToWait;
TickType_t xTimeToWait;
/* Stop warnings. */
( void ) pvParameters;
@ -228,7 +228,7 @@ const char * const pcTaskStartMsg = "COM Rx task started.\r\n";
const char * const pcTaskErrorMsg = "COM read error\r\n";
const char * const pcTaskRestartMsg = "COM resynced\r\n";
const char * const pcTaskTimeoutMsg = "COM Rx timed out\r\n";
const portTickType xBlockTime = ( portTickType ) 0xffff / portTICK_RATE_MS;
const TickType_t xBlockTime = ( TickType_t ) 0xffff / portTICK_PERIOD_MS;
const char *pcExpectedChar;
portBASE_TYPE xGotChar;
char cRxedChar;

View file

@ -86,7 +86,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>
@ -119,7 +119,7 @@ static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 5;
/* Used to store a handle to the tasks that should be killed by a suicidal task,
before it kills itself. */
xTaskHandle xCreatedTask1, xCreatedTask2;
TaskHandle_t xCreatedTask1, xCreatedTask2;
/*-----------------------------------------------------------*/
@ -143,15 +143,15 @@ unsigned portBASE_TYPE *puxPriority;
static void vSuicidalTask( void *pvParameters )
{
portDOUBLE d1, d2;
xTaskHandle xTaskToKill;
const portTickType xDelay = ( portTickType ) 500 / portTICK_RATE_MS;
TaskHandle_t xTaskToKill;
const TickType_t xDelay = ( TickType_t ) 500 / portTICK_PERIOD_MS;
if( pvParameters != NULL )
{
/* This task is periodically created four times. Tow 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
{
@ -169,7 +169,7 @@ const portTickType xDelay = ( portTickType ) 500 / 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 );
/* Kill ourselves. */
@ -181,7 +181,7 @@ const portTickType xDelay = ( portTickType ) 500 / portTICK_RATE_MS;
static void vCreateTasks( void *pvParameters )
{
const portTickType xDelay = ( portTickType ) 1000 / portTICK_RATE_MS;
const TickType_t xDelay = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
unsigned portBASE_TYPE uxPriority;
const char * const pcTaskStartMsg = "Create task started.\r\n";

View file

@ -132,7 +132,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.
+ Added a second, simple test that uses the functions
vQueueReceiveWhenSuspendedTask() and vQueueSendWhenSuspendedTask().
@ -177,17 +177,17 @@ static void prvChangePriorityHelperTask( void *pvParameters );
/* Demo task specific constants. */
#define priSTACK_SIZE ( ( unsigned short ) configMINIMAL_STACK_SIZE )
#define priSLEEP_TIME ( ( portTickType ) 50 )
#define priSLEEP_TIME ( ( TickType_t ) 50 )
#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, xChangePriorityWhenSuspendedHandle;
static TaskHandle_t xContinuousIncrementHandle, xLimitedIncrementHandle, xChangePriorityWhenSuspendedHandle;
/* The shared counter variable. This is passed in as a parameter to the two
counter variables for demonstration purposes. */
@ -207,7 +207,7 @@ static portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
static portBASE_TYPE xPriorityRaiseWhenSuspendedError = pdFALSE;
/* Queue used by the second test. */
xQueueHandle xSuspendedTestQueue;
QueueHandle_t xSuspendedTestQueue;
/*-----------------------------------------------------------*/
/*

View file

@ -126,11 +126,11 @@ static portBASE_TYPE xExpectedTaskCounters[ evtNUM_TASKS ] = { 0, 0, 0, 0 };
/* Handles to the four event tasks. These are required to suspend and resume
the tasks. */
static xTaskHandle xCreatedTasks[ evtNUM_TASKS ];
static TaskHandle_t xCreatedTasks[ evtNUM_TASKS ];
/* The single queue onto which the controlling task posts, and the four event
tasks block. */
static xQueueHandle xQueue;
static QueueHandle_t xQueue;
/* Flag used to indicate whether or not an error has occurred at any time.
An error is either the queue being full when not expected, or an unexpected

View file

@ -83,7 +83,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.
Changes from V2.1.1
@ -108,7 +108,7 @@ Changes from V2.1.1
typedef struct LED_PARAMETERS
{
unsigned portBASE_TYPE uxLED; /*< The output the task should use. */
portTickType xFlashRate; /*< The rate at which the LED should flash. */
TickType_t xFlashRate; /*< The rate at which the LED should flash. */
} xLEDParameters;
/* The task that is created eight times - each time with a different xLEDParaemtes
@ -125,7 +125,7 @@ void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority )
unsigned portBASE_TYPE uxLEDTask;
xLEDParameters *pxLEDParameters;
const unsigned portBASE_TYPE uxNumOfLEDs = 8;
const portTickType xFlashRate = 125;
const TickType_t xFlashRate = 125;
/* Create the eight tasks. */
for( uxLEDTask = 0; uxLEDTask < uxNumOfLEDs; ++uxLEDTask )
@ -134,11 +134,11 @@ const portTickType xFlashRate = 125;
created task. */
pxLEDParameters = ( xLEDParameters * ) pvPortMalloc( sizeof( xLEDParameters ) );
pxLEDParameters->uxLED = uxLEDTask;
pxLEDParameters->xFlashRate = ( xFlashRate + ( xFlashRate * ( portTickType ) uxLEDTask ) );
pxLEDParameters->xFlashRate /= portTICK_RATE_MS;
pxLEDParameters->xFlashRate = ( xFlashRate + ( xFlashRate * ( TickType_t ) uxLEDTask ) );
pxLEDParameters->xFlashRate /= portTICK_PERIOD_MS;
/* Spawn the task. */
xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, ( void * ) pxLEDParameters, uxPriority, ( xTaskHandle * ) NULL );
xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, ( void * ) pxLEDParameters, uxPriority, ( TaskHandle_t * ) NULL );
}
}
/*-----------------------------------------------------------*/
@ -155,11 +155,11 @@ xLEDParameters *pxParameters;
for(;;)
{
/* Delay for half the flash period then turn the LED on. */
vTaskDelay( pxParameters->xFlashRate / ( portTickType ) 2 );
vTaskDelay( pxParameters->xFlashRate / ( TickType_t ) 2 );
vParTestToggleLED( pxParameters->uxLED );
/* Delay for half the flash period then turn the LED off. */
vTaskDelay( pxParameters->xFlashRate / ( portTickType ) 2 );
vTaskDelay( pxParameters->xFlashRate / ( TickType_t ) 2 );
vParTestToggleLED( pxParameters->uxLED );
}
}

View file

@ -91,7 +91,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,7 +103,7 @@ Changes from V2.0.0
/* Demo program include files. */
#include "print.h"
static xQueueHandle xPrintQueue;
static QueueHandle_t xPrintQueue;
/*-----------------------------------------------------------*/
@ -119,7 +119,7 @@ const unsigned portBASE_TYPE uxQueueSize = 20;
void vPrintDisplayMessage( const char * const * ppcMessageToSend )
{
#ifdef USE_STDIO
xQueueSend( xPrintQueue, ( void * ) ppcMessageToSend, ( portTickType ) 0 );
xQueueSend( xPrintQueue, ( void * ) ppcMessageToSend, ( TickType_t ) 0 );
#else
/* Stop warnings. */
( void ) ppcMessageToSend;
@ -127,7 +127,7 @@ void vPrintDisplayMessage( const char * const * ppcMessageToSend )
}
/*-----------------------------------------------------------*/
const char *pcPrintGetNextMessage( portTickType xPrintRate )
const char *pcPrintGetNextMessage( TickType_t xPrintRate )
{
char *pcMessage;

View file

@ -101,7 +101,7 @@ Changes from V1.2.0:
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.
Changes from V2.1.1
@ -128,7 +128,7 @@ Changes from V2.1.1
#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 void prvSemaphoreTest( void *pvParameters );
@ -136,9 +136,9 @@ static void prvSemaphoreTest( void *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. */
@ -154,7 +154,7 @@ const char * const pcSemaphoreTaskStart = "Guarded shared variable task started.
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 ) );
@ -173,11 +173,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 );
}
}
@ -192,10 +192,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 );
}
}
}
@ -225,7 +225,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;
}
@ -289,7 +289,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