Daniel Lee / BSP_DISCO_F413ZH

Dependents:   DISCO_F413ZH-AUDIO-demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32f413h_discovery_sd.c Source File

stm32f413h_discovery_sd.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f413h_discovery_sd.c
00004   * @author  MCD Application Team
00005   * @brief   This file includes the uSD card driver mounted on STM32F413H-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 STM32F413H-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 "stm32f413h_discovery_sd.h"
00080 
00081 /** @addtogroup BSP
00082   * @{
00083   */
00084 
00085 /** @addtogroup STM32F413H_DISCOVERY
00086   * @{
00087   */ 
00088   
00089 /** @defgroup STM32F413H_DISCOVERY_SD STM32F413H_DISCOVERY SD
00090   * @{
00091   */ 
00092 
00093 /** @defgroup STM32F413H_DISCOVERY_SD_Private_Variables STM32F413H DISCOVERY SD Private Variables
00094   * @{
00095   */
00096 SD_HandleTypeDef uSdHandle;
00097 
00098 /**
00099   * @}
00100   */ 
00101   
00102 /** @defgroup STM32F413H_DISCOVERY_SD_Private_Functions STM32F413H DISCOVERY SD Private Functions
00103   * @{
00104   */
00105 
00106 /**
00107   * @brief  Initializes the SD card device.
00108   * @retval SD status
00109   */
00110 uint8_t BSP_SD_Init(void)
00111 { 
00112   uint8_t sd_state = MSD_OK;
00113   
00114   /* uSD device interface configuration */
00115   uSdHandle.Instance = SDIO;
00116 
00117   uSdHandle.Init.ClockEdge           = SDIO_CLOCK_EDGE_RISING;
00118   uSdHandle.Init.ClockBypass         = SDIO_CLOCK_BYPASS_DISABLE;
00119   uSdHandle.Init.ClockPowerSave      = SDIO_CLOCK_POWER_SAVE_DISABLE;
00120   uSdHandle.Init.BusWide             = SDIO_BUS_WIDE_1B;
00121   uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE;
00122   uSdHandle.Init.ClockDiv            = SDIO_TRANSFER_CLK_DIV;
00123   
00124   /* Msp SD Detect pin initialization */
00125   BSP_SD_Detect_MspInit(&uSdHandle, NULL);
00126   
00127   /* Check if SD card is present */
00128   if(BSP_SD_IsDetected() != SD_PRESENT)
00129   {
00130     return MSD_ERROR_SD_NOT_PRESENT;
00131   }
00132   
00133   /* Msp SD initialization */
00134   BSP_SD_MspInit(&uSdHandle, NULL);
00135 
00136   /* HAL SD initialization */
00137   if(HAL_SD_Init(&uSdHandle) != HAL_OK)
00138   {
00139     sd_state = MSD_ERROR;
00140   }
00141   
00142   /* Configure SD Bus width */
00143   if(sd_state == MSD_OK)
00144   {
00145     /* Enable wide operation */
00146     if(HAL_SD_ConfigWideBusOperation(&uSdHandle, SDIO_BUS_WIDE_4B) != HAL_OK)
00147     {
00148       sd_state = MSD_ERROR;
00149     }
00150     else
00151     {
00152       sd_state = MSD_OK;
00153     }
00154   }
00155   
00156   return  sd_state;
00157 }
00158 
00159 /**
00160   * @brief  DeInitializes the SD card device.
00161   * @retval SD status
00162   */
00163 uint8_t BSP_SD_DeInit(void)
00164 { 
00165   uint8_t sd_state = MSD_OK;
00166  
00167   uSdHandle.Instance = SDIO;
00168   
00169   /* HAL SD deinitialization */
00170   if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
00171   {
00172     sd_state = MSD_ERROR;
00173   }
00174 
00175   /* Msp SD deinitialization */
00176   uSdHandle.Instance = SDIO;
00177   BSP_SD_MspDeInit(&uSdHandle, NULL);
00178   
00179   return  sd_state;
00180 }
00181 
00182 /**
00183   * @brief  Configures Interrupt mode for SD detection pin.
00184   * @retval Returns MSD_OK
00185   */
00186 uint8_t BSP_SD_ITConfig(void)
00187 {  
00188   GPIO_InitTypeDef gpio_init_structure;
00189 
00190   /* Configure Interrupt mode for SD detection pin */  
00191   gpio_init_structure.Pin = SD_DETECT_PIN;
00192   gpio_init_structure.Pull = GPIO_PULLUP;
00193   gpio_init_structure.Speed = GPIO_SPEED_FAST;
00194   gpio_init_structure.Mode = GPIO_MODE_IT_RISING_FALLING;
00195   HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
00196 
00197   /* Enable and set SD detect EXTI Interrupt to the lowest priority */
00198   HAL_NVIC_SetPriority((IRQn_Type)(SD_DETECT_EXTI_IRQn), 0x0F, 0x00);
00199   HAL_NVIC_EnableIRQ((IRQn_Type)(SD_DETECT_EXTI_IRQn));
00200 
00201   return MSD_OK;
00202 }
00203 
00204 /**
00205  * @brief  Detects if SD card is correctly plugged in the memory slot or not.
00206  * @retval Returns if SD is detected or not
00207  */
00208 uint8_t BSP_SD_IsDetected(void)
00209 {
00210   __IO uint8_t status = SD_PRESENT;
00211   
00212   /* Check SD card detect pin */
00213   if (HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) == GPIO_PIN_SET)
00214   {
00215     status = SD_NOT_PRESENT;
00216   }
00217 
00218   return status;
00219 }
00220 
00221 /**
00222   * @brief  Reads block(s) from a specified address in an SD card, in polling mode.
00223   * @param  pData: Pointer to the buffer that will contain the data to transmit
00224   * @param  ReadAddr: Address from where data is to be read
00225   * @param  NumOfBlocks: Number of SD blocks to read
00226   * @param  Timeout: Timeout for read operation
00227   * @retval SD status
00228   */
00229 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
00230 {
00231   if(HAL_SD_ReadBlocks(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) != HAL_OK)
00232   {
00233     return MSD_ERROR;
00234   }
00235   else
00236   {
00237     return MSD_OK;
00238   }
00239 }
00240 
00241 /**
00242   * @brief  Writes block(s) to a specified address in an SD card, in polling mode. 
00243   * @param  pData: Pointer to the buffer that will contain the data to transmit
00244   * @param  WriteAddr: Address from where data is to be written
00245   * @param  NumOfBlocks: Number of SD blocks to write
00246   * @param  Timeout: Timeout for write operation
00247   * @retval SD status
00248   */
00249 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
00250 {
00251   if(HAL_SD_WriteBlocks(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks, Timeout) != HAL_OK)
00252   {
00253     return MSD_ERROR;
00254   }
00255   else
00256   {
00257     return MSD_OK;
00258   }
00259 }
00260 
00261 /**
00262   * @brief  Reads block(s) from a specified address in an SD card, in DMA mode.
00263   * @param  pData: Pointer to the buffer that will contain the data to transmit
00264   * @param  ReadAddr: Address from where data is to be read
00265   * @param  NumOfBlocks: Number of SD blocks to read 
00266   * @retval SD status
00267   */
00268 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
00269 {  
00270   /* Read block(s) in DMA transfer mode */
00271   if(HAL_SD_ReadBlocks_DMA(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks) != HAL_OK)
00272   {
00273     return MSD_ERROR;
00274   }
00275   else
00276   {
00277     return MSD_OK;
00278   }
00279 }
00280 
00281 /**
00282   * @brief  Writes block(s) to a specified address in an SD card, in DMA mode.
00283   * @param  pData: Pointer to the buffer that will contain the data to transmit
00284   * @param  WriteAddr: Address from where data is to be written
00285   * @param  NumOfBlocks: Number of SD blocks to write 
00286   * @retval SD status
00287   */
00288 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
00289 { 
00290   /* Write block(s) in DMA transfer mode */
00291   if(HAL_SD_WriteBlocks_DMA(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks) != HAL_OK)
00292   {
00293     return MSD_ERROR;
00294   }
00295   else
00296   {
00297     return MSD_OK;
00298   }
00299 }
00300 
00301 /**
00302   * @brief  Erases the specified memory area of the given SD card. 
00303   * @param  StartAddr: Start byte address
00304   * @param  EndAddr: End byte address
00305   * @retval SD status
00306   */
00307 uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
00308 {
00309   if(HAL_SD_Erase(&uSdHandle, StartAddr, EndAddr) != HAL_OK)
00310   {
00311     return MSD_ERROR;
00312   }
00313   else
00314   {
00315     return MSD_OK;
00316   }
00317 }
00318 
00319 /**
00320   * @brief  Initializes the SD MSP.
00321   * @param  hsd: SD handle
00322   * @param  Params : pointer on additional configuration parameters, can be NULL.
00323   */
00324 __weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
00325 {
00326   static DMA_HandleTypeDef dma_rx_handle;
00327   static DMA_HandleTypeDef dma_tx_handle;
00328   GPIO_InitTypeDef gpio_init_structure;
00329 
00330   /* Prevent unused argument(s) compilation warning */
00331   UNUSED(Params);
00332 
00333   /* Enable SDIO clock */
00334   __HAL_RCC_SDIO_CLK_ENABLE();
00335   
00336   /* Enable DMA2 clocks */
00337   __DMAx_TxRx_CLK_ENABLE();
00338 
00339   /* Enable GPIOs clock */
00340   __HAL_RCC_GPIOC_CLK_ENABLE();
00341   __HAL_RCC_GPIOA_CLK_ENABLE();
00342   
00343   /* Common GPIO configuration */
00344   gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
00345   gpio_init_structure.Pull      = GPIO_PULLUP;
00346   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00347   gpio_init_structure.Alternate = GPIO_AF12_SDIO;
00348   
00349   /* GPIOC configuration: SD_D[0..3] and SD_clk */
00350   gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
00351    
00352   HAL_GPIO_Init(GPIOC, &gpio_init_structure);
00353 
00354   /* GPIOA configuration: SD cmd */
00355   gpio_init_structure.Pin = GPIO_PIN_6;
00356   HAL_GPIO_Init(GPIOA, &gpio_init_structure);
00357 
00358   /* NVIC configuration for SDIO interrupts */
00359   HAL_NVIC_SetPriority(SDIO_IRQn, 0x0E, 0x00);
00360   HAL_NVIC_EnableIRQ(SDIO_IRQn);
00361     
00362   /* Configure DMA Rx parameters */
00363   dma_rx_handle.Init.Channel             = SD_DMAx_Rx_CHANNEL;
00364   dma_rx_handle.Init.Direction           = DMA_PERIPH_TO_MEMORY;
00365   dma_rx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
00366   dma_rx_handle.Init.MemInc              = DMA_MINC_ENABLE;
00367   dma_rx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
00368   dma_rx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
00369   dma_rx_handle.Init.Mode                = DMA_PFCTRL;
00370   dma_rx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
00371   dma_rx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
00372   dma_rx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
00373   dma_rx_handle.Init.MemBurst            = DMA_MBURST_INC4;
00374   dma_rx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
00375   
00376   dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
00377   
00378   /* Associate the DMA handle */
00379   __HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
00380   
00381   /* Deinitialize the stream for new transfer */
00382   HAL_DMA_DeInit(&dma_rx_handle);
00383   
00384   /* Configure the DMA stream */
00385   HAL_DMA_Init(&dma_rx_handle);
00386   
00387   /* Configure DMA Tx parameters */
00388   dma_tx_handle.Init.Channel             = SD_DMAx_Tx_CHANNEL;
00389   dma_tx_handle.Init.Direction           = DMA_MEMORY_TO_PERIPH;
00390   dma_tx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
00391   dma_tx_handle.Init.MemInc              = DMA_MINC_ENABLE;
00392   dma_tx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
00393   dma_tx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
00394   dma_tx_handle.Init.Mode                = DMA_PFCTRL;
00395   dma_tx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
00396   dma_tx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
00397   dma_tx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
00398   dma_tx_handle.Init.MemBurst            = DMA_MBURST_INC4;
00399   dma_tx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
00400   
00401   dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
00402   
00403   /* Associate the DMA handle */
00404   __HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
00405   
00406   /* Deinitialize the stream for new transfer */
00407   HAL_DMA_DeInit(&dma_tx_handle);
00408   
00409   /* Configure the DMA stream */
00410   HAL_DMA_Init(&dma_tx_handle); 
00411   
00412   /* NVIC configuration for DMA transfer complete interrupt */
00413   HAL_NVIC_SetPriority(SD_DMAx_Rx_IRQn, 0x0F, 0x00);
00414   HAL_NVIC_EnableIRQ(SD_DMAx_Rx_IRQn);
00415   
00416   /* NVIC configuration for DMA transfer complete interrupt */
00417   HAL_NVIC_SetPriority(SD_DMAx_Tx_IRQn, 0x0F, 0x00);
00418   HAL_NVIC_EnableIRQ(SD_DMAx_Tx_IRQn);
00419 }
00420 
00421 /**
00422   * @brief  Initializes the SD Detect pin MSP.
00423   * @param  hsd: SD handle
00424   * @param  Params : pointer on additional configuration parameters, can be NULL.
00425   */
00426 __weak void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params)
00427 {
00428   GPIO_InitTypeDef  gpio_init_structure;
00429 
00430   /* Prevent unused argument(s) compilation warning */
00431   UNUSED(Params);
00432   
00433   SD_DETECT_GPIO_CLK_ENABLE();
00434 
00435   /* GPIO configuration in input for uSD_Detect signal */
00436   gpio_init_structure.Pin       = SD_DETECT_PIN;
00437   gpio_init_structure.Mode      = GPIO_MODE_INPUT;
00438   gpio_init_structure.Pull      = GPIO_PULLUP;
00439   gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
00440   HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
00441 }
00442 
00443 /**
00444   * @brief  DeInitializes the SD MSP.
00445   * @param  hsd: SD handle
00446   * @param  Params : pointer on additional configuration parameters, can be NULL.
00447   */
00448 __weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
00449 {
00450   static DMA_HandleTypeDef dma_rx_handle;
00451   static DMA_HandleTypeDef dma_tx_handle;
00452   
00453   /* Prevent unused argument(s) compilation warning */
00454   UNUSED(Params);
00455   
00456   /* Disable NVIC for DMA transfer complete interrupts */
00457   HAL_NVIC_DisableIRQ(SD_DMAx_Rx_IRQn);
00458   HAL_NVIC_DisableIRQ(SD_DMAx_Tx_IRQn);
00459   
00460   /* Deinitialize the stream for new transfer */
00461   dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
00462   HAL_DMA_DeInit(&dma_rx_handle);
00463   
00464   /* Deinitialize the stream for new transfer */
00465   dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
00466   HAL_DMA_DeInit(&dma_tx_handle);
00467   
00468   /* Disable NVIC for SDIO interrupts */
00469   HAL_NVIC_DisableIRQ(SDIO_IRQn);
00470   
00471   /* DeInit GPIO pins can be done in the application 
00472   (by surcharging this __weak function) */
00473   
00474   /* Disable SDIO clock */
00475   __HAL_RCC_SDIO_CLK_DISABLE();
00476   
00477   /* GPIO pins clock and DMA clocks can be shut down in the application 
00478   by surcharging this __weak function */ 
00479 }
00480 
00481 /**
00482   * @brief  Gets the current SD card data status.
00483   * @retval Data transfer state.
00484   *          This value can be one of the following values:
00485   *            @arg  SD_TRANSFER_OK: No data transfer is acting
00486   *            @arg  SD_TRANSFER_BUSY: Data transfer is acting
00487   */
00488 uint8_t BSP_SD_GetCardState(void)
00489 {
00490   return((HAL_SD_GetCardState(&uSdHandle) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY);
00491 }
00492   
00493 
00494 /**
00495   * @brief  Get SD information about specific SD card.
00496   * @param  CardInfo: Pointer to HAL_SD_CardInfoTypedef structure
00497   */
00498 void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
00499 {
00500   /* Get SD card Information */
00501   HAL_SD_GetCardInfo(&uSdHandle, CardInfo);
00502 }
00503 
00504 /**
00505   * @brief SD Abort callbacks
00506   * @param hsd: SD handle
00507   */
00508 void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
00509 {
00510   BSP_SD_AbortCallback();
00511 }
00512 
00513 /**
00514   * @brief Tx Transfer completed callbacks
00515   * @param hsd: SD handle
00516   */
00517 void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
00518 {
00519   BSP_SD_WriteCpltCallback();
00520 }
00521 
00522 /**
00523   * @brief Rx Transfer completed callbacks
00524   * @param hsd: SD handle
00525   */
00526 void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
00527 {
00528   BSP_SD_ReadCpltCallback();
00529 }
00530 
00531 /**
00532   * @brief BSP SD Abort callbacks
00533   */
00534 __weak void BSP_SD_AbortCallback(void)
00535 {
00536 
00537 }
00538 
00539 /**
00540   * @brief BSP Tx Transfer completed callbacks
00541   */
00542 __weak void BSP_SD_WriteCpltCallback(void)
00543 {
00544 
00545 }
00546 
00547 /**
00548   * @brief BSP Rx Transfer completed callbacks
00549   */
00550 __weak void BSP_SD_ReadCpltCallback(void)
00551 {
00552 
00553 }
00554 
00555 /**
00556   * @}
00557   */ 
00558 
00559 /**
00560   * @}
00561   */ 
00562 
00563 /**
00564   * @}
00565   */ 
00566 
00567 /**
00568   * @}
00569   */
00570  
00571 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/