added some library

Fork of BSP_DISCO_F746NG by ST

Committer:
MikGa87
Date:
Thu Oct 27 10:05:07 2016 +0000
Revision:
3:fe21abc9cc66
Added header file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikGa87 3:fe21abc9cc66 1 /**
MikGa87 3:fe21abc9cc66 2 ******************************************************************************
MikGa87 3:fe21abc9cc66 3 * @file stm32746g_discovery_sd.c
MikGa87 3:fe21abc9cc66 4 * @author MCD Application Team
MikGa87 3:fe21abc9cc66 5 * @version V1.0.0
MikGa87 3:fe21abc9cc66 6 * @date 25-June-2015
MikGa87 3:fe21abc9cc66 7 * @brief This file includes the uSD card driver mounted on STM32746G-Discovery
MikGa87 3:fe21abc9cc66 8 * board.
MikGa87 3:fe21abc9cc66 9 @verbatim
MikGa87 3:fe21abc9cc66 10 1. How To use this driver:
MikGa87 3:fe21abc9cc66 11 --------------------------
MikGa87 3:fe21abc9cc66 12 - This driver is used to drive the micro SD external card mounted on STM32746G-Discovery
MikGa87 3:fe21abc9cc66 13 board.
MikGa87 3:fe21abc9cc66 14 - This driver does not need a specific component driver for the micro SD device
MikGa87 3:fe21abc9cc66 15 to be included with.
MikGa87 3:fe21abc9cc66 16
MikGa87 3:fe21abc9cc66 17 2. Driver description:
MikGa87 3:fe21abc9cc66 18 ---------------------
MikGa87 3:fe21abc9cc66 19 + Initialization steps:
MikGa87 3:fe21abc9cc66 20 o Initialize the micro SD card using the BSP_SD_Init() function. This
MikGa87 3:fe21abc9cc66 21 function includes the MSP layer hardware resources initialization and the
MikGa87 3:fe21abc9cc66 22 SDIO interface configuration to interface with the external micro SD. It
MikGa87 3:fe21abc9cc66 23 also includes the micro SD initialization sequence.
MikGa87 3:fe21abc9cc66 24 o To check the SD card presence you can use the function BSP_SD_IsDetected() which
MikGa87 3:fe21abc9cc66 25 returns the detection status
MikGa87 3:fe21abc9cc66 26 o If SD presence detection interrupt mode is desired, you must configure the
MikGa87 3:fe21abc9cc66 27 SD detection interrupt mode by calling the function BSP_SD_ITConfig(). The interrupt
MikGa87 3:fe21abc9cc66 28 is generated as an external interrupt whenever the micro SD card is
MikGa87 3:fe21abc9cc66 29 plugged/unplugged in/from the board.
MikGa87 3:fe21abc9cc66 30 o The function BSP_SD_GetCardInfo() is used to get the micro SD card information
MikGa87 3:fe21abc9cc66 31 which is stored in the structure "HAL_SD_CardInfoTypedef".
MikGa87 3:fe21abc9cc66 32
MikGa87 3:fe21abc9cc66 33 + Micro SD card operations
MikGa87 3:fe21abc9cc66 34 o The micro SD card can be accessed with read/write block(s) operations once
MikGa87 3:fe21abc9cc66 35 it is ready for access. The access can be performed whether using the polling
MikGa87 3:fe21abc9cc66 36 mode by calling the functions BSP_SD_ReadBlocks()/BSP_SD_WriteBlocks(), or by DMA
MikGa87 3:fe21abc9cc66 37 transfer using the functions BSP_SD_ReadBlocks_DMA()/BSP_SD_WriteBlocks_DMA()
MikGa87 3:fe21abc9cc66 38 o The DMA transfer complete is used with interrupt mode. Once the SD transfer
MikGa87 3:fe21abc9cc66 39 is complete, the SD interrupt is handled using the function BSP_SD_IRQHandler(),
MikGa87 3:fe21abc9cc66 40 the DMA Tx/Rx transfer complete are handled using the functions
MikGa87 3:fe21abc9cc66 41 BSP_SD_DMA_Tx_IRQHandler()/BSP_SD_DMA_Rx_IRQHandler(). The corresponding user callbacks
MikGa87 3:fe21abc9cc66 42 are implemented by the user at application level.
MikGa87 3:fe21abc9cc66 43 o The SD erase block(s) is performed using the function BSP_SD_Erase() with specifying
MikGa87 3:fe21abc9cc66 44 the number of blocks to erase.
MikGa87 3:fe21abc9cc66 45 o The SD runtime status is returned when calling the function BSP_SD_GetStatus().
MikGa87 3:fe21abc9cc66 46 @endverbatim
MikGa87 3:fe21abc9cc66 47 ******************************************************************************
MikGa87 3:fe21abc9cc66 48 * @attention
MikGa87 3:fe21abc9cc66 49 *
MikGa87 3:fe21abc9cc66 50 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
MikGa87 3:fe21abc9cc66 51 *
MikGa87 3:fe21abc9cc66 52 * Redistribution and use in source and binary forms, with or without modification,
MikGa87 3:fe21abc9cc66 53 * are permitted provided that the following conditions are met:
MikGa87 3:fe21abc9cc66 54 * 1. Redistributions of source code must retain the above copyright notice,
MikGa87 3:fe21abc9cc66 55 * this list of conditions and the following disclaimer.
MikGa87 3:fe21abc9cc66 56 * 2. Redistributions in binary form must reproduce the above copyright notice,
MikGa87 3:fe21abc9cc66 57 * this list of conditions and the following disclaimer in the documentation
MikGa87 3:fe21abc9cc66 58 * and/or other materials provided with the distribution.
MikGa87 3:fe21abc9cc66 59 * 3. Neither the name of STMicroelectronics nor the names of its contributors
MikGa87 3:fe21abc9cc66 60 * may be used to endorse or promote products derived from this software
MikGa87 3:fe21abc9cc66 61 * without specific prior written permission.
MikGa87 3:fe21abc9cc66 62 *
MikGa87 3:fe21abc9cc66 63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
MikGa87 3:fe21abc9cc66 64 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
MikGa87 3:fe21abc9cc66 65 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
MikGa87 3:fe21abc9cc66 66 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
MikGa87 3:fe21abc9cc66 67 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
MikGa87 3:fe21abc9cc66 68 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
MikGa87 3:fe21abc9cc66 69 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
MikGa87 3:fe21abc9cc66 70 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
MikGa87 3:fe21abc9cc66 71 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
MikGa87 3:fe21abc9cc66 72 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MikGa87 3:fe21abc9cc66 73 *
MikGa87 3:fe21abc9cc66 74 ******************************************************************************
MikGa87 3:fe21abc9cc66 75 */
MikGa87 3:fe21abc9cc66 76
MikGa87 3:fe21abc9cc66 77 /* Includes ------------------------------------------------------------------*/
MikGa87 3:fe21abc9cc66 78 #include "stm32746g_discovery_sd.h"
MikGa87 3:fe21abc9cc66 79
MikGa87 3:fe21abc9cc66 80 /** @addtogroup BSP
MikGa87 3:fe21abc9cc66 81 * @{
MikGa87 3:fe21abc9cc66 82 */
MikGa87 3:fe21abc9cc66 83
MikGa87 3:fe21abc9cc66 84 /** @addtogroup STM32746G_DISCOVERY
MikGa87 3:fe21abc9cc66 85 * @{
MikGa87 3:fe21abc9cc66 86 */
MikGa87 3:fe21abc9cc66 87
MikGa87 3:fe21abc9cc66 88 /** @defgroup STM32746G_DISCOVERY_SD STM32746G_DISCOVERY_SD
MikGa87 3:fe21abc9cc66 89 * @{
MikGa87 3:fe21abc9cc66 90 */
MikGa87 3:fe21abc9cc66 91
MikGa87 3:fe21abc9cc66 92
MikGa87 3:fe21abc9cc66 93 /** @defgroup STM32746G_DISCOVERY_SD_Private_TypesDefinitions STM32746G_DISCOVERY_SD Private Types Definitions
MikGa87 3:fe21abc9cc66 94 * @{
MikGa87 3:fe21abc9cc66 95 */
MikGa87 3:fe21abc9cc66 96 /**
MikGa87 3:fe21abc9cc66 97 * @}
MikGa87 3:fe21abc9cc66 98 */
MikGa87 3:fe21abc9cc66 99
MikGa87 3:fe21abc9cc66 100 /** @defgroup STM32746G_DISCOVERY_SD_Private_Defines STM32746G_DISCOVERY_SD Private Defines
MikGa87 3:fe21abc9cc66 101 * @{
MikGa87 3:fe21abc9cc66 102 */
MikGa87 3:fe21abc9cc66 103 /**
MikGa87 3:fe21abc9cc66 104 * @}
MikGa87 3:fe21abc9cc66 105 */
MikGa87 3:fe21abc9cc66 106
MikGa87 3:fe21abc9cc66 107 /** @defgroup STM32746G_DISCOVERY_SD_Private_Macros STM32746G_DISCOVERY_SD Private Macros
MikGa87 3:fe21abc9cc66 108 * @{
MikGa87 3:fe21abc9cc66 109 */
MikGa87 3:fe21abc9cc66 110 /**
MikGa87 3:fe21abc9cc66 111 * @}
MikGa87 3:fe21abc9cc66 112 */
MikGa87 3:fe21abc9cc66 113
MikGa87 3:fe21abc9cc66 114 /** @defgroup STM32746G_DISCOVERY_SD_Private_Variables STM32746G_DISCOVERY_SD Private Variables
MikGa87 3:fe21abc9cc66 115 * @{
MikGa87 3:fe21abc9cc66 116 */
MikGa87 3:fe21abc9cc66 117 static SD_HandleTypeDef uSdHandle;
MikGa87 3:fe21abc9cc66 118 static SD_CardInfo uSdCardInfo;
MikGa87 3:fe21abc9cc66 119
MikGa87 3:fe21abc9cc66 120 /**
MikGa87 3:fe21abc9cc66 121 * @}
MikGa87 3:fe21abc9cc66 122 */
MikGa87 3:fe21abc9cc66 123
MikGa87 3:fe21abc9cc66 124 /** @defgroup STM32746G_DISCOVERY_SD_Private_FunctionPrototypes STM32746G_DISCOVERY_SD Private Function Prototypes
MikGa87 3:fe21abc9cc66 125 * @{
MikGa87 3:fe21abc9cc66 126 */
MikGa87 3:fe21abc9cc66 127 /**
MikGa87 3:fe21abc9cc66 128 * @}
MikGa87 3:fe21abc9cc66 129 */
MikGa87 3:fe21abc9cc66 130
MikGa87 3:fe21abc9cc66 131 /** @defgroup STM32746G_DISCOVERY_SD_Exported_Functions STM32746G_DISCOVERY_SD Exported Functions
MikGa87 3:fe21abc9cc66 132 * @{
MikGa87 3:fe21abc9cc66 133 */
MikGa87 3:fe21abc9cc66 134
MikGa87 3:fe21abc9cc66 135 /**
MikGa87 3:fe21abc9cc66 136 * @brief Initializes the SD card device.
MikGa87 3:fe21abc9cc66 137 * @retval SD status
MikGa87 3:fe21abc9cc66 138 */
MikGa87 3:fe21abc9cc66 139 uint8_t BSP_SD_Init(void)
MikGa87 3:fe21abc9cc66 140 {
MikGa87 3:fe21abc9cc66 141 uint8_t sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 142
MikGa87 3:fe21abc9cc66 143 /* uSD device interface configuration */
MikGa87 3:fe21abc9cc66 144 uSdHandle.Instance = SDMMC1;
MikGa87 3:fe21abc9cc66 145
MikGa87 3:fe21abc9cc66 146 uSdHandle.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
MikGa87 3:fe21abc9cc66 147 uSdHandle.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
MikGa87 3:fe21abc9cc66 148 uSdHandle.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
MikGa87 3:fe21abc9cc66 149 uSdHandle.Init.BusWide = SDMMC_BUS_WIDE_1B;
MikGa87 3:fe21abc9cc66 150 uSdHandle.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
MikGa87 3:fe21abc9cc66 151 uSdHandle.Init.ClockDiv = SDMMC_TRANSFER_CLK_DIV;
MikGa87 3:fe21abc9cc66 152
MikGa87 3:fe21abc9cc66 153 /* Msp SD Detect pin initialization */
MikGa87 3:fe21abc9cc66 154 BSP_SD_Detect_MspInit(&uSdHandle, NULL);
MikGa87 3:fe21abc9cc66 155 if(BSP_SD_IsDetected() != SD_PRESENT) /* Check if SD card is present */
MikGa87 3:fe21abc9cc66 156 {
MikGa87 3:fe21abc9cc66 157 return MSD_ERROR_SD_NOT_PRESENT;
MikGa87 3:fe21abc9cc66 158 }
MikGa87 3:fe21abc9cc66 159
MikGa87 3:fe21abc9cc66 160 /* Msp SD initialization */
MikGa87 3:fe21abc9cc66 161 BSP_SD_MspInit(&uSdHandle, NULL);
MikGa87 3:fe21abc9cc66 162
MikGa87 3:fe21abc9cc66 163 /* HAL SD initialization */
MikGa87 3:fe21abc9cc66 164 if(HAL_SD_Init(&uSdHandle, &uSdCardInfo) != SD_OK)
MikGa87 3:fe21abc9cc66 165 {
MikGa87 3:fe21abc9cc66 166 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 167 }
MikGa87 3:fe21abc9cc66 168
MikGa87 3:fe21abc9cc66 169 /* Configure SD Bus width */
MikGa87 3:fe21abc9cc66 170 if(sd_state == MSD_OK)
MikGa87 3:fe21abc9cc66 171 {
MikGa87 3:fe21abc9cc66 172 /* Enable wide operation */
MikGa87 3:fe21abc9cc66 173 if(HAL_SD_WideBusOperation_Config(&uSdHandle, SDMMC_BUS_WIDE_4B) != SD_OK)
MikGa87 3:fe21abc9cc66 174 {
MikGa87 3:fe21abc9cc66 175 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 176 }
MikGa87 3:fe21abc9cc66 177 else
MikGa87 3:fe21abc9cc66 178 {
MikGa87 3:fe21abc9cc66 179 sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 180 }
MikGa87 3:fe21abc9cc66 181 }
MikGa87 3:fe21abc9cc66 182
MikGa87 3:fe21abc9cc66 183 return sd_state;
MikGa87 3:fe21abc9cc66 184 }
MikGa87 3:fe21abc9cc66 185
MikGa87 3:fe21abc9cc66 186 /**
MikGa87 3:fe21abc9cc66 187 * @brief DeInitializes the SD card device.
MikGa87 3:fe21abc9cc66 188 * @retval SD status
MikGa87 3:fe21abc9cc66 189 */
MikGa87 3:fe21abc9cc66 190 uint8_t BSP_SD_DeInit(void)
MikGa87 3:fe21abc9cc66 191 {
MikGa87 3:fe21abc9cc66 192 uint8_t sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 193
MikGa87 3:fe21abc9cc66 194 uSdHandle.Instance = SDMMC1;
MikGa87 3:fe21abc9cc66 195
MikGa87 3:fe21abc9cc66 196 /* HAL SD deinitialization */
MikGa87 3:fe21abc9cc66 197 if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
MikGa87 3:fe21abc9cc66 198 {
MikGa87 3:fe21abc9cc66 199 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 200 }
MikGa87 3:fe21abc9cc66 201
MikGa87 3:fe21abc9cc66 202 /* Msp SD deinitialization */
MikGa87 3:fe21abc9cc66 203 uSdHandle.Instance = SDMMC1;
MikGa87 3:fe21abc9cc66 204 BSP_SD_MspDeInit(&uSdHandle, NULL);
MikGa87 3:fe21abc9cc66 205
MikGa87 3:fe21abc9cc66 206 return sd_state;
MikGa87 3:fe21abc9cc66 207 }
MikGa87 3:fe21abc9cc66 208
MikGa87 3:fe21abc9cc66 209 /**
MikGa87 3:fe21abc9cc66 210 * @brief Configures Interrupt mode for SD detection pin.
MikGa87 3:fe21abc9cc66 211 * @retval Returns MSD_OK
MikGa87 3:fe21abc9cc66 212 */
MikGa87 3:fe21abc9cc66 213 uint8_t BSP_SD_ITConfig(void)
MikGa87 3:fe21abc9cc66 214 {
MikGa87 3:fe21abc9cc66 215 GPIO_InitTypeDef gpio_init_structure;
MikGa87 3:fe21abc9cc66 216
MikGa87 3:fe21abc9cc66 217 /* Configure Interrupt mode for SD detection pin */
MikGa87 3:fe21abc9cc66 218 gpio_init_structure.Pin = SD_DETECT_PIN;
MikGa87 3:fe21abc9cc66 219 gpio_init_structure.Pull = GPIO_PULLUP;
MikGa87 3:fe21abc9cc66 220 gpio_init_structure.Speed = GPIO_SPEED_FAST;
MikGa87 3:fe21abc9cc66 221 gpio_init_structure.Mode = GPIO_MODE_IT_RISING_FALLING;
MikGa87 3:fe21abc9cc66 222 HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
MikGa87 3:fe21abc9cc66 223
MikGa87 3:fe21abc9cc66 224 /* Enable and set SD detect EXTI Interrupt to the lowest priority */
MikGa87 3:fe21abc9cc66 225 HAL_NVIC_SetPriority((IRQn_Type)(SD_DETECT_EXTI_IRQn), 0x0F, 0x00);
MikGa87 3:fe21abc9cc66 226 HAL_NVIC_EnableIRQ((IRQn_Type)(SD_DETECT_EXTI_IRQn));
MikGa87 3:fe21abc9cc66 227
MikGa87 3:fe21abc9cc66 228 return MSD_OK;
MikGa87 3:fe21abc9cc66 229 }
MikGa87 3:fe21abc9cc66 230
MikGa87 3:fe21abc9cc66 231 /**
MikGa87 3:fe21abc9cc66 232 * @brief Detects if SD card is correctly plugged in the memory slot or not.
MikGa87 3:fe21abc9cc66 233 * @retval Returns if SD is detected or not
MikGa87 3:fe21abc9cc66 234 */
MikGa87 3:fe21abc9cc66 235 uint8_t BSP_SD_IsDetected(void)
MikGa87 3:fe21abc9cc66 236 {
MikGa87 3:fe21abc9cc66 237 __IO uint8_t status = SD_PRESENT;
MikGa87 3:fe21abc9cc66 238
MikGa87 3:fe21abc9cc66 239 /* Check SD card detect pin */
MikGa87 3:fe21abc9cc66 240 if (HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) == GPIO_PIN_SET)
MikGa87 3:fe21abc9cc66 241 {
MikGa87 3:fe21abc9cc66 242 status = SD_NOT_PRESENT;
MikGa87 3:fe21abc9cc66 243 }
MikGa87 3:fe21abc9cc66 244
MikGa87 3:fe21abc9cc66 245 return status;
MikGa87 3:fe21abc9cc66 246 }
MikGa87 3:fe21abc9cc66 247
MikGa87 3:fe21abc9cc66 248 /**
MikGa87 3:fe21abc9cc66 249 * @brief Reads block(s) from a specified address in an SD card, in polling mode.
MikGa87 3:fe21abc9cc66 250 * @param pData: Pointer to the buffer that will contain the data to transmit
MikGa87 3:fe21abc9cc66 251 * @param ReadAddr: Address from where data is to be read
MikGa87 3:fe21abc9cc66 252 * @param BlockSize: SD card data block size, that should be 512
MikGa87 3:fe21abc9cc66 253 * @param NumOfBlocks: Number of SD blocks to read
MikGa87 3:fe21abc9cc66 254 * @retval SD status
MikGa87 3:fe21abc9cc66 255 */
MikGa87 3:fe21abc9cc66 256 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
MikGa87 3:fe21abc9cc66 257 {
MikGa87 3:fe21abc9cc66 258 if(HAL_SD_ReadBlocks(&uSdHandle, pData, ReadAddr, BlockSize, NumOfBlocks) != SD_OK)
MikGa87 3:fe21abc9cc66 259 {
MikGa87 3:fe21abc9cc66 260 return MSD_ERROR;
MikGa87 3:fe21abc9cc66 261 }
MikGa87 3:fe21abc9cc66 262 else
MikGa87 3:fe21abc9cc66 263 {
MikGa87 3:fe21abc9cc66 264 return MSD_OK;
MikGa87 3:fe21abc9cc66 265 }
MikGa87 3:fe21abc9cc66 266 }
MikGa87 3:fe21abc9cc66 267
MikGa87 3:fe21abc9cc66 268 /**
MikGa87 3:fe21abc9cc66 269 * @brief Writes block(s) to a specified address in an SD card, in polling mode.
MikGa87 3:fe21abc9cc66 270 * @param pData: Pointer to the buffer that will contain the data to transmit
MikGa87 3:fe21abc9cc66 271 * @param WriteAddr: Address from where data is to be written
MikGa87 3:fe21abc9cc66 272 * @param BlockSize: SD card data block size, that should be 512
MikGa87 3:fe21abc9cc66 273 * @param NumOfBlocks: Number of SD blocks to write
MikGa87 3:fe21abc9cc66 274 * @retval SD status
MikGa87 3:fe21abc9cc66 275 */
MikGa87 3:fe21abc9cc66 276 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
MikGa87 3:fe21abc9cc66 277 {
MikGa87 3:fe21abc9cc66 278 if(HAL_SD_WriteBlocks(&uSdHandle, pData, WriteAddr, BlockSize, NumOfBlocks) != SD_OK)
MikGa87 3:fe21abc9cc66 279 {
MikGa87 3:fe21abc9cc66 280 return MSD_ERROR;
MikGa87 3:fe21abc9cc66 281 }
MikGa87 3:fe21abc9cc66 282 else
MikGa87 3:fe21abc9cc66 283 {
MikGa87 3:fe21abc9cc66 284 return MSD_OK;
MikGa87 3:fe21abc9cc66 285 }
MikGa87 3:fe21abc9cc66 286 }
MikGa87 3:fe21abc9cc66 287
MikGa87 3:fe21abc9cc66 288 /**
MikGa87 3:fe21abc9cc66 289 * @brief Reads block(s) from a specified address in an SD card, in DMA mode.
MikGa87 3:fe21abc9cc66 290 * @param pData: Pointer to the buffer that will contain the data to transmit
MikGa87 3:fe21abc9cc66 291 * @param ReadAddr: Address from where data is to be read
MikGa87 3:fe21abc9cc66 292 * @param BlockSize: SD card data block size, that should be 512
MikGa87 3:fe21abc9cc66 293 * @param NumOfBlocks: Number of SD blocks to read
MikGa87 3:fe21abc9cc66 294 * @retval SD status
MikGa87 3:fe21abc9cc66 295 */
MikGa87 3:fe21abc9cc66 296 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
MikGa87 3:fe21abc9cc66 297 {
MikGa87 3:fe21abc9cc66 298 uint8_t sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 299
MikGa87 3:fe21abc9cc66 300 /* Read block(s) in DMA transfer mode */
MikGa87 3:fe21abc9cc66 301 if(HAL_SD_ReadBlocks_DMA(&uSdHandle, pData, ReadAddr, BlockSize, NumOfBlocks) != SD_OK)
MikGa87 3:fe21abc9cc66 302 {
MikGa87 3:fe21abc9cc66 303 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 304 }
MikGa87 3:fe21abc9cc66 305
MikGa87 3:fe21abc9cc66 306 /* Wait until transfer is complete */
MikGa87 3:fe21abc9cc66 307 if(sd_state == MSD_OK)
MikGa87 3:fe21abc9cc66 308 {
MikGa87 3:fe21abc9cc66 309 if(HAL_SD_CheckReadOperation(&uSdHandle, (uint32_t)SD_DATATIMEOUT) != SD_OK)
MikGa87 3:fe21abc9cc66 310 {
MikGa87 3:fe21abc9cc66 311 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 312 }
MikGa87 3:fe21abc9cc66 313 else
MikGa87 3:fe21abc9cc66 314 {
MikGa87 3:fe21abc9cc66 315 sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 316 }
MikGa87 3:fe21abc9cc66 317 }
MikGa87 3:fe21abc9cc66 318
MikGa87 3:fe21abc9cc66 319 return sd_state;
MikGa87 3:fe21abc9cc66 320 }
MikGa87 3:fe21abc9cc66 321
MikGa87 3:fe21abc9cc66 322 /**
MikGa87 3:fe21abc9cc66 323 * @brief Writes block(s) to a specified address in an SD card, in DMA mode.
MikGa87 3:fe21abc9cc66 324 * @param pData: Pointer to the buffer that will contain the data to transmit
MikGa87 3:fe21abc9cc66 325 * @param WriteAddr: Address from where data is to be written
MikGa87 3:fe21abc9cc66 326 * @param BlockSize: SD card data block size, that should be 512
MikGa87 3:fe21abc9cc66 327 * @param NumOfBlocks: Number of SD blocks to write
MikGa87 3:fe21abc9cc66 328 * @retval SD status
MikGa87 3:fe21abc9cc66 329 */
MikGa87 3:fe21abc9cc66 330 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
MikGa87 3:fe21abc9cc66 331 {
MikGa87 3:fe21abc9cc66 332 uint8_t sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 333
MikGa87 3:fe21abc9cc66 334 /* Write block(s) in DMA transfer mode */
MikGa87 3:fe21abc9cc66 335 if(HAL_SD_WriteBlocks_DMA(&uSdHandle, pData, WriteAddr, BlockSize, NumOfBlocks) != SD_OK)
MikGa87 3:fe21abc9cc66 336 {
MikGa87 3:fe21abc9cc66 337 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 338 }
MikGa87 3:fe21abc9cc66 339
MikGa87 3:fe21abc9cc66 340 /* Wait until transfer is complete */
MikGa87 3:fe21abc9cc66 341 if(sd_state == MSD_OK)
MikGa87 3:fe21abc9cc66 342 {
MikGa87 3:fe21abc9cc66 343 if(HAL_SD_CheckWriteOperation(&uSdHandle, (uint32_t)SD_DATATIMEOUT) != SD_OK)
MikGa87 3:fe21abc9cc66 344 {
MikGa87 3:fe21abc9cc66 345 sd_state = MSD_ERROR;
MikGa87 3:fe21abc9cc66 346 }
MikGa87 3:fe21abc9cc66 347 else
MikGa87 3:fe21abc9cc66 348 {
MikGa87 3:fe21abc9cc66 349 sd_state = MSD_OK;
MikGa87 3:fe21abc9cc66 350 }
MikGa87 3:fe21abc9cc66 351 }
MikGa87 3:fe21abc9cc66 352
MikGa87 3:fe21abc9cc66 353 return sd_state;
MikGa87 3:fe21abc9cc66 354 }
MikGa87 3:fe21abc9cc66 355
MikGa87 3:fe21abc9cc66 356 /**
MikGa87 3:fe21abc9cc66 357 * @brief Erases the specified memory area of the given SD card.
MikGa87 3:fe21abc9cc66 358 * @param StartAddr: Start byte address
MikGa87 3:fe21abc9cc66 359 * @param EndAddr: End byte address
MikGa87 3:fe21abc9cc66 360 * @retval SD status
MikGa87 3:fe21abc9cc66 361 */
MikGa87 3:fe21abc9cc66 362 uint8_t BSP_SD_Erase(uint64_t StartAddr, uint64_t EndAddr)
MikGa87 3:fe21abc9cc66 363 {
MikGa87 3:fe21abc9cc66 364 if(HAL_SD_Erase(&uSdHandle, StartAddr, EndAddr) != SD_OK)
MikGa87 3:fe21abc9cc66 365 {
MikGa87 3:fe21abc9cc66 366 return MSD_ERROR;
MikGa87 3:fe21abc9cc66 367 }
MikGa87 3:fe21abc9cc66 368 else
MikGa87 3:fe21abc9cc66 369 {
MikGa87 3:fe21abc9cc66 370 return MSD_OK;
MikGa87 3:fe21abc9cc66 371 }
MikGa87 3:fe21abc9cc66 372 }
MikGa87 3:fe21abc9cc66 373
MikGa87 3:fe21abc9cc66 374 /**
MikGa87 3:fe21abc9cc66 375 * @brief Initializes the SD MSP.
MikGa87 3:fe21abc9cc66 376 * @param hsd: SD handle
MikGa87 3:fe21abc9cc66 377 * @param Params
MikGa87 3:fe21abc9cc66 378 * @retval None
MikGa87 3:fe21abc9cc66 379 */
MikGa87 3:fe21abc9cc66 380 __weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
MikGa87 3:fe21abc9cc66 381 {
MikGa87 3:fe21abc9cc66 382 static DMA_HandleTypeDef dma_rx_handle;
MikGa87 3:fe21abc9cc66 383 static DMA_HandleTypeDef dma_tx_handle;
MikGa87 3:fe21abc9cc66 384 GPIO_InitTypeDef gpio_init_structure;
MikGa87 3:fe21abc9cc66 385
MikGa87 3:fe21abc9cc66 386 /* Enable SDIO clock */
MikGa87 3:fe21abc9cc66 387 __HAL_RCC_SDMMC1_CLK_ENABLE();
MikGa87 3:fe21abc9cc66 388
MikGa87 3:fe21abc9cc66 389 /* Enable DMA2 clocks */
MikGa87 3:fe21abc9cc66 390 __DMAx_TxRx_CLK_ENABLE();
MikGa87 3:fe21abc9cc66 391
MikGa87 3:fe21abc9cc66 392 /* Enable GPIOs clock */
MikGa87 3:fe21abc9cc66 393 __HAL_RCC_GPIOC_CLK_ENABLE();
MikGa87 3:fe21abc9cc66 394 __HAL_RCC_GPIOD_CLK_ENABLE();
MikGa87 3:fe21abc9cc66 395
MikGa87 3:fe21abc9cc66 396 /* Common GPIO configuration */
MikGa87 3:fe21abc9cc66 397 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
MikGa87 3:fe21abc9cc66 398 gpio_init_structure.Pull = GPIO_PULLUP;
MikGa87 3:fe21abc9cc66 399 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
MikGa87 3:fe21abc9cc66 400 gpio_init_structure.Alternate = GPIO_AF12_SDMMC1;
MikGa87 3:fe21abc9cc66 401
MikGa87 3:fe21abc9cc66 402 /* GPIOC configuration */
MikGa87 3:fe21abc9cc66 403 gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
MikGa87 3:fe21abc9cc66 404 HAL_GPIO_Init(GPIOC, &gpio_init_structure);
MikGa87 3:fe21abc9cc66 405
MikGa87 3:fe21abc9cc66 406 /* GPIOD configuration */
MikGa87 3:fe21abc9cc66 407 gpio_init_structure.Pin = GPIO_PIN_2;
MikGa87 3:fe21abc9cc66 408 HAL_GPIO_Init(GPIOD, &gpio_init_structure);
MikGa87 3:fe21abc9cc66 409
MikGa87 3:fe21abc9cc66 410 /* NVIC configuration for SDIO interrupts */
MikGa87 3:fe21abc9cc66 411 HAL_NVIC_SetPriority(SDMMC1_IRQn, 5, 0);
MikGa87 3:fe21abc9cc66 412 HAL_NVIC_EnableIRQ(SDMMC1_IRQn);
MikGa87 3:fe21abc9cc66 413
MikGa87 3:fe21abc9cc66 414 /* Configure DMA Rx parameters */
MikGa87 3:fe21abc9cc66 415 dma_rx_handle.Init.Channel = SD_DMAx_Rx_CHANNEL;
MikGa87 3:fe21abc9cc66 416 dma_rx_handle.Init.Direction = DMA_PERIPH_TO_MEMORY;
MikGa87 3:fe21abc9cc66 417 dma_rx_handle.Init.PeriphInc = DMA_PINC_DISABLE;
MikGa87 3:fe21abc9cc66 418 dma_rx_handle.Init.MemInc = DMA_MINC_ENABLE;
MikGa87 3:fe21abc9cc66 419 dma_rx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
MikGa87 3:fe21abc9cc66 420 dma_rx_handle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
MikGa87 3:fe21abc9cc66 421 dma_rx_handle.Init.Mode = DMA_PFCTRL;
MikGa87 3:fe21abc9cc66 422 dma_rx_handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
MikGa87 3:fe21abc9cc66 423 dma_rx_handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
MikGa87 3:fe21abc9cc66 424 dma_rx_handle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
MikGa87 3:fe21abc9cc66 425 dma_rx_handle.Init.MemBurst = DMA_MBURST_INC4;
MikGa87 3:fe21abc9cc66 426 dma_rx_handle.Init.PeriphBurst = DMA_PBURST_INC4;
MikGa87 3:fe21abc9cc66 427
MikGa87 3:fe21abc9cc66 428 dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
MikGa87 3:fe21abc9cc66 429
MikGa87 3:fe21abc9cc66 430 /* Associate the DMA handle */
MikGa87 3:fe21abc9cc66 431 __HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
MikGa87 3:fe21abc9cc66 432
MikGa87 3:fe21abc9cc66 433 /* Deinitialize the stream for new transfer */
MikGa87 3:fe21abc9cc66 434 HAL_DMA_DeInit(&dma_rx_handle);
MikGa87 3:fe21abc9cc66 435
MikGa87 3:fe21abc9cc66 436 /* Configure the DMA stream */
MikGa87 3:fe21abc9cc66 437 HAL_DMA_Init(&dma_rx_handle);
MikGa87 3:fe21abc9cc66 438
MikGa87 3:fe21abc9cc66 439 /* Configure DMA Tx parameters */
MikGa87 3:fe21abc9cc66 440 dma_tx_handle.Init.Channel = SD_DMAx_Tx_CHANNEL;
MikGa87 3:fe21abc9cc66 441 dma_tx_handle.Init.Direction = DMA_MEMORY_TO_PERIPH;
MikGa87 3:fe21abc9cc66 442 dma_tx_handle.Init.PeriphInc = DMA_PINC_DISABLE;
MikGa87 3:fe21abc9cc66 443 dma_tx_handle.Init.MemInc = DMA_MINC_ENABLE;
MikGa87 3:fe21abc9cc66 444 dma_tx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
MikGa87 3:fe21abc9cc66 445 dma_tx_handle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
MikGa87 3:fe21abc9cc66 446 dma_tx_handle.Init.Mode = DMA_PFCTRL;
MikGa87 3:fe21abc9cc66 447 dma_tx_handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
MikGa87 3:fe21abc9cc66 448 dma_tx_handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
MikGa87 3:fe21abc9cc66 449 dma_tx_handle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
MikGa87 3:fe21abc9cc66 450 dma_tx_handle.Init.MemBurst = DMA_MBURST_INC4;
MikGa87 3:fe21abc9cc66 451 dma_tx_handle.Init.PeriphBurst = DMA_PBURST_INC4;
MikGa87 3:fe21abc9cc66 452
MikGa87 3:fe21abc9cc66 453 dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
MikGa87 3:fe21abc9cc66 454
MikGa87 3:fe21abc9cc66 455 /* Associate the DMA handle */
MikGa87 3:fe21abc9cc66 456 __HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
MikGa87 3:fe21abc9cc66 457
MikGa87 3:fe21abc9cc66 458 /* Deinitialize the stream for new transfer */
MikGa87 3:fe21abc9cc66 459 HAL_DMA_DeInit(&dma_tx_handle);
MikGa87 3:fe21abc9cc66 460
MikGa87 3:fe21abc9cc66 461 /* Configure the DMA stream */
MikGa87 3:fe21abc9cc66 462 HAL_DMA_Init(&dma_tx_handle);
MikGa87 3:fe21abc9cc66 463
MikGa87 3:fe21abc9cc66 464 /* NVIC configuration for DMA transfer complete interrupt */
MikGa87 3:fe21abc9cc66 465 HAL_NVIC_SetPriority(SD_DMAx_Rx_IRQn, 6, 0);
MikGa87 3:fe21abc9cc66 466 HAL_NVIC_EnableIRQ(SD_DMAx_Rx_IRQn);
MikGa87 3:fe21abc9cc66 467
MikGa87 3:fe21abc9cc66 468 /* NVIC configuration for DMA transfer complete interrupt */
MikGa87 3:fe21abc9cc66 469 HAL_NVIC_SetPriority(SD_DMAx_Tx_IRQn, 6, 0);
MikGa87 3:fe21abc9cc66 470 HAL_NVIC_EnableIRQ(SD_DMAx_Tx_IRQn);
MikGa87 3:fe21abc9cc66 471 }
MikGa87 3:fe21abc9cc66 472
MikGa87 3:fe21abc9cc66 473 /**
MikGa87 3:fe21abc9cc66 474 * @brief Initializes the SD Detect pin MSP.
MikGa87 3:fe21abc9cc66 475 * @param hsd: SD handle
MikGa87 3:fe21abc9cc66 476 * @param Params
MikGa87 3:fe21abc9cc66 477 * @retval None
MikGa87 3:fe21abc9cc66 478 */
MikGa87 3:fe21abc9cc66 479 __weak void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params)
MikGa87 3:fe21abc9cc66 480 {
MikGa87 3:fe21abc9cc66 481 GPIO_InitTypeDef gpio_init_structure;
MikGa87 3:fe21abc9cc66 482
MikGa87 3:fe21abc9cc66 483 SD_DETECT_GPIO_CLK_ENABLE();
MikGa87 3:fe21abc9cc66 484
MikGa87 3:fe21abc9cc66 485 /* GPIO configuration in input for uSD_Detect signal */
MikGa87 3:fe21abc9cc66 486 gpio_init_structure.Pin = SD_DETECT_PIN;
MikGa87 3:fe21abc9cc66 487 gpio_init_structure.Mode = GPIO_MODE_INPUT;
MikGa87 3:fe21abc9cc66 488 gpio_init_structure.Pull = GPIO_PULLUP;
MikGa87 3:fe21abc9cc66 489 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
MikGa87 3:fe21abc9cc66 490 HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
MikGa87 3:fe21abc9cc66 491 }
MikGa87 3:fe21abc9cc66 492
MikGa87 3:fe21abc9cc66 493 /**
MikGa87 3:fe21abc9cc66 494 * @brief DeInitializes the SD MSP.
MikGa87 3:fe21abc9cc66 495 * @param hsd: SD handle
MikGa87 3:fe21abc9cc66 496 * @param Params
MikGa87 3:fe21abc9cc66 497 * @retval None
MikGa87 3:fe21abc9cc66 498 */
MikGa87 3:fe21abc9cc66 499 __weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
MikGa87 3:fe21abc9cc66 500 {
MikGa87 3:fe21abc9cc66 501 static DMA_HandleTypeDef dma_rx_handle;
MikGa87 3:fe21abc9cc66 502 static DMA_HandleTypeDef dma_tx_handle;
MikGa87 3:fe21abc9cc66 503
MikGa87 3:fe21abc9cc66 504 /* Disable NVIC for DMA transfer complete interrupts */
MikGa87 3:fe21abc9cc66 505 HAL_NVIC_DisableIRQ(SD_DMAx_Rx_IRQn);
MikGa87 3:fe21abc9cc66 506 HAL_NVIC_DisableIRQ(SD_DMAx_Tx_IRQn);
MikGa87 3:fe21abc9cc66 507
MikGa87 3:fe21abc9cc66 508 /* Deinitialize the stream for new transfer */
MikGa87 3:fe21abc9cc66 509 dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
MikGa87 3:fe21abc9cc66 510 HAL_DMA_DeInit(&dma_rx_handle);
MikGa87 3:fe21abc9cc66 511
MikGa87 3:fe21abc9cc66 512 /* Deinitialize the stream for new transfer */
MikGa87 3:fe21abc9cc66 513 dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
MikGa87 3:fe21abc9cc66 514 HAL_DMA_DeInit(&dma_tx_handle);
MikGa87 3:fe21abc9cc66 515
MikGa87 3:fe21abc9cc66 516 /* Disable NVIC for SDIO interrupts */
MikGa87 3:fe21abc9cc66 517 HAL_NVIC_DisableIRQ(SDMMC1_IRQn);
MikGa87 3:fe21abc9cc66 518
MikGa87 3:fe21abc9cc66 519 /* DeInit GPIO pins can be done in the application
MikGa87 3:fe21abc9cc66 520 (by surcharging this __weak function) */
MikGa87 3:fe21abc9cc66 521
MikGa87 3:fe21abc9cc66 522 /* Disable SDMMC1 clock */
MikGa87 3:fe21abc9cc66 523 __HAL_RCC_SDMMC1_CLK_DISABLE();
MikGa87 3:fe21abc9cc66 524
MikGa87 3:fe21abc9cc66 525 /* GPIO pins clock and DMA clocks can be shut down in the application
MikGa87 3:fe21abc9cc66 526 by surcharging this __weak function */
MikGa87 3:fe21abc9cc66 527 }
MikGa87 3:fe21abc9cc66 528
MikGa87 3:fe21abc9cc66 529 /**
MikGa87 3:fe21abc9cc66 530 * @brief Handles SD card interrupt request.
MikGa87 3:fe21abc9cc66 531 * @retval None
MikGa87 3:fe21abc9cc66 532 */
MikGa87 3:fe21abc9cc66 533 void BSP_SD_IRQHandler(void)
MikGa87 3:fe21abc9cc66 534 {
MikGa87 3:fe21abc9cc66 535 HAL_SD_IRQHandler(&uSdHandle);
MikGa87 3:fe21abc9cc66 536 }
MikGa87 3:fe21abc9cc66 537
MikGa87 3:fe21abc9cc66 538 /**
MikGa87 3:fe21abc9cc66 539 * @brief Handles SD DMA Tx transfer interrupt request.
MikGa87 3:fe21abc9cc66 540 * @retval None
MikGa87 3:fe21abc9cc66 541 */
MikGa87 3:fe21abc9cc66 542 void BSP_SD_DMA_Tx_IRQHandler(void)
MikGa87 3:fe21abc9cc66 543 {
MikGa87 3:fe21abc9cc66 544 HAL_DMA_IRQHandler(uSdHandle.hdmatx);
MikGa87 3:fe21abc9cc66 545 }
MikGa87 3:fe21abc9cc66 546
MikGa87 3:fe21abc9cc66 547 /**
MikGa87 3:fe21abc9cc66 548 * @brief Handles SD DMA Rx transfer interrupt request.
MikGa87 3:fe21abc9cc66 549 * @retval None
MikGa87 3:fe21abc9cc66 550 */
MikGa87 3:fe21abc9cc66 551 void BSP_SD_DMA_Rx_IRQHandler(void)
MikGa87 3:fe21abc9cc66 552 {
MikGa87 3:fe21abc9cc66 553 HAL_DMA_IRQHandler(uSdHandle.hdmarx);
MikGa87 3:fe21abc9cc66 554 }
MikGa87 3:fe21abc9cc66 555
MikGa87 3:fe21abc9cc66 556 /**
MikGa87 3:fe21abc9cc66 557 * @brief Gets the current SD card data status.
MikGa87 3:fe21abc9cc66 558 * @retval Data transfer state.
MikGa87 3:fe21abc9cc66 559 * This value can be one of the following values:
MikGa87 3:fe21abc9cc66 560 * @arg SD_TRANSFER_OK: No data transfer is acting
MikGa87 3:fe21abc9cc66 561 * @arg SD_TRANSFER_BUSY: Data transfer is acting
MikGa87 3:fe21abc9cc66 562 * @arg SD_TRANSFER_ERROR: Data transfer error
MikGa87 3:fe21abc9cc66 563 */
MikGa87 3:fe21abc9cc66 564 HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void)
MikGa87 3:fe21abc9cc66 565 {
MikGa87 3:fe21abc9cc66 566 return(HAL_SD_GetStatus(&uSdHandle));
MikGa87 3:fe21abc9cc66 567 }
MikGa87 3:fe21abc9cc66 568
MikGa87 3:fe21abc9cc66 569 /**
MikGa87 3:fe21abc9cc66 570 * @brief Get SD information about specific SD card.
MikGa87 3:fe21abc9cc66 571 * @param CardInfo: Pointer to HAL_SD_CardInfoTypedef structure
MikGa87 3:fe21abc9cc66 572 * @retval None
MikGa87 3:fe21abc9cc66 573 */
MikGa87 3:fe21abc9cc66 574 void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypedef *CardInfo)
MikGa87 3:fe21abc9cc66 575 {
MikGa87 3:fe21abc9cc66 576 /* Get SD card Information */
MikGa87 3:fe21abc9cc66 577 HAL_SD_Get_CardInfo(&uSdHandle, CardInfo);
MikGa87 3:fe21abc9cc66 578 }
MikGa87 3:fe21abc9cc66 579
MikGa87 3:fe21abc9cc66 580 /**
MikGa87 3:fe21abc9cc66 581 * @}
MikGa87 3:fe21abc9cc66 582 */
MikGa87 3:fe21abc9cc66 583
MikGa87 3:fe21abc9cc66 584 /**
MikGa87 3:fe21abc9cc66 585 * @}
MikGa87 3:fe21abc9cc66 586 */
MikGa87 3:fe21abc9cc66 587
MikGa87 3:fe21abc9cc66 588 /**
MikGa87 3:fe21abc9cc66 589 * @}
MikGa87 3:fe21abc9cc66 590 */
MikGa87 3:fe21abc9cc66 591
MikGa87 3:fe21abc9cc66 592 /**
MikGa87 3:fe21abc9cc66 593 * @}
MikGa87 3:fe21abc9cc66 594 */
MikGa87 3:fe21abc9cc66 595
MikGa87 3:fe21abc9cc66 596 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/