summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/debug-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-05-10 00:08:03 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-05-10 00:13:11 +0200
commit645680d62b82455d24fcb178f1cc5208f9942e38 (patch)
tree1a9f928afc34260059bf986fc2caa7fc5b2a2028 /firmware/target/arm/imx233/debug-imx233.c
parentd29a11b7a8f4ce230e9385a44f352a559bde753f (diff)
downloadrockbox-645680d62b82455d24fcb178f1cc5208f9942e38.tar.gz
rockbox-645680d62b82455d24fcb178f1cc5208f9942e38.zip
imx233: add pinctrl debug code to track pin uses
Past development has proved that one can mistakely use the same pin for two uses without noticing. Since this causes extremely hard to find bugs, the infrastructure will allow to register pin uses and panic when a conflict is detected. The pinctrl debug now shows the pin uses when its support is compiled in. Change-Id: Idb2d5235ce09207d77aa474d6f158e72b933761a
Diffstat (limited to 'firmware/target/arm/imx233/debug-imx233.c')
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index fd510b77c1..59792c17a8 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -399,13 +399,25 @@ bool dbg_hw_info_pinctrl(void)
399{ 399{
400 lcd_setfont(FONT_SYSFIXED); 400 lcd_setfont(FONT_SYSFIXED);
401 401
402#ifdef IMX233_PINCTRL_DEBUG
403 unsigned top_user = 0;
404#endif
402 while(1) 405 while(1)
403 { 406 {
404 int button = get_action(CONTEXT_STD, HZ / 10); 407 int button = get_action(CONTEXT_STD, HZ / 10);
405 switch(button) 408 switch(button)
406 { 409 {
407 case ACTION_STD_NEXT: 410 case ACTION_STD_NEXT:
411#ifdef IMX233_PINCTRL_DEBUG
412 top_user++;
413 break;
414#endif
408 case ACTION_STD_PREV: 415 case ACTION_STD_PREV:
416#ifdef IMX233_PINCTRL_DEBUG
417 if(top_user > 0)
418 top_user--;
419 break;
420#endif
409 case ACTION_STD_OK: 421 case ACTION_STD_OK:
410 case ACTION_STD_MENU: 422 case ACTION_STD_MENU:
411 lcd_setfont(FONT_UI); 423 lcd_setfont(FONT_UI);
@@ -418,6 +430,23 @@ bool dbg_hw_info_pinctrl(void)
418 lcd_clear_display(); 430 lcd_clear_display();
419 for(int i = 0; i < 4; i++) 431 for(int i = 0; i < 4; i++)
420 lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_get_gpio_input_mask(i, 0xffffffff)); 432 lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_get_gpio_input_mask(i, 0xffffffff));
433#ifdef IMX233_PINCTRL_DEBUG
434 unsigned cur_line = 6;
435 unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height;
436 unsigned cur_idx = 0;
437
438 for(int bank = 0; bank < 4; bank++)
439 for(int pin = 0; pin < 32; pin++)
440 {
441 const char *owner = imx233_pinctrl_get_pin_use(bank, pin);
442 if(owner == NULL)
443 continue;
444 if(cur_idx++ >= top_user && cur_line < last_line)
445 lcd_putsf(0, cur_line++, "B%dP%02d %s", bank, pin, owner);
446 }
447 if(cur_idx < top_user)
448 top_user = cur_idx - 1;
449#endif
421 lcd_update(); 450 lcd_update();
422 yield(); 451 yield();
423 } 452 }