matos/drivers/pit.h

18 lines
583 B
C
Raw Permalink Normal View History

2018-07-20 15:41:58 +02:00
#pragma once
2020-04-27 23:08:36 +02:00
#include "cpu_context.h"
2018-07-20 15:41:58 +02:00
// C.f https://wiki.osdev.org/PIT
#define PIT_FREQ 1193182
#define PIT_CHAN_0 0x40 // IRQ0
#define PIT_CHAN_1 0x41 // Used for DRAM refresh. Not used anymore
#define PIT_CHAN_2 0x42 // PC Speaker
#define PIT_CMD 0x43
// Cmd are
// 7-6: select channel. 0 ->chan0, 1 -> chan1, 2 -> chan 2, 3 -> read back
// 5-4: access mode. 0 -> latch count; 1 -> low value only; 2 -> high value only;
// 3 -> low then high 3-1: mode. See https://wiki.osdev.org/PIT
2018-11-08 22:08:27 +01:00
int pitSetup(unsigned int freq);
2020-04-27 23:08:36 +02:00
struct cpu_state *pitIrqHandler(struct cpu_state *prevCpu);