|
AquilaOS documentation
How it works, and its code
|
x86: the PC's real time clock, in the CMOS: the date and time, which the kernel reads to set its clock at boot (arch_time_get()). More...
Go to the source code of this file.
Data Structures | |
| struct | cmos_rtc |
| The real time clock's date and time, as it keeps them. More... | |
Macros | |
| #define | RTC_SEC 0x00 |
| #define | RTC_MIN 0x02 |
| #define | RTC_HRS 0x04 |
| #define | RTC_WD 0x06 |
| #define | RTC_DOM 0x07 |
| #define | RTC_MON 0x08 |
| #define | RTC_YR 0x09 |
| #define | RTC_SA 0x0A |
| #define | RTC_SB 0x0B |
| #define | RTC_UIP 0x80 |
| #define | RTC_24H 0x02 |
| #define | RTC_BIN 0x04 |
| #define | RTC_PM 0x80 |
Functions | |
| static uint8_t | cmos_reg_read (uint8_t reg) |
| Reads a CMOS register. | |
| static uint8_t | bcd_to_bin (uint8_t bcd) |
| Converts a BCD byte to binary. | |
| static int | cmos_time (struct cmos_rtc *rtc) |
| Reads the real time clock's date and time, in binary and in 24-hour time. | |
| int | arch_time_get (struct timespec *ts) |
| Reads the date and time from the real time clock. | |
| int | x86_cmos_setup (struct ioaddr *ioaddr) |
| Sets where the CMOS's ports are. | |
Variables | |
| static struct ioaddr | cmos |
x86: the PC's real time clock, in the CMOS: the date and time, which the kernel reads to set its clock at boot (arch_time_get()).
The year is taken to be in the 2000s (the century register isn't read).
Definition in file cmos.c.
| #define RTC_24H 0x02 |
Definition at line 22 of file cmos.c.
Referenced by cmos_time().
| #define RTC_BIN 0x04 |
Definition at line 23 of file cmos.c.
Referenced by cmos_time().
| #define RTC_DOM 0x07 |
Definition at line 15 of file cmos.c.
Referenced by cmos_time().
| #define RTC_HRS 0x04 |
Definition at line 13 of file cmos.c.
Referenced by cmos_time().
| #define RTC_MIN 0x02 |
Definition at line 12 of file cmos.c.
Referenced by cmos_time().
| #define RTC_MON 0x08 |
Definition at line 16 of file cmos.c.
Referenced by cmos_time().
| #define RTC_PM 0x80 |
Definition at line 24 of file cmos.c.
Referenced by cmos_time().
| #define RTC_SA 0x0A |
Definition at line 18 of file cmos.c.
Referenced by cmos_time().
| #define RTC_SB 0x0B |
Definition at line 19 of file cmos.c.
Referenced by cmos_time().
| #define RTC_SEC 0x00 |
Definition at line 11 of file cmos.c.
Referenced by cmos_time().
| #define RTC_UIP 0x80 |
Definition at line 21 of file cmos.c.
Referenced by cmos_time().
| #define RTC_WD 0x06 |
Definition at line 14 of file cmos.c.
Referenced by cmos_time().
| #define RTC_YR 0x09 |
Definition at line 17 of file cmos.c.
Referenced by cmos_time().
| int arch_time_get | ( | struct timespec * | ts | ) |
Reads the date and time from the real time clock.
| ts | set to the time since the epoch, to the second (tv_nsec is 0) |
Definition at line 100 of file cmos.c.
References arch_time_get(), cmos_time(), cmos_rtc::hrs, cmos_rtc::mday, cmos_rtc::min, cmos_rtc::mon, cmos_rtc::sec, timespec::tv_nsec, timespec::tv_sec, and cmos_rtc::yr.
Converts a BCD byte to binary.
Definition at line 48 of file cmos.c.
References bcd_to_bin().
Referenced by bcd_to_bin(), and cmos_time().
Reads a CMOS register.
Bit 7 of the index port disables NMIs while it is set, so it is left clear: setting it would mask them from then on.
Definition at line 30 of file cmos.c.
References cmos, cmos_reg_read(), io_in8(), and io_out8().
Referenced by cmos_reg_read(), and cmos_time().
|
static |
Reads the real time clock's date and time, in binary and in 24-hour time.
Returns 0.
Definition at line 55 of file cmos.c.
References bcd_to_bin(), cmos_reg_read(), cmos_time(), cmos_rtc::hrs, cmos_rtc::mday, cmos_rtc::min, cmos_rtc::mon, RTC_24H, RTC_BIN, RTC_DOM, RTC_HRS, RTC_MIN, RTC_MON, RTC_PM, RTC_SA, RTC_SB, RTC_SEC, RTC_UIP, RTC_WD, RTC_YR, cmos_rtc::sec, cmos_rtc::wday, and cmos_rtc::yr.
Referenced by arch_time_get(), and cmos_time().
| int x86_cmos_setup | ( | struct ioaddr * | ioaddr | ) |
Sets where the CMOS's ports are.
| ioaddr | its index and data ports (0x70) |
Definition at line 139 of file cmos.c.
References ioaddr::addr, cmos, ioaddr_type_str(), printk(), and x86_cmos_setup().
Referenced by x86_cmos_setup(), and x86_pc_cmos_init().
|
static |
Definition at line 26 of file cmos.c.
Referenced by cmos_reg_read(), and x86_cmos_setup().