OS  v7.3.3
Documentation

Clock and time manipulation interface used by the entire OS. More...

Collaboration diagram for Clock:

Macros

#define QTIME_NULL
 To specify a NULL time value.
 
#define qTimeImmediate
 To specify a non-wait time value.
 
#define QTUNIT_MINUTE
 Conversion factor from seconds to minutes.
 
#define QTUNIT_HOUR
 Conversion factor from seconds to hours.
 
#define QTUNIT_DAY
 Conversion factor from seconds to days.
 
#define QTUNIT_WEEK
 Conversion factor from seconds to weeks.
 
#define QTUNIT_TOTIME(_xTime_, _qUnit_)
 A macro to perform time conversions. More...
 
#define qTimingBase_t
 A macro to specify a qTime_t type for time-base APIs.
 

Typedefs

typedef qFloat32_t qTime_t
 The typedef that specified an time quantity, usually expressed in seconds.
 
typedef qUINT32_t qClock_t
 A 32-bit unsigned integer to hold ticks count. Epochs counter.
 
typedef qClock_t(* qGetTickFcn_t) (void)
 Pointer to Function type qGetTickFcn_t : A function to get the hardware tick value. More...
 

Functions

qBool_t qClock_SetTimeBase (const qTimingBase_t tb)
 Set the system time-base for time conversions. More...
 
qBool_t qClock_SetTickProvider (const qGetTickFcn_t provider)
 Set the clock-tick provider function. More...
 
qTime_t qClock_Convert2Time (const qClock_t t)
 Convert the specified input time(epochs) to time(seconds) More...
 
qClock_t qClock_Convert2Clock (const qTime_t t)
 Convert the specified input time(seconds) to time(epochs) More...
 
void qClock_SysTick (void)
 Feed the system tick. More...
 
qBool_t qClock_TimeDeadlineCheck (const qClock_t ti, const qClock_t td)
 Perform a timestamp check. This function computes the amount of time elapsed between the current instant and the init timestamp ti and checks if the result is greater than td. More...
 

Variables

qGetTickFcn_t qClock_GetTick
 Return the current tick used by the OS. More...
 

Detailed Description

Clock and time manipulation interface used by the entire OS.

Macro Definition Documentation

◆ QTUNIT_TOTIME

#define QTUNIT_TOTIME (   _xTime_,
  _qUnit_ 
)

A macro to perform time conversions.

Parameters
[in]_xTime_The input time in seconds.
[in]_qUnit_The target unit. Use on of the provided factors prefixed with QTUNIT_XXX.
Returns
The time converted to the specified unit.

Typedef Documentation

◆ qGetTickFcn_t

typedef qClock_t(* qGetTickFcn_t) (void)

Pointer to Function type qGetTickFcn_t : A function to get the hardware tick value.

Note
User should use bare-metal code to implement this function. Example :
qUINT32_t OSInterface_GetTick( void ) {
return HAL_GetTick();
}
uint32_t qUINT32_t
Unsigned integer type with width of exactly 32 bits respectively.
Definition: qtypes.h:48
Returns
The number of ticks provided by the system HAL.

Function Documentation

◆ qClock_Convert2Clock()

qClock_t qClock_Convert2Clock ( const qTime_t  t)

Convert the specified input time(seconds) to time(epochs)

Parameters
[in]tTime in seconds
Returns
time (t) in epochs

◆ qClock_Convert2Time()

qTime_t qClock_Convert2Time ( const qClock_t  t)

Convert the specified input time(epochs) to time(seconds)

Parameters
[in]tTime in epochs
Returns
time (t) in seconds

◆ qClock_SetTickProvider()

qBool_t qClock_SetTickProvider ( const qGetTickFcn_t  provider)

Set the clock-tick provider function.

Parameters
[in]providerA pointer to the tick provider function
Returns
qTrue on success, otherwise returns qFalse.

◆ qClock_SetTimeBase()

qBool_t qClock_SetTimeBase ( const qTimingBase_t  tb)

Set the system time-base for time conversions.

Parameters
[in]tbTime base
Returns
qTrue on success, otherwise returns qFalse.

◆ qClock_SysTick()

void qClock_SysTick ( void  )

Feed the system tick.

Note
This call is mandatory and must be called once inside the dedicated timer interrupt service routine (ISR). Example
void interrupt xPeriodicTimer_ISR( void ) {
}
void qClock_SysTick(void)
Feed the system tick.
Definition: qclock.c:94

◆ qClock_TimeDeadlineCheck()

qBool_t qClock_TimeDeadlineCheck ( const qClock_t  ti,
const qClock_t  td 
)

Perform a timestamp check. This function computes the amount of time elapsed between the current instant and the init timestamp ti and checks if the result is greater than td.

Parameters
[in]tiInit timestamp in epochs
[in]tdElapsed time to check in epochs
Returns
qTrue if the elapsed time (t-ti) is greater or equal to td. Otherwise returns qFalse

Variable Documentation

◆ qClock_GetTick

qGetTickFcn_t qClock_GetTick
extern

Return the current tick used by the OS.

Returns
time (t) in epochs.