Codepolice: the patch I accepted contained some tabs. Oops
[kugel-rb.git] / uisimulator / common / stubs.c
blob7b630eb25bf89a1e7920925505a7c7d16952df7a
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 "ata.h" /* for volume definitions */
35 extern char having_new_lcd;
36 static bool ata_spinning = false;
38 #if CONFIG_CODEC != SWCODEC
39 void audio_set_buffer_margin(int seconds)
41 (void)seconds;
43 #endif
45 int fat_startsector(void)
47 return 63;
50 bool fat_ismounted(int volume)
52 (void)volume;
53 return true;
56 int ata_write_sectors(IF_MV2(int drive,)
57 unsigned long start,
58 int count,
59 const void* buf)
61 IF_MV((void)drive;)
62 int i;
64 for (i=0; i<count; i++ ) {
65 FILE* f;
66 char name[32];
68 sprintf(name,"sector%lX.bin",start+i);
69 f=fopen(name,"wb");
70 if (f) {
71 fwrite(buf,512,1,f);
72 fclose(f);
75 return 1;
78 int ata_read_sectors(IF_MV2(int drive,)
79 unsigned long start,
80 int count,
81 void* buf)
83 IF_MV((void)drive;)
84 int i;
86 for (i=0; i<count; i++ ) {
87 FILE* f;
88 char name[32];
90 DEBUGF("Reading sector %lX\n",start+i);
91 sprintf(name,"sector%lX.bin",start+i);
92 f=fopen(name,"rb");
93 if (f) {
94 fread(buf,512,1,f);
95 fclose(f);
98 return 1;
101 void ata_delayed_write(unsigned long sector, const void* buf)
103 ata_write_sectors(IF_MV2(0,) sector, 1, buf);
106 void ata_flush(void)
110 void ata_spin(void)
112 ata_spinning = true;
115 void ata_sleep(void)
117 DEBUGF("ata_sleep()\n");
120 bool ata_disk_is_active(void)
122 return ata_spinning;
125 void ata_spindown(int s)
127 (void)s;
128 ata_spinning = false;
131 void rtc_init(void)
135 int rtc_read(int address)
137 return address ^ 0x55;
140 int rtc_write(int address, int value)
142 (void)address;
143 (void)value;
144 return 0;
147 int rtc_read_datetime(unsigned char* buf)
149 time_t now = time(NULL);
150 struct tm *teem = localtime(&now);
152 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
153 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
154 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
155 buf[3] = (teem->tm_wday);
156 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
157 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
158 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
160 return 0;
163 int rtc_write_datetime(unsigned char* buf)
165 (void)buf;
166 return 0;
169 #ifdef HAVE_RTC_ALARM
170 void rtc_get_alarm(int *h, int *m)
172 *h = 11;
173 *m = 55;
176 void rtc_set_alarm(int h, int m)
178 (void)h;
179 (void)m;
182 bool rtc_enable_alarm(bool enable)
184 return enable;
187 extern bool sim_alarm_wakeup;
188 bool rtc_check_alarm_started(bool release_alarm)
190 (void)release_alarm;
191 return sim_alarm_wakeup;
194 bool rtc_check_alarm_flag(void)
196 return true;
198 #endif
200 #ifdef HAVE_HEADPHONE_DETECTION
201 bool headphones_inserted(void)
203 return true;
205 #endif
207 #ifdef HAVE_LCD_ENABLE
208 bool lcd_enabled(void)
210 return true;
212 #endif
214 bool charging_state(void)
216 return false;
219 bool charger_inserted(void)
221 return false;
224 #ifdef HAVE_SPDIF_POWER
225 void spdif_power_enable(bool on)
227 (void)on;
230 bool spdif_powered(void)
232 return false;
234 #endif
236 bool is_new_player(void)
238 return having_new_lcd;
241 #ifdef HAVE_USB_POWER
242 bool usb_powered(void)
244 return false;
247 #if CONFIG_CHARGING
248 bool usb_charging_enable(bool on)
250 (void)on;
251 return false;
253 #endif
254 #endif
256 bool usb_inserted(void)
258 return false;
261 #ifdef HAVE_REMOTE_LCD_TICKING
262 void lcd_remote_emireduce(bool state)
264 (void)state;
266 #endif
268 void lcd_set_contrast( int x )
270 (void)x;
273 void mpeg_set_pitch(int pitch)
275 (void)pitch;
278 static int sleeptime;
279 void set_sleep_timer(int seconds)
281 sleeptime = seconds;
284 int get_sleep_timer(void)
286 return sleeptime;
289 #ifdef HAVE_LCD_CHARCELLS
290 void lcd_clearrect (int x, int y, int nx, int ny)
292 /* Reprint char if you want to change anything */
293 (void)x;
294 (void)y;
295 (void)nx;
296 (void)ny;
299 void lcd_fillrect (int x, int y, int nx, int ny)
301 /* Reprint char if you want to change display anything */
302 (void)x;
303 (void)y;
304 (void)nx;
305 (void)ny;
307 #endif
309 void cpu_sleep(bool enabled)
311 (void)enabled;
314 void button_set_flip(bool yesno)
316 (void)yesno;
319 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
320 void touchpad_set_sensitivity(int level)
322 (void)level;
324 #endif
326 /* assure an unused place to direct virtual pointers to */
327 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
328 unsigned char vp_dummy[VIRT_SIZE];