OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Suggested addition to Bran's Known Bugs
PostPosted: Tue Jun 08, 2010 11:35 pm 
Offline
Member
Member

Joined: Wed Apr 28, 2010 9:07 am
Posts: 55
I understand the tutorial is located elsewhere, but it is referenced here and there is a Known Bugs page here.

In Bran's discussion of the Programmable Interval Timer, there is the following function. I have aded the comment and the first line of code.
Code:

void timer_phase(int hz)
{
/*
* The low order 16 bits of divisor is sent to the PIT to load a 16 bit countdown timer.
* Any value of hz that results in divisor being greater than 64k will produce erratic
* results because only the low 16 bits of the resulting divisor will be used.
* The smallest value of hz acceptable is thus 19.
* The bios usually will set the countdown register at the largest possible value
* 64k-1, resulting in an interrupt frequency of 18.2065 Hz.
* see http://wiki.osdev.org/Programmable_interval_timer
*/
    if (hz < 19) hz = 19;                /* see comment above */
    int divisor = 1193180 / hz;       /* Calculate our divisor */
    outportb(0x43, 0x36);             /* Set our command byte 0x36 */
    outportb(0x40, divisor & 0xFF);   /* Set low byte of divisor */
    outportb(0x40, divisor >> 8);     /* Set high byte of divisor */
}


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot] and 245 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