FlashParams

Struct FlashParams 

Source
pub struct FlashParams {
Show 17 fields pub version_major: u8, pub version_minor: u8, pub address_bytes: SFDPAddressBytes, pub density: u64, pub legacy_4kb_erase_supported: bool, pub legacy_4kb_erase_inst: u8, pub legacy_volatile_write_en_inst: u8, pub legacy_block_protect_volatile: bool, pub legacy_byte_write_granularity: bool, pub erase_insts: [Option<SFDPEraseInst>; 4], pub timing: Option<SFDPTiming>, pub page_size: Option<u32>, pub busy_poll_flag: Option<bool>, pub busy_poll_status: Option<bool>, pub reset_inst_f0: Option<bool>, pub reset_inst_66_99: Option<bool>, pub status_1_vol: Option<SFDPStatus1Volatility>,
}
Expand description

SFDP JEDEC Basic Flash Parameter Table

This table contains standard SFDP information which may be read from a flash memory. Only fields relevant to single I/O operation are parsed.

Fields are taken from JESD216D-01, supporting parameter versions up to 1.7.

Fields§

§version_major: u8

Parameter header major version field.

§version_minor: u8

Parameter header minor version field.

§address_bytes: SFDPAddressBytes

Number of address bytes to use in read/write commands.

§density: u64

Flash memory density in bits.

§legacy_4kb_erase_supported: bool

If true, 4kB erase is supported. Newer memories indicate all erase sizes with erase_* fields.

§legacy_4kb_erase_inst: u8

Instruction for 4kB erase, or 0xFF if unsupported. Newer memories also include this instruction in erase_* fields.

§legacy_volatile_write_en_inst: u8

Write enable instruction for volatile status register, either 0x50 or 0x06. Newer memories use status_1_vol instead.

§legacy_block_protect_volatile: bool

If true, Block Protect bits in status register are only volatile, otherwise they may be only non-volatile or may be programmed either as volatile with instruction 0x50 or non-volatile with instruction 0x06. Newer memories use status_1_vol instead.

§legacy_byte_write_granularity: bool

If true, writes can be performed with byte granularity. Newer memories use page_size.

§erase_insts: [Option<SFDPEraseInst>; 4]

Erase instructions.

Up to four erase instructions may be available, each specifying the opcode for the instruction and the number of bytes erased.

§timing: Option<SFDPTiming>

Chip erase and programming times, if available.

§page_size: Option<u32>

Page size, in bytes.

§busy_poll_flag: Option<bool>

If true, polling busy status via the flag status register is supported. Instruction 0x70 reads the flag register, where bit 7 is 0 if busy and 1 if ready.

§busy_poll_status: Option<bool>

If true, polling busy status via the status register is supported. Instruction 0x05 reads the status register, where bit 0 is 0 if ready and 1 if busy.

§reset_inst_f0: Option<bool>

If true, the device may be reset using instruction 0xF0.

§reset_inst_66_99: Option<bool>

If true, the device may be reset using instruction 0x66 followed by 0x99.

§status_1_vol: Option<SFDPStatus1Volatility>

Status register 1 volatility and write-enable instruction.

Implementations§

Source§

impl FlashParams

Source

pub fn from_bytes(major: u8, minor: u8, data: &[u8]) -> Result<Self>

Source

pub fn capacity_bytes(&self) -> usize

Get the flash capacity in bytes.

Source

pub fn sector_erase(&self) -> Option<(usize, u8)>

Get the smallest erase granularity and its opcode.

Trait Implementations§

Source§

impl Clone for FlashParams

Source§

fn clone(&self) -> FlashParams

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FlashParams

Source§

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

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

impl Display for FlashParams

Source§

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

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

impl Copy for FlashParams

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.