mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
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
This commit is contained in:
parent
86d91e3f84
commit
c23a7ccbbc
3 changed files with 66 additions and 46 deletions
|
|
@ -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,
|
0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0d, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x10, 0x00, 0x0f, 0xc8,
|
||||||
0x00, 0x00, 0x07, 0xc8
|
0x00, 0x00, 0x07, 0xc8
|
||||||
};
|
};
|
||||||
unsigned char dualboot_fuzev2[236] = {
|
unsigned char dualboot_fuzev2[364] = {
|
||||||
0xd4, 0xf0, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea,
|
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,
|
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, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5,
|
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,
|
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,
|
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,
|
0xf4, 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,
|
0xe8, 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, 0x00, 0x51, 0xe3, 0x27, 0x00, 0x00, 0x1a, 0xd4, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3,
|
||||||
0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0x02, 0x00, 0x00, 0x1a,
|
0x00, 0x10, 0x80, 0xe5, 0xc0, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x02, 0x18, 0x81, 0xe3,
|
||||||
0x78, 0x00, 0x1f, 0xe5, 0x78, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x8c, 0x00, 0x1f, 0xe5,
|
0x7f, 0x10, 0xc1, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0xb8, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3,
|
||||||
0x8c, 0x10, 0x1f, 0xe5, 0x84, 0x30, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0,
|
0x24, 0x10, 0x80, 0xe5, 0x3c, 0x10, 0xa0, 0xe3, 0x1c, 0x10, 0x80, 0xe5, 0x00, 0x10, 0xa0, 0xe3,
|
||||||
0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 0xfb, 0xff, 0xff, 0x1a,
|
0x20, 0x10, 0x80, 0xe5, 0x8c, 0x10, 0xa0, 0xe3, 0x04, 0x10, 0x80, 0xe5, 0x51, 0x20, 0xa0, 0xe3,
|
||||||
0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00,
|
0x0c, 0x20, 0x80, 0xe5, 0x30, 0x10, 0x90, 0xe5, 0x01, 0x00, 0x11, 0xe3, 0xfc, 0xff, 0xff, 0x1a,
|
||||||
0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0d, 0xc8
|
0x02, 0x17, 0xa0, 0xe3, 0x01, 0x10, 0x51, 0xe2, 0xfd, 0xff, 0xff, 0x1a, 0x25, 0x10, 0xa0, 0xe3,
|
||||||
|
0x44, 0x10, 0x80, 0xe5, 0x02, 0x20, 0x82, 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
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@ extern unsigned char dualboot_m200v4[212];
|
||||||
extern unsigned char dualboot_fuze[236];
|
extern unsigned char dualboot_fuze[236];
|
||||||
extern unsigned char dualboot_clipv2[280];
|
extern unsigned char dualboot_clipv2[280];
|
||||||
extern unsigned char dualboot_clipplus[372];
|
extern unsigned char dualboot_clipplus[372];
|
||||||
extern unsigned char dualboot_fuzev2[236];
|
extern unsigned char dualboot_fuzev2[364];
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ uclcopy:
|
||||||
/* TODO : M200V4 ? */
|
/* TODO : M200V4 ? */
|
||||||
#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2)
|
#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2)
|
||||||
#define USB_PIN 6
|
#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
|
#define USB_PIN 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -214,19 +214,23 @@ uclcopy:
|
||||||
|
|
||||||
cmp r1, #0
|
cmp r1, #0
|
||||||
beq boot_of
|
beq boot_of
|
||||||
#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_FUZEV2)
|
#elif defined(SANSA_E200V2) || defined(SANSA_FUZE)
|
||||||
ldr r0, =GPIOC
|
ldr r0, =GPIOC
|
||||||
mov r1, #0
|
mov r1, #0
|
||||||
str r1, [r0, #0x400]
|
str r1, [r0, #0x400]
|
||||||
ldr r1, [r0, #0x20] /* read pin C3 */
|
ldr r1, [r0, #0x20] /* read pin C3 */
|
||||||
|
|
||||||
cmp r1, #0 /* C3 = #0 means button pressed */
|
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
|
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)
|
#elif defined(SANSA_CLIPPLUS)
|
||||||
@ read pins
|
@ read pins
|
||||||
|
|
@ -242,7 +246,41 @@ uclcopy:
|
||||||
bne boot_of @ branch directly to OF if either pin high
|
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
|
ldr r0, =CGU_PROC
|
||||||
mov r1, #0
|
mov r1, #0
|
||||||
|
|
@ -302,32 +340,6 @@ uclcopy:
|
||||||
bne boot_of
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue