Back to home page

LXR

 
 

    


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

0001 #ifndef DS1375_I2C_RTC_H
0002 #define DS1375_I2C_RTC_H
0003 
0004 /* Driver for the Maxim 1375 i2c RTC (TOD only; very simple...) */
0005 
0006 /*
0007  * Authorship
0008  * ----------
0009  * This software was created by
0010  *
0011  *     Till Straumann <strauman@slac.stanford.edu>, 2005-2007,
0012  *     Stanford Linear Accelerator Center, Stanford University.
0013  *
0014  * Acknowledgement of sponsorship
0015  * ------------------------------
0016  * The software was produced by
0017  *     the Stanford Linear Accelerator Center, Stanford University,
0018  *     under Contract DE-AC03-76SFO0515 with the Department of Energy.
0019  *
0020  * Government disclaimer of liability
0021  * ----------------------------------
0022  * Neither the United States nor the United States Department of Energy,
0023  * nor any of their employees, makes any warranty, express or implied, or
0024  * assumes any legal liability or responsibility for the accuracy,
0025  * completeness, or usefulness of any data, apparatus, product, or process
0026  * disclosed, or represents that its use would not infringe privately owned
0027  * rights.
0028  *
0029  * Stanford disclaimer of liability
0030  * --------------------------------
0031  * Stanford University makes no representations or warranties, express or
0032  * implied, nor assumes any liability for the use of this software.
0033  *
0034  * Stanford disclaimer of copyright
0035  * --------------------------------
0036  * Stanford University, owner of the copyright, hereby disclaims its
0037  * copyright and all other rights in this software.  Hence, anyone may
0038  * freely use it for any purpose without restriction.
0039  *
0040  * Maintenance of notices
0041  * ----------------------
0042  * In the interest of clarity regarding the origin and status of this
0043  * SLAC software, this and all the preceding Stanford University notices
0044  * are to remain affixed to any copy or derivative of this software made
0045  * or distributed by the recipient and are to be affixed to any copy of
0046  * software made or distributed by the recipient that contains a copy or
0047  * derivative of this software.
0048  *
0049  * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
0050  */
0051 
0052 #include <rtems.h>
0053 #include <libchip/rtc.h>
0054 #include <stdint.h>
0055 
0056 #ifdef __cplusplus
0057 extern "C" {
0058 #endif
0059 
0060 extern rtc_fns rtc_ds1375_fns;
0061 
0062 bool
0063 rtc_ds1375_device_probe( int minor );
0064 
0065 uint32_t
0066 rtc_ds1375_get_register( uintptr_t port, uint8_t reg );
0067 
0068 void
0069 rtc_ds1375_set_register( uintptr_t port, uint8_t reg, uint32_t value );
0070 
0071 /*
0072  * BSP must supply string constant argument 'i2cname' which matches
0073  * the registered device name of the raw i2c device (created with mknod).
0074  * E.g., "/dev/i2c.ds1375-raw"
0075  *
0076  * NOTE: The i2c bus driver must already be up and 'i2cname' already
0077  *       be available when this ENTRY is registered or initialized.
0078  *
0079  *       If you want to allow applications to add the RTC driver to
0080  *       the configuration table then the i2c subsystem must be
0081  *       initialized by the BSP from the predriver_hook.
0082  */
0083 #define DS1375_RTC_TBL_ENTRY(i2cname) \
0084 {                                                     \
0085     sDeviceName:    "/dev/rtc",                       \
0086     deviceType: RTC_CUSTOM,                       \
0087     pDeviceFns: &rtc_ds1375_fns,                  \
0088     deviceProbe:    rtc_ds1375_device_probe,          \
0089     ulCtrlPort1:    (uintptr_t)(i2cname),             \
0090     ulDataPort: 0,                                \
0091     getRegister:    rtc_ds1375_get_register,          \
0092     setRegister:    rtc_ds1375_set_register,          \
0093 }
0094 
0095 #ifdef __cplusplus
0096 }
0097 #endif
0098 
0099 #endif