diff options
author | Tobias Diedrich <ranma+coreboot@tdiedrich.de> | 2010-06-27 02:50:24 +0000 |
---|---|---|
committer | Tobias Diedrich <ranma+coreboot@tdiedrich.de> | 2010-06-27 02:50:24 +0000 |
commit | eefe273ce6395f3f6872a63f0a0f242b5065a17e (patch) | |
tree | f089b8ca89e1209746c58b213abc5a6fcd73f784 | |
parent | ac40959c48ced2c2dee30d3977e1671ceb941371 (diff) | |
download | rockbox-eefe273ce6395f3f6872a63f0a0f242b5065a17e.tar.gz rockbox-eefe273ce6395f3f6872a63f0a0f242b5065a17e.zip |
DBOP noise on C200v2 goes away if we precharge long enough.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27148 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/as3525/dbop-as3525.c | 45 | ||||
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 11 |
2 files changed, 5 insertions, 51 deletions
diff --git a/firmware/target/arm/as3525/dbop-as3525.c b/firmware/target/arm/as3525/dbop-as3525.c index 87bc46e145..1816b5205b 100644 --- a/firmware/target/arm/as3525/dbop-as3525.c +++ b/firmware/target/arm/as3525/dbop-as3525.c | |||
@@ -34,49 +34,9 @@ | |||
34 | /* doesn't work with the new ams sansas so far and is not needed */ | 34 | /* doesn't work with the new ams sansas so far and is not needed */ |
35 | static short int dbop_input_value = 0; | 35 | static short int dbop_input_value = 0; |
36 | 36 | ||
37 | #if defined(SANSA_C200V2) | ||
38 | /* | ||
39 | * workaround DBOP noise issue cause it's really annoying if your | ||
40 | * buttons don't work in the debug menu... | ||
41 | */ | ||
42 | static short int input_value_tmp[2]; | ||
43 | int dbop_denoise_reject = 0; | ||
44 | int dbop_denoise_accept = 0; | ||
45 | #endif | ||
46 | |||
47 | /* read the DBOP data pins */ | 37 | /* read the DBOP data pins */ |
48 | #if defined(SANSA_C200V2) | ||
49 | unsigned short dbop_read_input_once(void); | ||
50 | |||
51 | unsigned short dbop_read_input(void) | 38 | unsigned short dbop_read_input(void) |
52 | { | 39 | { |
53 | int i; | ||
54 | |||
55 | while (1) { | ||
56 | for (i=0; i<2; i++) { | ||
57 | input_value_tmp[i] = dbop_read_input_once(); | ||
58 | } | ||
59 | /* noise rejection */ | ||
60 | if (input_value_tmp[0] == input_value_tmp[1]) { | ||
61 | dbop_denoise_accept++; | ||
62 | break; | ||
63 | } else { | ||
64 | dbop_denoise_reject++; | ||
65 | } | ||
66 | } | ||
67 | if (dbop_denoise_accept + dbop_denoise_reject > 1000) { | ||
68 | dbop_denoise_accept /= 2; | ||
69 | dbop_denoise_reject /= 2; | ||
70 | } | ||
71 | |||
72 | return dbop_input_value; | ||
73 | } | ||
74 | |||
75 | unsigned short dbop_read_input_once(void) | ||
76 | #else | ||
77 | unsigned short dbop_read_input(void) | ||
78 | #endif | ||
79 | { | ||
80 | unsigned int dbop_ctrl_old = DBOP_CTRL; | 40 | unsigned int dbop_ctrl_old = DBOP_CTRL; |
81 | unsigned int dbop_timpol23_old = DBOP_TIMPOL_23; | 41 | unsigned int dbop_timpol23_old = DBOP_TIMPOL_23; |
82 | 42 | ||
@@ -92,6 +52,11 @@ unsigned short dbop_read_input(void) | |||
92 | (1 << 16) | /* enw=1 (enable write) */ | 52 | (1 << 16) | /* enw=1 (enable write) */ |
93 | (1 << 12); /* ow=1 (16-bit data width) */ | 53 | (1 << 12); /* ow=1 (16-bit data width) */ |
94 | DBOP_DOUT = DBOP_PRECHARGE; | 54 | DBOP_DOUT = DBOP_PRECHARGE; |
55 | #if defined(SANSA_C200V2) | ||
56 | /* two additional writes to precharge longer get rid of the read noise */ | ||
57 | DBOP_DOUT = DBOP_PRECHARGE; | ||
58 | DBOP_DOUT = DBOP_PRECHARGE; | ||
59 | #endif | ||
95 | while ((DBOP_STAT & (1<<10)) == 0); | 60 | while ((DBOP_STAT & (1<<10)) == 0); |
96 | 61 | ||
97 | #if defined(SANSA_FUZE) || defined(SANSA_E200V2) | 62 | #if defined(SANSA_FUZE) || defined(SANSA_E200V2) |
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index e6ae3a4a5d..71a8a85022 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -269,21 +269,10 @@ bool __dbg_hw_info(void) | |||
269 | while(1) | 269 | while(1) |
270 | { | 270 | { |
271 | #ifdef SANSA_C200V2 | 271 | #ifdef SANSA_C200V2 |
272 | extern int dbop_denoise_accept; | ||
273 | extern int dbop_denoise_reject; | ||
274 | |||
275 | lcd_clear_display(); | 272 | lcd_clear_display(); |
276 | line = 0; | 273 | line = 0; |
277 | lcd_puts(0, line++, "[Submodel:]"); | 274 | lcd_puts(0, line++, "[Submodel:]"); |
278 | lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant); | 275 | lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant); |
279 | if (dbop_denoise_accept) { | ||
280 | lcd_putsf(0, line++, "DBOP noise: %d%%", | ||
281 | (100*dbop_denoise_reject)/dbop_denoise_accept); | ||
282 | } else { | ||
283 | lcd_puts(0, line++, "DBOP noise: oo"); | ||
284 | } | ||
285 | lcd_putsf(0, line++, "reject: %d", dbop_denoise_reject); | ||
286 | lcd_putsf(0, line++, "accept: %d", dbop_denoise_accept); | ||
287 | lcd_update(); | 276 | lcd_update(); |
288 | int btn = button_get_w_tmo(HZ/10); | 277 | int btn = button_get_w_tmo(HZ/10); |
289 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | 278 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) |