2002-06-24 13:23:01 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2003-01-22 12:50:34 +00:00
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese
|
2002-06-24 13:23:01 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-06-24 13:23:01 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _RTC_H_
|
|
|
|
#define _RTC_H_
|
|
|
|
|
2003-01-22 12:50:34 +00:00
|
|
|
#include <stdbool.h>
|
2007-03-03 00:11:20 +00:00
|
|
|
#include "system.h"
|
|
|
|
#include "config.h"
|
2009-09-26 14:58:32 +00:00
|
|
|
#include "time.h"
|
|
|
|
|
|
|
|
/* Macros used to convert to and from BCD, used in various rtc drivers
|
|
|
|
this is the wrong place but misc.h is in apps... */
|
|
|
|
#define BCD2DEC(X) (((((X)>>4) & 0x0f) * 10) + ((X) & 0xf))
|
|
|
|
#define DEC2BCD(X) ((((X)/10)<<4) | ((X)%10))
|
2003-01-22 12:50:34 +00:00
|
|
|
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2005-12-11 00:47:40 +00:00
|
|
|
|
|
|
|
/* Common functions for all targets */
|
2002-08-06 08:12:29 +00:00
|
|
|
void rtc_init(void);
|
2009-09-26 14:58:32 +00:00
|
|
|
int rtc_read_datetime(struct tm *tm);
|
|
|
|
int rtc_write_datetime(const struct tm *tm);
|
2005-12-11 00:47:40 +00:00
|
|
|
|
|
|
|
#if CONFIG_RTC == RTC_M41ST84W
|
|
|
|
|
|
|
|
/* The RTC in the Archos devices is used for much more than just the clock
|
|
|
|
data */
|
2002-06-24 13:23:01 +00:00
|
|
|
int rtc_read(unsigned char address);
|
2002-11-20 00:00:56 +00:00
|
|
|
int rtc_read_multiple(unsigned char address, unsigned char *buf, int numbytes);
|
2002-06-24 13:23:01 +00:00
|
|
|
int rtc_write(unsigned char address, unsigned char value);
|
2003-01-22 12:50:34 +00:00
|
|
|
|
2007-02-28 13:20:36 +00:00
|
|
|
#endif /* RTC_M41ST84W */
|
|
|
|
|
2007-02-28 21:55:11 +00:00
|
|
|
#ifdef HAVE_RTC_ALARM
|
2003-01-22 12:50:34 +00:00
|
|
|
void rtc_set_alarm(int h, int m);
|
|
|
|
void rtc_get_alarm(int *h, int *m);
|
2010-05-22 00:28:26 +00:00
|
|
|
void rtc_enable_alarm(bool enable);
|
2005-02-05 19:57:19 +00:00
|
|
|
bool rtc_check_alarm_started(bool release_alarm);
|
2005-02-06 17:21:42 +00:00
|
|
|
bool rtc_check_alarm_flag(void);
|
2007-02-28 21:55:11 +00:00
|
|
|
#endif /* HAVE_RTC_ALARM */
|
2003-01-22 12:50:34 +00:00
|
|
|
|
2005-12-04 15:23:47 +00:00
|
|
|
#endif /* CONFIG_RTC */
|
2002-06-24 13:23:01 +00:00
|
|
|
|
|
|
|
#endif
|
2009-09-26 14:58:32 +00:00
|
|
|
|