Add software support for sd response codes
Polls the sd controller until the read flag is set, at which point it reads 32 bits of data from the controller. long response codes (such as CID) are not supported in hw or sw.
This commit is contained in:
59
sw/main.c
59
sw/main.c
@@ -7,13 +7,14 @@
|
||||
#include "sd_card.h"
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
uint8_t sw;
|
||||
char s[16];
|
||||
s[15] = 0;
|
||||
int i;
|
||||
uint8_t sw;
|
||||
uint32_t resp;
|
||||
char s[16];
|
||||
s[15] = 0;
|
||||
|
||||
clrscr();
|
||||
cprintf("Hello, world!\n");
|
||||
clrscr();
|
||||
cprintf("Hello, world!\n");
|
||||
|
||||
for (i = 0; i < 16; i++){
|
||||
cprintf("Mapping %1xxxx to %2xxxx\n", i, i);
|
||||
@@ -51,29 +52,53 @@ int main() {
|
||||
// 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_resp(&resp);
|
||||
cprintf("CMD8: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 55);
|
||||
sd_card_command(0x40180000, 41);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD41: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 55);
|
||||
sd_card_command(0x40180000, 41);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD41: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 2);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD2: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 3);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD3: %lx\n", resp);
|
||||
|
||||
sd_card_command(0x59b40000, 7);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD7: %lx\n", resp);
|
||||
|
||||
sd_card_command(0x59b41000, 13);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD13: %lx\n", resp);
|
||||
|
||||
sd_card_command(0, 17);
|
||||
sd_card_resp(&resp);
|
||||
cprintf("CMD17: %lx\n", resp);
|
||||
|
||||
while (1) {
|
||||
while (1) {
|
||||
|
||||
sw = sw_read();
|
||||
led_set(sw);
|
||||
sw = sw_read();
|
||||
led_set(sw);
|
||||
|
||||
cscanf("%15s", s);
|
||||
cprintf("\n");
|
||||
for (i = 0; i < 16; i++)
|
||||
cprintf("s[%d]=%c ", i, s[i]);
|
||||
cprintf("\n");
|
||||
cprintf("Read string: %s\n", s);
|
||||
}
|
||||
cscanf("%15s", s);
|
||||
cprintf("\n");
|
||||
for (i = 0; i < 16; i++)
|
||||
cprintf("s[%d]=%c ", i, s[i]);
|
||||
cprintf("\n");
|
||||
cprintf("Read string: %s\n", s);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user