diff --git a/firmware/application/ui_sd_card_debug.cpp b/firmware/application/ui_sd_card_debug.cpp index f07982e4..a340c26b 100644 --- a/firmware/application/ui_sd_card_debug.cpp +++ b/firmware/application/ui_sd_card_debug.cpp @@ -27,6 +27,7 @@ #include "lfsr_random.hpp" #include "ff.h" +#include "diskio.h" #include "ch.h" #include "hal.h" @@ -227,12 +228,15 @@ namespace ui { SDCardDebugView::SDCardDebugView(NavigationView& nav) { add_children({ { &text_title, + &text_csd_title, + &text_csd_value_3, + &text_csd_value_2, + &text_csd_value_1, + &text_csd_value_0, &text_bus_width_title, &text_bus_width_value, &text_card_mode_title, &text_card_mode_value, - // &text_csd_title, - // &text_csd_value, &text_block_size_title, &text_block_size_value, &text_block_count_title, @@ -293,7 +297,10 @@ 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_csd_value.set(""); + text_csd_value_0.set(""); + text_csd_value_1.set(""); + text_csd_value_2.set(""); + text_csd_value_3.set(""); text_block_size_value.set(""); text_block_count_value.set(""); text_capacity_value.set(""); @@ -315,7 +322,13 @@ 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)); - // text_csd_value.set("0x" + to_string_hex(SDCD1.csd, 8)); + + std::array csd; + disk_ioctl(0, MMC_GET_CSD, csd.data()); + text_csd_value_3.set(to_string_hex(csd[3], 8)); + text_csd_value_2.set(to_string_hex(csd[2], 8)); + text_csd_value_1.set(to_string_hex(csd[1], 8)); + text_csd_value_0.set(to_string_hex(csd[0], 8)); BlockDeviceInfo block_device_info; if( sdcGetInfo(&SDCD1, &block_device_info) == CH_SUCCESS ) { diff --git a/firmware/application/ui_sd_card_debug.hpp b/firmware/application/ui_sd_card_debug.hpp index 86ab36bb..80e37468 100644 --- a/firmware/application/ui_sd_card_debug.hpp +++ b/firmware/application/ui_sd_card_debug.hpp @@ -49,6 +49,31 @@ private: "SD Card", }; + Text text_csd_title { + { 0, 3 * 16, (8 * 8), 16 }, + "CSD", + }; + + Text text_csd_value_3 { + { 240 - ((8 + 1 + 8) * 8), 3 * 16, (8 * 8), 16 }, + "", + }; + + Text text_csd_value_2 { + { 240 - (8 * 8), 3 * 16, (8 * 8), 16 }, + "", + }; + + Text text_csd_value_1 { + { 240 - ((8 + 1 + 8) * 8), 4 * 16, (8 * 8), 16 }, + "", + }; + + Text text_csd_value_0 { + { 240 - (8 * 8), 4 * 16, (8 * 8), 16 }, + "", + }; + static constexpr size_t bus_width_characters = 1; Text text_bus_width_title { @@ -73,18 +98,6 @@ private: "", }; - // static constexpr size_t csd_characters = 10; - - // Text text_csd_title { - // { 0, 7 * 16, (3 * 8), 16 }, - // "CSD", - // }; - - // Text text_csd_value { - // { 240 - (csd_characters * 8), 7 * 16, (csd_characters * 8), 16 }, - // "", - // }; - static constexpr size_t block_size_characters = 5; Text text_block_size_title {