cueOS  2.4
cueOS - Universal Show Control OS for ARM
bsp_driver_sd.h
Go to the documentation of this file.
1
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef __STM32F4_SD_H
22#define __STM32F4_SD_H
23
24#ifdef __cplusplus
25 extern "C" {
26#endif
27
28/* Includes ------------------------------------------------------------------*/
29#include "stm32f4xx_hal.h"
30#include "fatfs_platform.h"
31
32/* Exported types --------------------------------------------------------*/
36#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
37
38/* Exported constants --------------------------------------------------------*/
42#define MSD_OK ((uint8_t)0x00)
43#define MSD_ERROR ((uint8_t)0x01)
44
48#define SD_TRANSFER_OK ((uint8_t)0x00)
49#define SD_TRANSFER_BUSY ((uint8_t)0x01)
50
51#define SD_PRESENT ((uint8_t)0x01)
52#define SD_NOT_PRESENT ((uint8_t)0x00)
53#define SD_DATATIMEOUT ((uint32_t)100000000)
54
55#ifdef OLD_API
56/* kept to avoid issue when migrating old projects. */
57/* USER CODE BEGIN 0 */
58
59/* USER CODE END 0 */
60#else
61/* USER CODE BEGIN BSP_H_CODE */
62/* Exported functions --------------------------------------------------------*/
63uint8_t BSP_SD_Init(void);
64uint8_t BSP_SD_ITConfig(void);
65void BSP_SD_DetectIT(void);
66void BSP_SD_DetectCallback(void);
67uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
68uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
69uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
70uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
71uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
72void BSP_SD_IRQHandler(void);
73void BSP_SD_DMA_Tx_IRQHandler(void);
74void BSP_SD_DMA_Rx_IRQHandler(void);
75uint8_t BSP_SD_GetCardState(void);
76void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
77uint8_t BSP_SD_IsDetected(void);
78
79/* These functions can be modified in case the current settings (e.g. DMA stream)
80 need to be changed for specific application needs */
81void BSP_SD_AbortCallback(void);
84/* USER CODE END BSP_H_CODE */
85#endif
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif /* __STM32F4_SD_H */
92
93/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
void BSP_SD_AbortCallback(void)
BSP SD Abort callback.
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_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.
uint8_t BSP_SD_Init(void)
Initializes the SD card device.
Definition: bsp_driver_sd.c:47
uint8_t BSP_SD_ITConfig(void)
Configures Interrupt mode for SD detection pin.
Definition: bsp_driver_sd.c:78
void BSP_SD_ReadCpltCallback(void)
BSP Rx Transfer completed callback.
void BSP_SD_DetectIT(void)
SD detect IT treatment.
Definition: bsp_driver_sd.c:87
uint8_t BSP_SD_GetCardState(void)
Gets the current SD card data status.
uint8_t BSP_SD_IsDetected(void)
Detects if SD card is correctly plugged in the memory slot or not.
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_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 BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
Get SD information about specific SD card.
void BSP_SD_WriteCpltCallback(void)
BSP Tx Transfer completed callback.
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
Erases the specified memory area of the given SD card.
: fatfs_platform header file