From c07703124faa16274eb014502bc3614da6c82e5c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 25 Jun 2020 13:46:39 +0200 Subject: [PATCH] liblitesdcard/sdcard_read: enable multiple block read. >10MB/s read speed with a 25MHz clock. --- litex/soc/software/liblitesdcard/sdcard.c | 29 ++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/litex/soc/software/liblitesdcard/sdcard.c b/litex/soc/software/liblitesdcard/sdcard.c index 1329433d..b3281959 100644 --- a/litex/soc/software/liblitesdcard/sdcard.c +++ b/litex/soc/software/liblitesdcard/sdcard.c @@ -484,25 +484,22 @@ int sdcard_init(void) { void sdcard_read(uint32_t sector, uint32_t count, uint8_t* buf) { - uint32_t i; - for (i=0; i 0) + sdcard_read_multiple_block(sector, count); + else sdcard_read_single_block(sector); - /* Wait for DMA Writer to complete */ - while ((sdreader_done_read() & 0x1) == 0); + /* Wait for DMA Writer to complete */ + while ((sdreader_done_read() & 0x1) == 0); - /* Update buf/sector */ - buf += 512; - sector += 1; - } flush_cpu_dcache(); /* FIXME */ } -- 2.30.2