From 060320b95c99d91fd2e72cc1c3aabbad8d99127d Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sun, 11 Dec 2005 02:00:28 +0000 Subject: Fix red sim builds - add rtc_read_datetime and rtc_write_datetime functions for the simulator git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8218 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/stubs.c | 47 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 73890378f5..d6170e13ca 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c @@ -166,37 +166,36 @@ bool simulate_usb(void) int rtc_read(int address) { - time_t now = time(NULL); - struct tm *teem = localtime(&now); - - switch(address) { - case 3: /* hour */ - return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4); - - case 2: /* minute */ - return (teem->tm_min%10) | ((teem->tm_min/10) << 4); - - case 1: /* seconds */ - return (teem->tm_sec%10) | ((teem->tm_sec/10) << 4); + return address ^ 0x55; +} - case 7: /* year */ - return ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4); +int rtc_write(int address, int value) +{ + (void)address; + (void)value; + return 0; +} - case 6: /* month */ - return ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4); +int rtc_read_datetime(unsigned char* buf) +{ + time_t now = time(NULL); + struct tm *teem = localtime(&now); - case 5: /* day */ - return (teem->tm_mday%10) | ((teem->tm_mday/10) << 4); - } + buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4); + buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4); + buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4); + buf[3] = (teem->tm_wday); + buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4); + buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4); + buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4); - return address ^ 0x55; + return 0; } -int rtc_write(int address, int value) +int rtc_write_datetime(unsigned char* buf) { - (void)address; - (void)value; - return 0; + (void)buf; + return 0; } bool is_new_player(void) -- cgit v1.2.3