summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2007-03-03 00:11:20 +0000
committerRobert Kukla <roolku@rockbox.org>2007-03-03 00:11:20 +0000
commitae08eeb4ffeadb7b89f913180bdac099fc5c5071 (patch)
treef17480217ca239b14a6b4ec97d7cb45bf8840cc6 /firmware/drivers
parent909b9462da8387e1c8379a52058c61bf18e222e5 (diff)
downloadrockbox-ae08eeb4ffeadb7b89f913180bdac099fc5c5071.zip
rockbox-ae08eeb4ffeadb7b89f913180bdac099fc5c5071.tar.gz
rockbox-ae08eeb4ffeadb7b89f913180bdac099fc5c5071.tar.bz2
rockbox-ae08eeb4ffeadb7b89f913180bdac099fc5c5071.tar.xz
remove runtime detection of h1x0 series RTC MOD, but leave driver code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12554 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/fat.c20
-rw-r--r--firmware/drivers/rtc/rtc_ds1339_ds3231.c12
2 files changed, 6 insertions, 26 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index e4e7762..e3e1a75 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -31,9 +31,6 @@
#include "rbunicode.h"
#include "logf.h"
#include "atoi.h"
-#ifdef CONFIG_RTC
-#include "rtc.h"
-#endif
#define BYTES2INT16(array,pos) \
(array[pos] | (array[pos+1] << 8 ))
@@ -948,10 +945,6 @@ static void fat_time(unsigned short* date,
{
#ifdef CONFIG_RTC
struct tm* tm = get_time();
-#if CONFIG_RTC == RTC_DS1339_DS3231
- if(rtc_detected)
- {
-#endif /* CONFIG_RTC == RTC_DS1339_DS3231 */
if (date)
*date = ((tm->tm_year - 80) << 9) |
@@ -965,14 +958,7 @@ static void fat_time(unsigned short* date,
if (tenth)
*tenth = (tm->tm_sec & 1) * 100;
-
-#if CONFIG_RTC == RTC_DS1339_DS3231
- }
- else
-#endif /* CONFIG_RTC == RTC_DS1339_DS3231 */
-#endif /* CONFIG_RTC */
-#if !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231
- {
+#else
/* non-RTC version returns an increment from the supplied time, or a
* fixed standard time/date if no time given as input */
bool next_day = false;
@@ -1039,9 +1025,9 @@ static void fat_time(unsigned short* date,
}
if (tenth)
*tenth = 0;
- }
-#endif /* !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 */
+#endif /* CONFIG_RTC */
}
+
static int write_long_name(struct fat_file* file,
unsigned int firstentry,
unsigned int numentries,
diff --git a/firmware/drivers/rtc/rtc_ds1339_ds3231.c b/firmware/drivers/rtc/rtc_ds1339_ds3231.c
index 7396c2e..e343c96 100644
--- a/firmware/drivers/rtc/rtc_ds1339_ds3231.c
+++ b/firmware/drivers/rtc/rtc_ds1339_ds3231.c
@@ -22,17 +22,10 @@
#define RTC_ADDR 0xD0
-bool rtc_detected = false;
-
void rtc_init(void)
{
- char byte;
-
sw_i2c_init();
- /* read one byte from RTC; 0 on success */
- rtc_detected = !sw_i2c_read(RTC_ADDR, 0, &byte, 1);
-
#ifdef HAVE_RTC_ALARM
/* Check + save alarm bit first, before the power thread starts watching */
rtc_check_alarm_started(false);
@@ -72,7 +65,8 @@ bool rtc_check_alarm_flag(void)
sw_i2c_read(RTC_ADDR, 0x0f, buf, 1);
if (buf[0] & 0x02) flag = true;
- rtc_enable_alarm(false);
+ buf[0] = 0x00;
+ sw_i2c_write(RTC_ADDR, 0x0f, buf, 1);
return flag;
}
@@ -109,7 +103,7 @@ bool rtc_enable_alarm(bool enable)
{
unsigned char buf[2];
- buf[0] = enable ? 0x26 : 0x04; /* BBSQI INTCN A2IE vs INTCH only */
+ buf[0] = enable ? 0x26 : 0x24; /* BBSQI INTCN A2IE vs INTCH only */
buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */
sw_i2c_write(RTC_ADDR, 0x0e, buf, 2);