diff --git a/deps/litex b/deps/litex index 2bf54c2..1dccf57 160000 --- a/deps/litex +++ b/deps/litex @@ -1 +1 @@ -Subproject commit 2bf54c2d20b4cdc4fbdba82d49e3183146ac067b +Subproject commit 1dccf57a8a17b26c4c936ec717d6bfb90306839f diff --git a/deps/litex_boards b/deps/litex_boards index 3903cde..2e3e4d9 160000 --- a/deps/litex_boards +++ b/deps/litex_boards @@ -1 +1 @@ -Subproject commit 3903cdee9223bda126a926bf3b10accee395d1c9 +Subproject commit 2e3e4d97b1a08aa0f2d6c4bc49ce2ede9348d0bd diff --git a/example-ecpix-5.py b/example-ecpix-5.py index 06123ac..d328159 100755 --- a/example-ecpix-5.py +++ b/example-ecpix-5.py @@ -68,6 +68,7 @@ def main(): device = args.device, sys_clk_freq = args.sys_clk_freq, toolchain = args.toolchain, + with_video_framebuffer = True, **parser.soc_argdict ) diff --git a/firmware/litex-fw/src/main.rs b/firmware/litex-fw/src/main.rs index 4bb8650..1a6d62d 100644 --- a/firmware/litex-fw/src/main.rs +++ b/firmware/litex-fw/src/main.rs @@ -50,6 +50,10 @@ static mut LAST_RDAT: u32 = 0; // TODO: ideally fetch this from the svf, its currently not exported by `svd2rust`! riscv::plic_context!(PLIC0, 0xf0c00000, 0, VexInterrupt, VexPriority); +const FB_SIZE_X: usize = 720; +const FB_SIZE_Y: usize = 720; +static mut FB: Aligned = Aligned([0u32; FB_SIZE_X*FB_SIZE_Y]); + // Create the HAL bindings for the remaining LiteX peripherals. litex_hal::uart! { @@ -90,6 +94,10 @@ unsafe fn irq_handler() { LAST_CH0 = ch0raw; LAST_CH1 = ch1raw; + + let ix = ((ch0raw as i32 * (FB_SIZE_X) as i32) >> 16) as usize; + let iy = ((ch1raw as i32 * (FB_SIZE_Y) as i32) >> 16) as usize; + FB[(FB_SIZE_Y*(iy+FB_SIZE_Y/2)) + (ix+FB_SIZE_X/4)] = 0xFF; } peripherals.EURORACK_PMOD0.ev_pending().write(|w| w.bits(pending_subtype)); @@ -128,6 +136,9 @@ fn main() -> ! { plic.set_priority(dma_irq, VexPriority::from(1)); plic.enable_interrupt(dma_irq); + peripherals.VIDEO_FRAMEBUFFER.dma_base().write(|w| w.bits(FB.as_mut_ptr() as u32)); + peripherals.VIDEO_FRAMEBUFFER.dma_enable().write(|w| w.bits(1u32)); + // Enable machine external interrupts (basically everything added on by LiteX). riscv::register::mie::set_mext(); @@ -137,6 +148,7 @@ fn main() -> ! { loop { unsafe { + /* log::info!("rdat: {:x}", LAST_RDAT); log::info!("ch0: {}", LAST_CH0); log::info!("ch1: {}", LAST_CH1); @@ -147,6 +159,13 @@ fn main() -> ! { if LAST_IRQ_PERIOD != 0 { log::info!("irq_load_percent: {}", (LAST_IRQ_LEN * 100) / LAST_IRQ_PERIOD); } + */ + + /* + for p in 0..(FB_SIZE_X*FB_SIZE_Y) { + FB[p] = 0;//(FB[p] >> 1); + } + */ } timer.delay_ms(500u32);