CMOS: Difference between revisions

246 bytes added ,  26 days ago
m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
(→‎See Also: Added RTC page, moved external links to a new section)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(6 intermediate revisions by 5 users not shown)
Line 37:
as follows:
 
* <tt>outb (0x70, (NMI_disable_bit << 7) | (selected CMOS register number));</tt>
 
Once a register is selected, you either read the value of that register on Port 0x71 (with inb or an equivalent
function), or you write a new value to that register -- also on Port 0x71 (with outb, for example):
 
* <tt>val_8bit = inb (0x71);</tt>
 
Note1: Reading or writing Port 0x71 seems to default the "selected register" back to 0xD. So you need to
Line 207:
 
=== Reading from the CMOS ===
<sourcesyntaxhighlight lang="c">
ReadFromCMOS (unsigned char array [])
{
Line 229:
}
}
</syntaxhighlight>
</source>
 
=== Writing to the CMOS ===
<sourcesyntaxhighlight lang="c">
WriteTOCMOS(unsigned char array[])
{
Line 252:
}
}
</syntaxhighlight>
</source>
 
=== Reading All RTC Time and Date Registers ===
<sourcesyntaxhighlight lang="c">
#define CURRENT_YEAR 20142023 // Change this each year!
 
int century_register = 0x00; // Set by ACPI table parsing code if possible
Line 364:
}
}
</syntaxhighlight>
</source>
 
== See Also ==
Line 375:
* [http://web.stanford.edu/class/cs140/projects/pintos/specs/mc146818a.pdf MC146818A REAL-TIME CLOCK PLUS RAM (RTC)]
* [http://www.bitsavers.org/pdf/ibm/pc/ps2/PS2_Model_50_Technical_Reference_May88.pdf IBM PS/2 Technical Reference]
* [https://www.singlix.com/trdos/archive/pdf_archive/real-time-clock-nmi-enable-paper.pdf Intel Application Note: Accessing the Real Time Clock Registers and NMI Enable Bit]
 
[[Category:X86]]