Merge pull request #975 from cklarhorst/master

soc/add_sdcard: Fix IRQ code, only add IRQs depending on mode
This commit is contained in:
enjoy-digital 2021-07-21 11:57:21 +02:00 committed by GitHub
commit a782596513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -1563,14 +1563,18 @@ class LiteXSoC(SoC):
# Interrupts.
self.submodules.sdirq = EventManager()
self.sdirq.card_detect = EventSourcePulse(description="SDCard has been ejected/inserted.")
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: