Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:43

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  *  This file contains the definitions for the following real-time clocks:
0005  *
0006  *    + Mostek M48T08
0007  *    + Mostek M48T18
0008  *    + Dallas Semiconductor DS1643
0009  *
0010  *  COPYRIGHT (c) 1989-1999.
0011  *  On-Line Applications Research Corporation (OAR).
0012  *
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  * 1. Redistributions of source code must retain the above copyright
0017  *    notice, this list of conditions and the following disclaimer.
0018  * 2. Redistributions in binary form must reproduce the above copyright
0019  *    notice, this list of conditions and the following disclaimer in the
0020  *    documentation and/or other materials provided with the distribution.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0023  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0026  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0027  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0028  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0031  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0032  * POSSIBILITY OF SUCH DAMAGE.
0033  */
0034 
0035 #ifndef __LIBCHIP_M48T08_h
0036 #define __LIBCHIP_M48T08_h
0037 
0038 /*
0039  *  Register indices
0040  */
0041 
0042 #define M48T08_CONTROL     0
0043 #define M48T08_SECOND      1
0044 #define M48T08_MINUTE      2
0045 #define M48T08_HOUR        3
0046 #define M48T08_DAY_OF_WEEK 4
0047 #define M48T08_DATE        5
0048 #define M48T08_MONTH       6
0049 #define M48T08_YEAR        7
0050 
0051 /*
0052  *  Driver function table
0053  */
0054 
0055 extern rtc_fns m48t08_fns;
0056 
0057 /*
0058  * Default register access routines
0059  */
0060 
0061 uint32_t   m48t08_get_register(     /* registers are at 1 byte boundaries */
0062   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0063   uint8_t     ucRegNum
0064 );
0065 
0066 void  m48t08_set_register(
0067   uintptr_t   ulCtrlPort,
0068   uint8_t     ucRegNum,
0069   uint32_t    ucData
0070 );
0071 
0072 uint32_t   m48t08_get_register_2(   /* registers are at 2 byte boundaries */
0073   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0074   uint8_t     ucRegNum
0075 );
0076 
0077 void  m48t08_set_register_2(
0078   uintptr_t   ulCtrlPort,
0079   uint8_t     ucRegNum,
0080   uint32_t    ucData
0081 );
0082 
0083 uint32_t   m48t08_get_register_4(   /* registers are at 4 byte boundaries */
0084   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0085   uint8_t     ucRegNum
0086 );
0087 
0088 void  m48t08_set_register_4(
0089   uintptr_t   ulCtrlPort,
0090   uint8_t     ucRegNum,
0091   uint32_t    ucData
0092 );
0093 
0094 uint32_t   m48t08_get_register_8(   /* registers are at 8 byte boundaries */
0095   uintptr_t   ulCtrlPort,           /*   and accessed as bytes            */
0096   uint8_t     ucRegNum
0097 );
0098 
0099 void  m48t08_set_register_8(
0100   uintptr_t   ulCtrlPort,
0101   uint8_t     ucRegNum,
0102   uint32_t    ucData
0103 );
0104 
0105 #endif
0106 /* end of include file */