summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c90
1 files changed, 18 insertions, 72 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 48e67b575b..682bcaf456 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -121,8 +121,6 @@ static bool dbg_list(char *title, int count, int selection_size,
121/*---------------------------------------------------*/ 121/*---------------------------------------------------*/
122/* SPECIAL DEBUG STUFF */ 122/* SPECIAL DEBUG STUFF */
123/*---------------------------------------------------*/ 123/*---------------------------------------------------*/
124extern int ata_device;
125extern int ata_io_address;
126extern struct thread_entry threads[MAXTHREADS]; 124extern struct thread_entry threads[MAXTHREADS];
127 125
128 126
@@ -407,8 +405,6 @@ static bool dbg_hw_info(void)
407{ 405{
408#if CONFIG_CPU == SH7034 406#if CONFIG_CPU == SH7034
409 char buf[32]; 407 char buf[32];
410 int usb_polarity;
411 int pr_polarity;
412 int bitmask = *(unsigned short*)0x20000fc; 408 int bitmask = *(unsigned short*)0x20000fc;
413 int rom_version = *(unsigned short*)0x20000fe; 409 int rom_version = *(unsigned short*)0x20000fe;
414 unsigned manu, id; /* flash IDs */ 410 unsigned manu, id; /* flash IDs */
@@ -417,20 +413,6 @@ static bool dbg_hw_info(void)
417 bool has_bootrom; /* flag for boot ROM present */ 413 bool has_bootrom; /* flag for boot ROM present */
418 int oldmode; /* saved memory guard mode */ 414 int oldmode; /* saved memory guard mode */
419 415
420#ifdef USB_ENABLE_ONDIOSTYLE
421 if(PADRL & 0x20)
422#else
423 if(PADRH & 0x04)
424#endif
425 usb_polarity = 0; /* Negative */
426 else
427 usb_polarity = 1; /* Positive */
428
429 if(PADRH & 0x08)
430 pr_polarity = 0; /* Negative */
431 else
432 pr_polarity = 1; /* Positive */
433
434 oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */ 416 oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
435 417
436 /* get flash ROM type */ 418 /* get flash ROM type */
@@ -460,17 +442,11 @@ static bool dbg_hw_info(void)
460 snprintf(buf, 32, "Mask: 0x%04x", bitmask); 442 snprintf(buf, 32, "Mask: 0x%04x", bitmask);
461 lcd_puts(0, 2, buf); 443 lcd_puts(0, 2, buf);
462 444
463 snprintf(buf, 32, "USB: %s", usb_polarity?"positive":"negative");
464 lcd_puts(0, 3, buf);
465
466 snprintf(buf, 32, "PR: %s", pr_polarity?"positive":"negative");
467 lcd_puts(0, 4, buf);
468
469 if (got_id) 445 if (got_id)
470 snprintf(buf, 32, "Flash: M=%02x D=%02x", manu, id); 446 snprintf(buf, 32, "Flash: M=%02x D=%02x", manu, id);
471 else 447 else
472 snprintf(buf, 32, "Flash: M=?? D=??"); /* unknown, sorry */ 448 snprintf(buf, 32, "Flash: M=?? D=??"); /* unknown, sorry */
473 lcd_puts(0, 5, buf); 449 lcd_puts(0, 3, buf);
474 450
475 if (has_bootrom) 451 if (has_bootrom)
476 { 452 {
@@ -483,13 +459,8 @@ static bool dbg_hw_info(void)
483 { 459 {
484 snprintf(buf, 32, "Boot ROM: none"); 460 snprintf(buf, 32, "Boot ROM: none");
485 } 461 }
486 lcd_puts(0, 6, buf); 462 lcd_puts(0, 4, buf);
487 463
488#ifndef HAVE_MMC /* have ATA */
489 snprintf(buf, 32, "ATA: 0x%x,%s", ata_io_address,
490 ata_device ? "slave":"master");
491 lcd_puts(0, 7, buf);
492#endif
493 lcd_update(); 464 lcd_update();
494 465
495 while(1) 466 while(1)
@@ -593,8 +564,6 @@ static bool dbg_hw_info(void)
593 char buf[32]; 564 char buf[32];
594 int button; 565 int button;
595 int currval = 0; 566 int currval = 0;
596 int usb_polarity;
597 int bitmask = *(unsigned short*)0x20000fc;
598 int rom_version = *(unsigned short*)0x20000fe; 567 int rom_version = *(unsigned short*)0x20000fe;
599 unsigned manu, id; /* flash IDs */ 568 unsigned manu, id; /* flash IDs */
600 bool got_id; /* flag if we managed to get the flash IDs */ 569 bool got_id; /* flag if we managed to get the flash IDs */
@@ -602,11 +571,6 @@ static bool dbg_hw_info(void)
602 bool has_bootrom; /* flag for boot ROM present */ 571 bool has_bootrom; /* flag for boot ROM present */
603 int oldmode; /* saved memory guard mode */ 572 int oldmode; /* saved memory guard mode */
604 573
605 if(PADRH & 0x04)
606 usb_polarity = 0; /* Negative */
607 else
608 usb_polarity = 1; /* Positive */
609
610 oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */ 574 oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
611 575
612 /* get flash ROM type */ 576 /* get flash ROM type */
@@ -636,23 +600,12 @@ static bool dbg_hw_info(void)
636 rom_version/100, rom_version%100); 600 rom_version/100, rom_version%100);
637 break; 601 break;
638 case 1: 602 case 1:
639 snprintf(buf, 32, "USB: %s",
640 usb_polarity?"pos":"neg");
641 break;
642 case 2:
643 snprintf(buf, 32, "ATA: 0x%x%s",
644 ata_io_address, ata_device ? "s":"m");
645 break;
646 case 3:
647 snprintf(buf, 32, "Mask: %04x", bitmask);
648 break;
649 case 4:
650 if (got_id) 603 if (got_id)
651 snprintf(buf, 32, "Flash:%02x,%02x", manu, id); 604 snprintf(buf, 32, "Flash:%02x,%02x", manu, id);
652 else 605 else
653 snprintf(buf, 32, "Flash:??,??"); /* unknown, sorry */ 606 snprintf(buf, 32, "Flash:??,??"); /* unknown, sorry */
654 break; 607 break;
655 case 5: 608 case 2:
656 if (has_bootrom) 609 if (has_bootrom)
657 { 610 {
658 if (rom_crc == 0x56DBA4EE) /* known Version 1 */ 611 if (rom_crc == 0x56DBA4EE) /* known Version 1 */
@@ -681,12 +634,12 @@ static bool dbg_hw_info(void)
681 case ACTION_SETTINGS_DEC: 634 case ACTION_SETTINGS_DEC:
682 currval--; 635 currval--;
683 if(currval < 0) 636 if(currval < 0)
684 currval = 5; 637 currval = 2;
685 break; 638 break;
686 639
687 case ACTION_SETTINGS_INC: 640 case ACTION_SETTINGS_INC:
688 currval++; 641 currval++;
689 if(currval > 5) 642 if(currval > 2)
690 currval = 0; 643 currval = 0;
691 break; 644 break;
692 } 645 }
@@ -968,11 +921,7 @@ bool dbg_ports(void)
968 snprintf(buf, 32, "Batt: %d.%02dV %d%% ", adc_battery_voltage / 100, 921 snprintf(buf, 32, "Batt: %d.%02dV %d%% ", adc_battery_voltage / 100,
969 adc_battery_voltage % 100, adc_battery_level); 922 adc_battery_voltage % 100, adc_battery_level);
970 lcd_puts(0, 6, buf); 923 lcd_puts(0, 6, buf);
971#ifndef HAVE_MMC /* have ATA */ 924
972 snprintf(buf, 32, "ATA: %s, 0x%x",
973 ata_device?"slave":"master", ata_io_address);
974 lcd_puts(0, 7, buf);
975#endif
976 lcd_update(); 925 lcd_update();
977 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) 926 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
978 return false; 927 return false;
@@ -1208,38 +1157,35 @@ bool dbg_ports(void)
1208 switch(currval) 1157 switch(currval)
1209 { 1158 {
1210 case 0: 1159 case 0:
1211 snprintf(buf, 32, "PADR: %04x ", porta); 1160 snprintf(buf, 32, "PADR: %04x", porta);
1212 break; 1161 break;
1213 case 1: 1162 case 1:
1214 snprintf(buf, 32, "PBDR: %04x ", portb); 1163 snprintf(buf, 32, "PBDR: %04x", portb);
1215 break; 1164 break;
1216 case 2: 1165 case 2:
1217 snprintf(buf, 32, "AN0: %03x ", adc_read(0)); 1166 snprintf(buf, 32, "AN0: %03x", adc_read(0));
1218 break; 1167 break;
1219 case 3: 1168 case 3:
1220 snprintf(buf, 32, "AN1: %03x ", adc_read(1)); 1169 snprintf(buf, 32, "AN1: %03x", adc_read(1));
1221 break; 1170 break;
1222 case 4: 1171 case 4:
1223 snprintf(buf, 32, "AN2: %03x ", adc_read(2)); 1172 snprintf(buf, 32, "AN2: %03x", adc_read(2));
1224 break; 1173 break;
1225 case 5: 1174 case 5:
1226 snprintf(buf, 32, "AN3: %03x ", adc_read(3)); 1175 snprintf(buf, 32, "AN3: %03x", adc_read(3));
1227 break; 1176 break;
1228 case 6: 1177 case 6:
1229 snprintf(buf, 32, "AN4: %03x ", adc_read(4)); 1178 snprintf(buf, 32, "AN4: %03x", adc_read(4));
1230 break; 1179 break;
1231 case 7: 1180 case 7:
1232 snprintf(buf, 32, "AN5: %03x ", adc_read(5)); 1181 snprintf(buf, 32, "AN5: %03x", adc_read(5));
1233 break; 1182 break;
1234 case 8: 1183 case 8:
1235 snprintf(buf, 32, "AN6: %03x ", adc_read(6)); 1184 snprintf(buf, 32, "AN6: %03x", adc_read(6));
1236 break; 1185 break;
1237 case 9: 1186 case 9:
1238 snprintf(buf, 32, "AN7: %03x ", adc_read(7)); 1187 snprintf(buf, 32, "AN7: %03x", adc_read(7));
1239 break; 1188 break;
1240 case 10:
1241 snprintf(buf, 32, "%s, 0x%x ",
1242 ata_device?"slv":"mst", ata_io_address);
1243 break; 1189 break;
1244 } 1190 }
1245 lcd_puts(0, 0, buf); 1191 lcd_puts(0, 0, buf);
@@ -1261,12 +1207,12 @@ bool dbg_ports(void)
1261 case ACTION_SETTINGS_DEC: 1207 case ACTION_SETTINGS_DEC:
1262 currval--; 1208 currval--;
1263 if(currval < 0) 1209 if(currval < 0)
1264 currval = 10; 1210 currval = 9;
1265 break; 1211 break;
1266 1212
1267 case ACTION_SETTINGS_INC: 1213 case ACTION_SETTINGS_INC:
1268 currval++; 1214 currval++;
1269 if(currval > 10) 1215 if(currval > 9)
1270 currval = 0; 1216 currval = 0;
1271 break; 1217 break;
1272 } 1218 }