1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
29 /* Macros used to convert to and from BCD, used in various rtc drivers
30 this is the wrong place but misc.h is in apps... */
31 #define BCD2DEC(X) (((((X)>>4) & 0x0f) * 10) + ((X) & 0xf))
32 #define DEC2BCD(X) ((((X)/10)<<4) | ((X)%10))
36 /* Common functions for all targets */
38 int rtc_read_datetime(struct tm
*tm
);
39 int rtc_write_datetime(const struct tm
*tm
);
41 #if CONFIG_RTC == RTC_M41ST84W
43 /* The RTC in the Archos devices is used for much more than just the clock
45 int rtc_read(unsigned char address
);
46 int rtc_read_multiple(unsigned char address
, unsigned char *buf
, int numbytes
);
47 int rtc_write(unsigned char address
, unsigned char value
);
49 #endif /* RTC_M41ST84W */
52 void rtc_set_alarm(int h
, int m
);
53 void rtc_get_alarm(int *h
, int *m
);
54 void rtc_enable_alarm(bool enable
);
55 bool rtc_check_alarm_started(bool release_alarm
);
56 bool rtc_check_alarm_flag(void);
57 #endif /* HAVE_RTC_ALARM */
59 #endif /* CONFIG_RTC */