trellisboard: Add Video Terminal/Framebuffer support and use new I2C init feature to automatically configure TP410 at startup.
This commit is contained in:
parent
4251cfa865
commit
7f4d464f1b
|
@ -200,14 +200,13 @@ _io = [
|
|||
|
||||
# HDMI
|
||||
("hdmi", 0,
|
||||
Subsignal("d", Pins(
|
||||
"C11 A11 B11 A10 B10 C10 A8 B7",
|
||||
"B8 A7 C8 C9 F11 E11 E10 D10",
|
||||
"F10 F9 D9 D8 C7 F8 E8 D11")),
|
||||
Subsignal("de", Pins("F14")),
|
||||
Subsignal("clk", Pins("A9")),
|
||||
Subsignal("vsync", Pins("E14")),
|
||||
Subsignal("hsync", Pins("F13")),
|
||||
Subsignal("r", Pins("F10 F9 D9 D8 C7 F8 E8 D11")),
|
||||
Subsignal("g", Pins("B8 A7 C8 C9 F11 E11 E10 D10")),
|
||||
Subsignal("b", Pins("C11 A11 B11 A10 B10 C10 A8 B7")),
|
||||
Subsignal("de", Pins("F14")),
|
||||
Subsignal("clk", Pins("A9")),
|
||||
Subsignal("vsync_n", Pins("E14")),
|
||||
Subsignal("hsync_n", Pins("F13")),
|
||||
Subsignal("sda", Pins("D13")),
|
||||
Subsignal("scl", Pins("C13")),
|
||||
IOStandard("LVCMOS33")
|
||||
|
|
|
@ -21,6 +21,8 @@ from litex.soc.integration.soc_core import *
|
|||
from litex.soc.integration.builder import *
|
||||
from litex.soc.cores.led import LedChaser
|
||||
from litex.soc.cores.gpio import GPIOTristate
|
||||
from litex.soc.cores.video import VideoDVIPHY
|
||||
from litex.soc.cores.bitbang import I2CMaster
|
||||
|
||||
from litedram.modules import MT41J256M16
|
||||
from litedram.phy import ECP5DDRPHY
|
||||
|
@ -112,8 +114,13 @@ class _CRGSDRAM(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", with_ethernet=False,
|
||||
with_led_chaser=True, with_pmod_gpio=False, **kwargs):
|
||||
def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis",
|
||||
with_ethernet = False,
|
||||
with_video_terminal = False,
|
||||
with_video_framebuffer = False,
|
||||
with_led_chaser = True,
|
||||
with_pmod_gpio = False,
|
||||
**kwargs):
|
||||
platform = trellisboard.Platform(toolchain=toolchain)
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
|
@ -145,6 +152,22 @@ class BaseSoC(SoCCore):
|
|||
pads = self.platform.request("eth"))
|
||||
self.add_ethernet(phy=self.ethphy)
|
||||
|
||||
# HDMI -------------------------------------------------------------------------------------
|
||||
if with_video_terminal or with_video_framebuffer:
|
||||
# PHY + TP410 I2C initialization.
|
||||
hdmi_pads = platform.request("hdmi")
|
||||
self.submodules.videophy = VideoDVIPHY(hdmi_pads, clock_domain="init")
|
||||
self.submodules.hdmi_i2c = I2CMaster(hdmi_pads)
|
||||
self.add_i2c_init_table("hdmi_i2c", i2c_addr=0x38, table=[
|
||||
(0x08, 0x35) # CTL_1_MODE: Normal operation, 24-bit, HSYNC/VSYNC.
|
||||
])
|
||||
|
||||
# Video Terminal/Framebuffer.
|
||||
if with_video_terminal:
|
||||
self.add_video_terminal(phy=self.videophy, timings="640x480@75Hz", clock_domain="init")
|
||||
if with_video_framebuffer:
|
||||
self.add_video_framebuffer(phy=self.videophy, timings="640x480@75Hz", clock_domain="init")
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
self.submodules.leds = LedChaser(
|
||||
|
@ -165,19 +188,24 @@ def main():
|
|||
parser.add_argument("--toolchain", default="trellis", help="FPGA toolchain (trellis or diamond).")
|
||||
parser.add_argument("--sys-clk-freq", default=75e6, help="System clock frequency.")
|
||||
parser.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
|
||||
viopts = parser.add_mutually_exclusive_group()
|
||||
viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
|
||||
viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (HDMI).")
|
||||
sdopts = parser.add_mutually_exclusive_group()
|
||||
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support.")
|
||||
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
|
||||
parser.add_argument("--with-pmod-gpio", action="store_true", help="Enable GPIOs through PMOD.") # FIXME: Temporary test.
|
||||
parser.add_argument("--with-pmod-gpio", action="store_true", help="Enable GPIOs through PMOD.") # FIXME: Temporary test.
|
||||
builder_args(parser)
|
||||
soc_core_args(parser)
|
||||
trellis_args(parser)
|
||||
args = parser.parse_args()
|
||||
|
||||
soc = BaseSoC(
|
||||
sys_clk_freq = int(float(args.sys_clk_freq)),
|
||||
with_ethernet = args.with_ethernet,
|
||||
with_pmod_gpio = args.with_pmod_gpio,
|
||||
sys_clk_freq = int(float(args.sys_clk_freq)),
|
||||
with_ethernet = args.with_ethernet,
|
||||
with_video_terminal = args.with_video_terminal,
|
||||
with_video_framebuffer = args.with_video_framebuffer,
|
||||
with_pmod_gpio = args.with_pmod_gpio,
|
||||
**soc_core_argdict(args)
|
||||
)
|
||||
if args.with_spi_sdcard:
|
||||
|
|
Loading…
Reference in New Issue