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 ****************************************************************************/
35 #include "powermgmt.h"
42 #include "mp3_playback.h"
43 #include "main_menu.h"
46 #include "backlight.h"
48 #include "debug_menu.h"
53 #include "wps-display.h"
63 #if (CONFIG_HWCODEC == MASNONE)
64 #include "pcm_playback.h"
74 #ifdef HAVE_REMOTE_LCD
75 #include "lcd-remote.h"
78 /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
80 const char appsversion
[]=APPSVERSION
;
101 settings_calc_config_sector();
102 settings_load(SETTINGS_ALL
);
107 mp3_init( global_settings
.volume
,
108 global_settings
.bass
,
109 global_settings
.treble
,
110 global_settings
.balance
,
111 global_settings
.loudness
,
113 global_settings
.channel_config
,
114 global_settings
.stereo_width
,
115 global_settings
.mdb_strength
,
116 global_settings
.mdb_harmonics
,
117 global_settings
.mdb_center
,
118 global_settings
.mdb_shape
,
119 global_settings
.mdb_enable
,
120 global_settings
.superbass
);
122 button_clear_queue(); /* Empty the keyboard buffer */
130 bool mounted
= false;
131 #if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034)
132 /* if nobody initialized ATA before, I consider this a cold start */
133 bool coldstart
= (PACR2
& 0x4000) != 0; /* starting from Flash */
138 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
139 set_cpu_frequency(CPUFREQ_NORMAL
);
148 #ifdef HAVE_REMOTE_LCD
160 #ifndef HAVE_MMC /* FIXME: This is also necessary for debug builds
161 * (do debug builds on the Ondio make sense?) */
170 settings_load(SETTINGS_RTC
); /* early load parts of global_settings */
187 #if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034)
188 if (coldstart
&& charger_inserted()
189 && !global_settings
.car_adapter_mode
190 #ifdef ATA_POWER_PLAYERSTYLE
191 && !ide_powered() /* relies on probing result from bootloader */
195 rc
= charging_screen(); /* display a "charging" screen */
196 if (rc
== 1 || rc
== 2) /* charger removed or "Off/Stop" pressed */
198 /* "On" pressed or USB connected: proceed */
199 show_logo(); /* again, to provide better visual feedback */
206 #ifdef HAVE_LCD_BITMAP
209 snprintf(str
, 31, "ATA error: %d", rc
);
211 lcd_puts(0, 3, "Press ON to debug");
213 while(!(button_get(true) & BUTTON_REL
));
216 panicf("ata: %d", rc
);
219 usb_start_monitoring();
221 { /* enter USB mode early, before trying to mount */
222 if (button_get_w_tmo(HZ
/10) == SYS_USB_CONNECTED
)
224 if (!mmc_touched() || (mmc_remove_request() == SYS_MMC_EXTRACTED
))
228 mounted
= true; /* mounting done @ end of USB mode */
234 rc
= disk_mount_all();
238 lcd_puts(0, 0, "No partition");
239 lcd_puts(0, 1, "found.");
240 #ifdef HAVE_LCD_BITMAP
241 lcd_puts(0, 2, "Insert USB cable");
242 lcd_puts(0, 3, "and fix it.");
245 while(button_get(true) != SYS_USB_CONNECTED
) {};
251 settings_calc_config_sector();
252 settings_load(SETTINGS_ALL
);
259 /* No buffer allocation (see buffer.c) may take place after the call to
260 audio_init() since the mpeg thread takes the rest of the buffer space */
261 mp3_init( global_settings
.volume
,
262 global_settings
.bass
,
263 global_settings
.treble
,
264 global_settings
.balance
,
265 global_settings
.loudness
,
267 global_settings
.channel_config
,
268 global_settings
.stereo_width
,
269 global_settings
.mdb_strength
,
270 global_settings
.mdb_harmonics
,
271 global_settings
.mdb_center
,
272 global_settings
.mdb_shape
,
273 global_settings
.mdb_enable
,
274 global_settings
.superbass
);
282 static const char filename
[] = PLUGIN_DIR
"/autostart.rock";
284 fd
= open(filename
, O_RDONLY
);
285 if(fd
>= 0) /* no complaint if it doesn't exit */
288 plugin_load((char*)filename
, NULL
); /* start if it does */
291 #endif /* #ifdef AUTOROCK */
293 #if (CONFIG_HWCODEC == MASNONE)
297 car_adapter_mode_init();
306 led(true); sleep(HZ
/10);
307 led(false); sleep(HZ
/10);