tte_hw_timer.h File Reference

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.

Detailed Description

Low-level timer driver for TTE protocol layer.

Definition in file tte_hw_timer.h.


Typedef Documentation

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.


Function Documentation

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.

Returns:
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.

Parameters:
ts - Pointer to the buffer where the current time stamp shall be stored.
Returns:
int32_t hw_timer_init ( void   ) 

Initialize the timer.

Initialize the timer module. The timer is initially stopped.

Returns:
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.

Parameters:
time - Time in timer ticks when the timer expires.
Returns:
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.

Parameters:
time - Time in timer ticks until the timer expires.
Returns:
hwtime_t hwtime_add_ns ( hwtime_t  ht,
int64_t  ns 
)

Add a number of nanoseconds to a value in hwtime_t format.

Parameters:
ht [in] first operand of additon
ns [in] second operand of addition (signed, in nanoseconds)
Returns:
the product of the addition.
hwtime_t hwtime_from_ns ( int64_t  ns  ) 

Convert a number of nanoseconds into hwtime_t format.

int64_t hwtime_sub ( hwtime_t  ht1,
hwtime_t  ht2 
)

Subtract two time values and return the difference in nanoseconds.

Parameters:
ht1 [in] first time value
ht2 [in] second time value
Returns:
Result of (ht1 - ht2) converted into nanoseconds.
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.

Note:
The TTEthernet core is irq-safe, therefore, the callback should run with IRQs (preemption) disabled.
Parameters:
ctrl - The value is the controller ID.
cb - The timer callback that shall be registered.
Returns:
Generated on Tue Nov 29 14:09:19 2011 for TTEthernet Model for INET Framework by  doxygen 1.6.3