fuzev2: prevent button light flickering when accessing µSD
[kugel-rb.git] / firmware / export / rtc.h
blob57853f28ccb3b5e79a6b3a6b37aa3a559f8c4372
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 ****************************************************************************/
21 #ifndef _RTC_H_
22 #define _RTC_H_
24 #include <stdbool.h>
25 #include "system.h"
26 #include "config.h"
27 #include "time.h"
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))
34 #if CONFIG_RTC
36 /* Common functions for all targets */
37 void rtc_init(void);
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
44 data */
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 */
51 #ifdef HAVE_RTC_ALARM
52 void rtc_set_alarm(int h, int m);
53 void rtc_get_alarm(int *h, int *m);
54 bool 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 */
61 #endif