Outportb ( 0x70, 0x8A ) // reset index to A Outportb ( 0x70, 0x8A ) // set index to register A, disable NMI char prev =inportb ( 0x71 ) // get initial value of register A Rate &= 0x0F // rate must be above 2 and not over 15 To write 0x20 to Status Register A you would do this: They areĪt offset 0xA, 0xB, and 0xC in the CMOS RAM. They are called RTC Status Register A, B, and C. Only three bytes ofĬMOS RAM are used to control the RTC periodic interrupt function. Port 0x71 is used to read or write from/to that byte of CMOS configuration space. Port 0x70 is used to specify an index or "register number",Īnd to disable NMI. The 2 IO ports used for the RTC and CMOS are 0x70 and 0x71. See the NMI page for more information about disabling and enabling it, and the effects of it. So even a cold reboot may not be enough to get the RTC out of an undefined state! The RTC is never initialized by BIOS, and it is backed This would usually not be too big a deal, except for two things. This is because if an interrupt happens, the RTC may be left in an "undefined" (non functional) state. When programming the RTC, it is extremely imperative that the NMI (non-maskable-interrupt) and other interrupts are disabled. If you turn on the RTC interrupts, the RTC will periodically generate IRQ 8.Īvoiding NMI and Other Interrupts While Programming On most machines however, the RTC interrupt rate can not go higher than 8 kHz. If you need an interrupt frequency other than 1024 Hz, the RTC can theoretically generate 15 interrupt rates between 2 HzĪnd 32768 Hz. The output (interrupt) divider frequency is by default set so that there is an interrupt rate of 1024 Hz. The chip also has a "divider" register that will generate other frequencies from For this reason, it is strongly recommended This value, but this is the only base frequency that will keep proper time. The base frequency is pre-programmed at 32.768 kHz. The RTC is capable of multiple frequencies. The rest of this article covers the use of RTC interrupts. If you simply want information about reading the date/time from the RTC, then please see the CMOS article. Within the chip is also the 64 bytes of CMOS RAM. It is the chip that keeps your computer's clock up-to-date. 3.1 Avoiding NMI and Other Interrupts While ProgrammingĪ typical OS will use the APIC or PIT for timing purposes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |