1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Björn Stenberg
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 ****************************************************************************/
21 #if defined(IRIVER_H100) && !defined(SIMULATOR)
25 unsigned long test_thread_stack
[0x1000];
33 void test_thread(void)
37 GPIO1_OUT
^= 0x00020000;
48 create_thread(test_thread
, test_thread_stack
,
49 sizeof(test_thread_stack
), "Test thread");
51 GPIO1_FUNCTION
|= 0x00020000;
52 GPIO1_ENABLE
|= 0x00020000;
55 for(i
= 0;i
< 10000;i
++) {}
75 #include "powermgmt.h"
82 #include "mp3_playback.h"
83 #include "main_menu.h"
86 #include "backlight.h"
88 #include "debug_menu.h"
93 #include "wps-display.h"
108 /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
110 const char appsversion
[]=APPSVERSION
;
130 settings_calc_config_sector();
131 settings_load(SETTINGS_ALL
);
136 mp3_init( global_settings
.volume
,
137 global_settings
.bass
,
138 global_settings
.treble
,
139 global_settings
.balance
,
140 global_settings
.loudness
,
142 global_settings
.channel_config
,
143 global_settings
.stereo_width
,
144 global_settings
.mdb_strength
,
145 global_settings
.mdb_harmonics
,
146 global_settings
.mdb_center
,
147 global_settings
.mdb_shape
,
148 global_settings
.mdb_enable
,
149 global_settings
.superbass
);
151 while (button_get(false) != 0)
152 ; /* Empty the keyboard buffer */
160 /* if nobody initialized ATA before, I consider this a cold start */
161 bool coldstart
= (PACR2
& 0x4000) != 0; /* starting from Flash */
179 #ifndef HAVE_MMC /* FIXME: This is also necessary for debug builds
180 * (do debug builds on the Ondio make sense?) */
189 settings_load(SETTINGS_RTC
); /* early load parts of global_settings */
207 if (coldstart
&& charger_inserted()
208 && !global_settings
.car_adapter_mode
209 #ifdef ATA_POWER_PLAYERSTYLE
210 && !ide_powered() /* relies on probing result from bootloader */
214 rc
= charging_screen(); /* display a "charging" screen */
215 if (rc
== 1 || rc
== 2) /* charger removed or "Off/Stop" pressed */
217 /* "On" pressed or USB connected: proceed */
218 show_logo(); /* again, to provide better visual feedback */
227 #ifdef HAVE_LCD_BITMAP
230 snprintf(str
, 31, "ATA error: %d", rc
);
232 lcd_puts(0, 3, "Press ON to debug");
234 while(!(button_get(true) & BUTTON_REL
));
237 panicf("ata: %d", rc
);
240 usb_start_monitoring();
242 /* FixMe: the same kind of mounting happens in usb.c, share the code. */
243 rc
= disk_mount_all();
247 lcd_puts(0, 0, "No partition");
248 lcd_puts(0, 1, "found.");
249 #ifdef HAVE_LCD_BITMAP
250 lcd_puts(0, 2, "Insert USB cable");
251 lcd_puts(0, 3, "and fix it.");
254 while(button_get(true) != SYS_USB_CONNECTED
) {};
259 settings_calc_config_sector();
260 settings_load(SETTINGS_ALL
);
267 /* No buffer allocation (see buffer.c) may take place after the call to
268 mpeg_init() since the mpeg thread takes the rest of the buffer space */
269 mp3_init( global_settings
.volume
,
270 global_settings
.bass
,
271 global_settings
.treble
,
272 global_settings
.balance
,
273 global_settings
.loudness
,
275 global_settings
.channel_config
,
276 global_settings
.stereo_width
,
277 global_settings
.mdb_strength
,
278 global_settings
.mdb_harmonics
,
279 global_settings
.mdb_center
,
280 global_settings
.mdb_shape
,
281 global_settings
.mdb_enable
,
282 global_settings
.superbass
);
290 static const char filename
[] = PLUGIN_DIR
"/autostart.rock";
292 fd
= open(filename
, O_RDONLY
);
293 if(fd
>= 0) /* no complaint if it doesn't exit */
296 plugin_load((char*)filename
, NULL
); /* start if it does */
299 #endif /* #ifdef AUTOROCK */
307 led(true); sleep(HZ
/10);
308 led(false); sleep(HZ
/10);