summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/rtc/rtc_e8564.c
diff options
context:
space:
mode:
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 */
-