SDK3.5
This document shows Ameba SDK 3.5 APIs
Enumerator
TIMER

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
}
 

Detailed Description

timer functions

Function Documentation

void gtimer_deinit ( gtimer_t *  obj)

Deinitializes the timer, including clock/function/timer registers.

Parameters
objgtimer object defined in application software.
Return values
none
void gtimer_init ( gtimer_t *  obj,
uint32_t  tid 
)

Initializes the timer, including clock/function/timer registers.

Parameters
objgtimer object defined in application software.
tidthe timer struct ID defined in gtimer structure.
Return values
none
uint32_t gtimer_read_tick ( gtimer_t *  obj)

Read current timer tick in Gtimer clock(0~32768).

Parameters
objgtimer object defined in application software.
Return values
32bit tick time
uint64_t gtimer_read_us ( gtimer_t *  obj)

Read current timer tick in microsecond.

Parameters
objgtimer object defined in application software.
Return values
64bit tick time
void gtimer_reload ( gtimer_t *  obj,
uint32_t  duration_us 
)

Reload timer.

Parameters
objgtimer object defined in application software.
duration_usthe time in microsecond of gtimer to reload.
Return values
none
void gtimer_start ( gtimer_t *  obj)

Start the timer.

Parameters
objgtimer object defined in application software.
Return values
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.

Parameters
objgtimer object defined in application software.
duration_usthe period in microsecond of gtimer.
handlerThe Pointer to the function that program runs into when timer is up.
hidthe timer struct ID defined in gtimer structure.
Return values
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.

Parameters
objgtimer object defined in application software.
duration_usthe period in microsecond of gtimer.
handlerThe Pointer to function that program runs into when timer is up.
hidthe timer struct ID defined in gtimer structure.
Return values
none
void gtimer_stop ( gtimer_t *  obj)

Stop the timer, including clock/function/timer registers.

Parameters
objgtimer object defined in application software.
Return values
none