MPEGPlayer: Fix leakage of file decriptors if file wasn't accepted by playback engine...
[kugel-rb.git] / uisimulator / common / stubs.c
blobe0372d2683983d8357d5695e228de16c566f4d41
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 "debug.h"
26 #include "screens.h"
27 #include "button.h"
29 #include "string.h"
30 #include "lcd.h"
32 #include "power.h"
34 #include "ata.h" /* for volume definitions */
36 static bool storage_spinning = false;
38 #if CONFIG_CODEC != SWCODEC
39 void audio_set_buffer_margin(int seconds)
41 (void)seconds;
44 /* firmware/target/sh/archos/audio-archos.c */
46 /* list of tracks in memory */
47 #define MAX_ID3_TAGS (1<<4) /* Must be power of 2 */
48 #define MAX_ID3_TAGS_MASK (MAX_ID3_TAGS - 1)
50 static bool paused; /* playback is paused */
51 static bool playing; /* We are playing an MP3 stream */
53 bool audio_is_initialized = false;
55 void mp3_init(int volume, int bass, int treble, int balance, int loudness,
56 int avc, int channel_config, int stereo_width,
57 int mdb_strength, int mdb_harmonics,
58 int mdb_center, int mdb_shape, bool mdb_enable,
59 bool superbass)
61 (void)volume;
62 (void)bass;
63 (void)treble;
64 (void)balance;
65 (void)loudness;
66 (void)avc;
67 (void)channel_config;
68 (void)stereo_width;
69 (void)mdb_strength;
70 (void)mdb_harmonics;
71 (void)mdb_center;
72 (void)mdb_shape;
73 (void)mdb_enable;
74 (void)superbass;
75 audio_is_initialized = true;
77 playing = false;
78 paused = true;
81 void mp3_play_pause(bool play)
83 (void)play;
86 void mp3_play_stop(void)
90 unsigned char* mp3_get_pos(void)
92 return NULL;
95 void mp3_play_data(const unsigned char* start, int size,
96 void (*get_more)(unsigned char** start, size_t* size) /* callback fn */
99 (void)start; (void)size; (void)get_more;
102 /* firmware/drivers/audio/mas35xx.c */
103 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
104 void audiohw_set_loudness(int value)
106 (void)value;
109 void audiohw_set_avc(int value)
111 (void)value;
114 void audiohw_set_mdb_strength(int value)
116 (void)value;
119 void audiohw_set_mdb_harmonics(int value)
121 (void)value;
124 void audiohw_set_mdb_center(int value)
126 (void)value;
129 void audiohw_set_mdb_shape(int value)
131 (void)value;
134 void audiohw_set_mdb_enable(int value)
136 (void)value;
139 void audiohw_set_superbass(int value)
141 (void)value;
144 void audiohw_set_pitch(unsigned long value)
146 (void)value;
148 #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
149 #endif /* CODEC != SWCODEC */
151 int fat_startsector(void)
153 return 63;
156 bool fat_ismounted(int volume)
158 (void)volume;
159 return true;
162 int storage_spinup_time(void)
164 return 0;
167 int storage_init(void)
169 return 1;
172 int storage_write_sectors(IF_MV2(int drive,)
173 unsigned long start,
174 int count,
175 const void* buf)
177 IF_MV((void)drive;)
178 int i;
180 for (i=0; i<count; i++ ) {
181 FILE* f;
182 char name[32];
184 sprintf(name,"sector%lX.bin",start+i);
185 f=fopen(name,"wb");
186 if (f) {
187 fwrite(buf,512,1,f);
188 fclose(f);
191 return 1;
194 int storage_read_sectors(IF_MV2(int drive,)
195 unsigned long start,
196 int count,
197 void* buf)
199 IF_MV((void)drive;)
200 int i;
202 for (i=0; i<count; i++ ) {
203 FILE* f;
204 char name[32];
206 DEBUGF("Reading sector %lX\n",start+i);
207 sprintf(name,"sector%lX.bin",start+i);
208 f=fopen(name,"rb");
209 if (f) {
210 fread(buf,512,1,f);
211 fclose(f);
214 return 1;
217 void storage_spin(void)
219 storage_spinning = true;
222 void storage_sleep(void)
226 bool storage_disk_is_active(void)
228 return storage_spinning;
231 void storage_spindown(int s)
233 (void)s;
234 storage_spinning = false;
237 void rtc_init(void)
241 int rtc_read(int address)
243 return address ^ 0x55;
246 int rtc_write(int address, int value)
248 (void)address;
249 (void)value;
250 return 0;
253 int rtc_read_datetime(struct tm *tm)
255 time_t now = time(NULL);
256 *tm = *localtime(&now);
258 return 0;
261 int rtc_write_datetime(const struct tm *tm)
263 (void)tm;
264 return 0;
267 #ifdef HAVE_RTC_ALARM
268 void rtc_get_alarm(int *h, int *m)
270 *h = 11;
271 *m = 55;
274 void rtc_set_alarm(int h, int m)
276 (void)h;
277 (void)m;
280 void rtc_enable_alarm(bool enable)
282 (void)enable;
285 extern bool sim_alarm_wakeup;
286 bool rtc_check_alarm_started(bool release_alarm)
288 (void)release_alarm;
289 return sim_alarm_wakeup;
292 bool rtc_check_alarm_flag(void)
294 return true;
296 #endif
298 #ifdef HAVE_HEADPHONE_DETECTION
299 bool headphones_inserted(void)
301 return true;
303 #endif
305 #ifdef HAVE_SPDIF_POWER
306 void spdif_power_enable(bool on)
308 (void)on;
311 bool spdif_powered(void)
313 return false;
315 #endif
317 #ifdef ARCHOS_PLAYER
318 bool is_new_player(void)
320 extern char having_new_lcd;
321 return having_new_lcd;
323 #endif
325 #ifdef HAVE_USB_POWER
326 bool usb_powered(void)
328 return false;
331 bool usb_charging_enable(bool on)
333 (void)on;
334 return false;
336 #endif
338 #if CONFIG_CHARGING
339 bool charger_inserted(void)
341 return false;
344 bool power_input_present(void)
346 return false;
349 unsigned int power_input_status(void)
351 #ifdef HAVE_BATTERY_SWITCH
352 return POWER_INPUT_BATTERY;
353 #else
354 return POWER_INPUT_NONE;
355 #endif
358 bool charging_state(void)
360 return false;
362 #endif /* CONFIG_CHARGING */
364 #ifndef USB_NONE
365 bool usb_inserted(void)
367 return false;
369 #endif
371 #ifdef HAVE_REMOTE_LCD_TICKING
372 void lcd_remote_emireduce(bool state)
374 (void)state;
376 #endif
378 void lcd_set_contrast( int x )
380 (void)x;
383 void mpeg_set_pitch(int pitch)
385 (void)pitch;
388 static int sleeptime;
389 void set_sleep_timer(int seconds)
391 sleeptime = seconds;
394 int get_sleep_timer(void)
396 return sleeptime;
399 #ifdef HAVE_LCD_CHARCELLS
400 void lcd_clearrect (int x, int y, int nx, int ny)
402 /* Reprint char if you want to change anything */
403 (void)x;
404 (void)y;
405 (void)nx;
406 (void)ny;
409 void lcd_fillrect (int x, int y, int nx, int ny)
411 /* Reprint char if you want to change display anything */
412 (void)x;
413 (void)y;
414 (void)nx;
415 (void)ny;
417 #endif
419 void cpu_sleep(bool enabled)
421 (void)enabled;
424 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
425 void touchpad_set_sensitivity(int level)
427 (void)level;
429 #endif