sdmmc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
127#ifndef SDMMC_SDMMC_H
128#define SDMMC_SDMMC_H
129
130#include <errno.h>
131
132#include "assert.h"
133#include "byteorder.h"
134#include "macros/units.h"
135#include "periph_conf.h"
136#include "xfa.h"
137
138#ifdef __cplusplus
139extern "C" {
140#endif
141
151#ifndef SDMMC_CPU_DMA_REQUIREMENTS
152#define SDMMC_CPU_DMA_REQUIREMENTS
153#endif
154
163#define sdmmc_buf_t SDMMC_CPU_DMA_REQUIREMENTS uint8_t
164
171#define SDMMC_SDHC_BLOCK_SIZE (512)
172
181#define SDMMC_CMD(n) (n)
182
186#define SDMMC_ACMD_PREFIX (1 << 7)
187
191#define SDMMC_ACMD(n) (SDMMC_ACMD_PREFIX | SDMMC_CMD(n))
192
202typedef enum {
236
238#define SDMMC_CMD_NO_ARG (0x00000000UL)
239
241#define SDMMC_CMD_ARG_RCA(n) ((uint32_t)n << 16)
242
244#define SDMMC_RESP_CRC (1UL << 4)
246#define SDMMC_RESP_BUSY (1UL << 5)
248#define SDMMC_RESP_IDX (0xf)
249
259typedef enum {
267 SDMMC_R4 = 4,
286#define SDMMC_CMD8_CHECK_PATTERN (0xaa)
287#define SDMMC_CMD8_VHS_27_36V (0b0001 << 8)
288#define SDMMC_CMD8_PCIE_AVAIL (1 << 12)
289#define SDMMC_CMD8_PCIE_12V (1 << 13)
292#define SDMMC_CMD8_CHECK (SDMMC_CMD8_VHS_27_36V | SDMMC_CMD8_CHECK_PATTERN)
302#define SDMMC_OCR_18V (1UL << 7)
303#define SDMMC_OCR_27_28V (1UL << 15)
304#define SDMMC_OCR_28_29V (1UL << 16)
305#define SDMMC_OCR_29_30V (1UL << 17)
306#define SDMMC_OCR_30_31V (1UL << 18)
307#define SDMMC_OCR_31_32V (1UL << 19)
308#define SDMMC_OCR_32_33V (1UL << 20)
309#define SDMMC_OCR_33_34V (1UL << 21)
310#define SDMMC_OCR_34_35V (1UL << 22)
311#define SDMMC_OCR_35_36V (1UL << 23)
313#define SDMMC_OCR_S18A (1UL << 24)
314#define SDMMC_OCR_OVER_2TB (1UL << 27)
315#define SDMMC_OCR_UHS_II (1UL << 29)
316#define SDMMC_OCR_CCS (1UL << 30)
317#define SDMMC_OCR_POWER_UP (1UL << 31)
326#define SDMMC_OCR_ALL_VOLTAGES (SDMMC_OCR_27_28V | SDMMC_OCR_28_29V | \
327 SDMMC_OCR_29_30V | SDMMC_OCR_30_31V | \
328 SDMMC_OCR_31_32V | SDMMC_OCR_32_33V | \
329 SDMMC_OCR_33_34V | SDMMC_OCR_34_35V | \
330 SDMMC_OCR_35_36V)
343typedef enum {
348 /* bits 3..5 are left unused for later extensions of SD Memory Card types */
352
356#define SDMMC_CARD_TYPE_SD (SDMMC_CARD_TYPE_SDSC_V1 | \
357 SDMMC_CARD_TYPE_SDSC_V2_V3 | \
358 SDMMC_CARD_TYPE_SDHC_SDXC)
359
372typedef enum {
377
388typedef enum {
396
409#define SDMMC_CARD_STATUS_OUT_OF_RANGE (1UL << 31)
410#define SDMMC_CARD_STATUS_ADDRESS_ERROR (1UL << 30)
411#define SDMMC_CARD_STATUS_BLOCK_LEN_ERROR (1UL << 29)
412#define SDMMC_CARD_STATUS_ERASE_SEQ_ERROR (1UL << 28)
413#define SDMMC_CARD_STATUS_ERASE_PARAM (1UL << 27)
414#define SDMMC_CARD_STATUS_WP_VIOLATION (1UL << 26)
415#define SDMMC_CARD_STATUS_CARD_IS_LOCKED (1UL << 25)
416#define SDMMC_CARD_STATUS_LOCK_UNLOCK_FAILED (1UL << 24)
417#define SDMMC_CARD_STATUS_COM_CRC_ERROR (1UL << 23)
418#define SDMMC_CARD_STATUS_ILLEGAL_COMMAND (1UL << 22)
419#define SDMMC_CARD_STATUS_CARD_ECC_FAILED (1UL << 21)
420#define SDMMC_CARD_STATUS_CC_ERROR (1UL << 20)
421#define SDMMC_CARD_STATUS_ERROR (1UL << 19)
422#define SDMMC_CARD_STATUS_UNDERRUN (1UL << 18)
423#define SDMMC_CARD_STATUS_OVERRUN (1UL << 17)
424#define SDMMC_CARD_STATUS_CSD_OVERWRITE (1UL << 16)
425#define SDMMC_CARD_STATUS_WP_ERASE_SKIP (1UL << 15)
426#define SDMMC_CARD_STATUS_CARD_ECC_DISABLED (1UL << 14)
427#define SDMMC_CARD_STATUS_ERASE_RESET (1UL << 13)
428#define SDMMC_CARD_STATUS_READY_FOR_DATA (1UL << 8)
429#define SDMMC_CARD_STATUS_SWITCH_ERROR (1UL << 7)
430#define SDMMC_CARD_STATUS_FX_EVENT (1UL << 6)
431#define SDMMC_CARD_STATUS_APP_CMD (1UL << 5)
432#define SDMMC_CARD_STATUS_AKE_SEQ_ERROR (1UL << 3)
435#define SDMMC_CARD_STATUS_ERRORS (SDMMC_CARD_STATUS_OUT_OF_RANGE | \
436 SDMMC_CARD_STATUS_ADDRESS_ERROR | \
437 SDMMC_CARD_STATUS_BLOCK_LEN_ERROR | \
438 SDMMC_CARD_STATUS_ERASE_SEQ_ERROR | \
439 SDMMC_CARD_STATUS_ERASE_PARAM | \
440 SDMMC_CARD_STATUS_WP_VIOLATION | \
441 SDMMC_CARD_STATUS_LOCK_UNLOCK_FAILED | \
442 SDMMC_CARD_STATUS_COM_CRC_ERROR | \
443 SDMMC_CARD_STATUS_ILLEGAL_COMMAND | \
444 SDMMC_CARD_STATUS_CARD_ECC_FAILED | \
445 SDMMC_CARD_STATUS_CC_ERROR | \
446 SDMMC_CARD_STATUS_ERROR | \
447 SDMMC_CARD_STATUS_UNDERRUN | \
448 SDMMC_CARD_STATUS_OVERRUN | \
449 SDMMC_CARD_STATUS_CSD_OVERWRITE | \
450 SDMMC_CARD_STATUS_WP_ERASE_SKIP | \
451 SDMMC_CARD_STATUS_SWITCH_ERROR | \
452 SDMMC_CARD_STATUS_AKE_SEQ_ERROR)
453
455#define SDMMC_CARD_STATUS_CURRENT_STATE(n) (((n) >> SDMMC_CARD_STATUS_CURRENT_STATE_Pos) & 0x0f)
456#define SDMMC_CARD_STATUS_CURRENT_STATE_Pos (9)
461enum {
472};
473
477typedef union {
478 struct {
479 uint32_t reserved0 :2;
480 uint32_t reserved2 :1;
481 uint32_t AKE_SEQ_ERROR :1;
482 uint32_t reserved4 :1;
483 uint32_t APP_CMD :1;
484 uint32_t FX_EVENT :1;
485 uint32_t SWITCH_ERROR :1;
486 uint32_t READY_FOR_DATA :1;
487 uint32_t CURRENT_STATE :4;
488 uint32_t ERASE_RESET :1;
489 uint32_t CARD_ECC_DISABLED :1;
490 uint32_t WP_ERASE_SKIP :1;
491 uint32_t CSD_OVERWRITE :1;
492 uint32_t OVERRUN :1;
493 uint32_t UNDERRUN :1;
494 uint32_t ERROR :1;
495 uint32_t CC_ERROR :1;
496 uint32_t CARD_ECC_FAILED :1;
497 uint32_t ILLEGAL_COMMAND :1;
498 uint32_t COM_CRC_ERROR :1;
500 uint32_t CARD_IS_LOCKED :1;
501 uint32_t WP_VIOLATION :1;
502 uint32_t ERASE_PARAM :1;
503 uint32_t ERASE_SEQ_ERROR :1;
504 uint32_t BLOCK_LEN_ERROR :1;
505 uint32_t ADDRESS_ERROR :1;
506 uint32_t OUT_OF_RANGE :1;
507 };
508 uint32_t value;
510
519#define SDMMC_SD_STATUS_SIZE (64)
520
533typedef struct __attribute__((packed)) {
535 uint32_t SUS_ADDR:22;
536 uint32_t VSC_AU_SIZE:10;
537 uint16_t SD_CARD_TYPE:16;
538 uint16_t ERASE_SIZE:16;
539 uint8_t SPEED_CLASS:8;
542 uint8_t ERASE_TIMEOUT:6;
543 uint8_t ERASE_OFFSET:2;
544 uint8_t UHS_SPEED_GRADE:4;
545 uint8_t UHS_AU_SIZE:4;
546 uint8_t AU_SIZE:4;
547 uint8_t DAT_BUS_WIDTH:2;
548 uint8_t SECURED_MODE:1;
550
559#define SDMMC_CID_REG_SIZE (16)
560
561#define SDMMC_CID_OID_SIZE_SD (2)
562#define SDMMC_CID_PNM_SIZE_SD (5)
563#define SDMMC_CID_PNM_SIZE_MMC (6)
571typedef struct __attribute__((packed)) {
572 uint8_t MID;
575 uint8_t PRV;
578 uint8_t CID_CRC;
580
588typedef struct __attribute__((packed)) {
589 uint8_t MID;
592 uint8_t PRV;
594 uint8_t MDT;
595 uint8_t CID_CRC;
597
601typedef union {
605
622typedef enum {
628
630#define SDMMC_CSD_REG_SIZE (16)
631
638typedef struct __attribute__((packed)) {
639 uint32_t CSD_CRC:8;
640 uint32_t reserved5:1;
641 uint32_t WP_UPC:1;
642 uint32_t FILE_FORMAT:2;
643 uint32_t TMP_WRITE_PROTECT:1;
645 uint32_t COPY:1;
646 uint32_t FILE_FORMAT_GRP:1;
647 uint32_t reserved4:5;
648 uint32_t WRITE_BL_PARTIAL:1;
649 uint32_t WRITE_BL_LEN:4;
650 uint32_t R2W_FACTOR:3;
651 uint32_t reserved3:2;
652 uint32_t WP_GRP_ENABLE:1;
653 uint32_t WP_GRP_SIZE:7;
654 uint32_t SECTOR_SIZE:7;
655 uint32_t ERASE_BLK_EN:1;
656 uint32_t C_SIZE_MULT:3;
657 uint32_t VDD_W_CURR_MAX:3;
658 uint32_t VDD_W_CURR_MIN:3;
659 uint32_t VDD_R_CURR_MAX:3;
660 uint32_t VDD_R_CURR_MIN:3;
661 uint32_t C_SIZE:12;
662 uint32_t reserved2:2;
663 uint32_t DSR_IMP:1;
664 uint32_t READ_BLK_MISALIGN:1;
666 uint32_t READ_BL_PARTIAL:1;
667 uint32_t READ_BL_LEN:4;
668 uint32_t CCC:12;
669 uint32_t TRAN_SPEED:8;
670 uint32_t NSAC:8;
671 uint32_t TAAC:8;
672 uint32_t reserved1:6;
673 uint32_t CSD_STRUCTURE:2;
675
687typedef struct __attribute__((packed)) {
688 uint32_t CSD_CRC:8;
689 uint32_t reserved5:1;
690 uint32_t WP_UPC:1;
691 uint32_t FILE_FORMAT:2;
692 uint32_t TMP_WRITE_PROTECT:1;
694 uint32_t COPY:1;
695 uint32_t FILE_FORMAT_GRP:1;
696 uint32_t reserved4:5;
697 uint32_t WRITE_BL_PARTIAL:1;
698 uint32_t WRITE_BL_LEN:4;
699 uint32_t R2W_FACTOR:3;
700 uint32_t reserved3:2;
701 uint32_t WP_GRP_ENABLE:1;
702 uint32_t WP_GRP_SIZE:7;
703 uint32_t SECTOR_SIZE:7;
704 uint32_t ERASE_BLK_EN:1;
705 uint32_t reserved2:1;
706 uint32_t C_SIZE:28;
707 uint32_t DSR_IMP:1;
708 uint32_t READ_BLK_MISALIGN:1;
710 uint32_t READ_BL_PARTIAL:1;
711 uint32_t READ_BL_LEN:4;
712 uint32_t CCC:12;
713 uint32_t TRAN_SPEED:8;
714 uint32_t NSAC:8;
715 uint32_t TAAC:8;
716 uint32_t reserved1:6;
717 uint32_t CSD_STRUCTURE:2;
719
727typedef struct __attribute__((packed)) {
728 uint32_t CSD_CRC:8;
729 uint32_t ECC:2;
730 uint32_t FILE_FORMAT:2;
731 uint32_t TMP_WRITE_PROTECT:1;
733 uint32_t COPY:1;
734 uint32_t FILE_FORMAT_GRP:1;
735 uint32_t CONTENT_PROT_APP:1;
736 uint32_t reserved4:4;
737 uint32_t WRITE_BL_PARTIAL:1;
738 uint32_t WRITE_BL_LEN:4;
739 uint32_t R2W_FACTOR:3;
740 uint32_t DEFAULT_ECC:2;
741 uint32_t WP_GRP_ENABLE:1;
742 uint32_t WP_GRP_SIZE:5;
743 uint32_t ERASE_GRP_MULT:5;
744 uint32_t ERASE_GRP_SIZE:5;
745 uint32_t C_SIZE_MULT:3;
746 uint32_t VDD_W_CURR_MAX:3;
747 uint32_t VDD_W_CURR_MIN:3;
748 uint32_t VDD_R_CURR_MAX:3;
749 uint32_t VDD_R_CURR_MIN:3;
750 uint16_t C_SIZE:12;
751 uint32_t reserved2:2;
752 uint32_t DSR_IMP:1;
753 uint32_t READ_BLK_MISALIGN:1;
755 uint32_t READ_BL_PARTIAL:1;
756 uint32_t READ_BL_LEN:4;
757 uint32_t CCC:12;
758 uint32_t TRAN_SPEED:8;
759 uint32_t NSAC:8;
760 uint32_t TAAC:8;
761 uint32_t reserved1:2;
762 uint32_t SPEC_VERS:4;
763 uint32_t CSD_STRUCTURE:2;
765
769typedef union {
774
776#define SDMMC_EXT_CSD_REG_SIZE (512)
777
789typedef struct {
790 uint32_t SEC_COUNT;
791 uint8_t CARD_TYPE;
793 uint8_t BUS_WIDTH;
795
807#define SDMMC_SCR_REG_SIZE (8)
808
815typedef struct {
816 /* first 32-bit word */
817 uint32_t reserved0;
818 /* second 32-bit word */
819 union {
820 struct {
821 uint32_t CMD_SUPPORT:5;
822 uint32_t reserved37:1;
823 uint32_t SD_SPECX:4;
824 uint32_t SD_SPEC4:1;
825 uint32_t EX_SECURITY:4;
826 uint32_t SD_SPEC3:1;
827 uint32_t SD_BUS_WIDTHS:4;
828 uint32_t SD_SECURITY:3;
830 uint32_t SD_SPEC:4;
831 uint32_t SCR_STRUCTURE:4;
832 };
833 uint32_t value;
834 };
836
837#define SDMMC_SCR_ACMD_53_54_SUPPORT (0b10000)
839#define SDMMC_SCR_ACMD_58_59_SUPPORT (0b01000)
841#define SDMMC_SCR_ACMD_48_49_SUPPORT (0b00100)
843#define SDMMC_SCR_ACMD_23_SUPPORT (0b00010)
845#define SDMMC_SCR_ACMD_20_SUPPORT (0b00001)
866#define SDMMC_SCR_SD_SPEC(scr) \
867 (scr.SD_SPEC + scr.SD_SPEC3 + (scr.SD_SPECX ? scr.SD_SPECX + 1 : scr.SD_SPEC4))
868
875#define SDMMC_DEV(x) (sdmmc_get_dev(x))
881typedef struct sdmmc_dev sdmmc_dev_t;
882
886typedef enum {
891
898typedef struct {
900 bool write;
903 uint32_t arg;
904 uint16_t block_size;
905 uint16_t block_num;
907
917typedef enum {
918 SDMMC_AUTO_CMD_NONE = 0x00,
919 SDMMC_AUTO_CMD12 = 0x01,
920 SDMMC_AUTO_CMD23 = 0x02,
921 SDMMC_AUTO_CMD_BOTH = 0x03,
923
927typedef enum {
928 SDMMC_EVENT_CARD_INSERTED,
929 SDMMC_EVENT_CARD_REMOVED,
931
944
956typedef struct {
975 void (*init)(sdmmc_dev_t *dev);
976
1031 int (*send_cmd)(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg,
1032 sdmmc_resp_t resp_type, uint32_t *resp);
1033
1060 int (*card_init)(sdmmc_dev_t *dev);
1061
1111 int (*set_bus_width)(sdmmc_dev_t *dev, sdmmc_bus_width_t width);
1112
1137 int (*set_clock_rate)(sdmmc_dev_t *dev, sdmmc_clock_rate_t rate);
1138
1139#if !IS_USED(MODULE_PERIPH_SDMMC_AUTO_CLK) || DOXYGEN
1156 int (*enable_clock)(sdmmc_dev_t *dev, bool enable);
1157#endif
1158
1183 int (*xfer_prepare)(sdmmc_dev_t *dev, sdmmc_xfer_desc_t *xfer);
1184
1226 int (*xfer_execute)(sdmmc_dev_t *dev, sdmmc_xfer_desc_t *xfer,
1227 const void *data_wr, void *data_rd,
1228 uint16_t *done);
1229
1249 int (*xfer_finish)(sdmmc_dev_t *dev, sdmmc_xfer_desc_t *xfer);
1250
1252
1269typedef struct sdmmc_dev {
1275
1288
1296
1304
1312
1313#if IS_USED(MODULE_SDMMC_MMC)
1318 sdmmc_ext_csd_t ext_csd;
1319#endif
1320
1326 uint32_t status;
1327
1333 uint16_t rca;
1334
1341
1350
1359
1366
1373
1380
1387
1388} sdmmc_dev_t;
1389
1430#if !DOXYGEN
1432#else
1434#endif
1435
1439#define SDMMC_NUMOF XFA_LEN(sdmmc_dev_t *, sdmmc_devs)
1440
1453static inline sdmmc_dev_t *sdmmc_get_dev(unsigned num)
1454{
1455 return (num < SDMMC_NUMOF) ? sdmmc_devs[num] : NULL;
1456}
1457
1477static inline void sdmmc_init(sdmmc_dev_t *dev)
1478{
1479 assert(dev);
1480 assert(dev->driver);
1481
1482 dev->driver->init(dev);
1483}
1484
1532int sdmmc_send_cmd(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg,
1533 sdmmc_resp_t resp_type, uint32_t *resp);
1534
1591int sdmmc_send_acmd(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg,
1592 sdmmc_resp_t resp_type, uint32_t *resp);
1593
1645
1749int sdmmc_xfer(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg,
1750 uint16_t block_size, uint16_t block_num,
1751 const void *data_wr, void *data_rd, uint16_t *done);
1752
1807 uint32_t block_addr, uint16_t block_size,
1808 uint16_t block_num, void *data, uint16_t *done);
1809
1863int sdmmc_write_blocks(sdmmc_dev_t *dev, uint32_t block_addr,
1864 uint16_t block_size, uint16_t block_num,
1865 const void *data, uint16_t *done);
1866
1901 uint32_t block_addr, uint16_t block_num);
1902
1933
1953
1956#ifdef __cplusplus
1957}
1958#endif
1959
1960#endif /* SDMMC_SDMMC_H */
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:137
Functions to work with different byte orders.
sdmmc_cmd_t
SDIO/SD/MMC Commands.
Definition: sdmmc.h:202
sdmmc_xfer_type_t
Data transfer types.
Definition: sdmmc.h:886
sdmmc_auto_cmd_t
Auto Command features supported by the SDIO/SD/MMC peripheral.
Definition: sdmmc.h:917
int sdmmc_read_blocks(sdmmc_dev_t *dev, uint32_t block_addr, uint16_t block_size, uint16_t block_num, void *data, uint16_t *done)
Read a number of blocks.
int sdmmc_xfer(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg, uint16_t block_size, uint16_t block_num, const void *data_wr, void *data_rd, uint16_t *done)
Perform a data transfer with the selected card or embedded device.
struct sdmmc_dev sdmmc_dev_t
sdmmc_dev_t forward declaration
Definition: sdmmc.h:881
#define SDMMC_CID_OID_SIZE_SD
OID (OEM/Application ID) size in byte (SD)
Definition: sdmmc.h:561
sdmmc_resp_t
SDIO/SD/MMC Response types.
Definition: sdmmc.h:259
static void sdmmc_init(sdmmc_dev_t *dev)
Basic initialization of the given SDIO/SD/MMC device.
Definition: sdmmc.h:1477
int sdmmc_erase_blocks(sdmmc_dev_t *dev, uint32_t block_addr, uint16_t block_num)
Erase a number of blocks.
static sdmmc_dev_t * sdmmc_get_dev(unsigned num)
Retrieve SDIO/SD/MMC device descriptor reference from device index.
Definition: sdmmc.h:1453
#define SDMMC_CMD(n)
Command index.
Definition: sdmmc.h:181
sdmmc_dev_t sdmmc_devs[]
SDIO/SD/MMC device descriptor references as read-only XFA.
Definition: sdmmc.h:1433
#define SDMMC_ACMD(n)
Application specific command index.
Definition: sdmmc.h:191
sdmmc_clock_rate_t
SDIO/SD/MMC Card clock rate types.
Definition: sdmmc.h:388
#define SDMMC_RESP_BUSY
Mask to check whether the response includes busy status from card.
Definition: sdmmc.h:246
int sdmmc_read_sds(sdmmc_dev_t *dev, sdmmc_sd_status_t *sds)
Read SD Status Register.
sdmmc_card_type_t
SDIO/SD/MMC Card types.
Definition: sdmmc.h:343
int sdmmc_card_init(sdmmc_dev_t *dev)
Card Initialization and Identification.
void(* sdmmc_event_cb_t)(sdmmc_dev_t *dev, sdmmc_event_t event)
Event callback function type.
Definition: sdmmc.h:943
#define SDMMC_NUMOF
Number of SDIO/SD/MMC devices defined.
Definition: sdmmc.h:1439
#define SDMMC_CID_PNM_SIZE_MMC
PNM (Product name) size in byte (MMC)
Definition: sdmmc.h:563
uint64_t sdmmc_get_capacity(sdmmc_dev_t *dev)
Get Capacity of SD/MMC Card.
int sdmmc_send_acmd(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg, sdmmc_resp_t resp_type, uint32_t *resp)
Send application specific command optionally wait for response.
int sdmmc_write_blocks(sdmmc_dev_t *dev, uint32_t block_addr, uint16_t block_size, uint16_t block_num, const void *data, uint16_t *done)
Write a number of blocks.
#define SDMMC_RESP_CRC
Mask to check whether the response type uses CRC7.
Definition: sdmmc.h:244
sdmmc_csd_version_t
CSD Register Versions (SD Memory Card and MMC)
Definition: sdmmc.h:622
sdmmc_event_t
Events generated by SDIO/SD/MMC high level API.
Definition: sdmmc.h:927
#define SDMMC_CID_PNM_SIZE_SD
PNM (Product name) size in byte (SD)
Definition: sdmmc.h:562
int sdmmc_send_cmd(sdmmc_dev_t *dev, sdmmc_cmd_t cmd_idx, uint32_t arg, sdmmc_resp_t resp_type, uint32_t *resp)
Send command to SDIO/SD/MMC Card and optionally wait for response.
sdmmc_bus_width_t
SDIO/SD/MMC Card data bus widths.
Definition: sdmmc.h:372
@ SDMMC_CMD5
SD_APP_OP_COND (SDIO only)
Definition: sdmmc.h:208
@ SDMMC_CMD58
READ_OCR (SPI mode only)
Definition: sdmmc.h:228
@ SDMMC_CMD16
SET_BLOCKLEN.
Definition: sdmmc.h:216
@ SDMMC_ACMD51
SEND_SCR.
Definition: sdmmc.h:234
@ SDMMC_CMD33
ERASE_WR_BLK_END.
Definition: sdmmc.h:223
@ SDMMC_CMD25
WRITE_MULTIPLE_BLOCK.
Definition: sdmmc.h:221
@ SDMMC_ACMD13
SD_STATUS.
Definition: sdmmc.h:231
@ SDMMC_CMD4
SET_DSR.
Definition: sdmmc.h:207
@ SDMMC_ACMD41
SD_APP_OP_COND.
Definition: sdmmc.h:233
@ SDMMC_CMD7
SELECT/DESELECT_CARD.
Definition: sdmmc.h:210
@ SDMMC_CMD32
ERASE_WR_BLK_START.
Definition: sdmmc.h:222
@ SDMMC_CMD17
READ_SINGLE_BLOCK.
Definition: sdmmc.h:217
@ SDMMC_CMD6
SWITCH.
Definition: sdmmc.h:209
@ SDMMC_CMD38
ERASE.
Definition: sdmmc.h:224
@ SDMMC_CMD8
SEND_IF_COND (SD), SEND_EXT_CSD (MMC)
Definition: sdmmc.h:211
@ SDMMC_CMD24
WRITE_BLOCK.
Definition: sdmmc.h:220
@ SDMMC_CMD59
CRC_ON_OFF (SPI mode only)
Definition: sdmmc.h:229
@ SDMMC_CMD13
SEND_STATUS.
Definition: sdmmc.h:215
@ SDMMC_CMD3
SET_RELATIVE_ADDR.
Definition: sdmmc.h:206
@ SDMMC_CMD52
IO_RW_DIRECT (SDIO only)
Definition: sdmmc.h:225
@ SDMMC_CMD53
IO_RW_EXTENDED (SDIO only)
Definition: sdmmc.h:226
@ SDMMC_ACMD23
SET_WR_BLK_ERASE_COUNT.
Definition: sdmmc.h:232
@ SDMMC_CMD55
APP_CMD.
Definition: sdmmc.h:227
@ SDMMC_CMD12
STOP_TRANSMISSION.
Definition: sdmmc.h:214
@ SDMMC_CMD10
SEND_CID.
Definition: sdmmc.h:213
@ SDMMC_CMD23
SET_BLOCK_COUNT.
Definition: sdmmc.h:219
@ SDMMC_ACMD6
SET_BUS_WIDTH.
Definition: sdmmc.h:230
@ SDMMC_CMD2
ALL_SEND_CID.
Definition: sdmmc.h:205
@ SDMMC_CMD9
SEND_CSD.
Definition: sdmmc.h:212
@ SDMMC_CMD18
READ_MULTIPLE_BLOCK.
Definition: sdmmc.h:218
@ SDMMC_CMD1
SEND_OP_COND.
Definition: sdmmc.h:204
@ SDMMC_CMD0
GO_IDLE_STATE.
Definition: sdmmc.h:203
@ SDMMC_BLOCK
Transfer block with size of READ_BL_LEN/WRITE_BL_LEN.
Definition: sdmmc.h:888
@ SDMMC_MULTIBYTE
Transfer 1 to READ_BL_LEN/WRITE_BL_LEN bytes.
Definition: sdmmc.h:887
@ SDMMC_STREAM
Transfer until CMD12 is sent (MMC and 1-bit bus only)
Definition: sdmmc.h:889
@ SDMMC_R4
Fast I/O [48 bit (16 bit RCA, 1 bit status, 7 bit addr, 8 bit reg)].
Definition: sdmmc.h:267
@ SDMMC_R3
OCR Resister [48 bit (32 bit OCR)].
Definition: sdmmc.h:266
@ SDMMC_NO_R
No response expected.
Definition: sdmmc.h:260
@ SDMMC_R1
Normal Response [48 bit (32 bit card status)].
Definition: sdmmc.h:261
@ SDMMC_R6
Published RCA Response [48 bit (16 bit RCA, 16 bit card status)
Definition: sdmmc.h:271
@ SDMMC_R1B
Normal Response [48 bit (R1 with optional busy signal on DAT0)].
Definition: sdmmc.h:262
@ SDMMC_R7
Card Interface Condition [48 bit] (32 bit data, see section 4.9.6)
Definition: sdmmc.h:273
@ SDMMC_R2
CID/CSD [136 bit (128 bit CID or CSD)].
Definition: sdmmc.h:265
@ SDMMC_R5
Interrupt Request [48 bit (16 bit RCA, 16 bit not defined)
Definition: sdmmc.h:269
@ SDMMC_CLK_20M
MMC Card in Data Transfer Mode (Backward Compatibility)
Definition: sdmmc.h:390
@ SDMMC_CLK_400K
Identification Mode f_OD (400 kHz)
Definition: sdmmc.h:389
@ SDMMC_CLK_52M
MMC/eMMC in Data Transfer Mode (High Speed)
Definition: sdmmc.h:394
@ SDMMC_CLK_26M
MMC/eMMC Card in Data Transfer Mode (Default Speed)
Definition: sdmmc.h:392
@ SDMMC_CLK_25M
SD/SDIO Card in Data Transfer Mode (Default Speed)
Definition: sdmmc.h:391
@ SDMMC_CLK_50M
SD/SDIO Card in Data Transfer Mode (High Speed)
Definition: sdmmc.h:393
@ SDMMC_CARD_TYPE_SDSC_V2_V3
SD Memory Card Standard Capacity (SDSC) Version 2.x+.
Definition: sdmmc.h:346
@ SDMMC_CARD_TYPE_MMC
MultiMedia Card.
Definition: sdmmc.h:350
@ SDMMC_CARD_TYPE_SDIO
SDIO Card.
Definition: sdmmc.h:349
@ SDMMC_CARD_TYPE_SDHC_SDXC
SD Memory Card High or Extended Capacity (SDHC/SDXC)
Definition: sdmmc.h:347
@ SDMMC_CARD_TYPE_SDSC_V1
SD Memory Card Standard Capacity (SDSC) Version 1.x.
Definition: sdmmc.h:345
@ SDMMC_CARD_TYPE_UNKNOWN
Card type unknown.
Definition: sdmmc.h:344
@ SDMMC_CARD_STATE_IDLE
Idle.
Definition: sdmmc.h:462
@ SDMMC_CARD_STATE_READY
Ready.
Definition: sdmmc.h:463
@ SDMMC_CARD_STATE_DATA
Data.
Definition: sdmmc.h:467
@ SDMMC_CARD_STATE_RCV
Receive.
Definition: sdmmc.h:468
@ SDMMC_CARD_STATE_PRG
Programming.
Definition: sdmmc.h:469
@ SDMMC_CARD_STATE_BTST
Bus Test.
Definition: sdmmc.h:471
@ SDMMC_CARD_STATE_TRAN
Transfer.
Definition: sdmmc.h:466
@ SDMMC_CARD_STATE_IDENT
Identification.
Definition: sdmmc.h:464
@ SDMMC_CARD_STATE_DIS
Disconnect.
Definition: sdmmc.h:470
@ SDMMC_CARD_STATE_STBY
Stand-by.
Definition: sdmmc.h:465
@ SDMMC_CSD_V1
CSD Version 1.0 (SDSC and MMC)
Definition: sdmmc.h:623
@ SDMMC_CSD_V3
CSD Version 3.0 (SDUC) or Version 1.2 (MMC)
Definition: sdmmc.h:625
@ SDMMC_CSD_V2
CSD Version 2.0 (SDHC/SDXC) or Version 1.1 (MMC)
Definition: sdmmc.h:624
@ SDMMC_CSD_Vx
Reserved (SD) or Version in EXT_CSD (MMC)
Definition: sdmmc.h:626
@ SDMMC_BUS_WIDTH_1BIT
Data bus width is 1 bit (default)
Definition: sdmmc.h:373
@ SDMMC_BUS_WIDTH_4BIT
Data bus width is 4 bit.
Definition: sdmmc.h:374
@ SDMMC_BUS_WIDTH_8BIT
Data bus width is 8 bit.
Definition: sdmmc.h:375
event structure
Definition: event.h:148
CID register structure (MMC)
Definition: sdmmc.h:588
be_uint32_t PSN
Product serial number in big-endian order.
Definition: sdmmc.h:593
uint8_t MDT
Manufacturing date.
Definition: sdmmc.h:594
be_uint16_t OID
OEM/Application ID in big-endian order.
Definition: sdmmc.h:590
uint8_t PRV
Product revision.
Definition: sdmmc.h:592
uint8_t CID_CRC
CRC7 checksum including bit 0.
Definition: sdmmc.h:595
uint8_t MID
Manufacturer ID.
Definition: sdmmc.h:589
CID register structure (SD Memory Cards)
Definition: sdmmc.h:571
be_uint32_t PSN
Product serial number in big-endian order.
Definition: sdmmc.h:576
uint8_t CID_CRC
CRC7 checksum including bit 0.
Definition: sdmmc.h:578
uint8_t MID
Manufacturer ID.
Definition: sdmmc.h:572
uint8_t PRV
Product revision.
Definition: sdmmc.h:575
be_uint16_t MDT
Manufacturing date in big-endian order.
Definition: sdmmc.h:577
CSD register structure for MMC.
Definition: sdmmc.h:727
uint32_t R2W_FACTOR
Write speed factor [28:26].
Definition: sdmmc.h:739
uint32_t reserved4
reserved [20:17]
Definition: sdmmc.h:736
uint32_t WP_GRP_SIZE
Write protect group size [36:32].
Definition: sdmmc.h:742
uint32_t TMP_WRITE_PROTECT
Temporary write protection [12].
Definition: sdmmc.h:731
uint32_t DEFAULT_ECC
Manufacturer default ECC [30:29].
Definition: sdmmc.h:740
uint32_t CSD_STRUCTURE
CSD structure [127:126].
Definition: sdmmc.h:763
uint32_t CONTENT_PROT_APP
Content protection application [16].
Definition: sdmmc.h:735
uint32_t WRITE_BL_LEN
Max.
Definition: sdmmc.h:738
uint32_t VDD_W_CURR_MIN
Max.
Definition: sdmmc.h:747
uint32_t FILE_FORMAT
File format [11:10].
Definition: sdmmc.h:730
uint32_t DSR_IMP
DSR implemented [76].
Definition: sdmmc.h:752
uint32_t WP_GRP_ENABLE
write protect group enable [31]
Definition: sdmmc.h:741
uint32_t reserved2
reserved [75:74]
Definition: sdmmc.h:751
uint32_t NSAC
Data read access-time-2 in CLK cycles [111:104].
Definition: sdmmc.h:759
uint32_t VDD_R_CURR_MAX
Max.
Definition: sdmmc.h:748
uint32_t CCC
Card command classes [95:84].
Definition: sdmmc.h:757
uint32_t WRITE_BL_PARTIAL
partial blocks for write allowed [21]
Definition: sdmmc.h:737
uint32_t reserved1
reserved [121:120]
Definition: sdmmc.h:761
uint32_t FILE_FORMAT_GRP
File format group [15].
Definition: sdmmc.h:734
uint32_t TRAN_SPEED
Max.
Definition: sdmmc.h:758
uint32_t ERASE_GRP_MULT
Erase group size multiplier [41:37].
Definition: sdmmc.h:743
uint32_t TAAC
Data read access-time-1 [119:112].
Definition: sdmmc.h:760
uint32_t WRITE_BLK_MISALIGN
Write block misalignment [78].
Definition: sdmmc.h:754
uint32_t CSD_CRC
CRC including End bit 1b [7:0].
Definition: sdmmc.h:728
uint32_t COPY
Copy flag [14].
Definition: sdmmc.h:733
uint32_t SPEC_VERS
Specification version [125:122].
Definition: sdmmc.h:762
uint32_t ERASE_GRP_SIZE
Erase group size [46:42].
Definition: sdmmc.h:744
uint16_t C_SIZE
Device size [73:62].
Definition: sdmmc.h:750
uint32_t VDD_W_CURR_MAX
Max.
Definition: sdmmc.h:746
uint32_t VDD_R_CURR_MIN
Max.
Definition: sdmmc.h:749
uint32_t READ_BL_LEN
Max.
Definition: sdmmc.h:756
uint32_t PERM_WRITE_PROTECT
Permanent write protection [13].
Definition: sdmmc.h:732
uint32_t ECC
ECC code [9:8].
Definition: sdmmc.h:729
uint32_t READ_BLK_MISALIGN
Read block misalignment [77].
Definition: sdmmc.h:753
uint32_t C_SIZE_MULT
Device size multiplier [49:47].
Definition: sdmmc.h:745
uint32_t READ_BL_PARTIAL
Partial blocks for read allowed [79].
Definition: sdmmc.h:755
CSD register structure Version 1.0.
Definition: sdmmc.h:638
uint32_t WRITE_BL_LEN
max.
Definition: sdmmc.h:649
uint32_t FILE_FORMAT_GRP
File format group [15].
Definition: sdmmc.h:646
uint32_t READ_BL_PARTIAL
partial blocks for read allowed [79]
Definition: sdmmc.h:666
uint32_t PERM_WRITE_PROTECT
permanent write protection [13]
Definition: sdmmc.h:644
uint32_t VDD_R_CURR_MIN
max.
Definition: sdmmc.h:660
uint32_t TMP_WRITE_PROTECT
temporary write protection [12]
Definition: sdmmc.h:643
uint32_t WP_GRP_SIZE
write protect group size [38:32]
Definition: sdmmc.h:653
uint32_t R2W_FACTOR
write speed factor [28:26]
Definition: sdmmc.h:650
uint32_t reserved2
reserved [75:74]
Definition: sdmmc.h:662
uint32_t FILE_FORMAT
File format [11:10].
Definition: sdmmc.h:642
uint32_t CSD_CRC
CRC including End bit 1b [7:0].
Definition: sdmmc.h:639
uint32_t TRAN_SPEED
max.
Definition: sdmmc.h:669
uint32_t VDD_W_CURR_MAX
max.
Definition: sdmmc.h:657
uint32_t TAAC
data read access-time-1 [119:112]
Definition: sdmmc.h:671
uint32_t C_SIZE
device size [73:62]
Definition: sdmmc.h:661
uint32_t WRITE_BL_PARTIAL
partial blocks for write allowed [21]
Definition: sdmmc.h:648
uint32_t SECTOR_SIZE
erase sector size [45:39]
Definition: sdmmc.h:654
uint32_t READ_BLK_MISALIGN
read block misalignment [77]
Definition: sdmmc.h:664
uint32_t DSR_IMP
DSR implemented [76].
Definition: sdmmc.h:663
uint32_t VDD_R_CURR_MAX
max.
Definition: sdmmc.h:659
uint32_t WP_GRP_ENABLE
write protect group enable [31]
Definition: sdmmc.h:652
uint32_t CSD_STRUCTURE
CSD structure [127:126].
Definition: sdmmc.h:673
uint32_t reserved4
reserved [20:16]
Definition: sdmmc.h:647
uint32_t reserved3
reserved [30:29]
Definition: sdmmc.h:651
uint32_t reserved1
reserved [125:120]
Definition: sdmmc.h:672
uint32_t READ_BL_LEN
max.
Definition: sdmmc.h:667
uint32_t NSAC
data read access-time-2 in CLK cycles [111:104]
Definition: sdmmc.h:670
uint32_t WP_UPC
write protection until power cycle [9]
Definition: sdmmc.h:641
uint32_t WRITE_BLK_MISALIGN
write block misalignment [78]
Definition: sdmmc.h:665
uint32_t VDD_W_CURR_MIN
max.
Definition: sdmmc.h:658
uint32_t COPY
copy flag [14]
Definition: sdmmc.h:645
uint32_t ERASE_BLK_EN
erase single block enable [46]
Definition: sdmmc.h:655
uint32_t reserved5
reserved [8]
Definition: sdmmc.h:640
uint32_t C_SIZE_MULT
device size multiplier [49:47]
Definition: sdmmc.h:656
uint32_t CCC
card command classes [95:84]
Definition: sdmmc.h:668
CSD register structure Version 2.0 and Version 3.0.
Definition: sdmmc.h:687
uint32_t WRITE_BL_LEN
max.
Definition: sdmmc.h:698
uint32_t reserved2
reserved [47]
Definition: sdmmc.h:705
uint32_t WP_GRP_ENABLE
write protect group enable [31]
Definition: sdmmc.h:701
uint32_t SECTOR_SIZE
erase sector size [45:39]
Definition: sdmmc.h:703
uint32_t TMP_WRITE_PROTECT
temporary write protection [12]
Definition: sdmmc.h:692
uint32_t FILE_FORMAT_GRP
File format group [15].
Definition: sdmmc.h:695
uint32_t reserved4
reserved [20:16]
Definition: sdmmc.h:696
uint32_t READ_BLK_MISALIGN
read block misalignment [77]
Definition: sdmmc.h:708
uint32_t PERM_WRITE_PROTECT
permanent write protection [13]
Definition: sdmmc.h:693
uint32_t WP_UPC
write protection until power cycle [9]
Definition: sdmmc.h:690
uint32_t TAAC
data read access-time-1 [119:112]
Definition: sdmmc.h:715
uint32_t DSR_IMP
DSR implemented [76].
Definition: sdmmc.h:707
uint32_t ERASE_BLK_EN
erase single block enable [46]
Definition: sdmmc.h:704
uint32_t READ_BL_LEN
max.
Definition: sdmmc.h:711
uint32_t CCC
card command classes [95:84]
Definition: sdmmc.h:712
uint32_t WRITE_BL_PARTIAL
partial blocks for write allowed [21]
Definition: sdmmc.h:697
uint32_t FILE_FORMAT
File format [11:10].
Definition: sdmmc.h:691
uint32_t CSD_CRC
CRC including End bit 1b [7:0].
Definition: sdmmc.h:688
uint32_t CSD_STRUCTURE
CSD structure [127:126].
Definition: sdmmc.h:717
uint32_t reserved3
reserved [30:29]
Definition: sdmmc.h:700
uint32_t reserved5
reserved [8]
Definition: sdmmc.h:689
uint32_t reserved1
reserved [125:120]
Definition: sdmmc.h:716
uint32_t WP_GRP_SIZE
write protect group size [38:32]
Definition: sdmmc.h:702
uint32_t COPY
copy flag [14]
Definition: sdmmc.h:694
uint32_t TRAN_SPEED
max.
Definition: sdmmc.h:713
uint32_t C_SIZE
device size v2.0 [69:48], v3.0 [75:48]
Definition: sdmmc.h:706
uint32_t WRITE_BLK_MISALIGN
write block misalignment [78]
Definition: sdmmc.h:709
uint32_t NSAC
data read access-time-2 in CLK cycles [111:104]
Definition: sdmmc.h:714
uint32_t READ_BL_PARTIAL
partial blocks for read allowed [79]
Definition: sdmmc.h:710
uint32_t R2W_FACTOR
write speed factor [28:26]
Definition: sdmmc.h:699
SDIO/SD/MMC device descriptor.
Definition: sdmmc.h:1269
bool init_done
Indicates whether the card is initialized (default false).
Definition: sdmmc.h:1365
uint16_t rca
Relative Card Address (RCA) of the SDIO/SD/MMC Card as determined during the initialization and ident...
Definition: sdmmc.h:1333
sdmmc_scr_t scr
SCR register of the SD Card, read during the initialization and identification procedure in the sdmmc...
Definition: sdmmc.h:1303
sdmmc_cid_t cid
CID register of the SD/MMC Card, read during the initialization and identification procedure in the s...
Definition: sdmmc.h:1295
bool s18v_allowed
Indicates whether the card supports the switching to 1.8V (default false).
Definition: sdmmc.h:1379
bool spi_mode
Indicates whether SPI mode is used by the SDIO/SD/MMC device (default false).
Definition: sdmmc.h:1386
uint32_t status
Last SDIO/SD/MMC Card status reported in R1 response.
Definition: sdmmc.h:1326
sdmmc_card_type_t type
Type of the SDIO/SD/MMC Card as identified during the initialization and identification procedure in ...
Definition: sdmmc.h:1340
const sdmmc_driver_t * driver
Low-level SDIO/SD/MMC peripheral driver.
Definition: sdmmc.h:1274
sdmmc_event_cb_t event_cb
The application can register an event callback function of type sdmmc_event_cb_t which is called when...
Definition: sdmmc.h:1287
sdmmc_csd_t csd
CSD register of the SD/MMC Card, read during the initialization and identification procedure in the s...
Definition: sdmmc.h:1311
sdmmc_bus_width_t bus_width
Data bus width supported by the SDIO/SD/MMC device (default SDMMC_BUS_WIDTH_1BIT).
Definition: sdmmc.h:1349
bool present
Indicates whether a card is present.
Definition: sdmmc.h:1358
bool s18v_support
Indicates whether the SDIO/SD/MMC peripheral supports the switching to 1.8V (default false).
Definition: sdmmc.h:1372
Low-level SDIO/SD/MMC peripheral driver.
Definition: sdmmc.h:956
void(* init)(sdmmc_dev_t *dev)
Basic initialization of the given SDIO/SD/MMC device.
Definition: sdmmc.h:975
Extended CSD (EXT_CSD) register structure (MMC only)
Definition: sdmmc.h:789
uint32_t SEC_COUNT
Sector Count [215:212].
Definition: sdmmc.h:790
uint8_t CSD_STRUCTURE
CSD Structure Version [194].
Definition: sdmmc.h:792
uint8_t CARD_TYPE
Card Type [196].
Definition: sdmmc.h:791
uint8_t BUS_WIDTH
Bus Width Mode [183].
Definition: sdmmc.h:793
SCR register structure (SD Memory Card only)
Definition: sdmmc.h:815
uint32_t reserved0
Reserved for manufacturer usage [31:0].
Definition: sdmmc.h:817
uint32_t SD_BUS_WIDTHS
DAT Bus widths supported [51:48].
Definition: sdmmc.h:827
uint32_t SCR_STRUCTURE
SCR Structure [63:60].
Definition: sdmmc.h:831
uint32_t SD_SECURITY
CPRM Security Support [54:52].
Definition: sdmmc.h:828
uint32_t SD_SPEC
SD Memory Card - Spec.
Definition: sdmmc.h:830
uint32_t DATA_STAT_AFTER_ERASE
Data status after erases [55].
Definition: sdmmc.h:829
uint32_t SD_SPEC3
Spec.
Definition: sdmmc.h:826
uint32_t SD_SPECX
Spec.
Definition: sdmmc.h:823
uint32_t EX_SECURITY
Extended Security Support [46:43].
Definition: sdmmc.h:825
uint32_t CMD_SUPPORT
Command Support bits [36:32].
Definition: sdmmc.h:821
uint32_t reserved37
Reserved [37].
Definition: sdmmc.h:822
uint32_t SD_SPEC4
Spec.
Definition: sdmmc.h:824
SD Status (SD Memory Card only)
Definition: sdmmc.h:533
uint16_t SD_CARD_TYPE
[495:480] Section 4.10.2, Table 4-44
Definition: sdmmc.h:537
uint8_t AU_SIZE
[431:428] Section 4.10.2.4, Table 4-47
Definition: sdmmc.h:546
uint32_t VSC_AU_SIZE
[377:368] Section 4.10.2.11, Table 4-56
Definition: sdmmc.h:536
uint8_t VIDEO_SPEED_CLASS
[391:384] Section 4.10.2.10, Table 4-54
Definition: sdmmc.h:541
uint32_t SIZE_OF_PROTECTED_AREA
[479:448] Section 4.10.2.1
Definition: sdmmc.h:534
uint8_t ERASE_TIMEOUT
[407:402] Section 4.10.2.6, Table 4-50
Definition: sdmmc.h:542
uint8_t PERFORMANCE_MOVE
[439:432] Section 4.10.2.3, Table 4-46
Definition: sdmmc.h:540
uint8_t ERASE_OFFSET
[401:400] Section 4.10.2.7, Table 4-51
Definition: sdmmc.h:543
uint8_t SECURED_MODE
[509] Section 4.10.2, Table 4-44
Definition: sdmmc.h:548
uint16_t ERASE_SIZE
[423:408] Section 4.10.2.5, Table 4-49
Definition: sdmmc.h:538
uint32_t SUS_ADDR
[367:346] Section 4.10.2.12, Table 4-57
Definition: sdmmc.h:535
uint8_t SPEED_CLASS
[447:440] Section 4.10.2.2, Table 4-45
Definition: sdmmc.h:539
uint8_t DAT_BUS_WIDTH
[511:510] Section 4.10.2, Table 4-44
Definition: sdmmc.h:547
uint8_t UHS_AU_SIZE
[395:392] Section 4.10.2.9, Table 4-3
Definition: sdmmc.h:545
uint8_t UHS_SPEED_GRADE
[399:396] Section 4.10.2.8, Table 4-52
Definition: sdmmc.h:544
Transfer descriptor.
Definition: sdmmc.h:898
sdmmc_xfer_type_t type
Type of the transfer.
Definition: sdmmc.h:899
uint32_t arg
Command argument used for the transfer.
Definition: sdmmc.h:903
uint16_t block_num
Number of blocks to be transferred, 1 for Byte transfer.
Definition: sdmmc.h:905
sdmmc_cmd_t cmd_idx
Command index used for the transfer.
Definition: sdmmc.h:901
uint16_t block_size
Size of a block or number of bytes for Byte transfer.
Definition: sdmmc.h:904
sdmmc_resp_t resp_type
Type of expected response for the transfer.
Definition: sdmmc.h:902
bool write
Indicate a write transfer.
Definition: sdmmc.h:900
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:74
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:84
SD/MMC Card status as structure.
Definition: sdmmc.h:477
uint32_t BLOCK_LEN_ERROR
[29] SD and MMC
Definition: sdmmc.h:504
uint32_t AKE_SEQ_ERROR
[3] SD only, Reserved in MMC
Definition: sdmmc.h:481
uint32_t SWITCH_ERROR
[7] MMC only, reserved in SD/SDIO
Definition: sdmmc.h:485
uint32_t OVERRUN
[17] MMC only, DEFERRED_RESPONSE in SD
Definition: sdmmc.h:492
uint32_t reserved4
[4] Reserved
Definition: sdmmc.h:482
uint32_t ERASE_SEQ_ERROR
[28] SD and MMC
Definition: sdmmc.h:503
uint32_t ILLEGAL_COMMAND
[22] SD/SDIO and MMC
Definition: sdmmc.h:497
uint32_t OUT_OF_RANGE
[31] SD/SDIO and MMC
Definition: sdmmc.h:506
uint32_t reserved2
[2] Reserved for appl.
Definition: sdmmc.h:480
uint32_t CC_ERROR
[20] SD and MMC
Definition: sdmmc.h:495
uint32_t CURRENT_STATE
[12:9] SD and MMC
Definition: sdmmc.h:487
uint32_t UNDERRUN
[18] MMC only, reserved in SD
Definition: sdmmc.h:493
uint32_t ERASE_RESET
[13] SD and MMC
Definition: sdmmc.h:488
uint32_t LOCK_UNLOCK_FAILED
[24] SD and MMC
Definition: sdmmc.h:499
uint32_t CARD_IS_LOCKED
[25] SD and MMC
Definition: sdmmc.h:500
uint32_t READY_FOR_DATA
[8] SD and MMC
Definition: sdmmc.h:486
uint32_t FX_EVENT
[6] SD only, Reserved in MMC
Definition: sdmmc.h:484
uint32_t COM_CRC_ERROR
[23] SD/SDIO and MMC
Definition: sdmmc.h:498
uint32_t ADDRESS_ERROR
[30] SD and MMC
Definition: sdmmc.h:505
uint32_t ERROR
[19] SD/SDIO and MMC
Definition: sdmmc.h:494
uint32_t ERASE_PARAM
[27] SD and MMC
Definition: sdmmc.h:502
uint32_t CARD_ECC_FAILED
[21] SD and MMC
Definition: sdmmc.h:496
uint32_t CSD_OVERWRITE
[16] SD (CSD), MMC (CSD and CID)
Definition: sdmmc.h:491
uint32_t reserved0
[1:0] Reserved for appl.
Definition: sdmmc.h:479
uint32_t WP_ERASE_SKIP
[15] SD and MMC
Definition: sdmmc.h:490
uint32_t WP_VIOLATION
[26] SD and MMC
Definition: sdmmc.h:501
uint32_t APP_CMD
[5] SD and MMC
Definition: sdmmc.h:483
uint32_t value
SD/MMC Card status as 32 bit value.
Definition: sdmmc.h:508
uint32_t CARD_ECC_DISABLED
[14] SD only, reserved in MMC
Definition: sdmmc.h:489
CID register structure (SD Memory and MMC Cards)
Definition: sdmmc.h:601
sdmmc_cid_mmc_t mmc
CID register of MMC.
Definition: sdmmc.h:603
sdmmc_cid_sd_t sd
CID register of SD Memory Cards.
Definition: sdmmc.h:602
CSD register (SD Memory Card and MMC)
Definition: sdmmc.h:769
sdmmc_csd_v1_t v1
CSD Version 1.0.
Definition: sdmmc.h:770
sdmmc_csd_mmc_t mmc
CSD Version for MMC.
Definition: sdmmc.h:772
sdmmc_csd_v2_t v2
CSD Version 2.0 and 3.0.
Definition: sdmmc.h:771
Unit helper macros.
#define MHZ(x)
A macro to return the Hz in x MHz.
Definition: units.h:49
#define KHZ(x)
A macro to return the Hz in x kHz.
Definition: units.h:44
Cross File Arrays.
#define XFA_USE_CONST(type, name)
Declare an external read-only cross-file array.
Definition: xfa.h:114