Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DISCO_L4R9I-LCD-demo
stm32l4r9i_discovery_sd.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4r9i_discovery_sd.h 00004 * @author MCD Application Team 00005 * @brief This file contains the common defines and functions prototypes for 00006 * the stm32l4r9i_discovery_sd.c driver. 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00011 * All rights reserved.</center></h2> 00012 * 00013 * This software component is licensed by ST under BSD 3-Clause license, 00014 * the "License"; You may not use this file except in compliance with the 00015 * License. You may obtain a copy of the License at: 00016 * opensource.org/licenses/BSD-3-Clause 00017 * 00018 ****************************************************************************** 00019 */ 00020 00021 /* Define to prevent recursive inclusion -------------------------------------*/ 00022 #ifndef __STM32L4R9I_DISCOVERY_SD_H 00023 #define __STM32L4R9I_DISCOVERY_SD_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 /* Includes ------------------------------------------------------------------*/ 00030 #include "stm32l4xx_hal.h" 00031 00032 /** @addtogroup BSP 00033 * @{ 00034 */ 00035 00036 /** @addtogroup STM32L4R9I_DISCOVERY 00037 * @{ 00038 */ 00039 00040 /** @addtogroup STM32L4R9I_DISCOVERY_SD 00041 * @{ 00042 */ 00043 00044 /* Exported types ------------------------------------------------------------*/ 00045 00046 /** @defgroup STM32L4R9I_DISCOVERY_SD_Exported_Types Exported Types 00047 * @{ 00048 */ 00049 00050 /** 00051 * @brief SD Card information structure 00052 */ 00053 #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef 00054 /** 00055 * @} 00056 */ 00057 00058 /** 00059 * @brief SD status structure definition 00060 */ 00061 #define MSD_OK ((uint8_t)0x00) 00062 #define MSD_ERROR ((uint8_t)0x01) 00063 #define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02) 00064 00065 /** 00066 * @brief SD transfer state definition 00067 */ 00068 #define SD_TRANSFER_OK ((uint8_t)0x00) 00069 #define SD_TRANSFER_BUSY ((uint8_t)0x01) 00070 #define SD_TRANSFER_ERROR ((uint8_t)0x02) 00071 00072 /* Exported constants --------------------------------------------------------*/ 00073 00074 /** @defgroup STM32L4R9I_DISCOVERY_SD_Exported_Constants Exported Constants 00075 * @{ 00076 */ 00077 #define SD_DATATIMEOUT ((uint32_t)100000000) 00078 00079 #define SD_PRESENT ((uint8_t)0x01) 00080 #define SD_NOT_PRESENT ((uint8_t)0x00) 00081 00082 /* SD IRQ handler */ 00083 #define SDMMCx_IRQHandler SDMMC1_IRQHandler 00084 #define SDMMCx_IRQn SDMMC1_IRQn 00085 00086 /** 00087 * @} 00088 */ 00089 00090 /* Exported variables --------------------------------------------------------*/ 00091 00092 /** @defgroup STM32L4R9I_DISCOVERY_SD_Exported_Variables Exported Variables 00093 * @{ 00094 */ 00095 extern SD_HandleTypeDef hsd_discovery; 00096 00097 /** 00098 * @} 00099 */ 00100 00101 /* Exported functions --------------------------------------------------------*/ 00102 00103 /** @defgroup STM32L4R9I_DISCOVERY_SD_Exported_Functions Exported Functions 00104 * @{ 00105 */ 00106 uint8_t BSP_SD_Init(void); 00107 uint8_t BSP_SD_DeInit(void); 00108 uint8_t BSP_SD_ITConfig(void); 00109 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout); 00110 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout); 00111 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks); 00112 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks); 00113 uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr); 00114 uint8_t BSP_SD_GetCardState(void); 00115 void BSP_SD_GetCardInfo(BSP_SD_CardInfo *CardInfo); 00116 uint8_t BSP_SD_IsDetected(void); 00117 00118 /* These __weak functions can be surcharged by application code in case the current settings 00119 (eg. interrupt priority, callbacks implementation) need to be changed for specific application needs */ 00120 void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params); 00121 void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params); 00122 void BSP_SD_AbortCallback(void); 00123 void BSP_SD_WriteCpltCallback(void); 00124 void BSP_SD_ReadCpltCallback(void); 00125 00126 /** 00127 * @} 00128 */ 00129 00130 /** 00131 * @} 00132 */ 00133 00134 /** 00135 * @} 00136 */ 00137 00138 /** 00139 * @} 00140 */ 00141 00142 #ifdef __cplusplus 00143 } 00144 #endif 00145 00146 #endif /* __STM32L4R9I_DISCOVERY_SD_H */ 00147 00148 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Wed Jul 13 2022 19:15:17 by
