RKH
|
Files | |
file | rkhtmr.h |
Specifies the interface of software timer services. | |
Data Structures | |
struct | RKH_TMR_T |
Defines the data structure used to maintain information that allows the timer-handling facility to update and expire software timers. More... | |
struct | RKHTmEvt |
It defines a time event that occurs at a specific duration. More... | |
Macros | |
#define | RKH_TMR_INIT(t_, e_, th_) rkh_tmr_init_((t_), (e_), (th_)) |
Initializes the previously allocated timer structure RKH_TMR_T. More... | |
#define | RKH_TMR_ONESHOT(t, sma, itick) rkh_tmr_start(t, sma, itick, 0) |
Start a timer as one-shot timer. More... | |
#define | RKH_TMR_PERIODIC(t, sma, itick, per) rkh_tmr_start((t), (sma), (itick), (per)) |
Start a timer as periodic timer. More... | |
Functions | |
void | rkh_tmr_start (RKH_TMR_T *t, const struct RKH_SMA_T *sma, RKH_TNT_T itick, RKH_TNT_T per) |
Start a timer. More... | |
rbool_t | rkh_tmr_stop (RKH_TMR_T *t) |
Stops a running timer. More... | |
void | rkh_tmr_init (void) |
Initializes the timer module. More... | |
void | rkh_tmr_get_info (RKH_TMR_T *t, RKH_TINFO_T *info) |
Retrieves performance information for a particular software timer. More... | |
void | rkh_tmr_clear_info (RKH_TMR_T *t) |
Clear performance information for a particular software timer. More... | |
#define RKH_TMR_INIT | ( | t_, | |
e_, | |||
th_ | |||
) | rkh_tmr_init_((t_), (e_), (th_)) |
Initializes the previously allocated timer structure RKH_TMR_T.
A timer is declared with the RKH_TMR_T data type and is defined with the RKH_TMR_INIT() service. The timer is initialized in a non-active state (stopped). In this case, a subsequent start service call is necessary to get the timer actually started. The following listing creates an application timer that executes "my_timer_hook" and send the event signal "TOUT" to "pwr" SMA after 100 timer-ticks.
[in] | t_ | pointer to previously allocated timer structure. Any software module intending to install a software timer must first allocate a timer structure RKH_TMR_T. |
[in] | e_ | event to be directly posted (using the FIFO policy) into the event queue of the target agreed state machine application at the timer expiration. |
[in] | th_ | hook function to be called at the timer expiration. This argument is optional, thus it could be declared as NULL or eliminated in compile-time with RKH_CFG_TMR_HOOK_EN. |
#define RKH_TMR_ONESHOT | ( | t, | |
sma, | |||
itick | |||
) | rkh_tmr_start(t, sma, itick, 0) |
Start a timer as one-shot timer.
This operation installs a previously created timer into the timer-handling facility. The timer begins running at the completion of this operation. The timer won't be re-started automatically. The following listing creates an application timer that executes "my_timer_hook" and send the event signal "TOUT" to "pwr" SMA after 100 timer-ticks.
[in] | t | pointer to previously created timer structure. |
[in] | sma | state machine application (SMA) that receives the timer event. |
[in] | itick | number of ticks for timer expiration. |
#define RKH_TMR_PERIODIC | ( | t, | |
sma, | |||
itick, | |||
per | |||
) | rkh_tmr_start((t), (sma), (itick), (per)) |
Start a timer as periodic timer.
This operation installs a previously created timer into the timer-handling facility. The timer begins running at the completion of this operation. Once the timeout will expire the timer will be re-started (re-triggered) again automatically. The following listing creates an application timer that executes "my_timer_hook" and send the event signal "TOUT" to "pwr" SMA after 100 timer-ticks initially and then after every 25 timer-ticks.
[in] | t | pointer to previously created timer structure. |
[in] | sma | state machine application (SMA) that receives the timer event. |
[in] | itick | number initial of ticks for timer expiration. |
[in] | per | number of ticks for all timer expirations after the first (expiration period). A zero for this parameter makes the timer a one-shot timer, otherwise, for periodic timers, any value in range. |
Start a timer.
This operation installs a previously created timer into the timer-handling facility. The timer begins running at the completion of this operation.
[in] | t | pointer to previously created timer structure. |
[in] | sma | state machine application (SMA) that receives the timer event. |
[in] | itick | number of ticks for timer expiration. |
[in] | per | number of ticks for all timer expirations after the first (expiration period). A zero for this parameter makes the timer an one-shot timer, otherwise, for periodic timers, any value in range. |
rbool_t rkh_tmr_stop | ( | RKH_TMR_T * | t | ) |
Stops a running timer.
This operation stops a timer by removing the currently running timer from the timer-handling facility. If the timer is already stopped, this service has no effect.
[in] | t | pointer to previously created timer structure. |
void rkh_tmr_init | ( | void | ) |
Initializes the timer module.
void rkh_tmr_get_info | ( | RKH_TMR_T * | t, |
RKH_TINFO_T * | info | ||
) |
Retrieves performance information for a particular software timer.
The user application must allocate an RKH_TINFO_T data structure used to receive data. The performance information is available during run-time for each of the RKH services. This can be useful in determining whether the application is performing properly, as well as helping to optimize the application. This information provides a "snapshot" a particular instant in time, i.e., when the service is invoked.
[in] | t | pointer to previously created timer structure. |
[in] | info | pointer to the buffer into which the performance information will be copied by reference. |
void rkh_tmr_clear_info | ( | RKH_TMR_T * | t | ) |
Clear performance information for a particular software timer.
[in] | t | pointer to previously created timer structure. |