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 ****************************************************************************/
35 #include "ata.h" /* for volume definitions */
37 extern char having_new_lcd
;
38 static bool storage_spinning
= false;
40 #if CONFIG_CODEC != SWCODEC
41 void audio_set_buffer_margin(int seconds
)
47 int fat_startsector(void)
52 bool fat_ismounted(int volume
)
58 int storage_init(void)
63 int storage_write_sectors(IF_MV2(int drive
,)
71 for (i
=0; i
<count
; i
++ ) {
75 sprintf(name
,"sector%lX.bin",start
+i
);
85 int storage_read_sectors(IF_MV2(int drive
,)
93 for (i
=0; i
<count
; i
++ ) {
97 DEBUGF("Reading sector %lX\n",start
+i
);
98 sprintf(name
,"sector%lX.bin",start
+i
);
108 void storage_spin(void)
110 storage_spinning
= true;
113 void storage_sleep(void)
117 bool storage_disk_is_active(void)
119 return storage_spinning
;
122 void storage_spindown(int s
)
125 storage_spinning
= false;
132 int rtc_read(int address
)
134 return address
^ 0x55;
137 int rtc_write(int address
, int value
)
144 int rtc_read_datetime(unsigned char* buf
)
146 time_t now
= time(NULL
);
147 struct tm
*teem
= localtime(&now
);
149 buf
[0] = (teem
->tm_sec
%10) | ((teem
->tm_sec
/10) << 4);
150 buf
[1] = (teem
->tm_min
%10) | ((teem
->tm_min
/10) << 4);
151 buf
[2] = (teem
->tm_hour
%10) | ((teem
->tm_hour
/10) << 4);
152 buf
[3] = (teem
->tm_wday
);
153 buf
[4] = (teem
->tm_mday
%10) | ((teem
->tm_mday
/10) << 4);
154 buf
[5] = ((teem
->tm_year
-100)%10) | (((teem
->tm_year
-100)/10) << 4);
155 buf
[6] = ((teem
->tm_mon
+1)%10) | (((teem
->tm_mon
+1)/10) << 4);
160 int rtc_write_datetime(unsigned char* buf
)
166 #ifdef HAVE_RTC_ALARM
167 void rtc_get_alarm(int *h
, int *m
)
173 void rtc_set_alarm(int h
, int m
)
179 bool rtc_enable_alarm(bool enable
)
184 extern bool sim_alarm_wakeup
;
185 bool rtc_check_alarm_started(bool release_alarm
)
188 return sim_alarm_wakeup
;
191 bool rtc_check_alarm_flag(void)
197 #ifdef HAVE_HEADPHONE_DETECTION
198 bool headphones_inserted(void)
204 #ifdef HAVE_LCD_ENABLE
205 bool lcd_enabled(void)
211 #ifdef HAVE_SPDIF_POWER
212 void spdif_power_enable(bool on
)
217 bool spdif_powered(void)
223 bool is_new_player(void)
225 return having_new_lcd
;
228 #ifdef HAVE_USB_POWER
229 bool usb_powered(void)
234 bool usb_charging_enable(bool on
)
242 bool charger_inserted(void)
247 bool power_input_present(void)
252 unsigned int power_input_status(void)
254 #ifdef HAVE_BATTERY_SWITCH
255 return POWER_INPUT_BATTERY
;
257 return POWER_INPUT_NONE
;
261 bool charging_state(void)
265 #endif /* CONFIG_CHARGING */
267 bool usb_inserted(void)
272 #ifdef HAVE_REMOTE_LCD_TICKING
273 void lcd_remote_emireduce(bool state
)
279 void lcd_set_contrast( int x
)
284 void mpeg_set_pitch(int pitch
)
289 static int sleeptime
;
290 void set_sleep_timer(int seconds
)
295 int get_sleep_timer(void)
300 #ifdef HAVE_LCD_CHARCELLS
301 void lcd_clearrect (int x
, int y
, int nx
, int ny
)
303 /* Reprint char if you want to change anything */
310 void lcd_fillrect (int x
, int y
, int nx
, int ny
)
312 /* Reprint char if you want to change display anything */
320 void cpu_sleep(bool enabled
)
325 void button_set_flip(bool yesno
)
330 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
331 void touchpad_set_sensitivity(int level
)
337 /* assure an unused place to direct virtual pointers to */
338 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
339 unsigned char vp_dummy
[VIRT_SIZE
];