forked from len0rd/rockbox
rtc_enable_alarm() needs no return value
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26245 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8302c5fe17
commit
ba46c88c6f
10 changed files with 13 additions and 30 deletions
|
|
@ -111,9 +111,9 @@ void rtc_alarm_poweroff(void)
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_enable_alarm(bool enable)
|
void rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
return alarm_enabled = enable;
|
alarm_enabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_check_alarm_started(bool release_alarm)
|
bool rtc_check_alarm_started(bool release_alarm)
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,7 @@ void rtc_get_alarm(int *h, int *m)
|
||||||
/* turn alarm on or off by setting the alarm flag enable */
|
/* turn alarm on or off by setting the alarm flag enable */
|
||||||
/* the alarm is automatically disabled when the RTC gets Vcc power at startup */
|
/* the alarm is automatically disabled when the RTC gets Vcc power at startup */
|
||||||
/* avoid that an alarm occurs when the device is on because this locks the ON key forever */
|
/* avoid that an alarm occurs when the device is on because this locks the ON key forever */
|
||||||
/* returns false if alarm was set and alarm flag (output) is off */
|
void rtc_enable_alarm(bool enable)
|
||||||
/* returns true if alarm flag went on, which would lock the device, so the alarm was disabled again */
|
|
||||||
bool rtc_enable_alarm(bool enable)
|
|
||||||
{
|
{
|
||||||
unsigned char buf[2];
|
unsigned char buf[2];
|
||||||
|
|
||||||
|
|
@ -109,8 +107,6 @@ bool rtc_enable_alarm(bool enable)
|
||||||
buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */
|
buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */
|
||||||
|
|
||||||
sw_i2c_write(RTC_ADDR, 0x0e, buf, 2);
|
sw_i2c_write(RTC_ADDR, 0x0e, buf, 2);
|
||||||
|
|
||||||
return false; /* all ok */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_RTC_ALARM */
|
#endif /* HAVE_RTC_ALARM */
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ void rtc_get_alarm(int *h, int *m)
|
||||||
*h = BCD2DEC(buf[0] & 0x3f);
|
*h = BCD2DEC(buf[0] & 0x3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_enable_alarm(bool enable)
|
void rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
unsigned char tmp=0;
|
unsigned char tmp=0;
|
||||||
int rv=0;
|
int rv=0;
|
||||||
|
|
@ -172,13 +172,11 @@ bool rtc_enable_alarm(bool enable)
|
||||||
/* disable alarm interrupt */
|
/* disable alarm interrupt */
|
||||||
if(rtc_lock_alarm_clear)
|
if(rtc_lock_alarm_clear)
|
||||||
/* lock disabling alarm before it was checked whether or not the unit was started by RTC alarm */
|
/* lock disabling alarm before it was checked whether or not the unit was started by RTC alarm */
|
||||||
return false;
|
return;
|
||||||
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
|
rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
|
||||||
tmp &= ~(RTC_AIE | RTC_AF);
|
tmp &= ~(RTC_AIE | RTC_AF);
|
||||||
pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
|
pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_check_alarm_started(bool release_alarm)
|
bool rtc_check_alarm_started(bool release_alarm)
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,7 @@ void rtc_get_alarm(int *h, int *m)
|
||||||
/* turn alarm on or off by setting the alarm flag enable */
|
/* turn alarm on or off by setting the alarm flag enable */
|
||||||
/* the alarm is automatically disabled when the RTC gets Vcc power at startup */
|
/* the alarm is automatically disabled when the RTC gets Vcc power at startup */
|
||||||
/* avoid that an alarm occurs when the device is on because this locks the ON key forever */
|
/* avoid that an alarm occurs when the device is on because this locks the ON key forever */
|
||||||
/* returns false if alarm was set and alarm flag (output) is off */
|
void rtc_enable_alarm(bool enable)
|
||||||
/* returns true if alarm flag went on, which would lock the device, so the alarm was disabled again */
|
|
||||||
bool rtc_enable_alarm(bool enable)
|
|
||||||
{
|
{
|
||||||
unsigned char data = rtc_read(0x0a);
|
unsigned char data = rtc_read(0x0a);
|
||||||
if (enable)
|
if (enable)
|
||||||
|
|
@ -164,8 +162,6 @@ bool rtc_enable_alarm(bool enable)
|
||||||
data |= 0xa0; /* turn bit d7=AFE and d5=ABE on */
|
data |= 0xa0; /* turn bit d7=AFE and d5=ABE on */
|
||||||
rtc_write(0x0a, data);
|
rtc_write(0x0a, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; /* all ok */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_RTC_ALARM */
|
#endif /* HAVE_RTC_ALARM */
|
||||||
|
|
|
||||||
|
|
@ -218,14 +218,12 @@ bool rtc_check_alarm_flag(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_enable_alarm(bool enable)
|
void rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
mc13783_clear(MC13783_INTERRUPT_MASK1, MC13783_TODAM);
|
mc13783_clear(MC13783_INTERRUPT_MASK1, MC13783_TODAM);
|
||||||
else
|
else
|
||||||
mc13783_set(MC13783_INTERRUPT_MASK1, MC13783_TODAM);
|
mc13783_set(MC13783_INTERRUPT_MASK1, MC13783_TODAM);
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_check_alarm_started(bool release_alarm)
|
bool rtc_check_alarm_started(bool release_alarm)
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,8 @@ bool rtc_check_alarm_flag(void)
|
||||||
* The Ipod bootloader clears all PCF interrupt registers and always enables
|
* The Ipod bootloader clears all PCF interrupt registers and always enables
|
||||||
* the "wake on RTC" bit on OOCC1, so we have to rely on other means to find
|
* the "wake on RTC" bit on OOCC1, so we have to rely on other means to find
|
||||||
* out if we just woke from an alarm.
|
* out if we just woke from an alarm.
|
||||||
* Return value is always false for us.
|
|
||||||
*/
|
*/
|
||||||
bool rtc_enable_alarm(bool enable)
|
void rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
if (enable) {
|
if (enable) {
|
||||||
/* Tell the PCF to ignore everything but second, minute and hour, so
|
/* Tell the PCF to ignore everything but second, minute and hour, so
|
||||||
|
|
@ -114,7 +113,6 @@ bool rtc_enable_alarm(bool enable)
|
||||||
/* Make sure we don't wake on RTC after shutting down */
|
/* Make sure we don't wake on RTC after shutting down */
|
||||||
pcf50605_wakeup_flags &= ~0x10;
|
pcf50605_wakeup_flags &= ~0x10;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,8 @@ void rtc_get_alarm(int *h, int *m)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* turn alarm on or off by setting the alarm flag enable
|
/* turn alarm on or off by setting the alarm flag enable
|
||||||
* returns false if alarm was set and alarm flag (output) is off
|
|
||||||
*/
|
*/
|
||||||
bool rtc_enable_alarm(bool enable)
|
vodi rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
|
|
@ -112,7 +111,5 @@ bool rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
RTCALM=0x00;
|
RTCALM=0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; /* all ok */
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ bool rtc_check_alarm_flag(void)
|
||||||
/**
|
/**
|
||||||
* Enables or disables the alarm.
|
* Enables or disables the alarm.
|
||||||
*/
|
*/
|
||||||
bool rtc_enable_alarm(bool enable)
|
void rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ int rtc_write(unsigned char address, unsigned char value);
|
||||||
#ifdef HAVE_RTC_ALARM
|
#ifdef HAVE_RTC_ALARM
|
||||||
void rtc_set_alarm(int h, int m);
|
void rtc_set_alarm(int h, int m);
|
||||||
void rtc_get_alarm(int *h, int *m);
|
void rtc_get_alarm(int *h, int *m);
|
||||||
bool rtc_enable_alarm(bool enable);
|
void rtc_enable_alarm(bool enable);
|
||||||
bool rtc_check_alarm_started(bool release_alarm);
|
bool rtc_check_alarm_started(bool release_alarm);
|
||||||
bool rtc_check_alarm_flag(void);
|
bool rtc_check_alarm_flag(void);
|
||||||
#endif /* HAVE_RTC_ALARM */
|
#endif /* HAVE_RTC_ALARM */
|
||||||
|
|
|
||||||
|
|
@ -169,9 +169,9 @@ void rtc_set_alarm(int h, int m)
|
||||||
(void)m;
|
(void)m;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtc_enable_alarm(bool enable)
|
void rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
return enable;
|
(void)enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool sim_alarm_wakeup;
|
extern bool sim_alarm_wakeup;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue