iPXE
rtc.h
Go to the documentation of this file.
1 #ifndef _RTC_H
2 #define _RTC_H
3 
4 /** @file
5  *
6  * CMOS Real-Time Clock (RTC)
7  *
8  * The CMOS/RTC registers are documented (with varying degrees of
9  * accuracy and consistency) at
10  *
11  * http://www.nondot.org/sabre/os/files/MiscHW/RealtimeClockFAQ.txt
12  * http://wiki.osdev.org/RTC
13  * http://wiki.osdev.org/CMOS
14  */
15 
16 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
17 
18 #include <pic8259.h>
19 
20 /** RTC IRQ */
21 #define RTC_IRQ 8
22 
23 /** RTC interrupt vector */
24 #define RTC_INT IRQ_INT ( RTC_IRQ )
25 
26 /** CMOS/RTC address (and NMI) register */
27 #define CMOS_ADDRESS 0x70
28 
29 /** NMI disable bit */
30 #define CMOS_DISABLE_NMI 0x80
31 
32 /** CMOS/RTC data register */
33 #define CMOS_DATA 0x71
34 
35 /** RTC seconds */
36 #define RTC_SEC 0x00
37 
38 /** RTC minutes */
39 #define RTC_MIN 0x02
40 
41 /** RTC hours */
42 #define RTC_HOUR 0x04
43 
44 /** RTC weekday */
45 #define RTC_WDAY 0x06
46 
47 /** RTC day of month */
48 #define RTC_MDAY 0x07
49 
50 /** RTC month */
51 #define RTC_MON 0x08
52 
53 /** RTC year */
54 #define RTC_YEAR 0x09
55 
56 /** RTC status register A */
57 #define RTC_STATUS_A 0x0a
58 
59 /** RTC update in progress bit */
60 #define RTC_STATUS_A_UPDATE_IN_PROGRESS 0x80
61 
62 /** RTC status register B */
63 #define RTC_STATUS_B 0x0b
64 
65 /** RTC 24 hour format bit */
66 #define RTC_STATUS_B_24_HOUR 0x02
67 
68 /** RTC binary mode bit */
69 #define RTC_STATUS_B_BINARY 0x04
70 
71 /** RTC Periodic Interrupt Enabled bit */
72 #define RTC_STATUS_B_PIE 0x40
73 
74 /** RTC status register C */
75 #define RTC_STATUS_C 0x0c
76 
77 /** RTC status register D */
78 #define RTC_STATUS_D 0x0d
79 
80 /** CMOS default address */
81 #define CMOS_DEFAULT_ADDRESS RTC_STATUS_D
82 
83 #endif /* _RTC_H */
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)