integration/soc/add_uart: cleanup.
This commit is contained in:
parent
5bcf730c77
commit
3f43c6a223
|
@ -912,33 +912,51 @@ class LiteXSoC(SoC):
|
||||||
# Add UART -------------------------------------------------------------------------------------
|
# Add UART -------------------------------------------------------------------------------------
|
||||||
def add_uart(self, name, baudrate=115200, fifo_depth=16):
|
def add_uart(self, name, baudrate=115200, fifo_depth=16):
|
||||||
from litex.soc.cores import uart
|
from litex.soc.cores import uart
|
||||||
|
|
||||||
|
# Stub / Stream
|
||||||
if name in ["stub", "stream"]:
|
if name in ["stub", "stream"]:
|
||||||
self.submodules.uart = uart.UART(tx_fifo_depth=0, rx_fifo_depth=0)
|
self.submodules.uart = uart.UART(tx_fifo_depth=0, rx_fifo_depth=0)
|
||||||
if name == "stub":
|
if name == "stub":
|
||||||
self.comb += self.uart.sink.ready.eq(1)
|
self.comb += self.uart.sink.ready.eq(1)
|
||||||
elif name == "bridge":
|
|
||||||
|
# Bridge
|
||||||
|
elif name in ["bridge"]:
|
||||||
self.submodules.uart = uart.UARTWishboneBridge(
|
self.submodules.uart = uart.UARTWishboneBridge(
|
||||||
pads = self.platform.request("serial"),
|
pads = self.platform.request("serial"),
|
||||||
clk_freq = self.sys_clk_freq,
|
clk_freq = self.sys_clk_freq,
|
||||||
baudrate = baudrate)
|
baudrate = baudrate)
|
||||||
self.bus.add_master(name="uart_bridge", master=self.uart.wishbone)
|
self.bus.add_master(name="uart_bridge", master=self.uart.wishbone)
|
||||||
elif name == "crossover":
|
|
||||||
|
# Crossover
|
||||||
|
elif name in ["crossover"]:
|
||||||
self.submodules.uart = uart.UARTCrossover()
|
self.submodules.uart = uart.UARTCrossover()
|
||||||
else:
|
|
||||||
if name == "jtag_atlantic":
|
# JTAG Atlantic
|
||||||
from litex.soc.cores.jtag import JTAGAtlantic
|
elif name in ["jtag_atlantic"]:
|
||||||
self.submodules.uart_phy = JTAGAtlantic()
|
from litex.soc.cores.jtag import JTAGAtlantic
|
||||||
elif name == "jtag_uart":
|
self.submodules.uart_phy = JTAGAtlantic()
|
||||||
from litex.soc.cores.jtag import JTAGPHY
|
|
||||||
self.submodules.uart_phy = JTAGPHY(device=self.platform.device)
|
|
||||||
else:
|
|
||||||
self.submodules.uart_phy = uart.UARTPHY(
|
|
||||||
pads = self.platform.request(name),
|
|
||||||
clk_freq = self.sys_clk_freq,
|
|
||||||
baudrate = baudrate)
|
|
||||||
self.submodules.uart = ResetInserter()(uart.UART(self.uart_phy,
|
self.submodules.uart = ResetInserter()(uart.UART(self.uart_phy,
|
||||||
tx_fifo_depth = fifo_depth,
|
tx_fifo_depth = fifo_depth,
|
||||||
rx_fifo_depth = fifo_depth))
|
rx_fifo_depth = fifo_depth))
|
||||||
|
|
||||||
|
# JTAG UART
|
||||||
|
elif name in ["jtag_uart"]:
|
||||||
|
from litex.soc.cores.jtag import JTAGPHY
|
||||||
|
self.submodules.uart_phy = JTAGPHY(device=self.platform.device)
|
||||||
|
self.submodules.uart = ResetInserter()(uart.UART(self.uart_phy,
|
||||||
|
tx_fifo_depth = fifo_depth,
|
||||||
|
rx_fifo_depth = fifo_depth))
|
||||||
|
|
||||||
|
# Classic UART
|
||||||
|
else:
|
||||||
|
self.submodules.uart_phy = uart.UARTPHY(
|
||||||
|
pads = self.platform.request(name),
|
||||||
|
clk_freq = self.sys_clk_freq,
|
||||||
|
baudrate = baudrate)
|
||||||
|
self.submodules.uart = ResetInserter()(uart.UART(self.uart_phy,
|
||||||
|
tx_fifo_depth = fifo_depth,
|
||||||
|
rx_fifo_depth = fifo_depth))
|
||||||
|
|
||||||
self.csr.add("uart_phy", use_loc_if_exists=True)
|
self.csr.add("uart_phy", use_loc_if_exists=True)
|
||||||
self.csr.add("uart", use_loc_if_exists=True)
|
self.csr.add("uart", use_loc_if_exists=True)
|
||||||
self.irq.add("uart", use_loc_if_exists=True)
|
self.irq.add("uart", use_loc_if_exists=True)
|
||||||
|
|
Loading…
Reference in New Issue