OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 2:53 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Bochs, PIT ch.2
PostPosted: Wed Jan 04, 2012 10:23 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 26, 2011 5:26 am
Posts: 32
Location: Moscow
Sorry for my english.

I try to calibrate APIC timer by using PIT ch.2.

Code:
; in real mode
cli

in      al,70h   ; turn off interrupts and NMI
or      al,80h
out      70h,al

mov      al,-1   ; no interrupts at all
out      21h,al
out      0a1h,al

; ...

; in long mode, after turn APIC on
sti         ; need to calibrate APIC timer

mov      dx,61h
in      al,dx
and      al,0fdh   ; turn off sound of speaker
or      al,1   ; connect speaker to PIT ch.2
out      dx,al

mov      al,10110000b ; ch.2 (10), r/w LSB/MSB (11), one-shot (000), binary (0)
out      43h,al
mov      al,9bh   ; LSB; 1193180/100 Hz = 11931 = 2e9bh
out      40h,al
mov      al,2eh   ; MSB
out      40h,al

@@:
in      al,dx
and      al,20h
jz      @b

In Qemu all OK, but in Bochs I get infinite loop. Where am I wrong?


Top
 Profile  
 
 Post subject: Re: Bochs, PIT ch.2
PostPosted: Wed Jan 04, 2012 2:01 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 26, 2011 5:26 am
Posts: 32
Location: Moscow
Solved :). Thanks to http://www.nondot.org/sabre/os/files/MiscHW/PIT.txt

Instead port 40h (ch.0) need to use 42h (ch.2). And control word must be 10110010b.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], thewrongchristian and 115 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group