khypervisor  v1
include/generic_timer.h
Go to the documentation of this file.
00001 #ifndef __GENERIC_TIMER_H__
00002 #define __GENERIC_TIMER_H__
00003 
00004 #include "armv7_p15.h"
00005 #include "gic.h"
00006 
00007 #include <log/uart_print.h>
00008 
00009 typedef enum {
00010     GENERIC_TIMER_HYP,      /* IRQ 26 */
00011     GENERIC_TIMER_VIR,      /* IRQ 27 */
00012     GENERIC_TIMER_NSP,      /* IRQ 30 */
00013     GENERIC_TIMER_NUM_TYPES
00014 } generic_timer_type_t;
00015 
00016 typedef void (*generic_timer_callback_t)(void *pdata);
00017 
00018 /* Calling this function is required only once in the entire system. */
00019 hvmm_status_t generic_timer_init();
00020 /* Enable the timer interrupt. Specified by timer type */ 
00021 hvmm_status_t generic_timer_enable_int(generic_timer_type_t type);
00022 /* Disable the timer. Specified by timer type */
00023 hvmm_status_t generic_timer_disable_int(generic_timer_type_t type);
00024 /* Sets time interval. Converts from microseconds to count and sets time interval.*/
00025 hvmm_status_t generic_timer_set_tval(generic_timer_type_t type, uint32_t tval);
00026 /* Enables timer irq.  */
00027 hvmm_status_t generic_timer_enable_irq(generic_timer_type_t type);
00028 /* Adds callback funtion. Called when occur timer interrupt */
00029 hvmm_status_t generic_timer_set_callback(generic_timer_type_t type, generic_timer_callback_t callback);
00030 
00031 #endif
00032 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines