1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
34 #include "ata.h" /* for volume definitions */
36 static bool storage_spinning
= false;
38 #if CONFIG_CODEC != SWCODEC
39 #include "mp3_playback.h"
41 void audio_set_buffer_margin(int seconds
)
46 /* firmware/target/sh/archos/audio-archos.c */
48 /* list of tracks in memory */
49 #define MAX_ID3_TAGS (1<<4) /* Must be power of 2 */
50 #define MAX_ID3_TAGS_MASK (MAX_ID3_TAGS - 1)
52 static bool paused
; /* playback is paused */
53 static bool playing
; /* We are playing an MP3 stream */
55 bool audio_is_initialized
= false;
57 void mp3_init(int volume
, int bass
, int treble
, int balance
, int loudness
,
58 int avc
, int channel_config
, int stereo_width
,
59 int mdb_strength
, int mdb_harmonics
,
60 int mdb_center
, int mdb_shape
, bool mdb_enable
,
77 audio_is_initialized
= true;
83 void mp3_play_pause(bool play
)
88 void mp3_play_stop(void)
92 unsigned char* mp3_get_pos(void)
97 void mp3_play_data(const void* start
, size_t size
,
98 mp3_play_callback_t get_more
)
100 (void)start
; (void)size
; (void)get_more
;
103 void mp3_shutdown(void)
107 /* firmware/drivers/audio/mas35xx.c */
108 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
109 void audiohw_set_loudness(int value
)
114 void audiohw_set_avc(int value
)
119 void audiohw_set_mdb_strength(int value
)
124 void audiohw_set_mdb_harmonics(int value
)
129 void audiohw_set_mdb_center(int value
)
134 void audiohw_set_mdb_shape(int value
)
139 void audiohw_set_mdb_enable(int value
)
144 void audiohw_set_superbass(int value
)
149 void audiohw_set_pitch(unsigned long value
)
153 #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
154 #endif /* CODEC != SWCODEC */
156 int fat_startsector(void)
161 bool fat_ismounted(int volume
)
167 int storage_spinup_time(void)
172 int storage_init(void)
177 int storage_write_sectors(IF_MV2(int drive
,)
185 for (i
=0; i
<count
; i
++ ) {
189 sprintf(name
,"sector%lX.bin",start
+i
);
192 if(fwrite(buf
,512,1,f
) != 1) {
205 int storage_read_sectors(IF_MV2(int drive
,)
214 for (i
=0; i
<count
; i
++ ) {
218 DEBUGF("Reading sector %lX\n",start
+i
);
219 sprintf(name
,"sector%lX.bin",start
+i
);
222 ret
= fread(buf
,512,1,f
);
231 void storage_spin(void)
233 storage_spinning
= true;
236 void storage_sleep(void)
240 bool storage_disk_is_active(void)
242 return storage_spinning
;
245 void storage_spindown(int s
)
248 storage_spinning
= false;
251 int rtc_read(int address
)
253 return address
^ 0x55;
256 int rtc_write(int address
, int value
)
263 #ifdef HAVE_RTC_ALARM
264 void rtc_get_alarm(int *h
, int *m
)
270 void rtc_set_alarm(int h
, int m
)
276 void rtc_enable_alarm(bool enable
)
281 extern bool sim_alarm_wakeup
;
282 bool rtc_check_alarm_started(bool release_alarm
)
285 return sim_alarm_wakeup
;
288 bool rtc_check_alarm_flag(void)
294 #ifdef HAVE_HEADPHONE_DETECTION
295 bool headphones_inserted(void)
301 #ifdef HAVE_SPDIF_POWER
302 void spdif_power_enable(bool on
)
307 bool spdif_powered(void)
314 bool is_new_player(void)
316 extern char having_new_lcd
;
317 return having_new_lcd
;
321 #ifdef HAVE_USB_POWER
322 bool usb_powered(void)
327 bool usb_charging_enable(bool on
)
335 bool usb_inserted(void)
341 #ifdef HAVE_REMOTE_LCD_TICKING
342 void lcd_remote_emireduce(bool state
)
348 void lcd_set_contrast( int x
)
353 void mpeg_set_pitch(int pitch
)
358 #ifdef HAVE_LCD_CHARCELLS
359 void lcd_clearrect (int x
, int y
, int nx
, int ny
)
361 /* Reprint char if you want to change anything */
368 void lcd_fillrect (int x
, int y
, int nx
, int ny
)
370 /* Reprint char if you want to change display anything */
378 void cpu_sleep(bool enabled
)
383 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
384 void touchpad_set_sensitivity(int level
)