change default disk size to 256kiB, mostly to economize on RAM

since we don't have a clear use case for this yet and it's just
for testing on bleeding-edge, make a very small disk just so it's
easier for people to do testing, but not so big that it's a burden
on the system.

later on we can make this dynamically sizeable/allocateable only
e.g., only when the disk is required
This commit is contained in:
bunnie 2023-01-14 00:07:11 +08:00
parent c67a32b28c
commit 26f12990f1

View file

@ -1,5 +1,6 @@
use xous::MemoryRange;
const CAPACITY: usize = 256 * 1024; // must be a multiple of one page (4096)
pub struct BlockDevice{
backing: MemoryRange,
}
@ -8,7 +9,7 @@ impl BlockDevice {
let mut backing = xous::syscall::map_memory(
None,
None,
512 * 1024,
CAPACITY,
xous::MemoryFlags::R | xous::MemoryFlags::W,
).unwrap();
let backing_slice: &mut [u32] = backing.as_slice_mut();
@ -37,6 +38,6 @@ impl usbd_scsi::BlockDevice for BlockDevice {
}
fn max_lba(&self) -> u32 {
1023
(CAPACITY / Self::BLOCK_BYTES) as u32 - 1
}
}