blob: 7bf3a4f546f50fdbc15a43fa035567ad4f11b13d [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>
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000024
Björn Stenbergcd7691d2002-08-13 17:16:09 +000025#include "debug.h"
Robert Hakc15b4052002-08-13 08:55:58 +000026
Markus Braun88098be2002-10-11 08:56:23 +000027#include "screens.h"
Daniel Stenberg42564a12002-08-21 17:24:42 +000028#include "button.h"
29
Mats Lidelld5fd94d2002-10-11 11:12:00 +000030#include "string.h"
31#include "lcd.h"
Daniel Stenberg22b77012005-02-22 12:19:12 +000032
Jörg Hohensohnc540e822004-12-28 22:38:47 +000033#include "ata.h" /* for volume definitions */
Mats Lidelld5fd94d2002-10-11 11:12:00 +000034
Kjell Ericson32622072002-10-28 20:00:19 +000035extern char having_new_lcd;
Miika Pekkarineneab434c2005-07-22 06:32:55 +000036
Jens Arnoldd6c05452005-08-29 21:15:27 +000037#if CONFIG_CODEC != SWCODEC
Steve Bavin135cc752008-03-28 12:51:33 +000038void audio_set_buffer_margin(int seconds)
Miika Pekkarinen3b6a9f32005-07-21 12:25:30 +000039{
40 (void)seconds;
41}
42#endif
43
Björn Stenbergcd7691d2002-08-13 17:16:09 +000044int fat_startsector(void)
45{
46 return 63;
47}
48
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000049bool fat_ismounted(int volume)
50{
51 (void)volume;
52 return true;
53}
54
Jörg Hohensohnc540e822004-12-28 22:38:47 +000055int ata_write_sectors(IF_MV2(int drive,)
56 unsigned long start,
57 int count,
58 const void* buf)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000059{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000060 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000061 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000062
Björn Stenbergcd7691d2002-08-13 17:16:09 +000063 for (i=0; i<count; i++ ) {
64 FILE* f;
65 char name[32];
66
Björn Stenbergcd7691d2002-08-13 17:16:09 +000067 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000068 f=fopen(name,"wb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000069 if (f) {
70 fwrite(buf,512,1,f);
71 fclose(f);
72 }
73 }
74 return 1;
75}
76
Jörg Hohensohnc540e822004-12-28 22:38:47 +000077int ata_read_sectors(IF_MV2(int drive,)
78 unsigned long start,
79 int count,
Björn Stenbergcd7691d2002-08-13 17:16:09 +000080 void* buf)
81{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +000082 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000083 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000084
Björn Stenbergcd7691d2002-08-13 17:16:09 +000085 for (i=0; i<count; i++ ) {
86 FILE* f;
87 char name[32];
88
Steve Bavin076ab8d2006-09-28 08:45:40 +000089 DEBUGF("Reading sector %lX\n",start+i);
Björn Stenbergcd7691d2002-08-13 17:16:09 +000090 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000091 f=fopen(name,"rb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000092 if (f) {
93 fread(buf,512,1,f);
94 fclose(f);
95 }
96 }
97 return 1;
98}
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000099
Jörg Hohensohnc540e822004-12-28 22:38:47 +0000100void ata_delayed_write(unsigned long sector, const void* buf)
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000101{
Jörg Hohensohnc540e822004-12-28 22:38:47 +0000102 ata_write_sectors(IF_MV2(0,) sector, 1, buf);
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000103}
Björn Stenberg6224cdb2002-08-16 14:41:47 +0000104
105void ata_flush(void)
106{
107}
Daniel Stenberg42564a12002-08-21 17:24:42 +0000108
Björn Stenberg457b8a02002-08-26 13:21:14 +0000109void ata_spin(void)
110{
111}
112
Jens Arnold2bf41782008-04-13 12:24:47 +0000113void ata_sleep(void)
114{
115 DEBUGF("ata_sleep()\n");
116}
117
Björn Stenberg457b8a02002-08-26 13:21:14 +0000118void ata_spindown(int s)
119{
120 (void)s;
121}
122
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000123void rtc_init(void)
124{
125}
126
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000127int rtc_read(int address)
128{
Dave Chapman060320b2005-12-11 02:00:28 +0000129 return address ^ 0x55;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000130}
131
132int rtc_write(int address, int value)
133{
Linus Nielsen Feltzing33519052004-11-17 12:45:07 +0000134 (void)address;
135 (void)value;
Dave Chapman060320b2005-12-11 02:00:28 +0000136 return 0;
137}
138
139int rtc_read_datetime(unsigned char* buf)
140{
141 time_t now = time(NULL);
142 struct tm *teem = localtime(&now);
143
144 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
145 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
146 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
147 buf[3] = (teem->tm_wday);
148 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
149 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
150 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
151
152 return 0;
153}
154
155int rtc_write_datetime(unsigned char* buf)
156{
157 (void)buf;
158 return 0;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000159}
Daniel Stenbergb3438e82002-10-15 07:58:16 +0000160
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000161#ifdef HAVE_RTC_ALARM
162void rtc_get_alarm(int *h, int *m)
163{
164 *h = 11;
165 *m = 55;
166}
167
168void rtc_set_alarm(int h, int m)
169{
170 (void)h;
171 (void)m;
172}
173
174bool rtc_enable_alarm(bool enable)
175{
176 return enable;
177}
178
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000179extern bool sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000180bool rtc_check_alarm_started(bool release_alarm)
181{
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000182 (void)release_alarm;
183 return sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000184}
185
186bool rtc_check_alarm_flag(void)
187{
188 return true;
189}
190#endif
191
192#ifdef HAVE_HEADPHONE_DETECTION
193bool headphones_inserted(void)
194{
195 return true;
196}
197#endif
198
199#ifdef HAVE_LCD_ENABLE
200bool lcd_enabled(void)
201{
202 return true;
203}
204#endif
205
206bool charging_state(void)
207{
208 return false;
209}
210
211bool charger_inserted(void)
212{
213 return false;
214}
215
216#ifdef HAVE_SPDIF_POWER
217void spdif_power_enable(bool on)
218{
219 (void)on;
220}
221
222bool spdif_powered(void)
223{
224 return false;
225}
226#endif
227
Jens Arnoldd4e53972004-11-22 21:20:54 +0000228bool is_new_player(void)
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000229{
Kjell Ericson32622072002-10-28 20:00:19 +0000230 return having_new_lcd;
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000231}
Mats Lidella99c5652002-10-18 09:20:14 +0000232
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000233#ifdef HAVE_USB_POWER
234bool usb_powered(void)
235{
236 return false;
237}
238
239#if CONFIG_CHARGING
240bool usb_charging_enable(bool on)
241{
242 (void)on;
243 return false;
244}
245#endif
246#endif
247
248bool usb_inserted(void)
249{
250 return false;
251}
252
253#ifdef HAVE_REMOTE_LCD_TICKING
254void lcd_remote_emireduce(bool state)
255{
256 (void)state;
257}
258#endif
259
Mats Lidella99c5652002-10-18 09:20:14 +0000260void lcd_set_contrast( int x )
261{
262 (void)x;
263}
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000264
265void mpeg_set_pitch(int pitch)
266{
267 (void)pitch;
268}
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000269
Linus Nielsen Feltzing4a663272002-12-03 22:49:48 +0000270static int sleeptime;
271void set_sleep_timer(int seconds)
272{
273 sleeptime = seconds;
274}
275
276int get_sleep_timer(void)
277{
278 return sleeptime;
279}
280
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000281#ifdef HAVE_LCD_CHARCELLS
282void lcd_clearrect (int x, int y, int nx, int ny)
283{
284 /* Reprint char if you want to change anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000285 (void)x;
286 (void)y;
287 (void)nx;
288 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000289}
290
291void lcd_fillrect (int x, int y, int nx, int ny)
292{
293 /* Reprint char if you want to change display 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#endif
Björn Stenbergc4d8d972003-02-14 09:44:34 +0000300
301void cpu_sleep(bool enabled)
302{
303 (void)enabled;
304}
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000305
306void button_set_flip(bool yesno)
307{
308 (void)yesno;
309}
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000310
Michael Sevakis3b730a22008-05-29 21:53:49 +0000311#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
312void touchpad_set_sensitivity(int level)
313{
314 (void)level;
315}
316#endif
317
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000318/* assure an unused place to direct virtual pointers to */
Daniel Stenberg22b77012005-02-22 12:19:12 +0000319#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000320unsigned char vp_dummy[VIRT_SIZE];
321