summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/Common/Minimal/semtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/Common/Minimal/semtest.c')
-rw-r--r--FreeRTOS/Demo/Common/Minimal/semtest.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/FreeRTOS/Demo/Common/Minimal/semtest.c b/FreeRTOS/Demo/Common/Minimal/semtest.c
index 5b093a5fa..3240c806d 100644
--- a/FreeRTOS/Demo/Common/Minimal/semtest.c
+++ b/FreeRTOS/Demo/Common/Minimal/semtest.c
@@ -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