summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2003-07-03 22:13:39 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2003-07-03 22:13:39 +0000
commitc47f8c042c81926ee88d5d8739ff1988d4113d42 (patch)
tree478955a6932fe5efa5aee34c83a4773268ca1af7 /apps
parentd4735224bbb27fae62a852c882e6524c6fd716d6 (diff)
downloadrockbox-c47f8c042c81926ee88d5d8739ff1988d4113d42.tar.gz
rockbox-c47f8c042c81926ee88d5d8739ff1988d4113d42.zip
detect cold start (from flash) and look for archos.mod/ajbrec.ajz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3808 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/main.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/main.c b/apps/main.c
index b7e02151fb..820c9c3088 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -50,6 +50,7 @@
50#include "wps-display.h" 50#include "wps-display.h"
51#include "playlist.h" 51#include "playlist.h"
52#include "buffer.h" 52#include "buffer.h"
53#include "rolo.h"
53 54
54char appsversion[]=APPSVERSION; 55char appsversion[]=APPSVERSION;
55 56
@@ -97,6 +98,7 @@ void init(void)
97{ 98{
98 int rc, i; 99 int rc, i;
99 struct partinfo* pinfo; 100 struct partinfo* pinfo;
101 bool coldstart; /* starting from Flash */
100 102
101 system_init(); 103 system_init();
102 kernel_init(); 104 kernel_init();
@@ -131,6 +133,9 @@ void init(void)
131 133
132 button_init(); 134 button_init();
133 135
136 /* if nobody initialized ATA before, I consider this a cold start */
137 coldstart = (PACR2 & 0x4000) != 0;
138
134 rc = ata_init(); 139 rc = ata_init();
135 if(rc) 140 if(rc)
136 { 141 {
@@ -168,7 +173,7 @@ void init(void)
168 dbg_partitions(); 173 dbg_partitions();
169 } 174 }
170 } 175 }
171 176
172 settings_load(); 177 settings_load();
173 178
174 status_init(); 179 status_init();
@@ -188,6 +193,22 @@ void init(void)
188 global_settings.channel_config ); 193 global_settings.channel_config );
189 194
190 power_init(); 195 power_init();
196
197 if (coldstart && !usb_detect())
198 { /* when starting from flash, this time _we_ have to yield */
199 int fd;
200#ifdef HAVE_LCD_CHARCELLS
201 static const char filename[] = "/archos.mod";
202#else
203 static const char filename[] = "/ajbrec.ajz";
204#endif
205 fd = open(filename, O_RDONLY);
206 if(fd >= 0) /* no complaint if it doesn't exit */
207 {
208 close(fd);
209 rolo_load((char*)filename); /* start if it does */
210 }
211 }
191} 212}
192 213
193int main(void) 214int main(void)