mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-21 21:49:15 +01:00
[SC64][SW] Added SD sector read test
This commit is contained in:
parent
409ba28359
commit
c2dc401393
@ -7,20 +7,31 @@
|
||||
|
||||
static void test_rtc (void) {
|
||||
sc64_rtc_time_t t;
|
||||
const char *weekdays[8] = { "", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
|
||||
const char *weekdays[8] = {
|
||||
"",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
"Sunday",
|
||||
};
|
||||
|
||||
sc64_get_time(&t);
|
||||
|
||||
display_printf("RTC current time:\n");
|
||||
display_printf(" %02d:%02d:%02d", FROM_BCD(t.hour), FROM_BCD(t.minute), FROM_BCD(t.second));
|
||||
display_printf(" %s ", weekdays[FROM_BCD(t.weekday)]);
|
||||
display_printf("%d.%02d.%04d", FROM_BCD(t.day), FROM_BCD(t.month), 2000 + FROM_BCD(t.year));
|
||||
display_printf("RTC current time:\n ");
|
||||
display_printf("%04d-%02d-%02d", 2000 + FROM_BCD(t.year), FROM_BCD(t.month), FROM_BCD(t.day));
|
||||
display_printf("T");
|
||||
display_printf("%02d:%02d:%02d", FROM_BCD(t.hour), FROM_BCD(t.minute), FROM_BCD(t.second));
|
||||
display_printf(" (%s)", weekdays[FROM_BCD(t.weekday)]);
|
||||
display_printf("\n");
|
||||
}
|
||||
|
||||
static void test_sd_card (void) {
|
||||
sc64_sd_card_status_t card_status;
|
||||
uint8_t card_info[32] __attribute__((aligned(8)));
|
||||
uint8_t sector[512] __attribute__((aligned(8)));
|
||||
|
||||
card_status = sc64_sd_card_get_status();
|
||||
|
||||
@ -54,18 +65,36 @@ static void test_sd_card (void) {
|
||||
|
||||
pi_dma_read((io32_t *) (SC64_BUFFERS->BUFFER), card_info, sizeof(card_info));
|
||||
|
||||
display_printf("SD Card registers:\n CSD: 0x");
|
||||
display_printf("SD Card registers:\n CSD: 0x");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
display_printf("%02X", card_info[i]);
|
||||
display_printf("%02X ", card_info[i]);
|
||||
}
|
||||
display_printf("\n CID: 0x");
|
||||
display_printf("\n CID: 0x");
|
||||
for (int i = 16; i < 32; i++) {
|
||||
display_printf("%02X", card_info[i]);
|
||||
display_printf("%02X ", card_info[i]);
|
||||
}
|
||||
display_printf("\n ");
|
||||
display_printf("\n ");
|
||||
for (int i = 16; i < 32; i++) {
|
||||
display_printf("%c ", card_info[i] >= ' ' ? card_info[i] : 0xFF);
|
||||
display_printf(" %c ", card_info[i] >= ' ' ? card_info[i] : 0xFF);
|
||||
}
|
||||
display_printf("\n");
|
||||
|
||||
if (sc64_sd_read_sectors((void *) (SC64_BUFFERS->BUFFER), 0, 1)) {
|
||||
display_printf("SD card read sector 0 error!\n");
|
||||
}
|
||||
|
||||
pi_dma_read((io32_t *) (SC64_BUFFERS->BUFFER), sector, sizeof(sector));
|
||||
|
||||
display_printf("Sector 0 (0x1BE-0x1DD), partition entry 1/2:\n 0x");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
display_printf("%02X ", sector[0x1BE + i]);
|
||||
}
|
||||
display_printf("\n 0x");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
display_printf("%02X ", sector[0x1CE + i]);
|
||||
}
|
||||
display_printf("\n");
|
||||
display_printf(" Boot signature: 0x%02X%02X", sector[510], sector[511]);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user