1/* 2 * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _KERNEL_ARCH_x86_TIMERS_PIT_H 6#define _KERNEL_ARCH_x86_TIMERS_PIT_H 7 8#include <SupportDefs.h> 9 10/* ports */ 11#define PIT_CTRL 0x43 12#define PIT_CNT0 0x40 13#define PIT_CNT1 0x41 14#define PIT_CNT2 0x42 15 16/* commands */ 17#define PIT_SELCH0 0x00 18#define PIT_SELCH1 0x40 19#define PIT_SELCH2 0x80 20 21#define PIT_RWLOW 0x10 22#define PIT_RWHIGH 0x20 23#define PIT_RWBOTH 0x30 24 25#define PIT_MD_INTON0 0x00 26#define PIT_MD_ONESHOT 0x02 27#define PIT_MD_RTGEN 0x04 28#define PIT_MD_SQGEN 0x06 29#define PIT_MD_SW_STRB 0x08 30#define PIT_MD_HW_STRB 0x0A 31 32#define PIT_BCD 0x01 33 34#define PIT_LATCH 0x00 35 36#define PIT_READ 0xF0 37#define PIT_CNT 0x20 38#define PIT_STAT 0x10 39 40#define PIT_CLOCK_RATE 1193180 41#define PIT_MAX_TIMER_INTERVAL (0xffff * 1000000ll / PIT_CLOCK_RATE) 42 43/* Method Prototypes */ 44static int pit_get_prio(void); 45static status_t pit_set_hardware_timer(bigtime_t relativeTimeout); 46static status_t pit_clear_hardware_timer(void); 47static status_t pit_init(struct kernel_args *args); 48 49#endif /* _KERNEL_ARCH_x86_TIMERS_PIT_H */ 50