Introduce the PIT commands as defines and used them in the pit timer

module. They should be used also in the bootloader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33220 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2009-09-21 10:14:15 +00:00
parent bf7902cb4b
commit cb35a69347
2 changed files with 38 additions and 8 deletions

View File

@ -7,6 +7,39 @@
#include <SupportDefs.h>
/* ports */
#define PIT_CTRL 0x43
#define PIT_CNT0 0x40
#define PIT_CNT1 0x41
#define PIT_CNT2 0x42
/* commands */
#define PIT_SELCH0 0x00
#define PIT_SELCH1 0x40
#define PIT_SELCH2 0x80
#define PIT_RWLOW 0x10
#define PIT_RWHIGH 0x20
#define PIT_RWBOTH 0x30
#define PIT_MD_INTON0 0x00
#define PIT_MD_ONESHOT 0x02
#define PIT_MD_RTGEN 0x04
#define PIT_MD_SQGEN 0x06
#define PIT_MD_SW_STRB 0x08
#define PIT_MD_HW_STRB 0x0A
#define PIT_BCD 0x01
#define PIT_LATCH 0x00
#define PIT_READ 0xF0
#define PIT_CNT 0x20
#define PIT_STAT 0x10
#define PIT_CLOCK_RATE 1193180
#define PIT_MAX_TIMER_INTERVAL (0xffff * 1000000ll / PIT_CLOCK_RATE)
/* Method Prototypes */
static int pit_get_prio(void);
static status_t pit_set_hardware_timer(bigtime_t relativeTimeout);

View File

@ -15,9 +15,6 @@
#include "pit.h"
#define PIT_CLOCK_RATE 1193180
#define PIT_MAX_TIMER_INTERVAL (0xffff * 1000000ll / PIT_CLOCK_RATE)
static bool sPITTimerInitialized = false;
struct timer_info gPITTimer = {
@ -55,9 +52,9 @@ pit_set_hardware_timer(bigtime_t relativeTimeout)
else
nextEventClocks = 0xffff;
out8(0x30, 0x43);
out8(nextEventClocks & 0xff, 0x40);
out8((nextEventClocks >> 8) & 0xff, 0x40);
out8(PIT_SELCH0 | PIT_RWBOTH | PIT_MD_INTON0, PIT_CTRL);
out8(nextEventClocks & 0xff, PIT_CNT0);
out8((nextEventClocks >> 8) & 0xff, PIT_CNT0);
arch_int_enable_io_interrupt(0);
return B_OK;
@ -78,9 +75,9 @@ pit_init(struct kernel_args *args)
if (sPITTimerInitialized) {
return B_OK;
}
install_io_interrupt_handler(0, &pit_timer_interrupt, NULL, 0);
pit_clear_hardware_timer();
pit_clear_hardware_timer();
sPITTimerInitialized = true;