Skip to content

Commit

Permalink
working a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
vk2seb committed Sep 23, 2023
1 parent e5dba17 commit e58b7a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
32 changes: 22 additions & 10 deletions firmware/litex-fw/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,44 @@ fn default_handler() {
if (pending & (1u32 << pac::Interrupt::DMA_WRITER0 as u32)) != 0 {
let pending_type = peripherals.DMA_WRITER0.ev_pending.read().bits();
let offset = peripherals.DMA_WRITER0.offset.read().bits();
info!("dmaw0 {:x} {:x}", pending_type, offset);
//info!("dmaw0 {:x} {:x}", pending_type, offset);
unsafe {
peripherals.DMA_WRITER0.ev_pending.write(|w| w.bits(pending_type));
}
if 0x10 == offset {
let base = peripherals.DMA_WRITER0.base0.read().bits();
let buf = base as *const u32;

let mut buf_copy: [u32; 0x10] = [0; 0x10];
let base = peripherals.DMA_WRITER0.base0.read().bits();
let buf = base as *const u32;
let mut hi = false;

if offset == 0x10 {
for i in 0..0x10 {
unsafe {
info!("{:x}@{:x}", i, *buf.add(i));
buf_copy[i] = *buf.add(i);
}
}
}

if offset == 0x1f {
let base = peripherals.DMA_WRITER0.base0.read().bits();
let buf = base as *const u32;
for i in 0x10..0x1f {
for i in 0x0..0x10 {
unsafe {
info!("{:x}@{:x}", i, *buf.add(i));
buf_copy[i] = *buf.add(i+0x10);
}
}
hi = true;
}

for i in 0..0x10 {
let mut fac = 0;
if hi {
fac += 0x10;
}
info!("{:x}@{:x}", i+fac, buf_copy[i]);
}
} else if (pending & (1u32 << pac::Interrupt::DMA_READER0 as u32)) != 0 {
let pending_type = peripherals.DMA_READER0.ev_pending.read().bits();
let offset = peripherals.DMA_READER0.offset.read().bits();
info!("dmar0 {:x} {:x}", pending_type, offset);
//info!("dmar0 {:x} {:x}", pending_type, offset);
unsafe {
peripherals.DMA_READER0.ev_pending.write(|w| w.bits(pending_type));
}
Expand Down
1 change: 1 addition & 0 deletions firmware/litex-fw/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const BUF_SZ_BYTES: usize = BUF_SZ_WORDS * 4;
static mut BUF_OUT: [u32; BUF_SZ_WORDS] = [0; BUF_SZ_WORDS];
static mut BUF_IN: [u32; BUF_SZ_WORDS] = [0; BUF_SZ_WORDS];

static mut BUF_IN_CP: [u32; BUF_SZ_WORDS] = [0; BUF_SZ_WORDS]

#[entry]
fn main() -> ! {
Expand Down

0 comments on commit e58b7a0

Please sign in to comment.