2002-05-16 12:53:40 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-05-05 10:32:46 +00:00
|
|
|
* Copyright (C) 2002 Björn Stenberg
|
2002-05-16 12:53:40 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-05-16 12:53:40 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2004-10-15 02:16:31 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2008-11-01 16:14:28 +00:00
|
|
|
#include "storage.h"
|
2002-05-17 19:50:37 +00:00
|
|
|
#include "disk.h"
|
|
|
|
#include "fat.h"
|
|
|
|
#include "lcd.h"
|
2002-06-24 13:51:40 +00:00
|
|
|
#include "rtc.h"
|
2002-05-17 19:50:37 +00:00
|
|
|
#include "debug.h"
|
|
|
|
#include "led.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "button.h"
|
2002-05-16 12:53:40 +00:00
|
|
|
#include "tree.h"
|
2007-03-29 06:16:00 +00:00
|
|
|
#include "filetypes.h"
|
2002-05-21 14:28:10 +00:00
|
|
|
#include "panic.h"
|
|
|
|
#include "menu.h"
|
2002-05-29 09:14:38 +00:00
|
|
|
#include "system.h"
|
2002-06-30 13:24:29 +00:00
|
|
|
#include "usb.h"
|
2002-08-06 10:52:51 +00:00
|
|
|
#include "powermgmt.h"
|
2002-06-30 20:25:37 +00:00
|
|
|
#include "adc.h"
|
2002-07-02 21:40:12 +00:00
|
|
|
#include "i2c.h"
|
2002-08-12 12:44:18 +00:00
|
|
|
#ifndef DEBUG
|
|
|
|
#include "serial.h"
|
|
|
|
#endif
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2004-01-05 20:42:51 +00:00
|
|
|
#include "mp3_playback.h"
|
2002-06-12 15:31:35 +00:00
|
|
|
#include "thread.h"
|
2002-06-20 08:59:54 +00:00
|
|
|
#include "settings.h"
|
2002-06-24 13:51:40 +00:00
|
|
|
#include "backlight.h"
|
2002-07-22 22:44:03 +00:00
|
|
|
#include "status.h"
|
2002-07-15 11:02:12 +00:00
|
|
|
#include "debug_menu.h"
|
2002-09-12 13:33:59 +00:00
|
|
|
#include "font.h"
|
2002-09-25 11:42:10 +00:00
|
|
|
#include "language.h"
|
2009-08-03 04:43:34 +00:00
|
|
|
#include "wps.h"
|
2003-04-24 17:31:36 +00:00
|
|
|
#include "playlist.h"
|
2003-05-09 16:01:21 +00:00
|
|
|
#include "buffer.h"
|
2003-07-03 22:13:39 +00:00
|
|
|
#include "rolo.h"
|
2009-10-19 21:34:27 +00:00
|
|
|
#include "screens.h"
|
2009-10-19 21:19:30 +00:00
|
|
|
#include "usb_screen.h"
|
2003-07-17 20:29:51 +00:00
|
|
|
#include "power.h"
|
2004-03-14 21:33:53 +00:00
|
|
|
#include "talk.h"
|
2004-06-19 15:50:02 +00:00
|
|
|
#include "plugin.h"
|
2005-04-06 11:12:22 +00:00
|
|
|
#include "misc.h"
|
2005-10-07 17:38:05 +00:00
|
|
|
#include "dircache.h"
|
2006-10-25 10:17:57 +00:00
|
|
|
#ifdef HAVE_TAGCACHE
|
2006-03-26 11:33:42 +00:00
|
|
|
#include "tagcache.h"
|
2006-04-04 19:28:13 +00:00
|
|
|
#include "tagtree.h"
|
2006-10-25 10:17:57 +00:00
|
|
|
#endif
|
2005-10-07 17:38:05 +00:00
|
|
|
#include "lang.h"
|
|
|
|
#include "string.h"
|
2005-12-07 11:20:56 +00:00
|
|
|
#include "splash.h"
|
2006-08-05 20:19:10 +00:00
|
|
|
#include "eeprom_settings.h"
|
2006-10-19 09:42:58 +00:00
|
|
|
#include "scrobbler.h"
|
2007-04-16 09:14:36 +00:00
|
|
|
#include "icon.h"
|
2009-08-16 22:20:11 +00:00
|
|
|
#include "viewport.h"
|
2009-10-19 15:28:15 +00:00
|
|
|
#include "statusbar-skinned.h"
|
2010-04-01 16:27:21 +00:00
|
|
|
#include "bootchart.h"
|
2005-03-28 00:00:24 +00:00
|
|
|
|
2008-12-25 01:46:16 +00:00
|
|
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
|
|
|
#include "iap.h"
|
|
|
|
#endif
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
2006-01-27 11:39:46 +00:00
|
|
|
#include "playback.h"
|
2009-06-15 16:03:01 +00:00
|
|
|
#include "tdspeed.h"
|
2005-03-28 13:00:22 +00:00
|
|
|
#endif
|
2006-07-21 08:42:28 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR)
|
2005-06-19 03:05:53 +00:00
|
|
|
#include "pcm_record.h"
|
2006-12-18 01:52:21 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BUTTON_REC
|
2007-04-27 19:24:31 +00:00
|
|
|
#define SETTINGS_RESET BUTTON_REC
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
|
|
|
#define SETTINGS_RESET BUTTON_A
|
2005-06-19 03:05:53 +00:00
|
|
|
#endif
|
2005-03-28 00:00:24 +00:00
|
|
|
|
2007-02-18 02:04:47 +00:00
|
|
|
#if CONFIG_TUNER
|
2004-10-15 21:41:46 +00:00
|
|
|
#include "radio.h"
|
2004-10-15 22:10:55 +00:00
|
|
|
#endif
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC)
|
2004-12-28 22:16:07 +00:00
|
|
|
#include "ata_mmc.h"
|
|
|
|
#endif
|
2004-06-19 15:50:02 +00:00
|
|
|
|
2005-04-15 12:08:49 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#include "lcd-remote.h"
|
|
|
|
#endif
|
|
|
|
|
2007-02-18 04:57:28 +00:00
|
|
|
#if CONFIG_USBOTG == USBOTG_ISP1362
|
2006-06-16 17:34:18 +00:00
|
|
|
#include "isp1362.h"
|
|
|
|
#endif
|
|
|
|
|
2007-02-18 04:57:28 +00:00
|
|
|
#if CONFIG_USBOTG == USBOTG_M5636
|
2006-07-13 07:40:30 +00:00
|
|
|
#include "m5636.h"
|
|
|
|
#endif
|
|
|
|
|
2010-07-25 17:07:56 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2009-02-20 17:13:08 +00:00
|
|
|
#include "sim_tasks.h"
|
2010-06-21 16:53:00 +00:00
|
|
|
#endif
|
2010-07-25 17:07:56 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#ifdef HAVE_SDL
|
2007-10-26 23:11:18 +00:00
|
|
|
#include "system-sdl.h"
|
|
|
|
#endif
|
|
|
|
|
2004-06-19 15:50:02 +00:00
|
|
|
/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
|
2002-08-12 12:44:18 +00:00
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
static void init(void);
|
2009-08-27 13:30:26 +00:00
|
|
|
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef HAVE_SDL
|
|
|
|
#if defined(WIN32) && defined(main)
|
|
|
|
/* Don't use SDL_main on windows -> no more stdio redirection */
|
|
|
|
#undef main
|
|
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
sys_handle_argv(argc, argv);
|
2006-12-12 22:22:21 +00:00
|
|
|
#else
|
2010-03-04 17:44:57 +00:00
|
|
|
/* main(), and various functions called by main() and init() may be
|
|
|
|
* be INIT_ATTR. These functions must not be called after the final call
|
|
|
|
* to root_menu() at the end of main()
|
|
|
|
* see definition of INIT_ATTR in config.h */
|
2010-03-03 23:20:32 +00:00
|
|
|
int main(void) INIT_ATTR __attribute__((noreturn));
|
2009-11-03 12:20:54 +00:00
|
|
|
int main(void)
|
2002-05-21 14:28:10 +00:00
|
|
|
{
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2008-03-05 09:58:30 +00:00
|
|
|
int i;
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">init");
|
2002-06-10 12:42:23 +00:00
|
|
|
init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<init");
|
2008-03-05 09:58:30 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
|
|
|
screens[i].clear_display();
|
|
|
|
screens[i].update();
|
|
|
|
}
|
2009-09-07 17:37:06 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
list_init();
|
|
|
|
#endif
|
2007-06-10 10:41:27 +00:00
|
|
|
tree_gui_init();
|
2009-11-10 20:13:24 +00:00
|
|
|
/* Keep the order of this 3
|
|
|
|
* Must be done before any code uses the multi-screen API */
|
2009-05-21 19:01:07 +00:00
|
|
|
#ifdef HAVE_USBSTACK
|
|
|
|
/* All threads should be created and public queues registered by now */
|
|
|
|
usb_start_monitoring();
|
|
|
|
#endif
|
2009-08-27 13:30:26 +00:00
|
|
|
|
|
|
|
#ifdef AUTOROCK
|
|
|
|
{
|
|
|
|
static const char filename[] = PLUGIN_APPS_DIR "/autostart.rock";
|
|
|
|
|
|
|
|
if(file_exists(filename)) /* no complaint if it doesn't exist */
|
|
|
|
{
|
|
|
|
plugin_load((char*)filename, NULL); /* start if it does */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* #ifdef AUTOROCK */
|
|
|
|
|
2009-11-01 02:36:51 +00:00
|
|
|
global_status.last_volume_change = 0;
|
2010-03-04 17:44:57 +00:00
|
|
|
/* no calls INIT_ATTR functions after this point anymore!
|
|
|
|
* see definition of INIT_ATTR in config.h */
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">root_menu");
|
2007-06-10 10:41:27 +00:00
|
|
|
root_menu();
|
2002-05-21 14:28:10 +00:00
|
|
|
}
|
|
|
|
|
2010-03-03 23:20:32 +00:00
|
|
|
static int init_dircache(bool preinit) INIT_ATTR;
|
2006-12-12 22:22:21 +00:00
|
|
|
static int init_dircache(bool preinit)
|
2005-10-07 17:38:05 +00:00
|
|
|
{
|
2006-08-05 20:19:10 +00:00
|
|
|
#ifdef HAVE_DIRCACHE
|
|
|
|
int result = 0;
|
2006-08-12 14:40:38 +00:00
|
|
|
bool clear = false;
|
|
|
|
|
|
|
|
if (preinit)
|
|
|
|
dircache_init();
|
2008-03-08 23:50:55 +00:00
|
|
|
|
2006-12-22 09:11:09 +00:00
|
|
|
if (!global_settings.dircache)
|
|
|
|
return 0;
|
2008-03-08 23:50:55 +00:00
|
|
|
|
2006-08-15 22:54:06 +00:00
|
|
|
# ifdef HAVE_EEPROM_SETTINGS
|
2006-12-22 09:11:09 +00:00
|
|
|
if (firmware_settings.initialized && firmware_settings.disk_clean
|
|
|
|
&& preinit)
|
|
|
|
{
|
|
|
|
result = dircache_load();
|
|
|
|
|
|
|
|
if (result < 0)
|
2005-11-19 09:47:31 +00:00
|
|
|
{
|
2006-12-22 09:11:09 +00:00
|
|
|
firmware_settings.disk_clean = false;
|
2007-01-24 02:19:22 +00:00
|
|
|
if (global_status.dircache_size <= 0)
|
2006-08-12 15:18:25 +00:00
|
|
|
{
|
2006-12-22 09:11:09 +00:00
|
|
|
/* This will be in default language, settings are not
|
|
|
|
applied yet. Not really any easy way to fix that. */
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(0, str(LANG_SCANNING_DISK));
|
2006-12-22 09:11:09 +00:00
|
|
|
clear = true;
|
2006-08-12 15:18:25 +00:00
|
|
|
}
|
2006-12-22 09:11:09 +00:00
|
|
|
|
2007-01-24 02:19:22 +00:00
|
|
|
dircache_build(global_status.dircache_size);
|
2005-11-19 09:47:31 +00:00
|
|
|
}
|
2006-12-22 09:11:09 +00:00
|
|
|
}
|
|
|
|
else
|
2006-08-05 20:19:10 +00:00
|
|
|
# endif
|
2006-12-22 09:11:09 +00:00
|
|
|
{
|
2006-08-12 14:40:38 +00:00
|
|
|
if (preinit)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (!dircache_is_enabled()
|
|
|
|
&& !dircache_is_initializing())
|
|
|
|
{
|
2007-01-24 02:19:22 +00:00
|
|
|
if (global_status.dircache_size <= 0)
|
2006-08-12 14:40:38 +00:00
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(0, str(LANG_SCANNING_DISK));
|
2006-08-12 14:40:38 +00:00
|
|
|
clear = true;
|
|
|
|
}
|
2007-01-24 02:19:22 +00:00
|
|
|
result = dircache_build(global_status.dircache_size);
|
2006-08-12 14:40:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result < 0)
|
2007-04-07 17:48:51 +00:00
|
|
|
{
|
|
|
|
/* Initialization of dircache failed. Manual action is
|
|
|
|
* necessary to enable dircache again.
|
|
|
|
*/
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(0, "Dircache failed, disabled. Result: %d", result);
|
2007-04-07 17:48:51 +00:00
|
|
|
global_settings.dircache = false;
|
|
|
|
}
|
2006-12-22 09:11:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (clear)
|
|
|
|
{
|
|
|
|
backlight_on();
|
|
|
|
show_logo();
|
2007-01-24 02:19:22 +00:00
|
|
|
global_status.dircache_size = dircache_get_cache_size();
|
|
|
|
status_save();
|
2005-10-07 17:38:05 +00:00
|
|
|
}
|
2006-08-05 20:19:10 +00:00
|
|
|
|
|
|
|
return result;
|
2005-10-07 17:38:05 +00:00
|
|
|
#else
|
2006-08-12 14:40:38 +00:00
|
|
|
(void)preinit;
|
2006-08-05 20:19:10 +00:00
|
|
|
return 0;
|
2005-10-07 17:38:05 +00:00
|
|
|
#endif
|
2006-08-05 20:19:10 +00:00
|
|
|
}
|
2005-10-07 17:38:05 +00:00
|
|
|
|
2006-10-25 10:17:57 +00:00
|
|
|
#ifdef HAVE_TAGCACHE
|
2010-03-03 23:20:32 +00:00
|
|
|
static void init_tagcache(void) INIT_ATTR;
|
2006-12-12 22:22:21 +00:00
|
|
|
static void init_tagcache(void)
|
2006-03-26 11:33:42 +00:00
|
|
|
{
|
2006-05-24 07:31:23 +00:00
|
|
|
bool clear = false;
|
2009-10-25 10:20:15 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
long talked_tick = 0;
|
|
|
|
#endif
|
2006-03-26 11:33:42 +00:00
|
|
|
tagcache_init();
|
2006-04-12 10:31:24 +00:00
|
|
|
|
|
|
|
while (!tagcache_is_initialized())
|
|
|
|
{
|
2006-05-24 07:31:23 +00:00
|
|
|
int ret = tagcache_get_commit_step();
|
|
|
|
|
2006-04-12 10:31:24 +00:00
|
|
|
if (ret > 0)
|
|
|
|
{
|
2007-08-28 18:08:48 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
/* hwcodec can't use voice here, as the database commit
|
|
|
|
* uses the audio buffer. */
|
2007-10-19 15:31:42 +00:00
|
|
|
if(global_settings.talk_menu
|
2007-08-06 13:08:36 +00:00
|
|
|
&& (talked_tick == 0
|
|
|
|
|| TIME_AFTER(current_tick, talked_tick+7*HZ)))
|
|
|
|
{
|
|
|
|
talked_tick = current_tick;
|
|
|
|
talk_id(LANG_TAGCACHE_INIT, false);
|
|
|
|
talk_number(ret, true);
|
|
|
|
talk_id(VOICE_OF, true);
|
|
|
|
talk_number(tagcache_get_max_commit_step(), true);
|
|
|
|
}
|
2007-08-28 18:08:48 +00:00
|
|
|
#endif
|
2006-05-24 07:31:23 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2009-10-08 22:40:38 +00:00
|
|
|
if (lang_is_rtl())
|
|
|
|
{
|
|
|
|
splashf(0, "[%d/%d] %s", ret, tagcache_get_max_commit_step(),
|
|
|
|
str(LANG_TAGCACHE_INIT));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
splashf(0, "%s [%d/%d]", str(LANG_TAGCACHE_INIT), ret,
|
|
|
|
tagcache_get_max_commit_step());
|
|
|
|
}
|
2006-05-24 07:31:23 +00:00
|
|
|
#else
|
|
|
|
lcd_double_height(false);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 1, " DB [%d/%d]", ret,
|
2007-03-07 19:56:15 +00:00
|
|
|
tagcache_get_max_commit_step());
|
2007-05-17 06:37:25 +00:00
|
|
|
lcd_update();
|
2006-04-12 10:31:24 +00:00
|
|
|
#endif
|
2006-05-24 07:31:23 +00:00
|
|
|
clear = true;
|
|
|
|
}
|
2006-04-12 10:31:24 +00:00
|
|
|
sleep(HZ/4);
|
|
|
|
}
|
2006-04-04 19:28:13 +00:00
|
|
|
tagtree_init();
|
2006-03-26 11:33:42 +00:00
|
|
|
|
2006-05-24 07:31:23 +00:00
|
|
|
if (clear)
|
2006-05-27 11:21:08 +00:00
|
|
|
{
|
|
|
|
backlight_on();
|
2006-05-24 07:31:23 +00:00
|
|
|
show_logo();
|
2006-05-27 11:21:08 +00:00
|
|
|
}
|
2006-03-26 11:33:42 +00:00
|
|
|
}
|
2006-10-25 10:17:57 +00:00
|
|
|
#endif
|
2006-03-26 11:33:42 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2002-06-10 12:42:23 +00:00
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
static void init(void)
|
2002-06-10 12:42:23 +00:00
|
|
|
{
|
2010-05-15 21:02:47 +00:00
|
|
|
system_init();
|
2008-03-25 02:34:12 +00:00
|
|
|
kernel_init();
|
2003-05-09 16:01:21 +00:00
|
|
|
buffer_init();
|
2008-03-26 01:50:41 +00:00
|
|
|
enable_irq();
|
2002-06-10 12:42:23 +00:00
|
|
|
lcd_init();
|
2005-07-07 21:03:58 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
lcd_remote_init();
|
|
|
|
#endif
|
2002-10-28 19:52:22 +00:00
|
|
|
font_init();
|
2002-06-10 12:42:23 +00:00
|
|
|
show_logo();
|
2005-11-21 23:55:39 +00:00
|
|
|
button_init();
|
|
|
|
backlight_init();
|
2009-02-20 17:13:08 +00:00
|
|
|
sim_tasks_init();
|
2009-10-18 00:56:42 +00:00
|
|
|
lang_init(core_language_builtin, language_strings,
|
|
|
|
LANG_LAST_INDEX_IN_ARRAY);
|
2007-04-19 20:17:24 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
debug_init();
|
|
|
|
#endif
|
2009-11-10 20:13:24 +00:00
|
|
|
/* Keep the order of this 3 (viewportmanager handles statusbars)
|
|
|
|
* Must be done before any code uses the multi-screen API */
|
2009-10-03 22:09:27 +00:00
|
|
|
gui_syncstatusbar_init(&statusbars);
|
2010-03-04 01:04:43 +00:00
|
|
|
gui_sync_wps_init();
|
2009-11-10 20:13:24 +00:00
|
|
|
sb_skin_init();
|
|
|
|
viewportmanager_init();
|
|
|
|
|
2008-11-01 16:14:28 +00:00
|
|
|
storage_init();
|
2002-07-15 11:02:12 +00:00
|
|
|
settings_reset();
|
2004-06-19 15:50:02 +00:00
|
|
|
settings_load(SETTINGS_ALL);
|
2010-03-07 03:20:34 +00:00
|
|
|
settings_apply(true);
|
2006-08-12 14:40:38 +00:00
|
|
|
init_dircache(true);
|
|
|
|
init_dircache(false);
|
2006-10-25 10:17:57 +00:00
|
|
|
#ifdef HAVE_TAGCACHE
|
2006-03-26 11:33:42 +00:00
|
|
|
init_tagcache();
|
2006-10-25 10:17:57 +00:00
|
|
|
#endif
|
2002-06-10 12:42:23 +00:00
|
|
|
sleep(HZ/2);
|
2007-06-10 10:41:27 +00:00
|
|
|
tree_mem_init();
|
2007-03-29 06:16:00 +00:00
|
|
|
filetype_init();
|
2003-05-17 22:25:52 +00:00
|
|
|
playlist_init();
|
2007-03-09 12:30:14 +00:00
|
|
|
|
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2004-01-05 20:42:51 +00:00
|
|
|
mp3_init( global_settings.volume,
|
|
|
|
global_settings.bass,
|
|
|
|
global_settings.treble,
|
|
|
|
global_settings.balance,
|
|
|
|
global_settings.loudness,
|
|
|
|
global_settings.avc,
|
2004-07-06 12:17:14 +00:00
|
|
|
global_settings.channel_config,
|
2005-01-12 00:24:15 +00:00
|
|
|
global_settings.stereo_width,
|
2004-07-06 12:17:14 +00:00
|
|
|
global_settings.mdb_strength,
|
|
|
|
global_settings.mdb_harmonics,
|
|
|
|
global_settings.mdb_center,
|
|
|
|
global_settings.mdb_shape,
|
|
|
|
global_settings.mdb_enable,
|
|
|
|
global_settings.superbass);
|
2006-05-01 12:54:21 +00:00
|
|
|
|
|
|
|
/* audio_init must to know the size of voice buffer so init voice first */
|
2005-08-20 11:13:19 +00:00
|
|
|
talk_init();
|
2007-03-09 12:30:14 +00:00
|
|
|
#endif /* CONFIG_CODEC != SWCODEC */
|
|
|
|
|
|
|
|
scrobbler_init();
|
2009-06-15 15:46:09 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
tdspeed_init();
|
|
|
|
#endif /* CONFIG_CODEC == SWCODEC */
|
2006-05-01 12:54:21 +00:00
|
|
|
|
|
|
|
audio_init();
|
|
|
|
button_clear_queue(); /* Empty the keyboard buffer */
|
2009-12-09 07:25:46 +00:00
|
|
|
|
2010-02-26 08:01:41 +00:00
|
|
|
settings_apply_skins();
|
2002-06-10 12:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2002-05-24 15:40:14 +00:00
|
|
|
|
2010-03-03 23:20:32 +00:00
|
|
|
static void init(void) INIT_ATTR;
|
2006-12-12 22:22:21 +00:00
|
|
|
static void init(void)
|
2002-05-17 19:50:37 +00:00
|
|
|
{
|
2004-12-29 22:33:32 +00:00
|
|
|
int rc;
|
2005-05-17 22:10:51 +00:00
|
|
|
bool mounted = false;
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
|
2003-07-17 20:29:51 +00:00
|
|
|
/* if nobody initialized ATA before, I consider this a cold start */
|
|
|
|
bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */
|
2007-03-04 20:06:41 +00:00
|
|
|
#endif
|
2007-09-28 10:20:02 +00:00
|
|
|
|
2002-05-29 09:14:38 +00:00
|
|
|
system_init();
|
2002-06-10 14:44:15 +00:00
|
|
|
kernel_init();
|
2002-06-20 08:59:54 +00:00
|
|
|
|
2005-03-18 11:38:15 +00:00
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
|
|
|
set_cpu_frequency(CPUFREQ_NORMAL);
|
2006-11-06 18:07:30 +00:00
|
|
|
#ifdef CPU_COLDFIRE
|
|
|
|
coldfire_set_pllcr_audio_bits(DEFAULT_PLLCR_AUDIO_BITS);
|
|
|
|
#endif
|
2006-12-05 20:20:00 +00:00
|
|
|
cpu_boost(true);
|
2005-03-18 11:38:15 +00:00
|
|
|
#endif
|
|
|
|
|
2003-05-09 16:01:21 +00:00
|
|
|
buffer_init();
|
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
settings_reset();
|
2005-11-18 14:55:51 +00:00
|
|
|
|
2008-02-10 05:39:20 +00:00
|
|
|
i2c_init();
|
|
|
|
|
2005-11-18 14:55:51 +00:00
|
|
|
power_init();
|
|
|
|
|
2008-03-26 01:50:41 +00:00
|
|
|
enable_irq();
|
2007-10-06 22:27:27 +00:00
|
|
|
#ifdef CPU_ARM
|
2008-03-26 01:50:41 +00:00
|
|
|
enable_fiq();
|
2007-10-06 22:27:27 +00:00
|
|
|
#endif
|
2010-04-01 16:27:21 +00:00
|
|
|
/* current_tick should be ticking by now */
|
|
|
|
CHART("ticking");
|
|
|
|
|
2002-05-29 09:12:21 +00:00
|
|
|
lcd_init();
|
2005-07-07 21:03:58 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2005-04-15 12:08:49 +00:00
|
|
|
lcd_remote_init();
|
|
|
|
#endif
|
2002-09-20 08:07:51 +00:00
|
|
|
font_init();
|
2007-04-21 04:48:20 +00:00
|
|
|
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">show_logo");
|
2005-11-08 23:51:36 +00:00
|
|
|
show_logo();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<show_logo");
|
2009-10-18 00:56:42 +00:00
|
|
|
lang_init(core_language_builtin, language_strings,
|
|
|
|
LANG_LAST_INDEX_IN_ARRAY);
|
2002-06-11 08:24:33 +00:00
|
|
|
|
2002-05-27 09:53:28 +00:00
|
|
|
#ifdef DEBUG
|
2002-05-17 19:50:37 +00:00
|
|
|
debug_init();
|
2002-08-12 12:44:18 +00:00
|
|
|
#else
|
2009-02-07 11:15:30 +00:00
|
|
|
#ifdef HAVE_SERIAL
|
2002-08-12 12:44:18 +00:00
|
|
|
serial_setup();
|
2004-09-20 22:15:35 +00:00
|
|
|
#endif
|
2002-05-27 09:53:28 +00:00
|
|
|
#endif
|
2002-05-17 19:50:37 +00:00
|
|
|
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2002-08-06 08:14:08 +00:00
|
|
|
rtc_init();
|
2005-12-04 13:05:56 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_RTC_RAM
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">settings_load(RTC)");
|
2004-06-19 15:50:02 +00:00
|
|
|
settings_load(SETTINGS_RTC); /* early load parts of global_settings */
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<settings_load(RTC)");
|
2002-08-06 08:14:08 +00:00
|
|
|
#endif
|
|
|
|
|
2002-06-30 20:25:37 +00:00
|
|
|
adc_init();
|
2007-08-27 16:04:32 +00:00
|
|
|
|
2005-11-08 23:51:36 +00:00
|
|
|
usb_init();
|
2007-02-18 04:57:28 +00:00
|
|
|
#if CONFIG_USBOTG == USBOTG_ISP1362
|
2006-06-16 17:34:18 +00:00
|
|
|
isp1362_init();
|
2007-02-18 04:57:28 +00:00
|
|
|
#elif CONFIG_USBOTG == USBOTG_M5636
|
2006-07-13 07:40:30 +00:00
|
|
|
m5636_init();
|
2006-06-16 17:34:18 +00:00
|
|
|
#endif
|
2005-11-18 14:55:51 +00:00
|
|
|
|
2007-03-07 14:49:20 +00:00
|
|
|
backlight_init();
|
|
|
|
|
2002-07-02 17:59:10 +00:00
|
|
|
button_init();
|
2002-05-17 19:50:37 +00:00
|
|
|
|
2005-11-08 23:51:36 +00:00
|
|
|
powermgmt_init();
|
2008-09-07 20:09:11 +00:00
|
|
|
|
2007-02-18 02:04:47 +00:00
|
|
|
#if CONFIG_TUNER
|
2005-11-08 23:51:36 +00:00
|
|
|
radio_init();
|
2004-10-19 08:20:38 +00:00
|
|
|
#endif
|
|
|
|
|
2009-11-10 20:13:24 +00:00
|
|
|
/* Keep the order of this 3 (viewportmanager handles statusbars)
|
|
|
|
* Must be done before any code uses the multi-screen API */
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">gui_syncstatusbar_init");
|
2009-10-03 22:09:27 +00:00
|
|
|
gui_syncstatusbar_init(&statusbars);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<gui_syncstatusbar_init");
|
|
|
|
CHART(">sb_skin_init");
|
2009-11-10 20:13:24 +00:00
|
|
|
sb_skin_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<sb_skin_init");
|
|
|
|
CHART(">gui_sync_wps_init");
|
2010-03-04 01:04:43 +00:00
|
|
|
gui_sync_wps_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<gui_sync_wps_init");
|
|
|
|
CHART(">viewportmanager_init");
|
2009-11-10 20:13:24 +00:00
|
|
|
viewportmanager_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<viewportmanager_init");
|
2009-11-10 20:13:24 +00:00
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
|
2009-04-06 01:47:28 +00:00
|
|
|
/* charger_inserted() can't be used here because power_thread()
|
|
|
|
hasn't checked power_input_status() yet */
|
|
|
|
if (coldstart && (power_input_status() & POWER_INPUT_MAIN_CHARGER)
|
2004-12-16 22:31:26 +00:00
|
|
|
&& !global_settings.car_adapter_mode
|
|
|
|
#ifdef ATA_POWER_PLAYERSTYLE
|
|
|
|
&& !ide_powered() /* relies on probing result from bootloader */
|
|
|
|
#endif
|
|
|
|
)
|
2003-07-17 20:29:51 +00:00
|
|
|
{
|
|
|
|
rc = charging_screen(); /* display a "charging" screen */
|
2005-07-11 19:14:26 +00:00
|
|
|
if (rc == 1) /* charger removed */
|
2003-07-17 20:29:51 +00:00
|
|
|
power_off();
|
|
|
|
/* "On" pressed or USB connected: proceed */
|
2004-11-21 09:29:51 +00:00
|
|
|
show_logo(); /* again, to provide better visual feedback */
|
2003-07-17 20:29:51 +00:00
|
|
|
}
|
2003-12-12 13:34:27 +00:00
|
|
|
#endif
|
2003-07-03 22:13:39 +00:00
|
|
|
|
2010-06-06 13:20:47 +00:00
|
|
|
|
|
|
|
disk_init_subsystem();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">storage_init");
|
2008-11-01 16:14:28 +00:00
|
|
|
rc = storage_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<storage_init");
|
2002-07-02 18:01:31 +00:00
|
|
|
if(rc)
|
2002-07-02 17:59:10 +00:00
|
|
|
{
|
2002-08-08 20:44:25 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-07-02 17:59:10 +00:00
|
|
|
lcd_clear_display();
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 1, "ATA error: %d", rc);
|
2002-07-02 17:59:10 +00:00
|
|
|
lcd_puts(0, 3, "Press ON to debug");
|
|
|
|
lcd_update();
|
2006-08-15 12:27:07 +00:00
|
|
|
while(!(button_get(true) & BUTTON_REL)); /*DO NOT CHANGE TO ACTION SYSTEM */
|
2002-07-02 17:59:10 +00:00
|
|
|
dbg_ports();
|
|
|
|
#endif
|
|
|
|
panicf("ata: %d", rc);
|
|
|
|
}
|
2004-09-20 22:15:35 +00:00
|
|
|
|
2006-08-15 22:54:06 +00:00
|
|
|
#ifdef HAVE_EEPROM_SETTINGS
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">eeprom_settings_init");
|
2006-08-11 10:13:16 +00:00
|
|
|
eeprom_settings_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<eeprom_settings_init");
|
2006-08-11 10:13:16 +00:00
|
|
|
#endif
|
2008-09-07 20:09:11 +00:00
|
|
|
|
2009-05-21 19:01:07 +00:00
|
|
|
#ifndef HAVE_USBSTACK
|
2009-01-22 22:05:04 +00:00
|
|
|
usb_start_monitoring();
|
2007-09-04 08:03:07 +00:00
|
|
|
while (usb_detect() == USB_INSERTED)
|
2008-09-07 20:09:11 +00:00
|
|
|
{
|
2006-08-15 22:54:06 +00:00
|
|
|
#ifdef HAVE_EEPROM_SETTINGS
|
2006-08-11 10:13:16 +00:00
|
|
|
firmware_settings.disk_clean = false;
|
|
|
|
#endif
|
|
|
|
/* enter USB mode early, before trying to mount */
|
2005-05-17 22:10:51 +00:00
|
|
|
if (button_get_w_tmo(HZ/10) == SYS_USB_CONNECTED)
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC)
|
2007-06-30 02:08:27 +00:00
|
|
|
if (!mmc_touched() ||
|
|
|
|
(mmc_remove_request() == SYS_HOTSWAP_EXTRACTED))
|
2005-05-17 22:10:51 +00:00
|
|
|
#endif
|
|
|
|
{
|
2009-11-10 20:13:24 +00:00
|
|
|
gui_usb_screen_run();
|
2005-05-17 22:10:51 +00:00
|
|
|
mounted = true; /* mounting done @ end of USB mode */
|
|
|
|
}
|
2005-06-23 02:18:29 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
if (usb_powered()) /* avoid deadlock */
|
|
|
|
break;
|
|
|
|
#endif
|
2005-05-17 22:10:51 +00:00
|
|
|
}
|
2008-03-10 19:11:37 +00:00
|
|
|
#endif
|
2005-12-06 10:06:40 +00:00
|
|
|
|
2005-05-17 22:10:51 +00:00
|
|
|
if (!mounted)
|
2004-07-05 22:13:20 +00:00
|
|
|
{
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">disk_mount_all");
|
2005-05-17 22:10:51 +00:00
|
|
|
rc = disk_mount_all();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<disk_mount_all");
|
2005-05-17 22:10:51 +00:00
|
|
|
if (rc<=0)
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
|
|
|
lcd_puts(0, 0, "No partition");
|
|
|
|
lcd_puts(0, 1, "found.");
|
2004-07-05 22:13:20 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-05-17 22:10:51 +00:00
|
|
|
lcd_puts(0, 2, "Insert USB cable");
|
|
|
|
lcd_puts(0, 3, "and fix it.");
|
2004-07-05 22:13:20 +00:00
|
|
|
#endif
|
2007-04-06 22:55:00 +00:00
|
|
|
lcd_update();
|
|
|
|
|
2005-05-17 22:10:51 +00:00
|
|
|
while(button_get(true) != SYS_USB_CONNECTED) {};
|
2009-11-10 20:13:24 +00:00
|
|
|
gui_usb_screen_run();
|
2005-05-17 22:10:51 +00:00
|
|
|
system_reboot();
|
|
|
|
}
|
2004-07-05 22:13:20 +00:00
|
|
|
}
|
2002-07-15 15:06:45 +00:00
|
|
|
|
2006-12-31 02:02:03 +00:00
|
|
|
#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
2007-04-27 19:24:31 +00:00
|
|
|
(CONFIG_KEYPAD == IRIVER_H10_PAD)
|
2005-12-07 12:35:54 +00:00
|
|
|
#ifdef SETTINGS_RESET
|
2007-04-27 19:24:31 +00:00
|
|
|
/* Reset settings if holding the reset button. (Rec on Archos,
|
|
|
|
A on Gigabeat) */
|
2005-12-07 12:35:54 +00:00
|
|
|
if ((button_status() & SETTINGS_RESET) == SETTINGS_RESET)
|
2006-02-24 12:37:50 +00:00
|
|
|
#else
|
|
|
|
/* Reset settings if the hold button is turned on */
|
|
|
|
if (button_hold())
|
|
|
|
#endif
|
2005-12-07 11:20:56 +00:00
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, str(LANG_RESET_DONE_CLEAR));
|
2005-12-07 11:20:56 +00:00
|
|
|
settings_reset();
|
|
|
|
}
|
|
|
|
else
|
2005-12-07 12:35:54 +00:00
|
|
|
#endif
|
2010-04-01 16:27:21 +00:00
|
|
|
{
|
|
|
|
CHART(">settings_load(ALL)");
|
2005-12-07 11:20:56 +00:00
|
|
|
settings_load(SETTINGS_ALL);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<settings_load(ALL)");
|
|
|
|
}
|
2005-12-07 12:35:54 +00:00
|
|
|
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">init_dircache(true)");
|
|
|
|
rc = init_dircache(true);
|
2010-04-06 23:07:18 +00:00
|
|
|
CHART("<init_dircache(true)");
|
2010-04-01 16:27:21 +00:00
|
|
|
if (rc < 0)
|
2006-08-12 14:40:38 +00:00
|
|
|
{
|
2006-10-25 10:17:57 +00:00
|
|
|
#ifdef HAVE_TAGCACHE
|
2006-08-12 14:40:38 +00:00
|
|
|
remove(TAGCACHE_STATEFILE);
|
2006-10-25 10:17:57 +00:00
|
|
|
#endif
|
2006-08-12 14:40:38 +00:00
|
|
|
}
|
2008-09-07 20:09:11 +00:00
|
|
|
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">settings_apply(true)");
|
2010-03-07 03:20:34 +00:00
|
|
|
settings_apply(true);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<settings_apply(true)");
|
|
|
|
CHART(">init_dircache(false)");
|
2006-08-12 14:40:38 +00:00
|
|
|
init_dircache(false);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<init_dircache(false)");
|
2006-10-25 10:17:57 +00:00
|
|
|
#ifdef HAVE_TAGCACHE
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">init_tagcache");
|
2006-04-12 10:31:24 +00:00
|
|
|
init_tagcache();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<init_tagcache");
|
2006-10-25 10:17:57 +00:00
|
|
|
#endif
|
2004-09-28 18:09:10 +00:00
|
|
|
|
2006-08-15 22:54:06 +00:00
|
|
|
#ifdef HAVE_EEPROM_SETTINGS
|
2006-08-05 20:19:10 +00:00
|
|
|
if (firmware_settings.initialized)
|
|
|
|
{
|
|
|
|
/* In case we crash. */
|
|
|
|
firmware_settings.disk_clean = false;
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">eeprom_settings_store");
|
2006-08-05 20:19:10 +00:00
|
|
|
eeprom_settings_store();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<eeprom_settings_store");
|
2006-08-05 20:19:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
2004-09-29 21:41:10 +00:00
|
|
|
playlist_init();
|
2007-06-10 10:41:27 +00:00
|
|
|
tree_mem_init();
|
2007-03-29 06:16:00 +00:00
|
|
|
filetype_init();
|
2006-10-19 09:42:58 +00:00
|
|
|
scrobbler_init();
|
2009-06-15 15:46:09 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
tdspeed_init();
|
|
|
|
#endif /* CONFIG_CODEC == SWCODEC */
|
2006-10-19 09:42:58 +00:00
|
|
|
|
2007-03-09 12:30:14 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2003-05-17 20:38:38 +00:00
|
|
|
/* No buffer allocation (see buffer.c) may take place after the call to
|
2005-04-04 12:06:29 +00:00
|
|
|
audio_init() since the mpeg thread takes the rest of the buffer space */
|
2004-01-05 20:42:51 +00:00
|
|
|
mp3_init( global_settings.volume,
|
|
|
|
global_settings.bass,
|
|
|
|
global_settings.treble,
|
|
|
|
global_settings.balance,
|
|
|
|
global_settings.loudness,
|
|
|
|
global_settings.avc,
|
2004-07-06 12:17:14 +00:00
|
|
|
global_settings.channel_config,
|
2005-01-12 00:24:15 +00:00
|
|
|
global_settings.stereo_width,
|
2004-07-06 12:17:14 +00:00
|
|
|
global_settings.mdb_strength,
|
|
|
|
global_settings.mdb_harmonics,
|
|
|
|
global_settings.mdb_center,
|
|
|
|
global_settings.mdb_shape,
|
|
|
|
global_settings.mdb_enable,
|
|
|
|
global_settings.superbass);
|
2006-05-01 12:54:21 +00:00
|
|
|
|
|
|
|
/* audio_init must to know the size of voice buffer so init voice first */
|
|
|
|
talk_init();
|
2007-03-09 12:30:14 +00:00
|
|
|
#endif /* CONFIG_CODEC != SWCODEC */
|
2006-05-01 12:54:21 +00:00
|
|
|
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">audio_init");
|
2005-10-16 08:01:02 +00:00
|
|
|
audio_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<audio_init");
|
2007-03-09 12:30:14 +00:00
|
|
|
|
2006-07-21 08:42:28 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR)
|
2005-11-12 04:00:56 +00:00
|
|
|
pcm_rec_init();
|
2005-06-20 10:04:16 +00:00
|
|
|
#endif
|
2006-05-01 12:54:21 +00:00
|
|
|
|
2005-07-04 22:10:42 +00:00
|
|
|
/* runtime database has to be initialized after audio_init() */
|
2006-12-05 20:20:00 +00:00
|
|
|
cpu_boost(false);
|
2003-05-17 20:38:38 +00:00
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2005-04-06 11:12:22 +00:00
|
|
|
car_adapter_mode_init();
|
|
|
|
#endif
|
2008-12-25 01:46:16 +00:00
|
|
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
|
|
|
iap_setup(global_settings.serial_bitrate);
|
|
|
|
#endif
|
2008-04-20 18:28:25 +00:00
|
|
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
|
|
|
accessory_supply_set(global_settings.accessory_supply);
|
|
|
|
#endif
|
2010-03-20 15:02:29 +00:00
|
|
|
#ifdef HAVE_LINEOUT_POWEROFF
|
|
|
|
lineout_set(global_settings.lineout_active);
|
|
|
|
#endif
|
2009-11-25 22:54:36 +00:00
|
|
|
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<check_bootfile(false)");
|
2009-11-25 22:54:36 +00:00
|
|
|
check_bootfile(false); /* remember write time and filesize */
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">check_bootfile(false)");
|
2009-11-25 22:54:36 +00:00
|
|
|
#endif
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<settings_apply_skins");
|
2010-02-26 08:01:41 +00:00
|
|
|
settings_apply_skins();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">settings_apply_skins");
|
2002-05-17 19:50:37 +00:00
|
|
|
}
|
|
|
|
|
2006-08-03 16:38:06 +00:00
|
|
|
#ifdef CPU_PP
|
2010-06-17 20:15:58 +00:00
|
|
|
void __attribute__((noreturn)) cop_main(void)
|
2006-08-03 16:29:42 +00:00
|
|
|
{
|
|
|
|
/* This is the entry point for the coprocessor
|
|
|
|
Anyone not running an upgraded bootloader will never reach this point,
|
|
|
|
so it should not be assumed that the coprocessor be usable even on
|
|
|
|
platforms which support it.
|
|
|
|
|
2007-09-28 10:20:02 +00:00
|
|
|
A kernel thread is initially setup on the coprocessor and immediately
|
|
|
|
destroyed for purposes of continuity. The cop sits idle until at least
|
|
|
|
one thread exists on it. */
|
2007-02-27 22:55:12 +00:00
|
|
|
|
2007-09-28 10:20:02 +00:00
|
|
|
#if NUM_CORES > 1
|
2007-03-04 20:06:41 +00:00
|
|
|
system_init();
|
|
|
|
kernel_init();
|
2007-09-28 10:20:02 +00:00
|
|
|
/* This should never be reached */
|
|
|
|
#endif
|
|
|
|
while(1) {
|
2008-04-20 17:53:05 +00:00
|
|
|
sleep_core(COP);
|
2006-08-03 16:29:42 +00:00
|
|
|
}
|
|
|
|
}
|
2007-02-27 23:21:38 +00:00
|
|
|
#endif /* CPU_PP */
|
2006-08-03 16:29:42 +00:00
|
|
|
|
2010-06-17 20:15:58 +00:00
|
|
|
#endif /* SIMULATOR */
|