From 17b7981e2e56fd5aebeded090c863b980bd76000 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 10 Apr 2022 21:19:30 +0200 Subject: [PATCH] driver: sdmmc: add SPI mode R2 response definitions --- components/driver/include/driver/sdmmc_defs.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/driver/include/driver/sdmmc_defs.h b/components/driver/include/driver/sdmmc_defs.h index 1e336c2d72..9b9c5b8023 100644 --- a/components/driver/include/driver/sdmmc_defs.h +++ b/components/driver/include/driver/sdmmc_defs.h @@ -119,6 +119,20 @@ #define SDIO_R1_FUNC_NUM_ERR (1<<4) +/* SPI mode R2 response type bits. + * The first byte is the same as for R1. + * The bits below belong to the second byte. + * Bits 10, 11, 12, 15 can also be reported in data error token of a read command response. + */ +#define SD_SPI_R2_CARD_LOCKED (1<<8) /* Set when the card is locked by the user */ +#define SD_SPI_R2_UNLOCK_FAILED (1<<9) /* Host attempts to erase a write-protected sector or makes an error during card lock/unlock operation */ +#define SD_SPI_R2_ERROR (1<<10) /* A general or an unknown error occurred during the operation */ +#define SD_SPI_R2_CC_ERROR (1<<11) /* Internal card controller error */ +#define SD_SPI_R2_ECC_FAILED (1<<12) /* Card internal ECC was applied but failed to correct the data */ +#define SD_SPI_R2_WP_VIOLATION (1<<13) /* The command tried to write a write-protected block */ +#define SD_SPI_R2_ERASE_PARAM (1<<14) /* An invalid selection for erase, sectors or groups */ +#define SD_SPI_R2_OUT_OF_RANGE (1<<15) /* The command argument was out of the allowed range for this card */ + /* 48-bit response decoding (32 bits w/o CRC) */ #define MMC_R1(resp) ((resp)[0]) #define MMC_R3(resp) ((resp)[0])