diff options
-rw-r--r-- | apps/debug_menu.c | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index cc93b298b2..b67f07cb19 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1000,9 +1000,6 @@ static bool dbg_spdif(void) | |||
1000 | bool dbg_ports(void) | 1000 | bool dbg_ports(void) |
1001 | { | 1001 | { |
1002 | #if CONFIG_CPU == SH7034 | 1002 | #if CONFIG_CPU == SH7034 |
1003 | unsigned short porta; | ||
1004 | unsigned short portb; | ||
1005 | unsigned char portc; | ||
1006 | char buf[32]; | 1003 | char buf[32]; |
1007 | int adc_battery_voltage, adc_battery_level; | 1004 | int adc_battery_voltage, adc_battery_level; |
1008 | 1005 | ||
@@ -1012,13 +1009,9 @@ bool dbg_ports(void) | |||
1012 | 1009 | ||
1013 | while(1) | 1010 | while(1) |
1014 | { | 1011 | { |
1015 | porta = PADR; | 1012 | snprintf(buf, 32, "PADR: %04x", (unsigned short)PADR); |
1016 | portb = PBDR; | ||
1017 | portc = PCDR; | ||
1018 | |||
1019 | snprintf(buf, 32, "PADR: %04x", porta); | ||
1020 | lcd_puts(0, 0, buf); | 1013 | lcd_puts(0, 0, buf); |
1021 | snprintf(buf, 32, "PBDR: %04x", portb); | 1014 | snprintf(buf, 32, "PBDR: %04x", (unsigned short)PBDR); |
1022 | lcd_puts(0, 1, buf); | 1015 | lcd_puts(0, 1, buf); |
1023 | 1016 | ||
1024 | snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); | 1017 | snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); |
@@ -1126,10 +1119,6 @@ bool dbg_ports(void) | |||
1126 | 1119 | ||
1127 | #elif defined(CPU_PP502x) | 1120 | #elif defined(CPU_PP502x) |
1128 | 1121 | ||
1129 | unsigned int gpio_a, gpio_b, gpio_c, gpio_d; | ||
1130 | unsigned int gpio_e, gpio_f, gpio_g, gpio_h; | ||
1131 | unsigned int gpio_i, gpio_j, gpio_k, gpio_l; | ||
1132 | |||
1133 | char buf[128]; | 1122 | char buf[128]; |
1134 | int line; | 1123 | int line; |
1135 | 1124 | ||
@@ -1139,36 +1128,29 @@ bool dbg_ports(void) | |||
1139 | 1128 | ||
1140 | while(1) | 1129 | while(1) |
1141 | { | 1130 | { |
1142 | gpio_a = GPIOA_INPUT_VAL; | ||
1143 | gpio_b = GPIOB_INPUT_VAL; | ||
1144 | gpio_c = GPIOC_INPUT_VAL; | ||
1145 | gpio_d = GPIOD_INPUT_VAL; | ||
1146 | gpio_e = GPIOE_INPUT_VAL; | ||
1147 | gpio_f = GPIOF_INPUT_VAL; | ||
1148 | gpio_g = GPIOG_INPUT_VAL; | ||
1149 | gpio_h = GPIOH_INPUT_VAL; | ||
1150 | gpio_i = GPIOI_INPUT_VAL; | ||
1151 | gpio_j = GPIOJ_INPUT_VAL; | ||
1152 | gpio_k = GPIOK_INPUT_VAL; | ||
1153 | gpio_l = GPIOL_INPUT_VAL; | ||
1154 | |||
1155 | line = 0; | 1131 | line = 0; |
1156 | snprintf(buf, sizeof(buf), "GPIO STATES:"); | 1132 | lcd_puts(0, line++, "GPIO STATES:"); |
1157 | lcd_puts(0, line++, buf); | ||
1158 | snprintf(buf, sizeof(buf), "A: %02x E: %02x I: %02x", | 1133 | snprintf(buf, sizeof(buf), "A: %02x E: %02x I: %02x", |
1159 | gpio_a, gpio_e, gpio_i); | 1134 | (unsigned int)GPIOA_INPUT_VAL, |
1135 | (unsigned int)GPIOE_INPUT_VAL, | ||
1136 | (unsigned int)GPIOI_INPUT_VAL); | ||
1160 | lcd_puts(0, line++, buf); | 1137 | lcd_puts(0, line++, buf); |
1161 | snprintf(buf, sizeof(buf), "B: %02x F: %02x J: %02x", | 1138 | snprintf(buf, sizeof(buf), "B: %02x F: %02x J: %02x", |
1162 | gpio_b, gpio_f, gpio_j); | 1139 | (unsigned int)GPIOB_INPUT_VAL, |
1140 | (unsigned int)GPIOF_INPUT_VAL, | ||
1141 | (unsigned int)GPIOJ_INPUT_VAL); | ||
1163 | lcd_puts(0, line++, buf); | 1142 | lcd_puts(0, line++, buf); |
1164 | snprintf(buf, sizeof(buf), "C: %02x G: %02x K: %02x", | 1143 | snprintf(buf, sizeof(buf), "C: %02x G: %02x K: %02x", |
1165 | gpio_c, gpio_g, gpio_k); | 1144 | (unsigned int)GPIOC_INPUT_VAL, |
1145 | (unsigned int)GPIOG_INPUT_VAL, | ||
1146 | (unsigned int)GPIOK_INPUT_VAL); | ||
1166 | lcd_puts(0, line++, buf); | 1147 | lcd_puts(0, line++, buf); |
1167 | snprintf(buf, sizeof(buf), "D: %02x H: %02x L: %02x", | 1148 | snprintf(buf, sizeof(buf), "D: %02x H: %02x L: %02x", |
1168 | gpio_d, gpio_h, gpio_l); | 1149 | (unsigned int)GPIOD_INPUT_VAL, |
1150 | (unsigned int)GPIOH_INPUT_VAL, | ||
1151 | (unsigned int)GPIOL_INPUT_VAL); | ||
1169 | lcd_puts(0, line++, buf); | 1152 | lcd_puts(0, line++, buf); |
1170 | line++; | 1153 | line++; |
1171 | |||
1172 | snprintf(buf, sizeof(buf), "GPO32_VAL: %08lx", GPO32_VAL); | 1154 | snprintf(buf, sizeof(buf), "GPO32_VAL: %08lx", GPO32_VAL); |
1173 | lcd_puts(0, line++, buf); | 1155 | lcd_puts(0, line++, buf); |
1174 | snprintf(buf, sizeof(buf), "GPO32_EN: %08lx", GPO32_ENABLE); | 1156 | snprintf(buf, sizeof(buf), "GPO32_EN: %08lx", GPO32_ENABLE); |
@@ -1186,11 +1168,11 @@ bool dbg_ports(void) | |||
1186 | 1168 | ||
1187 | #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) | 1169 | #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) |
1188 | line++; | 1170 | line++; |
1189 | snprintf(buf, sizeof(buf), "BATT: %03x UNK1: %03x", adc_read(ADC_BATTERY), | 1171 | snprintf(buf, sizeof(buf), "BATT: %03x UNK1: %03x", |
1190 | adc_read(ADC_UNKNOWN_1)); | 1172 | adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1)); |
1191 | lcd_puts(0, line++, buf); | 1173 | lcd_puts(0, line++, buf); |
1192 | snprintf(buf, sizeof(buf), "REM: %03x PAD: %03x", adc_read(ADC_REMOTE), | 1174 | snprintf(buf, sizeof(buf), "REM: %03x PAD: %03x", |
1193 | adc_read(ADC_SCROLLPAD)); | 1175 | adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD)); |
1194 | lcd_puts(0, line++, buf); | 1176 | lcd_puts(0, line++, buf); |
1195 | #elif defined(SANSA_E200) | 1177 | #elif defined(SANSA_E200) |
1196 | line++; | 1178 | line++; |
@@ -1238,15 +1220,12 @@ bool dbg_ports(void) | |||
1238 | 1220 | ||
1239 | while(1) | 1221 | while(1) |
1240 | { | 1222 | { |
1241 | gpio_a = GPIOA_INPUT_VAL; | ||
1242 | gpio_b = GPIOB_INPUT_VAL; | ||
1243 | gpio_c = GPIOC_INPUT_VAL; | ||
1244 | gpio_d = GPIOD_INPUT_VAL; | ||
1245 | |||
1246 | line = 0; | 1223 | line = 0; |
1247 | snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_B: %02x", gpio_a, gpio_b); | 1224 | snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_B: %02x", |
1225 | (unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL); | ||
1248 | lcd_puts(0, line++, buf); | 1226 | lcd_puts(0, line++, buf); |
1249 | snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_D: %02x", gpio_c, gpio_d); | 1227 | snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_D: %02x", |
1228 | (unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL); | ||
1250 | lcd_puts(0, line++, buf); | 1229 | lcd_puts(0, line++, buf); |
1251 | 1230 | ||
1252 | snprintf(buf, sizeof(buf), "DEV_EN: %08lx", DEV_EN); | 1231 | snprintf(buf, sizeof(buf), "DEV_EN: %08lx", DEV_EN); |
@@ -1278,9 +1257,6 @@ bool dbg_ports(void) | |||
1278 | #else /* !HAVE_LCD_BITMAP */ | 1257 | #else /* !HAVE_LCD_BITMAP */ |
1279 | bool dbg_ports(void) | 1258 | bool dbg_ports(void) |
1280 | { | 1259 | { |
1281 | unsigned short porta; | ||
1282 | unsigned short portb; | ||
1283 | unsigned char portc; | ||
1284 | char buf[32]; | 1260 | char buf[32]; |
1285 | int button; | 1261 | int button; |
1286 | int adc_battery_voltage; | 1262 | int adc_battery_voltage; |
@@ -1290,17 +1266,13 @@ bool dbg_ports(void) | |||
1290 | 1266 | ||
1291 | while(1) | 1267 | while(1) |
1292 | { | 1268 | { |
1293 | porta = PADR; | ||
1294 | portb = PBDR; | ||
1295 | portc = PCDR; | ||
1296 | |||
1297 | switch(currval) | 1269 | switch(currval) |
1298 | { | 1270 | { |
1299 | case 0: | 1271 | case 0: |
1300 | snprintf(buf, 32, "PADR: %04x", porta); | 1272 | snprintf(buf, 32, "PADR: %04x", (unsigned short)PADR); |
1301 | break; | 1273 | break; |
1302 | case 1: | 1274 | case 1: |
1303 | snprintf(buf, 32, "PBDR: %04x", portb); | 1275 | snprintf(buf, 32, "PBDR: %04x", (unsigned short)PBDR); |
1304 | break; | 1276 | break; |
1305 | case 2: | 1277 | case 2: |
1306 | snprintf(buf, 32, "AN0: %03x", adc_read(0)); | 1278 | snprintf(buf, 32, "AN0: %03x", adc_read(0)); |