feat(kernel): configure pit

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-07-28 11:09:24 +02:00
parent 4105a83947
commit 85d09cbbf6
3 changed files with 23 additions and 0 deletions

0
kernel/dev/at/cd.inc Normal file
View file

View file

@ -8,8 +8,30 @@ PIT_CHANNEL1 = 0x40
PIT_CHANNEL2 = 0x42
PIT_COMMAND = 0x43
PIT_MAX_FREQ = 1193180
;; Function: pit_init
;;
;; In:
;; AX - freq
pit_init:
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
ret
;; Function: pit_irq

View file

@ -77,6 +77,7 @@ kmain:
call idt_setup
mov ax, 100 ; 100Hz
call pit_init
call bio_init