rtc.h 1.12 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 *  linux/include/asm-arm/rtc.h
 *
 *  Copyright (C) 2003 Deep Blue Solutions Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef ASMARM_RTC_H
#define ASMARM_RTC_H

struct module;

struct rtc_ops {
	struct module	*owner;
	int		(*open)(void);
	void		(*release)(void);
	int		(*ioctl)(unsigned int, unsigned long);

21
	int		(*read_time)(struct rtc_time *);
Linus Torvalds's avatar
Linus Torvalds committed
22
	int		(*set_time)(struct rtc_time *);
23
	int		(*read_alarm)(struct rtc_wkalrm *);
Linus Torvalds's avatar
Linus Torvalds committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
	int		(*set_alarm)(struct rtc_wkalrm *);
	int		(*proc)(char *buf);
};

void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *);
void rtc_update(unsigned long, unsigned long);
int register_rtc(struct rtc_ops *);
void unregister_rtc(struct rtc_ops *);

static inline int rtc_periodic_alarm(struct rtc_time *tm)
{
	return  (tm->tm_year == -1) ||
		((unsigned)tm->tm_mon >= 12) ||
		((unsigned)(tm->tm_mday - 1) >= 31) ||
		((unsigned)tm->tm_hour > 23) ||
		((unsigned)tm->tm_min > 59) ||
		((unsigned)tm->tm_sec > 59);
}

#endif