feat(kernel): configure pit
This commit is contained in:
parent
4105a83947
commit
85d09cbbf6
0
kernel/dev/at/cd.inc
Normal file
0
kernel/dev/at/cd.inc
Normal 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
|
||||
|
|
|
@ -77,6 +77,7 @@ kmain:
|
|||
|
||||
call idt_setup
|
||||
|
||||
mov ax, 100 ; 100Hz
|
||||
call pit_init
|
||||
|
||||
call bio_init
|
||||
|
|
Loading…
Reference in a new issue