Timer implementation for timeouts and time measuring. More...
#include "csi_plfabstr.h"
Data Structures | |
struct | TCsiTimer |
A timer object. More... | |
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 for timeouts and time measuring.
- Date
- 2009/08/25 This module implements a polling timer. The application initializes the polling timer with a timestamp value. The timestamp value is the expiration time of the timer. After initialization the application can check the timer for expiration.
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().