WebRadioApp  0.1
bsp_driver_sd.c File Reference

This file includes a generic uSD card driver. To be completed by the user according to the board used for the project. More...

#include "bsp_driver_sd.h"
Include dependency graph for bsp_driver_sd.c:

Functions

__weak uint8_t BSP_SD_Init (void)
 Initializes the SD card device. More...
 
__weak uint8_t BSP_SD_ITConfig (void)
 Configures Interrupt mode for SD detection pin. More...
 
__weak 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. More...
 
__weak 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. More...
 
__weak 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. More...
 
__weak 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. More...
 
__weak uint8_t BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr)
 Erases the specified memory area of the given SD card. More...
 
__weak uint8_t BSP_SD_GetCardState (void)
 Gets the current SD card data status. More...
 
__weak void BSP_SD_GetCardInfo (HAL_SD_CardInfoTypeDef *CardInfo)
 Get SD information about specific SD card. More...
 
void HAL_SD_AbortCallback (SD_HandleTypeDef *hsd)
 SD Abort callbacks. More...
 
void HAL_SD_TxCpltCallback (SD_HandleTypeDef *hsd)
 Tx Transfer completed callback. More...
 
void HAL_SD_RxCpltCallback (SD_HandleTypeDef *hsd)
 Rx Transfer completed callback. More...
 
__weak void BSP_SD_AbortCallback (void)
 BSP SD Abort callback. More...
 
__weak void BSP_SD_WriteCpltCallback (void)
 BSP Tx Transfer completed callback. More...
 
__weak void BSP_SD_ReadCpltCallback (void)
 BSP Rx Transfer completed callback. More...
 
__weak uint8_t BSP_SD_IsDetected (void)
 Detects if SD card is correctly plugged in the memory slot or not. More...
 

Variables

SD_HandleTypeDef hsd1
 

Detailed Description

This file includes a generic uSD card driver. To be completed by the user according to the board used for the project.

for H7 (based on stm32h743i_eval_sd.c)

Note
Some functions generated as weak: they can be overriden by
  • code in user files
  • or BSP code from the FW pack files if such files are added to the generated project (by the user).
Attention

© Copyright (c) 2021 STMicroelectronics. All rights reserved.

This software component is licensed by ST under Ultimate Liberty license SLA0044, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: www.st.com/SLA0044

Function Documentation

◆ BSP_SD_AbortCallback()

__weak void BSP_SD_AbortCallback ( void  )

BSP SD Abort callback.

Return values
None
Note
empty (up to the user to fill it in or to remove it if useless)
Here is the caller graph for this function:

◆ BSP_SD_Erase()

__weak uint8_t BSP_SD_Erase ( uint32_t  StartAddr,
uint32_t  EndAddr 
)

Erases the specified memory area of the given SD card.

Parameters
StartAddrStart byte address
EndAddrEnd byte address
Return values
SDstatus

References hsd1, MSD_ERROR, and MSD_OK.

◆ BSP_SD_GetCardInfo()

__weak void BSP_SD_GetCardInfo ( HAL_SD_CardInfoTypeDef *  CardInfo)

Get SD information about specific SD card.

Parameters
CardInfoPointer to HAL_SD_CardInfoTypedef structure
Return values
None

References hsd1.

◆ BSP_SD_GetCardState()

__weak uint8_t BSP_SD_GetCardState ( void  )

Gets the current SD card data status.

Parameters
None
Return values
Datatransfer state. This value can be one of the following values:
  • SD_TRANSFER_OK: No data transfer is acting
  • SD_TRANSFER_BUSY: Data transfer is acting

References hsd1, SD_TRANSFER_BUSY, and SD_TRANSFER_OK.

Here is the caller graph for this function:

◆ BSP_SD_Init()

__weak uint8_t BSP_SD_Init ( void  )

Initializes the SD card device.

Return values
SDstatus

References BSP_SD_IsDetected(), hsd1, MSD_ERROR, MSD_ERROR_SD_NOT_PRESENT, MSD_OK, and SD_PRESENT.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BSP_SD_IsDetected()

__weak uint8_t BSP_SD_IsDetected ( void  )

Detects if SD card is correctly plugged in the memory slot or not.

Parameters
None
Return values
Returnsif SD is detected or not

References BSP_PlatformIsDetected(), SD_NOT_PRESENT, and SD_PRESENT.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BSP_SD_ITConfig()

__weak uint8_t BSP_SD_ITConfig ( void  )

Configures Interrupt mode for SD detection pin.

Return values
Returns0

◆ BSP_SD_ReadBlocks()

__weak 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.

Parameters
pDataPointer to the buffer that will contain the data to transmit
ReadAddrAddress from where data is to be read
NumOfBlocksNumber of SD blocks to read
TimeoutTimeout for read operation
Return values
SDstatus

References hsd1, MSD_ERROR, and MSD_OK.

Here is the caller graph for this function:

◆ BSP_SD_ReadBlocks_DMA()

__weak 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.

Parameters
pDataPointer to the buffer that will contain the data to transmit
ReadAddrAddress from where data is to be read
NumOfBlocksNumber of SD blocks to read
Return values
SDstatus

References hsd1, MSD_ERROR, and MSD_OK.

◆ BSP_SD_ReadCpltCallback()

__weak void BSP_SD_ReadCpltCallback ( void  )

BSP Rx Transfer completed callback.

Return values
None
Note
empty (up to the user to fill it in or to remove it if useless)
Here is the caller graph for this function:

◆ BSP_SD_WriteBlocks()

__weak 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.

Parameters
pDataPointer to the buffer that will contain the data to transmit
WriteAddrAddress from where data is to be written
NumOfBlocksNumber of SD blocks to write
TimeoutTimeout for write operation
Return values
SDstatus

References hsd1, MSD_ERROR, and MSD_OK.

◆ BSP_SD_WriteBlocks_DMA()

__weak 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.

Parameters
pDataPointer to the buffer that will contain the data to transmit
WriteAddrAddress from where data is to be written
NumOfBlocksNumber of SD blocks to write
Return values
SDstatus

References hsd1, MSD_ERROR, and MSD_OK.

◆ BSP_SD_WriteCpltCallback()

__weak void BSP_SD_WriteCpltCallback ( void  )

BSP Tx Transfer completed callback.

Return values
None
Note
empty (up to the user to fill it in or to remove it if useless)
Here is the caller graph for this function:

◆ HAL_SD_AbortCallback()

void HAL_SD_AbortCallback ( SD_HandleTypeDef *  hsd)

SD Abort callbacks.

Parameters
hsdSD handle
Return values
None

References BSP_SD_AbortCallback().

Here is the call graph for this function:

◆ HAL_SD_RxCpltCallback()

void HAL_SD_RxCpltCallback ( SD_HandleTypeDef *  hsd)

Rx Transfer completed callback.

Parameters
hsdSD handle
Return values
None

References BSP_SD_ReadCpltCallback().

Here is the call graph for this function:

◆ HAL_SD_TxCpltCallback()

void HAL_SD_TxCpltCallback ( SD_HandleTypeDef *  hsd)

Tx Transfer completed callback.

Parameters
hsdSD handle
Return values
None

References BSP_SD_WriteCpltCallback().

Here is the call graph for this function: