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 void audio_set_buffer_margin(int seconds
)
44 /* firmware/target/sh/archos/audio-archos.c */
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)
50 static bool paused
; /* playback is paused */
51 static bool playing
; /* We are playing an MP3 stream */
53 bool audio_is_initialized
= false;
55 void 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
,
75 audio_is_initialized
= true;
81 void mp3_play_pause(bool play
)
86 void mp3_play_stop(void)
90 unsigned char* mp3_get_pos(void)
95 void mp3_play_data(const unsigned char* start
, int size
,
96 void (*get_more
)(unsigned char** start
, size_t* size
) /* callback fn */
99 (void)start
; (void)size
; (void)get_more
;
102 /* firmware/drivers/audio/mas35xx.c */
103 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
104 void audiohw_set_loudness(int value
)
109 void audiohw_set_avc(int value
)
114 void audiohw_set_mdb_strength(int value
)
119 void audiohw_set_mdb_harmonics(int value
)
124 void audiohw_set_mdb_center(int value
)
129 void audiohw_set_mdb_shape(int value
)
134 void audiohw_set_mdb_enable(int value
)
139 void audiohw_set_superbass(int value
)
144 void audiohw_set_pitch(unsigned long value
)
148 #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
149 #endif /* CODEC != SWCODEC */
151 int fat_startsector(void)
156 bool fat_ismounted(int volume
)
162 int storage_spinup_time(void)
167 int storage_init(void)
172 int storage_write_sectors(IF_MV2(int drive
,)
180 for (i
=0; i
<count
; i
++ ) {
184 sprintf(name
,"sector%lX.bin",start
+i
);
194 int storage_read_sectors(IF_MV2(int drive
,)
202 for (i
=0; i
<count
; i
++ ) {
206 DEBUGF("Reading sector %lX\n",start
+i
);
207 sprintf(name
,"sector%lX.bin",start
+i
);
217 void storage_spin(void)
219 storage_spinning
= true;
222 void storage_sleep(void)
226 bool storage_disk_is_active(void)
228 return storage_spinning
;
231 void storage_spindown(int s
)
234 storage_spinning
= false;
241 int rtc_read(int address
)
243 return address
^ 0x55;
246 int rtc_write(int address
, int value
)
253 int rtc_read_datetime(struct tm
*tm
)
255 time_t now
= time(NULL
);
256 *tm
= *localtime(&now
);
261 int rtc_write_datetime(const struct tm
*tm
)
267 #ifdef HAVE_RTC_ALARM
268 void rtc_get_alarm(int *h
, int *m
)
274 void rtc_set_alarm(int h
, int m
)
280 void rtc_enable_alarm(bool enable
)
285 extern bool sim_alarm_wakeup
;
286 bool rtc_check_alarm_started(bool release_alarm
)
289 return sim_alarm_wakeup
;
292 bool rtc_check_alarm_flag(void)
298 #ifdef HAVE_HEADPHONE_DETECTION
299 bool headphones_inserted(void)
305 #ifdef HAVE_SPDIF_POWER
306 void spdif_power_enable(bool on
)
311 bool spdif_powered(void)
318 bool is_new_player(void)
320 extern char having_new_lcd
;
321 return having_new_lcd
;
325 #ifdef HAVE_USB_POWER
326 bool usb_powered(void)
331 bool usb_charging_enable(bool on
)
339 bool charger_inserted(void)
344 bool power_input_present(void)
349 unsigned int power_input_status(void)
351 #ifdef HAVE_BATTERY_SWITCH
352 return POWER_INPUT_BATTERY
;
354 return POWER_INPUT_NONE
;
358 bool charging_state(void)
362 #endif /* CONFIG_CHARGING */
365 bool usb_inserted(void)
371 #ifdef HAVE_REMOTE_LCD_TICKING
372 void lcd_remote_emireduce(bool state
)
378 void lcd_set_contrast( int x
)
383 void mpeg_set_pitch(int pitch
)
388 static int sleeptime
;
389 void set_sleep_timer(int seconds
)
394 int get_sleep_timer(void)
399 #ifdef HAVE_LCD_CHARCELLS
400 void lcd_clearrect (int x
, int y
, int nx
, int ny
)
402 /* Reprint char if you want to change anything */
409 void lcd_fillrect (int x
, int y
, int nx
, int ny
)
411 /* Reprint char if you want to change display anything */
419 void cpu_sleep(bool enabled
)
424 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
425 void touchpad_set_sensitivity(int level
)