diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-29 23:15:55 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-29 23:15:55 +0000 |
commit | b0db71397023229cbe83e239dabe746467eea659 (patch) | |
tree | 967c430f75c389c5a7a91340ade88d3dd7242415 /rbutil/mkamsboot/dualboot/dualboot.S | |
parent | aa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5 (diff) | |
download | rockbox-b0db71397023229cbe83e239dabe746467eea659.tar.gz rockbox-b0db71397023229cbe83e239dabe746467eea659.zip |
mkamsboot: don't boot OF if USB is plugged (AMSv1 only)mkamsboot_1.4
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27618 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mkamsboot/dualboot/dualboot.S')
-rw-r--r-- | rbutil/mkamsboot/dualboot/dualboot.S | 70 |
1 files changed, 5 insertions, 65 deletions
diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S index 77fb4dec7d..242eefa815 100644 --- a/rbutil/mkamsboot/dualboot/dualboot.S +++ b/rbutil/mkamsboot/dualboot/dualboot.S | |||
@@ -90,77 +90,17 @@ uclcopy: | |||
90 | str r1, [r0] | 90 | str r1, [r0] |
91 | 91 | ||
92 | 92 | ||
93 | /* TODO : M200V4 ? */ | 93 | #ifdef SANSA_CLIPV2 /* TODO : remove this check when we'll have an USB driver */ |
94 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) | ||
95 | #define USB_PIN 6 | ||
96 | #elif defined(SANSA_FUZE) || defined(SANSA_E200V2) | ||
97 | #define USB_PIN 3 | ||
98 | #endif | ||
99 | |||
100 | #ifdef USB_PIN /* TODO : remove this check when we'll have an USB driver */ | ||
101 | ldr r0, =GPIOA | 94 | ldr r0, =GPIOA |
102 | mov r1, #0 | 95 | mov r1, #0 |
103 | str r1, [r0, #0x400] | 96 | str r1, [r0, #0x400] |
104 | ldr r1, [r0, #(4*(1<<USB_PIN))] | 97 | ldr r1, [r0, #(4*(1<<6))] |
105 | cmp r1, #0 | 98 | cmp r1, #0 |
106 | bne boot_of | 99 | bne boot_of |
107 | #endif | 100 | #endif |
108 | #if defined(SANSA_C200V2) | 101 | /* Here are model specific tests for dual boot */ |
109 | /* Instead of checking the GPIO, check the audio master IRQ_ENRD0 | 102 | /* All models but c200v2 use left button */ |
110 | * USB_STATUS bit on C200V2 */ | 103 | /* TODO: Left button for c200v2 too (needs DBOP code) */ |
111 | |||
112 | ldr r0, =CGU_PERI | ||
113 | ldr r1, [r0] | ||
114 | /* enable i2c audio master clock */ | ||
115 | orr r1, r1, #(1<<17) | ||
116 | /* make sure 24MHz clk_main is selected */ | ||
117 | bic r1, r1, #0x7f | ||
118 | str r1, [r0] | ||
119 | |||
120 | ldr r0, =I2C_BASE | ||
121 | /* disable i2c interrupts */ | ||
122 | mov r1, #0 | ||
123 | str r1, [r0, #I2C_IMR] | ||
124 | /* setup prescaler */ | ||
125 | mov r1, #I2C_PRESCALER_LOW | ||
126 | str r1, [r0, #I2C_CPSR0] | ||
127 | mov r1, #I2C_PRESCALER_HIGH | ||
128 | str r1, [r0, #I2C_CPSR1] | ||
129 | /* setup i2c slave address */ | ||
130 | mov r1, #(AS3514_I2C_ADDR << 1) | ||
131 | str r1, [r0, #I2C_SLAD0] | ||
132 | mov r2, #0x51 | ||
133 | str r2, [r0, #I2C_CNTRL] | ||
134 | |||
135 | /* wait for not busy */ | ||
136 | 1: | ||
137 | ldr r1, [r0, #I2C_SR] | ||
138 | tst r1, #1 | ||
139 | bne 1b | ||
140 | |||
141 | /* start read of irq_enrd0 */ | ||
142 | mov r1, #AS3514_IRQ_ENRD0 | ||
143 | str r1, [r0, #I2C_SADDR] | ||
144 | orr r2, r2, #(1 << 1) | ||
145 | str r2, [r0, #I2C_CNTRL] | ||
146 | mov r1, #1 | ||
147 | str r1, [r0, #I2C_DACNT] | ||
148 | |||
149 | /* wait for transfer to finish */ | ||
150 | 1: | ||
151 | ldr r1, [r0, #I2C_DACNT] | ||
152 | cmp r1, #0 | ||
153 | bne 1b | ||
154 | |||
155 | /* load result and test USB_STATUS bit */ | ||
156 | ldr r1, [r0, #I2C_DATA] | ||
157 | tst r1, #(1 << 3) | ||
158 | bne boot_of | ||
159 | #endif | ||
160 | |||
161 | /* Here are model specific tests, for dual boot without a computer */ | ||
162 | /* All models use left button */ | ||
163 | /* /!\ Right button for c200v2 (left button is unkwown) */ | ||
164 | 104 | ||
165 | #ifdef SANSA_CLIP | 105 | #ifdef SANSA_CLIP |
166 | .set row, (1<<5) /* enable output on C5 */ | 106 | .set row, (1<<5) /* enable output on C5 */ |