From 385efb25114ab3e7b1027ccfb6508952d98e18a9 Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Sun, 10 Apr 2022 19:34:38 -0500 Subject: [PATCH] Read some data off of the sd card These series of commands are enough to read the first 512b block off of the sd card. The RCA is hard coded to the sd card that I have on hand, since response codes are not supported --- sw/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sw/main.c b/sw/main.c index aea99c8..81e6cd6 100644 --- a/sw/main.c +++ b/sw/main.c @@ -47,8 +47,20 @@ int main() { cprintf("Reading from 0x4000: %x\n", *(unsigned int*)(0x4000)); cprintf("Reading from 0x5000: %x\n", *(unsigned int*)(0x5000)); + // This will read a 512 block from the sd card. + // The RCA is hard coded for the one that I have on hand as responses + // are not implemented yet. sd_card_command(0, 0); sd_card_command(0x000001aa, 8); + sd_card_command(0, 55); + sd_card_command(0x40180000, 41); + sd_card_command(0, 55); + sd_card_command(0x40180000, 41); + sd_card_command(0, 2); + sd_card_command(0, 3); + sd_card_command(0x59b40000, 7); + sd_card_command(0x59b41000, 13); + sd_card_command(0, 17); while (1) {