From e17a01086666c86cfbcad9e8eb0efa3231a0fe8a Mon Sep 17 00:00:00 2001 From: Christian Klarhorst Date: Tue, 20 Jul 2021 21:40:18 +0200 Subject: [PATCH] soc/add_sdcard: Fix IRQ code, only add IRQs depending on mode --- litex/soc/integration/soc.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 9e5662fdb..658ae5f6e 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1563,14 +1563,18 @@ class LiteXSoC(SoC): # Interrupts. self.submodules.sdirq = EventManager() self.sdirq.card_detect = EventSourcePulse(description="SDCard has been ejected/inserted.") - self.sdirq.block2mem_dma = EventSourcePulse(description="Block2Mem DMA terminated.") - self.sdirq.mem2block_dma = EventSourcePulse(description="Mem2Block DMA terminated.") + if "read" in mode: + self.sdirq.block2mem_dma = EventSourcePulse(description="Block2Mem DMA terminated.") + if "write" in mode: + self.sdirq.mem2block_dma = EventSourcePulse(description="Mem2Block DMA terminated.") self.sdirq.cmd_done = EventSourceLevel(description="Command completed.") self.sdirq.finalize() + if "read" in mode: + self.comb += self.sdirq.block2mem_dma.trigger.eq(self.sdblock2mem.irq) + if "write" in mode: + self.comb += self.sdirq.mem2block_dma.trigger.eq(self.sdmem2block.irq) self.comb += [ self.sdirq.card_detect.trigger.eq(self.sdphy.card_detect_irq), - self.sdirq.block2mem_dma.trigger.eq(self.sdblock2mem.irq), - self.sdirq.mem2block_dma.trigger.eq(self.sdmem2block.irq), self.sdirq.cmd_done.trigger.eq(self.sdcore.cmd_event.fields.done) ] if self.irq.enabled: