The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386at/rtc.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /* 
   27  * HISTORY
   28  * $Log:        rtc.h,v $
   29  * Revision 2.7  91/05/14  16:30:03  mrt
   30  *      Correcting copyright
   31  * 
   32  * Revision 2.6  91/03/16  14:47:03  rpd
   33  *      Fixed ioctl definitions for ANSI C.
   34  *      [91/02/20            rpd]
   35  * 
   36  * Revision 2.5  91/02/05  17:20:25  mrt
   37  *      Changed to new Mach copyright
   38  *      [91/02/01  17:47:16  mrt]
   39  * 
   40  * Revision 2.4  90/11/26  14:51:02  rvb
   41  *      jsb bet me to XMK34, sigh ...
   42  *      [90/11/26            rvb]
   43  *      Synched 2.5 & 3.0 at I386q (r1.5.1.3) & XMK35 (r2.4)
   44  *      [90/11/15            rvb]
   45  * 
   46  * Revision 1.5.1.2  90/07/27  11:27:06  rvb
   47  *      Fix Intel Copyright as per B. Davies authorization.
   48  *      [90/07/27            rvb]
   49  * 
   50  * Revision 2.2  90/05/03  15:46:11  dbg
   51  *      First checkin.
   52  * 
   53  * Revision 1.5.1.1  90/01/08  13:29:46  rvb
   54  *      Add Intel copyright.
   55  *      [90/01/08            rvb]
   56  * 
   57  * Revision 1.5  89/09/25  12:27:37  rvb
   58  *      File was provided by Intel 9/18/89.
   59  *      [89/09/23            rvb]
   60  * 
   61  */
   62 
   63 /*
   64   Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
   65 
   66                 All Rights Reserved
   67 
   68 Permission to use, copy, modify, and distribute this software and
   69 its documentation for any purpose and without fee is hereby
   70 granted, provided that the above copyright notice appears in all
   71 copies and that both the copyright notice and this permission notice
   72 appear in supporting documentation, and that the name of Intel
   73 not be used in advertising or publicity pertaining to distribution
   74 of the software without specific, written prior permission.
   75 
   76 INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
   77 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
   78 IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
   79 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
   80 LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
   81 NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
   82 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   83 */
   84 
   85 #define RTC_ADDR        0x70    /* I/O port address for register select */
   86 #define RTC_DATA        0x71    /* I/O port address for data read/write */
   87 
   88 /*
   89  * Register A definitions
   90  */
   91 #define RTC_A           0x0a    /* register A address */
   92 #define RTC_UIP         0x80    /* Update in progress bit */
   93 #define RTC_DIV0        0x00    /* Time base of 4.194304 MHz */
   94 #define RTC_DIV1        0x10    /* Time base of 1.048576 MHz */
   95 #define RTC_DIV2        0x20    /* Time base of 32.768 KHz */
   96 #define RTC_RATE6       0x06    /* interrupt rate of 976.562 */
   97 
   98 /*
   99  * Register B definitions
  100  */
  101 #define RTC_B           0x0b    /* register B address */
  102 #define RTC_SET         0x80    /* stop updates for time set */
  103 #define RTC_PIE         0x40    /* Periodic interrupt enable */
  104 #define RTC_AIE         0x20    /* Alarm interrupt enable */
  105 #define RTC_UIE         0x10    /* Update ended interrupt enable */
  106 #define RTC_SQWE        0x08    /* Square wave enable */
  107 #define RTC_DM          0x04    /* Date mode, 1 = binary, 0 = BCD */
  108 #define RTC_HM          0x02    /* hour mode, 1 = 24 hour, 0 = 12 hour */
  109 #define RTC_DSE         0x01    /* Daylight savings enable */
  110 
  111 /* 
  112  * Register C definitions
  113  */
  114 #define RTC_C           0x0c    /* register C address */
  115 #define RTC_IRQF        0x80    /* IRQ flag */
  116 #define RTC_PF          0x40    /* PF flag bit */
  117 #define RTC_AF          0x20    /* AF flag bit */
  118 #define RTC_UF          0x10    /* UF flag bit */
  119 
  120 /*
  121  * Register D definitions
  122  */
  123 #define RTC_D           0x0d    /* register D address */
  124 #define RTC_VRT         0x80    /* Valid RAM and time bit */
  125 
  126 #define RTC_NREG        0x0e    /* number of RTC registers */
  127 #define RTC_NREGP       0x0a    /* number of RTC registers to set time */
  128 
  129 #define RTCRTIME        _IOR('c', 0x01, struct rtc_st) /* Read time from RTC */
  130 #define RTCSTIME        _IOW('c', 0x02, struct rtc_st) /* Set time into RTC */
  131 
  132 struct rtc_st {
  133         char    rtc_sec;
  134         char    rtc_asec;
  135         char    rtc_min;
  136         char    rtc_amin;
  137         char    rtc_hr;
  138         char    rtc_ahr;
  139         char    rtc_dow;
  140         char    rtc_dom;
  141         char    rtc_mon;
  142         char    rtc_yr;
  143         char    rtc_statusa;
  144         char    rtc_statusb;
  145         char    rtc_statusc;
  146         char    rtc_statusd;
  147 };
  148 
  149 /*
  150  * this macro reads contents of real time clock to specified buffer 
  151  */
  152 #define load_rtc(regs) \
  153 {\
  154         register int i; \
  155         \
  156         for (i = 0; i < RTC_NREG; i++) { \
  157                 outb(RTC_ADDR, i); \
  158                 regs[i] = inb(RTC_DATA); \
  159         } \
  160 }
  161 
  162 /*
  163  * this macro writes contents of specified buffer to real time clock 
  164  */ 
  165 #define save_rtc(regs) \
  166 { \
  167         register int i; \
  168         for (i = 0; i < RTC_NREGP; i++) { \
  169                 outb(RTC_ADDR, i); \
  170                 outb(RTC_DATA, regs[i]);\
  171         } \
  172 }       
  173 
  174 

Cache object: 6f0723803d9e67892534c1d012107083


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.