Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sd_spec.h File Reference
#include <stdint.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...
 

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   (28U)
 
#define SDIO_IO_OCR_MASK   (0xFFFFFFU)
 
#define SD_PRODUCT_NAME_BYTES   (5U)
 
#define SDMMC_DEFAULT_BLOCK_SIZE   (512U)
 
#define MMC_EXT_CSD_BYTES   512
 

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 , 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 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_MAX_DTR = 50000000 }
 
enum  sd_bus_speed {
  UHS_SDR12_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_SDR12 = 0U , 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 = 400000U , SD_CLOCK_25MHZ = 25000000U , SD_CLOCK_50MHZ = 50000000U , SD_CLOCK_100MHZ = 100000000U ,
  SD_CLOCK_208MHZ = 208000000U , MMC_CLOCK_26MHZ = 26000000U , MMC_CLOCK_52MHZ = 52000000U , MMC_CLOCK_DDR52 = 52000000U ,
  MMC_CLOCK_HS200 = 200000000U , MMC_CLOCK_HS400 = 200000000U
}
 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...
 

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   (5U)

◆ 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_IO_OCR_MASK

#define SDIO_IO_OCR_MASK   (0xFFFFFFU)

◆ SDIO_OCR_IO_NUMBER_SHIFT

#define SDIO_OCR_IO_NUMBER_SHIFT   (28U)

◆ SDMMC_DEFAULT_BLOCK_SIZE

#define SDMMC_DEFAULT_BLOCK_SIZE   (512U)

Enumeration Type Documentation

◆ hs_max_data_rate

Enumerator
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 
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 2.9-3.0.

SD_OCR_VDD31_32FLAG 

VDD 3.0-3.1.

SD_OCR_VDD32_33FLAG 

VDD 3.1-3.2.

SD_OCR_VDD33_34FLAG 

VDD 3.2-3.3.

SD_OCR_VDD34_35FLAG 

VDD 3.3-3.4.

SD_OCR_VDD35_36FLAG 

VDD 3.4-3.5.

◆ 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 
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_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_SDR12 

Default mode & SDR12.

SD_TIMING_SDR25 

High speed mode & SDR25.

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_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.