pub struct Flash<'d, MODE = Async> { /* private fields */ }Expand description
Internal flash memory driver.
Implementations§
Source§impl<'d> Flash<'d, Blocking>
impl<'d> Flash<'d, Blocking>
Sourcepub fn new_blocking(p: Peri<'d, FLASH>) -> Self
pub fn new_blocking(p: Peri<'d, FLASH>) -> Self
Create a new flash driver, usable in blocking mode.
Source§impl<'d, MODE> Flash<'d, MODE>
impl<'d, MODE> Flash<'d, MODE>
Sourcepub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking>
pub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking>
Split this flash driver into one instance per flash memory region.
See module-level documentation for details on how memory regions work.
Sourcepub fn blocking_read(
&mut self,
offset: u32,
bytes: &mut [u8],
) -> Result<(), Error>
pub fn blocking_read( &mut self, offset: u32, bytes: &mut [u8], ) -> Result<(), Error>
Blocking read.
NOTE: offset is an offset from the flash start, NOT an absolute address.
For example, to read address 0x0800_1234 you have to use offset 0x1234.
Source§impl<'d> Flash<'d, Blocking>
impl<'d> Flash<'d, Blocking>
Sourcepub fn edata_is_enabled(&self) -> bool
pub fn edata_is_enabled(&self) -> bool
Returns whether the EDATA area is enabled by the option bytes.
Sourcepub fn edata_read(
&self,
bank: EDataBank,
offset: u32,
output: &mut [u8],
) -> Result<(), Error>
pub fn edata_read( &self, bank: EDataBank, offset: u32, output: &mut [u8], ) -> Result<(), Error>
Reads output.len() bytes from an EDATA bank.
offset is a byte offset from the beginning of the selected physical
bank and does not need to be aligned to 2 bytes.
§Hardware behavior
EDATA associates ECC information with each aligned 16-bit word. Although this function accepts unaligned byte ranges, it reads the aligned 16-bit word containing each requested byte.
Reading a virgin EDATA word, such as a word that has not been programmed since the page was erased, raises a double ECC error. Therefore, callers should ensure that every 16-bit word touched by the requested range has been programmed before reading it.
See RM0522, “Error correction codes (ECC).”
Sourcepub fn edata_read_u16(&self, bank: EDataBank, offset: u32) -> Result<u16, Error>
pub fn edata_read_u16(&self, bank: EDataBank, offset: u32) -> Result<u16, Error>
Reads a 16-bit value from an EDATA bank.
offset is a byte offset from the beginning of the selected physical
bank and must be aligned to 2 bytes.
§Hardware behavior
EDATA associates ECC information with each aligned 16-bit word. Reading a virgin EDATA word, such as a word that has not been programmed since the page was erased, raises a double ECC error. Callers should ensure that the requested word has been programmed before reading it.
See RM0522, “Error correction codes (ECC).”
Sourcepub fn edata_read_u16_slice(
&self,
bank: EDataBank,
offset: u32,
output: &mut [u16],
) -> Result<(), Error>
pub fn edata_read_u16_slice( &self, bank: EDataBank, offset: u32, output: &mut [u16], ) -> Result<(), Error>
Reads 16-bit values from an EDATA bank into output.
offset is a byte offset from the beginning of the selected physical
bank and must be aligned to 2 bytes.
§Hardware behavior
EDATA associates ECC information with each aligned 16-bit word. Reading a virgin EDATA word, such as a word that has not been programmed since the page was erased, raises a double ECC error. Callers should ensure that every requested word has been programmed before reading it.
See RM0522, “Error correction codes (ECC).”
Sourcepub fn edata_write_u16(
&mut self,
bank: EDataBank,
offset: u32,
value: u16,
) -> Result<(), Error>
pub fn edata_write_u16( &mut self, bank: EDataBank, offset: u32, value: u16, ) -> Result<(), Error>
Writes a 16-bit value to an EDATA bank.
offset is a byte offset from the beginning of the selected physical
bank and must be aligned to 2 bytes.
Sourcepub fn edata_write_u16_slice(
&mut self,
bank: EDataBank,
offset: u32,
values: &[u16],
) -> Result<(), Error>
pub fn edata_write_u16_slice( &mut self, bank: EDataBank, offset: u32, values: &[u16], ) -> Result<(), Error>
Writes 16-bit values to an EDATA bank.
offset is a byte offset from the beginning of the selected physical
bank and must be aligned to 2 bytes.
Sourcepub fn edata_write_u32(
&mut self,
bank: EDataBank,
offset: u32,
value: u32,
) -> Result<(), Error>
pub fn edata_write_u32( &mut self, bank: EDataBank, offset: u32, value: u32, ) -> Result<(), Error>
Writes a 32-bit value to an EDATA bank.
offset is a byte offset from the beginning of the selected physical
bank and must be aligned to 4 bytes.