khypervisor
v1
|
Go to the source code of this file.
Data Structures | |
struct | timer_channel |
Defines | |
#define | TIMER_MAX_CHANNEL_CALLBACKS 8 |
Typedefs | |
typedef void(* | timer_callback_t )(void *pdata) |
Enumerations | |
enum | timer_channel_t { timer_sched = 0, TIMER_NUM_MAX_CHANNELS } |
Functions | |
hvmm_status_t | timer_init (timer_channel_t channel) |
hvmm_status_t | timer_start (timer_channel_t channel) |
hvmm_status_t | timer_stop (timer_channel_t channel) |
hvmm_status_t | timer_set_interval (timer_channel_t channel, uint32_t interval_us) |
uint32_t | timer_get_interval (timer_channel_t channel) |
hvmm_status_t | timer_add_callback (timer_channel_t channel, timer_callback_t handler) |
hvmm_status_t | timer_remove_callback (timer_channel_t channel, timer_callback_t handler) |
uint64_t | timer_t2c (uint64_t time_us) |
#define TIMER_MAX_CHANNEL_CALLBACKS 8 |
typedef void(* timer_callback_t)(void *pdata) |
enum timer_channel_t |
Definition at line 31 of file timer.h.
{ timer_sched = 0, TIMER_NUM_MAX_CHANNELS } timer_channel_t;
hvmm_status_t timer_add_callback | ( | timer_channel_t | channel, |
timer_callback_t | handler | ||
) |
Definition at line 87 of file timer.c.
{ int i; hvmm_status_t result = HVMM_STATUS_BUSY; for( i = 0; i < TIMER_MAX_CHANNEL_CALLBACKS; i++ ) { if( _channels[channel].callbacks[i] == 0 ) { _channels[channel].callbacks[i] = callback; result = HVMM_STATUS_SUCCESS; break; } } return result; }
uint32_t timer_get_interval | ( | timer_channel_t | channel | ) |
Definition at line 82 of file timer.c.
{ return _channels[channel].interval_us; }
hvmm_status_t timer_init | ( | timer_channel_t | channel | ) |
Definition at line 43 of file timer.c.
{ int i; for( i = 0; i < TIMER_MAX_CHANNEL_CALLBACKS; i++ ) { _channels[channel].callbacks[i] = 0; } generic_timer_init(); return HVMM_STATUS_SUCCESS; }
hvmm_status_t timer_remove_callback | ( | timer_channel_t | channel, |
timer_callback_t | handler | ||
) |
Definition at line 101 of file timer.c.
{ int i; hvmm_status_t result = HVMM_STATUS_NOT_FOUND; for( i = 0; i < TIMER_MAX_CHANNEL_CALLBACKS; i++ ) { if ( _channels[channel].callbacks[i] == callback ) { _channels[channel].callbacks[i] = 0; result = HVMM_STATUS_SUCCESS; break; } } return result; }
hvmm_status_t timer_set_interval | ( | timer_channel_t | channel, |
uint32_t | interval_us | ||
) |
Definition at line 76 of file timer.c.
{ _channels[channel].interval_us = timer_t2c(interval_us); return HVMM_STATUS_SUCCESS; }
hvmm_status_t timer_start | ( | timer_channel_t | channel | ) |
Definition at line 54 of file timer.c.
{ if ( _timer_channel_num_callbacks( channel ) > 0 ) { generic_timer_set_callback(GENERIC_TIMER_HYP, &_timer_hw_callback ); generic_timer_set_tval(GENERIC_TIMER_HYP, _channels[channel].interval_us); generic_timer_enable_irq(GENERIC_TIMER_HYP); generic_timer_enable_int(GENERIC_TIMER_HYP); } return HVMM_STATUS_SUCCESS; }
hvmm_status_t timer_stop | ( | timer_channel_t | channel | ) |
Definition at line 70 of file timer.c.
{ generic_timer_disable_int(GENERIC_TIMER_HYP); return HVMM_STATUS_SUCCESS; }