STM32F439xx HAL User Manual
Data Structures | Defines | Enumerations | Functions
stm32f4xx_hal_sd.h File Reference

Header file of SD HAL module. More...

#include "stm32f4xx_ll_sdmmc.h"

Go to the source code of this file.

Data Structures

struct  HAL_SD_CardInfoTypeDef
 SD Card Information Structure definition. More...
struct  SD_HandleTypeDef
 SD handle Structure definition. More...
struct  HAL_SD_CardCSDTypeDef
struct  HAL_SD_CardCIDTypeDef
struct  HAL_SD_CardStatusTypeDef

Defines

#define SD_InitTypeDef   SDIO_InitTypeDef
#define SD_TypeDef   SDIO_TypeDef
#define BLOCKSIZE   512U
#define HAL_SD_ERROR_NONE   SDMMC_ERROR_NONE
#define HAL_SD_ERROR_CMD_CRC_FAIL   SDMMC_ERROR_CMD_CRC_FAIL
#define HAL_SD_ERROR_DATA_CRC_FAIL   SDMMC_ERROR_DATA_CRC_FAIL
#define HAL_SD_ERROR_CMD_RSP_TIMEOUT   SDMMC_ERROR_CMD_RSP_TIMEOUT
#define HAL_SD_ERROR_DATA_TIMEOUT   SDMMC_ERROR_DATA_TIMEOUT
#define HAL_SD_ERROR_TX_UNDERRUN   SDMMC_ERROR_TX_UNDERRUN
#define HAL_SD_ERROR_RX_OVERRUN   SDMMC_ERROR_RX_OVERRUN
#define HAL_SD_ERROR_ADDR_MISALIGNED   SDMMC_ERROR_ADDR_MISALIGNED
#define HAL_SD_ERROR_BLOCK_LEN_ERR   SDMMC_ERROR_BLOCK_LEN_ERR
#define HAL_SD_ERROR_ERASE_SEQ_ERR   SDMMC_ERROR_ERASE_SEQ_ERR
#define HAL_SD_ERROR_BAD_ERASE_PARAM   SDMMC_ERROR_BAD_ERASE_PARAM
#define HAL_SD_ERROR_WRITE_PROT_VIOLATION   SDMMC_ERROR_WRITE_PROT_VIOLATION
#define HAL_SD_ERROR_LOCK_UNLOCK_FAILED   SDMMC_ERROR_LOCK_UNLOCK_FAILED
#define HAL_SD_ERROR_COM_CRC_FAILED   SDMMC_ERROR_COM_CRC_FAILED
#define HAL_SD_ERROR_ILLEGAL_CMD   SDMMC_ERROR_ILLEGAL_CMD
#define HAL_SD_ERROR_CARD_ECC_FAILED   SDMMC_ERROR_CARD_ECC_FAILED
#define HAL_SD_ERROR_CC_ERR   SDMMC_ERROR_CC_ERR
#define HAL_SD_ERROR_GENERAL_UNKNOWN_ERR   SDMMC_ERROR_GENERAL_UNKNOWN_ERR
#define HAL_SD_ERROR_STREAM_READ_UNDERRUN   SDMMC_ERROR_STREAM_READ_UNDERRUN
#define HAL_SD_ERROR_STREAM_WRITE_OVERRUN   SDMMC_ERROR_STREAM_WRITE_OVERRUN
#define HAL_SD_ERROR_CID_CSD_OVERWRITE   SDMMC_ERROR_CID_CSD_OVERWRITE
#define HAL_SD_ERROR_WP_ERASE_SKIP   SDMMC_ERROR_WP_ERASE_SKIP
#define HAL_SD_ERROR_CARD_ECC_DISABLED   SDMMC_ERROR_CARD_ECC_DISABLED
#define HAL_SD_ERROR_ERASE_RESET   SDMMC_ERROR_ERASE_RESET
#define HAL_SD_ERROR_AKE_SEQ_ERR   SDMMC_ERROR_AKE_SEQ_ERR
#define HAL_SD_ERROR_INVALID_VOLTRANGE   SDMMC_ERROR_INVALID_VOLTRANGE
#define HAL_SD_ERROR_ADDR_OUT_OF_RANGE   SDMMC_ERROR_ADDR_OUT_OF_RANGE
#define HAL_SD_ERROR_REQUEST_NOT_APPLICABLE   SDMMC_ERROR_REQUEST_NOT_APPLICABLE
#define HAL_SD_ERROR_PARAM   SDMMC_ERROR_INVALID_PARAMETER
#define HAL_SD_ERROR_UNSUPPORTED_FEATURE   SDMMC_ERROR_UNSUPPORTED_FEATURE
#define HAL_SD_ERROR_BUSY   SDMMC_ERROR_BUSY
#define HAL_SD_ERROR_DMA   SDMMC_ERROR_DMA
#define HAL_SD_ERROR_TIMEOUT   SDMMC_ERROR_TIMEOUT
#define SD_CONTEXT_NONE   0x00000000U
#define SD_CONTEXT_READ_SINGLE_BLOCK   0x00000001U
#define SD_CONTEXT_READ_MULTIPLE_BLOCK   0x00000002U
#define SD_CONTEXT_WRITE_SINGLE_BLOCK   0x00000010U
#define SD_CONTEXT_WRITE_MULTIPLE_BLOCK   0x00000020U
#define SD_CONTEXT_IT   0x00000008U
#define SD_CONTEXT_DMA   0x00000080U
#define CARD_SDSC   0x00000000U
#define CARD_SDHC_SDXC   0x00000001U
#define CARD_SECURED   0x00000003U
#define CARD_V1_X   0x00000000U
#define CARD_V2_X   0x00000001U
#define __HAL_SD_ENABLE(__HANDLE__)   __SDIO_ENABLE((__HANDLE__)->Instance)
 Enable the SD device.
#define __HAL_SD_DISABLE(__HANDLE__)   __SDIO_DISABLE((__HANDLE__)->Instance)
 Disable the SD device.
#define __HAL_SD_DMA_ENABLE(__HANDLE__)   __SDIO_DMA_ENABLE((__HANDLE__)->Instance)
 Enable the SDMMC DMA transfer.
#define __HAL_SD_DMA_DISABLE(__HANDLE__)   __SDIO_DMA_DISABLE((__HANDLE__)->Instance)
 Disable the SDMMC DMA transfer.
#define __HAL_SD_ENABLE_IT(__HANDLE__, __INTERRUPT__)   __SDIO_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
 Enable the SD device interrupt.
#define __HAL_SD_DISABLE_IT(__HANDLE__, __INTERRUPT__)   __SDIO_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
 Disable the SD device interrupt.
#define __HAL_SD_GET_FLAG(__HANDLE__, __FLAG__)   __SDIO_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
 Check whether the specified SD flag is set or not.
#define __HAL_SD_CLEAR_FLAG(__HANDLE__, __FLAG__)   __SDIO_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
 Clear the SD's pending flags.
#define __HAL_SD_GET_IT(__HANDLE__, __INTERRUPT__)   __SDIO_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
 Check whether the specified SD interrupt has occurred or not.
#define __HAL_SD_CLEAR_IT(__HANDLE__, __INTERRUPT__)   __SDIO_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
 Clear the SD's interrupt pending bits.

Enumerations

enum  HAL_SD_StateTypeDef {
  HAL_SD_STATE_RESET = 0x00000000U, HAL_SD_STATE_READY = 0x00000001U, HAL_SD_STATE_TIMEOUT = 0x00000002U, HAL_SD_STATE_BUSY = 0x00000003U,
  HAL_SD_STATE_PROGRAMMING = 0x00000004U, HAL_SD_STATE_RECEIVING = 0x00000005U, HAL_SD_STATE_TRANSFER = 0x00000006U, HAL_SD_STATE_ERROR = 0x0000000FU
}
enum  HAL_SD_CardStateTypeDef {
  HAL_SD_CARD_READY = 0x00000001U, HAL_SD_CARD_IDENTIFICATION = 0x00000002U, HAL_SD_CARD_STANDBY = 0x00000003U, HAL_SD_CARD_TRANSFER = 0x00000004U,
  HAL_SD_CARD_SENDING = 0x00000005U, HAL_SD_CARD_RECEIVING = 0x00000006U, HAL_SD_CARD_PROGRAMMING = 0x00000007U, HAL_SD_CARD_DISCONNECTED = 0x00000008U,
  HAL_SD_CARD_ERROR = 0x000000FFU
}

Functions

HAL_StatusTypeDef HAL_SD_Init (SD_HandleTypeDef *hsd)
 Initializes the SD according to the specified parameters in the SD_HandleTypeDef and create the associated handle.
HAL_StatusTypeDef HAL_SD_InitCard (SD_HandleTypeDef *hsd)
 Initializes the SD Card.
HAL_StatusTypeDef HAL_SD_DeInit (SD_HandleTypeDef *hsd)
 De-Initializes the SD card.
__weak void HAL_SD_MspInit (SD_HandleTypeDef *hsd)
 Initializes the SD MSP.
__weak void HAL_SD_MspDeInit (SD_HandleTypeDef *hsd)
 De-Initialize SD MSP.
HAL_StatusTypeDef HAL_SD_ReadBlocks (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout)
 Reads block(s) from a specified address in a card.
HAL_StatusTypeDef HAL_SD_WriteBlocks (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout)
 Allows to write block(s) to a specified address in a card.
HAL_StatusTypeDef HAL_SD_Erase (SD_HandleTypeDef *hsd, uint32_t BlockStartAdd, uint32_t BlockEndAdd)
 Erases the specified memory area of the given SD card.
HAL_StatusTypeDef HAL_SD_ReadBlocks_IT (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in a card.
HAL_StatusTypeDef HAL_SD_WriteBlocks_IT (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in a card.
HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in a card.
HAL_StatusTypeDef HAL_SD_WriteBlocks_DMA (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in a card.
void HAL_SD_IRQHandler (SD_HandleTypeDef *hsd)
 This function handles SD card interrupt request.
__weak void HAL_SD_TxCpltCallback (SD_HandleTypeDef *hsd)
 Tx Transfer completed callbacks.
__weak void HAL_SD_RxCpltCallback (SD_HandleTypeDef *hsd)
 Rx Transfer completed callbacks.
__weak void HAL_SD_ErrorCallback (SD_HandleTypeDef *hsd)
 SD error callbacks.
__weak void HAL_SD_AbortCallback (SD_HandleTypeDef *hsd)
 SD Abort callbacks.
HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation (SD_HandleTypeDef *hsd, uint32_t WideMode)
 Enables wide bus operation for the requested card if supported by card.
HAL_StatusTypeDef HAL_SD_SendSDStatus (SD_HandleTypeDef *hsd, uint32_t *pSDstatus)
HAL_SD_CardStateTypeDef HAL_SD_GetCardState (SD_HandleTypeDef *hsd)
 Gets the current sd card data state.
HAL_StatusTypeDef HAL_SD_GetCardCID (SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypeDef *pCID)
 Returns information the information of the card which are stored on the CID register.
HAL_StatusTypeDef HAL_SD_GetCardCSD (SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD)
 Returns information the information of the card which are stored on the CSD register.
HAL_StatusTypeDef HAL_SD_GetCardStatus (SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypeDef *pStatus)
 Gets the SD status info.
HAL_StatusTypeDef HAL_SD_GetCardInfo (SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo)
 Gets the SD card info.
HAL_SD_StateTypeDef HAL_SD_GetState (SD_HandleTypeDef *hsd)
 return the SD state
uint32_t HAL_SD_GetError (SD_HandleTypeDef *hsd)
 Return the SD error code.
HAL_StatusTypeDef HAL_SD_Abort (SD_HandleTypeDef *hsd)
 Abort the current transfer and disable the SD.
HAL_StatusTypeDef HAL_SD_Abort_IT (SD_HandleTypeDef *hsd)
 Abort the current transfer and disable the SD (IT mode).

Detailed Description

Header file of SD HAL module.

Author:
MCD Application Team
Attention:

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file stm32f4xx_hal_sd.h.