blob: f8b8fdc91253977da8b005e9ed4986328aaae60b [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>
Björn Stenbergcd7691d2002-08-13 17:16:09 +000024#include "debug.h"
Robert Hakc15b4052002-08-13 08:55:58 +000025
Markus Braun88098be2002-10-11 08:56:23 +000026#include "screens.h"
Daniel Stenberg42564a12002-08-21 17:24:42 +000027#include "button.h"
28
Mats Lidelld5fd94d2002-10-11 11:12:00 +000029#include "string.h"
30#include "lcd.h"
Daniel Stenberg22b77012005-02-22 12:19:12 +000031
Michael Sevakis58eb7842008-12-03 19:54:25 +000032#include "power.h"
33
Jörg Hohensohnc540e822004-12-28 22:38:47 +000034#include "ata.h" /* for volume definitions */
Mats Lidelld5fd94d2002-10-11 11:12:00 +000035
Frank Gevaerts99d39f52008-11-02 02:19:39 +000036static bool storage_spinning = false;
Miika Pekkarineneab434c2005-07-22 06:32:55 +000037
Jens Arnoldd6c05452005-08-29 21:15:27 +000038#if CONFIG_CODEC != SWCODEC
Steve Bavin135cc752008-03-28 12:51:33 +000039void audio_set_buffer_margin(int seconds)
Miika Pekkarinen3b6a9f32005-07-21 12:25:30 +000040{
41 (void)seconds;
42}
Marcin Bukat56c4e9f2010-10-31 21:09:34 +000043
44/* firmware/target/sh/archos/audio-archos.c */
45
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)
49
50static bool paused; /* playback is paused */
51static bool playing; /* We are playing an MP3 stream */
52
53bool audio_is_initialized = false;
54
55void 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)
60{
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;
76
77 playing = false;
78 paused = true;
79}
80
81void mp3_play_pause(bool play)
82{
83 (void)play;
84}
85
86void mp3_play_stop(void)
87{
88}
89
90unsigned char* mp3_get_pos(void)
91{
92 return NULL;
93}
94
95void mp3_play_data(const unsigned char* start, int size,
96 void (*get_more)(unsigned char** start, size_t* size) /* callback fn */
97)
98{
99 (void)start; (void)size; (void)get_more;
100}
101
102/* firmware/drivers/audio/mas35xx.c */
103#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
104void audiohw_set_loudness(int value)
105{
106 (void)value;
107}
108
109void audiohw_set_avc(int value)
110{
111 (void)value;
112}
113
114void audiohw_set_mdb_strength(int value)
115{
116 (void)value;
117}
118
119void audiohw_set_mdb_harmonics(int value)
120{
121 (void)value;
122}
123
124void audiohw_set_mdb_center(int value)
125{
126 (void)value;
127}
128
129void audiohw_set_mdb_shape(int value)
130{
131 (void)value;
132}
133
134void audiohw_set_mdb_enable(int value)
135{
136 (void)value;
137}
138
139void audiohw_set_superbass(int value)
140{
141 (void)value;
142}
143
144void audiohw_set_pitch(unsigned long value)
145{
146 (void)value;
147}
148#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
149#endif /* CODEC != SWCODEC */
Miika Pekkarinen3b6a9f32005-07-21 12:25:30 +0000150
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000151int fat_startsector(void)
152{
153 return 63;
154}
155
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000156bool fat_ismounted(int volume)
157{
158 (void)volume;
159 return true;
160}
161
Rafaël Carré3982f1e2010-07-04 13:37:52 +0000162int storage_spinup_time(void)
163{
164 return 0;
165}
166
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000167int storage_init(void)
168{
169 return 1;
170}
171
172int storage_write_sectors(IF_MV2(int drive,)
Jörg Hohensohnc540e822004-12-28 22:38:47 +0000173 unsigned long start,
174 int count,
175 const void* buf)
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000176{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000177 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000178 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +0000179
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000180 for (i=0; i<count; i++ ) {
181 FILE* f;
182 char name[32];
183
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000184 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +0000185 f=fopen(name,"wb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000186 if (f) {
187 fwrite(buf,512,1,f);
188 fclose(f);
189 }
190 }
191 return 1;
192}
193
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000194int storage_read_sectors(IF_MV2(int drive,)
Jörg Hohensohnc540e822004-12-28 22:38:47 +0000195 unsigned long start,
196 int count,
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000197 void* buf)
198{
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000199 IF_MV((void)drive;)
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000200 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +0000201
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000202 for (i=0; i<count; i++ ) {
203 FILE* f;
204 char name[32];
205
Steve Bavin076ab8d2006-09-28 08:45:40 +0000206 DEBUGF("Reading sector %lX\n",start+i);
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000207 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +0000208 f=fopen(name,"rb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000209 if (f) {
210 fread(buf,512,1,f);
211 fclose(f);
212 }
213 }
214 return 1;
215}
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000216
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000217void storage_spin(void)
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000218{
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000219 storage_spinning = true;
Björn Stenbergc9d98ca2002-08-15 12:42:37 +0000220}
Björn Stenberg6224cdb2002-08-16 14:41:47 +0000221
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000222void storage_sleep(void)
Björn Stenberg6224cdb2002-08-16 14:41:47 +0000223{
224}
Daniel Stenberg42564a12002-08-21 17:24:42 +0000225
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000226bool storage_disk_is_active(void)
Björn Stenberg457b8a02002-08-26 13:21:14 +0000227{
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000228 return storage_spinning;
Björn Stenberg457b8a02002-08-26 13:21:14 +0000229}
230
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000231void storage_spindown(int s)
Björn Stenberg457b8a02002-08-26 13:21:14 +0000232{
233 (void)s;
Frank Gevaerts99d39f52008-11-02 02:19:39 +0000234 storage_spinning = false;
Björn Stenberg457b8a02002-08-26 13:21:14 +0000235}
236
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000237int rtc_read(int address)
238{
Dave Chapman060320b2005-12-11 02:00:28 +0000239 return address ^ 0x55;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000240}
241
242int rtc_write(int address, int value)
243{
Linus Nielsen Feltzing33519052004-11-17 12:45:07 +0000244 (void)address;
245 (void)value;
Dave Chapman060320b2005-12-11 02:00:28 +0000246 return 0;
247}
248
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000249#ifdef HAVE_RTC_ALARM
250void rtc_get_alarm(int *h, int *m)
251{
252 *h = 11;
253 *m = 55;
254}
255
256void rtc_set_alarm(int h, int m)
257{
258 (void)h;
259 (void)m;
260}
261
Rafaël Carréba46c882010-05-22 00:28:26 +0000262void rtc_enable_alarm(bool enable)
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000263{
Rafaël Carréba46c882010-05-22 00:28:26 +0000264 (void)enable;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000265}
266
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000267extern bool sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000268bool rtc_check_alarm_started(bool release_alarm)
269{
Jonathan Gordonc9d1ab72007-10-13 12:07:59 +0000270 (void)release_alarm;
271 return sim_alarm_wakeup;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000272}
273
274bool rtc_check_alarm_flag(void)
275{
276 return true;
277}
278#endif
279
280#ifdef HAVE_HEADPHONE_DETECTION
281bool headphones_inserted(void)
282{
283 return true;
284}
285#endif
286
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000287#ifdef HAVE_SPDIF_POWER
288void spdif_power_enable(bool on)
289{
290 (void)on;
291}
292
293bool spdif_powered(void)
294{
295 return false;
296}
297#endif
298
Thomas Martitz240923a2010-08-02 20:34:47 +0000299#ifdef ARCHOS_PLAYER
Jens Arnoldd4e53972004-11-22 21:20:54 +0000300bool is_new_player(void)
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000301{
Thomas Martitz240923a2010-08-02 20:34:47 +0000302 extern char having_new_lcd;
Kjell Ericson32622072002-10-28 20:00:19 +0000303 return having_new_lcd;
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000304}
Thomas Martitz240923a2010-08-02 20:34:47 +0000305#endif
Mats Lidella99c5652002-10-18 09:20:14 +0000306
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000307#ifdef HAVE_USB_POWER
308bool usb_powered(void)
309{
310 return false;
311}
312
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000313bool usb_charging_enable(bool on)
314{
315 (void)on;
316 return false;
317}
318#endif
Michael Sevakisadd677f2008-12-03 20:43:10 +0000319
320#if CONFIG_CHARGING
321bool charger_inserted(void)
322{
323 return false;
324}
325
326bool power_input_present(void)
327{
328 return false;
329}
330
331unsigned int power_input_status(void)
332{
333#ifdef HAVE_BATTERY_SWITCH
334 return POWER_INPUT_BATTERY;
335#else
336 return POWER_INPUT_NONE;
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000337#endif
Michael Sevakisadd677f2008-12-03 20:43:10 +0000338}
339
340bool charging_state(void)
341{
342 return false;
343}
344#endif /* CONFIG_CHARGING */
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000345
Michael Chicoineae22ef12009-11-23 17:43:42 +0000346#ifndef USB_NONE
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000347bool usb_inserted(void)
348{
349 return false;
350}
Michael Chicoineae22ef12009-11-23 17:43:42 +0000351#endif
Nils Wallméniusf28da1a2007-08-12 19:49:03 +0000352
353#ifdef HAVE_REMOTE_LCD_TICKING
354void lcd_remote_emireduce(bool state)
355{
356 (void)state;
357}
358#endif
359
Mats Lidella99c5652002-10-18 09:20:14 +0000360void lcd_set_contrast( int x )
361{
362 (void)x;
363}
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000364
365void mpeg_set_pitch(int pitch)
366{
367 (void)pitch;
368}
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000369
370#ifdef HAVE_LCD_CHARCELLS
371void lcd_clearrect (int x, int y, int nx, int ny)
372{
373 /* Reprint char if you want to change anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000374 (void)x;
375 (void)y;
376 (void)nx;
377 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000378}
379
380void lcd_fillrect (int x, int y, int nx, int ny)
381{
382 /* Reprint char if you want to change display anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000383 (void)x;
384 (void)y;
385 (void)nx;
386 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000387}
388#endif
Björn Stenbergc4d8d972003-02-14 09:44:34 +0000389
390void cpu_sleep(bool enabled)
391{
392 (void)enabled;
393}
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000394
Michael Sevakis3b730a22008-05-29 21:53:49 +0000395#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
396void touchpad_set_sensitivity(int level)
397{
398 (void)level;
399}
400#endif