summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2007-02-28 13:20:36 +0000
committerRobert Kukla <roolku@rockbox.org>2007-02-28 13:20:36 +0000
commit50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324 (patch)
treed5197ea90c5dcfa574b84743ecbbd7fa2a754e55 /firmware/export
parent343c428f2cf97c82540aecf07d154e43ff40e79a (diff)
downloadrockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.zip
rockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.tar.gz
rockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.tar.bz2
rockbox-50b5ee4781a44234b4ea5dccf3be6ae5ec9fd324.tar.xz
FS#6419 - driver for H1x0 series RTC Mod with runtime detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12520 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config-h120.h8
-rw-r--r--firmware/export/config.h1
-rw-r--r--firmware/export/rtc.h9
-rw-r--r--firmware/export/sw_i2c.h30
4 files changed, 45 insertions, 3 deletions
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index e7fb73e..9dccf22 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -45,7 +45,13 @@
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
-/* Define this if you have an remote lcd */
+#ifndef SIMULATOR
+/* RTC is autodetected on target only */
+#define CONFIG_RTC RTC_DS1339_DS3231
+#define HAVE_ALARM_MOD
+#endif
+
+ /* Define this if you have an remote lcd */
#define HAVE_REMOTE_LCD
#define CONFIG_LCD LCD_S1D15E06
diff --git a/firmware/export/config.h b/firmware/export/config.h
index ac2ee68..085f86a 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -153,6 +153,7 @@
#define RTC_S3C2440 4
#define RTC_E8564 5 /* iriver H10 */
#define RTC_AS3514 6 /* Sandisk Sansa e200 series */
+#define RTC_DS1339_DS3231 7 /* h1x0 RTC mod */
/* USB On-the-go */
#define USBOTG_ISP1362 1362 /* iriver H300 */
diff --git a/firmware/export/rtc.h b/firmware/export/rtc.h
index c7e3c4a..2f13cbb 100644
--- a/firmware/export/rtc.h
+++ b/firmware/export/rtc.h
@@ -20,6 +20,7 @@
#define _RTC_H_
#include <stdbool.h>
+#include <system.h>
#ifdef CONFIG_RTC
@@ -27,6 +28,10 @@ extern const int dayname[];
extern const int monthname[];
+#if CONFIG_RTC == RTC_DS1339_DS3231
+extern bool rtc_detected;
+#endif
+
/* Common functions for all targets */
void rtc_init(void);
int rtc_read_datetime(unsigned char* buf);
@@ -40,6 +45,8 @@ int rtc_read(unsigned char address);
int rtc_read_multiple(unsigned char address, unsigned char *buf, int numbytes);
int rtc_write(unsigned char address, unsigned char value);
+#endif /* RTC_M41ST84W */
+
#ifdef HAVE_ALARM_MOD
void rtc_set_alarm(int h, int m);
void rtc_get_alarm(int *h, int *m);
@@ -48,8 +55,6 @@ bool rtc_check_alarm_started(bool release_alarm);
bool rtc_check_alarm_flag(void);
#endif /* HAVE_ALARM_MOD */
-#endif /* RTC_M41ST84W */
-
#endif /* CONFIG_RTC */
#endif
diff --git a/firmware/export/sw_i2c.h b/firmware/export/sw_i2c.h
new file mode 100644
index 0000000..42dccad
--- /dev/null
+++ b/firmware/export/sw_i2c.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2006 by Robert Kukla
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef _SW_I2C_H
+#define _SW_I2C_H
+
+#define SW_I2C_WRITE 0
+#define SW_I2C_READ 1
+
+void sw_i2c_init(void);
+int sw_i2c_write(unsigned char chip, unsigned char location, const unsigned char* buf, int count);
+int sw_i2c_read (unsigned char chip, unsigned char location, unsigned char* buf, int count);
+
+#endif