summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/rtc/rtc_e8564.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-13 13:06:18 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-13 13:37:21 -0400
commit4a3d04654580b1771fcda3492491843d5eac10ad (patch)
treec93aef6dda1960d357e0da146164b0f459c389b3 /firmware/drivers/rtc/rtc_e8564.c
parentb4865b05b0a3cc45f2873599c6411bef92f40b1c (diff)
downloadrockbox-4a3d046545.tar.gz
rockbox-4a3d046545.tar.bz2
rockbox-4a3d046545.zip
Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
Diffstat (limited to 'firmware/drivers/rtc/rtc_e8564.c')
-rw-r--r--firmware/drivers/rtc/rtc_e8564.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/firmware/drivers/rtc/rtc_e8564.c b/firmware/drivers/rtc/rtc_e8564.c
index 7837bbaa83..ee2449ffb8 100644
--- a/firmware/drivers/rtc/rtc_e8564.c
+++ b/firmware/drivers/rtc/rtc_e8564.c
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
- * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum,
+ * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum,
* Przemyslaw Holubowski
*
* This program is free software; you can redistribute it and/or
@@ -59,13 +59,14 @@ void rtc_init(void)
{
unsigned char tmp;
int rv;
-
+
/* initialize Control 1 register */
tmp = 0;
pp_i2c_send(RTC_ADDR, RTC_CTRL1, tmp);
-
+
/* read value of the Control 2 register - we'll need it to preserve alarm and timer interrupt assertion flags */
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
+ (void)rv;
/* preserve alarm and timer interrupt flags */
tmp &= (RTC_TF | RTC_AF | RTC_TIE | RTC_AIE);
pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
@@ -119,6 +120,7 @@ void rtc_set_alarm(int h, int m)
/* clear alarm interrupt */
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, buf);
+ (void)rv;
buf[0] &= RTC_AF;
pp_i2c_send(RTC_ADDR, RTC_CTRL2, buf[0]);
@@ -128,7 +130,7 @@ void rtc_set_alarm(int h, int m)
else
/* ignore minutes comparison query */
buf[0] = RTC_AE;
-
+
if( h >= 0 )
buf[1] = DEC2BCD(h);
else
@@ -172,7 +174,7 @@ void rtc_enable_alarm(bool enable)
}
else
{
- /* disable alarm interrupt */
+ /* disable alarm interrupt */
if(rtc_lock_alarm_clear)
/* lock disabling alarm before it was checked whether or not the unit was started by RTC alarm */
return;
@@ -180,6 +182,7 @@ void rtc_enable_alarm(bool enable)
tmp &= ~(RTC_AIE | RTC_AF);
pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
}
+ (void)rv;
}
bool rtc_check_alarm_started(bool release_alarm)
@@ -193,14 +196,14 @@ bool rtc_check_alarm_started(bool release_alarm)
{
started = alarm_state;
alarm_state &= ~release_alarm;
- }
- else
- {
+ }
+ else
+ {
/* read Control 2 register which contains alarm flag */
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
alarm_state = started = ( (tmp & RTC_AF) && (tmp & RTC_AIE) );
-
+
if(release_alarm && started)
{
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
@@ -211,7 +214,8 @@ bool rtc_check_alarm_started(bool release_alarm)
run_before = true;
rtc_lock_alarm_clear = false;
}
-
+ (void)rv;
+
return started;
}
@@ -219,11 +223,10 @@ bool rtc_check_alarm_flag(void)
{
unsigned char tmp=0;
int rv=0;
-
+
/* read Control 2 register which contains alarm flag */
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
return (tmp & RTC_AF);
}
#endif /* HAVE_RTC_ALARM */
-