x12rtc.h

Go to the documentation of this file.
00001 #ifndef _DEV_X12RTC_H_
00002 #define _DEV_X12RTC_H_
00003 
00004 /*
00005  * Copyright (C) 2005-2007 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00036 /*
00037  * $Log: x12rtc.h,v $
00038  * Revision 1.5  2008/08/11 07:00:00  haraldkipp
00039  * BSD types replaced by stdint types (feature request #1282721).
00040  *
00041  * Revision 1.4  2007/06/03 08:52:16  haraldkipp
00042  * Wrong watchdog mode bit fixed.
00043  *
00044  * Revision 1.3  2006/10/05 17:18:49  haraldkipp
00045  * Hardware independant RTC layer added.
00046  *
00047  * Revision 1.2  2006/01/19 18:42:21  haraldkipp
00048  * Make it compile even if the calling module doesn't include time.h.
00049  *
00050  * Revision 1.1  2005/10/24 11:41:39  haraldkipp
00051  * Initial check-in.
00052  *
00053  */
00054 
00055 #include <dev/rtc.h>
00056 
00059 #define X12RTC_SCA0         0x00    
00060 #define X12RTC_SCA1         0x08    
00061 #define X12RTC_SCA_ESC      0x80    
00063 #define X12RTC_MNA0         0x01    
00064 #define X12RTC_MNA1         0x09    
00065 #define X12RTC_MNA_EMN      0x80    
00067 #define X12RTC_HRA0         0x02    
00068 #define X12RTC_HRA1         0x0A    
00069 #define X12RTC_HRA_EHR      0x80    
00071 #define X12RTC_DTA0         0x03    
00072 #define X12RTC_DTA1         0x0B    
00073 #define X12RTC_DTA_EDT      0x80    
00075 #define X12RTC_MOA0         0x04    
00076 #define X12RTC_MOA1         0x0C    
00077 #define X12RTC_MOA_EMO      0x80    
00079 #define X12RTC_YRA0         0x05    
00080 #define X12RTC_YRA1         0x0D    
00082 #define X12RTC_DWA0         0x06    
00083 #define X12RTC_DWA1         0x0E    
00084 #define X12RTC_DWA_EDW      0x80    
00086 #define X12RTC_Y2K0         0x07    
00087 #define X12RTC_Y2K1         0x0F    
00089 
00090 
00092 #define X12RTC_BL           0x10    
00094 #define X12RTC_BL_WD        0x18    
00095 #define X12RTC_BL_WD_1750   0x00    
00096 #define X12RTC_BL_WD_750    0x08    
00097 #define X12RTC_BL_WD_250    0x10    
00098 #define X12RTC_BL_WD_OFF    0x18    
00100 #define X12RTC_BL_BP        0xE0    
00101 #define X12RTC_BL_BP_NONE   0x00    
00102 #define X12RTC_BL_BP_UQUAD  0x20    
00103 #define X12RTC_BL_BP_UHALF  0x40    
00104 #define X12RTC_BL_BP_FULL   0x60    
00105 #define X12RTC_BL_BP_FIRST1 0x80    
00106 #define X12RTC_BL_BP_FIRST2 0xA0    
00107 #define X12RTC_BL_BP_FIRST3 0xC0    
00108 #define X12RTC_BL_BP_FIRST8 0xE0    
00110 #define X12RTC_INT          0x11    
00112 #define X12RTC_INT_FO       0x14    
00113 #define X12RTC_INT_FO_IRQ   0x00    
00114 #define X12RTC_INT_FO_32KHZ 0x04    
00115 #define X12RTC_INT_FO_100HZ 0x10    
00116 #define X12RTC_INT_FO_1HZ   0x14    
00118 #define X12RTC_INT_AL0E     0x20    
00119 #define X12RTC_INT_AL1E     0x40    
00120 #define X12RTC_INT_IM       0x80    
00122 #define X12RTC_ATR          0x12    
00124 #define X12RTC_DTR          0x13    
00125 #define X12RTC_DTR_NONE     0x00    
00126 #define X12RTC_DTR_PLUS10   0x02    
00127 #define X12RTC_DTR_PLUS20   0x01    
00128 #define X12RTC_DTR_PLUS30   0x03    
00129 #define X12RTC_DTR_MINUS10  0x06    
00130 #define X12RTC_DTR_MINUS20  0x05    
00131 #define X12RTC_DTR_MINUS30  0x07    
00133 
00134 
00136 #define X12RTC_SC           0x30    
00137 #define X12RTC_MN           0x31    
00138 #define X12RTC_HR           0x32    
00139 #define X12RTC_HR_MIL       0x80    
00140 #define X12RTC_DT           0x33    
00141 #define X12RTC_MO           0x34    
00142 #define X12RTC_YR           0x35    
00143 #define X12RTC_DW           0x36    
00144 #define X128xRTC_SSEC       0x37    
00145 #define X122xRTC_Y2K        0x37    
00147 
00148 
00150 #define X12RTC_SR           0x3F    
00151 #define X12RTC_SR_RTCF      0x01    
00152 #define X12RTC_SR_WEL       0x02    
00153 #define X12RTC_SR_RWEL      0x04    
00154 #define X12RTC_SR_AL0       0x20    
00155 #define X12RTC_SR_AL1       0x40    
00156 #define X12RTC_SR_BAT       0x80    
00158 
00159 extern NUTRTC rtcX12x6;
00160 
00161 __BEGIN_DECLS
00162 /* Prototypes */
00163 extern int X12Init(void);
00164 
00165 extern int X12RtcGetClock(struct _tm *tm);
00166 extern int X12RtcSetClock(CONST struct _tm *tm);
00167 extern int X12RtcGetAlarm(int idx, struct _tm *tm, int *aflgs);
00168 extern int X12RtcSetAlarm(int idx, CONST struct _tm *tm, int aflgs);
00169 extern int X12RtcGetStatus(uint32_t *sflgs);
00170 extern int X12RtcClearStatus(uint32_t sflgs);
00171 extern int X12RtcReadRegs(uint8_t addr, uint8_t *buff, size_t len);
00172 extern int X12RtcWrite(int nv, CONST uint8_t *buff, size_t len);
00173 
00174 extern int X12EepromRead(u_int addr, void *buff, size_t len);
00175 extern int X12EepromWrite(u_int addr, CONST void *buff, size_t len);
00176 
00177 __END_DECLS
00178 /* End of prototypes */
00179 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/