blob: 2218c497f89ab460a4c4d1dc9b4e75bda7e3333c [file] [log] [blame]
Robert Hakc15b4052002-08-13 08:55:58 +00001/***************************************************************************
Daniel Ankers8300d8c2006-09-03 21:00:19 +00002 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
Robert Hakc15b4052002-08-13 08:55:58 +00008 * $Id$
9 *
Nicolas Pennequin357ffb32008-05-05 10:32:46 +000010 * Copyright (C) 2002 by Björn Stenberg <bjorn@haxx.se>
Robert Hakc15b4052002-08-13 08:55:58 +000011 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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.
Robert Hakc15b4052002-08-13 08:55:58 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
Björn Stenbergcd7691d2002-08-13 17:16:09 +000021#include <stdio.h>
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000022#include <time.h>
Markus Braun88098be2002-10-11 08:56:23 +000023#include <stdbool.h>
Michael Sevakisfaa01e92009-01-08 11:27:46 +000024#include "thread-sdl.h"
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000025
Björn Stenbergcd7691d2002-08-13 17:16:09 +000026#include "debug.h"
Robert Hakc15b4052002-08-13 08:55:58 +000027
Markus Braun88098be2002-10-11 08:56:23 +000028#include "screens.h"
Daniel Stenberg42564a12002-08-21 17:24:42 +000029#include "button.h"
30
Mats Lidelld5fd94d2002-10-11 11:12:00 +000031#include "string.h"
32#include "lcd.h"
Daniel Stenberg22b77012005-02-22 12:19:12 +000033
Michael Sevakis58eb7842008-12-03 19:54:25 +000034#include "power.h"
35
Jörg Hohensohnc540e822004-12-28 22:38:47 +000036#include "ata.h" /* for volume definitions */
Mats Lidelld5fd94d2002-10-11 11:12:00 +000037
Kjell Ericson32622072002-10-28 20:00:19 +000038extern char having_new_lcd;
Frank Gevaerts99d39f52008-11-02 02:19:39 +000039static bool storage_spinning = false;
Miika Pekkarineneab434c2005-07-22 06:32:55 +000040
Jens Arnoldd6c05452005-08-29 21:15:27 +000041#if CONFIG_CODEC != SWCODEC
Steve Bavin135cc752008-03-28 12:51:33 +000042void audio_set_buffer_margin(int seconds)
Miika Pekkarinen3b6a9f32005-07-21 12:25:30 +000043{
44 (void)seconds;
45}
46#endif
47
Björn Stenbergcd7691d2002-08-13 17:16:09 +000048int fat_startsector(void)
49{
50 return 63;
51}
52
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000053bool fat_ismounted(int volume)
54{
55 (void)volume;
56 return true;
57}
58
Frank Gevaerts99d39f52008-11-02 02:19:39 +000059int storage_init(void)
60{
61 return 1;
62}
63
64int storage_write_sectors(IF_MV2(int drive,)
Jörg Hohensohnc540e822004-12-28 22:38:47 +000065 unsigned long start,
66 int count,
67 const void* buf)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000068{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000069 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000070 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000071
Björn Stenbergcd7691d2002-08-13 17:16:09 +000072 for (i=0; i<count; i++ ) {
73 FILE* f;
74 char name[32];
75
Björn Stenbergcd7691d2002-08-13 17:16:09 +000076 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000077 f=fopen(name,"wb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000078 if (f) {
79 fwrite(buf,512,1,f);
80 fclose(f);
81 }
82 }
83 return 1;
84}
85
Frank Gevaerts99d39f52008-11-02 02:19:39 +000086int storage_read_sectors(IF_MV2(int drive,)
Jörg Hohensohnc540e822004-12-28 22:38:47 +000087 unsigned long start,
88 int count,
Björn Stenbergcd7691d2002-08-13 17:16:09 +000089 void* buf)
90{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000091 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000092 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000093
Björn Stenbergcd7691d2002-08-13 17:16:09 +000094 for (i=0; i<count; i++ ) {
95 FILE* f;
96 char name[32];
97
Steve Bavin076ab8d2006-09-28 08:45:40 +000098 DEBUGF("Reading sector %lX\n",start+i);
Björn Stenbergcd7691d2002-08-13 17:16:09 +000099 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +0000100 f=fopen(name,"rb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000101 if (f) {
102 fread(buf,512,1,f);
103 fclose(f);
104 }
105 }
106 return 1;
107}
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000108
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000109void storage_spin(void)
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000110{
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000111 storage_spinning = true;
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000112}
Björn Stenberg6224cdb2002-08-16 14:41:47 +0000113
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000114void storage_sleep(void)
Björn Stenberg6224cdb2002-08-16 14:41:47 +0000115{
116}
Daniel Stenberg42564a12002-08-21 17:24:42 +0000117
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000118bool storage_disk_is_active(void)
Björn Stenberg457b8a02002-08-26 13:21:14 +0000119{
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000120 return storage_spinning;
Björn Stenberg457b8a02002-08-26 13:21:14 +0000121}
122
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000123void storage_spindown(int s)
Björn Stenberg457b8a02002-08-26 13:21:14 +0000124{
125 (void)s;
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000126 storage_spinning = false;
Björn Stenberg457b8a02002-08-26 13:21:14 +0000127}
128
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000129void rtc_init(void)
130{
131}
132
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000133int rtc_read(int address)
134{
Dave Chapman060320b2005-12-11 02:00:28 +0000135 return address ^ 0x55;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000136}
137
138int rtc_write(int address, int value)
139{
Linus Nielsen Feltzing33519052004-11-17 12:45:07 +0000140 (void)address;
141 (void)value;
Dave Chapman060320b2005-12-11 02:00:28 +0000142 return 0;
143}
144
Nils Wallméniusc8b87d72009-09-26 14:58:32 +0000145int rtc_read_datetime(struct tm *tm)
Dave Chapman060320b2005-12-11 02:00:28 +0000146{
147 time_t now = time(NULL);
Nils Wallméniusc8b87d72009-09-26 14:58:32 +0000148 *tm = *localtime(&now);
Dave Chapman060320b2005-12-11 02:00:28 +0000149
150 return 0;
151}
152
Nils Wallméniusc8b87d72009-09-26 14:58:32 +0000153int rtc_write_datetime(const struct tm *tm)
Dave Chapman060320b2005-12-11 02:00:28 +0000154{
Nils Wallméniusc8b87d72009-09-26 14:58:32 +0000155 (void)tm;
Dave Chapman060320b2005-12-11 02:00:28 +0000156 return 0;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000157}
Daniel Stenbergb3438e82002-10-15 07:58:16 +0000158
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000159#ifdef HAVE_RTC_ALARM
160void rtc_get_alarm(int *h, int *m)
161{
162 *h = 11;
163 *m = 55;
164}
165
166void rtc_set_alarm(int h, int m)
167{
168 (void)h;
169 (void)m;
170}
171
172bool rtc_enable_alarm(bool enable)
173{
174 return enable;
175}
176
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000177extern bool sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000178bool rtc_check_alarm_started(bool release_alarm)
179{
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000180 (void)release_alarm;
181 return sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000182}
183
184bool rtc_check_alarm_flag(void)
185{
186 return true;
187}
188#endif
189
190#ifdef HAVE_HEADPHONE_DETECTION
191bool headphones_inserted(void)
192{
193 return true;
194}
195#endif
196
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000197#ifdef HAVE_SPDIF_POWER
198void spdif_power_enable(bool on)
199{
200 (void)on;
201}
202
203bool spdif_powered(void)
204{
205 return false;
206}
207#endif
208
Jens Arnoldd4e53972004-11-22 21:20:54 +0000209bool is_new_player(void)
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000210{
Kjell Ericson32622072002-10-28 20:00:19 +0000211 return having_new_lcd;
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000212}
Mats Lidella99c5652002-10-18 09:20:14 +0000213
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000214#ifdef HAVE_USB_POWER
215bool usb_powered(void)
216{
217 return false;
218}
219
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000220bool usb_charging_enable(bool on)
221{
222 (void)on;
223 return false;
224}
225#endif
Michael Sevakisadd677f2008-12-03 20:43:10 +0000226
227#if CONFIG_CHARGING
228bool charger_inserted(void)
229{
230 return false;
231}
232
233bool power_input_present(void)
234{
235 return false;
236}
237
238unsigned int power_input_status(void)
239{
240#ifdef HAVE_BATTERY_SWITCH
241 return POWER_INPUT_BATTERY;
242#else
243 return POWER_INPUT_NONE;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000244#endif
Michael Sevakisadd677f2008-12-03 20:43:10 +0000245}
246
247bool charging_state(void)
248{
249 return false;
250}
251#endif /* CONFIG_CHARGING */
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000252
253bool usb_inserted(void)
254{
255 return false;
256}
257
258#ifdef HAVE_REMOTE_LCD_TICKING
259void lcd_remote_emireduce(bool state)
260{
261 (void)state;
262}
263#endif
264
Mats Lidella99c5652002-10-18 09:20:14 +0000265void lcd_set_contrast( int x )
266{
267 (void)x;
268}
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000269
Nils Wallménius4f879762009-08-19 21:48:17 +0000270void lcd_init_device(void)
271{
272}
273
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000274void mpeg_set_pitch(int pitch)
275{
276 (void)pitch;
277}
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000278
Linus Nielsen Feltzing4a663272002-12-03 22:49:48 +0000279static int sleeptime;
280void set_sleep_timer(int seconds)
281{
282 sleeptime = seconds;
283}
284
285int get_sleep_timer(void)
286{
287 return sleeptime;
288}
289
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000290#ifdef HAVE_LCD_CHARCELLS
291void lcd_clearrect (int x, int y, int nx, int ny)
292{
293 /* Reprint char if you want to change anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000294 (void)x;
295 (void)y;
296 (void)nx;
297 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000298}
299
300void lcd_fillrect (int x, int y, int nx, int ny)
301{
302 /* Reprint char if you want to change display anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000303 (void)x;
304 (void)y;
305 (void)nx;
306 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000307}
308#endif
Björn Stenbergc4d8d972003-02-14 09:44:34 +0000309
310void cpu_sleep(bool enabled)
311{
312 (void)enabled;
313}
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000314
Tomer Shaleva39be4b2009-10-05 17:53:45 +0000315void button_set_flip(bool yesno)
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000316{
317 (void)yesno;
318}
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000319
Michael Sevakis3b730a22008-05-29 21:53:49 +0000320#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
321void touchpad_set_sensitivity(int level)
322{
323 (void)level;
324}
325#endif
326
Michael Sevakis4ed78f52009-01-08 10:15:32 +0000327void system_exception_wait(void)
328{
Michael Sevakis33a7f3a2009-01-08 11:08:22 +0000329 thread_sdl_exception_wait();
Michael Sevakis4ed78f52009-01-08 10:15:32 +0000330}
331
332void system_reboot(void)
333{
Michael Sevakis33a7f3a2009-01-08 11:08:22 +0000334 thread_sdl_exception_wait();
Michael Sevakis4ed78f52009-01-08 10:15:32 +0000335}
336