create an UnZip derived class for zip file extraction to allow showing progress while...
[Rockbox.git] / uisimulator / common / stubs.c
blobc40d10082c493993bcbfe6e7882d13c4d29a526e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Björn Stenberg <bjorn@haxx.se>
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include <stdio.h>
20 #include <time.h>
21 #include <stdbool.h>
23 #include "debug.h"
25 #include "screens.h"
26 #include "button.h"
28 #include "string.h"
29 #include "lcd.h"
31 #include "ata.h" /* for volume definitions */
33 extern char having_new_lcd;
35 #if CONFIG_CODEC != SWCODEC
36 void audio_set_buffer_margin(int seconds)
38 (void)seconds;
40 #endif
42 int fat_startsector(void)
44 return 63;
47 bool fat_ismounted(int volume)
49 (void)volume;
50 return true;
53 int ata_write_sectors(IF_MV2(int drive,)
54 unsigned long start,
55 int count,
56 const void* buf)
58 IF_MV((void)drive;)
59 int i;
61 for (i=0; i<count; i++ ) {
62 FILE* f;
63 char name[32];
65 sprintf(name,"sector%lX.bin",start+i);
66 f=fopen(name,"wb");
67 if (f) {
68 fwrite(buf,512,1,f);
69 fclose(f);
72 return 1;
75 int ata_read_sectors(IF_MV2(int drive,)
76 unsigned long start,
77 int count,
78 void* buf)
80 IF_MV((void)drive;)
81 int i;
83 for (i=0; i<count; i++ ) {
84 FILE* f;
85 char name[32];
87 DEBUGF("Reading sector %lX\n",start+i);
88 sprintf(name,"sector%lX.bin",start+i);
89 f=fopen(name,"rb");
90 if (f) {
91 fread(buf,512,1,f);
92 fclose(f);
95 return 1;
98 void ata_delayed_write(unsigned long sector, const void* buf)
100 ata_write_sectors(IF_MV2(0,) sector, 1, buf);
103 void ata_flush(void)
107 void ata_spin(void)
111 void ata_spindown(int s)
113 (void)s;
116 void rtc_init(void)
120 int rtc_read(int address)
122 return address ^ 0x55;
125 int rtc_write(int address, int value)
127 (void)address;
128 (void)value;
129 return 0;
132 int rtc_read_datetime(unsigned char* buf)
134 time_t now = time(NULL);
135 struct tm *teem = localtime(&now);
137 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
138 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
139 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
140 buf[3] = (teem->tm_wday);
141 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
142 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
143 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
145 return 0;
148 int rtc_write_datetime(unsigned char* buf)
150 (void)buf;
151 return 0;
154 #ifdef HAVE_RTC_ALARM
155 void rtc_get_alarm(int *h, int *m)
157 *h = 11;
158 *m = 55;
161 void rtc_set_alarm(int h, int m)
163 (void)h;
164 (void)m;
167 bool rtc_enable_alarm(bool enable)
169 return enable;
172 extern bool sim_alarm_wakeup;
173 bool rtc_check_alarm_started(bool release_alarm)
175 (void)release_alarm;
176 return sim_alarm_wakeup;
179 bool rtc_check_alarm_flag(void)
181 return true;
183 #endif
185 #ifdef HAVE_HEADPHONE_DETECTION
186 bool headphones_inserted(void)
188 return true;
190 #endif
192 #ifdef HAVE_LCD_ENABLE
193 bool lcd_enabled(void)
195 return true;
197 #endif
199 bool charging_state(void)
201 return false;
204 bool charger_inserted(void)
206 return false;
209 #ifdef HAVE_SPDIF_POWER
210 void spdif_power_enable(bool on)
212 (void)on;
215 bool spdif_powered(void)
217 return false;
219 #endif
221 bool is_new_player(void)
223 return having_new_lcd;
226 #ifdef HAVE_USB_POWER
227 bool usb_powered(void)
229 return false;
232 #if CONFIG_CHARGING
233 bool usb_charging_enable(bool on)
235 (void)on;
236 return false;
238 #endif
239 #endif
241 bool usb_inserted(void)
243 return false;
246 #ifdef HAVE_REMOTE_LCD_TICKING
247 void lcd_remote_emireduce(bool state)
249 (void)state;
251 #endif
253 void lcd_set_contrast( int x )
255 (void)x;
258 void mpeg_set_pitch(int pitch)
260 (void)pitch;
263 static int sleeptime;
264 void set_sleep_timer(int seconds)
266 sleeptime = seconds;
269 int get_sleep_timer(void)
271 return sleeptime;
274 #ifdef HAVE_LCD_CHARCELLS
275 void lcd_clearrect (int x, int y, int nx, int ny)
277 /* Reprint char if you want to change anything */
278 (void)x;
279 (void)y;
280 (void)nx;
281 (void)ny;
284 void lcd_fillrect (int x, int y, int nx, int ny)
286 /* Reprint char if you want to change display anything */
287 (void)x;
288 (void)y;
289 (void)nx;
290 (void)ny;
292 #endif
294 void cpu_sleep(bool enabled)
296 (void)enabled;
299 void button_set_flip(bool yesno)
301 (void)yesno;
304 /* assure an unused place to direct virtual pointers to */
305 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
306 unsigned char vp_dummy[VIRT_SIZE];