Timer implementation form timeouts and time measuring. More...
#include "csi_timer.h"
Functions | |
uint32_t | CsiTimerGetExpirationTime (TCsiTimer *pTimer) |
This function returns the absolut expiration time in millisecoonds. More... | |
uint32_t | CsiTimerGetMilliSec (void) |
Returns actual value of global millisecond timer. More... | |
void | CsiTimerInit (TCsiTimer *pTimer, uint32_t Period) |
Function CsiTimerInit() initialiszes a timer object. More... | |
uint8_t | CsiTimerIsExpired (TCsiTimer *pTimer) |
Check if a certain timer is expired or if it is still active. More... | |
void | CsiTimerRestart (TCsiTimer *pTimer) |
Initializes the timer with a new timestamp value. More... | |
void | CsiTimerSetTimestamp (TCsiTimer *pTimer, const uint32_t Period) |
Set timestamp value (expiration timer) of certain timer. More... | |
void | CsiTimerSetTimestampAndStartTime (TCsiTimer *pTimer, const uint32_t StartTime, const uint32_t Period) |
This function calculates the expiration time from a start time value and the timer period (expiration time = start time + period) More... | |
Detailed Description
Timer implementation form timeouts and time measuring.
- Date
- 2009/08/27 The file implements a polling timer. The polling timer is intialized with a specific millisecond value and a timeout period. After this initialisation the application can check (poll) the timer for timeout.
Function Documentation
uint32_t CsiTimerGetExpirationTime | ( | TCsiTimer * | pTimer | ) |
This function returns the absolut expiration time in millisecoonds.
- Parameters
-
[in] pTimer The timer to query for expiration time
- Returns
- Timer expiration time in milliseconds
uint32_t CsiTimerGetMilliSec | ( | void | ) |
Returns actual value of global millisecond timer.
- Returns
- An absolut time value in milliseconds
Referenced by CsiTimerIsExpired(), and CsiTimerSetTimestamp().
void CsiTimerInit | ( | TCsiTimer * | pTimer, |
uint32_t | Period | ||
) |
Function CsiTimerInit() initialiszes a timer object.
The function stores the dwPeriod value into the timer object pTimer.
- Parameters
-
[in] pTimer The timer object to initialize [in] Period The period of the timer
uint8_t CsiTimerIsExpired | ( | TCsiTimer * | pTimer | ) |
Check if a certain timer is expired or if it is still active.
The function checks if the current time value is larger then the timer timestamp value. If the current time value is larger, then the timer is expired.
- Parameters
-
[in] pTimer The timer to query
- Return values
-
1 Timer expired 0 Timer not expired - active
void CsiTimerRestart | ( | TCsiTimer * | pTimer | ) |
Initializes the timer with a new timestamp value.
The function calculates a new timestamp value. It uses the pTimer period for this calculation. The new timestamp value is the current timer plus the timer period.
- Parameters
-
[in] pTimer Timer to restart
void CsiTimerSetTimestamp | ( | TCsiTimer * | pTimer, |
const uint32_t | Period | ||
) |
Set timestamp value (expiration timer) of certain timer.
The expiration time is the current time + the value in dwPeriod.
- Parameters
-
[in] pTimer Timer to change [in] Period The timer period (timestamp = current time + dwPeriod)
Referenced by CsiTimerRestart().
void CsiTimerSetTimestampAndStartTime | ( | TCsiTimer * | pTimer, |
const uint32_t | StartTime, | ||
const uint32_t | Period | ||
) |
This function calculates the expiration time from a start time value and the timer period (expiration time = start time + period)
- Parameters
-
[in] pTimer Timer to change [in] StartTime The start time in milliseconds [in] Period The timeout period of this timer in milliseconds
Referenced by CsiTimerSetTimestamp().