mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2025-01-14 13:39:14 +01:00
70 lines
1.8 KiB
C
70 lines
1.8 KiB
C
#include <stddef.h>
|
|
#include "display.h"
|
|
#include "io.h"
|
|
#include "sc64.h"
|
|
#include "test.h"
|
|
|
|
|
|
bool test_check (void) {
|
|
if (sc64_get_config(CFG_ID_BUTTON_STATE)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void test_execute (void) {
|
|
sd_card_status_t card_status;
|
|
uint8_t card_info[32] __attribute__((aligned(8)));
|
|
|
|
display_init(NULL);
|
|
|
|
display_printf("SC64 Test suite\n\n");
|
|
|
|
card_status = sc64_sd_card_get_status();
|
|
|
|
if (card_status & SD_CARD_STATUS_INSERTED) {
|
|
display_printf("SD card is inserted\n");
|
|
} else {
|
|
display_printf("SD card is not inserted\n");
|
|
}
|
|
|
|
if (sc64_sd_card_init()) {
|
|
display_printf("SD card init error!\n");
|
|
while (1);
|
|
}
|
|
|
|
card_status = sc64_sd_card_get_status();
|
|
|
|
if (card_status & SD_CARD_STATUS_INITIALIZED) {
|
|
display_printf("SD card is initialized\n");
|
|
}
|
|
if (card_status & SD_CARD_STATUS_TYPE_BLOCK) {
|
|
display_printf("SD card type is block\n");
|
|
}
|
|
if (card_status & SD_CARD_STATUS_50MHZ_MODE) {
|
|
display_printf("SD card runs at 50 MHz clock speed\n");
|
|
}
|
|
|
|
if (sc64_sd_card_get_info((uint32_t *) (SC64_BUFFERS->BUFFER))) {
|
|
display_printf("SD card get info error!\n");
|
|
while (1);
|
|
}
|
|
|
|
pi_dma_read((io32_t *) (SC64_BUFFERS->BUFFER), card_info, sizeof(card_info));
|
|
|
|
display_printf("SD Card registers:\n CSD: 0x");
|
|
for (int i = 0; i < 16; i++) {
|
|
display_printf("%02X", card_info[i]);
|
|
}
|
|
display_printf("\n CID: 0x");
|
|
for (int i = 16; i < 32; i++) {
|
|
display_printf("%02X", card_info[i]);
|
|
}
|
|
display_printf("\n ");
|
|
for (int i = 16; i < 32; i++) {
|
|
display_printf("%c ", card_info[i] >= ' ' ? card_info[i] : 0xFF);
|
|
}
|
|
|
|
while (1);
|
|
}
|