mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
SD debug display more informative card type.
This commit is contained in:
parent
91ae692f90
commit
4c57c1205f
@ -235,8 +235,8 @@ SDCardDebugView::SDCardDebugView(NavigationView& nav) {
|
||||
&text_csd_value_0,
|
||||
&text_bus_width_title,
|
||||
&text_bus_width_value,
|
||||
&text_card_mode_title,
|
||||
&text_card_mode_value,
|
||||
&text_card_type_title,
|
||||
&text_card_type_value,
|
||||
&text_block_size_title,
|
||||
&text_block_size_value,
|
||||
&text_block_count_title,
|
||||
@ -296,7 +296,7 @@ static std::string format_bytes_size_string(uint64_t value) {
|
||||
|
||||
void SDCardDebugView::on_status(const sd_card::Status) {
|
||||
text_bus_width_value.set("");
|
||||
text_card_mode_value.set("");
|
||||
text_card_type_value.set("");
|
||||
text_csd_value_0.set("");
|
||||
text_csd_value_1.set("");
|
||||
text_csd_value_2.set("");
|
||||
@ -321,7 +321,23 @@ void SDCardDebugView::on_status(const sd_card::Status) {
|
||||
}
|
||||
|
||||
text_bus_width_value.set(card_width ? to_string_dec_uint(card_width, 1) : "X");
|
||||
text_card_mode_value.set("0x" + to_string_hex(SDCD1.cardmode, 8));
|
||||
|
||||
// TODO: Implement Text class right-justify!
|
||||
BYTE card_type;
|
||||
disk_ioctl(0, MMC_GET_TYPE, &card_type);
|
||||
|
||||
std::string formatted_card_type;
|
||||
switch(card_type & SDC_MODE_CARDTYPE_MASK) {
|
||||
case SDC_MODE_CARDTYPE_SDV11: formatted_card_type = "SD V1.1"; break;
|
||||
case SDC_MODE_CARDTYPE_SDV20: formatted_card_type = "SD V2.0"; break;
|
||||
case SDC_MODE_CARDTYPE_MMC: formatted_card_type = "MMC"; break;
|
||||
default: formatted_card_type = "???"; break;
|
||||
}
|
||||
|
||||
if( card_type & SDC_MODE_HIGH_CAPACITY ) {
|
||||
formatted_card_type += ", SDHC";
|
||||
}
|
||||
text_card_type_value.set(formatted_card_type);
|
||||
|
||||
std::array<uint32_t, 4> csd;
|
||||
disk_ioctl(0, MMC_GET_CSD, csd.data());
|
||||
|
@ -86,15 +86,15 @@ private:
|
||||
"",
|
||||
};
|
||||
|
||||
static constexpr size_t card_mode_characters = 10;
|
||||
static constexpr size_t card_type_characters = 13;
|
||||
|
||||
Text text_card_mode_title {
|
||||
Text text_card_type_title {
|
||||
{ 0, 6 * 16, (9 * 8), 16 },
|
||||
"Card mode",
|
||||
"Card type",
|
||||
};
|
||||
|
||||
Text text_card_mode_value {
|
||||
{ 240 - (card_mode_characters * 8), 6 * 16, (card_mode_characters * 8), 16 },
|
||||
Text text_card_type_value {
|
||||
{ 240 - (card_type_characters * 8), 6 * 16, (card_type_characters * 8), 16 },
|
||||
"",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user