From 0ec50881f0d749dddb4d40883224e86374d5f7d4 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 4 Jun 2020 11:55:25 +0200 Subject: [PATCH] software/liblitesdcard/sdcard: simplify readSector. --- litex/soc/software/liblitesdcard/sdcard.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/litex/soc/software/liblitesdcard/sdcard.c b/litex/soc/software/liblitesdcard/sdcard.c index 960f20bf..376c9df3 100644 --- a/litex/soc/software/liblitesdcard/sdcard.c +++ b/litex/soc/software/liblitesdcard/sdcard.c @@ -713,34 +713,16 @@ int sdcard_test(unsigned int blocks) return 0; } -// Return values -#define SUCCESS 0x01 -#define FAILURE 0x00 - -// READSECTOR -// Read a 512 byte sector from the SD CARD -// Given SECTORNUMBER and memory STORAGE -// -// Sequence -// Send CMD17 - Read Block -// Command Sequence is DUMMY=0xff CMD17=0x51 SECTORNUMBER (32bit UNSIGNED as bits 32-25,24-17, 16-9, 8-1) CRC=0xff -// Wait for SD CARD to send 0x00 indicating SD CARD is processing -// Wait for SD CARD to send 0xfe indicating SD CARD BLOCK START -// Read 512 bytes -// Read 8 DUMMY bytes -// Return 0 success, 1 failure -// -// Details from https://openlabpro.com/guide/interfacing-microcontrollers-with-sd-card/ section "Read/Write SD Card" uint8_t readSector(uint32_t sectorNumber, uint8_t *storage) { int n; - // FIXME: handle errors, svoid recopy. + // FIXME: handle errors, avoid recopy. sdcard_read(sectorNumber, 1); for(n=0; n