integration/soc/add_uart: add USB CDC support (with ValentyUSB core).
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 25 Mar 2020 18:07:06 +0000 (19:07 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 25 Mar 2020 18:07:06 +0000 (19:07 +0100)
litex/soc/integration/soc.py

index 53684fdf74b9546d2c3ce323c09ae9e57d96b038..fb2bfb74d07bffd351de1042d89e7318c5a14900 100644 (file)
@@ -954,6 +954,14 @@ class LiteXSoC(SoC):
                 tx_fifo_depth = fifo_depth,
                 rx_fifo_depth = fifo_depth))
 
+        # USB CDC (with ValentyUSB core)
+        elif name in ["usb_cdc"]:
+            import valentyusb.usbcore.io as usbio
+            import valentyusb.usbcore.cpu.cdc_eptri as cdc_eptri
+            usb_pads = self.platform.request("usb")
+            usb_iobuf = usbio.IoBuf(usb_pads.d_p, usb_pads.d_n, usb_pads.pullup)
+            self.submodules.uart = cdc_eptri.CDCUsb(usb_iobuf)
+
         # Classic UART
         else:
             self.submodules.uart_phy = uart.UARTPHY(