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/dev/mk48txx/mk48txxreg.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  * Copyright (c) 2000 The NetBSD Foundation, Inc.
    3  * All rights reserved.
    4  *
    5  * This code is derived from software contributed to The NetBSD Foundation
    6  * by Paul Kranenburg.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *        This product includes software developed by the NetBSD
   19  *        Foundation, Inc. and its contributors.
   20  * 4. Neither the name of The NetBSD Foundation nor the names of its
   21  *    contributors may be used to endorse or promote products derived
   22  *    from this software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   25  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   26  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   27  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   34  * POSSIBILITY OF SUCH DAMAGE.
   35  *
   36  *      $NetBSD: mk48txxreg.h,v 1.4 2000/11/11 11:59:42 pk Exp $
   37  *
   38  * $FreeBSD: releng/5.4/sys/dev/mk48txx/mk48txxreg.h 135796 2004-09-25 20:53:44Z marius $
   39  */
   40 
   41 /*
   42  * Mostek MK48Txx clocks.
   43  *
   44  * The MK48T02 has 2KB of non-volatile memory. The time-of-day clock
   45  * registers start at offset 0x7f8.
   46  *
   47  * The MK48T08 has 8KB of non-volatile memory
   48  *
   49  * The MK48T59 also has 8KB of non-volatile memory but in addition it
   50  * has a battery low detection bit and a power supply wakeup alarm for
   51  * power management.  It's at offset 0x1ff0 in the NVRAM.
   52  */
   53 
   54 /*
   55  * Mostek MK48TXX register definitions
   56  */
   57 
   58 /*
   59  * The first bank of eight registers at offset (nvramsz - 16) is
   60  * available only on recenter (which?) MK48Txx models.
   61  */
   62 #define MK48TXX_FLAGS   0       /* flags register */
   63 #define MK48TXX_UNUSED  1       /* unused */
   64 #define MK48TXX_ASEC    2       /* alarm seconds (0..59; BCD) */
   65 #define MK48TXX_AMIN    3       /* alarm minutes (0..59; BCD) */
   66 #define MK48TXX_AHOUR   4       /* alarm hours (0..23; BCD) */
   67 #define MK48TXX_ADAY    5       /* alarm day in month (1..31; BCD) */
   68 #define MK48TXX_INTR    6       /* interrupts register */
   69 #define MK48TXX_WDOG    7       /* watchdog register */
   70 
   71 #define MK48TXX_ICSR    8       /* control register */
   72 #define MK48TXX_ISEC    9       /* seconds (0..59; BCD) */
   73 #define MK48TXX_IMIN    10      /* minutes (0..59; BCD) */
   74 #define MK48TXX_IHOUR   11      /* hours (0..23; BCD) */
   75 #define MK48TXX_IWDAY   12      /* weekday (1..7) */
   76 #define MK48TXX_IDAY    13      /* day in month (1..31; BCD) */
   77 #define MK48TXX_IMON    14      /* month (1..12; BCD) */
   78 #define MK48TXX_IYEAR   15      /* year (0..99; BCD) */
   79 
   80 /*
   81  * Note that some of the bits below that are not in the first eight
   82  * registers are also only available on models with an extended
   83  * register set.
   84  */
   85 
   86 /* Bits in the flags register (extended only) */
   87 #define MK48TXX_FLAGS_BL        0x10    /* battery low (read only) */
   88 #define MK48TXX_FLAGS_AF        0x40    /* alarm flag (read only) */
   89 #define MK48TXX_FLAGS_WDF       0x80    /* watchdog flag (read only) */
   90 
   91 /* Bits in the alarm seconds register (extended only) */
   92 #define MK48TXX_ASEC_MASK       0x7f    /* mask for alarm seconds */
   93 #define MK48TXX_ASEC_RPT1       0x80    /* alarm repeat mode bit 1 */
   94 
   95 /* Bits in the alarm minutes register (extended only) */
   96 #define MK48TXX_AMIN_MASK       0x7f    /* mask for alarm minutes */
   97 #define MK48TXX_AMIN_RPT2       0x80    /* alarm repeat mode bit 2 */
   98 
   99 /* Bits in the alarm hours register (extended only) */
  100 #define MK48TXX_AHOUR_MASK      0x3f    /* mask for alarm hours */
  101 #define MK48TXX_AHOUR_RPT3      0x80    /* alarm repeat mode bit 3 */
  102 
  103 /* Bits in the alarm day in month register (extended only) */
  104 #define MK48TXX_ADAY_MASK       0x3f    /* mask for alarm day in month */
  105 #define MK48TXX_ADAY_RPT4       0x80    /* alarm repeat mode bit 4 */
  106 
  107 /* Bits in the interrupts register (extended only) */
  108 #define MK48TXX_INTR_ABE        0x20    /* alarm in battery back-up mode */
  109 #define MK48TXX_INTR_AFE        0x80    /* alarm flag enable */
  110 
  111 /* Bits in the watchdog register (extended only) */
  112 #define MK48TXX_WDOG_RB_1_16    0x00    /* watchdog resolution 1/16 second */
  113 #define MK48TXX_WDOG_RB_1_4     0x01    /* watchdog resolution 1/4 second */
  114 #define MK48TXX_WDOG_RB_1       0x02    /* watchdog resolution 1 second */
  115 #define MK48TXX_WDOG_RB_4       0x03    /* watchdog resolution 4 seconds */
  116 #define MK48TXX_WDOG_BMB_MASK   0x7c    /* mask for watchdog multiplier */
  117 #define MK48TXX_WDOG_WDS        0x80    /* watchdog steering bit */
  118 
  119 /* Bits in the control register */
  120 #define MK48TXX_CSR_CALIB_MASK  0x1f    /* mask for calibration step width */
  121 #define MK48TXX_CSR_SIGN        0x20    /* sign of above calibration witdh */
  122 #define MK48TXX_CSR_READ        0x40    /* want to read (freeze clock) */
  123 #define MK48TXX_CSR_WRITE       0x80    /* want to write */
  124 
  125 /* Bits in the seconds register */
  126 #define MK48TXX_SEC_MASK        0x7f    /* mask for seconds */
  127 #define MK48TXX_SEC_ST          0x80    /* stop oscillator */
  128 
  129 /* Bits in the minutes register */
  130 #define MK48TXX_MIN_MASK        0x7f    /* mask for minutes */
  131 
  132 /* Bits in the hours register */
  133 #define MK48TXX_HOUR_MASK       0x3f    /* mask for hours */
  134 
  135 /* Bits in the century/weekday register */
  136 #define MK48TXX_WDAY_MASK       0x07    /* mask for weekday */
  137 #define MK48TXX_WDAY_CB         0x10    /* century bit (extended only) */
  138 #define MK48TXX_WDAY_CEB        0x20    /* century enable bit (extended only) */
  139 #define MK48TXX_WDAY_FT         0x40    /* frequency test */
  140 
  141 /* Bits in the day in month register */
  142 #define MK48TXX_DAY_MASK        0x3f    /* mask for day in month */
  143 
  144 /* Bits in the month register */
  145 #define MK48TXX_MON_MASK        0x1f    /* mask for month */
  146 
  147 /* Bits in the year register */
  148 #define MK48TXX_YEAR_MASK       0xff    /* mask for year */
  149 
  150 /* Model specific NVRAM sizes and clock offsets */
  151 #define MK48T02_CLKSZ           2048
  152 #define MK48T02_CLKOFF          0x7f0
  153 
  154 #define MK48T08_CLKSZ           8192
  155 #define MK48T08_CLKOFF          0x1ff0
  156 
  157 #define MK48T59_CLKSZ           8192
  158 #define MK48T59_CLKOFF          0x1ff0
  159 
  160 /* Chip attach function */
  161 int mk48txx_attach(device_t, bus_space_tag_t, bus_space_handle_t, const char *,
  162     int);
  163 
  164 /* Retrieve size of the on-chip NVRAM area */
  165 int mk48txx_get_nvram_size(device_t, bus_size_t *);
  166 
  167 /* Methods for the clock interface. */
  168 int mk48txx_gettime(device_t, struct timespec *);
  169 int mk48txx_settime(device_t, struct timespec *);

Cache object: 5e96e944884fd5cfe077060dbd734584


[ 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.