Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-arm/rtc.h |
| 3 | * |
| 4 | * Copyright (C) 2003 Deep Blue Solutions Ltd. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #ifndef ASMARM_RTC_H |
| 11 | #define ASMARM_RTC_H |
| 12 | |
| 13 | struct module; |
| 14 | |
| 15 | struct rtc_ops { |
| 16 | struct module *owner; |
| 17 | int (*open)(void); |
| 18 | void (*release)(void); |
| 19 | int (*ioctl)(unsigned int, unsigned long); |
| 20 | |
Russell King | d5aa207 | 2005-04-30 12:19:28 +0100 | [diff] [blame] | 21 | int (*read_time)(struct rtc_time *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | int (*set_time)(struct rtc_time *); |
Russell King | d5aa207 | 2005-04-30 12:19:28 +0100 | [diff] [blame] | 23 | int (*read_alarm)(struct rtc_wkalrm *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | int (*set_alarm)(struct rtc_wkalrm *); |
| 25 | int (*proc)(char *buf); |
| 26 | }; |
| 27 | |
| 28 | void rtc_time_to_tm(unsigned long, struct rtc_time *); |
| 29 | int rtc_tm_to_time(struct rtc_time *, unsigned long *); |
| 30 | int rtc_valid_tm(struct rtc_time *); |
| 31 | void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *); |
| 32 | void rtc_update(unsigned long, unsigned long); |
| 33 | int register_rtc(struct rtc_ops *); |
| 34 | void unregister_rtc(struct rtc_ops *); |
| 35 | |
| 36 | static inline int rtc_periodic_alarm(struct rtc_time *tm) |
| 37 | { |
| 38 | return (tm->tm_year == -1) || |
| 39 | ((unsigned)tm->tm_mon >= 12) || |
| 40 | ((unsigned)(tm->tm_mday - 1) >= 31) || |
| 41 | ((unsigned)tm->tm_hour > 23) || |
| 42 | ((unsigned)tm->tm_min > 59) || |
| 43 | ((unsigned)tm->tm_sec > 59); |
| 44 | } |
| 45 | |
| 46 | #endif |