class SdmmcDevice

Defined at line 29 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

SdmmcDevice wraps a ddk::SdmmcProtocolClient to provide helper methods to the SD/MMC and SDIO

core drivers. It is assumed that the underlying SDMMC protocol driver can handle calls from

different threads, although care should be taken when calling methods that update the RCA

(SdSendRelativeAddr and MmcSetRelativeAddr) or change the signal voltage (SdSwitchUhsVoltage).

These are typically not used outside the probe thread however, so generally no synchronization is

required.

Public Members

static const uint32_t kTryAttempts

Public Methods

void SdmmcDevice (SdmmcRootDevice * root_device, const fuchsia_hardware_sdmmc::SdmmcMetadata & metadata)

Defined at line 33 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

void SdmmcDevice (SdmmcRootDevice * root_device, const ddk::SdmmcProtocolClient & host)

For testing using Banjo.

Defined at line 38 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

void SdmmcDevice (SdmmcRootDevice * root_device, fdf::ClientEnd<fuchsia_hardware_sdmmc::Sdmmc> client_end)

For testing using FIDL.

Defined at line 41 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

bool using_fidl ()

Defined at line 50 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

const sdmmc_host_info_t & host_info ()

Defined at line 51 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

bool UseDma ()

Defined at line 53 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

void SetCurrentVoltage (sdmmc_voltage_t new_voltage)

Update the current voltage field, e.g. after reading the card status registers.

Defined at line 56 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

void SetRequestRetries (uint32_t retries)

Defined at line 58 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

void ClearRca ()

Defined at line 125 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

zx_status_t RefreshHostInfo ()

Visible for testing.

Defined at line 128 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.h

zx_status_t Init (bool use_fidl)

Defined at line 131 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdmmcGoIdle ()

SD/MMC shared ops

Defined at line 237 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdmmcSendStatus (uint32_t * status)

Defined at line 246 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdmmcStopTransmission (uint32_t * status)

Defined at line 259 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdmmcWaitForState (uint32_t desired_state)

Defined at line 278 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdmmcIoRequest (fdf::Arena arena, fidl::VectorView<fuchsia_hardware_sdmmc::wire::SdmmcReq> reqs, sdmmc_buffer_region_t * buffer_region_ptr)

Issues a collection of IO requests. STOP_TRANSMISSION is issued if the request(s) fail.

|buffer_region_ptr| is used for FIDL-to-Banjo request translation.

Defined at line 298 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSendOpCond (uint32_t flags, uint32_t * ocr)

SD ops

Defined at line 355 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSendIfCond ()

Defined at line 374 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSelectCard ()

Defined at line 419 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSendScr (std::array<uint8_t, 8> & scr)

Defined at line 428 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSetBusWidth (sdmmc_bus_width_t width)

Defined at line 443 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSwitchUhsVoltage (uint32_t ocr)

SD/SDIO shared ops

Defined at line 461 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdSendRelativeAddr (uint16_t * card_status)

Defined at line 397 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdioSendOpCond (uint32_t ocr, uint32_t * rocr)

SDIO ops

Defined at line 505 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdioIoRwDirect (bool write, uint32_t fn_idx, uint32_t reg_addr, uint8_t write_byte, uint8_t * read_byte)

Defined at line 528 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx::result<uint8_t> SdioIoRwDirect (uint32_t function, uint32_t address, bool suppress_error_messages)

Read

Defined at line 564 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx::result<uint8_t> SdioIoRwDirect (uint32_t function, uint32_t address, uint8_t byte, bool read_after_write, bool suppress_error_messages)

Write

Defined at line 588 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SdioIoRwExtended (uint32_t caps, bool write, uint8_t fn_idx, uint32_t reg_addr, bool incr, uint32_t blk_count, uint32_t blk_size, cpp20::span<const sdmmc_buffer_region_t> buffers)

Defined at line 618 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx::result<uint32_t> MmcSendOpCond (bool suppress_error_messages)

MMC ops

Defined at line 668 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcWaitForReadyState (uint32_t ocr)

Defined at line 682 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcAllSendCid (std::array<uint8_t, 16> & cid)

Defined at line 702 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcSetRelativeAddr (uint16_t rca)

Defined at line 719 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcSendCsd (std::array<uint8_t, 16> & csd)

Defined at line 729 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcSendExtCsd (std::array<uint8_t, 512> & ext_csd)

Defined at line 746 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcSleepOrAwake (bool sleep)

Defined at line 767 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcSelectCard (bool select)

Defined at line 790 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t MmcSwitch (uint8_t index, uint8_t value)

Defined at line 803 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t HostInfo (sdmmc_host_info_t * info)

TODO(b/299501583): Migrate these to use FIDL calls.

Wraps ddk::SdmmcProtocolClient methods.

Defined at line 815 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SetSignalVoltage (sdmmc_voltage_t voltage)

Defined at line 837 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SetBusWidth (sdmmc_bus_width_t bus_width)

Defined at line 868 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SetBusFreq (uint32_t bus_freq)

Defined at line 902 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t SetTiming (sdmmc_timing_t timing)

Defined at line 924 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t HwReset ()

Defined at line 982 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t PerformTuning (uint32_t cmd_idx)

Defined at line 1000 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t RegisterInBandInterrupt (fdf::ClientEnd<fuchsia_hardware_sdmmc::InBandInterrupt> client_end)

Defined at line 1018 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

void AckInBandInterrupt ()

Defined at line 1036 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t RegisterVmo (uint32_t vmo_id, uint8_t client_id, zx::vmo vmo, uint64_t offset, uint64_t size, uint32_t vmo_rights)

Defined at line 1046 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t UnregisterVmo (uint32_t vmo_id, uint8_t client_id, zx::vmo * out_vmo)

Defined at line 1067 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

zx_status_t Request (const sdmmc_req_t * req, uint32_t[4] out_response)

Defined at line 1086 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc

fdf::Logger & logger ()

Defined at line 1113 of file ../../src/devices/block/drivers/sdmmc/sdmmc-device.cc