diff options
Diffstat (limited to 'firmware/target/arm/as3525/system-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index c51d84469f..5a7d25a1f7 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -163,6 +163,41 @@ void fiq_handler(void) | |||
163 | ); | 163 | ); |
164 | } | 164 | } |
165 | 165 | ||
166 | #if defined(SANSA_C200V2) | ||
167 | #include "dbop-as3525.h" | ||
168 | |||
169 | int c200v2_variant = 0; | ||
170 | |||
171 | static void check_model_variant(void) | ||
172 | { | ||
173 | unsigned int i; | ||
174 | unsigned int saved_dir = GPIOA_DIR; | ||
175 | |||
176 | /* Make A7 input */ | ||
177 | GPIOA_DIR &= ~(1<<7); | ||
178 | /* wait a little to allow the pullup/pulldown resistor | ||
179 | * to charge the input capacitance */ | ||
180 | for (i=0; i<1000; i++) asm volatile ("nop\n"); | ||
181 | /* read the pullup/pulldown value on A7 to determine the variant */ | ||
182 | if (GPIOA_PIN(7) == 0) { | ||
183 | /* | ||
184 | * Backlight on A7. | ||
185 | */ | ||
186 | c200v2_variant = 1; | ||
187 | } else { | ||
188 | /* | ||
189 | * Backlight on A5. | ||
190 | */ | ||
191 | c200v2_variant = 0; | ||
192 | } | ||
193 | GPIOA_DIR = saved_dir; | ||
194 | } | ||
195 | #else | ||
196 | static inline void check_model_variant(void) | ||
197 | { | ||
198 | } | ||
199 | #endif /* SANSA_C200V2*/ | ||
200 | |||
166 | #if defined(BOOTLOADER) | 201 | #if defined(BOOTLOADER) |
167 | static void sdram_delay(void) | 202 | static void sdram_delay(void) |
168 | { | 203 | { |
@@ -319,6 +354,7 @@ void system_init(void) | |||
319 | fmradio_i2c_init(); | 354 | fmradio_i2c_init(); |
320 | #endif | 355 | #endif |
321 | #endif /* !BOOTLOADER */ | 356 | #endif /* !BOOTLOADER */ |
357 | check_model_variant(); | ||
322 | } | 358 | } |
323 | 359 | ||
324 | void system_reboot(void) | 360 | void system_reboot(void) |