Xen Test Framework
Macros | Functions | Variables
hpet.h File Reference

x86 HPET register definitions and utility functions. More...

#include <xtf/numbers.h>
#include <xtf/macro_magic.h>
#include <xtf/types.h>
+ Include dependency graph for hpet.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HPET_ID   0x0
 
#define HPET_ID_MAX_PERIOD   0x05f5e100
 
#define HPET_ID_NUMBER_MASK   0x1f00
 
#define HPET_CFG   0x010
 
#define HPET_CFG_ENABLE   0x001
 
#define HPET_COUNTER   0x0f0
 
#define HPET_Tn_CFG(n)   (0x100 + (n) * 0x20)
 
#define HPET_Tn_CMP(n)   (0x108 + (n) * 0x20)
 
#define HPET_DEFAULT_BASE   0xfed00000
 

Functions

int hpet_init (void)
 Discover and initialise the HPET. More...
 
static uint32_t hpet_read32 (unsigned int reg)
 
static uint64_t hpet_read64 (unsigned int reg)
 
static void hpet_write32 (unsigned int reg, uint32_t val)
 
static void hpet_write64 (unsigned int reg, uint64_t val)
 
static uint64_t hpet_read_counter (void)
 Fetch the HPET main counter register. More...
 
void hpet_init_timer (unsigned int nr, unsigned int irq, uint64_t ticks, bool level, bool periodic, bool mode32bit)
 Setup and enable a specific HPET timer. More...
 

Variables

unsigned int hpet_nr_timers
 

Detailed Description

x86 HPET register definitions and utility functions.

NB: assume the HPET is at it's default address.

Definition in file hpet.h.

Macro Definition Documentation

◆ HPET_ID

#define HPET_ID   0x0

Definition at line 16 of file hpet.h.

◆ HPET_ID_MAX_PERIOD

#define HPET_ID_MAX_PERIOD   0x05f5e100

Definition at line 17 of file hpet.h.

◆ HPET_ID_NUMBER_MASK

#define HPET_ID_NUMBER_MASK   0x1f00

Definition at line 18 of file hpet.h.

◆ HPET_CFG

#define HPET_CFG   0x010

Definition at line 20 of file hpet.h.

◆ HPET_CFG_ENABLE

#define HPET_CFG_ENABLE   0x001

Definition at line 21 of file hpet.h.

◆ HPET_COUNTER

#define HPET_COUNTER   0x0f0

Definition at line 23 of file hpet.h.

◆ HPET_Tn_CFG

#define HPET_Tn_CFG (   n)    (0x100 + (n) * 0x20)

Definition at line 25 of file hpet.h.

◆ HPET_Tn_CMP

#define HPET_Tn_CMP (   n)    (0x108 + (n) * 0x20)

Definition at line 27 of file hpet.h.

◆ HPET_DEFAULT_BASE

#define HPET_DEFAULT_BASE   0xfed00000

Definition at line 29 of file hpet.h.

Function Documentation

◆ hpet_init()

int hpet_init ( void  )

Discover and initialise the HPET.

May fail if there is no HPET.

Definition at line 29 of file hpet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hpet_read32()

static uint32_t hpet_read32 ( unsigned int  reg)
inlinestatic

Definition at line 39 of file hpet.h.

+ Here is the caller graph for this function:

◆ hpet_read64()

static uint64_t hpet_read64 ( unsigned int  reg)
inlinestatic

Definition at line 44 of file hpet.h.

+ Here is the caller graph for this function:

◆ hpet_write32()

static void hpet_write32 ( unsigned int  reg,
uint32_t  val 
)
inlinestatic

Definition at line 49 of file hpet.h.

+ Here is the caller graph for this function:

◆ hpet_write64()

static void hpet_write64 ( unsigned int  reg,
uint64_t  val 
)
inlinestatic

Definition at line 54 of file hpet.h.

+ Here is the caller graph for this function:

◆ hpet_read_counter()

static uint64_t hpet_read_counter ( void  )
inlinestatic

Fetch the HPET main counter register.

Definition at line 62 of file hpet.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hpet_init_timer()

void hpet_init_timer ( unsigned int  nr,
unsigned int  irq,
uint64_t  ticks,
bool  level,
bool  periodic,
bool  mode32bit 
)

Setup and enable a specific HPET timer.

Definition at line 49 of file hpet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ hpet_nr_timers

unsigned int hpet_nr_timers

Definition at line 13 of file hpet.c.