forked from len0rd/rockbox
rtc_init() takes care of both the ST and HT bits
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1541 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a25d7ce126
commit
50f1ea16c5
1 changed files with 15 additions and 3 deletions
|
@ -28,9 +28,21 @@
|
||||||
void rtc_init(void)
|
void rtc_init(void)
|
||||||
{
|
{
|
||||||
unsigned char data;
|
unsigned char data;
|
||||||
data = (unsigned int)rtc_read(0x0c);
|
rtc_write(0x13, 0x10); /* 32 kHz square wave */
|
||||||
data &= 0xbf;
|
|
||||||
rtc_write(0x0c,data);
|
/* Clear the Stop bit if it is set */
|
||||||
|
data = rtc_read(0x01);
|
||||||
|
if(data & 0x80)
|
||||||
|
rtc_write(0x01, 0x00);
|
||||||
|
|
||||||
|
/* Clear the HT bit if it is set */
|
||||||
|
data = rtc_read(0x0c);
|
||||||
|
|
||||||
|
if(data & 0x40)
|
||||||
|
{
|
||||||
|
data &= ~0x40;
|
||||||
|
rtc_write(0x0c,data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtc_write(unsigned char address, unsigned char value)
|
int rtc_write(unsigned char address, unsigned char value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue