summaryrefslogtreecommitdiffstats
path: root/rbutil
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
parent86d91e3f84ca2df6b8ce8b0eae9b548a86734735 (diff)
downloadrockbox-c23a7ccbbc9e8e817503bac5c1401125ef23a136.tar.gz
rockbox-c23a7ccbbc9e8e817503bac5c1401125ef23a136.tar.bz2
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')
-rw-r--r--rbutil/mkamsboot/dualboot.c30
-rw-r--r--rbutil/mkamsboot/dualboot.h2
-rw-r--r--rbutil/mkamsboot/dualboot/dualboot.S80
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] = {
0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0d, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x10, 0x00, 0x0f, 0xc8,
0x00, 0x00, 0x07, 0xc8
};
-unsigned char dualboot_fuzev2[236] = {
- 0xd4, 0xf0, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea,
+unsigned char dualboot_fuzev2[364] = {
+ 0x50, 0xf1, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea,
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5,
0x24, 0x10, 0x1f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x18, 0x30, 0x1f, 0xe5, 0x01, 0x40, 0x50, 0xe4,
0x01, 0x40, 0x43, 0xe4, 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x2c, 0x30, 0x0f, 0xe5,
- 0x78, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5,
- 0x6c, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5,
- 0x00, 0x00, 0x51, 0xe3, 0x08, 0x00, 0x00, 0x1a, 0x58, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3,
- 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0x02, 0x00, 0x00, 0x1a,
- 0x78, 0x00, 0x1f, 0xe5, 0x78, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x8c, 0x00, 0x1f, 0xe5,
- 0x8c, 0x10, 0x1f, 0xe5, 0x84, 0x30, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0,
- 0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 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, 0xe3, 0x0c, 0x20, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3,
+ 0x10, 0x10, 0x80, 0xe5, 0x10, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0xfc, 0xff, 0xff, 0x1a,
+ 0x00, 0x10, 0x90, 0xe5, 0x08, 0x00, 0x11, 0xe3, 0x02, 0x00, 0x00, 0x1a, 0xf4, 0x00, 0x1f, 0xe5,
+ 0xf4, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x08, 0x01, 0x1f, 0xe5, 0x08, 0x11, 0x1f, 0xe5,
+ 0x00, 0x31, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0, 0x01, 0x20, 0x50, 0xe4,
+ 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x01, 0x00, 0x83, 0xe2,
+ 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0f, 0xc8,
+ 0x00, 0x00, 0x0d, 0xc8, 0x10, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x07, 0xc8
};
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];
extern unsigned char dualboot_fuze[236];
extern unsigned char dualboot_clipv2[280];
extern unsigned char dualboot_clipplus[372];
-extern unsigned char dualboot_fuzev2[236];
+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:
/* TODO : M200V4 ? */
#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2)
#define USB_PIN 6
-#elif defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2)
+#elif defined(SANSA_FUZE) || defined(SANSA_E200V2)
#define USB_PIN 3
#endif
@@ -214,19 +214,23 @@ uclcopy:
cmp r1, #0
beq boot_of
-#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_FUZEV2)
+#elif defined(SANSA_E200V2) || defined(SANSA_FUZE)
ldr r0, =GPIOC
mov r1, #0
str r1, [r0, #0x400]
ldr r1, [r0, #0x20] /* read pin C3 */
cmp r1, #0 /* C3 = #0 means button pressed */
-#ifdef SANSA_FUZEV2
- /* the logic is reversed on the fuzev2 */
- bne boot_of
-#else
beq boot_of
-#endif /* SANSA_FUZEV2 */
+
+#elif defined(SANSA_FUZEV2)
+ ldr r0, =GPIOC
+ mov r1, #0
+ str r1, [r0, #0x400]
+ ldr r1, [r0, #0x20] /* read pin C3 */
+
+ cmp r1, #0 /* C3 != #0 means button pressed */
+ bne boot_of
#elif defined(SANSA_CLIPPLUS)
@ read pins
@@ -242,7 +246,41 @@ uclcopy:
bne boot_of @ branch directly to OF if either pin high
- @ check USB connection
+#elif defined(SANSA_C200V2)
+ /* check for RIGHT on C6, should changed to LEFT as soon as it
+ * known in which pin that is in order for consistency */
+ ldr r0, =GPIOC
+ mov r1, #0
+ str r1, [r0, #0x400] /* set pin to output */
+
+ ldr r1, [r0, #256] /* 1<<(6+2) */
+ cmp r1, #0 /* C6 low means button pressed */
+ beq boot_of
+#elif defined(SANSA_M200V4)
+.set row, (1<<5) /* enable output on A5 */
+.set col, (1<<0) /* read keyscan column A0 */
+
+ ldr r0, =GPIOA
+ mov r1, #row
+ str r1, [r0, #0x400]
+ str r1, [r0, #(4*row)]
+
+ ldr r2, [r0, #(4*col)]
+
+ /* check value read (1 means button pressed) */
+ cmp r2, #0
+ bne boot_of
+#else
+ #error No target-specific key check defined!
+#endif
+
+#if defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2)
+ /* Check for USB after buttons because I trust more the GPIO code than
+ * the i2c code.
+ * Also it seems we need to wait a bit before detecting USB connection
+ * on those models, but not on c200v2
+ */
+
ldr r0, =CGU_PROC
mov r1, #0
@@ -302,32 +340,6 @@ uclcopy:
bne boot_of
-#elif defined(SANSA_C200V2)
- /* check for RIGHT on C6, should changed to LEFT as soon as it
- * known in which pin that is in order for consistency */
- ldr r0, =GPIOC
- mov r1, #0
- str r1, [r0, #0x400] /* set pin to output */
-
- ldr r1, [r0, #256] /* 1<<(6+2) */
- cmp r1, #0 /* C6 low means button pressed */
- beq boot_of
-#elif defined(SANSA_M200V4)
-.set row, (1<<5) /* enable output on A5 */
-.set col, (1<<0) /* read keyscan column A0 */
-
- ldr r0, =GPIOA
- mov r1, #row
- str r1, [r0, #0x400]
- str r1, [r0, #(4*row)]
-
- ldr r2, [r0, #(4*col)]
-
- /* check value read (1 means button pressed) */
- cmp r2, #0
- bne boot_of
-#else
- #error No target-specific key check defined!
#endif