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 ****************************************************************************/
32 #include "ata.h" /* for volume definitions */
34 extern char having_new_lcd
;
37 void backlight_on(void)
39 /* we could do something better here! */
42 void backlight_off(void)
44 /* we could do something better here! */
47 void backlight_time(int dummy
)
52 int fat_startsector(void)
57 int ata_write_sectors(IF_MV2(int drive
,)
64 for (i
=0; i
<count
; i
++ ) {
68 DEBUGF("Writing sector %X\n",start
+i
);
69 sprintf(name
,"sector%lX.bin",start
+i
);
79 int ata_read_sectors(IF_MV2(int drive
,)
86 for (i
=0; i
<count
; i
++ ) {
90 DEBUGF("Reading sector %X\n",start
+i
);
91 sprintf(name
,"sector%lX.bin",start
+i
);
101 void ata_delayed_write(unsigned long sector
, const void* buf
)
103 ata_write_sectors(IF_MV2(0,) sector
, 1, buf
);
114 void ata_spindown(int s
)
119 bool simulate_usb(void)
122 while (button_get(true) & BUTTON_REL
);
126 void backlight_set_timeout(int index
)
131 void backlight_set_on_when_charging(bool beep
)
136 void remote_backlight_set_timeout(int index
)
141 int rtc_read(int address
)
143 time_t now
= time(NULL
);
144 struct tm
*teem
= localtime(&now
);
148 return (teem
->tm_hour
%10) | ((teem
->tm_hour
/10) << 4);
151 return (teem
->tm_min
%10) | ((teem
->tm_min
/10) << 4);
153 case 1: /* seconds */
154 return (teem
->tm_sec
%10) | ((teem
->tm_sec
/10) << 4);
157 return ((teem
->tm_year
-100)%10) | (((teem
->tm_year
-100)/10) << 4);
160 return ((teem
->tm_mon
+1)%10) | (((teem
->tm_mon
+1)/10) << 4);
163 return (teem
->tm_mday
%10) | ((teem
->tm_mday
/10) << 4);
166 return address
^ 0x55;
169 int rtc_write(int address
, int value
)
176 bool is_new_player(void)
178 return having_new_lcd
;
181 void lcd_set_contrast( int x
)
186 void mpeg_set_pitch(int pitch
)
191 void audio_set_buffer_margin(int seconds
)
196 static int sleeptime
;
197 void set_sleep_timer(int seconds
)
202 int get_sleep_timer(void)
207 #ifdef HAVE_LCD_CHARCELLS
208 void lcd_clearrect (int x
, int y
, int nx
, int ny
)
210 /* Reprint char if you want to change anything */
217 void lcd_fillrect (int x
, int y
, int nx
, int ny
)
219 /* Reprint char if you want to change display anything */
227 void cpu_sleep(bool enabled
)
232 void button_set_flip(bool yesno
)
241 int talk_buffer_steal(void)
246 int talk_id(int id
, bool enqueue
)
253 int talk_file(char* filename
, bool enqueue
)
260 int talk_value(int n
, int unit
, bool enqueue
)
268 int talk_number(int n
, bool enqueue
)
275 int talk_spell(char* spell
, bool enqueue
)
282 const char* const dir_thumbnail_name
= "_dirname.talk";
283 const char* const file_thumbnail_ext
= ".talk";
285 /* FIXME: this shoudn't be a stub, rather the real thing.
286 I'm afraid on Win32/X11 it'll be hard to kill a thread from outside. */
287 void remove_thread(int threadnum
)
292 /* assure an unused place to direct virtual pointers to */
293 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
294 unsigned char vp_dummy
[VIRT_SIZE
];