STM32F469NI Discovery board drivers

Dependents:   DISCO-F469NI_LCDTS_GUI_demo Configurable_Robots DISCO-F469NI_LCD_demo DISCO-F469NI_SD_demo ... more

Committer:
Jerome Coutant
Date:
Tue May 16 10:50:26 2017 +0200
Revision:
2:123b894b49dd
Child:
3:3cdfcc4f7c9d
STM32Cube_FW_BSP_DISCO_F469NI

Who changed what in which revision?

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