You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rtc.h 1.5KB

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