From 26f12990f15a01dda780df765a3c6b4650d53f79 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 14 Jan 2023 00:07:11 +0800 Subject: [PATCH] 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 --- services/usb-device-xous/src/block_device.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/usb-device-xous/src/block_device.rs b/services/usb-device-xous/src/block_device.rs index f58a83fa3..e71359fc7 100644 --- a/services/usb-device-xous/src/block_device.rs +++ b/services/usb-device-xous/src/block_device.rs @@ -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 } } \ No newline at end of file