fix bp_read.
It was broken since the switch from u8 to u32.
This commit is contained in:
parent
432240162a
commit
56b50f8b62
10
src/lib.rs
10
src/lib.rs
@ -1071,13 +1071,15 @@ where
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
async fn bp_read(&mut self, mut addr: u32, mut data: &mut [u32]) {
|
||||
async fn bp_read(&mut self, mut addr: u32, mut data: &mut [u8]) {
|
||||
// It seems the HW force-aligns the addr
|
||||
// to 2 if data.len() >= 2
|
||||
// to 4 if data.len() >= 4
|
||||
// To simplify, enforce 4-align for now.
|
||||
assert!(addr % 4 == 0);
|
||||
|
||||
let mut buf = [0u32; BACKPLANE_MAX_TRANSFER_SIZE / 4];
|
||||
|
||||
while !data.is_empty() {
|
||||
// Ensure transfer doesn't cross a window boundary.
|
||||
let window_offs = addr & BACKPLANE_ADDRESS_MASK;
|
||||
@ -1097,15 +1099,17 @@ where
|
||||
bus.read(&mut junk).await?;
|
||||
|
||||
// Read data
|
||||
bus.read(&mut data[..len / 4]).await?;
|
||||
bus.read(&mut buf[..(len + 3) / 4]).await?;
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
data[..len].copy_from_slice(&slice8_mut(&mut buf)[..len]);
|
||||
|
||||
// Advance ptr.
|
||||
addr += len as u32;
|
||||
data = &mut data[len / 4..];
|
||||
data = &mut data[len..];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user