Skip to main content

FlashMap

Struct FlashMap 

Source
pub struct FlashMap {
    pub param_block: u8,
    pub firmware_blocks: Range<u8>,
    pub golden_block: u8,
    pub screen_record_addr: u32,
}
Expand description

The blocks and addresses one card’s writes are confined to. Every write builder is a method here, so no frame can be built outside a map.

Fields§

§param_block: u8

The block erase_block and write_page accept.

§firmware_blocks: Range<u8>

Blocks erase_firmware_block and write_firmware_page accept.

§golden_block: u8

First block of the golden backup; outside both allowlists.

§screen_record_addr: u32

The one linear address write_screen_record accepts.

Implementations§

Source§

impl FlashMap

Source

pub fn erase_block( &self, rcv_index: u16, block: u8, ) -> Result<Vec<u8>, WriteError>

Erase the whole 64 KB parameter block; the caller must hold a full copy.

§Errors

Refuses any block other than param_block.

Source

pub fn erase_firmware_block( &self, rcv_index: u16, block: u8, ) -> Result<Vec<u8>, WriteError>

Erase a firmware block. Kept apart from Self::erase_block so a firmware write is never reachable through the parameter path.

§Errors

Refuses any block outside firmware_blocks.

Source

pub fn write_firmware_page( &self, rcv_index: u16, block: u8, page: u8, data: &[u8], ) -> Result<Vec<u8>, WriteError>

Write one page of a firmware block.

§Errors

Refuses any block outside firmware_blocks, or a payload that is not exactly one page.

Source

pub fn write_page( &self, rcv_index: u16, block: u8, page: u8, data: &[u8], ) -> Result<Vec<u8>, WriteError>

Write one 256-byte page within the parameter block.

§Errors

Refuses any block other than param_block, or a payload that is not exactly one page.

Source

pub fn write_screen_record( &self, rcv_index: u16, addr: u32, data: &[u8], ) -> Result<Vec<u8>, WriteError>

Write the screen-size record (linear-address frame, type 0x1900). Linear writes can reach firmware, so exactly one address is allowed.

§Errors

Refuses any address but screen_record_addr, or a wrong length.

Source

pub fn read_screen_record(&self, rcv_index: u16) -> Vec<u8>

Read the screen-size record.

Trait Implementations§

Source§

impl Clone for FlashMap

Source§

fn clone(&self) -> FlashMap

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FlashMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FlashMap

Source§

impl PartialEq for FlashMap

Source§

fn eq(&self, other: &FlashMap) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FlashMap

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.