khypervisor  v1
Data Structures | Defines | Typedefs | Enumerations | Functions
timer.h File Reference
#include "hvmm_types.h"
#include "arch_types.h"
Include dependency graph for timer.h:
This graph shows which files directly or indirectly include this file:

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 Documentation

Definition at line 29 of file timer.h.


Typedef Documentation

typedef void(* timer_callback_t)(void *pdata)

Definition at line 36 of file timer.h.


Enumeration Type Documentation

Enumerator:
timer_sched 
TIMER_NUM_MAX_CHANNELS 

Definition at line 31 of file timer.h.


Function Documentation

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;
}

Definition at line 82 of file timer.c.

{
    return _channels[channel].interval_us;
}

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;
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

Definition at line 70 of file timer.c.

Here is the call graph for this function:

uint64_t timer_t2c ( uint64_t  time_us)

Definition at line 115 of file timer.c.

{
    return time_us * COUNT_PER_USEC;
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines