Removed convenience storage and deref access to MoonbootManager

This commit is contained in:
Wouter Geraedts 2022-07-11 20:10:40 +02:00
parent 3d7a4b7cfb
commit 34e6326482

View file

@ -127,79 +127,3 @@ impl<CONTEXT: Context, const INTERNAL_PAGE_SIZE: usize>
self.processor.do_jump(bootloader_address)
}
}
// /// Easily get read access to the update bank
// impl<
// InternalMemory: Storage,
// HardwareState: State,
// PROCESSOR: Processor,
// const INTERNAL_PAGE_SIZE: usize,
// > core::convert::AsRef<[u8]>
// for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
// {
// #[inline]
// fn as_ref(&self) -> &[u8] {
// unsafe {
// core::slice::from_raw_parts(
// self.config.update_bank.location as *const u8,
// self.config.update_bank.size as usize,
// )
// }
// }
// }
// /// Read Access to the current update target slot
// impl<
// InternalMemory: Storage,
// HardwareState: State,
// CPU: Processor,
// const INTERNAL_PAGE_SIZE: usize,
// > ReadStorage for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
// {
// type Error = (); // TODO
// fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
// let bank = self.config.update_bank; // For now we always write updates to this bank.
// if offset > bank.size || offset + bytes.len() as u32 > bank.size {
// Err(()) // TODO: We want better error types!
// } else {
// // TODO! fix
// let bank_start = bank.location;
// log::info!("Writing at {:x}[{:x}]", bank_start, offset);
// match bank.memory_unit {
// crate::hardware::MemoryUnit::Internal => {
// { self.storage.read(bank_start + offset, bytes) }.map_err(|_| ())
// }
// }
// }
// }
// fn capacity(&self) -> usize {
// self.config.update_bank.size as usize
// }
// }
// /// Write Access to the current update target slot
// impl<
// InternalMemory: Storage,
// HardwareState: State,
// CPU: Processor,
// const INTERNAL_PAGE_SIZE: usize,
// > Storage for MoonbootManager<InternalMemory, HardwareState, CPU, INTERNAL_PAGE_SIZE>
// {
// fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> {
// let bank = self.config.update_bank; // For now we always write updates to this bank.
// if offset > bank.size || offset + bytes.len() as u32 > bank.size {
// Err(()) // TODO: We want better error types!
// } else {
// // TODO! fix
// let bank_start = bank.location;
// log::info!("Writing at {:x}[{:x}]", bank_start, offset);
// match bank.memory_unit {
// crate::hardware::MemoryUnit::Internal => {
// { self.internal_memory.write(bank_start + offset, bytes) }.map_err(|_| ())
// }
// }
// }
// }
// }