Go to the documentation of this file.
150 uint8_t sd_state =
MSD_OK;
156 uSdHandle.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
157 uSdHandle.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
158 uSdHandle.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
159 uSdHandle.Init.BusWide = SDMMC_BUS_WIDE_1B;
160 uSdHandle.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
161 uSdHandle.Init.ClockDiv = SDMMC_TRANSFER_CLK_DIV;
183 if(HAL_SD_ConfigWideBusOperation(&
uSdHandle, SDMMC_BUS_WIDE_4B) !=
HAL_OK)
201 uint8_t sd_state =
MSD_OK;
229 gpio_init_structure.
Speed = GPIO_SPEED_FAST;
265 uint8_t
BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
267 if(HAL_SD_ReadBlocks(&
uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) !=
HAL_OK)
285 uint8_t
BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
287 if(HAL_SD_WriteBlocks(&
uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks, Timeout) !=
HAL_OK)
307 if(HAL_SD_ReadBlocks_DMA(&
uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks) !=
HAL_OK)
327 if(HAL_SD_WriteBlocks_DMA(&
uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks) !=
HAL_OK)
380 gpio_init_structure.
Speed = GPIO_SPEED_HIGH;
475 gpio_init_structure.
Speed = GPIO_SPEED_HIGH;
508 __HAL_RCC_SDIO_CLK_DISABLE();
535 HAL_SD_GetCardInfo(&
uSdHandle, CardInfo);
#define SD_DETECT_EXTI_IRQn
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
__weak void BSP_SD_AbortCallback(void)
BSP SD Abort callbacks.
uint8_t BSP_SD_Init(void)
Initializes the SD card device.
DMA handle Structure definition.
GPIO Init structure definition
#define DMA_PDATAALIGN_WORD
__weak void BSP_SD_ReadCpltCallback(void)
BSP Rx Transfer completed callbacks.
#define __DMAx_TxRx_CLK_ENABLE
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
#define SD_TRANSFER_OK
SD transfer state definition
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
Reads block(s) from a specified address in an SD card, in polling mode.
uint8_t BSP_SD_GetCardState(void)
Gets the current SD card data status.
uint32_t PeriphDataAlignment
#define __HAL_RCC_GPIOB_CLK_ENABLE()
uint8_t BSP_SD_DeInit(void)
DeInitializes the SD card device.
#define __HAL_RCC_SDMMC2_CLK_ENABLE()
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
#define __HAL_RCC_GPIOD_CLK_ENABLE()
__weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
DeInitializes the SD MSP.
#define DMA_PERIPH_TO_MEMORY
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
#define SD_DMAx_Tx_STREAM
#define GPIO_MODE_IT_RISING_FALLING
DMA_HandleTypeDef * hdmatx
#define SD_DMAx_Tx_CHANNEL
DMA_Stream_TypeDef * Instance
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
Writes block(s) to a specified address in an SD card, in DMA mode.
uint32_t MemDataAlignment
IRQn_Type
STM32F4XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
__weak void BSP_SD_WriteCpltCallback(void)
BSP Tx Transfer completed callbacks.
void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
SD Abort callbacks.
#define MSD_OK
SD status structure definition.
#define SD_DETECT_GPIO_CLK_ENABLE()
#define SD_DETECT_GPIO_PORT
DMA_HandleTypeDef * hdmarx
__weak void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params)
Initializes the SD Detect pin MSP.
#define DMA_FIFOMODE_ENABLE
#define DMA_MEMORY_TO_PERIPH
HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
SD_HandleTypeDef uSdHandle
#define __HAL_RCC_GPIOG_CLK_ENABLE()
HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma)
#define MSD_ERROR_SD_NOT_PRESENT
#define DMA_PRIORITY_VERY_HIGH
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
This file contains the common defines and functions prototypes for the stm32f769i_discovery_sd....
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
Writes block(s) to a specified address in an SD card, in polling mode.
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
Erases the specified memory area of the given SD card.
#define SD_DETECT_PIN
SD-detect signal.
#define DMA_FIFO_THRESHOLD_FULL
uint8_t BSP_SD_IsDetected(void)
Detects if SD card is correctly plugged in the memory slot or not.
#define SD_DMAx_Rx_STREAM
void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
Get SD information about specific SD card.
#define SD_DMAx_Rx_CHANNEL
uint8_t BSP_SD_ITConfig(void)
Configures Interrupt mode for SD detection pin.
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
Reads block(s) from a specified address in an SD card, in DMA mode.
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
Tx Transfer completed callbacks.
#define DMA_MDATAALIGN_WORD
#define GPIO_AF10_SDMMC2
AF 10 selection.
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
Rx Transfer completed callbacks.
__weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
Initializes the SD MSP.