|
ginnOS
The reference: libc, the libraries and the kernel
|
CMOS real-time clock (MC146818 compatible). More...
#include "rtc.h"#include "kernel/sync/spinlock.h"#include "arch/arch.h"#include "arch/x86/cpu/io.h"Enumerations | |
| enum | { CMOS_ADDRESS = 0x70 , CMOS_DATA = 0x71 , REG_SECONDS = 0x00 , REG_MINUTES = 0x02 , REG_HOURS = 0x04 , REG_DAY = 0x07 , REG_MONTH = 0x08 , REG_YEAR = 0x09 , REG_STATUS_A = 0x0A , REG_STATUS_B = 0x0B , REG_CENTURY = 0x32 , STATUS_A_UPDATING = 0x80 , STATUS_B_BINARY = 0x04 , STATUS_B_24_HOUR = 0x02 , HOURS_PM = 0x80 , NMI_DISABLE = 0x80 } |
Functions | |
| bool | rtc_read_unix_time (uint32_t *seconds_out) |
| read the date and time from the CMOS clock (taken as UTC). | |
CMOS real-time clock (MC146818 compatible).
the clock keeps seconds, minutes, hours, day, month and year in CMOS registers, in BCD or binary and 12 or 24 hour form (status register B says which). they change once a second; the registers are read until two reads agree, so a read is never torn by an update.
| anonymous enum |