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 ****************************************************************************/
24 #include "thread-sdl.h"
36 #include "ata.h" /* for volume definitions */
38 extern char having_new_lcd
;
39 static bool storage_spinning
= false;
41 #if CONFIG_CODEC != SWCODEC
42 void audio_set_buffer_margin(int seconds
)
48 int fat_startsector(void)
53 bool fat_ismounted(int volume
)
59 int storage_init(void)
64 int storage_write_sectors(IF_MV2(int drive
,)
72 for (i
=0; i
<count
; i
++ ) {
76 sprintf(name
,"sector%lX.bin",start
+i
);
86 int storage_read_sectors(IF_MV2(int drive
,)
94 for (i
=0; i
<count
; i
++ ) {
98 DEBUGF("Reading sector %lX\n",start
+i
);
99 sprintf(name
,"sector%lX.bin",start
+i
);
109 void storage_spin(void)
111 storage_spinning
= true;
114 void storage_sleep(void)
118 bool storage_disk_is_active(void)
120 return storage_spinning
;
123 void storage_spindown(int s
)
126 storage_spinning
= false;
133 int rtc_read(int address
)
135 return address
^ 0x55;
138 int rtc_write(int address
, int value
)
145 int rtc_read_datetime(unsigned char* buf
)
147 time_t now
= time(NULL
);
148 struct tm
*teem
= localtime(&now
);
150 buf
[0] = (teem
->tm_sec
%10) | ((teem
->tm_sec
/10) << 4);
151 buf
[1] = (teem
->tm_min
%10) | ((teem
->tm_min
/10) << 4);
152 buf
[2] = (teem
->tm_hour
%10) | ((teem
->tm_hour
/10) << 4);
153 buf
[3] = (teem
->tm_wday
);
154 buf
[4] = (teem
->tm_mday
%10) | ((teem
->tm_mday
/10) << 4);
155 buf
[5] = ((teem
->tm_year
-100)%10) | (((teem
->tm_year
-100)/10) << 4);
156 buf
[6] = ((teem
->tm_mon
+1)%10) | (((teem
->tm_mon
+1)/10) << 4);
161 int rtc_write_datetime(unsigned char* buf
)
167 #ifdef HAVE_RTC_ALARM
168 void rtc_get_alarm(int *h
, int *m
)
174 void rtc_set_alarm(int h
, int m
)
180 bool rtc_enable_alarm(bool enable
)
185 extern bool sim_alarm_wakeup
;
186 bool rtc_check_alarm_started(bool release_alarm
)
189 return sim_alarm_wakeup
;
192 bool rtc_check_alarm_flag(void)
198 #ifdef HAVE_HEADPHONE_DETECTION
199 bool headphones_inserted(void)
205 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
206 bool lcd_active(void)
212 #ifdef HAVE_LCD_SLEEP
218 #ifdef HAVE_SPDIF_POWER
219 void spdif_power_enable(bool on
)
224 bool spdif_powered(void)
230 bool is_new_player(void)
232 return having_new_lcd
;
235 #ifdef HAVE_USB_POWER
236 bool usb_powered(void)
241 bool usb_charging_enable(bool on
)
249 bool charger_inserted(void)
254 bool power_input_present(void)
259 unsigned int power_input_status(void)
261 #ifdef HAVE_BATTERY_SWITCH
262 return POWER_INPUT_BATTERY
;
264 return POWER_INPUT_NONE
;
268 bool charging_state(void)
272 #endif /* CONFIG_CHARGING */
274 bool usb_inserted(void)
279 #ifdef HAVE_REMOTE_LCD_TICKING
280 void lcd_remote_emireduce(bool state
)
286 void lcd_set_contrast( int x
)
291 void mpeg_set_pitch(int pitch
)
296 static int sleeptime
;
297 void set_sleep_timer(int seconds
)
302 int get_sleep_timer(void)
307 #ifdef HAVE_LCD_CHARCELLS
308 void lcd_clearrect (int x
, int y
, int nx
, int ny
)
310 /* Reprint char if you want to change anything */
317 void lcd_fillrect (int x
, int y
, int nx
, int ny
)
319 /* Reprint char if you want to change display anything */
327 void cpu_sleep(bool enabled
)
332 void button_set_flip(bool yesno
)
337 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
338 void touchpad_set_sensitivity(int level
)
344 void system_exception_wait(void)
346 thread_sdl_exception_wait();
349 void system_reboot(void)
351 thread_sdl_exception_wait();