39 lines
797 B
C
39 lines
797 B
C
|
#ifndef PIT_H
|
||
|
#define PIT_H
|
||
|
|
||
|
#define BCD_SET 0x1
|
||
|
|
||
|
#define PIT_MODE_0 (0x0 << 1)
|
||
|
#define PIT_MODE_1 (0x1 << 1)
|
||
|
#define PIT_MODE_2 (0x2 << 1)
|
||
|
#define PIT_MODE_3 (0x3 << 1)
|
||
|
#define PIT_MODE_4 (0x4 << 1)
|
||
|
#define PIT_MODE_5 (0x5 << 1)
|
||
|
|
||
|
#define PIT_RW_SPECIAL (0x0 << 4)
|
||
|
#define PIT_RW_LSB (0x1 << 4)
|
||
|
#define PIT_RW_MSB (0x2 << 4)
|
||
|
#define PIT_RW_LSB_MSB (0x3 << 4)
|
||
|
|
||
|
#define PIT_SET_COUNTER_0 (0x0 << 6)
|
||
|
#define PIT_SET_COUNTER_1 (0x1 << 6)
|
||
|
#define PIT_SET_COUNTER_2 (0x2 << 6)
|
||
|
|
||
|
// port definition
|
||
|
#define PIT_COUNTER_0 0x40
|
||
|
#define PIT_COUNTER_1 0x41
|
||
|
#define PIT_COUNTER_2 0x42
|
||
|
#define PIT_CONTROL_REG 0x43
|
||
|
|
||
|
// to get 100Hz
|
||
|
#define DIVIDER_LO (11931 & 0xff)
|
||
|
#define DIVIDER_HI (11931 >> 8)
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
void pit_handler(void);
|
||
|
void init_pit(void);
|
||
|
uint64_t gettick(void);
|
||
|
|
||
|
#endif
|