Struct capsules::nonvolatile_to_pages::NonvolatileToPages
[−]
[src]
pub struct NonvolatileToPages<'a, F: Flash + 'static> { driver: &'a F, client: Cell<Option<&'static NonvolatileStorageClient>>, pagebuffer: TakeCell<'static, F::Page>, state: Cell<State>, buffer: TakeCell<'static, [u8]>, address: Cell<usize>, length: Cell<usize>, remaining_length: Cell<usize>, buffer_index: Cell<usize>, }
Fields
driver: &'a F
The module providing a Flash
interface.
client: Cell<Option<&'static NonvolatileStorageClient>>
Callback to the user of this capsule.
pagebuffer: TakeCell<'static, F::Page>
Buffer correctly sized for the underlying flash page size.
state: Cell<State>
Current state of this capsule.
buffer: TakeCell<'static, [u8]>
Temporary holding place for the user's buffer.
address: Cell<usize>
Absolute address of where we are reading or writing. This gets updated as the operation proceeds across pages.
length: Cell<usize>
Total length to read or write. We need to store this to return it to the client.
remaining_length: Cell<usize>
How many bytes are left to read or write.
buffer_index: Cell<usize>
Where we are in the user buffer.
Methods
impl<'a, F: Flash + 'a> NonvolatileToPages<'a, F>
[src]
pub fn new(
driver: &'a F,
buffer: &'static mut F::Page
) -> NonvolatileToPages<'a, F>
[src]
driver: &'a F,
buffer: &'static mut F::Page
) -> NonvolatileToPages<'a, F>
Trait Implementations
impl<'a, F: Flash + 'a> NonvolatileStorage for NonvolatileToPages<'a, F>
[src]
fn set_client(&self, client: &'static NonvolatileStorageClient)
[src]
fn read(
&self,
buffer: &'static mut [u8],
address: usize,
length: usize
) -> ReturnCode
[src]
&self,
buffer: &'static mut [u8],
address: usize,
length: usize
) -> ReturnCode
Read length
bytes starting at address address
in to the provided buffer. The buffer must be at least length
bytes long. The address must be in the address space of the physical storage. Read more
fn write(
&self,
buffer: &'static mut [u8],
address: usize,
length: usize
) -> ReturnCode
[src]
&self,
buffer: &'static mut [u8],
address: usize,
length: usize
) -> ReturnCode
Write length
bytes starting at address address
from the provided buffer. The buffer must be at least length
bytes long. This address must be in the address space of the physical storage. Read more
impl<'a, F: Flash + 'a> Client<F> for NonvolatileToPages<'a, F>
[src]
fn read_complete(&self, pagebuffer: &'static mut F::Page, _error: Error)
[src]
Flash read complete.
fn write_complete(&self, pagebuffer: &'static mut F::Page, _error: Error)
[src]
Flash write complete.
fn erase_complete(&self, _error: Error)
[src]
Flash erase complete.