This file contains the common defines and functions prototypes for the bsp_driver_sd.c driver. More...
Go to the source code of this file.
Macros | |
#define | BSP_SD_CardInfo HAL_SD_CardInfoTypeDef |
SD Card information structure. More... | |
#define | MSD_OK ((uint8_t)0x00) |
SD status structure definition. More... | |
#define | MSD_ERROR ((uint8_t)0x01) |
#define | MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02) |
#define | SD_TRANSFER_OK ((uint8_t)0x00) |
SD transfer state definition. More... | |
#define | SD_TRANSFER_BUSY ((uint8_t)0x01) |
#define | SD_PRESENT ((uint8_t)0x01) |
#define | SD_NOT_PRESENT ((uint8_t)0x00) |
#define | SD_DATATIMEOUT ((uint32_t)100000000) |
#define | SD_DetectIRQHandler() HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8) |
Functions | |
uint8_t | BSP_SD_Init (void) |
Initializes the SD card device. More... | |
uint8_t | BSP_SD_ITConfig (void) |
Configures Interrupt mode for SD detection pin. More... | |
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... | |
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... | |
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... | |
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... | |
uint8_t | BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr) |
Erases the specified memory area of the given SD card. More... | |
uint8_t | BSP_SD_GetCardState (void) |
Gets the current SD card data status. More... | |
void | BSP_SD_GetCardInfo (BSP_SD_CardInfo *CardInfo) |
uint8_t | BSP_SD_IsDetected (void) |
Detects if SD card is correctly plugged in the memory slot or not. More... | |
void | BSP_SD_AbortCallback (void) |
BSP SD Abort callback. More... | |
void | BSP_SD_WriteCpltCallback (void) |
BSP Tx Transfer completed callback. More... | |
void | BSP_SD_ReadCpltCallback (void) |
BSP Rx Transfer completed callback. More... | |
This file contains the common defines and functions prototypes for the bsp_driver_sd.c driver.
(based on stm32h743i_eval_sd.h)
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
#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef |
SD Card information structure.
#define MSD_ERROR ((uint8_t)0x01) |
#define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02) |
#define MSD_OK ((uint8_t)0x00) |
SD status structure definition.
#define SD_DATATIMEOUT ((uint32_t)100000000) |
#define SD_DetectIRQHandler | ( | ) | HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8) |
#define SD_NOT_PRESENT ((uint8_t)0x00) |
#define SD_PRESENT ((uint8_t)0x01) |
#define SD_TRANSFER_BUSY ((uint8_t)0x01) |
#define SD_TRANSFER_OK ((uint8_t)0x00) |
SD transfer state definition.
BSP SD Abort callback.
None |
uint8_t BSP_SD_Erase | ( | uint32_t | StartAddr, |
uint32_t | EndAddr | ||
) |
void BSP_SD_GetCardInfo | ( | BSP_SD_CardInfo * | CardInfo | ) |
uint8_t BSP_SD_GetCardState | ( | void | ) |
Gets the current SD card data status.
None |
Data | transfer state. This value can be one of the following values:
|
References hsd1, SD_TRANSFER_BUSY, and SD_TRANSFER_OK.
uint8_t BSP_SD_Init | ( | void | ) |
Initializes the SD card device.
SD | status |
References BSP_SD_IsDetected(), hsd1, MSD_ERROR, MSD_ERROR_SD_NOT_PRESENT, MSD_OK, and SD_PRESENT.
uint8_t BSP_SD_IsDetected | ( | void | ) |
Detects if SD card is correctly plugged in the memory slot or not.
None |
Returns | if SD is detected or not |
References BSP_PlatformIsDetected(), SD_NOT_PRESENT, and SD_PRESENT.
uint8_t BSP_SD_ITConfig | ( | void | ) |
Configures Interrupt mode for SD detection pin.
Returns | 0 |
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.
pData | Pointer to the buffer that will contain the data to transmit |
ReadAddr | Address from where data is to be read |
NumOfBlocks | Number of SD blocks to read |
Timeout | Timeout for read operation |
SD | status |
References hsd1, MSD_ERROR, and MSD_OK.
uint8_t BSP_SD_ReadBlocks_DMA | ( | uint32_t * | pData, |
uint32_t | ReadAddr, | ||
uint32_t | NumOfBlocks | ||
) |
BSP Rx Transfer completed callback.
None |
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.
pData | Pointer to the buffer that will contain the data to transmit |
WriteAddr | Address from where data is to be written |
NumOfBlocks | Number of SD blocks to write |
Timeout | Timeout for write operation |
SD | status |
uint8_t BSP_SD_WriteBlocks_DMA | ( | uint32_t * | pData, |
uint32_t | WriteAddr, | ||
uint32_t | NumOfBlocks | ||
) |