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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32469i_discovery_sd.c Source File

stm32469i_discovery_sd.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32469i_discovery_sd.c
00004   * @author  MCD Application Team
00005   * @brief   This file includes the uSD card driver mounted on STM32469I-Discovery
00006   *          board.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00011   *
00012   * Redistribution and use in source and binary forms, with or without modification,
00013   * are permitted provided that the following conditions are met:
00014   *   1. Redistributions of source code must retain the above copyright notice,
00015   *      this list of conditions and the following disclaimer.
00016   *   2. Redistributions in binary form must reproduce the above copyright notice,
00017   *      this list of conditions and the following disclaimer in the documentation
00018   *      and/or other materials provided with the distribution.
00019   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00020   *      may be used to endorse or promote products derived from this software
00021   *      without specific prior written permission.
00022   *
00023   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00027   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00029   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033   *
00034   ******************************************************************************
00035   */
00036 
00037 /* File Info : -----------------------------------------------------------------
00038                                    User NOTES
00039 1. How To use this driver:
00040 --------------------------
00041    - This driver is used to drive the micro SD external card mounted on STM32469I-Discovery
00042      board.
00043    - This driver does not need a specific component driver for the micro SD device
00044      to be included with.
00045 
00046 2. Driver description:
00047 ---------------------
00048   + Initialization steps:
00049      o Initialize the micro SD card using the BSP_SD_Init() function. This
00050        function includes the MSP layer hardware resources initialization and the
00051        SDIO interface configuration to interface with the external micro SD. It
00052        also includes the micro SD initialization sequence.
00053      o To check the SD card presence you can use the function BSP_SD_IsDetected() which
00054        returns the detection status
00055      o If SD presence detection interrupt mode is desired, you must configure the 
00056        SD detection interrupt mode by calling the function BSP_SD_ITConfig(). The interrupt 
00057        is generated as an external interrupt whenever the micro SD card is 
00058        plugged/unplugged in/from the board.
00059      o The function BSP_SD_GetCardInfo() is used to get the micro SD card information
00060        which is stored in the structure "HAL_SD_CardInfoTypeDef".
00061 
00062      + Micro SD card operations
00063         o The micro SD card can be accessed with read/write block(s) operations once 
00064           it is ready for access. The access can be performed whether using the polling
00065           mode by calling the functions BSP_SD_ReadBlocks()/BSP_SD_WriteBlocks(), or by DMA 
00066           transfer using the functions BSP_SD_ReadBlocks_DMA()/BSP_SD_WriteBlocks_DMA()
00067         o The DMA transfer complete is used with interrupt mode. Once the SD transfer
00068           is complete, the SD interrupt is handled using the function BSP_SD_IRQHandler(),
00069           the DMA Tx/Rx transfer complete are handled using the functions
00070           BSP_SD_DMA_Tx_IRQHandler()/BSP_SD_DMA_Rx_IRQHandler(). The corresponding user callbacks 
00071           are implemented by the user at application level. 
00072         o The SD erase block(s) is performed using the function BSP_SD_Erase() with specifying
00073           the number of blocks to erase.
00074         o The SD runtime status is returned when calling the function BSP_SD_GetCardState().
00075 
00076 ------------------------------------------------------------------------------*/
00077 
00078 /* Includes ------------------------------------------------------------------*/
00079 #include "stm32469i_discovery_sd.h"
00080 
00081 /** @addtogroup BSP
00082   * @{
00083   */
00084 
00085 /** @addtogroup STM32469I_Discovery
00086   * @{
00087   */
00088 
00089 /** @defgroup STM32469I-Discovery_SD STM32469I Discovery SD
00090   * @{
00091   */
00092 
00093 
00094 /** @defgroup STM32469I-Discovery_SD_Private_TypesDefinitions STM32469I Discovery SD Private TypesDef
00095   * @{
00096   */
00097 /**
00098   * @}
00099   */
00100 
00101 /** @defgroup STM32469I-Discovery_SD_Private_Defines STM32469I Discovery SD Private Defines
00102   * @{
00103   */
00104 /**
00105   * @}
00106   */
00107 
00108 /** @defgroup STM32469I-Discovery_SD_Private_Macros STM32469I Discovery SD Private Macro
00109   * @{
00110   */
00111 /**
00112   * @}
00113   */
00114 
00115 /** @defgroup STM32469I-Discovery_SD_Private_Variables STM32469I Discovery SD Private Variables
00116   * @{
00117   */
00118 SD_HandleTypeDef uSdHandle;
00119 
00120 /**
00121   * @}
00122   */
00123 
00124 /** @defgroup STM32469I-Discovery_SD_Private_FunctionPrototypes STM32469I Discovery SD Private Prototypes
00125   * @{
00126   */
00127 /**
00128   * @}
00129   */
00130 
00131 /** @defgroup STM32469I-Discovery_SD_Private_Functions STM32469I Discovery SD Private Functions
00132   * @{
00133   */
00134 
00135 /**
00136   * @brief  Initializes the SD card device.
00137   * @retval SD status
00138   */
00139 uint8_t BSP_SD_Init(void)
00140 {
00141   uint8_t sd_state = MSD_OK;
00142 
00143   /* PLLSAI is dedicated to LCD periph. Do not use it to get 48MHz*/
00144 
00145   /* uSD device interface configuration */
00146   uSdHandle.Instance = SDIO;
00147 
00148   uSdHandle.Init.ClockEdge           = SDIO_CLOCK_EDGE_RISING;
00149   uSdHandle.Init.ClockBypass         = SDIO_CLOCK_BYPASS_DISABLE;
00150   uSdHandle.Init.ClockPowerSave      = SDIO_CLOCK_POWER_SAVE_DISABLE;
00151   uSdHandle.Init.BusWide             = SDIO_BUS_WIDE_1B;
00152   uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE;
00153   uSdHandle.Init.ClockDiv            = SDIO_TRANSFER_CLK_DIV;
00154 
00155   /* Msp SD Detect pin initialization */
00156   BSP_SD_Detect_MspInit(&uSdHandle, NULL);
00157   if(BSP_SD_IsDetected() != SD_PRESENT)   /* Check if SD card is present */
00158   {
00159     return MSD_ERROR_SD_NOT_PRESENT;
00160   }
00161 
00162   /* Msp SD initialization */
00163   BSP_SD_MspInit(&uSdHandle, NULL);
00164 
00165   /* HAL SD initialization */
00166   if(HAL_SD_Init(&uSdHandle) != HAL_OK)
00167   {
00168     sd_state = MSD_ERROR;
00169   }
00170 
00171   /* Configure SD Bus width */
00172   if(sd_state == MSD_OK)
00173   {
00174     /* Enable wide operation */
00175     if(HAL_SD_ConfigWideBusOperation(&uSdHandle, SDIO_BUS_WIDE_4B) != HAL_OK)
00176     {
00177       sd_state = MSD_ERROR;
00178     }
00179     else
00180     {
00181       sd_state = MSD_OK;
00182     }
00183   }
00184   return  sd_state;
00185 }
00186 
00187 /**
00188   * @brief  DeInitializes the SD card device.
00189   * @retval SD status
00190   */
00191 uint8_t BSP_SD_DeInit(void)
00192 {
00193   uint8_t sd_state = MSD_OK;
00194 
00195   uSdHandle.Instance = SDIO;
00196 
00197   /* HAL SD deinitialization */
00198   if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
00199   {
00200     sd_state = MSD_ERROR;
00201   }
00202 
00203   /* Msp SD deinitialization */
00204   uSdHandle.Instance = SDIO;
00205   BSP_SD_MspDeInit(&uSdHandle, NULL);
00206 
00207   return  sd_state;
00208 }
00209 
00210 /**
00211   * @brief  Configures Interrupt mode for SD detection pin.
00212   * @retval Returns 0
00213   */
00214 uint8_t BSP_SD_ITConfig(void)
00215 {
00216   GPIO_InitTypeDef gpio_init_structure;
00217 
00218   /* Configure Interrupt mode for SD detection pin */
00219   gpio_init_structure.Pin = SD_DETECT_PIN;
00220   gpio_init_structure.Pull = GPIO_PULLUP;
00221   gpio_init_structure.Speed = GPIO_SPEED_FAST;
00222   gpio_init_structure.Mode = GPIO_MODE_IT_RISING_FALLING;
00223   HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
00224 
00225   /* Enable and set SD detect EXTI Interrupt to the lowest priority */
00226   HAL_NVIC_SetPriority((IRQn_Type)(SD_DETECT_EXTI_IRQn), 0x0F, 0x00);
00227   HAL_NVIC_EnableIRQ((IRQn_Type)(SD_DETECT_EXTI_IRQn));
00228 
00229   return MSD_OK;
00230 }
00231 
00232 /**
00233  * @brief  Detects if SD card is correctly plugged in the memory slot or not.
00234  * @retval Returns if SD is detected or not
00235  */
00236 uint8_t BSP_SD_IsDetected(void)
00237 {
00238   __IO uint8_t  status = SD_PRESENT;
00239 
00240   /* Check SD card detect pin */
00241   if (HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) == GPIO_PIN_SET)
00242   {
00243     status = SD_NOT_PRESENT;
00244   }
00245 
00246     return status;
00247 }
00248 
00249 /**
00250   * @brief  Reads block(s) from a specified address in an SD card, in polling mode.
00251   * @param  pData: Pointer to the buffer that will contain the data to transmit
00252   * @param  ReadAddr: Address from where data is to be read
00253   * @param  NumOfBlocks: Number of SD blocks to read
00254   * @param  Timeout: Timeout for read operation
00255   * @retval SD status
00256   */
00257 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
00258 {
00259   if(HAL_SD_ReadBlocks(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) != HAL_OK)
00260   {
00261     return MSD_ERROR;
00262   }
00263   else
00264   {
00265     return MSD_OK;
00266   }
00267 }
00268 
00269 /**
00270   * @brief  Writes block(s) to a specified address in an SD card, in polling mode. 
00271   * @param  pData: Pointer to the buffer that will contain the data to transmit
00272   * @param  WriteAddr: Address from where data is to be written
00273   * @param  NumOfBlocks: Number of SD blocks to write
00274   * @param  Timeout: Timeout for write operation
00275   * @retval SD status
00276   */
00277 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
00278 {
00279   if(HAL_SD_WriteBlocks(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks, Timeout) != HAL_OK)
00280   {
00281     return MSD_ERROR;
00282   }
00283   else
00284   {
00285     return MSD_OK;
00286   }
00287 }
00288 
00289 /**
00290   * @brief  Reads block(s) from a specified address in an SD card, in DMA mode.
00291   * @param  pData: Pointer to the buffer that will contain the data to transmit
00292   * @param  ReadAddr: Address from where data is to be read
00293   * @param  NumOfBlocks: Number of SD blocks to read 
00294   * @retval SD status
00295   */
00296 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
00297 {  
00298   /* Read block(s) in DMA transfer mode */
00299   if(HAL_SD_ReadBlocks_DMA(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks) != HAL_OK)
00300   {
00301     return MSD_ERROR;
00302   }
00303   else
00304   {
00305     return MSD_OK;
00306   }
00307 }
00308 
00309 /**
00310   * @brief  Writes block(s) to a specified address in an SD card, in DMA mode.
00311   * @param  pData: Pointer to the buffer that will contain the data to transmit
00312   * @param  WriteAddr: Address from where data is to be written
00313   * @param  NumOfBlocks: Number of SD blocks to write 
00314   * @retval SD status
00315   */
00316 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
00317 { 
00318   /* Write block(s) in DMA transfer mode */
00319   if(HAL_SD_WriteBlocks_DMA(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks) != HAL_OK)
00320   {
00321     return MSD_ERROR;
00322   }
00323   else
00324   {
00325     return MSD_OK;
00326   }
00327 }
00328 
00329 /**
00330   * @brief  Erases the specified memory area of the given SD card. 
00331   * @param  StartAddr: Start byte address
00332   * @param  EndAddr: End byte address
00333   * @retval SD status
00334   */
00335 uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
00336 {
00337   if(HAL_SD_Erase(&uSdHandle, StartAddr, EndAddr) != HAL_OK)
00338   {
00339     return MSD_ERROR;
00340   }
00341   else
00342   {
00343     return MSD_OK;
00344   }
00345 }
00346 
00347 /**
00348   * @brief  Initializes the SD MSP.
00349   * @param  hsd: SD handle
00350   * @param  Params : pointer on additional configuration parameters, can be NULL.
00351   */
00352 __weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
00353 {
00354   static DMA_HandleTypeDef dma_rx_handle;
00355   static DMA_HandleTypeDef dma_tx_handle;
00356   GPIO_InitTypeDef gpio_init_structure;
00357 
00358   /* Enable SDIO clock */
00359   __HAL_RCC_SDIO_CLK_ENABLE();
00360 
00361   /* Enable DMA2 clocks */
00362   __DMAx_TxRx_CLK_ENABLE();
00363 
00364   /* Enable GPIOs clock */
00365   __HAL_RCC_GPIOC_CLK_ENABLE();
00366   __HAL_RCC_GPIOD_CLK_ENABLE();
00367 
00368   /* Common GPIO configuration */
00369   gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
00370   gpio_init_structure.Pull      = GPIO_PULLUP;
00371   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00372   gpio_init_structure.Alternate = GPIO_AF12_SDIO;
00373 
00374   /* GPIOC configuration */
00375   gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
00376 
00377   HAL_GPIO_Init(GPIOC, &gpio_init_structure);
00378 
00379   /* GPIOD configuration */
00380   gpio_init_structure.Pin = GPIO_PIN_2;
00381   HAL_GPIO_Init(GPIOD, &gpio_init_structure);
00382 
00383   /* NVIC configuration for SDIO interrupts */
00384   HAL_NVIC_SetPriority(SDIO_IRQn, 0x0E, 0);
00385   HAL_NVIC_EnableIRQ(SDIO_IRQn);
00386 
00387   /* Configure DMA Rx parameters */
00388   dma_rx_handle.Init.Channel             = SD_DMAx_Rx_CHANNEL;
00389   dma_rx_handle.Init.Direction           = DMA_PERIPH_TO_MEMORY;
00390   dma_rx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
00391   dma_rx_handle.Init.MemInc              = DMA_MINC_ENABLE;
00392   dma_rx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
00393   dma_rx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
00394   dma_rx_handle.Init.Mode                = DMA_PFCTRL;
00395   dma_rx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
00396   dma_rx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
00397   dma_rx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
00398   dma_rx_handle.Init.MemBurst            = DMA_MBURST_INC4;
00399   dma_rx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
00400 
00401   dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
00402 
00403   /* Associate the DMA handle */
00404   __HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
00405 
00406   /* Deinitialize the stream for new transfer */
00407   HAL_DMA_DeInit(&dma_rx_handle);
00408 
00409   /* Configure the DMA stream */
00410   HAL_DMA_Init(&dma_rx_handle);
00411 
00412   /* Configure DMA Tx parameters */
00413   dma_tx_handle.Init.Channel             = SD_DMAx_Tx_CHANNEL;
00414   dma_tx_handle.Init.Direction           = DMA_MEMORY_TO_PERIPH;
00415   dma_tx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
00416   dma_tx_handle.Init.MemInc              = DMA_MINC_ENABLE;
00417   dma_tx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
00418   dma_tx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
00419   dma_tx_handle.Init.Mode                = DMA_PFCTRL;
00420   dma_tx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
00421   dma_tx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
00422   dma_tx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
00423   dma_tx_handle.Init.MemBurst            = DMA_MBURST_INC4;
00424   dma_tx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
00425 
00426   dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
00427 
00428   /* Associate the DMA handle */
00429   __HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
00430 
00431   /* Deinitialize the stream for new transfer */
00432   HAL_DMA_DeInit(&dma_tx_handle);
00433 
00434   /* Configure the DMA stream */
00435   HAL_DMA_Init(&dma_tx_handle);
00436 
00437   /* NVIC configuration for DMA transfer complete interrupt */
00438   HAL_NVIC_SetPriority(SD_DMAx_Rx_IRQn, 0x0F, 0);
00439   HAL_NVIC_EnableIRQ(SD_DMAx_Rx_IRQn);
00440 
00441   /* NVIC configuration for DMA transfer complete interrupt */
00442   HAL_NVIC_SetPriority(SD_DMAx_Tx_IRQn, 0x0F, 0);
00443   HAL_NVIC_EnableIRQ(SD_DMAx_Tx_IRQn);
00444 }
00445 
00446 /**
00447   * @brief  Initializes the SD Detect pin MSP.
00448   * @param  hsd: SD handle
00449   * @param  Params : pointer on additional configuration parameters, can be NULL.
00450   */
00451 __weak void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params)
00452 {
00453   GPIO_InitTypeDef  gpio_init_structure;
00454 
00455   SD_DETECT_GPIO_CLK_ENABLE();
00456 
00457   /* GPIO configuration in input for uSD_Detect signal */
00458   gpio_init_structure.Pin       = SD_DETECT_PIN;
00459   gpio_init_structure.Mode      = GPIO_MODE_INPUT;
00460   gpio_init_structure.Pull      = GPIO_PULLUP;
00461   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00462   HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
00463 }
00464 
00465 /**
00466   * @brief  DeInitializes the SD MSP.
00467   * @param  hsd: SD handle
00468   * @param  Params : pointer on additional configuration parameters, can be NULL.
00469   */
00470 __weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
00471 {
00472     static DMA_HandleTypeDef dma_rx_handle;
00473     static DMA_HandleTypeDef dma_tx_handle;
00474 
00475     /* Disable NVIC for DMA transfer complete interrupts */
00476     HAL_NVIC_DisableIRQ(SD_DMAx_Rx_IRQn);
00477     HAL_NVIC_DisableIRQ(SD_DMAx_Tx_IRQn);
00478 
00479     /* Deinitialize the stream for new transfer */
00480     dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
00481     HAL_DMA_DeInit(&dma_rx_handle);
00482 
00483     /* Deinitialize the stream for new transfer */
00484     dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
00485     HAL_DMA_DeInit(&dma_tx_handle);
00486 
00487     /* Disable NVIC for SDIO interrupts */
00488     HAL_NVIC_DisableIRQ(SDIO_IRQn);
00489 
00490     /* DeInit GPIO pins can be done in the application
00491        (by surcharging this __weak function) */
00492 
00493     /* Disable SDIO clock */
00494     __HAL_RCC_SDIO_CLK_DISABLE();
00495 
00496     /* GPOI pins clock and DMA cloks can be shut down in the applic
00497        by surcgarging this __weak function */
00498 }
00499 
00500 /**
00501   * @brief  Gets the current SD card data status.
00502   * @retval Data transfer state.
00503   *          This value can be one of the following values:
00504   *            @arg  SD_TRANSFER_OK: No data transfer is acting
00505   *            @arg  SD_TRANSFER_BUSY: Data transfer is acting
00506   */
00507 uint8_t BSP_SD_GetCardState(void)
00508 {
00509   return((HAL_SD_GetCardState(&uSdHandle) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY);
00510 }
00511   
00512 
00513 /**
00514   * @brief  Get SD information about specific SD card.
00515   * @param  CardInfo: Pointer to HAL_SD_CardInfoTypedef structure
00516   * @retval None 
00517   */
00518 void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
00519 {
00520   /* Get SD card Information */
00521   HAL_SD_GetCardInfo(&uSdHandle, CardInfo);
00522 }
00523 
00524 /**
00525   * @brief SD Abort callbacks
00526   * @param hsd: SD handle
00527   * @retval None
00528   */
00529 void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
00530 {
00531   BSP_SD_AbortCallback();
00532 }
00533 
00534 /**
00535   * @brief Tx Transfer completed callbacks
00536   * @param hsd: SD handle
00537   * @retval None
00538   */
00539 void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
00540 {
00541   BSP_SD_WriteCpltCallback();
00542 }
00543 
00544 /**
00545   * @brief Rx Transfer completed callbacks
00546   * @param hsd: SD handle
00547   * @retval None
00548   */
00549 void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
00550 {
00551   BSP_SD_ReadCpltCallback();
00552 }
00553 
00554 /**
00555   * @brief BSP SD Abort callbacks
00556   * @retval None
00557   */
00558 __weak void BSP_SD_AbortCallback(void)
00559 {
00560 
00561 }
00562 
00563 /**
00564   * @brief BSP Tx Transfer completed callbacks
00565   * @retval None
00566   */
00567 __weak void BSP_SD_WriteCpltCallback(void)
00568 {
00569 
00570 }
00571 
00572 /**
00573   * @brief BSP Rx Transfer completed callbacks
00574   * @retval None
00575   */
00576 __weak void BSP_SD_ReadCpltCallback(void)
00577 {
00578 
00579 }
00580 
00581 /**
00582   * @}
00583   */
00584 
00585 /**
00586   * @}
00587   */
00588 
00589 /**
00590   * @}
00591   */
00592 
00593 /**
00594   * @}
00595   */
00596 
00597 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/