khypervisor  v1
Defines | Enumerations | Functions
generic_timer/generic_timer_regs.h File Reference
#include "asm-arm_inline.h"
#include "armv7_p15.h"
#include "arch_types.h"
Include dependency graph for generic_timer_regs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define GENERIC_TIMER_CTRL_ENABLE   (1 << 0)
#define GENERIC_TIMER_CTRL_IMASK   (1 << 1)
#define GENERIC_TIMER_CTRL_ISTATUS   (1 << 2)
#define generic_timer_pcounter_read()   read_cntpct()
#define generic_timer_vcounter_read()   read_cntvct()

Enumerations

enum  {
  GENERIC_TIMER_REG_FREQ, GENERIC_TIMER_REG_HCTL, GENERIC_TIMER_REG_KCTL, GENERIC_TIMER_REG_HYP_CTRL,
  GENERIC_TIMER_REG_HYP_TVAL, GENERIC_TIMER_REG_HYP_CVAL, GENERIC_TIMER_REG_PHYS_CTRL, GENERIC_TIMER_REG_PHYS_TVAL,
  GENERIC_TIMER_REG_PHYS_CVAL, GENERIC_TIMER_REG_VIRT_CTRL, GENERIC_TIMER_REG_VIRT_TVAL, GENERIC_TIMER_REG_VIRT_CVAL,
  GENERIC_TIMER_REG_VIRT_OFF
}

Functions

static void generic_timer_reg_write (int reg, uint32_t val)
static uint32_t generic_timer_reg_read (int reg)
static void generic_timer_reg_write64 (int reg, uint64_t val)
static uint64_t generic_timer_reg_read64 (int reg)

Define Documentation

#define GENERIC_TIMER_CTRL_ENABLE   (1 << 0)

Definition at line 7 of file generic_timer_regs.h.

#define GENERIC_TIMER_CTRL_IMASK   (1 << 1)

Definition at line 8 of file generic_timer_regs.h.

#define GENERIC_TIMER_CTRL_ISTATUS   (1 << 2)

Definition at line 9 of file generic_timer_regs.h.

Definition at line 10 of file generic_timer_regs.h.

Definition at line 11 of file generic_timer_regs.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
GENERIC_TIMER_REG_FREQ 
GENERIC_TIMER_REG_HCTL 
GENERIC_TIMER_REG_KCTL 
GENERIC_TIMER_REG_HYP_CTRL 
GENERIC_TIMER_REG_HYP_TVAL 
GENERIC_TIMER_REG_HYP_CVAL 
GENERIC_TIMER_REG_PHYS_CTRL 
GENERIC_TIMER_REG_PHYS_TVAL 
GENERIC_TIMER_REG_PHYS_CVAL 
GENERIC_TIMER_REG_VIRT_CTRL 
GENERIC_TIMER_REG_VIRT_TVAL 
GENERIC_TIMER_REG_VIRT_CVAL 
GENERIC_TIMER_REG_VIRT_OFF 

Definition at line 14 of file generic_timer_regs.h.


Function Documentation

static uint32_t generic_timer_reg_read ( int  reg) [inline, static]

Definition at line 68 of file generic_timer_regs.h.

{
    uint32_t val;

    switch (reg) {
    case GENERIC_TIMER_REG_FREQ:
        val = read_cntfrq();
        break;
    case GENERIC_TIMER_REG_HCTL:
        val = read_cnthctl();
        break;
    case GENERIC_TIMER_REG_KCTL:
        val = read_cntkctl();
        break;
    case GENERIC_TIMER_REG_HYP_CTRL:
        val = read_cnthp_ctl();
        break;
    case GENERIC_TIMER_REG_HYP_TVAL:
        val = read_cnthp_tval();
        break;
    case GENERIC_TIMER_REG_PHYS_CTRL:
        val = read_cntp_ctl();
        break;
    case GENERIC_TIMER_REG_PHYS_TVAL:
        val = read_cntp_tval();
        break;
    case GENERIC_TIMER_REG_VIRT_CTRL:
        val = read_cntv_ctl();
        break;
    case GENERIC_TIMER_REG_VIRT_TVAL:
        val = read_cntv_tval();
        break;
    default:
        uart_print("Trying to read invalid generic-timer register\n\r");
        break;
    }

    return val;
}
static uint64_t generic_timer_reg_read64 ( int  reg) [inline, static]

Definition at line 131 of file generic_timer_regs.h.

{
    uint64_t val;

    switch (reg) {
    case GENERIC_TIMER_REG_HYP_CVAL:
        val = read_cnthp_cval();
        break;
    case GENERIC_TIMER_REG_PHYS_CVAL:
        val = read_cntp_tval();
        break;
    case GENERIC_TIMER_REG_VIRT_CVAL:
        val = read_cntv_cval();
        break;
    case GENERIC_TIMER_REG_VIRT_OFF:
        val = read_cntvoff();
        break;
    default:
        uart_print("Trying to read invalid generic-timer register\n\r");
        break;
    }

    return val;
}
static void generic_timer_reg_write ( int  reg,
uint32_t  val 
) [inline, static]

Definition at line 30 of file generic_timer_regs.h.

{
    switch (reg) {
    case GENERIC_TIMER_REG_FREQ:
        write_cntfrq(val);
        break;
    case GENERIC_TIMER_REG_HCTL:
        write_cnthctl(val);
        break;
    case GENERIC_TIMER_REG_KCTL:
        write_cntkctl(val);
        break;
    case GENERIC_TIMER_REG_HYP_CTRL:
        write_cnthp_ctl(val);
        break;
    case GENERIC_TIMER_REG_HYP_TVAL:
        write_cnthp_tval(val);
        break;
    case GENERIC_TIMER_REG_PHYS_CTRL:
        write_cntp_ctl(val);
        break;
    case GENERIC_TIMER_REG_PHYS_TVAL:
        write_cntp_tval(val);
        break;
    case GENERIC_TIMER_REG_VIRT_CTRL:
        write_cntv_ctl(val);
        break;
    case GENERIC_TIMER_REG_VIRT_TVAL:
        write_cntv_tval(val);
        break;
    default:
        uart_print("Trying to write invalid generic-timer register\n\r");
        break;
    }

    isb();
}
static void generic_timer_reg_write64 ( int  reg,
uint64_t  val 
) [inline, static]

Definition at line 108 of file generic_timer_regs.h.

{
    switch (reg) {
    case GENERIC_TIMER_REG_HYP_CVAL:
        write_cnthp_cval(val);
        break;
    case GENERIC_TIMER_REG_PHYS_CVAL:
        write_cntp_cval(val);
        break;
    case GENERIC_TIMER_REG_VIRT_CVAL:
        write_cntv_cval(val);
        break;
    case GENERIC_TIMER_REG_VIRT_OFF:
        write_cntvoff(val);
        break;
    default:
        uart_print("Trying to write invalid generic-timer register\n\r");
        break;
    }

    isb();
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines