exo: read first two sd card sectors in mariko_fatal

This commit is contained in:
Michael Scire 2020-11-15 13:31:01 -08:00 committed by SciresM
parent 7bcd5c6e3b
commit 898fe61034
6 changed files with 67 additions and 13 deletions

View file

@ -18,6 +18,12 @@
namespace ams::secmon::fatal {
namespace {
constinit u8 g_test_buffer[sdmmc::SectorSize * 2];
}
void Main() {
/* Set library register addresses. */
actmon::SetRegisterAddress(MemoryRegionVirtualDeviceActivityMonitor.GetAddress());
@ -43,6 +49,20 @@ namespace ams::secmon::fatal {
Result result = InitializeSdCard();
AMS_SECMON_LOG("InitializeSdCard: %08x\n", result.GetValue());
/* Get the connection status. */
sdmmc::SpeedMode speed_mode;
sdmmc::BusWidth bus_width;
result = CheckSdCardConnection(std::addressof(speed_mode), std::addressof(bus_width));
AMS_SECMON_LOG("CheckSdCardConnection: %08x\n", result.GetValue());
AMS_SECMON_LOG(" Speed Mode: %u\n", static_cast<u32>(speed_mode));
AMS_SECMON_LOG(" Bus Width: %u\n", static_cast<u32>(bus_width));
/* Read the first two sectors from the SD Card. */
std::memset(g_test_buffer, 0xCC, sizeof(g_test_buffer));
result = ReadSdCard(g_test_buffer, sizeof(g_test_buffer), 0, sizeof(g_test_buffer) / sdmmc::SectorSize);
AMS_SECMON_LOG("ReadSdCard: %08x\n", result.GetValue());
AMS_DUMP(g_test_buffer, sizeof(g_test_buffer));
/* TODO */
AMS_INFINITE_LOOP();
}