Björn Stenberg | 8218285 | 2002-05-16 12:53:40 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
Nicolas Pennequin | 357ffb3 | 2008-05-05 10:32:46 +0000 | [diff] [blame] | 10 | * Copyright (C) 2002 Björn Stenberg |
Björn Stenberg | 8218285 | 2002-05-16 12:53:40 +0000 | [diff] [blame] | 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Björn Stenberg | 8218285 | 2002-05-16 12:53:40 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
Linus Nielsen Feltzing | 688b4dd | 2004-10-15 02:16:31 +0000 | [diff] [blame] | 21 | #include "config.h" |
| 22 | |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 23 | #include "storage.h" |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 24 | #include "disk.h" |
| 25 | #include "fat.h" |
| 26 | #include "lcd.h" |
Linus Nielsen Feltzing | 9b3a3be | 2002-06-24 13:51:40 +0000 | [diff] [blame] | 27 | #include "rtc.h" |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 28 | #include "debug.h" |
| 29 | #include "led.h" |
| 30 | #include "kernel.h" |
| 31 | #include "button.h" |
Björn Stenberg | 8218285 | 2002-05-16 12:53:40 +0000 | [diff] [blame] | 32 | #include "tree.h" |
Jonathan Gordon | 21165a3 | 2007-03-29 06:16:00 +0000 | [diff] [blame] | 33 | #include "filetypes.h" |
Björn Stenberg | 55c7da2 | 2002-05-21 14:28:10 +0000 | [diff] [blame] | 34 | #include "panic.h" |
| 35 | #include "menu.h" |
Linus Nielsen Feltzing | 0f60775 | 2002-05-29 09:14:38 +0000 | [diff] [blame] | 36 | #include "system.h" |
Linus Nielsen Feltzing | 6c77cc3 | 2002-06-30 13:24:29 +0000 | [diff] [blame] | 37 | #include "usb.h" |
Heikki Hannikainen | 6eb4254 | 2002-08-06 10:52:51 +0000 | [diff] [blame] | 38 | #include "powermgmt.h" |
Linus Nielsen Feltzing | 7d3c31b | 2002-06-30 20:25:37 +0000 | [diff] [blame] | 39 | #include "adc.h" |
Linus Nielsen Feltzing | 6d2e492 | 2002-07-02 21:40:12 +0000 | [diff] [blame] | 40 | #include "i2c.h" |
Björn Stenberg | 18239b8 | 2002-08-12 12:44:18 +0000 | [diff] [blame] | 41 | #ifndef DEBUG |
| 42 | #include "serial.h" |
| 43 | #endif |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 44 | #include "audio.h" |
Jörg Hohensohn | f993365 | 2004-01-05 20:42:51 +0000 | [diff] [blame] | 45 | #include "mp3_playback.h" |
Felix Arends | e096c86 | 2002-06-12 15:31:35 +0000 | [diff] [blame] | 46 | #include "thread.h" |
Linus Nielsen Feltzing | 31e2097 | 2002-06-20 08:59:54 +0000 | [diff] [blame] | 47 | #include "settings.h" |
Linus Nielsen Feltzing | 9b3a3be | 2002-06-24 13:51:40 +0000 | [diff] [blame] | 48 | #include "backlight.h" |
Linus Nielsen Feltzing | 97f94b4 | 2002-07-22 22:44:03 +0000 | [diff] [blame] | 49 | #include "status.h" |
Björn Stenberg | 6b25f79 | 2002-07-15 11:02:12 +0000 | [diff] [blame] | 50 | #include "debug_menu.h" |
Daniel Stenberg | 93b231c | 2002-09-12 13:33:59 +0000 | [diff] [blame] | 51 | #include "font.h" |
Daniel Stenberg | 5b662ff | 2002-09-25 11:42:10 +0000 | [diff] [blame] | 52 | #include "language.h" |
Jonathan Gordon | 3e7444f | 2009-08-03 04:43:34 +0000 | [diff] [blame] | 53 | #include "wps.h" |
Björn Stenberg | 7bb746b | 2003-04-24 17:31:36 +0000 | [diff] [blame] | 54 | #include "playlist.h" |
Linus Nielsen Feltzing | 20d031f | 2003-05-09 16:01:21 +0000 | [diff] [blame] | 55 | #include "buffer.h" |
Jörg Hohensohn | c47f8c0 | 2003-07-03 22:13:39 +0000 | [diff] [blame] | 56 | #include "rolo.h" |
Tomer Shalev | 09de597 | 2009-10-19 21:34:27 +0000 | [diff] [blame] | 57 | #include "screens.h" |
Tomer Shalev | 5d585f4 | 2009-10-19 21:19:30 +0000 | [diff] [blame] | 58 | #include "usb_screen.h" |
Jörg Hohensohn | 5dd17b1 | 2003-07-17 20:29:51 +0000 | [diff] [blame] | 59 | #include "power.h" |
Jörg Hohensohn | 4f36ea8 | 2004-03-14 21:33:53 +0000 | [diff] [blame] | 60 | #include "talk.h" |
Jörg Hohensohn | 6ff6d21 | 2004-06-19 15:50:02 +0000 | [diff] [blame] | 61 | #include "plugin.h" |
Linus Nielsen Feltzing | 3d21781 | 2005-04-06 11:12:22 +0000 | [diff] [blame] | 62 | #include "misc.h" |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 63 | #include "dircache.h" |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 64 | #ifdef HAVE_TAGCACHE |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 65 | #include "tagcache.h" |
Miika Pekkarinen | 4a63c09 | 2006-04-04 19:28:13 +0000 | [diff] [blame] | 66 | #include "tagtree.h" |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 67 | #endif |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 68 | #include "lang.h" |
| 69 | #include "string.h" |
Miika Pekkarinen | a697717 | 2005-12-07 11:20:56 +0000 | [diff] [blame] | 70 | #include "splash.h" |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 71 | #include "eeprom_settings.h" |
Linus Nielsen Feltzing | da153da | 2006-10-19 09:42:58 +0000 | [diff] [blame] | 72 | #include "scrobbler.h" |
Jonathan Gordon | 6a5cc0b | 2007-04-16 09:14:36 +0000 | [diff] [blame] | 73 | #include "icon.h" |
Thomas Martitz | 4c48b59 | 2009-08-16 22:20:11 +0000 | [diff] [blame] | 74 | #include "viewport.h" |
Thomas Martitz | 1016ee4 | 2009-10-19 15:28:15 +0000 | [diff] [blame] | 75 | #include "statusbar-skinned.h" |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 76 | #include "bootchart.h" |
Michiel Van Der Kolk | 451dd48 | 2005-03-28 00:00:24 +0000 | [diff] [blame] | 77 | |
Michael Giacomelli | 70e9c7a | 2008-12-25 01:46:16 +0000 | [diff] [blame] | 78 | #ifdef IPOD_ACCESSORY_PROTOCOL |
| 79 | #include "iap.h" |
| 80 | #endif |
| 81 | |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 82 | #if (CONFIG_CODEC == SWCODEC) |
Miika Pekkarinen | d319116 | 2006-01-27 11:39:46 +0000 | [diff] [blame] | 83 | #include "playback.h" |
Steve Bavin | e8c825f | 2009-06-15 16:03:01 +0000 | [diff] [blame] | 84 | #include "tdspeed.h" |
Henrik Backe | c1a951f | 2005-03-28 13:00:22 +0000 | [diff] [blame] | 85 | #endif |
Linus Nielsen Feltzing | ed4d7a3 | 2006-07-21 08:42:28 +0000 | [diff] [blame] | 86 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) |
Andy | e5d0872 | 2005-06-19 03:05:53 +0000 | [diff] [blame] | 87 | #include "pcm_record.h" |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 88 | #endif |
| 89 | |
| 90 | #ifdef BUTTON_REC |
Marcoen Hirschberg | 810f717 | 2007-04-27 19:24:31 +0000 | [diff] [blame] | 91 | #define SETTINGS_RESET BUTTON_REC |
| 92 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) |
| 93 | #define SETTINGS_RESET BUTTON_A |
Andy | e5d0872 | 2005-06-19 03:05:53 +0000 | [diff] [blame] | 94 | #endif |
Michiel Van Der Kolk | 451dd48 | 2005-03-28 00:00:24 +0000 | [diff] [blame] | 95 | |
Jonathan Gordon | 8ff3a65 | 2007-02-18 02:04:47 +0000 | [diff] [blame] | 96 | #if CONFIG_TUNER |
Jörg Hohensohn | 8f8fbac | 2004-10-15 21:41:46 +0000 | [diff] [blame] | 97 | #include "radio.h" |
Jörg Hohensohn | 4a5df8e | 2004-10-15 22:10:55 +0000 | [diff] [blame] | 98 | #endif |
Frank Gevaerts | 19d1cac | 2008-10-31 21:25:04 +0000 | [diff] [blame] | 99 | #if (CONFIG_STORAGE & STORAGE_MMC) |
Jörg Hohensohn | da84857 | 2004-12-28 22:16:07 +0000 | [diff] [blame] | 100 | #include "ata_mmc.h" |
| 101 | #endif |
Jörg Hohensohn | 6ff6d21 | 2004-06-19 15:50:02 +0000 | [diff] [blame] | 102 | |
Christian Gmeiner | 7c1879b | 2005-04-15 12:08:49 +0000 | [diff] [blame] | 103 | #ifdef HAVE_REMOTE_LCD |
| 104 | #include "lcd-remote.h" |
| 105 | #endif |
| 106 | |
Jonathan Gordon | ac61951 | 2007-02-18 04:57:28 +0000 | [diff] [blame] | 107 | #if CONFIG_USBOTG == USBOTG_ISP1362 |
Jens Arnold | 977169e | 2006-06-16 17:34:18 +0000 | [diff] [blame] | 108 | #include "isp1362.h" |
| 109 | #endif |
| 110 | |
Jonathan Gordon | ac61951 | 2007-02-18 04:57:28 +0000 | [diff] [blame] | 111 | #if CONFIG_USBOTG == USBOTG_M5636 |
Linus Nielsen Feltzing | 5f655c9 | 2006-07-13 07:40:30 +0000 | [diff] [blame] | 112 | #include "m5636.h" |
| 113 | #endif |
| 114 | |
Michael Sevakis | d6af287 | 2007-10-26 23:11:18 +0000 | [diff] [blame] | 115 | #ifdef SIMULATOR |
Jens Arnold | 3e67e3b | 2009-02-20 17:13:08 +0000 | [diff] [blame] | 116 | #include "sim_tasks.h" |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 117 | #endif |
| 118 | #ifdef HAVE_SDL |
Michael Sevakis | d6af287 | 2007-10-26 23:11:18 +0000 | [diff] [blame] | 119 | #include "system-sdl.h" |
| 120 | #endif |
| 121 | |
Jörg Hohensohn | 6ff6d21 | 2004-06-19 15:50:02 +0000 | [diff] [blame] | 122 | /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ |
Björn Stenberg | 18239b8 | 2002-08-12 12:44:18 +0000 | [diff] [blame] | 123 | |
Jens Arnold | 314f3b5 | 2006-12-12 22:22:21 +0000 | [diff] [blame] | 124 | static void init(void); |
Teruaki Kawashima | ed940e8 | 2009-08-27 13:30:26 +0000 | [diff] [blame] | 125 | |
Thomas Martitz | 3d0cee8 | 2010-05-15 21:02:47 +0000 | [diff] [blame] | 126 | #ifdef HAVE_SDL |
| 127 | #if defined(WIN32) && defined(main) |
| 128 | /* Don't use SDL_main on windows -> no more stdio redirection */ |
| 129 | #undef main |
| 130 | #endif |
| 131 | int main(int argc, char *argv[]) |
| 132 | { |
| 133 | sys_handle_argv(argc, argv); |
Jens Arnold | 314f3b5 | 2006-12-12 22:22:21 +0000 | [diff] [blame] | 134 | #else |
Thomas Martitz | a62eced | 2010-03-04 17:44:57 +0000 | [diff] [blame] | 135 | /* main(), and various functions called by main() and init() may be |
| 136 | * be INIT_ATTR. These functions must not be called after the final call |
| 137 | * to root_menu() at the end of main() |
| 138 | * see definition of INIT_ATTR in config.h */ |
Thomas Martitz | f8edc32 | 2010-03-03 23:20:32 +0000 | [diff] [blame] | 139 | int main(void) INIT_ATTR __attribute__((noreturn)); |
Rafaël Carré | bb9808b | 2009-11-03 12:20:54 +0000 | [diff] [blame] | 140 | int main(void) |
Björn Stenberg | 55c7da2 | 2002-05-21 14:28:10 +0000 | [diff] [blame] | 141 | { |
Thomas Martitz | 3d0cee8 | 2010-05-15 21:02:47 +0000 | [diff] [blame] | 142 | #endif |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 143 | int i; |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 144 | CHART(">init"); |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 145 | init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 146 | CHART("<init"); |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 147 | FOR_NB_SCREENS(i) |
| 148 | { |
| 149 | screens[i].clear_display(); |
| 150 | screens[i].update(); |
| 151 | } |
Thomas Martitz | 2eb1cb6 | 2009-09-07 17:37:06 +0000 | [diff] [blame] | 152 | #ifdef HAVE_LCD_BITMAP |
| 153 | list_init(); |
| 154 | #endif |
Jonathan Gordon | 2cda994 | 2007-06-10 10:41:27 +0000 | [diff] [blame] | 155 | tree_gui_init(); |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 156 | /* Keep the order of this 3 |
| 157 | * Must be done before any code uses the multi-screen API */ |
Frank Gevaerts | c483efa | 2009-05-21 19:01:07 +0000 | [diff] [blame] | 158 | #ifdef HAVE_USBSTACK |
| 159 | /* All threads should be created and public queues registered by now */ |
| 160 | usb_start_monitoring(); |
| 161 | #endif |
Teruaki Kawashima | ed940e8 | 2009-08-27 13:30:26 +0000 | [diff] [blame] | 162 | |
| 163 | #ifdef AUTOROCK |
| 164 | { |
| 165 | static const char filename[] = PLUGIN_APPS_DIR "/autostart.rock"; |
| 166 | |
| 167 | if(file_exists(filename)) /* no complaint if it doesn't exist */ |
| 168 | { |
| 169 | plugin_load((char*)filename, NULL); /* start if it does */ |
| 170 | } |
| 171 | } |
| 172 | #endif /* #ifdef AUTOROCK */ |
| 173 | |
Jonathan Gordon | 235d1ae | 2009-11-01 02:36:51 +0000 | [diff] [blame] | 174 | global_status.last_volume_change = 0; |
Thomas Martitz | a62eced | 2010-03-04 17:44:57 +0000 | [diff] [blame] | 175 | /* no calls INIT_ATTR functions after this point anymore! |
| 176 | * see definition of INIT_ATTR in config.h */ |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 177 | CHART(">root_menu"); |
Jonathan Gordon | 2cda994 | 2007-06-10 10:41:27 +0000 | [diff] [blame] | 178 | root_menu(); |
Björn Stenberg | 55c7da2 | 2002-05-21 14:28:10 +0000 | [diff] [blame] | 179 | } |
| 180 | |
Thomas Martitz | f8edc32 | 2010-03-03 23:20:32 +0000 | [diff] [blame] | 181 | static int init_dircache(bool preinit) INIT_ATTR; |
Jens Arnold | 314f3b5 | 2006-12-12 22:22:21 +0000 | [diff] [blame] | 182 | static int init_dircache(bool preinit) |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 183 | { |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 184 | #ifdef HAVE_DIRCACHE |
| 185 | int result = 0; |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 186 | bool clear = false; |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 187 | |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 188 | if (preinit) |
| 189 | dircache_init(); |
Jens Arnold | 8c6920e | 2008-03-08 23:50:55 +0000 | [diff] [blame] | 190 | |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 191 | if (!global_settings.dircache) |
| 192 | return 0; |
Jens Arnold | 8c6920e | 2008-03-08 23:50:55 +0000 | [diff] [blame] | 193 | |
Peter D'Hoye | c4a59a2 | 2006-08-15 22:54:06 +0000 | [diff] [blame] | 194 | # ifdef HAVE_EEPROM_SETTINGS |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 195 | if (firmware_settings.initialized && firmware_settings.disk_clean |
| 196 | && preinit) |
| 197 | { |
| 198 | result = dircache_load(); |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 199 | |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 200 | if (result < 0) |
| 201 | { |
| 202 | firmware_settings.disk_clean = false; |
Jonathan Gordon | 228d62d | 2007-01-24 02:19:22 +0000 | [diff] [blame] | 203 | if (global_status.dircache_size <= 0) |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 204 | { |
| 205 | /* This will be in default language, settings are not |
| 206 | applied yet. Not really any easy way to fix that. */ |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 207 | splash(0, str(LANG_SCANNING_DISK)); |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 208 | clear = true; |
| 209 | } |
| 210 | |
Jonathan Gordon | 228d62d | 2007-01-24 02:19:22 +0000 | [diff] [blame] | 211 | dircache_build(global_status.dircache_size); |
Miika Pekkarinen | 196b770 | 2006-05-27 11:21:08 +0000 | [diff] [blame] | 212 | } |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 213 | } |
| 214 | else |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 215 | # endif |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 216 | { |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 217 | if (preinit) |
| 218 | return -1; |
| 219 | |
| 220 | if (!dircache_is_enabled() |
| 221 | && !dircache_is_initializing()) |
| 222 | { |
Jonathan Gordon | 228d62d | 2007-01-24 02:19:22 +0000 | [diff] [blame] | 223 | if (global_status.dircache_size <= 0) |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 224 | { |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 225 | splash(0, str(LANG_SCANNING_DISK)); |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 226 | clear = true; |
| 227 | } |
Jonathan Gordon | 228d62d | 2007-01-24 02:19:22 +0000 | [diff] [blame] | 228 | result = dircache_build(global_status.dircache_size); |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | if (result < 0) |
Miika Pekkarinen | 7b1e827 | 2007-04-07 17:48:51 +0000 | [diff] [blame] | 232 | { |
| 233 | /* Initialization of dircache failed. Manual action is |
| 234 | * necessary to enable dircache again. |
| 235 | */ |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 236 | splashf(0, "Dircache failed, disabled. Result: %d", result); |
Miika Pekkarinen | 7b1e827 | 2007-04-07 17:48:51 +0000 | [diff] [blame] | 237 | global_settings.dircache = false; |
| 238 | } |
Miika Pekkarinen | c8a9ca7 | 2006-12-22 09:11:09 +0000 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | if (clear) |
| 242 | { |
| 243 | backlight_on(); |
| 244 | show_logo(); |
Jonathan Gordon | 228d62d | 2007-01-24 02:19:22 +0000 | [diff] [blame] | 245 | global_status.dircache_size = dircache_get_cache_size(); |
| 246 | status_save(); |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 247 | } |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 248 | |
| 249 | return result; |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 250 | #else |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 251 | (void)preinit; |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 252 | return 0; |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 253 | #endif |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 254 | } |
Miika Pekkarinen | ab78b04 | 2005-10-07 17:38:05 +0000 | [diff] [blame] | 255 | |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 256 | #ifdef HAVE_TAGCACHE |
Thomas Martitz | f8edc32 | 2010-03-03 23:20:32 +0000 | [diff] [blame] | 257 | static void init_tagcache(void) INIT_ATTR; |
Jens Arnold | 314f3b5 | 2006-12-12 22:22:21 +0000 | [diff] [blame] | 258 | static void init_tagcache(void) |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 259 | { |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 260 | bool clear = false; |
Nils Wallménius | 18cf68e | 2009-10-25 10:20:15 +0000 | [diff] [blame] | 261 | #if CONFIG_CODEC == SWCODEC |
| 262 | long talked_tick = 0; |
| 263 | #endif |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 264 | tagcache_init(); |
Miika Pekkarinen | 1b18dd0 | 2006-04-12 10:31:24 +0000 | [diff] [blame] | 265 | |
| 266 | while (!tagcache_is_initialized()) |
| 267 | { |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 268 | int ret = tagcache_get_commit_step(); |
| 269 | |
Miika Pekkarinen | 1b18dd0 | 2006-04-12 10:31:24 +0000 | [diff] [blame] | 270 | if (ret > 0) |
| 271 | { |
Jens Arnold | 916a563 | 2007-08-28 18:08:48 +0000 | [diff] [blame] | 272 | #if CONFIG_CODEC == SWCODEC |
| 273 | /* hwcodec can't use voice here, as the database commit |
| 274 | * uses the audio buffer. */ |
Steve Bavin | 32a9575 | 2007-10-19 15:31:42 +0000 | [diff] [blame] | 275 | if(global_settings.talk_menu |
Nils Wallménius | 5b76936 | 2007-08-06 13:08:36 +0000 | [diff] [blame] | 276 | && (talked_tick == 0 |
| 277 | || TIME_AFTER(current_tick, talked_tick+7*HZ))) |
| 278 | { |
| 279 | talked_tick = current_tick; |
| 280 | talk_id(LANG_TAGCACHE_INIT, false); |
| 281 | talk_number(ret, true); |
| 282 | talk_id(VOICE_OF, true); |
| 283 | talk_number(tagcache_get_max_commit_step(), true); |
| 284 | } |
Jens Arnold | 916a563 | 2007-08-28 18:08:48 +0000 | [diff] [blame] | 285 | #endif |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 286 | #ifdef HAVE_LCD_BITMAP |
Tomer Shalev | d7cdd08 | 2009-10-08 22:40:38 +0000 | [diff] [blame] | 287 | if (lang_is_rtl()) |
| 288 | { |
| 289 | splashf(0, "[%d/%d] %s", ret, tagcache_get_max_commit_step(), |
| 290 | str(LANG_TAGCACHE_INIT)); |
| 291 | } |
| 292 | else |
| 293 | { |
| 294 | splashf(0, "%s [%d/%d]", str(LANG_TAGCACHE_INIT), ret, |
| 295 | tagcache_get_max_commit_step()); |
| 296 | } |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 297 | #else |
| 298 | lcd_double_height(false); |
Nils Wallménius | f34a841 | 2009-10-17 18:02:48 +0000 | [diff] [blame] | 299 | lcd_putsf(0, 1, " DB [%d/%d]", ret, |
Steve Bavin | 8137489 | 2007-03-07 19:56:15 +0000 | [diff] [blame] | 300 | tagcache_get_max_commit_step()); |
Jens Arnold | 900ced2 | 2007-05-17 06:37:25 +0000 | [diff] [blame] | 301 | lcd_update(); |
Miika Pekkarinen | 1b18dd0 | 2006-04-12 10:31:24 +0000 | [diff] [blame] | 302 | #endif |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 303 | clear = true; |
| 304 | } |
Miika Pekkarinen | 1b18dd0 | 2006-04-12 10:31:24 +0000 | [diff] [blame] | 305 | sleep(HZ/4); |
| 306 | } |
Miika Pekkarinen | 4a63c09 | 2006-04-04 19:28:13 +0000 | [diff] [blame] | 307 | tagtree_init(); |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 308 | |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 309 | if (clear) |
Miika Pekkarinen | 196b770 | 2006-05-27 11:21:08 +0000 | [diff] [blame] | 310 | { |
| 311 | backlight_on(); |
Jens Arnold | b09df80 | 2006-05-24 07:31:23 +0000 | [diff] [blame] | 312 | show_logo(); |
Miika Pekkarinen | 196b770 | 2006-05-27 11:21:08 +0000 | [diff] [blame] | 313 | } |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 314 | } |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 315 | #endif |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 316 | |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 317 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 318 | |
Jens Arnold | 314f3b5 | 2006-12-12 22:22:21 +0000 | [diff] [blame] | 319 | static void init(void) |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 320 | { |
Thomas Martitz | 3d0cee8 | 2010-05-15 21:02:47 +0000 | [diff] [blame] | 321 | system_init(); |
Michael Sevakis | 27cf677 | 2008-03-25 02:34:12 +0000 | [diff] [blame] | 322 | kernel_init(); |
Linus Nielsen Feltzing | 20d031f | 2003-05-09 16:01:21 +0000 | [diff] [blame] | 323 | buffer_init(); |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 324 | enable_irq(); |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 325 | lcd_init(); |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 326 | #ifdef HAVE_REMOTE_LCD |
| 327 | lcd_remote_init(); |
| 328 | #endif |
Kjell Ericson | fd9f864 | 2002-10-28 19:52:22 +0000 | [diff] [blame] | 329 | font_init(); |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 330 | show_logo(); |
Jens Arnold | b51f7df | 2005-11-21 23:55:39 +0000 | [diff] [blame] | 331 | button_init(); |
| 332 | backlight_init(); |
Jens Arnold | 3e67e3b | 2009-02-20 17:13:08 +0000 | [diff] [blame] | 333 | sim_tasks_init(); |
Tom Ross | ec2737b | 2009-10-18 00:56:42 +0000 | [diff] [blame] | 334 | lang_init(core_language_builtin, language_strings, |
| 335 | LANG_LAST_INDEX_IN_ARRAY); |
Jens Arnold | 2fd7c3c | 2007-04-19 20:17:24 +0000 | [diff] [blame] | 336 | #ifdef DEBUG |
| 337 | debug_init(); |
| 338 | #endif |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 339 | /* Keep the order of this 3 (viewportmanager handles statusbars) |
| 340 | * Must be done before any code uses the multi-screen API */ |
Jens Arnold | baef536 | 2009-10-03 22:09:27 +0000 | [diff] [blame] | 341 | gui_syncstatusbar_init(&statusbars); |
Thomas Martitz | ed6c143 | 2010-03-04 01:04:43 +0000 | [diff] [blame] | 342 | gui_sync_wps_init(); |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 343 | sb_skin_init(); |
| 344 | viewportmanager_init(); |
| 345 | |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 346 | storage_init(); |
Björn Stenberg | 6b25f79 | 2002-07-15 11:02:12 +0000 | [diff] [blame] | 347 | settings_reset(); |
Jörg Hohensohn | 6ff6d21 | 2004-06-19 15:50:02 +0000 | [diff] [blame] | 348 | settings_load(SETTINGS_ALL); |
Jonathan Gordon | 792f733 | 2010-03-07 03:20:34 +0000 | [diff] [blame] | 349 | settings_apply(true); |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 350 | init_dircache(true); |
| 351 | init_dircache(false); |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 352 | #ifdef HAVE_TAGCACHE |
Miika Pekkarinen | 7c4e0c8 | 2006-03-26 11:33:42 +0000 | [diff] [blame] | 353 | init_tagcache(); |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 354 | #endif |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 355 | sleep(HZ/2); |
Jonathan Gordon | 2cda994 | 2007-06-10 10:41:27 +0000 | [diff] [blame] | 356 | tree_mem_init(); |
Jonathan Gordon | 21165a3 | 2007-03-29 06:16:00 +0000 | [diff] [blame] | 357 | filetype_init(); |
Linus Nielsen Feltzing | fe6cf2d | 2003-05-17 22:25:52 +0000 | [diff] [blame] | 358 | playlist_init(); |
Michael Sevakis | 98cd3e8 | 2007-03-09 12:30:14 +0000 | [diff] [blame] | 359 | |
| 360 | #if CONFIG_CODEC != SWCODEC |
Jörg Hohensohn | f993365 | 2004-01-05 20:42:51 +0000 | [diff] [blame] | 361 | mp3_init( global_settings.volume, |
| 362 | global_settings.bass, |
| 363 | global_settings.treble, |
| 364 | global_settings.balance, |
| 365 | global_settings.loudness, |
Jörg Hohensohn | f993365 | 2004-01-05 20:42:51 +0000 | [diff] [blame] | 366 | global_settings.avc, |
Linus Nielsen Feltzing | 7bade1a | 2004-07-06 12:17:14 +0000 | [diff] [blame] | 367 | global_settings.channel_config, |
Jens Arnold | 76b257f | 2005-01-12 00:24:15 +0000 | [diff] [blame] | 368 | global_settings.stereo_width, |
Linus Nielsen Feltzing | 7bade1a | 2004-07-06 12:17:14 +0000 | [diff] [blame] | 369 | global_settings.mdb_strength, |
| 370 | global_settings.mdb_harmonics, |
| 371 | global_settings.mdb_center, |
| 372 | global_settings.mdb_shape, |
| 373 | global_settings.mdb_enable, |
| 374 | global_settings.superbass); |
Peter D'Hoye | 6488177 | 2006-05-01 12:54:21 +0000 | [diff] [blame] | 375 | |
Michael Sevakis | 98cd3e8 | 2007-03-09 12:30:14 +0000 | [diff] [blame] | 376 | /* audio_init must to know the size of voice buffer so init voice first */ |
| 377 | talk_init(); |
| 378 | #endif /* CONFIG_CODEC != SWCODEC */ |
| 379 | |
Linus Nielsen Feltzing | da153da | 2006-10-19 09:42:58 +0000 | [diff] [blame] | 380 | scrobbler_init(); |
Steve Bavin | 77f6f4c | 2009-06-15 15:46:09 +0000 | [diff] [blame] | 381 | #if CONFIG_CODEC == SWCODEC |
| 382 | tdspeed_init(); |
| 383 | #endif /* CONFIG_CODEC == SWCODEC */ |
Nicolas Pennequin | 9f4bd87 | 2007-02-14 14:40:24 +0000 | [diff] [blame] | 384 | |
Peter D'Hoye | 6488177 | 2006-05-01 12:54:21 +0000 | [diff] [blame] | 385 | audio_init(); |
| 386 | button_clear_queue(); /* Empty the keyboard buffer */ |
Jonathan Gordon | b2eb44c | 2009-12-09 07:25:46 +0000 | [diff] [blame] | 387 | |
Jonathan Gordon | 4c6b355 | 2010-02-26 08:01:41 +0000 | [diff] [blame] | 388 | settings_apply_skins(); |
Björn Stenberg | ad9829a | 2002-06-10 12:42:23 +0000 | [diff] [blame] | 389 | } |
| 390 | |
| 391 | #else |
Björn Stenberg | 88f7fb0 | 2002-05-24 15:40:14 +0000 | [diff] [blame] | 392 | |
Thomas Martitz | f8edc32 | 2010-03-03 23:20:32 +0000 | [diff] [blame] | 393 | static void init(void) INIT_ATTR; |
Jens Arnold | 314f3b5 | 2006-12-12 22:22:21 +0000 | [diff] [blame] | 394 | static void init(void) |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 395 | { |
Jörg Hohensohn | 7ee03d0 | 2004-12-29 22:33:32 +0000 | [diff] [blame] | 396 | int rc; |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 397 | bool mounted = false; |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 398 | #if CONFIG_CHARGING && (CONFIG_CPU == SH7034) |
Jörg Hohensohn | 5dd17b1 | 2003-07-17 20:29:51 +0000 | [diff] [blame] | 399 | /* if nobody initialized ATA before, I consider this a cold start */ |
| 400 | bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */ |
Daniel Stenberg | 8ef88a1 | 2005-02-03 08:36:43 +0000 | [diff] [blame] | 401 | #endif |
Michael Sevakis | 7914e90 | 2007-09-28 10:20:02 +0000 | [diff] [blame] | 402 | |
Linus Nielsen Feltzing | 0f60775 | 2002-05-29 09:14:38 +0000 | [diff] [blame] | 403 | system_init(); |
Linus Nielsen Feltzing | 8c00b4c | 2002-06-10 14:44:15 +0000 | [diff] [blame] | 404 | kernel_init(); |
Linus Nielsen Feltzing | 31e2097 | 2002-06-20 08:59:54 +0000 | [diff] [blame] | 405 | |
Linus Nielsen Feltzing | e7b993f | 2005-03-18 11:38:15 +0000 | [diff] [blame] | 406 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
| 407 | set_cpu_frequency(CPUFREQ_NORMAL); |
Michael Sevakis | 0f5cb94 | 2006-11-06 18:07:30 +0000 | [diff] [blame] | 408 | #ifdef CPU_COLDFIRE |
| 409 | coldfire_set_pllcr_audio_bits(DEFAULT_PLLCR_AUDIO_BITS); |
| 410 | #endif |
Miika Pekkarinen | 86d0d91 | 2006-12-05 20:20:00 +0000 | [diff] [blame] | 411 | cpu_boost(true); |
Linus Nielsen Feltzing | e7b993f | 2005-03-18 11:38:15 +0000 | [diff] [blame] | 412 | #endif |
| 413 | |
Linus Nielsen Feltzing | 20d031f | 2003-05-09 16:01:21 +0000 | [diff] [blame] | 414 | buffer_init(); |
| 415 | |
Björn Stenberg | 6b25f79 | 2002-07-15 11:02:12 +0000 | [diff] [blame] | 416 | settings_reset(); |
Linus Nielsen Feltzing | e16ebf1 | 2005-11-18 14:55:51 +0000 | [diff] [blame] | 417 | |
Michael Giacomelli | 054447f | 2008-02-10 05:39:20 +0000 | [diff] [blame] | 418 | i2c_init(); |
| 419 | |
Linus Nielsen Feltzing | e16ebf1 | 2005-11-18 14:55:51 +0000 | [diff] [blame] | 420 | power_init(); |
| 421 | |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 422 | enable_irq(); |
Michael Sevakis | 6077e5b | 2007-10-06 22:27:27 +0000 | [diff] [blame] | 423 | #ifdef CPU_ARM |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 424 | enable_fiq(); |
Michael Sevakis | 6077e5b | 2007-10-06 22:27:27 +0000 | [diff] [blame] | 425 | #endif |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 426 | /* current_tick should be ticking by now */ |
| 427 | CHART("ticking"); |
| 428 | |
Björn Stenberg | 4afa709 | 2002-05-30 12:17:18 +0000 | [diff] [blame] | 429 | lcd_init(); |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 430 | #ifdef HAVE_REMOTE_LCD |
Christian Gmeiner | 7c1879b | 2005-04-15 12:08:49 +0000 | [diff] [blame] | 431 | lcd_remote_init(); |
| 432 | #endif |
Björn Stenberg | bed3d3f | 2002-09-20 08:07:51 +0000 | [diff] [blame] | 433 | font_init(); |
Karl Kurbjun | 8a1fd8c | 2007-04-21 04:48:20 +0000 | [diff] [blame] | 434 | |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 435 | CHART(">show_logo"); |
Linus Nielsen Feltzing | 219944f | 2005-11-08 23:51:36 +0000 | [diff] [blame] | 436 | show_logo(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 437 | CHART("<show_logo"); |
Tom Ross | ec2737b | 2009-10-18 00:56:42 +0000 | [diff] [blame] | 438 | lang_init(core_language_builtin, language_strings, |
| 439 | LANG_LAST_INDEX_IN_ARRAY); |
Daniel Stenberg | 75e09a8 | 2002-06-11 08:24:33 +0000 | [diff] [blame] | 440 | |
Björn Stenberg | f43b27a | 2002-05-27 09:53:28 +0000 | [diff] [blame] | 441 | #ifdef DEBUG |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 442 | debug_init(); |
Björn Stenberg | 18239b8 | 2002-08-12 12:44:18 +0000 | [diff] [blame] | 443 | #else |
Bertrik Sikken | 3c7e299 | 2009-02-07 11:15:30 +0000 | [diff] [blame] | 444 | #ifdef HAVE_SERIAL |
Björn Stenberg | 18239b8 | 2002-08-12 12:44:18 +0000 | [diff] [blame] | 445 | serial_setup(); |
Björn Stenberg | f43b27a | 2002-05-27 09:53:28 +0000 | [diff] [blame] | 446 | #endif |
Jens Arnold | 2d875f8 | 2004-09-20 22:15:35 +0000 | [diff] [blame] | 447 | #endif |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 448 | |
Jens Arnold | 2c7b127 | 2007-03-16 23:47:03 +0000 | [diff] [blame] | 449 | #if CONFIG_RTC |
Linus Nielsen Feltzing | 76759e0 | 2002-08-06 08:14:08 +0000 | [diff] [blame] | 450 | rtc_init(); |
Dave Chapman | 5009c9c | 2005-12-04 13:05:56 +0000 | [diff] [blame] | 451 | #endif |
| 452 | #ifdef HAVE_RTC_RAM |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 453 | CHART(">settings_load(RTC)"); |
Jörg Hohensohn | 6ff6d21 | 2004-06-19 15:50:02 +0000 | [diff] [blame] | 454 | settings_load(SETTINGS_RTC); /* early load parts of global_settings */ |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 455 | CHART("<settings_load(RTC)"); |
Linus Nielsen Feltzing | 76759e0 | 2002-08-06 08:14:08 +0000 | [diff] [blame] | 456 | #endif |
| 457 | |
Linus Nielsen Feltzing | 7d3c31b | 2002-06-30 20:25:37 +0000 | [diff] [blame] | 458 | adc_init(); |
Christian Gmeiner | 8181a0c | 2007-08-27 16:04:32 +0000 | [diff] [blame] | 459 | |
Linus Nielsen Feltzing | 219944f | 2005-11-08 23:51:36 +0000 | [diff] [blame] | 460 | usb_init(); |
Jonathan Gordon | ac61951 | 2007-02-18 04:57:28 +0000 | [diff] [blame] | 461 | #if CONFIG_USBOTG == USBOTG_ISP1362 |
Jens Arnold | 977169e | 2006-06-16 17:34:18 +0000 | [diff] [blame] | 462 | isp1362_init(); |
Jonathan Gordon | ac61951 | 2007-02-18 04:57:28 +0000 | [diff] [blame] | 463 | #elif CONFIG_USBOTG == USBOTG_M5636 |
Linus Nielsen Feltzing | 5f655c9 | 2006-07-13 07:40:30 +0000 | [diff] [blame] | 464 | m5636_init(); |
Jens Arnold | 977169e | 2006-06-16 17:34:18 +0000 | [diff] [blame] | 465 | #endif |
Linus Nielsen Feltzing | e16ebf1 | 2005-11-18 14:55:51 +0000 | [diff] [blame] | 466 | |
Linus Nielsen Feltzing | a844a18 | 2007-03-07 14:49:20 +0000 | [diff] [blame] | 467 | backlight_init(); |
| 468 | |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 469 | button_init(); |
Linus Nielsen Feltzing | 4b54559 | 2002-07-02 17:59:10 +0000 | [diff] [blame] | 470 | |
Linus Nielsen Feltzing | 219944f | 2005-11-08 23:51:36 +0000 | [diff] [blame] | 471 | powermgmt_init(); |
Peter D'Hoye | 3c1e9ca | 2008-09-07 20:09:11 +0000 | [diff] [blame] | 472 | |
Jonathan Gordon | 8ff3a65 | 2007-02-18 02:04:47 +0000 | [diff] [blame] | 473 | #if CONFIG_TUNER |
Linus Nielsen Feltzing | 219944f | 2005-11-08 23:51:36 +0000 | [diff] [blame] | 474 | radio_init(); |
Jörg Hohensohn | ef8d508 | 2004-10-19 08:20:38 +0000 | [diff] [blame] | 475 | #endif |
| 476 | |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 477 | /* Keep the order of this 3 (viewportmanager handles statusbars) |
| 478 | * Must be done before any code uses the multi-screen API */ |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 479 | CHART(">gui_syncstatusbar_init"); |
Jens Arnold | baef536 | 2009-10-03 22:09:27 +0000 | [diff] [blame] | 480 | gui_syncstatusbar_init(&statusbars); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 481 | CHART("<gui_syncstatusbar_init"); |
| 482 | CHART(">sb_skin_init"); |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 483 | sb_skin_init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 484 | CHART("<sb_skin_init"); |
| 485 | CHART(">gui_sync_wps_init"); |
Thomas Martitz | ed6c143 | 2010-03-04 01:04:43 +0000 | [diff] [blame] | 486 | gui_sync_wps_init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 487 | CHART("<gui_sync_wps_init"); |
| 488 | CHART(">viewportmanager_init"); |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 489 | viewportmanager_init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 490 | CHART("<viewportmanager_init"); |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 491 | |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 492 | #if CONFIG_CHARGING && (CONFIG_CPU == SH7034) |
Boris Gjenero | 02b9c65 | 2009-04-06 01:47:28 +0000 | [diff] [blame] | 493 | /* charger_inserted() can't be used here because power_thread() |
| 494 | hasn't checked power_input_status() yet */ |
| 495 | if (coldstart && (power_input_status() & POWER_INPUT_MAIN_CHARGER) |
Jens Arnold | 7197edd | 2004-12-16 22:31:26 +0000 | [diff] [blame] | 496 | && !global_settings.car_adapter_mode |
| 497 | #ifdef ATA_POWER_PLAYERSTYLE |
| 498 | && !ide_powered() /* relies on probing result from bootloader */ |
| 499 | #endif |
| 500 | ) |
Jörg Hohensohn | 5dd17b1 | 2003-07-17 20:29:51 +0000 | [diff] [blame] | 501 | { |
| 502 | rc = charging_screen(); /* display a "charging" screen */ |
Jens Arnold | 7c7dd43 | 2005-07-11 19:14:26 +0000 | [diff] [blame] | 503 | if (rc == 1) /* charger removed */ |
Jörg Hohensohn | 5dd17b1 | 2003-07-17 20:29:51 +0000 | [diff] [blame] | 504 | power_off(); |
| 505 | /* "On" pressed or USB connected: proceed */ |
Jens Arnold | 67b17e1 | 2004-11-21 09:29:51 +0000 | [diff] [blame] | 506 | show_logo(); /* again, to provide better visual feedback */ |
Jörg Hohensohn | 5dd17b1 | 2003-07-17 20:29:51 +0000 | [diff] [blame] | 507 | } |
Daniel Stenberg | 8e43ccb | 2003-12-12 13:34:27 +0000 | [diff] [blame] | 508 | #endif |
Jörg Hohensohn | c47f8c0 | 2003-07-03 22:13:39 +0000 | [diff] [blame] | 509 | |
Frank Gevaerts | 9c43b2c | 2010-06-06 13:20:47 +0000 | [diff] [blame] | 510 | |
| 511 | disk_init_subsystem(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 512 | CHART(">storage_init"); |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 513 | rc = storage_init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 514 | CHART("<storage_init"); |
Linus Nielsen Feltzing | 71ef31a | 2002-07-02 18:01:31 +0000 | [diff] [blame] | 515 | if(rc) |
Linus Nielsen Feltzing | 4b54559 | 2002-07-02 17:59:10 +0000 | [diff] [blame] | 516 | { |
Björn Stenberg | b47e64e | 2002-08-08 20:44:25 +0000 | [diff] [blame] | 517 | #ifdef HAVE_LCD_BITMAP |
Linus Nielsen Feltzing | 4b54559 | 2002-07-02 17:59:10 +0000 | [diff] [blame] | 518 | lcd_clear_display(); |
Nils Wallménius | f34a841 | 2009-10-17 18:02:48 +0000 | [diff] [blame] | 519 | lcd_putsf(0, 1, "ATA error: %d", rc); |
Linus Nielsen Feltzing | 4b54559 | 2002-07-02 17:59:10 +0000 | [diff] [blame] | 520 | lcd_puts(0, 3, "Press ON to debug"); |
| 521 | lcd_update(); |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 522 | while(!(button_get(true) & BUTTON_REL)); /*DO NOT CHANGE TO ACTION SYSTEM */ |
Linus Nielsen Feltzing | 4b54559 | 2002-07-02 17:59:10 +0000 | [diff] [blame] | 523 | dbg_ports(); |
| 524 | #endif |
| 525 | panicf("ata: %d", rc); |
| 526 | } |
Jens Arnold | 2d875f8 | 2004-09-20 22:15:35 +0000 | [diff] [blame] | 527 | |
Peter D'Hoye | c4a59a2 | 2006-08-15 22:54:06 +0000 | [diff] [blame] | 528 | #ifdef HAVE_EEPROM_SETTINGS |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 529 | CHART(">eeprom_settings_init"); |
Miika Pekkarinen | 3b52bb9 | 2006-08-11 10:13:16 +0000 | [diff] [blame] | 530 | eeprom_settings_init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 531 | CHART("<eeprom_settings_init"); |
Miika Pekkarinen | 3b52bb9 | 2006-08-11 10:13:16 +0000 | [diff] [blame] | 532 | #endif |
Peter D'Hoye | 3c1e9ca | 2008-09-07 20:09:11 +0000 | [diff] [blame] | 533 | |
Frank Gevaerts | c483efa | 2009-05-21 19:01:07 +0000 | [diff] [blame] | 534 | #ifndef HAVE_USBSTACK |
Michael Sevakis | da76a34 | 2009-01-22 22:05:04 +0000 | [diff] [blame] | 535 | usb_start_monitoring(); |
Dave Chapman | 1672350 | 2007-09-04 08:03:07 +0000 | [diff] [blame] | 536 | while (usb_detect() == USB_INSERTED) |
Peter D'Hoye | 3c1e9ca | 2008-09-07 20:09:11 +0000 | [diff] [blame] | 537 | { |
Peter D'Hoye | c4a59a2 | 2006-08-15 22:54:06 +0000 | [diff] [blame] | 538 | #ifdef HAVE_EEPROM_SETTINGS |
Miika Pekkarinen | 3b52bb9 | 2006-08-11 10:13:16 +0000 | [diff] [blame] | 539 | firmware_settings.disk_clean = false; |
| 540 | #endif |
| 541 | /* enter USB mode early, before trying to mount */ |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 542 | if (button_get_w_tmo(HZ/10) == SYS_USB_CONNECTED) |
Frank Gevaerts | 19d1cac | 2008-10-31 21:25:04 +0000 | [diff] [blame] | 543 | #if (CONFIG_STORAGE & STORAGE_MMC) |
Michael Sevakis | 1167e3c | 2007-06-30 02:08:27 +0000 | [diff] [blame] | 544 | if (!mmc_touched() || |
| 545 | (mmc_remove_request() == SYS_HOTSWAP_EXTRACTED)) |
Linus Nielsen Feltzing | 15124aa | 2004-07-05 22:13:20 +0000 | [diff] [blame] | 546 | #endif |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 547 | { |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 548 | gui_usb_screen_run(); |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 549 | mounted = true; /* mounting done @ end of USB mode */ |
| 550 | } |
Jens Arnold | 97a8049 | 2005-06-23 02:18:29 +0000 | [diff] [blame] | 551 | #ifdef HAVE_USB_POWER |
| 552 | if (usb_powered()) /* avoid deadlock */ |
| 553 | break; |
| 554 | #endif |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 555 | } |
Frank Gevaerts | 6f05899 | 2008-03-10 19:11:37 +0000 | [diff] [blame] | 556 | #endif |
Linus Nielsen Feltzing | 55e9670 | 2005-12-06 10:06:40 +0000 | [diff] [blame] | 557 | |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 558 | if (!mounted) |
| 559 | { |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 560 | CHART(">disk_mount_all"); |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 561 | rc = disk_mount_all(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 562 | CHART("<disk_mount_all"); |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 563 | if (rc<=0) |
| 564 | { |
| 565 | lcd_clear_display(); |
| 566 | lcd_puts(0, 0, "No partition"); |
| 567 | lcd_puts(0, 1, "found."); |
| 568 | #ifdef HAVE_LCD_BITMAP |
| 569 | lcd_puts(0, 2, "Insert USB cable"); |
| 570 | lcd_puts(0, 3, "and fix it."); |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 571 | #endif |
Jens Arnold | f9b90e9 | 2007-04-06 22:55:00 +0000 | [diff] [blame] | 572 | lcd_update(); |
| 573 | |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 574 | while(button_get(true) != SYS_USB_CONNECTED) {}; |
Thomas Martitz | c5b4482 | 2009-11-10 20:13:24 +0000 | [diff] [blame] | 575 | gui_usb_screen_run(); |
Jens Arnold | 27abc2a | 2005-05-17 22:10:51 +0000 | [diff] [blame] | 576 | system_reboot(); |
| 577 | } |
Linus Nielsen Feltzing | 15124aa | 2004-07-05 22:13:20 +0000 | [diff] [blame] | 578 | } |
Björn Stenberg | de943a5 | 2002-07-15 15:06:45 +0000 | [diff] [blame] | 579 | |
Marcoen Hirschberg | d2d695f | 2006-12-31 02:02:03 +0000 | [diff] [blame] | 580 | #if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
Marcoen Hirschberg | 810f717 | 2007-04-27 19:24:31 +0000 | [diff] [blame] | 581 | (CONFIG_KEYPAD == IRIVER_H10_PAD) |
Miika Pekkarinen | 8e8c1a8 | 2005-12-07 12:35:54 +0000 | [diff] [blame] | 582 | #ifdef SETTINGS_RESET |
Marcoen Hirschberg | 810f717 | 2007-04-27 19:24:31 +0000 | [diff] [blame] | 583 | /* Reset settings if holding the reset button. (Rec on Archos, |
| 584 | A on Gigabeat) */ |
Miika Pekkarinen | 8e8c1a8 | 2005-12-07 12:35:54 +0000 | [diff] [blame] | 585 | if ((button_status() & SETTINGS_RESET) == SETTINGS_RESET) |
Dave Chapman | 1272c8a | 2006-02-24 12:37:50 +0000 | [diff] [blame] | 586 | #else |
| 587 | /* Reset settings if the hold button is turned on */ |
| 588 | if (button_hold()) |
| 589 | #endif |
Miika Pekkarinen | a697717 | 2005-12-07 11:20:56 +0000 | [diff] [blame] | 590 | { |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 591 | splash(HZ*2, str(LANG_RESET_DONE_CLEAR)); |
Miika Pekkarinen | a697717 | 2005-12-07 11:20:56 +0000 | [diff] [blame] | 592 | settings_reset(); |
| 593 | } |
| 594 | else |
Miika Pekkarinen | 8e8c1a8 | 2005-12-07 12:35:54 +0000 | [diff] [blame] | 595 | #endif |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 596 | { |
| 597 | CHART(">settings_load(ALL)"); |
Miika Pekkarinen | a697717 | 2005-12-07 11:20:56 +0000 | [diff] [blame] | 598 | settings_load(SETTINGS_ALL); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 599 | CHART("<settings_load(ALL)"); |
| 600 | } |
Miika Pekkarinen | 8e8c1a8 | 2005-12-07 12:35:54 +0000 | [diff] [blame] | 601 | |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 602 | CHART(">init_dircache(true)"); |
| 603 | rc = init_dircache(true); |
Torne Wuff | 59463ba | 2010-04-06 23:07:18 +0000 | [diff] [blame] | 604 | CHART("<init_dircache(true)"); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 605 | if (rc < 0) |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 606 | { |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 607 | #ifdef HAVE_TAGCACHE |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 608 | remove(TAGCACHE_STATEFILE); |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 609 | #endif |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 610 | } |
Peter D'Hoye | 3c1e9ca | 2008-09-07 20:09:11 +0000 | [diff] [blame] | 611 | |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 612 | CHART(">settings_apply(true)"); |
Jonathan Gordon | 792f733 | 2010-03-07 03:20:34 +0000 | [diff] [blame] | 613 | settings_apply(true); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 614 | CHART("<settings_apply(true)"); |
| 615 | CHART(">init_dircache(false)"); |
Miika Pekkarinen | 69cdc75 | 2006-08-12 14:40:38 +0000 | [diff] [blame] | 616 | init_dircache(false); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 617 | CHART("<init_dircache(false)"); |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 618 | #ifdef HAVE_TAGCACHE |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 619 | CHART(">init_tagcache"); |
Miika Pekkarinen | 1b18dd0 | 2006-04-12 10:31:24 +0000 | [diff] [blame] | 620 | init_tagcache(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 621 | CHART("<init_tagcache"); |
Jonathan Gordon | 710ccb7 | 2006-10-25 10:17:57 +0000 | [diff] [blame] | 622 | #endif |
Jens Arnold | c12e87d | 2004-09-28 18:09:10 +0000 | [diff] [blame] | 623 | |
Peter D'Hoye | c4a59a2 | 2006-08-15 22:54:06 +0000 | [diff] [blame] | 624 | #ifdef HAVE_EEPROM_SETTINGS |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 625 | if (firmware_settings.initialized) |
| 626 | { |
| 627 | /* In case we crash. */ |
| 628 | firmware_settings.disk_clean = false; |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 629 | CHART(">eeprom_settings_store"); |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 630 | eeprom_settings_store(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 631 | CHART("<eeprom_settings_store"); |
Miika Pekkarinen | 954b732 | 2006-08-05 20:19:10 +0000 | [diff] [blame] | 632 | } |
| 633 | #endif |
Jens Arnold | 3605600 | 2004-09-29 21:41:10 +0000 | [diff] [blame] | 634 | playlist_init(); |
Jonathan Gordon | 2cda994 | 2007-06-10 10:41:27 +0000 | [diff] [blame] | 635 | tree_mem_init(); |
Jonathan Gordon | 21165a3 | 2007-03-29 06:16:00 +0000 | [diff] [blame] | 636 | filetype_init(); |
Linus Nielsen Feltzing | da153da | 2006-10-19 09:42:58 +0000 | [diff] [blame] | 637 | scrobbler_init(); |
Steve Bavin | 77f6f4c | 2009-06-15 15:46:09 +0000 | [diff] [blame] | 638 | #if CONFIG_CODEC == SWCODEC |
| 639 | tdspeed_init(); |
| 640 | #endif /* CONFIG_CODEC == SWCODEC */ |
Linus Nielsen Feltzing | da153da | 2006-10-19 09:42:58 +0000 | [diff] [blame] | 641 | |
Michael Sevakis | 98cd3e8 | 2007-03-09 12:30:14 +0000 | [diff] [blame] | 642 | #if CONFIG_CODEC != SWCODEC |
Linus Nielsen Feltzing | 67bea32 | 2003-05-17 20:38:38 +0000 | [diff] [blame] | 643 | /* No buffer allocation (see buffer.c) may take place after the call to |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 644 | audio_init() since the mpeg thread takes the rest of the buffer space */ |
Jörg Hohensohn | f993365 | 2004-01-05 20:42:51 +0000 | [diff] [blame] | 645 | mp3_init( global_settings.volume, |
| 646 | global_settings.bass, |
| 647 | global_settings.treble, |
| 648 | global_settings.balance, |
| 649 | global_settings.loudness, |
Jörg Hohensohn | f993365 | 2004-01-05 20:42:51 +0000 | [diff] [blame] | 650 | global_settings.avc, |
Linus Nielsen Feltzing | 7bade1a | 2004-07-06 12:17:14 +0000 | [diff] [blame] | 651 | global_settings.channel_config, |
Jens Arnold | 76b257f | 2005-01-12 00:24:15 +0000 | [diff] [blame] | 652 | global_settings.stereo_width, |
Linus Nielsen Feltzing | 7bade1a | 2004-07-06 12:17:14 +0000 | [diff] [blame] | 653 | global_settings.mdb_strength, |
| 654 | global_settings.mdb_harmonics, |
| 655 | global_settings.mdb_center, |
| 656 | global_settings.mdb_shape, |
| 657 | global_settings.mdb_enable, |
| 658 | global_settings.superbass); |
Peter D'Hoye | 6488177 | 2006-05-01 12:54:21 +0000 | [diff] [blame] | 659 | |
| 660 | /* audio_init must to know the size of voice buffer so init voice first */ |
| 661 | talk_init(); |
Michael Sevakis | 98cd3e8 | 2007-03-09 12:30:14 +0000 | [diff] [blame] | 662 | #endif /* CONFIG_CODEC != SWCODEC */ |
Peter D'Hoye | 6488177 | 2006-05-01 12:54:21 +0000 | [diff] [blame] | 663 | |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 664 | CHART(">audio_init"); |
Magnus Holmgren | 62634a3 | 2005-10-16 08:01:02 +0000 | [diff] [blame] | 665 | audio_init(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 666 | CHART("<audio_init"); |
Michael Sevakis | 98cd3e8 | 2007-03-09 12:30:14 +0000 | [diff] [blame] | 667 | |
Linus Nielsen Feltzing | ed4d7a3 | 2006-07-21 08:42:28 +0000 | [diff] [blame] | 668 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) |
Andy | e6e5496 | 2005-11-12 04:00:56 +0000 | [diff] [blame] | 669 | pcm_rec_init(); |
Jens Arnold | 6514435 | 2005-06-20 10:04:16 +0000 | [diff] [blame] | 670 | #endif |
Peter D'Hoye | 6488177 | 2006-05-01 12:54:21 +0000 | [diff] [blame] | 671 | |
Michiel Van Der Kolk | d6ab723 | 2005-07-04 22:10:42 +0000 | [diff] [blame] | 672 | /* runtime database has to be initialized after audio_init() */ |
Miika Pekkarinen | 86d0d91 | 2006-12-05 20:20:00 +0000 | [diff] [blame] | 673 | cpu_boost(false); |
Linus Nielsen Feltzing | 67bea32 | 2003-05-17 20:38:38 +0000 | [diff] [blame] | 674 | |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 675 | #if CONFIG_CHARGING |
Linus Nielsen Feltzing | 3d21781 | 2005-04-06 11:12:22 +0000 | [diff] [blame] | 676 | car_adapter_mode_init(); |
| 677 | #endif |
Michael Giacomelli | 70e9c7a | 2008-12-25 01:46:16 +0000 | [diff] [blame] | 678 | #ifdef IPOD_ACCESSORY_PROTOCOL |
| 679 | iap_setup(global_settings.serial_bitrate); |
| 680 | #endif |
Andree Buschmann | 850a112 | 2008-04-20 18:28:25 +0000 | [diff] [blame] | 681 | #ifdef HAVE_ACCESSORY_SUPPLY |
| 682 | accessory_supply_set(global_settings.accessory_supply); |
| 683 | #endif |
Andree Buschmann | b6c12a1 | 2010-03-20 15:02:29 +0000 | [diff] [blame] | 684 | #ifdef HAVE_LINEOUT_POWEROFF |
| 685 | lineout_set(global_settings.lineout_active); |
| 686 | #endif |
Thomas Martitz | cfda097 | 2009-11-25 22:54:36 +0000 | [diff] [blame] | 687 | #ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 688 | CHART("<check_bootfile(false)"); |
Thomas Martitz | cfda097 | 2009-11-25 22:54:36 +0000 | [diff] [blame] | 689 | check_bootfile(false); /* remember write time and filesize */ |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 690 | CHART(">check_bootfile(false)"); |
Thomas Martitz | cfda097 | 2009-11-25 22:54:36 +0000 | [diff] [blame] | 691 | #endif |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 692 | CHART("<settings_apply_skins"); |
Jonathan Gordon | 4c6b355 | 2010-02-26 08:01:41 +0000 | [diff] [blame] | 693 | settings_apply_skins(); |
Torne Wuff | 52e528e | 2010-04-01 16:27:21 +0000 | [diff] [blame] | 694 | CHART(">settings_apply_skins"); |
Björn Stenberg | e324db6 | 2002-05-17 19:50:37 +0000 | [diff] [blame] | 695 | } |
| 696 | |
Daniel Ankers | 28575f6 | 2006-08-03 16:38:06 +0000 | [diff] [blame] | 697 | #ifdef CPU_PP |
Michael Sevakis | 2b640ba | 2010-06-17 20:15:58 +0000 | [diff] [blame] | 698 | void __attribute__((noreturn)) cop_main(void) |
Daniel Ankers | cec7cdc | 2006-08-03 16:29:42 +0000 | [diff] [blame] | 699 | { |
| 700 | /* This is the entry point for the coprocessor |
| 701 | Anyone not running an upgraded bootloader will never reach this point, |
| 702 | so it should not be assumed that the coprocessor be usable even on |
| 703 | platforms which support it. |
| 704 | |
Michael Sevakis | 7914e90 | 2007-09-28 10:20:02 +0000 | [diff] [blame] | 705 | A kernel thread is initially setup on the coprocessor and immediately |
| 706 | destroyed for purposes of continuity. The cop sits idle until at least |
| 707 | one thread exists on it. */ |
Daniel Ankers | b856636 | 2007-02-27 22:55:12 +0000 | [diff] [blame] | 708 | |
Michael Sevakis | 7914e90 | 2007-09-28 10:20:02 +0000 | [diff] [blame] | 709 | #if NUM_CORES > 1 |
| 710 | system_init(); |
| 711 | kernel_init(); |
| 712 | /* This should never be reached */ |
| 713 | #endif |
Daniel Ankers | cc5de0e | 2007-02-27 23:21:38 +0000 | [diff] [blame] | 714 | while(1) { |
Jens Arnold | cea07eb | 2008-04-20 17:53:05 +0000 | [diff] [blame] | 715 | sleep_core(COP); |
Daniel Ankers | cc5de0e | 2007-02-27 23:21:38 +0000 | [diff] [blame] | 716 | } |
Daniel Ankers | cec7cdc | 2006-08-03 16:29:42 +0000 | [diff] [blame] | 717 | } |
Daniel Ankers | cc5de0e | 2007-02-27 23:21:38 +0000 | [diff] [blame] | 718 | #endif /* CPU_PP */ |
Daniel Ankers | cec7cdc | 2006-08-03 16:29:42 +0000 | [diff] [blame] | 719 | |
Michael Sevakis | 2b640ba | 2010-06-17 20:15:58 +0000 | [diff] [blame] | 720 | #endif /* SIMULATOR */ |