Simulate lcd_enable and lcd_sleep in the simulator. Therefore, turn backlight-sim...
[kugel-rb/myfork.git] / uisimulator / common / stubs.c
blob1d0d6c51d833b5e6ca638d5dcfe8b34443179e25
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 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include <stdio.h>
22 #include <time.h>
23 #include <stdbool.h>
24 #include "thread-sdl.h"
26 #include "debug.h"
28 #include "screens.h"
29 #include "button.h"
31 #include "string.h"
32 #include "lcd.h"
34 #include "power.h"
36 #include "ata.h" /* for volume definitions */
38 extern char having_new_lcd;
39 static bool storage_spinning = false;
41 #if CONFIG_CODEC != SWCODEC
42 void audio_set_buffer_margin(int seconds)
44 (void)seconds;
46 #endif
48 int fat_startsector(void)
50 return 63;
53 bool fat_ismounted(int volume)
55 (void)volume;
56 return true;
59 int storage_init(void)
61 return 1;
64 int storage_write_sectors(IF_MV2(int drive,)
65 unsigned long start,
66 int count,
67 const void* buf)
69 IF_MV((void)drive;)
70 int i;
72 for (i=0; i<count; i++ ) {
73 FILE* f;
74 char name[32];
76 sprintf(name,"sector%lX.bin",start+i);
77 f=fopen(name,"wb");
78 if (f) {
79 fwrite(buf,512,1,f);
80 fclose(f);
83 return 1;
86 int storage_read_sectors(IF_MV2(int drive,)
87 unsigned long start,
88 int count,
89 void* buf)
91 IF_MV((void)drive;)
92 int i;
94 for (i=0; i<count; i++ ) {
95 FILE* f;
96 char name[32];
98 DEBUGF("Reading sector %lX\n",start+i);
99 sprintf(name,"sector%lX.bin",start+i);
100 f=fopen(name,"rb");
101 if (f) {
102 fread(buf,512,1,f);
103 fclose(f);
106 return 1;
109 void storage_spin(void)
111 storage_spinning = true;
114 void storage_sleep(void)
118 bool storage_disk_is_active(void)
120 return storage_spinning;
123 void storage_spindown(int s)
125 (void)s;
126 storage_spinning = false;
129 void rtc_init(void)
133 int rtc_read(int address)
135 return address ^ 0x55;
138 int rtc_write(int address, int value)
140 (void)address;
141 (void)value;
142 return 0;
145 int rtc_read_datetime(unsigned char* buf)
147 time_t now = time(NULL);
148 struct tm *teem = localtime(&now);
150 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
151 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
152 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
153 buf[3] = (teem->tm_wday);
154 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
155 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
156 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
158 return 0;
161 int rtc_write_datetime(unsigned char* buf)
163 (void)buf;
164 return 0;
167 #ifdef HAVE_RTC_ALARM
168 void rtc_get_alarm(int *h, int *m)
170 *h = 11;
171 *m = 55;
174 void rtc_set_alarm(int h, int m)
176 (void)h;
177 (void)m;
180 bool rtc_enable_alarm(bool enable)
182 return enable;
185 extern bool sim_alarm_wakeup;
186 bool rtc_check_alarm_started(bool release_alarm)
188 (void)release_alarm;
189 return sim_alarm_wakeup;
192 bool rtc_check_alarm_flag(void)
194 return true;
196 #endif
198 #ifdef HAVE_HEADPHONE_DETECTION
199 bool headphones_inserted(void)
201 return true;
203 #endif
205 #ifdef HAVE_SPDIF_POWER
206 void spdif_power_enable(bool on)
208 (void)on;
211 bool spdif_powered(void)
213 return false;
215 #endif
217 bool is_new_player(void)
219 return having_new_lcd;
222 #ifdef HAVE_USB_POWER
223 bool usb_powered(void)
225 return false;
228 bool usb_charging_enable(bool on)
230 (void)on;
231 return false;
233 #endif
235 #if CONFIG_CHARGING
236 bool charger_inserted(void)
238 return false;
241 bool power_input_present(void)
243 return false;
246 unsigned int power_input_status(void)
248 #ifdef HAVE_BATTERY_SWITCH
249 return POWER_INPUT_BATTERY;
250 #else
251 return POWER_INPUT_NONE;
252 #endif
255 bool charging_state(void)
257 return false;
259 #endif /* CONFIG_CHARGING */
261 bool usb_inserted(void)
263 return false;
266 #ifdef HAVE_REMOTE_LCD_TICKING
267 void lcd_remote_emireduce(bool state)
269 (void)state;
271 #endif
273 void lcd_set_contrast( int x )
275 (void)x;
278 void mpeg_set_pitch(int pitch)
280 (void)pitch;
283 static int sleeptime;
284 void set_sleep_timer(int seconds)
286 sleeptime = seconds;
289 int get_sleep_timer(void)
291 return sleeptime;
294 #ifdef HAVE_LCD_CHARCELLS
295 void lcd_clearrect (int x, int y, int nx, int ny)
297 /* Reprint char if you want to change anything */
298 (void)x;
299 (void)y;
300 (void)nx;
301 (void)ny;
304 void lcd_fillrect (int x, int y, int nx, int ny)
306 /* Reprint char if you want to change display anything */
307 (void)x;
308 (void)y;
309 (void)nx;
310 (void)ny;
312 #endif
314 void cpu_sleep(bool enabled)
316 (void)enabled;
319 void button_set_flip(bool yesno)
321 (void)yesno;
324 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
325 void touchpad_set_sensitivity(int level)
327 (void)level;
329 #endif
331 void system_exception_wait(void)
333 thread_sdl_exception_wait();
336 void system_reboot(void)
338 thread_sdl_exception_wait();