Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sd_spec.h File Reference
#include <stdint.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

Data Structures

struct  sd_switch_caps
 SD switch capabilities. More...
 
struct  sd_cid
 SD card identification register. More...
 
struct  sd_csd
 SD card specific data register. More...
 
struct  mmc_device_type
 MMC Device Type. More...
 
struct  mmc_ext_csd
 MMC extended card specific data register. More...
 
struct  sd_scr
 SD card configuration register. More...
 
struct  sdio_cis
 SDIO common CIS tuple properties. More...
 

Macros

#define SD_R1_CURRENT_STATE(x)   (((x) & SD_R1_CUR_STATE) >> 9U)
 
#define SD_SPI_CMD_SIZE   6
 
#define SD_SPI_CMD_BODY_SIZE   (SD_SPI_CMD_SIZE - 1)
 
#define SD_SPI_CRC16_SIZE   2
 
#define SD_SPI_START   0x80
 
#define SD_SPI_TX   0x40
 
#define SD_SPI_CMD   0x3F
 
#define SD_SPI_TOKEN_SINGLE   0xFE
 
#define SD_SPI_TOKEN_MULTI_WRITE   0xFC
 
#define SD_SPI_TOKEN_STOP_TRAN   0xFD
 
#define SD_SPI_RESPONSE_ACCEPTED   0x05
 
#define SD_SPI_RESPONSE_CRC_ERR   0x0B
 
#define SD_SPI_RESPONSE_WRITE_ERR   0x0C
 
#define SD_IF_COND_VHS_MASK   (0x0F << 8)
 
#define SD_IF_COND_VHS_3V3   BIT(8)
 
#define SD_IF_COND_CHECK   0xAA
 
#define SDIO_OCR_IO_NUMBER_SHIFT   28
 
#define SDIO_IO_OCR_MASK   0xFFFFFF
 
#define SD_PRODUCT_NAME_BYTES   5
 
#define SDMMC_DEFAULT_BLOCK_SIZE   512
 
#define MMC_EXT_CSD_BYTES   512
 
#define SDIO_CMD_ARG_RW_SHIFT   31
 read/write flag shift
 
#define SDIO_CMD_ARG_FUNC_NUM_SHIFT   28
 function number shift
 
#define SDIO_DIRECT_CMD_ARG_RAW_SHIFT   27
 direct raw flag shift
 
#define SDIO_CMD_ARG_REG_ADDR_SHIFT   9
 direct reg addr shift
 
#define SDIO_CMD_ARG_REG_ADDR_MASK   0x1FFFF
 direct reg addr mask
 
#define SDIO_DIRECT_CMD_DATA_MASK   0xFF
 data mask
 
#define SDIO_EXTEND_CMD_ARG_BLK_SHIFT   27
 extended write block mode
 
#define SDIO_EXTEND_CMD_ARG_OP_CODE_SHIFT   26
 op code (increment address)
 
#define SDIO_CCCR_CCCR   0x00
 Card common control register definitions.
 
#define SDIO_CCCR_CCCR_REV_MASK   0x0F
 
#define SDIO_CCCR_CCCR_REV_SHIFT   0x0
 
#define SDIO_CCCR_CCCR_REV_1_00   0x0
 CCCR/FBR Version 1.00.
 
#define SDIO_CCCR_CCCR_REV_1_10   0x1
 CCCR/FBR Version 1.10.
 
#define SDIO_CCCR_CCCR_REV_2_00   0x2
 CCCR/FBR Version 2.00.
 
#define SDIO_CCCR_CCCR_REV_3_00   0x3
 CCCR/FBR Version 3.00.
 
#define SDIO_CCCR_SD   0x01
 SD spec version register.
 
#define SDIO_CCCR_SD_SPEC_MASK   0x0F
 
#define SDIO_CCCR_SD_SPEC_SHIFT   0x0
 
#define SDIO_CCCR_IO_EN   0x02
 SDIO IO Enable register.
 
#define SDIO_CCCR_IO_RD   0x03
 SDIO IO Ready register.
 
#define SDIO_CCCR_INT_EN   0x04
 SDIO Interrupt enable register.
 
#define SDIO_CCCR_INT_P   0x05
 SDIO Interrupt pending register.
 
#define SDIO_CCCR_ABORT   0x06
 SDIO IO abort register.
 
#define SDIO_CCCR_BUS_IF   0x07
 SDIO bus interface control register.
 
#define SDIO_CCCR_BUS_IF_WIDTH_MASK   0x3
 SDIO bus width setting mask.
 
#define SDIO_CCCR_BUS_IF_WIDTH_1_BIT   0x00
 1 bit SDIO bus setting
 
#define SDIO_CCCR_BUS_IF_WIDTH_4_BIT   0x02
 4 bit SDIO bus setting
 
#define SDIO_CCCR_BUS_IF_WIDTH_8_BIT   0x03
 8 bit SDIO bus setting
 
#define SDIO_CCCR_CAPS   0x08
 SDIO card capabilities.
 
#define SDIO_CCCR_CAPS_SDC   BIT(0)
 support CMD52 while data transfer
 
#define SDIO_CCCR_CAPS_SMB   BIT(1)
 support multiple block transfer
 
#define SDIO_CCCR_CAPS_SRW   BIT(2)
 support read wait control
 
#define SDIO_CCCR_CAPS_SBS   BIT(3)
 support bus control
 
#define SDIO_CCCR_CAPS_S4MI   BIT(4)
 support block gap interrupt
 
#define SDIO_CCCR_CAPS_E4MI   BIT(5)
 enable block gap interrupt
 
#define SDIO_CCCR_CAPS_LSC   BIT(6)
 low speed card
 
#define SDIO_CCCR_CAPS_BLS   BIT(7)
 low speed card with 4 bit support
 
#define SDIO_CCCR_CIS   0x09
 SDIO CIS tuples pointer.
 
#define SDIO_CCCR_SPEED   0x13
 SDIO bus speed select.
 
#define SDIO_CCCR_SPEED_SHS   BIT(0)
 high speed support
 
#define SDIO_CCCR_SPEED_MASK   0xE
 bus speed select mask
 
#define SDIO_CCCR_SPEED_SHIFT   0x1
 bus speed select shift
 
#define SDIO_CCCR_SPEED_SDR12   0x0
 select SDR12
 
#define SDIO_CCCR_SPEED_HS   0x1
 select High speed mode
 
#define SDIO_CCCR_SPEED_SDR25   0x1
 select SDR25
 
#define SDIO_CCCR_SPEED_SDR50   0x2
 select SDR50
 
#define SDIO_CCCR_SPEED_SDR104   0x3
 select SDR104
 
#define SDIO_CCCR_SPEED_DDR50   0x4
 select DDR50
 
#define SDIO_CCCR_UHS   0x14
 SDIO UHS support.
 
#define SDIO_CCCR_UHS_SDR50   BIT(0)
 SDR50 support.
 
#define SDIO_CCCR_UHS_SDR104   BIT(1)
 SDR104 support.
 
#define SDIO_CCCR_UHS_DDR50   BIT(2)
 DDR50 support.
 
#define SDIO_CCCR_DRIVE_STRENGTH   0x15
 SDIO drive strength.
 
#define SDIO_CCCR_DRIVE_STRENGTH_A   BIT(0)
 drive type A
 
#define SDIO_CCCR_DRIVE_STRENGTH_C   BIT(1)
 drive type C
 
#define SDIO_CCCR_DRIVE_STRENGTH_D   BIT(2)
 drive type D
 
#define SDIO_FBR_BASE(n)   ((n) * 0x100)
 Get function base register addr.
 
#define SDIO_FBR_CIS   0x09
 SDIO function base register CIS pointer.
 
#define SDIO_FBR_CSA   0x0C
 SDIO function base register CSA pointer.
 
#define SDIO_FBR_BLK_SIZE   0x10
 SDIO function base register block size.
 
#define SDIO_MAX_IO_NUMS   7
 Maximum number of I/O functions for SDIO.
 
#define SDIO_TPL_CODE_NULL   0x00
 NULL CIS tuple code.
 
#define SDIO_TPL_CODE_MANIFID   0x20
 manufacturer ID CIS tuple code
 
#define SDIO_TPL_CODE_FUNCID   0x21
 function ID CIS tuple code
 
#define SDIO_TPL_CODE_FUNCE   0x22
 function extension CIS tuple code
 
#define SDIO_TPL_CODE_END   0xFF
 End CIS tuple code.
 

Enumerations

enum  sd_opcode {
  SD_GO_IDLE_STATE = 0 , MMC_SEND_OP_COND = 1 , SD_ALL_SEND_CID = 2 , SD_SEND_RELATIVE_ADDR = 3 ,
  MMC_SEND_RELATIVE_ADDR = 3 , SDIO_SEND_OP_COND = 5 , SD_SWITCH = 6 , SD_SELECT_CARD = 7 ,
  SD_SEND_IF_COND = 8 , MMC_SEND_EXT_CSD = 8 , SD_SEND_CSD = 9 , SD_SEND_CID = 10 ,
  SD_VOL_SWITCH = 11 , SD_STOP_TRANSMISSION = 12 , SD_SEND_STATUS = 13 , MMC_CHECK_BUS_TEST = 14 ,
  SD_GO_INACTIVE_STATE = 15 , SD_SET_BLOCK_SIZE = 16 , SD_READ_SINGLE_BLOCK = 17 , SD_READ_MULTIPLE_BLOCK = 18 ,
  SD_SEND_TUNING_BLOCK = 19 , MMC_SEND_BUS_TEST = 19 , MMC_SEND_TUNING_BLOCK = 21 , SD_SET_BLOCK_COUNT = 23 ,
  SD_WRITE_SINGLE_BLOCK = 24 , SD_WRITE_MULTIPLE_BLOCK = 25 , SD_ERASE_BLOCK_START = 32 , SD_ERASE_BLOCK_END = 33 ,
  SD_ERASE_BLOCK_OPERATION = 38 , SDIO_RW_DIRECT = 52 , SDIO_RW_EXTENDED = 53 , SD_APP_CMD = 55 ,
  SD_SPI_READ_OCR = 58 , SD_SPI_CRC_ON_OFF = 59
}
 SD specification command opcodes. More...
 
enum  sd_app_cmd {
  SD_APP_SET_BUS_WIDTH = 6 , SD_APP_SEND_STATUS = 13 , SD_APP_SEND_NUM_WRITTEN_BLK = 22 , SD_APP_SET_WRITE_BLK_ERASE_CNT = 23 ,
  SD_APP_SEND_OP_COND = 41 , SD_APP_CLEAR_CARD_DETECT = 42 , SD_APP_SEND_SCR = 51
}
 SD application command opcodes. More...
 
enum  sd_r1_status {
  SD_R1_AUTH_ERR = BIT(3) , SD_R1_APP_CMD = BIT(5) , SD_R1_FX_EVENT = BIT(6) , SD_R1_RDY_DATA = BIT(8) ,
  SD_R1_CUR_STATE = (0xFU << 9) , SD_R1_ERASE_RESET = BIT(13) , SD_R1_ECC_DISABLED = BIT(14) , SD_R1_ERASE_SKIP = BIT(15) ,
  SD_R1_CSD_OVERWRITE = BIT(16) , SD_R1_ERR = BIT(19) , SD_R1_CC_ERR = BIT(20) , SD_R1_ECC_FAIL = BIT(21) ,
  SD_R1_ILLEGAL_CMD = BIT(22) , SD_R1_CRC_ERR = BIT(23) , SD_R1_UNLOCK_FAIL = BIT(24) , SD_R1_CARD_LOCKED = BIT(25) ,
  SD_R1_WP_VIOLATION = BIT(26) , SD_R1_ERASE_PARAM = BIT(27) , SD_R1_ERASE_SEQ_ERR = BIT(28) , SD_R1_BLOCK_LEN_ERR = BIT(29) ,
  SD_R1_ADDR_ERR = BIT(30) , SD_R1_OUT_OF_RANGE = BIT(31) , SD_R1_ERR_FLAGS , SD_R1ERR_NONE = 0
}
 Native SD mode R1 response status flags. More...
 
enum  sd_r1_current_state {
  SDMMC_R1_IDLE = 0U , SDMMC_R1_READY = 1U , SDMMC_R1_IDENTIFY = 2U , SDMMC_R1_STANDBY = 3U ,
  SDMMC_R1_TRANSFER = 4U , SDMMC_R1_SEND_DATA = 5U , SDMMC_R1_RECIVE_DATA = 6U , SDMMC_R1_PROGRAM = 7U ,
  SDMMC_R1_DISCONNECT = 8U
}
 SD current state values. More...
 
enum  sd_spi_r1_error_flag {
  SD_SPI_R1PARAMETER_ERR = BIT(6) , SD_SPI_R1ADDRESS_ERR = BIT(5) , SD_SPI_R1ERASE_SEQ_ERR = BIT(4) , SD_SPI_R1CMD_CRC_ERR = BIT(3) ,
  SD_SPI_R1ILLEGAL_CMD_ERR = BIT(2) , SD_SPI_R1ERASE_RESET = BIT(1) , SD_SPI_R1IDLE_STATE = BIT(0)
}
 SPI SD mode R1 response status flags. More...
 
enum  sd_spi_r2_status {
  SDHC_SPI_R2_CARD_LOCKED = BIT(8) , SDHC_SPI_R2_UNLOCK_FAIL = BIT(9) , SDHC_SPI_R2_ERR = BIT(10) , SDHC_SPI_R2_CC_ERR = BIT(11) ,
  SDHC_SPI_R2_ECC_FAIL = BIT(12) , SDHC_SPI_R2_WP_VIOLATION = BIT(13) , SDHC_SPI_R2_ERASE_PARAM = BIT(14) , SDHC_SPI_R2_OUT_OF_RANGE = BIT(15)
}
 SPI SD mode R2 response status flags. More...
 
enum  sd_rsp_type {
  SD_RSP_TYPE_NONE = 0U , SD_RSP_TYPE_R1 = 1U , SD_RSP_TYPE_R1b = 2U , SD_RSP_TYPE_R2 = 3U ,
  SD_RSP_TYPE_R3 = 4U , SD_RSP_TYPE_R4 = 5U , SD_RSP_TYPE_R5 = 6U , SD_RSP_TYPE_R5b = 7U ,
  SD_RSP_TYPE_R6 = 8U , SD_RSP_TYPE_R7 = 9U , SD_SPI_RSP_TYPE_R1 = (1U << 4) , SD_SPI_RSP_TYPE_R1b = (2U << 4) ,
  SD_SPI_RSP_TYPE_R2 = (3U << 4) , SD_SPI_RSP_TYPE_R3 = (4U << 4) , SD_SPI_RSP_TYPE_R4 = (5U << 4) , SD_SPI_RSP_TYPE_R5 = (6U << 4) ,
  SD_SPI_RSP_TYPE_R7 = (7U << 4)
}
 SD response types. More...
 
enum  sd_support_flag {
  SD_HIGH_CAPACITY_FLAG = BIT(1) , SD_4BITS_WIDTH = BIT(2) , SD_SDHC_FLAG = BIT(3) , SD_SDXC_FLAG = BIT(4) ,
  SD_1800MV_FLAG = BIT(5) , SD_3000MV_FLAG = BIT(6) , SD_CMD23_FLAG = BIT(7) , SD_SPEED_CLASS_CONTROL_FLAG = BIT(8) ,
  SD_MEM_PRESENT_FLAG = BIT(9)
}
 SD support flags. More...
 
enum  sd_ocr_flag {
  SD_OCR_PWR_BUSY_FLAG = BIT(31) , SD_OCR_HOST_CAP_FLAG = BIT(30) , SD_OCR_CARD_CAP_FLAG = SD_OCR_HOST_CAP_FLAG , SD_OCR_SWITCH_18_REQ_FLAG = BIT(24) ,
  SD_OCR_SWITCH_18_ACCEPT_FLAG = SD_OCR_SWITCH_18_REQ_FLAG , SD_OCR_VDD27_28FLAG = BIT(15) , SD_OCR_VDD28_29FLAG = BIT(16) , SD_OCR_VDD29_30FLAG = BIT(17) ,
  SD_OCR_VDD30_31FLAG = BIT(18) , SD_OCR_VDD31_32FLAG = BIT(19) , SD_OCR_VDD32_33FLAG = BIT(20) , SD_OCR_VDD33_34FLAG = BIT(21) ,
  SD_OCR_VDD34_35FLAG = BIT(22) , SD_OCR_VDD35_36FLAG = BIT(23)
}
 SD OCR bit flags. More...
 
enum  mmc_ocr_flag {
  MMC_OCR_VDD170_195FLAG = BIT(7) , MMC_OCR_VDD20_26FLAG = 0x7F << 8 , MMC_OCR_VDD27_36FLAG = 0x1FF << 15 , MMC_OCR_SECTOR_MODE = BIT(30) ,
  MMC_OCR_PWR_BUSY_FLAG = BIT(31)
}
 MMC OCR bit flags. More...
 
enum  sdio_ocr_flag {
  SDIO_OCR_IO_READY_FLAG = BIT(31) , SDIO_OCR_IO_NUMBER = (7U << 28U) , SDIO_OCR_MEM_PRESENT_FLAG = BIT(27) , SDIO_OCR_180_VOL_FLAG = BIT(24) ,
  SDIO_OCR_VDD20_21FLAG = BIT(8) , SDIO_OCR_VDD21_22FLAG = BIT(9) , SDIO_OCR_VDD22_23FLAG = BIT(10) , SDIO_OCR_VDD23_24FLAG = BIT(11) ,
  SDIO_OCR_VDD24_25FLAG = BIT(12) , SDIO_OCR_VDD25_26FLAG = BIT(13) , SDIO_OCR_VDD26_27FLAG = BIT(14) , SDIO_OCR_VDD27_28FLAG = BIT(15) ,
  SDIO_OCR_VDD28_29FLAG = BIT(16) , SDIO_OCR_VDD29_30FLAG = BIT(17) , SDIO_OCR_VDD30_31FLAG = BIT(18) , SDIO_OCR_VDD31_32FLAG = BIT(19) ,
  SDIO_OCR_VDD32_33FLAG = BIT(20) , SDIO_OCR_VDD33_34FLAG = BIT(21) , SDIO_OCR_VDD34_35FLAG = BIT(22) , SDIO_OCR_VDD35_36FLAG = BIT(23)
}
 SDIO OCR bit flags. More...
 
enum  sd_switch_arg { SD_SWITCH_CHECK = 0U , SD_SWITCH_SET = 1U }
 SD switch arguments. More...
 
enum  sd_group_num { SD_GRP_TIMING_MODE = 0U , SD_GRP_CMD_SYS_MODE = 1U , SD_GRP_DRIVER_STRENGTH_MODE = 2U , SD_GRP_CURRENT_LIMIT_MODE = 3U }
 SD switch group numbers. More...
 
enum  hs_max_data_rate { HS_UNSUPPORTED = 0 , HS_MAX_DTR = MHZ(50) }
 
enum  uhs_max_data_rate {
  UHS_UNSUPPORTED = 0 , UHS_SDR12_MAX_DTR = MHZ(25) , UHS_SDR25_MAX_DTR = MHZ(50) , UHS_SDR50_MAX_DTR = MHZ(100) ,
  UHS_SDR104_MAX_DTR = MHZ(208) , UHS_DDR50_MAX_DTR = MHZ(50)
}
 
enum  sd_bus_speed {
  UHS_SDR12_BUS_SPEED = BIT(0) , DEFAULT_BUS_SPEED = BIT(0) , HIGH_SPEED_BUS_SPEED = BIT(1) , UHS_SDR25_BUS_SPEED = BIT(1) ,
  UHS_SDR50_BUS_SPEED = BIT(2) , UHS_SDR104_BUS_SPEED = BIT(3) , UHS_DDR50_BUS_SPEED = BIT(4)
}
 SD bus speed support bit flags. More...
 
enum  sd_timing_mode {
  SD_TIMING_DEFAULT = 0U , SD_TIMING_SDR12 = 0U , SD_TIMING_HIGH_SPEED = 1U , SD_TIMING_SDR25 = 1U ,
  SD_TIMING_SDR50 = 2U , SD_TIMING_SDR104 = 3U , SD_TIMING_DDR50 = 4U
}
 SD timing mode function selection values. More...
 
enum  sdhc_clock_speed {
  SDMMC_CLOCK_400KHZ = KHZ(400) , SD_CLOCK_25MHZ = MHZ(25) , SD_CLOCK_50MHZ = MHZ(50) , SD_CLOCK_100MHZ = MHZ(100) ,
  SD_CLOCK_208MHZ = MHZ(208) , MMC_CLOCK_26MHZ = MHZ(26) , MMC_CLOCK_52MHZ = MHZ(52) , MMC_CLOCK_DDR52 = MHZ(52) ,
  MMC_CLOCK_HS200 = MHZ(200) , MMC_CLOCK_HS400 = MHZ(200)
}
 SD host controller clock speed. More...
 
enum  sd_current_setting { SD_SET_CURRENT_200MA = 0 , SD_SET_CURRENT_400MA = 1 , SD_SET_CURRENT_600MA = 2 , SD_SET_CURRENT_800MA = 3 }
 SD current setting values. More...
 
enum  sd_current_limit { SD_MAX_CURRENT_200MA = BIT(0) , SD_MAX_CURRENT_400MA = BIT(1) , SD_MAX_CURRENT_600MA = BIT(2) , SD_MAX_CURRENT_800MA = BIT(3) }
 SD current support bitfield. More...
 
enum  sd_driver_type { SD_DRIVER_TYPE_B = 0x1 , SD_DRIVER_TYPE_A = 0x2 , SD_DRIVER_TYPE_C = 0x4 , SD_DRIVER_TYPE_D = 0x8 }
 SD driver types. More...
 
enum  sd_driver_strength { SD_DRV_STRENGTH_TYPEB = 0U , SD_DRV_STRENGTH_TYPEA = 1U , SD_DRV_STRENGTH_TYPEC = 2U , SD_DRV_STRENGTH_TYPED = 3U }
 SD switch drive type selection. More...
 
enum  mmc_csd_freq {
  MMC_MAXFREQ_100KHZ = 0U << 0U , MMC_MAXFREQ_1MHZ = 1U << 0U , MMC_MAXFREQ_10MHZ = 2U << 0U , MMC_MAXFREQ_100MHZ = 3U << 0U ,
  MMC_MAXFREQ_MULT_10 = 1U << 3U , MMC_MAXFREQ_MULT_12 = 2U << 3U , MMC_MAXFREQ_MULT_13 = 3U << 3U , MMC_MAXFREQ_MULT_15 = 4U << 3U ,
  MMC_MAXFREQ_MULT_20 = 5U << 3U , MMC_MAXFREQ_MULT_26 = 6U << 3U , MMC_MAXFREQ_MULT_30 = 7U << 3U , MMC_MAXFREQ_MULT_35 = 8U << 3U ,
  MMC_MAXFREQ_MULT_40 = 9U << 3U , MMC_MAXFREQ_MULT_45 = 0xAU << 3U , MMC_MAXFREQ_MULT_52 = 0xBU << 3U , MMC_MAXFREQ_MULT_55 = 0xCU << 3U ,
  MMC_MAXFREQ_MULT_60 = 0xDU << 3U , MMC_MAXFREQ_MULT_70 = 0xEU << 3U , MMC_MAXFREQ_MULT_80 = 0xFU << 3u
}
 MMC Maximum Frequency. More...
 
enum  mmc_timing_mode { MMC_LEGACY_TIMING = 0U , MMC_HS_TIMING = 1U , MMC_HS200_TIMING = 2U , MMC_HS400_TIMING = 3U }
 MMC Timing Modes. More...
 
enum  mmc_driver_strengths {
  mmc_driv_type0 = 0U , mmc_driv_type1 = 1U , mmc_driv_type2 = 2U , mmc_driv_type3 = 3U ,
  mmc_driv_type4 = 4U
}
 MMC Driver Strengths. More...
 
enum  mmc_ext_csd_rev {
  MMC_5_1 = 8U , MMC_5_0 = 7U , MMC_4_5 = 6U , MMC_4_4 = 5U ,
  MMC_4_3 = 3U , MMC_4_2 = 2U , MMC_4_1 = 1U , MMC_4_0 = 0U
}
 CSD Revision. More...
 
enum  sd_csd_flag {
  SD_CSD_READ_BLK_PARTIAL_FLAG = BIT(0) , SD_CSD_WRITE_BLK_MISALIGN_FLAG = BIT(1) , SD_CSD_READ_BLK_MISALIGN_FLAG = BIT(2) , SD_CSD_DSR_IMPLEMENTED_FLAG = BIT(3) ,
  SD_CSD_ERASE_BLK_EN_FLAG = BIT(4) , SD_CSD_WRITE_PROTECT_GRP_EN_FLAG = BIT(5) , SD_CSD_WRITE_BLK_PARTIAL_FLAG = BIT(6) , SD_CSD_FILE_FMT_GRP_FLAG = BIT(7) ,
  SD_CSD_COPY_FLAG = BIT(8) , SD_CSD_PERMANENT_WRITE_PROTECT_FLAG = BIT(9) , SD_CSD_TMP_WRITE_PROTECT_FLAG = BIT(10)
}
 SD card specific data flags. More...
 
enum  sd_scr_flag { SD_SCR_DATA_STATUS_AFTER_ERASE = BIT(0) , SD_SCR_SPEC3 = BIT(1) }
 SD card configuration register. More...
 
enum  sd_spec_version { SD_SPEC_VER1_0 = BIT(0) , SD_SPEC_VER1_1 = BIT(1) , SD_SPEC_VER2_0 = BIT(2) , SD_SPEC_VER3_0 = BIT(3) }
 SD specification version. More...
 
enum  sdio_func_num {
  SDIO_FUNC_NUM_0 = 0 , SDIO_FUNC_NUM_1 = 1 , SDIO_FUNC_NUM_2 = 2 , SDIO_FUNC_NUM_3 = 3 ,
  SDIO_FUNC_NUM_4 = 4 , SDIO_FUNC_NUM_5 = 5 , SDIO_FUNC_NUM_6 = 6 , SDIO_FUNC_NUM_7 = 7 ,
  SDIO_FUNC_MEMORY = 8
}
 SDIO function number. More...
 
enum  sdio_io_dir { SDIO_IO_READ = 0 , SDIO_IO_WRITE = 1 }
 SDIO I/O direction. More...
 
enum  sdio_cccr_flags {
  SDIO_SUPPORT_HS = BIT(0) , SDIO_SUPPORT_SDR50 = BIT(1) , SDIO_SUPPORT_SDR104 = BIT(2) , SDIO_SUPPORT_DDR50 = BIT(3) ,
  SDIO_SUPPORT_4BIT_LS_BUS = BIT(4) , SDIO_SUPPORT_MULTIBLOCK = BIT(5)
}
 Card common control register flags. More...
 

Macro Definition Documentation

◆ MMC_EXT_CSD_BYTES

#define MMC_EXT_CSD_BYTES   512

◆ SD_IF_COND_CHECK

#define SD_IF_COND_CHECK   0xAA

◆ SD_IF_COND_VHS_3V3

#define SD_IF_COND_VHS_3V3   BIT(8)

◆ SD_IF_COND_VHS_MASK

#define SD_IF_COND_VHS_MASK   (0x0F << 8)

◆ SD_PRODUCT_NAME_BYTES

#define SD_PRODUCT_NAME_BYTES   5

◆ SD_R1_CURRENT_STATE

#define SD_R1_CURRENT_STATE (   x)    (((x) & SD_R1_CUR_STATE) >> 9U)

◆ SD_SPI_CMD

#define SD_SPI_CMD   0x3F

◆ SD_SPI_CMD_BODY_SIZE

#define SD_SPI_CMD_BODY_SIZE   (SD_SPI_CMD_SIZE - 1)

◆ SD_SPI_CMD_SIZE

#define SD_SPI_CMD_SIZE   6

◆ SD_SPI_CRC16_SIZE

#define SD_SPI_CRC16_SIZE   2

◆ SD_SPI_RESPONSE_ACCEPTED

#define SD_SPI_RESPONSE_ACCEPTED   0x05

◆ SD_SPI_RESPONSE_CRC_ERR

#define SD_SPI_RESPONSE_CRC_ERR   0x0B

◆ SD_SPI_RESPONSE_WRITE_ERR

#define SD_SPI_RESPONSE_WRITE_ERR   0x0C

◆ SD_SPI_START

#define SD_SPI_START   0x80

◆ SD_SPI_TOKEN_MULTI_WRITE

#define SD_SPI_TOKEN_MULTI_WRITE   0xFC

◆ SD_SPI_TOKEN_SINGLE

#define SD_SPI_TOKEN_SINGLE   0xFE

◆ SD_SPI_TOKEN_STOP_TRAN

#define SD_SPI_TOKEN_STOP_TRAN   0xFD

◆ SD_SPI_TX

#define SD_SPI_TX   0x40

◆ SDIO_CCCR_ABORT

#define SDIO_CCCR_ABORT   0x06

SDIO IO abort register.

◆ SDIO_CCCR_BUS_IF

#define SDIO_CCCR_BUS_IF   0x07

SDIO bus interface control register.

◆ SDIO_CCCR_BUS_IF_WIDTH_1_BIT

#define SDIO_CCCR_BUS_IF_WIDTH_1_BIT   0x00

1 bit SDIO bus setting

◆ SDIO_CCCR_BUS_IF_WIDTH_4_BIT

#define SDIO_CCCR_BUS_IF_WIDTH_4_BIT   0x02

4 bit SDIO bus setting

◆ SDIO_CCCR_BUS_IF_WIDTH_8_BIT

#define SDIO_CCCR_BUS_IF_WIDTH_8_BIT   0x03

8 bit SDIO bus setting

◆ SDIO_CCCR_BUS_IF_WIDTH_MASK

#define SDIO_CCCR_BUS_IF_WIDTH_MASK   0x3

SDIO bus width setting mask.

◆ SDIO_CCCR_CAPS

#define SDIO_CCCR_CAPS   0x08

SDIO card capabilities.

◆ SDIO_CCCR_CAPS_BLS

#define SDIO_CCCR_CAPS_BLS   BIT(7)

low speed card with 4 bit support

◆ SDIO_CCCR_CAPS_E4MI

#define SDIO_CCCR_CAPS_E4MI   BIT(5)

enable block gap interrupt

◆ SDIO_CCCR_CAPS_LSC

#define SDIO_CCCR_CAPS_LSC   BIT(6)

low speed card

◆ SDIO_CCCR_CAPS_S4MI

#define SDIO_CCCR_CAPS_S4MI   BIT(4)

support block gap interrupt

◆ SDIO_CCCR_CAPS_SBS

#define SDIO_CCCR_CAPS_SBS   BIT(3)

support bus control

◆ SDIO_CCCR_CAPS_SDC

#define SDIO_CCCR_CAPS_SDC   BIT(0)

support CMD52 while data transfer

◆ SDIO_CCCR_CAPS_SMB

#define SDIO_CCCR_CAPS_SMB   BIT(1)

support multiple block transfer

◆ SDIO_CCCR_CAPS_SRW

#define SDIO_CCCR_CAPS_SRW   BIT(2)

support read wait control

◆ SDIO_CCCR_CCCR

#define SDIO_CCCR_CCCR   0x00

Card common control register definitions.

Card common control registers, present on all SDIO cards SDIO CCCR revision register

◆ SDIO_CCCR_CCCR_REV_1_00

#define SDIO_CCCR_CCCR_REV_1_00   0x0

CCCR/FBR Version 1.00.

◆ SDIO_CCCR_CCCR_REV_1_10

#define SDIO_CCCR_CCCR_REV_1_10   0x1

CCCR/FBR Version 1.10.

◆ SDIO_CCCR_CCCR_REV_2_00

#define SDIO_CCCR_CCCR_REV_2_00   0x2

CCCR/FBR Version 2.00.

◆ SDIO_CCCR_CCCR_REV_3_00

#define SDIO_CCCR_CCCR_REV_3_00   0x3

CCCR/FBR Version 3.00.

◆ SDIO_CCCR_CCCR_REV_MASK

#define SDIO_CCCR_CCCR_REV_MASK   0x0F

◆ SDIO_CCCR_CCCR_REV_SHIFT

#define SDIO_CCCR_CCCR_REV_SHIFT   0x0

◆ SDIO_CCCR_CIS

#define SDIO_CCCR_CIS   0x09

SDIO CIS tuples pointer.

◆ SDIO_CCCR_DRIVE_STRENGTH

#define SDIO_CCCR_DRIVE_STRENGTH   0x15

SDIO drive strength.

◆ SDIO_CCCR_DRIVE_STRENGTH_A

#define SDIO_CCCR_DRIVE_STRENGTH_A   BIT(0)

drive type A

◆ SDIO_CCCR_DRIVE_STRENGTH_C

#define SDIO_CCCR_DRIVE_STRENGTH_C   BIT(1)

drive type C

◆ SDIO_CCCR_DRIVE_STRENGTH_D

#define SDIO_CCCR_DRIVE_STRENGTH_D   BIT(2)

drive type D

◆ SDIO_CCCR_INT_EN

#define SDIO_CCCR_INT_EN   0x04

SDIO Interrupt enable register.

◆ SDIO_CCCR_INT_P

#define SDIO_CCCR_INT_P   0x05

SDIO Interrupt pending register.

◆ SDIO_CCCR_IO_EN

#define SDIO_CCCR_IO_EN   0x02

SDIO IO Enable register.

◆ SDIO_CCCR_IO_RD

#define SDIO_CCCR_IO_RD   0x03

SDIO IO Ready register.

◆ SDIO_CCCR_SD

#define SDIO_CCCR_SD   0x01

SD spec version register.

◆ SDIO_CCCR_SD_SPEC_MASK

#define SDIO_CCCR_SD_SPEC_MASK   0x0F

◆ SDIO_CCCR_SD_SPEC_SHIFT

#define SDIO_CCCR_SD_SPEC_SHIFT   0x0

◆ SDIO_CCCR_SPEED

#define SDIO_CCCR_SPEED   0x13

SDIO bus speed select.

◆ SDIO_CCCR_SPEED_DDR50

#define SDIO_CCCR_SPEED_DDR50   0x4

select DDR50

◆ SDIO_CCCR_SPEED_HS

#define SDIO_CCCR_SPEED_HS   0x1

select High speed mode

◆ SDIO_CCCR_SPEED_MASK

#define SDIO_CCCR_SPEED_MASK   0xE

bus speed select mask

◆ SDIO_CCCR_SPEED_SDR104

#define SDIO_CCCR_SPEED_SDR104   0x3

select SDR104

◆ SDIO_CCCR_SPEED_SDR12

#define SDIO_CCCR_SPEED_SDR12   0x0

select SDR12

◆ SDIO_CCCR_SPEED_SDR25

#define SDIO_CCCR_SPEED_SDR25   0x1

select SDR25

◆ SDIO_CCCR_SPEED_SDR50

#define SDIO_CCCR_SPEED_SDR50   0x2

select SDR50

◆ SDIO_CCCR_SPEED_SHIFT

#define SDIO_CCCR_SPEED_SHIFT   0x1

bus speed select shift

◆ SDIO_CCCR_SPEED_SHS

#define SDIO_CCCR_SPEED_SHS   BIT(0)

high speed support

◆ SDIO_CCCR_UHS

#define SDIO_CCCR_UHS   0x14

SDIO UHS support.

◆ SDIO_CCCR_UHS_DDR50

#define SDIO_CCCR_UHS_DDR50   BIT(2)

DDR50 support.

◆ SDIO_CCCR_UHS_SDR104

#define SDIO_CCCR_UHS_SDR104   BIT(1)

SDR104 support.

◆ SDIO_CCCR_UHS_SDR50

#define SDIO_CCCR_UHS_SDR50   BIT(0)

SDR50 support.

◆ SDIO_CMD_ARG_FUNC_NUM_SHIFT

#define SDIO_CMD_ARG_FUNC_NUM_SHIFT   28

function number shift

◆ SDIO_CMD_ARG_REG_ADDR_MASK

#define SDIO_CMD_ARG_REG_ADDR_MASK   0x1FFFF

direct reg addr mask

◆ SDIO_CMD_ARG_REG_ADDR_SHIFT

#define SDIO_CMD_ARG_REG_ADDR_SHIFT   9

direct reg addr shift

◆ SDIO_CMD_ARG_RW_SHIFT

#define SDIO_CMD_ARG_RW_SHIFT   31

read/write flag shift

◆ SDIO_DIRECT_CMD_ARG_RAW_SHIFT

#define SDIO_DIRECT_CMD_ARG_RAW_SHIFT   27

direct raw flag shift

◆ SDIO_DIRECT_CMD_DATA_MASK

#define SDIO_DIRECT_CMD_DATA_MASK   0xFF

data mask

◆ SDIO_EXTEND_CMD_ARG_BLK_SHIFT

#define SDIO_EXTEND_CMD_ARG_BLK_SHIFT   27

extended write block mode

◆ SDIO_EXTEND_CMD_ARG_OP_CODE_SHIFT

#define SDIO_EXTEND_CMD_ARG_OP_CODE_SHIFT   26

op code (increment address)

◆ SDIO_FBR_BASE

#define SDIO_FBR_BASE (   n)    ((n) * 0x100)

Get function base register addr.

◆ SDIO_FBR_BLK_SIZE

#define SDIO_FBR_BLK_SIZE   0x10

SDIO function base register block size.

◆ SDIO_FBR_CIS

#define SDIO_FBR_CIS   0x09

SDIO function base register CIS pointer.

◆ SDIO_FBR_CSA

#define SDIO_FBR_CSA   0x0C

SDIO function base register CSA pointer.

◆ SDIO_IO_OCR_MASK

#define SDIO_IO_OCR_MASK   0xFFFFFF

◆ SDIO_MAX_IO_NUMS

#define SDIO_MAX_IO_NUMS   7

Maximum number of I/O functions for SDIO.

◆ SDIO_OCR_IO_NUMBER_SHIFT

#define SDIO_OCR_IO_NUMBER_SHIFT   28

◆ SDIO_TPL_CODE_END

#define SDIO_TPL_CODE_END   0xFF

End CIS tuple code.

◆ SDIO_TPL_CODE_FUNCE

#define SDIO_TPL_CODE_FUNCE   0x22

function extension CIS tuple code

◆ SDIO_TPL_CODE_FUNCID

#define SDIO_TPL_CODE_FUNCID   0x21

function ID CIS tuple code

◆ SDIO_TPL_CODE_MANIFID

#define SDIO_TPL_CODE_MANIFID   0x20

manufacturer ID CIS tuple code

◆ SDIO_TPL_CODE_NULL

#define SDIO_TPL_CODE_NULL   0x00

NULL CIS tuple code.

◆ SDMMC_DEFAULT_BLOCK_SIZE

#define SDMMC_DEFAULT_BLOCK_SIZE   512

Enumeration Type Documentation

◆ hs_max_data_rate

Enumerator
HS_UNSUPPORTED 
HS_MAX_DTR 

◆ mmc_csd_freq

MMC Maximum Frequency.

Max freq in MMC csd

Enumerator
MMC_MAXFREQ_100KHZ 
MMC_MAXFREQ_1MHZ 
MMC_MAXFREQ_10MHZ 
MMC_MAXFREQ_100MHZ 
MMC_MAXFREQ_MULT_10 
MMC_MAXFREQ_MULT_12 
MMC_MAXFREQ_MULT_13 
MMC_MAXFREQ_MULT_15 
MMC_MAXFREQ_MULT_20 
MMC_MAXFREQ_MULT_26 
MMC_MAXFREQ_MULT_30 
MMC_MAXFREQ_MULT_35 
MMC_MAXFREQ_MULT_40 
MMC_MAXFREQ_MULT_45 
MMC_MAXFREQ_MULT_52 
MMC_MAXFREQ_MULT_55 
MMC_MAXFREQ_MULT_60 
MMC_MAXFREQ_MULT_70 
MMC_MAXFREQ_MULT_80 

◆ mmc_driver_strengths

MMC Driver Strengths.

Encoded in EXT_CSD

Enumerator
mmc_driv_type0 
mmc_driv_type1 
mmc_driv_type2 
mmc_driv_type3 
mmc_driv_type4 

◆ mmc_ext_csd_rev

CSD Revision.

Value of CSD rev in EXT_CSD

Enumerator
MMC_5_1 
MMC_5_0 
MMC_4_5 
MMC_4_4 
MMC_4_3 
MMC_4_2 
MMC_4_1 
MMC_4_0 

◆ mmc_ocr_flag

MMC OCR bit flags.

bit flags present in MMC OCR response. Used to determine status and supported functions of MMC card.

Enumerator
MMC_OCR_VDD170_195FLAG 
MMC_OCR_VDD20_26FLAG 
MMC_OCR_VDD27_36FLAG 
MMC_OCR_SECTOR_MODE 
MMC_OCR_PWR_BUSY_FLAG 

◆ mmc_timing_mode

MMC Timing Modes.

MMC Timing Mode, encoded in EXT_CSD

Enumerator
MMC_LEGACY_TIMING 
MMC_HS_TIMING 
MMC_HS200_TIMING 
MMC_HS400_TIMING 

◆ sd_app_cmd

enum sd_app_cmd

SD application command opcodes.

all application command opcodes must be prefixed with a CMD55 command to inform the SD card the next command is an application-specific one.

Enumerator
SD_APP_SET_BUS_WIDTH 
SD_APP_SEND_STATUS 
SD_APP_SEND_NUM_WRITTEN_BLK 
SD_APP_SET_WRITE_BLK_ERASE_CNT 
SD_APP_SEND_OP_COND 
SD_APP_CLEAR_CARD_DETECT 
SD_APP_SEND_SCR 

◆ sd_bus_speed

SD bus speed support bit flags.

Bit flags indicating support for SD bus speeds. these bit flags are provided as a response to CMD6 by the card

Enumerator
UHS_SDR12_BUS_SPEED 
DEFAULT_BUS_SPEED 
HIGH_SPEED_BUS_SPEED 
UHS_SDR25_BUS_SPEED 
UHS_SDR50_BUS_SPEED 
UHS_SDR104_BUS_SPEED 
UHS_DDR50_BUS_SPEED 

◆ sd_csd_flag

SD card specific data flags.

flags used in decoding the SD card specific data register

Enumerator
SD_CSD_READ_BLK_PARTIAL_FLAG 

Partial blocks for read allowed [79:79].

SD_CSD_WRITE_BLK_MISALIGN_FLAG 

Write block misalignment [78:78].

SD_CSD_READ_BLK_MISALIGN_FLAG 

Read block misalignment [77:77].

SD_CSD_DSR_IMPLEMENTED_FLAG 

DSR implemented [76:76].

SD_CSD_ERASE_BLK_EN_FLAG 

Erase single block enabled [46:46].

SD_CSD_WRITE_PROTECT_GRP_EN_FLAG 

Write protect group enabled [31:31].

SD_CSD_WRITE_BLK_PARTIAL_FLAG 

Partial blocks for write allowed [21:21].

SD_CSD_FILE_FMT_GRP_FLAG 

File format group [15:15].

SD_CSD_COPY_FLAG 

Copy flag [14:14].

SD_CSD_PERMANENT_WRITE_PROTECT_FLAG 

Permanent write protection [13:13].

SD_CSD_TMP_WRITE_PROTECT_FLAG 

Temporary write protection [12:12].

◆ sd_current_limit

SD current support bitfield.

Used with CMD6 to determine the maximum current the card will draw.

Enumerator
SD_MAX_CURRENT_200MA 

default current limit

SD_MAX_CURRENT_400MA 

current limit to 400MA

SD_MAX_CURRENT_600MA 

current limit to 600MA

SD_MAX_CURRENT_800MA 

current limit to 800MA

◆ sd_current_setting

SD current setting values.

Used with CMD6 to inform the card what its maximum current draw is.

Enumerator
SD_SET_CURRENT_200MA 
SD_SET_CURRENT_400MA 
SD_SET_CURRENT_600MA 
SD_SET_CURRENT_800MA 

◆ sd_driver_strength

SD switch drive type selection.

These values are used to select the preferred driver type for an SD card.

Enumerator
SD_DRV_STRENGTH_TYPEB 

default driver strength

SD_DRV_STRENGTH_TYPEA 

driver strength TYPE A

SD_DRV_STRENGTH_TYPEC 

driver strength TYPE C

SD_DRV_STRENGTH_TYPED 

driver strength TYPE D

◆ sd_driver_type

SD driver types.

Used with CMD6 to determine the driver type the card should use.

Enumerator
SD_DRIVER_TYPE_B 
SD_DRIVER_TYPE_A 
SD_DRIVER_TYPE_C 
SD_DRIVER_TYPE_D 

◆ sd_group_num

SD switch group numbers.

SD CMD6 has multiple function groups it can check/set. These indicies are used to determine which group CMD6 will interact with.

Enumerator
SD_GRP_TIMING_MODE 

access mode group

SD_GRP_CMD_SYS_MODE 

command system group

SD_GRP_DRIVER_STRENGTH_MODE 

driver strength group

SD_GRP_CURRENT_LIMIT_MODE 

current limit group

◆ sd_ocr_flag

SD OCR bit flags.

bit flags present in SD OCR response. Used to determine status and supported functions of SD card.

Enumerator
SD_OCR_PWR_BUSY_FLAG 

Power up busy status.

SD_OCR_HOST_CAP_FLAG 

Card capacity status.

SD_OCR_CARD_CAP_FLAG 

Card capacity status.

SD_OCR_SWITCH_18_REQ_FLAG 

Switch to 1.8V request.

SD_OCR_SWITCH_18_ACCEPT_FLAG 

Switch to 1.8V accepted.

SD_OCR_VDD27_28FLAG 

VDD 2.7-2.8.

SD_OCR_VDD28_29FLAG 

VDD 2.8-2.9.

SD_OCR_VDD29_30FLAG 

VDD 2.9-3.0.

SD_OCR_VDD30_31FLAG 

VDD 3.0-3.1.

SD_OCR_VDD31_32FLAG 

VDD 3.1-3.2.

SD_OCR_VDD32_33FLAG 

VDD 3.2-3.3.

SD_OCR_VDD33_34FLAG 

VDD 3.3-3.4.

SD_OCR_VDD34_35FLAG 

VDD 3.4-3.5.

SD_OCR_VDD35_36FLAG 

VDD 3.5-3.6.

◆ sd_opcode

enum sd_opcode

SD specification command opcodes.

SD specification command opcodes. Note that some command opcodes are specific to SDIO cards, or cards running in SPI mode instead of native SD mode.

Enumerator
SD_GO_IDLE_STATE 
MMC_SEND_OP_COND 
SD_ALL_SEND_CID 
SD_SEND_RELATIVE_ADDR 
MMC_SEND_RELATIVE_ADDR 
SDIO_SEND_OP_COND 
SD_SWITCH 
SD_SELECT_CARD 
SD_SEND_IF_COND 
MMC_SEND_EXT_CSD 
SD_SEND_CSD 
SD_SEND_CID 
SD_VOL_SWITCH 
SD_STOP_TRANSMISSION 
SD_SEND_STATUS 
MMC_CHECK_BUS_TEST 
SD_GO_INACTIVE_STATE 
SD_SET_BLOCK_SIZE 
SD_READ_SINGLE_BLOCK 
SD_READ_MULTIPLE_BLOCK 
SD_SEND_TUNING_BLOCK 
MMC_SEND_BUS_TEST 
MMC_SEND_TUNING_BLOCK 
SD_SET_BLOCK_COUNT 
SD_WRITE_SINGLE_BLOCK 
SD_WRITE_MULTIPLE_BLOCK 
SD_ERASE_BLOCK_START 
SD_ERASE_BLOCK_END 
SD_ERASE_BLOCK_OPERATION 
SDIO_RW_DIRECT 
SDIO_RW_EXTENDED 
SD_APP_CMD 
SD_SPI_READ_OCR 
SD_SPI_CRC_ON_OFF 

◆ sd_r1_current_state

SD current state values.

SD current state values, contained in R1 response data.

Enumerator
SDMMC_R1_IDLE 
SDMMC_R1_READY 
SDMMC_R1_IDENTIFY 
SDMMC_R1_STANDBY 
SDMMC_R1_TRANSFER 
SDMMC_R1_SEND_DATA 
SDMMC_R1_RECIVE_DATA 
SDMMC_R1_PROGRAM 
SDMMC_R1_DISCONNECT 

◆ sd_r1_status

Native SD mode R1 response status flags.

Native response flags for SD R1 response, used to check for error in command.

Enumerator
SD_R1_AUTH_ERR 
SD_R1_APP_CMD 
SD_R1_FX_EVENT 
SD_R1_RDY_DATA 
SD_R1_CUR_STATE 
SD_R1_ERASE_RESET 
SD_R1_ECC_DISABLED 
SD_R1_ERASE_SKIP 
SD_R1_CSD_OVERWRITE 
SD_R1_ERR 
SD_R1_CC_ERR 
SD_R1_ECC_FAIL 
SD_R1_ILLEGAL_CMD 
SD_R1_CRC_ERR 
SD_R1_UNLOCK_FAIL 
SD_R1_CARD_LOCKED 
SD_R1_WP_VIOLATION 
SD_R1_ERASE_PARAM 
SD_R1_ERASE_SEQ_ERR 
SD_R1_BLOCK_LEN_ERR 
SD_R1_ADDR_ERR 
SD_R1_OUT_OF_RANGE 
SD_R1_ERR_FLAGS 
SD_R1ERR_NONE 

◆ sd_rsp_type

SD response types.

SD response types. Note that SPI mode has difference response types than cards in native SD mode.

Enumerator
SD_RSP_TYPE_NONE 
SD_RSP_TYPE_R1 
SD_RSP_TYPE_R1b 
SD_RSP_TYPE_R2 
SD_RSP_TYPE_R3 
SD_RSP_TYPE_R4 
SD_RSP_TYPE_R5 
SD_RSP_TYPE_R5b 
SD_RSP_TYPE_R6 
SD_RSP_TYPE_R7 
SD_SPI_RSP_TYPE_R1 
SD_SPI_RSP_TYPE_R1b 
SD_SPI_RSP_TYPE_R2 
SD_SPI_RSP_TYPE_R3 
SD_SPI_RSP_TYPE_R4 
SD_SPI_RSP_TYPE_R5 
SD_SPI_RSP_TYPE_R7 

◆ sd_scr_flag

SD card configuration register.

flags used in decoding the SD card configuration register

Enumerator
SD_SCR_DATA_STATUS_AFTER_ERASE 

Data status after erases [55:55].

SD_SCR_SPEC3 

Specification version 3.00 or higher [47:47].

◆ sd_spec_version

SD specification version.

SD spec version flags used in decoding the SD card configuration register

Enumerator
SD_SPEC_VER1_0 

SD card version 1.0-1.01.

SD_SPEC_VER1_1 

SD card version 1.10.

SD_SPEC_VER2_0 

SD card version 2.00.

SD_SPEC_VER3_0 

SD card version 3.0.

◆ sd_spi_r1_error_flag

SPI SD mode R1 response status flags.

SPI mode R1 response flags. Used to check for error in SD SPI mode command.

Enumerator
SD_SPI_R1PARAMETER_ERR 
SD_SPI_R1ADDRESS_ERR 
SD_SPI_R1ERASE_SEQ_ERR 
SD_SPI_R1CMD_CRC_ERR 
SD_SPI_R1ILLEGAL_CMD_ERR 
SD_SPI_R1ERASE_RESET 
SD_SPI_R1IDLE_STATE 

◆ sd_spi_r2_status

SPI SD mode R2 response status flags.

SPI mode R2 response flags. Sent in response to SEND_STATUS command. Used to check status of SD card.

Enumerator
SDHC_SPI_R2_CARD_LOCKED 
SDHC_SPI_R2_UNLOCK_FAIL 
SDHC_SPI_R2_ERR 
SDHC_SPI_R2_CC_ERR 
SDHC_SPI_R2_ECC_FAIL 
SDHC_SPI_R2_WP_VIOLATION 
SDHC_SPI_R2_ERASE_PARAM 
SDHC_SPI_R2_OUT_OF_RANGE 

◆ sd_support_flag

SD support flags.

flags used by SD subsystem to determine support for SD card features.

Enumerator
SD_HIGH_CAPACITY_FLAG 
SD_4BITS_WIDTH 
SD_SDHC_FLAG 
SD_SDXC_FLAG 
SD_1800MV_FLAG 
SD_3000MV_FLAG 
SD_CMD23_FLAG 
SD_SPEED_CLASS_CONTROL_FLAG 
SD_MEM_PRESENT_FLAG 

◆ sd_switch_arg

SD switch arguments.

SD CMD6 can either check or set a function. Bitfields are used to indicate feature support when checking a function, and when setting a function an integer value is used to select it.

Enumerator
SD_SWITCH_CHECK 

SD switch mode 0: check function.

SD_SWITCH_SET 

SD switch mode 1: set function.

◆ sd_timing_mode

SD timing mode function selection values.

sent to the card via CMD6 to select a card speed, and used by SD host controller to identify timing of card.

Enumerator
SD_TIMING_DEFAULT 

Default Mode.

SD_TIMING_SDR12 

SDR12 mode.

SD_TIMING_HIGH_SPEED 

High speed mode.

SD_TIMING_SDR25 

SDR25 mode.

SD_TIMING_SDR50 

SDR50 mode.

SD_TIMING_SDR104 

SDR104 mode.

SD_TIMING_DDR50 

DDR50 mode.

◆ sdhc_clock_speed

SD host controller clock speed.

Controls the SD host controller clock speed on the SD bus.

Enumerator
SDMMC_CLOCK_400KHZ 
SD_CLOCK_25MHZ 
SD_CLOCK_50MHZ 
SD_CLOCK_100MHZ 
SD_CLOCK_208MHZ 
MMC_CLOCK_26MHZ 
MMC_CLOCK_52MHZ 
MMC_CLOCK_DDR52 
MMC_CLOCK_HS200 
MMC_CLOCK_HS400 

◆ sdio_cccr_flags

Card common control register flags.

flags to indicate capabilities supported by an SDIO card, read from the CCCR registers

Enumerator
SDIO_SUPPORT_HS 
SDIO_SUPPORT_SDR50 
SDIO_SUPPORT_SDR104 
SDIO_SUPPORT_DDR50 
SDIO_SUPPORT_4BIT_LS_BUS 
SDIO_SUPPORT_MULTIBLOCK 

◆ sdio_func_num

SDIO function number.

SDIO function number used to select function when performing I/O on SDIO card

Enumerator
SDIO_FUNC_NUM_0 
SDIO_FUNC_NUM_1 
SDIO_FUNC_NUM_2 
SDIO_FUNC_NUM_3 
SDIO_FUNC_NUM_4 
SDIO_FUNC_NUM_5 
SDIO_FUNC_NUM_6 
SDIO_FUNC_NUM_7 
SDIO_FUNC_MEMORY 

◆ sdio_io_dir

SDIO I/O direction.

SDIO I/O direction (read or write)

Enumerator
SDIO_IO_READ 
SDIO_IO_WRITE 

◆ sdio_ocr_flag

SDIO OCR bit flags.

bit flags present in SDIO OCR response. Used to determine status and supported functions of SDIO card.

Enumerator
SDIO_OCR_IO_READY_FLAG 
SDIO_OCR_IO_NUMBER 

Number of io function.

SDIO_OCR_MEM_PRESENT_FLAG 

Memory present flag.

SDIO_OCR_180_VOL_FLAG 

Switch to 1.8v signalling.

SDIO_OCR_VDD20_21FLAG 

VDD 2.0-2.1.

SDIO_OCR_VDD21_22FLAG 

VDD 2.1-2.2.

SDIO_OCR_VDD22_23FLAG 

VDD 2.2-2.3.

SDIO_OCR_VDD23_24FLAG 

VDD 2.3-2.4.

SDIO_OCR_VDD24_25FLAG 

VDD 2.4-2.5.

SDIO_OCR_VDD25_26FLAG 

VDD 2.5-2.6.

SDIO_OCR_VDD26_27FLAG 

VDD 2.6-2.7.

SDIO_OCR_VDD27_28FLAG 

VDD 2.7-2.8.

SDIO_OCR_VDD28_29FLAG 

VDD 2.8-2.9.

SDIO_OCR_VDD29_30FLAG 

VDD 2.9-3.0.

SDIO_OCR_VDD30_31FLAG 

VDD 2.9-3.0.

SDIO_OCR_VDD31_32FLAG 

VDD 3.0-3.1.

SDIO_OCR_VDD32_33FLAG 

VDD 3.1-3.2.

SDIO_OCR_VDD33_34FLAG 

VDD 3.2-3.3.

SDIO_OCR_VDD34_35FLAG 

VDD 3.3-3.4.

SDIO_OCR_VDD35_36FLAG 

VDD 3.4-3.5.

◆ uhs_max_data_rate

Enumerator
UHS_UNSUPPORTED 
UHS_SDR12_MAX_DTR 
UHS_SDR25_MAX_DTR 
UHS_SDR50_MAX_DTR 
UHS_SDR104_MAX_DTR 
UHS_DDR50_MAX_DTR