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: u8The block erase_block and write_page accept.
firmware_blocks: Range<u8>Blocks erase_firmware_block and write_firmware_page accept.
golden_block: u8First block of the golden backup; outside both allowlists.
screen_record_addr: u32The one linear address write_screen_record accepts.
Implementations§
Source§impl FlashMap
impl FlashMap
Sourcepub fn erase_block(
&self,
rcv_index: u16,
block: u8,
) -> Result<Vec<u8>, WriteError>
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.
Sourcepub fn erase_firmware_block(
&self,
rcv_index: u16,
block: u8,
) -> Result<Vec<u8>, WriteError>
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.
Sourcepub fn write_firmware_page(
&self,
rcv_index: u16,
block: u8,
page: u8,
data: &[u8],
) -> Result<Vec<u8>, WriteError>
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.
Sourcepub fn write_page(
&self,
rcv_index: u16,
block: u8,
page: u8,
data: &[u8],
) -> Result<Vec<u8>, WriteError>
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.
Sourcepub fn write_screen_record(
&self,
rcv_index: u16,
addr: u32,
data: &[u8],
) -> Result<Vec<u8>, WriteError>
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.