mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Update the the MPU simulator project to exercise the timer API.
This commit is contained in:
parent
148f588f56
commit
6edabbe7ea
|
@ -105,7 +105,7 @@ to exclude the API function. */
|
||||||
#define INCLUDE_vTaskDelayUntil 1
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
#define INCLUDE_vTaskDelay 1
|
#define INCLUDE_vTaskDelay 1
|
||||||
#define INCLUDE_eTaskGetState 1
|
#define INCLUDE_eTaskGetState 1
|
||||||
#define INCLUDE_xTimerPendFunctionCall 0
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||||
#define INCLUDE_xTaskGetHandle 1
|
#define INCLUDE_xTaskGetHandle 1
|
||||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>DLGDARM</Key>
|
<Key>DLGDARM</Key>
|
||||||
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=1215,201,1680,501,0)</Name>
|
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=1071,201,1536,501,0)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -146,7 +146,24 @@
|
||||||
<Name>-UV1115SAE -O2983 -S0 -C0 -P00 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO11 -FN1 -FC1000 -FD20000000 -FF0NEW_DEVICE -FL080000 -FS00 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM)</Name>
|
<Name>-UV1115SAE -O2983 -S0 -C0 -P00 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO11 -FN1 -FC1000 -FD20000000 -FF0NEW_DEVICE -FL080000 -FS00 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>614</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>23132</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Source\stream_buffer.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\RTOSDemo\../../../Source/stream_buffer.c\614</Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
|
@ -173,7 +190,7 @@
|
||||||
<DebugFlag>
|
<DebugFlag>
|
||||||
<trace>0</trace>
|
<trace>0</trace>
|
||||||
<periodic>1</periodic>
|
<periodic>1</periodic>
|
||||||
<aLwin>1</aLwin>
|
<aLwin>0</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>0</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
|
@ -190,7 +207,7 @@
|
||||||
<aLa>0</aLa>
|
<aLa>0</aLa>
|
||||||
<aPa1>0</aPa1>
|
<aPa1>0</aPa1>
|
||||||
<AscS4>0</AscS4>
|
<AscS4>0</AscS4>
|
||||||
<aSer4>0</aSer4>
|
<aSer4>1</aSer4>
|
||||||
<StkLoc>0</StkLoc>
|
<StkLoc>0</StkLoc>
|
||||||
<TrcWin>0</TrcWin>
|
<TrcWin>0</TrcWin>
|
||||||
<newCpu>0</newCpu>
|
<newCpu>0</newCpu>
|
||||||
|
|
|
@ -158,6 +158,7 @@ static void prvExerciseEventGroupAPI( void );
|
||||||
static void prvExerciseSemaphoreAPI( void );
|
static void prvExerciseSemaphoreAPI( void );
|
||||||
static void prvExerciseTaskNotificationAPI( void );
|
static void prvExerciseTaskNotificationAPI( void );
|
||||||
static void prvExerciseStreamBufferAPI( void );
|
static void prvExerciseStreamBufferAPI( void );
|
||||||
|
static void prvExerciseTimerAPI( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Just configures any clocks and IO necessary.
|
* Just configures any clocks and IO necessary.
|
||||||
|
@ -196,6 +197,13 @@ static void prvTestMemoryRegions( void );
|
||||||
*/
|
*/
|
||||||
static void prvTimerCallback( TimerHandle_t xExpiredTimer );
|
static void prvTimerCallback( TimerHandle_t xExpiredTimer );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The callback function and a function that is pended used when exercising the
|
||||||
|
* timer API.
|
||||||
|
*/
|
||||||
|
static void prvPendedFunctionCall( void *pvParameter1, uint32_t ulParameter2 );
|
||||||
|
static void prvTestTimerCallback( TimerHandle_t xTimer );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* The handle of the queue used to communicate between tasks and between tasks
|
/* The handle of the queue used to communicate between tasks and between tasks
|
||||||
|
@ -763,6 +771,7 @@ static void prvTaskToDelete( void *pvParameters )
|
||||||
prvExerciseSemaphoreAPI();
|
prvExerciseSemaphoreAPI();
|
||||||
prvExerciseTaskNotificationAPI();
|
prvExerciseTaskNotificationAPI();
|
||||||
prvExerciseStreamBufferAPI();
|
prvExerciseStreamBufferAPI();
|
||||||
|
prvExerciseTimerAPI();
|
||||||
|
|
||||||
/* For code coverage test purposes it is deleted by the Idle task. */
|
/* For code coverage test purposes it is deleted by the Idle task. */
|
||||||
configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 );
|
configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 );
|
||||||
|
@ -771,6 +780,72 @@ static void prvTaskToDelete( void *pvParameters )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvPendedFunctionCall( void *pvParameter1, uint32_t ulParameter2 )
|
||||||
|
{
|
||||||
|
uint32_t *pulCounter = ( uint32_t * ) pvParameter1;
|
||||||
|
|
||||||
|
/* Increment the paramater to show the pended function has executed. */
|
||||||
|
( *pulCounter )++;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvTestTimerCallback( TimerHandle_t xTimer )
|
||||||
|
{
|
||||||
|
uint32_t ulTimerID;
|
||||||
|
|
||||||
|
/* Increment the timer's ID to show the callback has executed. */
|
||||||
|
ulTimerID = ( uint32_t ) pvTimerGetTimerID( xTimer );
|
||||||
|
ulTimerID++;
|
||||||
|
vTimerSetTimerID( xTimer, ( void * ) ulTimerID );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvExerciseTimerAPI( void )
|
||||||
|
{
|
||||||
|
TimerHandle_t xTimer;
|
||||||
|
const char * const pcTimerName = "TestTimer";
|
||||||
|
const TickType_t x10ms = pdMS_TO_TICKS( 3 );
|
||||||
|
uint32_t ulValueForTesting = 0;
|
||||||
|
|
||||||
|
xTimer = xTimerCreate( pcTimerName,
|
||||||
|
x10ms,
|
||||||
|
pdFALSE, /* Created as a one shot timer. */
|
||||||
|
0,
|
||||||
|
prvTestTimerCallback );
|
||||||
|
configASSERT( xTimer );
|
||||||
|
configASSERT( xTimerIsTimerActive( xTimer ) == pdFALSE );
|
||||||
|
configASSERT( xTimerGetTimerDaemonTaskHandle() != NULL );
|
||||||
|
configASSERT( strcmp( pcTimerName, pcTimerGetName( xTimer ) ) == 0 );
|
||||||
|
configASSERT( xTimerGetPeriod( xTimer ) == x10ms );
|
||||||
|
configASSERT( xTimerGetExpiryTime( xTimer ) == 0 ); /* The timer has been created only. */
|
||||||
|
|
||||||
|
/* Pend a function then wait for it to execute. All it does is increment
|
||||||
|
its parameter. */
|
||||||
|
xTimerPendFunctionCall( prvPendedFunctionCall, &ulValueForTesting, 0, 0 );
|
||||||
|
vTaskDelay( x10ms );
|
||||||
|
configASSERT( ulValueForTesting == 1 );
|
||||||
|
|
||||||
|
/* Timer was created as a one shot timer. Its callback just increments the
|
||||||
|
timer's ID - so set the ID to 0, let the timer run for a number of timeout
|
||||||
|
periods, then check the timer has only executed once. */
|
||||||
|
vTimerSetTimerID( xTimer, ( void * ) 0 );
|
||||||
|
xTimerStart( xTimer, 0 );
|
||||||
|
vTaskDelay( 3UL * x10ms );
|
||||||
|
configASSERT( ( ( uint32_t ) ( pvTimerGetTimerID( xTimer ) ) ) == 1UL );
|
||||||
|
|
||||||
|
/* Now change the timer to be an autoreload timer and check it executes
|
||||||
|
the expected number of times. */
|
||||||
|
vTimerSetReloadMode( xTimer, pdTRUE );
|
||||||
|
xTimerStart( xTimer, 0 );
|
||||||
|
vTaskDelay( 3UL * x10ms );
|
||||||
|
configASSERT( ( uint32_t ) ( pvTimerGetTimerID( xTimer ) ) > 3UL );
|
||||||
|
configASSERT( xTimerStop( xTimer, 0 ) != pdFAIL );
|
||||||
|
|
||||||
|
/* Clean up at the end. */
|
||||||
|
xTimerDelete( xTimer, portMAX_DELAY );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvExerciseStreamBufferAPI( void )
|
static void prvExerciseStreamBufferAPI( void )
|
||||||
{
|
{
|
||||||
uint8_t ucBuffer[ 10 ];
|
uint8_t ucBuffer[ 10 ];
|
||||||
|
@ -799,19 +874,6 @@ StreamBufferHandle_t xStreamBuffer;
|
||||||
0 );
|
0 );
|
||||||
configASSERT( xReturned == sizeof( xRead ) );
|
configASSERT( xReturned == sizeof( xRead ) );
|
||||||
configASSERT( xRead == x );
|
configASSERT( xRead == x );
|
||||||
|
|
||||||
xStreamBufferSendFromISR( xStreamBuffer,
|
|
||||||
( void * ) &x,
|
|
||||||
sizeof( x ),
|
|
||||||
NULL );
|
|
||||||
configASSERT( xReturned == sizeof( x ) );
|
|
||||||
|
|
||||||
xReturned = xStreamBufferReceiveFromISR( xStreamBuffer,
|
|
||||||
( void * ) &xRead,
|
|
||||||
sizeof( xRead ),
|
|
||||||
NULL );
|
|
||||||
configASSERT( xReturned == sizeof( xRead ) );
|
|
||||||
configASSERT( xRead == x );
|
|
||||||
configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE );
|
configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE );
|
||||||
configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE );
|
configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE );
|
||||||
configASSERT( xStreamBufferSpacesAvailable( xStreamBuffer ) == sizeof( ucBuffer ) );
|
configASSERT( xStreamBufferSpacesAvailable( xStreamBuffer ) == sizeof( ucBuffer ) );
|
||||||
|
@ -865,9 +927,13 @@ volatile uint32_t ulReadData;
|
||||||
test purposes. */
|
test purposes. */
|
||||||
if( xTaskToDelete != NULL )
|
if( xTaskToDelete != NULL )
|
||||||
{
|
{
|
||||||
|
if( eTaskGetState( xTaskToDelete ) == eSuspended )
|
||||||
|
{
|
||||||
|
/* The task has finished its tests and can be deleted. */
|
||||||
vTaskDelete( xTaskToDelete );
|
vTaskDelete( xTaskToDelete );
|
||||||
xTaskToDelete = NULL;
|
xTaskToDelete = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
( void ) ulReadData;
|
( void ) ulReadData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue