pub struct Command {
pub cmd: u8,
pub arg: u32,
pub resp_type: ResponseType,
}Expand description
SD/MMC command definitions
Fields§
§cmd: u8§arg: u32§resp_type: ResponseTypeImplementations§
Source§impl Command
impl Command
pub const fn new(cmd: u8, arg: u32, resp_type: ResponseType) -> Self
Sourcepub const fn with_resp_type(self, resp_type: ResponseType) -> Self
pub const fn with_resp_type(self, resp_type: ResponseType) -> Self
Return a copy of this command with resp_type overridden.
Useful when the same command index has different response types depending on the transport (e.g. ACMD41 returns R3 in native mode but the OCR is not available in SPI mode where only an R1 byte is returned).
Sourcepub const fn data_direction(&self) -> DataDirection
pub const fn data_direction(&self) -> DataDirection
Direction of the data phase that follows this command.
Note: SDIO CMD53 carries its direction in the argument; this helper
returns None for it. CMD6 is also returned as None because the
same command index is reused for ACMD6 (SET_BUS_WIDTH, no data phase)
and CMD6 SWITCH_FUNC (64-byte read). Drivers that issue SWITCH_FUNC
choose the read-data submit path explicitly.
Sourcepub const fn data_block_size(&self) -> Option<u32>
pub const fn data_block_size(&self) -> Option<u32>
Size (in bytes) of the data block this command transfers, when the answer is unambiguous from the command index alone.
Returns None for commands without a data phase, for commands whose
block size depends on host configuration (e.g. CMD16-controlled
SDSC blocks), and for indices that are reused across commands with
different data shapes (e.g. CMD6).
Sourcepub fn to_spi_bytes(&self) -> [u8; 6]
pub fn to_spi_bytes(&self) -> [u8; 6]
Build the 6-byte SPI command packet