home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / rtc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.4 KB  |  89 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_RTC_H
  11. #define _SYS_RTC_H
  12.  
  13. #ident    "@(#)/usr/include/sys/rtc.h.sl 1.1 4.0 12/08/90 42068 AT&T-USL"
  14.  
  15. /*
  16.  * Definitions for Real Time Clock driver (Motorola MC146818 chip).
  17.  */
  18.  
  19. #define    RTC_ADDR    0x70    /* I/O port address of for register select */
  20. #define    RTC_DATA    0x71    /* I/O port address for data read/write */
  21.  
  22. /*
  23.  * Register A definitions
  24.  */
  25. #define    RTC_A        0x0a    /* register A address */
  26. #define    RTC_UIP        0x80    /* Update in progress bit */
  27. #define    RTC_DIV0    0x00    /* Time base of 4.194304 MHz */
  28. #define    RTC_DIV1    0x10    /* Time base of 1.048576 MHz */
  29. #define    RTC_DIV2    0x20    /* Time base of 32.768 KHz */
  30. #define    RTC_RATE6    0x06    /* interrupt rate of 976.562 */
  31.  
  32. /*
  33.  * Register B definitions
  34.  */
  35. #define    RTC_B        0x0b    /* register B address */
  36. #define    RTC_SET        0x80    /* stop updates for time set */
  37. #define    RTC_PIE        0x40    /* Periodic interrupt enable */
  38. #define    RTC_AIE        0x20    /* Alarm interrupt enable */
  39. #define    RTC_UIE        0x10    /* Update ended interrupt enable */
  40. #define    RTC_SQWE    0x08    /* Square wave enable */
  41. #define    RTC_DM        0x04    /* Date mode, 1 = binary, 0 = BCD */
  42. #define    RTC_HM        0x02    /* hour mode, 1 = 24 hour, 0 = 12 hour */
  43. #define    RTC_DSE        0x01    /* Daylight savings enable */
  44.  
  45. /* 
  46.  * Register C definitions
  47.  */
  48. #define    RTC_C        0x0c    /* register C address */
  49. #define    RTC_IRQF    0x80    /* IRQ flag */
  50. #define    RTC_PF        0x40    /* PF flag bit */
  51. #define    RTC_AF        0x20    /* AF flag bit */
  52. #define    RTC_UF        0x10    /* UF flag bit */
  53.  
  54. /*
  55.  * Register D definitions
  56.  */
  57. #define    RTC_D        0x0d    /* register D address */
  58. #define    RTC_VRT        0x80    /* Valid RAM and time bit */
  59.  
  60. #define    RTC_NREG    0x0e    /* number of RTC registers */
  61. #define    RTC_NREGP    0x0a    /* number of RTC registers to set time */
  62.  
  63. /*
  64.  * Ioctl definitions for accessing RTC.
  65.  */
  66. #define    RTCIOC    ('R' << 8)
  67.  
  68. #define    RTCRTIME    (RTCIOC | 0x01)        /* Read time from RTC */
  69. #define    RTCSTIME    (RTCIOC | 0x02)        /* Set time into RTC */
  70.  
  71. struct    rtc_t {
  72.     char    rtc_sec;
  73.     char    rtc_asec;
  74.     char    rtc_min;
  75.     char    rtc_amin;
  76.     char    rtc_hr;
  77.     char    rtc_ahr;
  78.     char    rtc_dow;
  79.     char    rtc_dom;
  80.     char    rtc_mon;
  81.     char    rtc_yr;
  82.     char    rtc_statusa;
  83.     char    rtc_statusb;
  84.     char    rtc_statusc;
  85.     char    rtc_statusd;
  86. };
  87.  
  88. #endif    /* _SYS_RTC_H */
  89.