diff options
author | Dave Chapman <dave@dchapman.com> | 2005-12-11 02:00:28 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2005-12-11 02:00:28 +0000 |
commit | 060320b95c99d91fd2e72cc1c3aabbad8d99127d (patch) | |
tree | c1d9641eb6e6003a3827d8adb6eb975df252f6a0 | |
parent | 4b32ec718dc7bda11c803f889d5c86350b871cfa (diff) | |
download | rockbox-060320b95c99d91fd2e72cc1c3aabbad8d99127d.tar.gz rockbox-060320b95c99d91fd2e72cc1c3aabbad8d99127d.zip |
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
-rw-r--r-- | uisimulator/common/stubs.c | 47 |
1 files 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) | |||
166 | 166 | ||
167 | int rtc_read(int address) | 167 | int rtc_read(int address) |
168 | { | 168 | { |
169 | time_t now = time(NULL); | 169 | return address ^ 0x55; |
170 | struct tm *teem = localtime(&now); | 170 | } |
171 | |||
172 | switch(address) { | ||
173 | case 3: /* hour */ | ||
174 | return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4); | ||
175 | |||
176 | case 2: /* minute */ | ||
177 | return (teem->tm_min%10) | ((teem->tm_min/10) << 4); | ||
178 | |||
179 | case 1: /* seconds */ | ||
180 | return (teem->tm_sec%10) | ((teem->tm_sec/10) << 4); | ||
181 | 171 | ||
182 | case 7: /* year */ | 172 | int rtc_write(int address, int value) |
183 | return ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4); | 173 | { |
174 | (void)address; | ||
175 | (void)value; | ||
176 | return 0; | ||
177 | } | ||
184 | 178 | ||
185 | case 6: /* month */ | 179 | int rtc_read_datetime(unsigned char* buf) |
186 | return ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4); | 180 | { |
181 | time_t now = time(NULL); | ||
182 | struct tm *teem = localtime(&now); | ||
187 | 183 | ||
188 | case 5: /* day */ | 184 | buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4); |
189 | return (teem->tm_mday%10) | ((teem->tm_mday/10) << 4); | 185 | buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4); |
190 | } | 186 | buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4); |
187 | buf[3] = (teem->tm_wday); | ||
188 | buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4); | ||
189 | buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4); | ||
190 | buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4); | ||
191 | 191 | ||
192 | return address ^ 0x55; | 192 | return 0; |
193 | } | 193 | } |
194 | 194 | ||
195 | int rtc_write(int address, int value) | 195 | int rtc_write_datetime(unsigned char* buf) |
196 | { | 196 | { |
197 | (void)address; | 197 | (void)buf; |
198 | (void)value; | 198 | return 0; |
199 | return 0; | ||
200 | } | 199 | } |
201 | 200 | ||
202 | bool is_new_player(void) | 201 | bool is_new_player(void) |