1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Björn Stenberg <bjorn@haxx.se>
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
31 #include "ata.h" /* for volume definitions */
33 extern char having_new_lcd
;
35 #if CONFIG_CODEC != SWCODEC
36 void audio_set_buffer_margin(int seconds
)
42 int fat_startsector(void)
47 bool fat_ismounted(int volume
)
53 int ata_write_sectors(IF_MV2(int drive
,)
61 for (i
=0; i
<count
; i
++ ) {
65 sprintf(name
,"sector%lX.bin",start
+i
);
75 int ata_read_sectors(IF_MV2(int drive
,)
83 for (i
=0; i
<count
; i
++ ) {
87 DEBUGF("Reading sector %lX\n",start
+i
);
88 sprintf(name
,"sector%lX.bin",start
+i
);
98 void ata_delayed_write(unsigned long sector
, const void* buf
)
100 ata_write_sectors(IF_MV2(0,) sector
, 1, buf
);
111 void ata_spindown(int s
)
120 int rtc_read(int address
)
122 return address
^ 0x55;
125 int rtc_write(int address
, int value
)
132 int rtc_read_datetime(unsigned char* buf
)
134 time_t now
= time(NULL
);
135 struct tm
*teem
= localtime(&now
);
137 buf
[0] = (teem
->tm_sec
%10) | ((teem
->tm_sec
/10) << 4);
138 buf
[1] = (teem
->tm_min
%10) | ((teem
->tm_min
/10) << 4);
139 buf
[2] = (teem
->tm_hour
%10) | ((teem
->tm_hour
/10) << 4);
140 buf
[3] = (teem
->tm_wday
);
141 buf
[4] = (teem
->tm_mday
%10) | ((teem
->tm_mday
/10) << 4);
142 buf
[5] = ((teem
->tm_year
-100)%10) | (((teem
->tm_year
-100)/10) << 4);
143 buf
[6] = ((teem
->tm_mon
+1)%10) | (((teem
->tm_mon
+1)/10) << 4);
148 int rtc_write_datetime(unsigned char* buf
)
154 #ifdef HAVE_RTC_ALARM
155 void rtc_get_alarm(int *h
, int *m
)
161 void rtc_set_alarm(int h
, int m
)
167 bool rtc_enable_alarm(bool enable
)
172 bool rtc_check_alarm_started(bool release_alarm
)
174 return release_alarm
;
177 bool rtc_check_alarm_flag(void)
183 #ifdef HAVE_HEADPHONE_DETECTION
184 bool headphones_inserted(void)
190 #ifdef HAVE_LCD_ENABLE
191 bool lcd_enabled(void)
197 bool charging_state(void)
202 bool charger_inserted(void)
207 #ifdef HAVE_SPDIF_POWER
208 void spdif_power_enable(bool on
)
213 bool spdif_powered(void)
219 bool is_new_player(void)
221 return having_new_lcd
;
224 #ifdef HAVE_USB_POWER
225 bool usb_powered(void)
231 bool usb_charging_enable(bool on
)
239 bool usb_inserted(void)
244 #ifdef HAVE_REMOTE_LCD_TICKING
245 void lcd_remote_emireduce(bool state
)
251 void lcd_set_contrast( int x
)
256 void mpeg_set_pitch(int pitch
)
261 static int sleeptime
;
262 void set_sleep_timer(int seconds
)
267 int get_sleep_timer(void)
272 #ifdef HAVE_LCD_CHARCELLS
273 void lcd_clearrect (int x
, int y
, int nx
, int ny
)
275 /* Reprint char if you want to change anything */
282 void lcd_fillrect (int x
, int y
, int nx
, int ny
)
284 /* Reprint char if you want to change display anything */
292 void cpu_sleep(bool enabled
)
297 void button_set_flip(bool yesno
)
302 #if CONFIG_CODEC != SWCODEC
307 int talk_buffer_steal(void)
312 int talk_id(int id
, bool enqueue
)
319 int talk_file(char* filename
, bool enqueue
)
326 int talk_value(int n
, int unit
, bool enqueue
)
334 int talk_number(int n
, bool enqueue
)
341 int talk_spell(char* spell
, bool enqueue
)
348 bool talk_menus_enabled(void)
353 void talk_enable_menus(void)
357 void talk_disable_menus(void)
361 const char* const dir_thumbnail_name
= "_dirname.talk";
362 const char* const file_thumbnail_ext
= ".talk";
365 /* assure an unused place to direct virtual pointers to */
366 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
367 unsigned char vp_dummy
[VIRT_SIZE
];