SD debug display CSD value.

This commit is contained in:
Jared Boone 2016-05-09 22:44:50 -07:00
parent cc9c5acc3c
commit 91ae692f90
2 changed files with 42 additions and 16 deletions

View File

@ -27,6 +27,7 @@
#include "lfsr_random.hpp" #include "lfsr_random.hpp"
#include "ff.h" #include "ff.h"
#include "diskio.h"
#include "ch.h" #include "ch.h"
#include "hal.h" #include "hal.h"
@ -227,12 +228,15 @@ namespace ui {
SDCardDebugView::SDCardDebugView(NavigationView& nav) { SDCardDebugView::SDCardDebugView(NavigationView& nav) {
add_children({ { add_children({ {
&text_title, &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_title,
&text_bus_width_value, &text_bus_width_value,
&text_card_mode_title, &text_card_mode_title,
&text_card_mode_value, &text_card_mode_value,
// &text_csd_title,
// &text_csd_value,
&text_block_size_title, &text_block_size_title,
&text_block_size_value, &text_block_size_value,
&text_block_count_title, &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) { void SDCardDebugView::on_status(const sd_card::Status) {
text_bus_width_value.set(""); text_bus_width_value.set("");
text_card_mode_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_size_value.set("");
text_block_count_value.set(""); text_block_count_value.set("");
text_capacity_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_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_card_mode_value.set("0x" + to_string_hex(SDCD1.cardmode, 8));
// text_csd_value.set("0x" + to_string_hex(SDCD1.csd, 8));
std::array<uint32_t, 4> 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; BlockDeviceInfo block_device_info;
if( sdcGetInfo(&SDCD1, &block_device_info) == CH_SUCCESS ) { if( sdcGetInfo(&SDCD1, &block_device_info) == CH_SUCCESS ) {

View File

@ -49,6 +49,31 @@ private:
"SD Card", "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; static constexpr size_t bus_width_characters = 1;
Text text_bus_width_title { 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; static constexpr size_t block_size_characters = 5;
Text text_block_size_title { Text text_block_size_title {