blob: c40d10082c493993bcbfe6e7882d13c4d29a526e [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 *
10 * Copyright (C) 2002 by Björn Stenberg <bjorn@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
Björn Stenbergcd7691d2002-08-13 17:16:09 +000019#include <stdio.h>
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000020#include <time.h>
Markus Braun88098be2002-10-11 08:56:23 +000021#include <stdbool.h>
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000022
Björn Stenbergcd7691d2002-08-13 17:16:09 +000023#include "debug.h"
Robert Hakc15b4052002-08-13 08:55:58 +000024
Markus Braun88098be2002-10-11 08:56:23 +000025#include "screens.h"
Daniel Stenberg42564a12002-08-21 17:24:42 +000026#include "button.h"
27
Mats Lidelld5fd94d2002-10-11 11:12:00 +000028#include "string.h"
29#include "lcd.h"
Daniel Stenberg22b77012005-02-22 12:19:12 +000030
Jörg Hohensohnc540e822004-12-28 22:38:47 +000031#include "ata.h" /* for volume definitions */
Mats Lidelld5fd94d2002-10-11 11:12:00 +000032
Kjell Ericson32622072002-10-28 20:00:19 +000033extern char having_new_lcd;
Miika Pekkarineneab434c2005-07-22 06:32:55 +000034
Jens Arnoldd6c05452005-08-29 21:15:27 +000035#if CONFIG_CODEC != SWCODEC
Miika Pekkarinen3b6a9f32005-07-21 12:25:30 +000036void audio_set_buffer_margin(int seconds)
37{
38 (void)seconds;
39}
40#endif
41
Björn Stenbergcd7691d2002-08-13 17:16:09 +000042int fat_startsector(void)
43{
44 return 63;
45}
46
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000047bool fat_ismounted(int volume)
48{
49 (void)volume;
50 return true;
51}
52
Jörg Hohensohnc540e822004-12-28 22:38:47 +000053int ata_write_sectors(IF_MV2(int drive,)
54 unsigned long start,
55 int count,
56 const void* buf)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000057{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000058 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000059 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000060
Björn Stenbergcd7691d2002-08-13 17:16:09 +000061 for (i=0; i<count; i++ ) {
62 FILE* f;
63 char name[32];
64
Björn Stenbergcd7691d2002-08-13 17:16:09 +000065 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000066 f=fopen(name,"wb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000067 if (f) {
68 fwrite(buf,512,1,f);
69 fclose(f);
70 }
71 }
72 return 1;
73}
74
Jörg Hohensohnc540e822004-12-28 22:38:47 +000075int ata_read_sectors(IF_MV2(int drive,)
76 unsigned long start,
77 int count,
Björn Stenbergcd7691d2002-08-13 17:16:09 +000078 void* buf)
79{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000080 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000081 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000082
Björn Stenbergcd7691d2002-08-13 17:16:09 +000083 for (i=0; i<count; i++ ) {
84 FILE* f;
85 char name[32];
86
Steve Bavin076ab8d2006-09-28 08:45:40 +000087 DEBUGF("Reading sector %lX\n",start+i);
Björn Stenbergcd7691d2002-08-13 17:16:09 +000088 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000089 f=fopen(name,"rb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000090 if (f) {
91 fread(buf,512,1,f);
92 fclose(f);
93 }
94 }
95 return 1;
96}
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000097
Jörg Hohensohnc540e822004-12-28 22:38:47 +000098void ata_delayed_write(unsigned long sector, const void* buf)
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000099{
Jörg Hohensohnc540e822004-12-28 22:38:47 +0000100 ata_write_sectors(IF_MV2(0,) sector, 1, buf);
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000101}
Björn Stenberg6224cdb2002-08-16 14:41:47 +0000102
103void ata_flush(void)
104{
105}
Daniel Stenberg42564a12002-08-21 17:24:42 +0000106
Björn Stenberg457b8a02002-08-26 13:21:14 +0000107void ata_spin(void)
108{
109}
110
111void ata_spindown(int s)
112{
113 (void)s;
114}
115
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000116void rtc_init(void)
117{
118}
119
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000120int rtc_read(int address)
121{
Dave Chapman060320b2005-12-11 02:00:28 +0000122 return address ^ 0x55;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000123}
124
125int rtc_write(int address, int value)
126{
Linus Nielsen Feltzing33519052004-11-17 12:45:07 +0000127 (void)address;
128 (void)value;
Dave Chapman060320b2005-12-11 02:00:28 +0000129 return 0;
130}
131
132int rtc_read_datetime(unsigned char* buf)
133{
134 time_t now = time(NULL);
135 struct tm *teem = localtime(&now);
136
137 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
138 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
139 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
140 buf[3] = (teem->tm_wday);
141 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
142 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
143 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
144
145 return 0;
146}
147
148int rtc_write_datetime(unsigned char* buf)
149{
150 (void)buf;
151 return 0;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000152}
Daniel Stenbergb3438e82002-10-15 07:58:16 +0000153
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000154#ifdef HAVE_RTC_ALARM
155void rtc_get_alarm(int *h, int *m)
156{
157 *h = 11;
158 *m = 55;
159}
160
161void rtc_set_alarm(int h, int m)
162{
163 (void)h;
164 (void)m;
165}
166
167bool rtc_enable_alarm(bool enable)
168{
169 return enable;
170}
171
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000172extern bool sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000173bool rtc_check_alarm_started(bool release_alarm)
174{
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000175 (void)release_alarm;
176 return sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000177}
178
179bool rtc_check_alarm_flag(void)
180{
181 return true;
182}
183#endif
184
185#ifdef HAVE_HEADPHONE_DETECTION
186bool headphones_inserted(void)
187{
188 return true;
189}
190#endif
191
192#ifdef HAVE_LCD_ENABLE
193bool lcd_enabled(void)
194{
195 return true;
196}
197#endif
198
199bool charging_state(void)
200{
201 return false;
202}
203
204bool charger_inserted(void)
205{
206 return false;
207}
208
209#ifdef HAVE_SPDIF_POWER
210void spdif_power_enable(bool on)
211{
212 (void)on;
213}
214
215bool spdif_powered(void)
216{
217 return false;
218}
219#endif
220
Jens Arnoldd4e53972004-11-22 21:20:54 +0000221bool is_new_player(void)
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000222{
Kjell Ericson32622072002-10-28 20:00:19 +0000223 return having_new_lcd;
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000224}
Mats Lidella99c5652002-10-18 09:20:14 +0000225
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000226#ifdef HAVE_USB_POWER
227bool usb_powered(void)
228{
229 return false;
230}
231
232#if CONFIG_CHARGING
233bool usb_charging_enable(bool on)
234{
235 (void)on;
236 return false;
237}
238#endif
239#endif
240
241bool usb_inserted(void)
242{
243 return false;
244}
245
246#ifdef HAVE_REMOTE_LCD_TICKING
247void lcd_remote_emireduce(bool state)
248{
249 (void)state;
250}
251#endif
252
Mats Lidella99c5652002-10-18 09:20:14 +0000253void lcd_set_contrast( int x )
254{
255 (void)x;
256}
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000257
258void mpeg_set_pitch(int pitch)
259{
260 (void)pitch;
261}
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000262
Linus Nielsen Feltzing4a663272002-12-03 22:49:48 +0000263static int sleeptime;
264void set_sleep_timer(int seconds)
265{
266 sleeptime = seconds;
267}
268
269int get_sleep_timer(void)
270{
271 return sleeptime;
272}
273
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000274#ifdef HAVE_LCD_CHARCELLS
275void lcd_clearrect (int x, int y, int nx, int ny)
276{
277 /* Reprint char if you want to change anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000278 (void)x;
279 (void)y;
280 (void)nx;
281 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000282}
283
284void lcd_fillrect (int x, int y, int nx, int ny)
285{
286 /* Reprint char if you want to change display anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000287 (void)x;
288 (void)y;
289 (void)nx;
290 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000291}
292#endif
Björn Stenbergc4d8d972003-02-14 09:44:34 +0000293
294void cpu_sleep(bool enabled)
295{
296 (void)enabled;
297}
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000298
299void button_set_flip(bool yesno)
300{
301 (void)yesno;
302}
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000303
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000304/* assure an unused place to direct virtual pointers to */
Daniel Stenberg22b77012005-02-22 12:19:12 +0000305#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000306unsigned char vp_dummy[VIRT_SIZE];
307