More blocking rename

This commit is contained in:
Rasmus Melchior Jacobsen 2023-05-25 22:09:28 +02:00
parent 983f01016b
commit 344e28360f
5 changed files with 10 additions and 10 deletions

View File

@ -92,7 +92,7 @@ impl interrupt::Handler<crate::interrupt::FLASH> for InterruptHandler {
} }
} }
pub(super) fn read_blocking(base: u32, size: u32, offset: u32, bytes: &mut [u8]) -> Result<(), Error> { pub(super) fn blocking_read(base: u32, size: u32, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
if offset + bytes.len() as u32 > size { if offset + bytes.len() as u32 > size {
return Err(Error::Size); return Err(Error::Size);
} }
@ -255,11 +255,11 @@ impl<MODE> embedded_storage::nor_flash::NorFlash for Flash<'_, MODE> {
const ERASE_SIZE: usize = MAX_ERASE_SIZE; const ERASE_SIZE: usize = MAX_ERASE_SIZE;
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> {
self.write_blocking(offset, bytes) self.blocking_write(offset, bytes)
} }
fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> { fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
self.erase_blocking(from, to) self.blocking_erase(from, to)
} }
} }
@ -289,7 +289,7 @@ foreach_flash_region! {
const READ_SIZE: usize = READ_SIZE; const READ_SIZE: usize = READ_SIZE;
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
self.read_blocking(offset, bytes) self.blocking_read(offset, bytes)
} }
fn capacity(&self) -> usize { fn capacity(&self) -> usize {
@ -302,11 +302,11 @@ foreach_flash_region! {
const ERASE_SIZE: usize = $erase_size; const ERASE_SIZE: usize = $erase_size;
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> {
self.write_blocking(offset, bytes) self.blocking_write(offset, bytes)
} }
fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> { fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
self.erase_blocking(from, to) self.blocking_erase(from, to)
} }
} }
}; };

View File

@ -36,7 +36,7 @@ pub(crate) unsafe fn disable_blocking_write() {
pac::FLASH.cr().write(|w| w.set_pg(false)); pac::FLASH.cr().write(|w| w.set_pg(false));
} }
pub(crate) unsafe fn write_blocking(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> {
let mut address = start_address; let mut address = start_address;
for chunk in buf.chunks(2) { for chunk in buf.chunks(2) {
write_volatile(address as *mut u16, u16::from_le_bytes(chunk.try_into().unwrap())); write_volatile(address as *mut u16, u16::from_le_bytes(chunk.try_into().unwrap()));

View File

@ -36,7 +36,7 @@ pub(crate) unsafe fn disable_blocking_write() {
pac::FLASH.cr().write(|w| w.set_pg(false)); pac::FLASH.cr().write(|w| w.set_pg(false));
} }
pub(crate) unsafe fn write_blocking(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> {
let mut address = start_address; let mut address = start_address;
for chunk in buf.chunks(2) { for chunk in buf.chunks(2) {
write_volatile(address as *mut u16, u16::from_le_bytes(chunk.try_into().unwrap())); write_volatile(address as *mut u16, u16::from_le_bytes(chunk.try_into().unwrap()));

View File

@ -57,7 +57,7 @@ pub(crate) unsafe fn disable_blocking_write() {
pac::FLASH.cr().write(|w| w.set_pg(false)); pac::FLASH.cr().write(|w| w.set_pg(false));
} }
pub(crate) unsafe fn write_blocking(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> {
let mut address = start_address; let mut address = start_address;
for val in buf.chunks(4) { for val in buf.chunks(4) {
write_volatile(address as *mut u32, u32::from_le_bytes(val.try_into().unwrap())); write_volatile(address as *mut u32, u32::from_le_bytes(val.try_into().unwrap()));

View File

@ -24,7 +24,7 @@ pub(crate) unsafe fn enable_blocking_write() {
pub(crate) unsafe fn disable_blocking_write() { pub(crate) unsafe fn disable_blocking_write() {
unimplemented!(); unimplemented!();
} }
pub(crate) unsafe fn write_blocking(_start_address: u32, _buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { pub(crate) unsafe fn blocking_write(_start_address: u32, _buf: &[u8; WRITE_SIZE]) -> Result<(), Error> {
unimplemented!(); unimplemented!();
} }
pub(crate) unsafe fn erase_sector_blocking(_sector: &FlashSector) -> Result<(), Error> { pub(crate) unsafe fn erase_sector_blocking(_sector: &FlashSector) -> Result<(), Error> {