Commit 16856fff authored by Russell King's avatar Russell King

[ARM] Add generic RTC implementation.

This provides a number of helper functions and data structures
for RTC implementations to make use of, including a standard
implemention for /proc/driver/rtc and the rtc miscdevice.  It
supports runtime registration of RTC timekeeping sources.
parent 2f8b11c4
......@@ -2,6 +2,7 @@
# Makefile for the linux kernel.
#
obj-y += rtctime.o
obj-$(CONFIG_ARM_AMBA) += amba.o
obj-$(CONFIG_ICST525) += icst525.o
obj-$(CONFIG_SA1111) += sa1111.o
......
This diff is collapsed.
/*
* 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);
void (*read_time)(struct rtc_time *);
int (*set_time)(struct rtc_time *);
void (*read_alarm)(struct rtc_wkalrm *);
int (*set_alarm)(struct rtc_wkalrm *);
int (*proc)(char *buf);
};
void rtc_time_to_tm(unsigned long, struct rtc_time *);
int rtc_tm_to_time(struct rtc_time *, unsigned long *);
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment