PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
Go to the source code of this file.
Macros | |
#define | CMOS_REG_SET 0x70 |
This code is an interface to the MC146818A-compatible real time clock found on PC motherboards. More... | |
#define | CMOS_REG_IO 0x71 |
Contains the selected data byte. More... | |
#define | RTC_REG_SEC 0 |
Indexes of CMOS registers with real-time clock functions. More... | |
#define | RTC_REG_MIN 2 |
Minute: 0x00...0x59. More... | |
#define | RTC_REG_HOUR 4 |
Hour: 0x00...0x23. More... | |
#define | RTC_REG_MDAY 7 |
Day of the month: 0x01...0x31. More... | |
#define | RTC_REG_MON 8 |
Month: 0x01...0x12. More... | |
#define | RTC_REG_YEAR 9 |
Year: 0x00...0x99. More... | |
#define | RTC_REG_A 0x0a |
Indexes of CMOS control registers. More... | |
#define | RTC_REG_B 0x0b |
Register B: 24/12 hour time, irq enables. More... | |
#define | RTC_REG_C 0x0c |
Register C: pending interrupts. More... | |
#define | RTC_REG_D 0x0d |
Register D: valid time? More... | |
#define | RTCSA_UIP 0x80 |
Register A. More... | |
#define | RTCSB_SET 0x80 |
Register B. More... | |
#define | RTCSB_DM 0x04 |
0 = BCD time format, 1 = binary format. More... | |
#define | RTCSB_24HR 0x02 |
0 = 12-hour format, 1 = 24-hour format. More... | |
Functions | |
static int | bcd_to_bin (uint8_t x) |
Returns the integer value of the given BCD byte. More... | |
static uint8_t | cmos_read (uint8_t index) |
Reads a byte from the CMOS register with the given INDEX and returns the byte read. More... | |
time_t | rtc_get_time (void) |
Returns number of seconds since Unix epoch of January 1,. More... | |
#define CMOS_REG_SET 0x70 |
#define RTC_REG_A 0x0a |
#define RTC_REG_B 0x0b |
#define RTC_REG_SEC 0 |
#define RTCSA_UIP 0x80 |
#define RTCSB_24HR 0x02 |
#define RTCSB_SET 0x80 |
|
static |
Returns the integer value of the given BCD byte.
Definition at line 100 of file rtc.c.
References x.
Referenced by rtc_get_time().
Reads a byte from the CMOS register with the given INDEX and returns the byte read.
Definition at line 108 of file rtc.c.
References CMOS_REG_IO, CMOS_REG_SET, inb(), and outb().
Referenced by rtc_get_time().
time_t rtc_get_time | ( | void | ) |
Returns number of seconds since Unix epoch of January 1,.
Definition at line 43 of file rtc.c.
References bcd_to_bin(), cmos_read(), RTC_REG_HOUR, RTC_REG_MDAY, RTC_REG_MIN, RTC_REG_MON, RTC_REG_SEC, and RTC_REG_YEAR.
Referenced by parse_options().