iPXE
rtc.h
Go to the documentation of this file.
00001 #ifndef _RTC_H
00002 #define _RTC_H
00003 
00004 /** @file
00005  *
00006  * CMOS Real-Time Clock (RTC)
00007  *
00008  * The CMOS/RTC registers are documented (with varying degrees of
00009  * accuracy and consistency) at
00010  *
00011  *    http://www.nondot.org/sabre/os/files/MiscHW/RealtimeClockFAQ.txt
00012  *    http://wiki.osdev.org/RTC
00013  *    http://wiki.osdev.org/CMOS
00014  */
00015 
00016 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00017 
00018 #include <pic8259.h>
00019 
00020 /** RTC IRQ */
00021 #define RTC_IRQ 8
00022 
00023 /** RTC interrupt vector */
00024 #define RTC_INT IRQ_INT ( RTC_IRQ )
00025 
00026 /** CMOS/RTC address (and NMI) register */
00027 #define CMOS_ADDRESS 0x70
00028 
00029 /** NMI disable bit */
00030 #define CMOS_DISABLE_NMI 0x80
00031 
00032 /** CMOS/RTC data register */
00033 #define CMOS_DATA 0x71
00034 
00035 /** RTC seconds */
00036 #define RTC_SEC 0x00
00037 
00038 /** RTC minutes */
00039 #define RTC_MIN 0x02
00040 
00041 /** RTC hours */
00042 #define RTC_HOUR 0x04
00043 
00044 /** RTC weekday */
00045 #define RTC_WDAY 0x06
00046 
00047 /** RTC day of month */
00048 #define RTC_MDAY 0x07
00049 
00050 /** RTC month */
00051 #define RTC_MON 0x08
00052 
00053 /** RTC year */
00054 #define RTC_YEAR 0x09
00055 
00056 /** RTC status register A */
00057 #define RTC_STATUS_A 0x0a
00058 
00059 /** RTC update in progress bit */
00060 #define RTC_STATUS_A_UPDATE_IN_PROGRESS 0x80
00061 
00062 /** RTC status register B */
00063 #define RTC_STATUS_B 0x0b
00064 
00065 /** RTC 24 hour format bit */
00066 #define RTC_STATUS_B_24_HOUR 0x02
00067 
00068 /** RTC binary mode bit */
00069 #define RTC_STATUS_B_BINARY 0x04
00070 
00071 /** RTC Periodic Interrupt Enabled bit */
00072 #define RTC_STATUS_B_PIE 0x40
00073 
00074 /** RTC status register C */
00075 #define RTC_STATUS_C 0x0c
00076 
00077 /** RTC status register D */
00078 #define RTC_STATUS_D 0x0d
00079 
00080 /** CMOS default address */
00081 #define CMOS_DEFAULT_ADDRESS RTC_STATUS_D
00082 
00083 #endif /* _RTC_H */