1
0
Fork 0
forked from len0rd/rockbox

H300: RTC support

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8284 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-12-22 23:48:32 +00:00
parent 0dac8b77b8
commit e57471a1be
5 changed files with 41 additions and 3 deletions

View file

@ -21,12 +21,41 @@
#include "i2c.h"
#include "rtc.h"
#include "kernel.h"
#include "system.h"
#include "pcf50606.h"
#include <stdbool.h>
#define RTC_ADR 0xd0
#define RTC_DEV_WRITE (RTC_ADR | 0x00)
#define RTC_DEV_READ (RTC_ADR | 0x01)
#if CONFIG_RTC == RTC_PCF50606
void rtc_init(void)
{
}
int rtc_read_datetime(unsigned char* buf) {
int rc;
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
rc = pcf50606_read_multiple(0x0a, buf, 7);
set_irq_level(oldlevel);
return rc;
}
int rtc_write_datetime(unsigned char* buf) {
int rc;
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
rc = pcf50606_write_multiple(0x0a, buf, 7);
set_irq_level(oldlevel);
return rc;
}
#else
void rtc_init(void)
{
unsigned char data;
@ -278,5 +307,6 @@ int rtc_write_datetime(unsigned char* buf) {
return rc;
}
#endif /* CONFIG_RTC == RTC_PCF50606 */
#endif /* CONFIG_RTC */