SDK4.0
This document shows Ameba SDK 4.0 APIs
|
timer functions More...
Ameba Common | |
typedef struct gtimer_s | gtimer_t |
typedef void(* | gtimer_irq_handler) (uint32_t id) |
void | gtimer_init (gtimer_t *obj, uint32_t tid) |
Initializes the timer, including clock/function/timer registers. More... | |
void | gtimer_deinit (gtimer_t *obj) |
Deinitializes the timer, including clock/function/timer registers. More... | |
uint32_t | gtimer_read_tick (gtimer_t *obj) |
Read current timer tick in Gtimer clock(0~32768). More... | |
uint64_t | gtimer_read_us (gtimer_t *obj) |
Read current timer tick in microsecond. More... | |
void | gtimer_reload (gtimer_t *obj, uint32_t duration_us) |
Reload timer. More... | |
void | gtimer_start (gtimer_t *obj) |
Start the timer. More... | |
void | gtimer_start_one_shout (gtimer_t *obj, uint32_t duration_us, void *handler, uint32_t hid) |
Set up a shout timer, including clock/function/timer registers. More... | |
void | gtimer_start_periodical (gtimer_t *obj, uint32_t duration_us, void *handler, uint32_t hid) |
Set up a periodic timer, including clock/function/timer registers. More... | |
void | gtimer_stop (gtimer_t *obj) |
Stop the timer, including clock/function/timer registers. More... | |
Ameba Only | |
enum | { TIMER0 = 2, TIMER1 = 3, TIMER2 = 4, TIMER3 = 5, TIMER4 = 0, GTIMER_MAX = 5 } |
AmebaZ Only | |
enum | { TIMER0 = 2, TIMER1 = 3, TIMER2 = 4, TIMER3 = 5, GTIMER_MAX = 5 } |
timer functions
void gtimer_deinit | ( | gtimer_t * | obj | ) |
Deinitializes the timer, including clock/function/timer registers.
obj | gtimer object defined in application software. |
none |
void gtimer_init | ( | gtimer_t * | obj, |
uint32_t | tid | ||
) |
Initializes the timer, including clock/function/timer registers.
obj | gtimer object defined in application software. |
tid | the timer struct ID defined in gtimer structure. |
none |
uint32_t gtimer_read_tick | ( | gtimer_t * | obj | ) |
Read current timer tick in Gtimer clock(0~32768).
obj | gtimer object defined in application software. |
32 | bit tick time |
uint64_t gtimer_read_us | ( | gtimer_t * | obj | ) |
Read current timer tick in microsecond.
obj | gtimer object defined in application software. |
64 | bit tick time |
void gtimer_reload | ( | gtimer_t * | obj, |
uint32_t | duration_us | ||
) |
Reload timer.
obj | gtimer object defined in application software. |
duration_us | the time in microsecond of gtimer to reload. |
none |
void gtimer_start | ( | gtimer_t * | obj | ) |
Start the timer.
obj | gtimer object defined in application software. |
none |
void gtimer_start_one_shout | ( | gtimer_t * | obj, |
uint32_t | duration_us, | ||
void * | handler, | ||
uint32_t | hid | ||
) |
Set up a shout timer, including clock/function/timer registers.
obj | gtimer object defined in application software. |
duration_us | the period in microsecond of gtimer. |
handler | The Pointer to the function that program runs into when timer is up. |
hid | the timer struct ID defined in gtimer structure. |
none |
void gtimer_start_periodical | ( | gtimer_t * | obj, |
uint32_t | duration_us, | ||
void * | handler, | ||
uint32_t | hid | ||
) |
Set up a periodic timer, including clock/function/timer registers.
obj | gtimer object defined in application software. |
duration_us | the period in microsecond of gtimer. |
handler | The Pointer to function that program runs into when timer is up. |
hid | the timer struct ID defined in gtimer structure. |
none |
void gtimer_stop | ( | gtimer_t * | obj | ) |
Stop the timer, including clock/function/timer registers.
obj | gtimer object defined in application software. |
none |