1#ifndef __RTC_H__
2#define __RTC_H__
3
4
5# define RTC_SECONDS 0
6# define RTC_MINUTES 1
7# define RTC_HOURS 2
8# define RTC_DAY_OF_MONTH 3
9# define RTC_MONTH 4
10# define RTC_WEEKDAY 5
11# define RTC_YEAR 6
12# define RTC_CONTROL 7
13
14
15# define RTC_CONTROL_WRITEPROTECT 0x80
16# define RTC_TRICKLECHARGER 8
17
18
19# define RTC_TCR_PATTERN 0xA0
20# define RTC_TCR_1DIOD 0x04
21# define RTC_TCR_2DIOD 0x08
22# define RTC_TCR_DISABLED 0x00
23# define RTC_TCR_2KOHM 0x01
24# define RTC_TCR_4KOHM 0x02
25# define RTC_TCR_8KOHM 0x03
26
27#ifdef CONFIG_DS1302
28extern unsigned char ds1302_readreg(int reg);
29extern void ds1302_writereg(int reg, unsigned char val);
30extern int ds1302_init(void);
31# define CMOS_READ(x) ds1302_readreg(x)
32# define CMOS_WRITE(val,reg) ds1302_writereg(reg,val)
33# define RTC_INIT() ds1302_init()
34#else
35
36# define CMOS_READ(x) 42
37# define CMOS_WRITE(x,y)
38# define RTC_INIT() (-1)
39#endif
40
41
42
43
44
45
46struct rtc_time {
47 int tm_sec;
48 int tm_min;
49 int tm_hour;
50 int tm_mday;
51 int tm_mon;
52 int tm_year;
53 int tm_wday;
54 int tm_yday;
55 int tm_isdst;
56};
57
58
59#define RTC_MAGIC 'p'
60#define RTC_RD_TIME _IOR(RTC_MAGIC, 0x09, struct rtc_time)
61#define RTC_SET_TIME _IOW(RTC_MAGIC, 0x0a, struct rtc_time)
62#define RTC_SET_CHARGE _IOW(RTC_MAGIC, 0x0b, int)
63#define RTC_MAX_IOCTL 0x0b
64
65#endif
66