Changed mutability

This commit is contained in:
pca006132 2020-06-10 12:54:50 +08:00
parent 0ebc4a61c8
commit 5332587de6
4 changed files with 7 additions and 10 deletions

View File

@ -93,14 +93,11 @@ pub fn main_core0() {
}; };
const SIZE: usize = 512 * 2 + 1; const SIZE: usize = 512 * 2 + 1;
let mut sd_card = result.unwrap(); let mut sd_card = result.unwrap();
{
let buffer: [u8; SIZE] = [5; SIZE];
sd_card.write_block(0x0, 2, &buffer).unwrap();
}
let mut buffer: [u8; SIZE] = [0; SIZE]; let mut buffer: [u8; SIZE] = [0; SIZE];
for i in 0..buffer.len() {
buffer[i] = (i % 16) as u8;
}
sd_card.write_block(0x0, 2, &mut buffer).unwrap();
for i in 0..buffer.len() {
buffer[i] = 0;
}
sd_card.read_block(0x1, 2, &mut buffer[1..]).unwrap(); sd_card.read_block(0x1, 2, &mut buffer[1..]).unwrap();
for i in 0..buffer.len() { for i in 0..buffer.len() {
info!("buffer[{}] = {}", i, buffer[i]); info!("buffer[{}] = {}", i, buffer[i]);

View File

@ -62,7 +62,7 @@ impl Adma2Desc32 {
} }
} }
pub fn setup_adma2_descr32(sdio: &mut SDIO, blk_cnt: u32, buffer: &mut [u8]) { pub fn setup_adma2_descr32(sdio: &mut SDIO, blk_cnt: u32, buffer: &[u8]) {
let descr_table = unsafe { &mut ADMA2_DESCR32_TABLE }; let descr_table = unsafe { &mut ADMA2_DESCR32_TABLE };
let blk_size = sdio let blk_size = sdio
.regs .regs

View File

@ -241,7 +241,7 @@ impl SdCard {
&mut self, &mut self,
address: u32, address: u32,
block_cnt: u16, block_cnt: u16,
buffer: &mut [u8], buffer: &[u8],
) -> Result<(), CmdTransferError> { ) -> Result<(), CmdTransferError> {
assert!(buffer.len() >= (block_cnt as usize) * 512); assert!(buffer.len() >= (block_cnt as usize) * 512);
// set block size if not set already // set block size if not set already

View File

@ -112,7 +112,7 @@ pub fn dcci<T>(object: &T) {
} }
} }
pub fn dcci_slice<T>(slice: &mut [T]) { pub fn dcci_slice<T>(slice: &[T]) {
for addr in slice_cache_line_addrs(slice) { for addr in slice_cache_line_addrs(slice) {
dccimvac(addr); dccimvac(addr);
} }