1 /* 2 * ds1742rtc.h - register definitions for the Real-Time-Clock / CMOS RAM 3 * 4 * Based on include/asm-mips/ds1643rtc.h. 5 * 6 * Copyright (C) 1999-2001 Toshiba Corporation 7 * It was written to be part of the Linux operating system. 8 */ 9 /* permission is hereby granted to copy, modify and redistribute this code 10 * in terms of the GNU Library General Public License, Version 2 or later, 11 * at your option. 12 */ 13 #ifndef _DS1742RTC_H 14 #define _DS1742RTC_H 15 16 #include <linux/rtc.h> 17 #include <asm/mc146818rtc.h> /* bad name... */ 18 19 #define RTC_BRAM_SIZE 0x800 20 #define RTC_OFFSET 0x7f8 21 22 /********************************************************************** 23 * register summary 24 **********************************************************************/ 25 #define RTC_CONTROL (RTC_OFFSET + 0) 26 #define RTC_CENTURY (RTC_OFFSET + 0) 27 #define RTC_SECONDS (RTC_OFFSET + 1) 28 #define RTC_MINUTES (RTC_OFFSET + 2) 29 #define RTC_HOURS (RTC_OFFSET + 3) 30 #define RTC_DAY (RTC_OFFSET + 4) 31 #define RTC_DATE (RTC_OFFSET + 5) 32 #define RTC_MONTH (RTC_OFFSET + 6) 33 #define RTC_YEAR (RTC_OFFSET + 7) 34 35 #define RTC_CENTURY_MASK 0x3f 36 #define RTC_SECONDS_MASK 0x7f 37 #define RTC_DAY_MASK 0x07 38 39 /* 40 * Bits in the Control/Century register 41 */ 42 #define RTC_WRITE 0x80 43 #define RTC_READ 0x40 44 45 /* 46 * Bits in the Seconds register 47 */ 48 #define RTC_STOP 0x80 49 50 /* 51 * Bits in the Day register 52 */ 53 #define RTC_BATT_FLAG 0x80 54 #define RTC_FREQ_TEST 0x40 55 56 /* 57 * Conversion between binary and BCD. 58 */ 59 #ifndef BCD_TO_BIN 60 #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) 61 #endif 62 63 #ifndef BIN_TO_BCD 64 #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) 65 #endif 66 67 #endif /* _DS1742RTC_H */ 68