Allow sims to shut down normally from panic code.
[kugel-rb.git] / uisimulator / common / stubs.c
blob58e18392bc2f4555012f9a8ad2aa6fb97d1d2c7f
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>
25 #include "debug.h"
27 #include "screens.h"
28 #include "button.h"
30 #include "string.h"
31 #include "lcd.h"
33 #include "power.h"
35 #include "ata.h" /* for volume definitions */
37 extern char having_new_lcd;
38 static bool storage_spinning = false;
40 #if CONFIG_CODEC != SWCODEC
41 void audio_set_buffer_margin(int seconds)
43 (void)seconds;
45 #endif
47 int fat_startsector(void)
49 return 63;
52 bool fat_ismounted(int volume)
54 (void)volume;
55 return true;
58 int storage_init(void)
60 return 1;
63 int storage_write_sectors(IF_MV2(int drive,)
64 unsigned long start,
65 int count,
66 const void* buf)
68 IF_MV((void)drive;)
69 int i;
71 for (i=0; i<count; i++ ) {
72 FILE* f;
73 char name[32];
75 sprintf(name,"sector%lX.bin",start+i);
76 f=fopen(name,"wb");
77 if (f) {
78 fwrite(buf,512,1,f);
79 fclose(f);
82 return 1;
85 int storage_read_sectors(IF_MV2(int drive,)
86 unsigned long start,
87 int count,
88 void* buf)
90 IF_MV((void)drive;)
91 int i;
93 for (i=0; i<count; i++ ) {
94 FILE* f;
95 char name[32];
97 DEBUGF("Reading sector %lX\n",start+i);
98 sprintf(name,"sector%lX.bin",start+i);
99 f=fopen(name,"rb");
100 if (f) {
101 fread(buf,512,1,f);
102 fclose(f);
105 return 1;
108 void storage_spin(void)
110 storage_spinning = true;
113 void storage_sleep(void)
117 bool storage_disk_is_active(void)
119 return storage_spinning;
122 void storage_spindown(int s)
124 (void)s;
125 storage_spinning = false;
128 void rtc_init(void)
132 int rtc_read(int address)
134 return address ^ 0x55;
137 int rtc_write(int address, int value)
139 (void)address;
140 (void)value;
141 return 0;
144 int rtc_read_datetime(unsigned char* buf)
146 time_t now = time(NULL);
147 struct tm *teem = localtime(&now);
149 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
150 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
151 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
152 buf[3] = (teem->tm_wday);
153 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
154 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
155 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
157 return 0;
160 int rtc_write_datetime(unsigned char* buf)
162 (void)buf;
163 return 0;
166 #ifdef HAVE_RTC_ALARM
167 void rtc_get_alarm(int *h, int *m)
169 *h = 11;
170 *m = 55;
173 void rtc_set_alarm(int h, int m)
175 (void)h;
176 (void)m;
179 bool rtc_enable_alarm(bool enable)
181 return enable;
184 extern bool sim_alarm_wakeup;
185 bool rtc_check_alarm_started(bool release_alarm)
187 (void)release_alarm;
188 return sim_alarm_wakeup;
191 bool rtc_check_alarm_flag(void)
193 return true;
195 #endif
197 #ifdef HAVE_HEADPHONE_DETECTION
198 bool headphones_inserted(void)
200 return true;
202 #endif
204 #ifdef HAVE_LCD_ENABLE
205 bool lcd_enabled(void)
207 return true;
209 #endif
211 #ifdef HAVE_LCD_SLEEP
212 void lcd_sleep(void)
215 #endif
217 #ifdef HAVE_SPDIF_POWER
218 void spdif_power_enable(bool on)
220 (void)on;
223 bool spdif_powered(void)
225 return false;
227 #endif
229 bool is_new_player(void)
231 return having_new_lcd;
234 #ifdef HAVE_USB_POWER
235 bool usb_powered(void)
237 return false;
240 bool usb_charging_enable(bool on)
242 (void)on;
243 return false;
245 #endif
247 #if CONFIG_CHARGING
248 bool charger_inserted(void)
250 return false;
253 bool power_input_present(void)
255 return false;
258 unsigned int power_input_status(void)
260 #ifdef HAVE_BATTERY_SWITCH
261 return POWER_INPUT_BATTERY;
262 #else
263 return POWER_INPUT_NONE;
264 #endif
267 bool charging_state(void)
269 return false;
271 #endif /* CONFIG_CHARGING */
273 bool usb_inserted(void)
275 return false;
278 #ifdef HAVE_REMOTE_LCD_TICKING
279 void lcd_remote_emireduce(bool state)
281 (void)state;
283 #endif
285 void lcd_set_contrast( int x )
287 (void)x;
290 void mpeg_set_pitch(int pitch)
292 (void)pitch;
295 static int sleeptime;
296 void set_sleep_timer(int seconds)
298 sleeptime = seconds;
301 int get_sleep_timer(void)
303 return sleeptime;
306 #ifdef HAVE_LCD_CHARCELLS
307 void lcd_clearrect (int x, int y, int nx, int ny)
309 /* Reprint char if you want to change anything */
310 (void)x;
311 (void)y;
312 (void)nx;
313 (void)ny;
316 void lcd_fillrect (int x, int y, int nx, int ny)
318 /* Reprint char if you want to change display anything */
319 (void)x;
320 (void)y;
321 (void)nx;
322 (void)ny;
324 #endif
326 void cpu_sleep(bool enabled)
328 (void)enabled;
331 void button_set_flip(bool yesno)
333 (void)yesno;
336 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
337 void touchpad_set_sensitivity(int level)
339 (void)level;
341 #endif
343 void system_exception_wait(void)
345 thread_sdl_exception_wait();
348 void system_reboot(void)
350 thread_sdl_exception_wait();
353 /* assure an unused place to direct virtual pointers to */
354 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
355 unsigned char vp_dummy[VIRT_SIZE];