Low-level timer driver for TTE protocol layer. More...
#include "tte_target.h"
#include "tte_common.h"
#include "tte_environment.h"
Go to the source code of this file.
Typedefs | |
typedef TTE_TIMER_TYPE | hwtime_t |
This type can hold the value of a timer. Implementation specific structure, defined in tte_target.h. | |
typedef void(* | tte_isr_callback_t )(uint8_t ctrl) |
This type defines the callback for the interrupt service routine. | |
Functions | |
hwtime_t | hwtime_from_ns (int64_t ns) |
int64_t | hwtime_to_ns (hwtime_t ht) |
hwtime_t | hwtime_add_ns (hwtime_t ht, int64_t ns) |
int64_t | hwtime_sub (hwtime_t ht1, hwtime_t ht2) |
int32_t | hw_timer_disable_timer (void) |
Disable the programmable timer. | |
void | hw_timer_exit (void) |
Free all allocated resources and stop the timer. | |
int32_t | hw_timer_get_timestamp (hwtime_t *ts) |
Get the current time stamp. | |
int32_t | hw_timer_init (void) |
Initialize the timer. | |
int32_t | hw_timer_start_timer_abs (hwtime_t time) |
Program the timer to expire at a specified absolute time. | |
int32_t | hw_timer_start_timer_rel (hwtime_t time) |
Program the timer to expire after a specified time interval. | |
int32_t | tte_register_timer_callback (uint8_t ctrl, tte_isr_callback_t cb) |
Register a timer callback. |
Low-level timer driver for TTE protocol layer.
Definition in file tte_hw_timer.h.
typedef TTE_TIMER_TYPE hwtime_t |
This type can hold the value of a timer. Implementation specific structure, defined in tte_target.h.
Definition at line 34 of file tte_hw_timer.h.
typedef void(* tte_isr_callback_t)(uint8_t ctrl) |
This type defines the callback for the interrupt service routine.
Definition at line 69 of file tte_hw_timer.h.
int32_t hw_timer_disable_timer | ( | void | ) |
Disable the programmable timer.
Stop the timer and prevent any interrupt generation. The timer can be restarted by calling the hw_timer_start_timer function.
void hw_timer_exit | ( | void | ) |
Free all allocated resources and stop the timer.
int32_t hw_timer_get_timestamp | ( | hwtime_t * | ts | ) |
Get the current time stamp.
Capture the current time from the free-running clock into the supplied argument. The value is in clock ticks.
ts | - Pointer to the buffer where the current time stamp shall be stored. |
int32_t hw_timer_init | ( | void | ) |
Initialize the timer.
Initialize the timer module. The timer is initially stopped.
int32_t hw_timer_start_timer_abs | ( | hwtime_t | time | ) |
Program the timer to expire at a specified absolute time.
The registered callback function is executed when the timer expires.
time | - Time in timer ticks when the timer expires. |
int32_t hw_timer_start_timer_rel | ( | hwtime_t | time | ) |
Program the timer to expire after a specified time interval.
The registered callback function is executed when the timer expires.
time | - Time in timer ticks until the timer expires. |
Add a number of nanoseconds to a value in hwtime_t format.
ht | [in] first operand of additon | |
ns | [in] second operand of addition (signed, in nanoseconds) |
hwtime_t hwtime_from_ns | ( | int64_t | ns | ) |
Convert a number of nanoseconds into hwtime_t format.
Subtract two time values and return the difference in nanoseconds.
ht1 | [in] first time value | |
ht2 | [in] second time value |
int64_t hwtime_to_ns | ( | hwtime_t | ht | ) |
Convert a time value in hwtime_t format into nanoseconds. Note, that upper bits of the time value may be lost during the conversion when the value does not fit into 32 bits.
int32_t tte_register_timer_callback | ( | uint8_t | ctrl, | |
tte_isr_callback_t | cb | |||
) |
Register a timer callback.
Register a function that will be called when a timer interrupt is generated. This will be used by the TTE core protocol in order to execute the TTE state machine.
ctrl | - The value is the controller ID. | |
cb | - The timer callback that shall be registered. |