Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions include/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
/**
* task. h
* <pre>
* void vTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );
* BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );
* </pre>
*
* INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.
Expand All @@ -799,7 +799,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* each time it executes].
*
* Whereas vTaskDelay () specifies a wake time relative to the time at which the function
* is called, vTaskDelayUntil () specifies the absolute (exact) time at which it wishes to
* is called, xTaskDelayUntil () specifies the absolute (exact) time at which it wishes to
* unblock.
*
* The constant portTICK_PERIOD_MS can be used to calculate real time from the tick
Expand All @@ -808,13 +808,16 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* @param pxPreviousWakeTime Pointer to a variable that holds the time at which the
* task was last unblocked. The variable must be initialised with the current time
* prior to its first use (see the example below). Following this the variable is
* automatically updated within vTaskDelayUntil ().
* automatically updated within xTaskDelayUntil ().
*
* @param xTimeIncrement The cycle time period. The task will be unblocked at
* time *pxPreviousWakeTime + xTimeIncrement. Calling vTaskDelayUntil with the
* time *pxPreviousWakeTime + xTimeIncrement. Calling xTaskDelayUntil with the
* same xTimeIncrement parameter value will cause the task to execute with
* a fixed interface period.
*
* @return Value which can be used to check whether the task was actually delayed.
* Will be pdTRUE if the task way delayed and pdFALSE otherwise.
*
* Example usage:
* <pre>
* // Perform an action every 10 ticks.
Expand All @@ -823,22 +826,28 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* TickType_t xLastWakeTime;
* const TickType_t xFrequency = 10;
*
* // Initialise the xLastWakeTime variable with the current time.
* xLastWakeTime = xTaskGetTickCount ();
* for( ;; )
* {
* // Wait for the next cycle.
* vTaskDelayUntil( &xLastWakeTime, xFrequency );
* // Initialise the xLastWakeTime variable with the current time.
* xLastWakeTime = xTaskGetTickCount ();
* for( ;; )
* {
* // Wait for the next cycle.
* BaseType_t xWasDelayed = xTaskDelayUntil( &xLastWakeTime, xFrequency );
*
* // Perform action here.
* }
* // Perform action here. xWasDelayed value can be used to determine
* // whether a deadline was missed if the code here took too long.
* }
* }
* </pre>
* \defgroup vTaskDelayUntil vTaskDelayUntil
* \defgroup xTaskDelayUntil xTaskDelayUntil
* \ingroup TaskCtrl
*/
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;
BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;
#define vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) \
{ \
xTaskDelayUntil ( pxPreviousWakeTime , xTimeIncrement ); \
}


/**
* task. h
Expand Down
2 changes: 2 additions & 0 deletions lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2976,6 +2976,7 @@ xtaskcreate
xtaskcreaterestricted
xtaskcreaterestrictedstatic
xtaskcreatestatic
xtaskdelayuntil
xtaskdetails
xtaskendscheduler
xtaskgetapplicationtasktag
Expand Down Expand Up @@ -3076,6 +3077,7 @@ xvalueofinsertion
xvtorconst
xwaitforallbits
xwantedsize
xwasdelayed
xwritevalue
xxr
xyieldpending
Expand Down
4 changes: 3 additions & 1 deletion tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )

#if ( INCLUDE_vTaskDelayUntil == 1 )

void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement )
{
TickType_t xTimeToWake;
Expand Down Expand Up @@ -1324,6 +1324,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
{
mtCOVERAGE_TEST_MARKER();
}

return xShouldDelay;
}

#endif /* INCLUDE_vTaskDelayUntil */
Expand Down