summaryrefslogtreecommitdiff
path: root/rbutil/mkamsboot/dualboot
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-18 00:11:42 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-18 00:11:42 +0000
commitc23a7ccbbc9e8e817503bac5c1401125ef23a136 (patch)
treef14c6930f41faad7de95131a7e8ed19f778774aa /rbutil/mkamsboot/dualboot
parent86d91e3f84ca2df6b8ce8b0eae9b548a86734735 (diff)
downloadrockbox-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/dualboot')
-rw-r--r--rbutil/mkamsboot/dualboot/dualboot.S80
1 files changed, 46 insertions, 34 deletions
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