diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-18 00:11:42 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-18 00:11:42 +0000 |
commit | c23a7ccbbc9e8e817503bac5c1401125ef23a136 (patch) | |
tree | f14c6930f41faad7de95131a7e8ed19f778774aa /rbutil/mkamsboot | |
parent | 86d91e3f84ca2df6b8ce8b0eae9b548a86734735 (diff) | |
download | rockbox-c23a7ccbbc9e8e817503bac5c1401125ef23a136.tar.gz rockbox-c23a7ccbbc9e8e817503bac5c1401125ef23a136.zip |
Fuzev2: use enrd0 for USB detection, GPIO didn't work on some models
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26125 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mkamsboot')
-rw-r--r-- | rbutil/mkamsboot/dualboot.c | 30 | ||||
-rw-r--r-- | rbutil/mkamsboot/dualboot.h | 2 | ||||
-rw-r--r-- | rbutil/mkamsboot/dualboot/dualboot.S | 80 |
3 files changed, 66 insertions, 46 deletions
diff --git a/rbutil/mkamsboot/dualboot.c b/rbutil/mkamsboot/dualboot.c index 8f87ea8cb5..6b0211fb75 100644 --- a/rbutil/mkamsboot/dualboot.c +++ b/rbutil/mkamsboot/dualboot.c | |||
@@ -152,20 +152,28 @@ unsigned char dualboot_clipplus[372] = { | |||
152 | 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0d, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x10, 0x00, 0x0f, 0xc8, | 152 | 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0d, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x10, 0x00, 0x0f, 0xc8, |
153 | 0x00, 0x00, 0x07, 0xc8 | 153 | 0x00, 0x00, 0x07, 0xc8 |
154 | }; | 154 | }; |
155 | unsigned char dualboot_fuzev2[236] = { | 155 | unsigned char dualboot_fuzev2[364] = { |
156 | 0xd4, 0xf0, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, | 156 | 0x50, 0xf1, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, |
157 | 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, | 157 | 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, |
158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5, | 159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5, |
160 | 0x24, 0x10, 0x1f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x18, 0x30, 0x1f, 0xe5, 0x01, 0x40, 0x50, 0xe4, | 160 | 0x24, 0x10, 0x1f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x18, 0x30, 0x1f, 0xe5, 0x01, 0x40, 0x50, 0xe4, |
161 | 0x01, 0x40, 0x43, 0xe4, 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x2c, 0x30, 0x0f, 0xe5, | 161 | 0x01, 0x40, 0x43, 0xe4, 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x2c, 0x30, 0x0f, 0xe5, |
162 | 0x78, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, | 162 | 0xf4, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, |
163 | 0x6c, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5, | 163 | 0xe8, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5, |
164 | 0x00, 0x00, 0x51, 0xe3, 0x08, 0x00, 0x00, 0x1a, 0x58, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, | 164 | 0x00, 0x00, 0x51, 0xe3, 0x27, 0x00, 0x00, 0x1a, 0xd4, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, |
165 | 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0x02, 0x00, 0x00, 0x1a, | 165 | 0x00, 0x10, 0x80, 0xe5, 0xc0, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x02, 0x18, 0x81, 0xe3, |
166 | 0x78, 0x00, 0x1f, 0xe5, 0x78, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x8c, 0x00, 0x1f, 0xe5, | 166 | 0x7f, 0x10, 0xc1, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0xb8, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, |
167 | 0x8c, 0x10, 0x1f, 0xe5, 0x84, 0x30, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0, | 167 | 0x24, 0x10, 0x80, 0xe5, 0x3c, 0x10, 0xa0, 0xe3, 0x1c, 0x10, 0x80, 0xe5, 0x00, 0x10, 0xa0, 0xe3, |
168 | 0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 0xfb, 0xff, 0xff, 0x1a, | 168 | 0x20, 0x10, 0x80, 0xe5, 0x8c, 0x10, 0xa0, 0xe3, 0x04, 0x10, 0x80, 0xe5, 0x51, 0x20, 0xa0, 0xe3, |
169 | 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, | 169 | 0x0c, 0x20, 0x80, 0xe5, 0x30, 0x10, 0x90, 0xe5, 0x01, 0x00, 0x11, 0xe3, 0xfc, 0xff, 0xff, 0x1a, |
170 | 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0d, 0xc8 | 170 | 0x02, 0x17, 0xa0, 0xe3, 0x01, 0x10, 0x51, 0xe2, 0xfd, 0xff, 0xff, 0x1a, 0x25, 0x10, 0xa0, 0xe3, |
171 | 0x44, 0x10, 0x80, 0xe5, 0x02, 0x20, 0x82, 0xe3, 0x0c, 0x20, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3, | ||
172 | 0x10, 0x10, 0x80, 0xe5, 0x10, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0xfc, 0xff, 0xff, 0x1a, | ||
173 | 0x00, 0x10, 0x90, 0xe5, 0x08, 0x00, 0x11, 0xe3, 0x02, 0x00, 0x00, 0x1a, 0xf4, 0x00, 0x1f, 0xe5, | ||
174 | 0xf4, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x08, 0x01, 0x1f, 0xe5, 0x08, 0x11, 0x1f, 0xe5, | ||
175 | 0x00, 0x31, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0, 0x01, 0x20, 0x50, 0xe4, | ||
176 | 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x01, 0x00, 0x83, 0xe2, | ||
177 | 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0f, 0xc8, | ||
178 | 0x00, 0x00, 0x0d, 0xc8, 0x10, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x07, 0xc8 | ||
171 | }; | 179 | }; |
diff --git a/rbutil/mkamsboot/dualboot.h b/rbutil/mkamsboot/dualboot.h index cada57559f..5ddcffc766 100644 --- a/rbutil/mkamsboot/dualboot.h +++ b/rbutil/mkamsboot/dualboot.h | |||
@@ -8,4 +8,4 @@ extern unsigned char dualboot_m200v4[212]; | |||
8 | extern unsigned char dualboot_fuze[236]; | 8 | extern unsigned char dualboot_fuze[236]; |
9 | extern unsigned char dualboot_clipv2[280]; | 9 | extern unsigned char dualboot_clipv2[280]; |
10 | extern unsigned char dualboot_clipplus[372]; | 10 | extern unsigned char dualboot_clipplus[372]; |
11 | extern unsigned char dualboot_fuzev2[236]; | 11 | extern unsigned char dualboot_fuzev2[364]; |
diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S index 309aa67742..4cbbc372e8 100644 --- a/rbutil/mkamsboot/dualboot/dualboot.S +++ b/rbutil/mkamsboot/dualboot/dualboot.S | |||
@@ -102,7 +102,7 @@ uclcopy: | |||
102 | /* TODO : M200V4 ? */ | 102 | /* TODO : M200V4 ? */ |
103 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) | 103 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) |
104 | #define USB_PIN 6 | 104 | #define USB_PIN 6 |
105 | #elif defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) | 105 | #elif defined(SANSA_FUZE) || defined(SANSA_E200V2) |
106 | #define USB_PIN 3 | 106 | #define USB_PIN 3 |
107 | #endif | 107 | #endif |
108 | 108 | ||
@@ -214,19 +214,23 @@ uclcopy: | |||
214 | 214 | ||
215 | cmp r1, #0 | 215 | cmp r1, #0 |
216 | beq boot_of | 216 | beq boot_of |
217 | #elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_FUZEV2) | 217 | #elif defined(SANSA_E200V2) || defined(SANSA_FUZE) |
218 | ldr r0, =GPIOC | 218 | ldr r0, =GPIOC |
219 | mov r1, #0 | 219 | mov r1, #0 |
220 | str r1, [r0, #0x400] | 220 | str r1, [r0, #0x400] |
221 | ldr r1, [r0, #0x20] /* read pin C3 */ | 221 | ldr r1, [r0, #0x20] /* read pin C3 */ |
222 | 222 | ||
223 | cmp r1, #0 /* C3 = #0 means button pressed */ | 223 | cmp r1, #0 /* C3 = #0 means button pressed */ |
224 | #ifdef SANSA_FUZEV2 | ||
225 | /* the logic is reversed on the fuzev2 */ | ||
226 | bne boot_of | ||
227 | #else | ||
228 | beq boot_of | 224 | beq boot_of |
229 | #endif /* SANSA_FUZEV2 */ | 225 | |
226 | #elif defined(SANSA_FUZEV2) | ||
227 | ldr r0, =GPIOC | ||
228 | mov r1, #0 | ||
229 | str r1, [r0, #0x400] | ||
230 | ldr r1, [r0, #0x20] /* read pin C3 */ | ||
231 | |||
232 | cmp r1, #0 /* C3 != #0 means button pressed */ | ||
233 | bne boot_of | ||
230 | 234 | ||
231 | #elif defined(SANSA_CLIPPLUS) | 235 | #elif defined(SANSA_CLIPPLUS) |
232 | @ read pins | 236 | @ read pins |
@@ -242,7 +246,41 @@ uclcopy: | |||
242 | bne boot_of @ branch directly to OF if either pin high | 246 | bne boot_of @ branch directly to OF if either pin high |
243 | 247 | ||
244 | 248 | ||
245 | @ check USB connection | 249 | #elif defined(SANSA_C200V2) |
250 | /* check for RIGHT on C6, should changed to LEFT as soon as it | ||
251 | * known in which pin that is in order for consistency */ | ||
252 | ldr r0, =GPIOC | ||
253 | mov r1, #0 | ||
254 | str r1, [r0, #0x400] /* set pin to output */ | ||
255 | |||
256 | ldr r1, [r0, #256] /* 1<<(6+2) */ | ||
257 | cmp r1, #0 /* C6 low means button pressed */ | ||
258 | beq boot_of | ||
259 | #elif defined(SANSA_M200V4) | ||
260 | .set row, (1<<5) /* enable output on A5 */ | ||
261 | .set col, (1<<0) /* read keyscan column A0 */ | ||
262 | |||
263 | ldr r0, =GPIOA | ||
264 | mov r1, #row | ||
265 | str r1, [r0, #0x400] | ||
266 | str r1, [r0, #(4*row)] | ||
267 | |||
268 | ldr r2, [r0, #(4*col)] | ||
269 | |||
270 | /* check value read (1 means button pressed) */ | ||
271 | cmp r2, #0 | ||
272 | bne boot_of | ||
273 | #else | ||
274 | #error No target-specific key check defined! | ||
275 | #endif | ||
276 | |||
277 | #if defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2) | ||
278 | /* Check for USB after buttons because I trust more the GPIO code than | ||
279 | * the i2c code. | ||
280 | * Also it seems we need to wait a bit before detecting USB connection | ||
281 | * on those models, but not on c200v2 | ||
282 | */ | ||
283 | |||
246 | 284 | ||
247 | ldr r0, =CGU_PROC | 285 | ldr r0, =CGU_PROC |
248 | mov r1, #0 | 286 | mov r1, #0 |
@@ -302,32 +340,6 @@ uclcopy: | |||
302 | bne boot_of | 340 | bne boot_of |
303 | 341 | ||
304 | 342 | ||
305 | #elif defined(SANSA_C200V2) | ||
306 | /* check for RIGHT on C6, should changed to LEFT as soon as it | ||
307 | * known in which pin that is in order for consistency */ | ||
308 | ldr r0, =GPIOC | ||
309 | mov r1, #0 | ||
310 | str r1, [r0, #0x400] /* set pin to output */ | ||
311 | |||
312 | ldr r1, [r0, #256] /* 1<<(6+2) */ | ||
313 | cmp r1, #0 /* C6 low means button pressed */ | ||
314 | beq boot_of | ||
315 | #elif defined(SANSA_M200V4) | ||
316 | .set row, (1<<5) /* enable output on A5 */ | ||
317 | .set col, (1<<0) /* read keyscan column A0 */ | ||
318 | |||
319 | ldr r0, =GPIOA | ||
320 | mov r1, #row | ||
321 | str r1, [r0, #0x400] | ||
322 | str r1, [r0, #(4*row)] | ||
323 | |||
324 | ldr r2, [r0, #(4*col)] | ||
325 | |||
326 | /* check value read (1 means button pressed) */ | ||
327 | cmp r2, #0 | ||
328 | bne boot_of | ||
329 | #else | ||
330 | #error No target-specific key check defined! | ||
331 | #endif | 343 | #endif |
332 | 344 | ||
333 | 345 | ||