245 #define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
246 #define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
251 #define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
252 #define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
253 #define SD_OCR_BLOCK_LEN_ERR ((uint32_t)0x20000000)
254 #define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
255 #define SD_OCR_BAD_ERASE_PARAM ((uint32_t)0x08000000)
256 #define SD_OCR_WRITE_PROT_VIOLATION ((uint32_t)0x04000000)
257 #define SD_OCR_LOCK_UNLOCK_FAILED ((uint32_t)0x01000000)
258 #define SD_OCR_COM_CRC_FAILED ((uint32_t)0x00800000)
259 #define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
260 #define SD_OCR_CARD_ECC_FAILED ((uint32_t)0x00200000)
261 #define SD_OCR_CC_ERROR ((uint32_t)0x00100000)
262 #define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
263 #define SD_OCR_STREAM_READ_UNDERRUN ((uint32_t)0x00040000)
264 #define SD_OCR_STREAM_WRITE_OVERRUN ((uint32_t)0x00020000)
265 #define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
266 #define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
267 #define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
268 #define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
269 #define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
270 #define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
275 #define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
276 #define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
277 #define SD_R6_COM_CRC_FAILED ((uint32_t)0x00008000)
279 #define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
280 #define SD_HIGH_CAPACITY ((uint32_t)0x40000000)
281 #define SD_STD_CAPACITY ((uint32_t)0x00000000)
282 #define SD_CHECK_PATTERN ((uint32_t)0x000001AA)
284 #define SD_MAX_VOLT_TRIAL ((uint32_t)0x0000FFFF)
285 #define SD_ALLZERO ((uint32_t)0x00000000)
287 #define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
288 #define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
289 #define SD_CARD_LOCKED ((uint32_t)0x02000000)
291 #define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
292 #define SD_0TO7BITS ((uint32_t)0x000000FF)
293 #define SD_8TO15BITS ((uint32_t)0x0000FF00)
294 #define SD_16TO23BITS ((uint32_t)0x00FF0000)
295 #define SD_24TO31BITS ((uint32_t)0xFF000000)
296 #define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
298 #define SD_HALFFIFO ((uint32_t)0x00000008)
299 #define SD_HALFFIFOBYTES ((uint32_t)0x00000020)
304 #define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
305 #define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
306 #define SD_CCCC_ERASE ((uint32_t)0x00000020)
312 #define SDIO_SEND_IF_COND ((uint32_t)0x00000008)
315 static uint32_t CSD_Tab[4], CID_Tab[4], RCA = 0;
316 static uint8_t SDSTATUS_Tab[16];
317 __IO uint32_t StopCondition = 0;
318 __IO
SD_Error TransferError = SD_OK;
319 __IO uint32_t TransferEnd = 0, DMAEndOfTransfer = 0;
364 if (errorstatus != SD_OK)
372 if (errorstatus != SD_OK)
392 if (errorstatus == SD_OK)
398 if (errorstatus == SD_OK)
420 if (cardstate == SD_CARD_TRANSFER)
422 return(SD_TRANSFER_OK);
424 else if(cardstate == SD_CARD_ERROR)
426 return (SD_TRANSFER_ERROR);
430 return(SD_TRANSFER_BUSY);
447 return SD_CARD_ERROR;
456 return SD_CARD_ERROR;
473 status = SD_NOT_PRESENT;
488 uint32_t response = 0, count = 0, validvoltage = 0;
489 uint32_t SDType = SD_STD_CAPACITY;
516 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
521 if (errorstatus != SD_OK)
537 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
542 if (errorstatus == SD_OK)
544 CardType = SDIO_STD_CAPACITY_SD_CARD_V2_0;
545 SDType = SD_HIGH_CAPACITY;
554 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
563 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
570 if (errorstatus == SD_OK)
574 while ((!validvoltage) && (count < SD_MAX_VOLT_TRIAL))
582 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
587 if (errorstatus != SD_OK)
591 SDIO_CmdInitStructure.
SDIO_Argument = SD_VOLTAGE_WINDOW_SD | SDType;
595 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
599 if (errorstatus != SD_OK)
605 validvoltage = (((response >> 31) == 1) ? 1 : 0);
608 if (count >= SD_MAX_VOLT_TRIAL)
610 errorstatus = SD_INVALID_VOLTRANGE;
614 if (response &= SD_HIGH_CAPACITY)
616 CardType = SDIO_HIGH_CAPACITY_SD_CARD;
652 errorstatus = SD_REQUEST_NOT_APPLICABLE;
656 if (SDIO_SECURE_DIGITAL_IO_CARD != CardType)
663 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
668 if (SD_OK != errorstatus)
678 if ((
SDIO_STD_CAPACITY_SD_CARD_V1_1 == CardType) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == CardType) || (SDIO_SECURE_DIGITAL_IO_COMBO_CARD == CardType)
679 || (SDIO_HIGH_CAPACITY_SD_CARD == CardType))
687 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
692 if (SD_OK != errorstatus)
698 if (SDIO_SECURE_DIGITAL_IO_CARD != CardType)
707 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
712 if (SD_OK != errorstatus)
740 cardinfo->CardType = (uint8_t)CardType;
741 cardinfo->RCA = (uint16_t)RCA;
744 tmp = (uint8_t)((CSD_Tab[0] & 0xFF000000) >> 24);
745 cardinfo->SD_csd.
CSDStruct = (tmp & 0xC0) >> 6;
750 tmp = (uint8_t)((CSD_Tab[0] & 0x00FF0000) >> 16);
751 cardinfo->SD_csd.
TAAC = tmp;
754 tmp = (uint8_t)((CSD_Tab[0] & 0x0000FF00) >> 8);
755 cardinfo->SD_csd.
NSAC = tmp;
758 tmp = (uint8_t)(CSD_Tab[0] & 0x000000FF);
762 tmp = (uint8_t)((CSD_Tab[1] & 0xFF000000) >> 24);
766 tmp = (uint8_t)((CSD_Tab[1] & 0x00FF0000) >> 16);
771 tmp = (uint8_t)((CSD_Tab[1] & 0x0000FF00) >> 8);
775 cardinfo->SD_csd.
DSRImpl = (tmp & 0x10) >> 4;
780 cardinfo->SD_csd.
DeviceSize = (tmp & 0x03) << 10;
783 tmp = (uint8_t)(CSD_Tab[1] & 0x000000FF);
787 tmp = (uint8_t)((CSD_Tab[2] & 0xFF000000) >> 24);
788 cardinfo->SD_csd.
DeviceSize |= (tmp & 0xC0) >> 6;
794 tmp = (uint8_t)((CSD_Tab[2] & 0x00FF0000) >> 16);
799 tmp = (uint8_t)((CSD_Tab[2] & 0x0000FF00) >> 8);
807 else if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
810 tmp = (uint8_t)(CSD_Tab[1] & 0x000000FF);
811 cardinfo->SD_csd.
DeviceSize = (tmp & 0x3F) << 16;
814 tmp = (uint8_t)((CSD_Tab[2] & 0xFF000000) >> 24);
819 tmp = (uint8_t)((CSD_Tab[2] & 0x00FF0000) >> 16);
824 tmp = (uint8_t)((CSD_Tab[2] & 0x0000FF00) >> 8);
832 cardinfo->SD_csd.
EraseGrMul = (tmp & 0x3F) << 1;
835 tmp = (uint8_t)(CSD_Tab[2] & 0x000000FF);
836 cardinfo->SD_csd.
EraseGrMul |= (tmp & 0x80) >> 7;
840 tmp = (uint8_t)((CSD_Tab[3] & 0xFF000000) >> 24);
842 cardinfo->SD_csd.
ManDeflECC = (tmp & 0x60) >> 5;
847 tmp = (uint8_t)((CSD_Tab[3] & 0x00FF0000) >> 16);
854 tmp = (uint8_t)((CSD_Tab[3] & 0x0000FF00) >> 8);
856 cardinfo->SD_csd.
CopyFlag = (tmp & 0x40) >> 6;
859 cardinfo->SD_csd.
FileFormat = (tmp & 0x0C) >> 2;
860 cardinfo->SD_csd.
ECC = (tmp & 0x03);
863 tmp = (uint8_t)(CSD_Tab[3] & 0x000000FF);
864 cardinfo->SD_csd.
CSD_CRC = (tmp & 0xFE) >> 1;
869 tmp = (uint8_t)((CID_Tab[0] & 0xFF000000) >> 24);
873 tmp = (uint8_t)((CID_Tab[0] & 0x00FF0000) >> 16);
877 tmp = (uint8_t)((CID_Tab[0] & 0x000000FF00) >> 8);
881 tmp = (uint8_t)(CID_Tab[0] & 0x000000FF);
885 tmp = (uint8_t)((CID_Tab[1] & 0xFF000000) >> 24);
889 tmp = (uint8_t)((CID_Tab[1] & 0x00FF0000) >> 16);
893 tmp = (uint8_t)((CID_Tab[1] & 0x0000FF00) >> 8);
897 tmp = (uint8_t)(CID_Tab[1] & 0x000000FF);
901 tmp = (uint8_t)((CID_Tab[2] & 0xFF000000) >> 24);
902 cardinfo->SD_cid.
ProdRev = tmp;
905 tmp = (uint8_t)((CID_Tab[2] & 0x00FF0000) >> 16);
906 cardinfo->SD_cid.
ProdSN = tmp << 24;
909 tmp = (uint8_t)((CID_Tab[2] & 0x0000FF00) >> 8);
910 cardinfo->SD_cid.
ProdSN |= tmp << 16;
913 tmp = (uint8_t)(CID_Tab[2] & 0x000000FF);
914 cardinfo->SD_cid.
ProdSN |= tmp << 8;
917 tmp = (uint8_t)((CID_Tab[3] & 0xFF000000) >> 24);
918 cardinfo->SD_cid.
ProdSN |= tmp;
921 tmp = (uint8_t)((CID_Tab[3] & 0x00FF0000) >> 16);
922 cardinfo->SD_cid.
Reserved1 |= (tmp & 0xF0) >> 4;
926 tmp = (uint8_t)((CID_Tab[3] & 0x0000FF00) >> 8);
930 tmp = (uint8_t)(CID_Tab[3] & 0x000000FF);
931 cardinfo->SD_cid.
CID_CRC = (tmp & 0xFE) >> 1;
951 if (errorstatus != SD_OK)
957 tmp = (uint8_t)((SDSTATUS_Tab[0] & 0xC0) >> 6);
958 cardstatus->DAT_BUS_WIDTH = tmp;
961 tmp = (uint8_t)((SDSTATUS_Tab[0] & 0x20) >> 5);
962 cardstatus->SECURED_MODE = tmp;
965 tmp = (uint8_t)((SDSTATUS_Tab[2] & 0xFF));
966 cardstatus->SD_CARD_TYPE = tmp << 8;
969 tmp = (uint8_t)((SDSTATUS_Tab[3] & 0xFF));
970 cardstatus->SD_CARD_TYPE |= tmp;
973 tmp = (uint8_t)(SDSTATUS_Tab[4] & 0xFF);
974 cardstatus->SIZE_OF_PROTECTED_AREA = tmp << 24;
977 tmp = (uint8_t)(SDSTATUS_Tab[5] & 0xFF);
978 cardstatus->SIZE_OF_PROTECTED_AREA |= tmp << 16;
981 tmp = (uint8_t)(SDSTATUS_Tab[6] & 0xFF);
982 cardstatus->SIZE_OF_PROTECTED_AREA |= tmp << 8;
985 tmp = (uint8_t)(SDSTATUS_Tab[7] & 0xFF);
986 cardstatus->SIZE_OF_PROTECTED_AREA |= tmp;
989 tmp = (uint8_t)((SDSTATUS_Tab[8] & 0xFF));
990 cardstatus->SPEED_CLASS = tmp;
993 tmp = (uint8_t)((SDSTATUS_Tab[9] & 0xFF));
994 cardstatus->PERFORMANCE_MOVE = tmp;
997 tmp = (uint8_t)((SDSTATUS_Tab[10] & 0xF0) >> 4);
998 cardstatus->AU_SIZE = tmp;
1001 tmp = (uint8_t)(SDSTATUS_Tab[11] & 0xFF);
1002 cardstatus->ERASE_SIZE = tmp << 8;
1005 tmp = (uint8_t)(SDSTATUS_Tab[12] & 0xFF);
1006 cardstatus->ERASE_SIZE |= tmp;
1009 tmp = (uint8_t)((SDSTATUS_Tab[13] & 0xFC) >> 2);
1010 cardstatus->ERASE_TIMEOUT = tmp;
1013 tmp = (uint8_t)((SDSTATUS_Tab[13] & 0x3));
1014 cardstatus->ERASE_OFFSET = tmp;
1016 return(errorstatus);
1035 if (SDIO_MULTIMEDIA_CARD == CardType)
1037 errorstatus = SD_UNSUPPORTED_FEATURE;
1038 return(errorstatus);
1040 else if ((
SDIO_STD_CAPACITY_SD_CARD_V1_1 == CardType) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == CardType) || (SDIO_HIGH_CAPACITY_SD_CARD == CardType))
1042 if (SDIO_BusWide_8b == WideMode)
1044 errorstatus = SD_UNSUPPORTED_FEATURE;
1045 return(errorstatus);
1047 else if (SDIO_BusWide_4b == WideMode)
1051 if (SD_OK == errorstatus)
1067 if (SD_OK == errorstatus)
1081 return(errorstatus);
1096 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_SEL_DESEL_CARD;
1099 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1104 return(errorstatus);
1126 #if defined (SD_POLLING_MODE)
1127 uint32_t count = 0, *tempbuff = (uint32_t *)readbuff;
1130 TransferError = SD_OK;
1137 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1148 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1153 if (SD_OK != errorstatus)
1155 return(errorstatus);
1163 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
1168 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_READ_SINGLE_BLOCK;
1171 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1176 if (errorstatus != SD_OK)
1178 return(errorstatus);
1181 #if defined (SD_POLLING_MODE)
1184 while (!(SDIO->STA &(SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR)))
1188 for (count = 0; count < 8; count++)
1200 return(errorstatus);
1206 return(errorstatus);
1212 return(errorstatus);
1218 return(errorstatus);
1220 count = SD_DATATIMEOUT;
1231 #elif defined (SD_DMA_MODE)
1232 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE);
1237 return(errorstatus);
1260 TransferError = SD_OK;
1266 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1277 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1282 if (SD_OK != errorstatus)
1284 return(errorstatus);
1292 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
1297 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_READ_MULT_BLOCK;
1300 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1305 if (errorstatus != SD_OK)
1307 return(errorstatus);
1310 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE);
1314 return(errorstatus);
1322 TransferError = SD_OK;
1328 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1331 ReadAddr *= BlockSize;
1338 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1343 if (SD_OK != errorstatus)
1345 return(errorstatus);
1353 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
1358 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_READ_MULT_BLOCK;
1361 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1366 if (errorstatus != SD_OK)
1368 return(errorstatus);
1371 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE);
1375 return(errorstatus);
1391 timeout = SD_DATATIMEOUT;
1393 while ((DMAEndOfTransfer == 0x00) && (TransferEnd == 0) && (TransferError == SD_OK) && (timeout > 0))
1398 DMAEndOfTransfer = 0x00;
1400 timeout = SD_DATATIMEOUT;
1402 while(((SDIO->STA & SDIO_FLAG_RXACT)) && (timeout > 0))
1407 if (StopCondition == 1)
1412 if ((timeout == 0) && (errorstatus == SD_OK))
1420 if (TransferError != SD_OK)
1422 return(TransferError);
1426 return(errorstatus);
1450 #if defined (SD_POLLING_MODE)
1451 uint32_t bytestransferred = 0, count = 0, restwords = 0;
1452 uint32_t *tempbuff = (uint32_t *)writebuff;
1455 TransferError = SD_OK;
1462 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1473 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1478 if (SD_OK != errorstatus)
1480 return(errorstatus);
1485 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_WRITE_SINGLE_BLOCK;
1488 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1493 if (errorstatus != SD_OK)
1495 return(errorstatus);
1503 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
1507 #if defined (SD_POLLING_MODE)
1508 while (!(SDIO->STA & (SDIO_FLAG_DBCKEND | SDIO_FLAG_TXUNDERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_STBITERR)))
1512 if ((512 - bytestransferred) < 32)
1514 restwords = ((512 - bytestransferred) % 4 == 0) ? ((512 - bytestransferred) / 4) : (( 512 - bytestransferred) / 4 + 1);
1515 for (count = 0; count < restwords; count++, tempbuff++, bytestransferred += 4)
1522 for (count = 0; count < 8; count++)
1527 bytestransferred += 32;
1535 return(errorstatus);
1541 return(errorstatus);
1547 return(errorstatus);
1553 return(errorstatus);
1555 #elif defined (SD_DMA_MODE)
1556 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE);
1561 return(errorstatus);
1585 TransferError = SD_OK;
1591 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1602 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1607 if (SD_OK != errorstatus)
1609 return(errorstatus);
1613 SDIO_CmdInitStructure.
SDIO_Argument = (uint32_t) (RCA << 16);
1617 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1623 if (errorstatus != SD_OK)
1625 return(errorstatus);
1628 SDIO_CmdInitStructure.
SDIO_Argument = (uint32_t)NumberOfBlocks;
1632 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1637 if (errorstatus != SD_OK)
1639 return(errorstatus);
1645 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_WRITE_MULT_BLOCK;
1648 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1653 if (SD_OK != errorstatus)
1655 return(errorstatus);
1663 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
1666 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE);
1670 return(errorstatus);
1675 SD_Error SD_WriteMultiBlocksFIXED(uint8_t *writebuff, uint32_t WriteAddr, uint32_t BlockSize, uint32_t NumberOfBlocks)
1679 TransferError = SD_OK;
1685 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1688 WriteAddr *= BlockSize;
1695 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1700 if (SD_OK != errorstatus)
1702 return(errorstatus);
1706 SDIO_CmdInitStructure.
SDIO_Argument = (uint32_t) (RCA << 16);
1710 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1716 if (errorstatus != SD_OK)
1718 return(errorstatus);
1721 SDIO_CmdInitStructure.
SDIO_Argument = (uint32_t)NumberOfBlocks;
1725 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1730 if (errorstatus != SD_OK)
1732 return(errorstatus);
1738 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_WRITE_MULT_BLOCK;
1741 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1746 if (SD_OK != errorstatus)
1748 return(errorstatus);
1756 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
1759 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE);
1763 return(errorstatus);
1779 timeout = SD_DATATIMEOUT;
1781 while ((DMAEndOfTransfer == 0x00) && (TransferEnd == 0) && (TransferError == SD_OK) && (timeout > 0))
1786 DMAEndOfTransfer = 0x00;
1788 timeout = SD_DATATIMEOUT;
1790 while(((SDIO->STA & SDIO_FLAG_TXACT)) && (timeout > 0))
1795 if (StopCondition == 1)
1800 if ((timeout == 0) && (errorstatus == SD_OK))
1808 if (TransferError != SD_OK)
1810 return(TransferError);
1814 return(errorstatus);
1828 if (SDIO->STA & (SDIO_FLAG_TXACT | SDIO_FLAG_RXACT))
1830 return(SD_TRANSFER_BUSY);
1834 return(SD_TRANSFER_OK);
1849 SDIO_CmdInitStructure.
SDIO_CmdIndex = SD_CMD_STOP_TRANSMISSION;
1852 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1857 return(errorstatus);
1871 __IO uint32_t maxdelay = 0;
1872 uint8_t cardstate = 0;
1875 if (((CSD_Tab[1] >> 20) & SD_CCCC_ERASE) == 0)
1877 errorstatus = SD_REQUEST_NOT_APPLICABLE;
1878 return(errorstatus);
1881 maxdelay = 120000 / ((SDIO->CLKCR & 0xFF) + 2);
1886 return(errorstatus);
1889 if (CardType == SDIO_HIGH_CAPACITY_SD_CARD)
1903 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1907 if (errorstatus != SD_OK)
1909 return(errorstatus);
1917 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1921 if (errorstatus != SD_OK)
1923 return(errorstatus);
1932 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1937 if (errorstatus != SD_OK)
1939 return(errorstatus);
1942 for (delay = 0; delay < maxdelay; delay++)
1947 delay = SD_DATATIMEOUT;
1948 while ((delay > 0) && (errorstatus == SD_OK) && ((SD_CARD_PROGRAMMING == cardstate) || (SD_CARD_RECEIVING == cardstate)))
1954 return(errorstatus);
1968 if (pcardstatus ==
NULL)
1970 errorstatus = SD_INVALID_PARAMETER;
1971 return(errorstatus);
1978 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
1983 if (errorstatus != SD_OK)
1985 return(errorstatus);
1990 return(errorstatus);
2008 return(errorstatus);
2016 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2021 if (errorstatus != SD_OK)
2023 return(errorstatus);
2031 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2035 if (errorstatus != SD_OK)
2037 return(errorstatus);
2045 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
2053 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2057 if (errorstatus != SD_OK)
2059 return(errorstatus);
2062 while (!(SDIO->STA &(SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR)))
2066 for (count = 0; count < 8; count++)
2078 return(errorstatus);
2084 return(errorstatus);
2090 return(errorstatus);
2096 return(errorstatus);
2099 count = SD_DATATIMEOUT;
2109 return(errorstatus);
2121 TransferError = SD_OK;
2151 SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND |
2152 SDIO_IT_TXFIFOHE | SDIO_IT_RXFIFOHF | SDIO_IT_TXUNDERR |
2153 SDIO_IT_RXOVERR | SDIO_IT_STBITERR, DISABLE);
2154 return(TransferError);
2164 if(DMA2->LISR & SD_SDIO_DMA_FLAG_TCIF)
2166 DMAEndOfTransfer = 0x01;
2167 DMA_ClearFlag(SD_SDIO_DMA_STREAM, SD_SDIO_DMA_FLAG_TCIF|SD_SDIO_DMA_FLAG_FEIF);
2181 timeout = SDIO_CMD0TIMEOUT;
2191 return(errorstatus);
2197 return(errorstatus);
2209 uint32_t timeout = SDIO_CMD0TIMEOUT;
2213 while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)) && (timeout > 0))
2219 if ((timeout == 0) || (status & SDIO_FLAG_CTIMEOUT))
2224 return(errorstatus);
2227 if (status & SDIO_FLAG_CMDREND)
2230 errorstatus = SD_OK;
2232 return(errorstatus);
2234 return(errorstatus);
2247 uint32_t response_r1;
2251 while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)))
2256 if (status & SDIO_FLAG_CTIMEOUT)
2260 return(errorstatus);
2262 else if (status & SDIO_FLAG_CCRCFAIL)
2266 return(errorstatus);
2273 return(errorstatus);
2282 if ((response_r1 & SD_OCR_ERRORBITS) == SD_ALLZERO)
2284 return(errorstatus);
2289 return(SD_ADDR_OUT_OF_RANGE);
2292 if (response_r1 & SD_OCR_ADDR_MISALIGNED)
2297 if (response_r1 & SD_OCR_BLOCK_LEN_ERR)
2302 if (response_r1 & SD_OCR_ERASE_SEQ_ERR)
2307 if (response_r1 & SD_OCR_BAD_ERASE_PARAM)
2312 if (response_r1 & SD_OCR_WRITE_PROT_VIOLATION)
2317 if (response_r1 & SD_OCR_LOCK_UNLOCK_FAILED)
2322 if (response_r1 & SD_OCR_COM_CRC_FAILED)
2327 if (response_r1 & SD_OCR_ILLEGAL_CMD)
2332 if (response_r1 & SD_OCR_CARD_ECC_FAILED)
2337 if (response_r1 & SD_OCR_CC_ERROR)
2342 if (response_r1 & SD_OCR_GENERAL_UNKNOWN_ERROR)
2347 if (response_r1 & SD_OCR_STREAM_READ_UNDERRUN)
2352 if (response_r1 & SD_OCR_STREAM_WRITE_OVERRUN)
2357 if (response_r1 & SD_OCR_CID_CSD_OVERWRIETE)
2362 if (response_r1 & SD_OCR_WP_ERASE_SKIP)
2367 if (response_r1 & SD_OCR_CARD_ECC_DISABLED)
2372 if (response_r1 & SD_OCR_ERASE_RESET)
2377 if (response_r1 & SD_OCR_AKE_SEQ_ERROR)
2381 return(errorstatus);
2396 while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)))
2401 if (status & SDIO_FLAG_CTIMEOUT)
2405 return(errorstatus);
2409 return(errorstatus);
2424 while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CTIMEOUT | SDIO_FLAG_CMDREND)))
2429 if (status & SDIO_FLAG_CTIMEOUT)
2433 return(errorstatus);
2435 else if (status & SDIO_FLAG_CCRCFAIL)
2439 return(errorstatus);
2445 return(errorstatus);
2460 uint32_t response_r1;
2464 while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CTIMEOUT | SDIO_FLAG_CMDREND)))
2469 if (status & SDIO_FLAG_CTIMEOUT)
2473 return(errorstatus);
2475 else if (status & SDIO_FLAG_CCRCFAIL)
2479 return(errorstatus);
2486 return(errorstatus);
2497 *prca = (uint16_t) (response_r1 >> 16);
2498 return(errorstatus);
2506 if (response_r1 & SD_R6_ILLEGAL_CMD)
2511 if (response_r1 & SD_R6_COM_CRC_FAILED)
2516 return(errorstatus);
2530 uint32_t scr[2] = {0, 0};
2535 return(errorstatus);
2539 errorstatus =
FindSCR(RCA, scr);
2541 if (errorstatus != SD_OK)
2543 return(errorstatus);
2547 if (NewState == ENABLE)
2550 if ((scr[1] & SD_WIDE_BUS_SUPPORT) != SD_ALLZERO)
2557 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2562 if (errorstatus != SD_OK)
2564 return(errorstatus);
2572 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2577 if (errorstatus != SD_OK)
2579 return(errorstatus);
2581 return(errorstatus);
2585 errorstatus = SD_REQUEST_NOT_APPLICABLE;
2586 return(errorstatus);
2592 if ((scr[1] & SD_SINGLE_BUS_SUPPORT) != SD_ALLZERO)
2599 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2605 if (errorstatus != SD_OK)
2607 return(errorstatus);
2615 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2620 if (errorstatus != SD_OK)
2622 return(errorstatus);
2625 return(errorstatus);
2629 errorstatus = SD_REQUEST_NOT_APPLICABLE;
2630 return(errorstatus);
2644 __IO uint32_t respR1 = 0, status = 0;
2650 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2654 while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)))
2659 if (status & SDIO_FLAG_CTIMEOUT)
2663 return(errorstatus);
2665 else if (status & SDIO_FLAG_CCRCFAIL)
2669 return(errorstatus);
2675 if (status != SD_CMD_SEND_STATUS)
2678 return(errorstatus);
2689 *pstatus = (uint8_t) ((respR1 >> 9) & 0x0000000F);
2691 if ((respR1 & SD_OCR_ERRORBITS) == SD_ALLZERO)
2693 return(errorstatus);
2698 return(SD_ADDR_OUT_OF_RANGE);
2701 if (respR1 & SD_OCR_ADDR_MISALIGNED)
2706 if (respR1 & SD_OCR_BLOCK_LEN_ERR)
2711 if (respR1 & SD_OCR_ERASE_SEQ_ERR)
2716 if (respR1 & SD_OCR_BAD_ERASE_PARAM)
2721 if (respR1 & SD_OCR_WRITE_PROT_VIOLATION)
2726 if (respR1 & SD_OCR_LOCK_UNLOCK_FAILED)
2731 if (respR1 & SD_OCR_COM_CRC_FAILED)
2736 if (respR1 & SD_OCR_ILLEGAL_CMD)
2741 if (respR1 & SD_OCR_CARD_ECC_FAILED)
2746 if (respR1 & SD_OCR_CC_ERROR)
2751 if (respR1 & SD_OCR_GENERAL_UNKNOWN_ERROR)
2756 if (respR1 & SD_OCR_STREAM_READ_UNDERRUN)
2761 if (respR1 & SD_OCR_STREAM_WRITE_OVERRUN)
2766 if (respR1 & SD_OCR_CID_CSD_OVERWRIETE)
2771 if (respR1 & SD_OCR_WP_ERASE_SKIP)
2776 if (respR1 & SD_OCR_CARD_ECC_DISABLED)
2781 if (respR1 & SD_OCR_ERASE_RESET)
2786 if (respR1 & SD_OCR_AKE_SEQ_ERROR)
2791 return(errorstatus);
2805 uint32_t tempscr[2] = {0, 0};
2813 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2818 if (errorstatus != SD_OK)
2820 return(errorstatus);
2828 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2833 if (errorstatus != SD_OK)
2835 return(errorstatus);
2842 SDIO_DataInitStructure.
SDIO_DPSM = SDIO_DPSM_Enable;
2851 SDIO_CmdInitStructure.
SDIO_CPSM = SDIO_CPSM_Enable;
2856 if (errorstatus != SD_OK)
2858 return(errorstatus);
2861 while (!(SDIO->STA & (SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR)))
2874 return(errorstatus);
2880 return(errorstatus);
2886 return(errorstatus);
2892 return(errorstatus);
2898 *(pscr + 1) = ((tempscr[0] & SD_0TO7BITS) << 24) | ((tempscr[0] & SD_8TO15BITS) << 8) | ((tempscr[0] & SD_16TO23BITS) >> 8) | ((tempscr[0] & SD_24TO31BITS) >> 24);
2900 *(pscr) = ((tempscr[1] & SD_0TO7BITS) << 24) | ((tempscr[1] & SD_8TO15BITS) << 8) | ((tempscr[1] & SD_16TO23BITS) >> 8) | ((tempscr[1] & SD_24TO31BITS) >> 24);
2902 return(errorstatus);
2915 while (NumberOfBytes != 1)
2917 NumberOfBytes >>= 1;
#define SD_CMD_SET_BLOCK_COUNT
#define SD_DETECT_GPIO_PORT
static SD_Error CmdResp6Error(uint8_t cmd, uint16_t *prca)
Checks for error conditions for R6 (RCA) response.
void SDIO_ClearITPendingBit(uint32_t SDIO_IT)
Clears the SDIO's interrupt pending bits.
__IO uint8_t RdBlockMisalign
SD_Error SD_ReadMultiBlocks(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
Allows to read blocks from a specified address in a card. The Data transfer can be managed by DMA mod...
SD_Error SD_Erase(uint32_t startaddr, uint32_t endaddr)
Allows to erase memory area specified for the given card.
uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Reads the specified input port pin.
SD_Error SD_Init(void)
Initializes the SD Card and put it into StandBy State (Ready for data transfer).
__IO uint8_t WriteBlockPaPartial
void DMA_ClearFlag(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_FLAG)
Clears the DMAy Streamx's pending flags.
static SD_Error CmdResp1Error(uint8_t cmd)
Checks for error conditions for R1 response.
__IO uint8_t PermWrProtect
void SDIO_ITConfig(uint32_t SDIO_IT, FunctionalState NewState)
Enables or disables the SDIO interrupts.
uint32_t SDIO_HardwareFlowControl
uint32_t SDIO_TransferDir
uint32_t SDIO_DataTimeOut
__IO uint8_t MaxBusClkFrec
SD_Error SD_WriteBlock(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize)
Allows to write one block starting from a specified address in a card. The Data transfer can be manag...
__IO uint8_t WrProtectGrSize
#define SD_CMD_SD_ERASE_GRP_START
static SD_Error FindSCR(uint16_t rca, uint32_t *pscr)
Find the SD card SCR register value.
__IO uint8_t MaxRdCurrentVDDMax
uint32_t SDIO_ClockPowerSave
__IO uint8_t TempWrProtect
uint32_t SDIO_TransferMode
void SD_LowLevel_DeInit(void)
DeInitializes the SDIO interface. Disable SDIO Clock, Set Power State to OFF, DeInitializes the SDIO...
SD_Error SD_WaitWriteOperation(void)
This function waits until the SDIO DMA data transfer is finished. This function should be called afte...
This file contains all the functions prototypes for the SD Card stm324xg_eval_sdio_sd driver firmware...
#define SD_OCR_ADDR_OUT_OF_RANGE
Mask for errors Card Status R1 (OCR Register)
__IO uint16_t OEM_AppliID
SD_Error SD_EnableWideBusOperation(uint32_t WideMode)
Enables wide bus opeartion for the requeseted card if supported by card.
#define SD_CMD_SD_APP_SEND_SCR
#define SD_CMD_SD_ERASE_GRP_END
SD_Error SD_WaitReadOperation(void)
This function waits until the SDIO DMA data transfer is finished. This function should be called afte...
__IO uint8_t FileFormatGrouop
SD_Error SD_PowerOFF(void)
Turns the SDIO output signals off.
void SDIO_Init(SDIO_InitTypeDef *SDIO_InitStruct)
Initializes the SDIO peripheral according to the specified parameters in the SDIO_InitStruct.
void SD_LowLevel_Init(void)
Initializes the SD Card and put it into StandBy State (Ready for data transfer).
#define SDIO_TRANSFER_CLK_DIV
SDIO Data Transfer Frequency (25MHz max)
__IO uint8_t SysSpecVersion
#define NULL
SDIO Static flags, TimeOut, FIFO Address.
SD_Error SD_PowerON(void)
Enquires cards about their operating voltage and configures clock controls.
uint32_t SDIO_ClockBypass
static SD_Error IsCardProgramming(uint8_t *pstatus)
Checks if the SD card is in programming state.
SD_Error SD_InitializeCards(void)
Intialises all cards or single card as the case may be Card(s) come into standby state.
__IO uint8_t MaxWrCurrentVDDMax
__IO uint8_t WrProtectGrEnable
void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize)
Configures the DMA2 Channel4 for SDIO Rx request.
__IO uint8_t MaxRdCurrentVDDMin
SD_Error SD_ReadMultiBlocksFIXED(uint8_t *readbuff, uint32_t ReadAddr, uint32_t BlockSize, uint32_t NumberOfBlocks)
void SDIO_ClearFlag(uint32_t SDIO_FLAG)
Clears the SDIO's pending flags.
SDCardState SD_GetState(void)
Returns the current card's state.
uint32_t SDIO_GetResponse(uint32_t SDIO_RESP)
Returns response received from the card for the last command.
ITStatus SDIO_GetITStatus(uint32_t SDIO_IT)
Checks whether the specified SDIO interrupt has occurred or not.
SD_Error SD_WriteMultiBlocks(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
Allows to write blocks starting from a specified address in a card. The Data transfer can be managed ...
#define SD_R6_GENERAL_UNKNOWN_ERROR
Masks for R6 Response.
#define SD_CMD_SD_APP_STAUS
#define SD_CMD_APP_SD_SET_BUSWIDTH
Following commands are SD Card Specific commands. SDIO_APP_CMD should be sent before sending these co...
SD_Error SD_SendStatus(uint32_t *pcardstatus)
Returns the current card's status.
void SDIO_SendCommand(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
Initializes the SDIO Command according to the specified parameters in the SDIO_CmdInitStruct and send...
__IO uint16_t CardComdClasses
__IO uint8_t ContentProtectAppli
void SDIO_DeInit(void)
Deinitializes the SDIO peripheral registers to their default reset values.
#define SD_CMD_SD_APP_OP_COND
FlagStatus SDIO_GetFlagStatus(uint32_t SDIO_FLAG)
Checks whether the specified SDIO flag is set or not.
void SDIO_DataConfig(SDIO_DataInitTypeDef *SDIO_DataInitStruct)
Initializes the SDIO data path according to the specified parameters in the SDIO_DataInitStruct.
static SD_Error CmdError(void)
Checks for error conditions for CMD0.
uint8_t convert_from_bytes_to_power_of_two(uint16_t NumberOfBytes)
Converts the number of bytes in power of two and returns the power.
uint32_t SDIO_ReadData(void)
Read one data word from Rx FIFO.
SDIO specific error defines.
#define SDIO_INIT_CLK_DIV
SDIO Intialization Frequency (400KHz max)
static SD_Error CmdResp2Error(void)
Checks for error conditions for R2 (CID or CSD) response.
__IO uint8_t DeviceSizeMul
#define SD_CMD_SET_REL_ADDR
void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize)
Configures the DMA2 Channel4 for SDIO Tx request.
SDTransferState SD_GetStatus(void)
Gets the cuurent sd card data transfer status.
void SDIO_WriteData(uint32_t Data)
Write one data word to Tx FIFO.
#define SDIO_STD_CAPACITY_SD_CARD_V1_1
Supported SD Memory Cards.
uint32_t SDIO_GetPowerState(void)
Gets the power status of the controller.
static SD_Error CmdResp7Error(void)
Checks for error conditions for R7 response.
SD_Error SD_ReadBlock(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize)
Allows to read one block from a specified address in a card. The Data transfer can be managed by DMA ...
__IO uint8_t ManufacturerID
void SDIO_SetPowerState(uint32_t SDIO_PowerState)
Sets the power status of the controller.
__IO uint8_t MaxWrBlockLen
SD_Error SD_GetCardStatus(SD_CardStatus *cardstatus)
Enables wide bus opeartion for the requeseted card if supported by card.
__IO uint16_t ManufactDate
#define SD_PRESENT
SD detection on its memory slot.
SD_Error SD_StopTransfer(void)
Aborts an ongoing data transfer.
uint8_t SDIO_GetCommandResponse(void)
Returns command index of last command for which response received.
__IO uint8_t MaxWrCurrentVDDMin
SDTransferState
SDIO Transfer state.
SD_Error SD_GetCardInfo(SD_CardInfo *cardinfo)
Returns information about specific card.
static SD_Error SDEnWideBus(FunctionalState NewState)
Enables or disables the SDIO wide bus mode.
static SD_Error CmdResp3Error(void)
Checks for error conditions for R3 (OCR) response.
SDCardState
SD Card States.
uint8_t SD_Detect(void)
Detect if SD card is correctly plugged in the memory slot.
SD_Error SD_SendSDStatus(uint32_t *psdstatus)
Returns the current SD card's status.
SDTransferState SD_GetTransferState(void)
Gets the cuurent data transfer state.
void SD_DeInit(void)
DeInitializes the SDIO interface.
void SDIO_DMACmd(FunctionalState NewState)
Enables or disables the SDIO DMA request.
SD_Error SD_ProcessIRQSrc(void)
Allows to process all the interrupts that are high.
#define SD_CMD_GO_IDLE_STATE
SDIO Commands Index.
uint32_t SDIO_DataBlockSize
void SDIO_ClockCmd(FunctionalState NewState)
Enables or disables the SDIO Clock.
__IO uint8_t WrBlockMisalign
__IO uint8_t PartBlockRead
void SD_ProcessDMAIRQ(void)
This function waits until the SDIO DMA data transfer is finished.
SD_Error SD_SelectDeselect(uint32_t addr)
Selects od Deselects the corresponding card.
#define SDIO_SEND_IF_COND
Following commands are SD Card Specific commands. SDIO_APP_CMD should be sent before sending these co...