Struct NorMemory

Source
pub struct NorMemory<B: BufferBackend, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> { /* private fields */ }
Expand description

Structure representing a NOR flash memory with a buffer backend.

Implementations§

Source§

impl<B: BufferBackend, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Source

pub fn storage(self) -> NorStorage<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Converts the NOR memory into a NOR storage.

Source§

impl<const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> NorMemory<Vec<u8>, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Source

pub fn new(size: usize) -> Self

Source§

impl<const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> NorMemory<MmapFile, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Source

pub fn new<P: AsRef<Path>>(path: P, size: usize) -> Result<Self, Error>

Source

pub fn new_from_mmap(mmap: MmapFile) -> Self

Trait Implementations§

Source§

impl<B: BufferBackend, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> ErrorType for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Source§

type Error = NorFlashErrorKind

Errors returned by this NOR flash.
Source§

impl<B: BufferBackend, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> NorFlash for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Source§

fn erase(&mut self, from: u32, to: u32) -> Result<(), Error>

Erases data in the NOR flash memory from the specified range.

Source§

fn write(&mut self, offset: u32, data: &[u8]) -> Result<(), Error>

Writes data to the NOR flash memory at the specified offset.

Source§

const WRITE_SIZE: usize = WRITE_SIZE

The minumum number of bytes the storage peripheral can write
Source§

const ERASE_SIZE: usize = ERASE_SIZE

The minumum number of bytes the storage peripheral can erase
Source§

impl<B: BufferBackend, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> ReadNorFlash for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>

Source§

fn read(&mut self, address: u32, buf: &mut [u8]) -> Result<(), Error>

Reads data from the NOR flash memory into the provided buffer.

Source§

fn capacity(&self) -> usize

Returns the capacity of the NOR flash memory.

Source§

const READ_SIZE: usize = READ_SIZE

The minumum number of bytes the storage peripheral can read

Auto Trait Implementations§

§

impl<B, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> Freeze for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>
where B: Freeze,

§

impl<B, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> RefUnwindSafe for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>
where B: RefUnwindSafe,

§

impl<B, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> Send for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>
where B: Send,

§

impl<B, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> Sync for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>
where B: Sync,

§

impl<B, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> Unpin for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>
where B: Unpin,

§

impl<B, const READ_SIZE: usize, const WRITE_SIZE: usize, const ERASE_SIZE: usize> UnwindSafe for NorMemory<B, READ_SIZE, WRITE_SIZE, ERASE_SIZE>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.