integration/soc/sdcard: cleanup emulator integration, fix sim.

This commit is contained in:
Florent Kermarrec 2020-07-07 15:05:07 +02:00
parent 7602977c16
commit 52f36b1257
3 changed files with 11 additions and 8 deletions

View file

@ -1244,23 +1244,24 @@ class LiteXSoC(SoC):
self.add_csr(name)
# Add SDCard -----------------------------------------------------------------------------------
def add_sdcard(self, name="sdcard", with_emulator=False):
def add_sdcard(self, name="sdcard", use_emulator=False):
# Imports
from litesdcard.emulator import SDEmulator
from litesdcard.phy import SDPHY
from litesdcard.core import SDCore
from litesdcard.frontend.dma import SDBlock2MemDMA, SDMem2BlockDMA
# Emulator / Pads
if with_emulator:
from litesdcard.emulator import SDEmulator
self.submodules.sdemulator = SDEmulator(self.platform)
sdcard_pads = self.sdemulator.pads
if use_emulator:
sdemulator = SDEmulator(self.platform)
self.submodules += sdemulator
sdcard_pads = sdemulator.pads
else:
sdcard_pads = self.platform.request(name)
# Core
self.submodules.sdphy = SDPHY(sdcard_pads, self.platform.device, self.clk_freq)
self.submodules.sdcore = SDCore(self.sdphy)
self.submodules.sdphy = SDPHY(sdcard_pads, self.platform.device, self.clk_freq)
self.submodules.sdcore = SDCore(self.sdphy)
self.add_csr("sdphy")
self.add_csr("sdcore")

View file

@ -562,7 +562,9 @@ sdcard_set_block_count(count);
/* Flush CPU caches */
flush_cpu_dcache();
#ifdef CONFIG_L2_SIZE
flush_l2_cache();
#endif
}
void sdcard_write(uint32_t sector, uint32_t count, uint8_t* buf)

View file

@ -309,7 +309,7 @@ class SimSoC(SoCCore):
# SDCard -----------------------------------------------------------------------------------
if with_sdcard:
self.add_sdcard("sdcard", with_emulator=True)
self.add_sdcard("sdcard", use_emulator=True)
# Build --------------------------------------------------------------------------------------------