imx233: add sd/mmc debug screen

The screen currently displays for each device the bus width, set_block_count
support, HS capability and whether it is enabled for not.

Change-Id: I6b1c3b1019e55ef1097a23c1f54fb07f5c7aa3b0
This commit is contained in:
Amaury Pouly 2016-05-29 16:07:43 +01:00
parent 7aacf4da2d
commit 85ad99ee3d
2 changed files with 127 additions and 6 deletions

View file

@ -43,6 +43,8 @@
#include "stdio.h"
#include "button.h"
#include "button-imx233.h"
#include "sdmmc-imx233.h"
#include "storage.h"
#include "regs/usbphy.h"
#include "regs/timrot.h"
@ -1190,6 +1192,65 @@ bool dbg_hw_info_button(void)
}
}
bool dbg_hw_info_sdmmc(void)
{
lcd_setfont(FONT_SYSFIXED);
while(1)
{
int button = my_get_action(HZ / 10);
switch(button)
{
case ACT_NEXT:
case ACT_PREV:
case ACT_OK:
lcd_setfont(FONT_UI);
return true;
case ACT_CANCEL:
lcd_setfont(FONT_UI);
return false;
}
lcd_clear_display();
int line = 0;
#if CONFIG_STORAGE & STORAGE_MMC
int mmc_idx = 0;
#endif
#if CONFIG_STORAGE & STORAGE_SD
int sd_idx = 0;
#endif
for(int drive = 0; drive < storage_num_drives(); drive++)
{
struct sdmmc_info_t info;
if(false) {}
#if CONFIG_STORAGE & STORAGE_MMC
else if(storage_driver_type(drive) == STORAGE_MMC_NUM)
info = imx233_mmc_get_info(mmc_idx++);
#endif
#if CONFIG_STORAGE & STORAGE_SD
else if(storage_driver_type(drive) == STORAGE_SD_NUM)
info = imx233_sd_get_info(sd_idx++);
#endif
else
continue;
lcd_putsf(0, line++, "%s", info.slot_name);
#ifdef HAVE_HOTSWAP
bool removable = storage_removable(info.drive);
bool present = storage_present(info.drive);
if(removable)
lcd_putsf(0, line++, " removable %spresent", present ? "" : "not ");
if(!present)
continue;
#endif
lcd_putsf(0, line++, " bus: %d sbc: %d", info.bus_width, info.has_sbc);
lcd_putsf(0, line++, " hs: %s", info.hs_enabled ? "enabled" :
info.hs_capable ? "disabled" : "not capable");
}
lcd_update();
yield();
}
}
static struct
{
const char *name;
@ -1215,6 +1276,7 @@ static struct
{"audio", dbg_hw_info_audio},
{"timrot", dbg_hw_info_timrot},
{"button", dbg_hw_info_button},
{"sdmmc", dbg_hw_info_sdmmc},
{"target", dbg_hw_target_info},
};