StupidOS/kernel/dev/at/pit.inc

52 lines
649 B
PHP
Raw Normal View History

2024-07-14 13:11:28 +00:00
;; File: pit.inc
;;
;; Usefull links:
;; - <http://www.osdever.net/bkerndev/Docs/pit.htm>
PIT_CHANNEL0 = 0x40
PIT_CHANNEL1 = 0x40
PIT_CHANNEL2 = 0x42
PIT_COMMAND = 0x43
2024-07-28 09:09:24 +00:00
PIT_MAX_FREQ = 1193180
2024-07-14 13:11:28 +00:00
;; Function: pit_init
2024-07-28 09:09:24 +00:00
;;
;; In:
;; AX - freq
2024-07-14 13:11:28 +00:00
pit_init:
2024-07-28 09:09:24 +00:00
movzx eax, ax
xor edx, edx
mov ecx, PIT_MAX_FREQ
div ecx
push eax
mov dx, PIT_COMMAND
mov al, 0x34 ;channel 0, lobyte/hibyte, rate generator
pop eax
mov dx, PIT_CHANNEL0
out dx, al
xchg al, ah
out dx, al
2024-07-14 13:11:28 +00:00
ret
;; Function: pit_irq
pit_irq:
pusha
;mov esi, szMsgPitIRQ
;call klog
mov al, PIC_EOI
out PIC1_COMMAND, al
popa
iret
szMsgPitIRQ db "PIT: IRQ", 0