STM32 Bootloader
Customizable Bootloader for STM32 microcontrollers
sdmmc.c File Reference

This file contains the SDMMC peripheral driver implementation for SD card communication using DMA transfers. More...

#include "sdmmc.h"
#include "board.h"
#include "error_handler.h"
#include "mcu_hal.h"
#include "rcc.h"

Go to the source code of this file.

Functions

static void SdmmcResetPeripheralHandleState (void)
 Reset the SD peripheral handle state and card information.
 
static bool SdmmcConfigureDmaRx (void)
 Configure the DMA channel for SD card receive transfers. More...
 
static bool SdmmcConfigureDmaTx (void)
 Configure the DMA channel for SD card transmit transfers. More...
 
bool SdmmcInit (void)
 Initialize the SDMMC peripheral and the SD card. More...
 
void SdmmcDeInit (void)
 De-initialize the SDMMC peripheral.
 
bool SdmmcGetCardInfo (SdCardInfo *const cardInfo)
 Get the SD card information (capacity, block size, etc.). More...
 
bool SdmmcIsCardInTransferState (void)
 Check if the SD card is in the transfer state. More...
 
bool SdmmcReadBlocks (uint8_t *const data, const uint32_t blockAddress, const uint32_t numOfBlocks, const uint32_t timeout)
 Read blocks from the SD card in blocking mode. More...
 
bool SdmmcWriteBlocks (const uint8_t *const data, const uint32_t blockAddress, const uint32_t numOfBlocks, const uint32_t timeout)
 Write blocks to the SD card in blocking mode. More...
 
bool SdmmcReadBlocksDma (uint8_t *const data, const uint32_t blockAddress, const uint32_t numOfBlocks)
 Read blocks from the SD card using DMA. More...
 
bool SdmmcWriteBlocksDma (const uint8_t *const data, const uint32_t blockAddress, const uint32_t numOfBlocks)
 Write blocks to the SD card using DMA. More...
 
void SdmmcRegisterRxCompleteCallback (Callback callback)
 Register a callback for the DMA receive complete event. More...
 
void SdmmcRegisterTxCompleteCallback (Callback callback)
 Register a callback for the DMA transmit complete event. More...
 
void SDMMC1_IRQHandler (void)
 SDMMC1 interrupt handler.
 
void DMA2_Channel5_IRQHandler (void)
 DMA2 Channel 5 interrupt handler for SDMMC DMA transfers.
 
void HAL_SD_RxCpltCallback (SD_HandleTypeDef *hsd)
 SD card receive complete callback. More...
 
void HAL_SD_TxCpltCallback (SD_HandleTypeDef *hsd)
 SD card transmit complete callback. More...
 
void HAL_SD_AbortCallback (SD_HandleTypeDef *hsd)
 SD card abort callback. More...
 
void HAL_SD_ErrorCallback (SD_HandleTypeDef *hsd)
 SD card error callback. More...
 

Variables

static SD_HandleTypeDef sdHandle = {0}
 
static Callback rxCompleteCallback = NULL
 
static Callback txCompleteCallback = NULL
 

Detailed Description

This file contains the SDMMC peripheral driver implementation for SD card communication using DMA transfers.

STM32 Bootloader

Author
Akos Pasztor

Definition in file sdmmc.c.