targets/analog_pocket: Add --video-colorbars/video-terminal/video-framebuffer arguments.

This commit is contained in:
Florent Kermarrec 2023-10-09 10:59:15 +02:00
parent dec25b7ce9
commit 6386f290e9

View file

@ -66,7 +66,11 @@ class _CRG(LiteXModule):
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=50e6, sdram_rate="1:1", **kwargs):
def __init__(self, sys_clk_freq=50e6, sdram_rate="1:1",
with_video_terminal = False,
with_video_framebuffer = False,
with_video_colorbars = False,
**kwargs):
platform = analog_pocket.Platform()
# CRG --------------------------------------------------------------------------------------
@ -87,6 +91,8 @@ class BaseSoC(SoCCore):
# Video ------------------------------------------------------------------------------------
if with_video_colorbars or with_video_framebuffer or with_video_terminal:
from litex.soc.interconnect import stream
from litex.soc.cores.video import video_data_layout
from litex.build.io import SDROutput, DDROutput
@ -124,9 +130,12 @@ class BaseSoC(SoCCore):
)
self.videophy = VideoDDRPHY(platform.request("video"), clock_domain="video")
#self.add_video_colorbars(phy=self.videophy, timings="640x480@60Hz", clock_domain="video")
if with_video_colorbars:
self.add_video_colorbars(phy=self.videophy, timings="640x480@60Hz", clock_domain="video")
if with_video_terminal:
self.add_video_terminal(phy=self.videophy, timings="640x480@60Hz", clock_domain="video")
#self.add_video_framebuffer(phy=self.videophy, timings="640x480@60Hz", clock_domain="video")
if with_video_framebuffer:
self.add_video_framebuffer(phy=self.videophy, timings="640x480@60Hz", clock_domain="video")
# Build --------------------------------------------------------------------------------------------
@ -135,11 +144,18 @@ def main():
parser = LiteXArgumentParser(platform=analog_pocket.Platform, description="LiteX SoC on Analog Pocket.")
parser.add_target_argument("--sys-clk-freq", default=50e6, type=float, help="System clock frequency.")
parser.add_target_argument("--sdram-rate", default="1:1", help="SDRAM Rate (1:1 Full Rate or 1:2 Half Rate).")
viopts = parser.target_group.add_mutually_exclusive_group()
viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal.")
viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer.")
viopts.add_argument("--with-video-colorbars", action="store_true", help="Enable Video Colorbars.")
args = parser.parse_args()
soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq,
sdram_rate = args.sdram_rate,
with_video_terminal = args.with_video_terminal,
with_video_framebuffer = args.with_video_framebuffer,
with_video_colorbars = args.with_video_colorbars,
**parser.soc_argdict
)
builder = Builder(soc, **parser.builder_argdict)