Patched for Audio example - Add status check when DFSDM's filter and channel de-init.
Dependents: DISCO_F413ZH-AUDIO-demo
The base repository is https://os.mbed.com/teams/ST/code/BSP_DISCO_F413ZH/. I've just added workaround patch for Audio-in demo on DISCO_F413ZH board(Microphone U16, U17)
Drivers/BSP/STM32F413H-Discovery/stm32f413h_discovery_sd.h@4:c051317d4051, 2020-01-31 (annotated)
- Committer:
- Daniel_Lee
- Date:
- Fri Jan 31 07:17:05 2020 +0000
- Revision:
- 4:c051317d4051
- Parent:
- 3:42b354f5069c
Patched for Audio example;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
arostm | 0:4af3ca173992 | 1 | /** |
arostm | 0:4af3ca173992 | 2 | ****************************************************************************** |
arostm | 0:4af3ca173992 | 3 | * @file stm32f413h_discovery_sd.h |
arostm | 0:4af3ca173992 | 4 | * @author MCD Application Team |
arostm | 0:4af3ca173992 | 5 | * @brief This file contains the common defines and functions prototypes for |
arostm | 0:4af3ca173992 | 6 | * the stm32413h_discovery_sd.c driver. |
arostm | 0:4af3ca173992 | 7 | ****************************************************************************** |
arostm | 0:4af3ca173992 | 8 | * @attention |
arostm | 0:4af3ca173992 | 9 | * |
arostm | 0:4af3ca173992 | 10 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
arostm | 0:4af3ca173992 | 11 | * |
arostm | 0:4af3ca173992 | 12 | * Redistribution and use in source and binary forms, with or without modification, |
arostm | 0:4af3ca173992 | 13 | * are permitted provided that the following conditions are met: |
arostm | 0:4af3ca173992 | 14 | * 1. Redistributions of source code must retain the above copyright notice, |
arostm | 0:4af3ca173992 | 15 | * this list of conditions and the following disclaimer. |
arostm | 0:4af3ca173992 | 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
arostm | 0:4af3ca173992 | 17 | * this list of conditions and the following disclaimer in the documentation |
arostm | 0:4af3ca173992 | 18 | * and/or other materials provided with the distribution. |
arostm | 0:4af3ca173992 | 19 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
arostm | 0:4af3ca173992 | 20 | * may be used to endorse or promote products derived from this software |
arostm | 0:4af3ca173992 | 21 | * without specific prior written permission. |
arostm | 0:4af3ca173992 | 22 | * |
arostm | 0:4af3ca173992 | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
arostm | 0:4af3ca173992 | 24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
arostm | 0:4af3ca173992 | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
arostm | 0:4af3ca173992 | 26 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
arostm | 0:4af3ca173992 | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
arostm | 0:4af3ca173992 | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
arostm | 0:4af3ca173992 | 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
arostm | 0:4af3ca173992 | 30 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
arostm | 0:4af3ca173992 | 31 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
arostm | 0:4af3ca173992 | 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
arostm | 0:4af3ca173992 | 33 | * |
arostm | 0:4af3ca173992 | 34 | ****************************************************************************** |
arostm | 0:4af3ca173992 | 35 | */ |
arostm | 0:4af3ca173992 | 36 | |
arostm | 0:4af3ca173992 | 37 | /* Define to prevent recursive inclusion -------------------------------------*/ |
arostm | 0:4af3ca173992 | 38 | #ifndef __STM32F413H_DISCOVERY_SD_H |
arostm | 0:4af3ca173992 | 39 | #define __STM32F413H_DISCOVERY_SD_H |
arostm | 0:4af3ca173992 | 40 | |
arostm | 0:4af3ca173992 | 41 | #ifdef __cplusplus |
arostm | 0:4af3ca173992 | 42 | extern "C" { |
arostm | 0:4af3ca173992 | 43 | #endif |
arostm | 0:4af3ca173992 | 44 | |
arostm | 0:4af3ca173992 | 45 | /* Includes ------------------------------------------------------------------*/ |
arostm | 0:4af3ca173992 | 46 | #include "stm32f413h_discovery.h" |
arostm | 0:4af3ca173992 | 47 | |
arostm | 0:4af3ca173992 | 48 | /** @addtogroup BSP |
arostm | 0:4af3ca173992 | 49 | * @{ |
arostm | 0:4af3ca173992 | 50 | */ |
arostm | 0:4af3ca173992 | 51 | |
arostm | 0:4af3ca173992 | 52 | /** @addtogroup STM32F413H_DISCOVERY |
arostm | 0:4af3ca173992 | 53 | * @{ |
arostm | 0:4af3ca173992 | 54 | */ |
arostm | 0:4af3ca173992 | 55 | |
arostm | 0:4af3ca173992 | 56 | /** @addtogroup STM32F413H_DISCOVERY_SD |
arostm | 0:4af3ca173992 | 57 | * @{ |
arostm | 0:4af3ca173992 | 58 | */ |
arostm | 0:4af3ca173992 | 59 | |
arostm | 0:4af3ca173992 | 60 | /** @addtogroup STM32F413H_DISCOVERY_SD_Private_Variables |
arostm | 0:4af3ca173992 | 61 | * @{ |
arostm | 0:4af3ca173992 | 62 | */ |
arostm | 0:4af3ca173992 | 63 | |
arostm | 0:4af3ca173992 | 64 | /** |
arostm | 0:4af3ca173992 | 65 | * @brief SD Card information structure |
arostm | 0:4af3ca173992 | 66 | */ |
arostm | 0:4af3ca173992 | 67 | #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef |
arostm | 0:4af3ca173992 | 68 | /** |
arostm | 0:4af3ca173992 | 69 | * @} |
arostm | 0:4af3ca173992 | 70 | */ |
arostm | 0:4af3ca173992 | 71 | |
arostm | 0:4af3ca173992 | 72 | /** @defgroup STM32F413H_DISCOVERY_SD_Exported_Constants STM32F413H DISCOVERY SD Exported Constants |
arostm | 0:4af3ca173992 | 73 | * @{ |
arostm | 0:4af3ca173992 | 74 | */ |
arostm | 0:4af3ca173992 | 75 | |
arostm | 0:4af3ca173992 | 76 | /** |
arostm | 0:4af3ca173992 | 77 | * @brief SD status structure definition |
arostm | 0:4af3ca173992 | 78 | */ |
arostm | 0:4af3ca173992 | 79 | #define MSD_OK ((uint8_t)0x00) |
arostm | 0:4af3ca173992 | 80 | #define MSD_ERROR ((uint8_t)0x01) |
arostm | 0:4af3ca173992 | 81 | #define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02) |
arostm | 0:4af3ca173992 | 82 | |
arostm | 0:4af3ca173992 | 83 | /** |
arostm | 0:4af3ca173992 | 84 | * @brief SD transfer state definition |
arostm | 0:4af3ca173992 | 85 | */ |
arostm | 0:4af3ca173992 | 86 | #define SD_TRANSFER_OK ((uint8_t)0x00) |
arostm | 0:4af3ca173992 | 87 | #define SD_TRANSFER_BUSY ((uint8_t)0x01) |
arostm | 0:4af3ca173992 | 88 | #define SD_PRESENT ((uint8_t)0x01) |
arostm | 0:4af3ca173992 | 89 | #define SD_NOT_PRESENT ((uint8_t)0x00) |
arostm | 0:4af3ca173992 | 90 | |
arostm | 0:4af3ca173992 | 91 | #define SD_DATATIMEOUT ((uint32_t)100000000) |
arostm | 0:4af3ca173992 | 92 | |
arostm | 0:4af3ca173992 | 93 | /* DMA definitions for SD DMA transfer */ |
arostm | 0:4af3ca173992 | 94 | #define __DMAx_TxRx_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE |
arostm | 0:4af3ca173992 | 95 | #define SD_DMAx_Tx_CHANNEL DMA_CHANNEL_4 |
arostm | 0:4af3ca173992 | 96 | #define SD_DMAx_Rx_CHANNEL DMA_CHANNEL_4 |
arostm | 0:4af3ca173992 | 97 | #define SD_DMAx_Tx_STREAM DMA2_Stream6 |
arostm | 0:4af3ca173992 | 98 | #define SD_DMAx_Rx_STREAM DMA2_Stream3 |
arostm | 0:4af3ca173992 | 99 | #define SD_DMAx_Tx_IRQn DMA2_Stream6_IRQn |
arostm | 0:4af3ca173992 | 100 | #define SD_DMAx_Rx_IRQn DMA2_Stream3_IRQn |
arostm | 0:4af3ca173992 | 101 | #define BSP_SD_IRQHandler SDIO_IRQHandler |
arostm | 0:4af3ca173992 | 102 | #define BSP_SD_DMA_Tx_IRQHandler DMA2_Stream6_IRQHandler |
arostm | 0:4af3ca173992 | 103 | #define BSP_SD_DMA_Rx_IRQHandler DMA2_Stream3_IRQHandler |
arostm | 0:4af3ca173992 | 104 | #define SD_DetectIRQHandler() HAL_GPIO_EXTI_IRQHandler(SD_DETECT_PIN) |
arostm | 0:4af3ca173992 | 105 | /** |
arostm | 0:4af3ca173992 | 106 | * @} |
arostm | 0:4af3ca173992 | 107 | */ |
arostm | 0:4af3ca173992 | 108 | |
arostm | 0:4af3ca173992 | 109 | /** @defgroup STM32F413H_DISCOVERY_SD_Exported_Functions STM32F413H DISCOVERY SD Exported Functions |
arostm | 0:4af3ca173992 | 110 | * @{ |
arostm | 0:4af3ca173992 | 111 | */ |
arostm | 0:4af3ca173992 | 112 | uint8_t BSP_SD_Init(void); |
arostm | 0:4af3ca173992 | 113 | uint8_t BSP_SD_DeInit(void); |
arostm | 0:4af3ca173992 | 114 | uint8_t BSP_SD_ITConfig(void); |
arostm | 0:4af3ca173992 | 115 | uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout); |
arostm | 0:4af3ca173992 | 116 | uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout); |
arostm | 0:4af3ca173992 | 117 | uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks); |
arostm | 0:4af3ca173992 | 118 | uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks); |
arostm | 0:4af3ca173992 | 119 | uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr); |
arostm | 0:4af3ca173992 | 120 | uint8_t BSP_SD_GetCardState(void); |
arostm | 0:4af3ca173992 | 121 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo); |
arostm | 0:4af3ca173992 | 122 | uint8_t BSP_SD_IsDetected(void); |
arostm | 0:4af3ca173992 | 123 | |
arostm | 0:4af3ca173992 | 124 | /* These functions can be modified in case the current settings (e.g. DMA stream) |
arostm | 0:4af3ca173992 | 125 | need to be changed for specific application needs */ |
arostm | 0:4af3ca173992 | 126 | void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params); |
arostm | 0:4af3ca173992 | 127 | void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params); |
arostm | 0:4af3ca173992 | 128 | void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params); |
arostm | 0:4af3ca173992 | 129 | void BSP_SD_AbortCallback(void); |
arostm | 0:4af3ca173992 | 130 | void BSP_SD_WriteCpltCallback(void); |
arostm | 0:4af3ca173992 | 131 | void BSP_SD_ReadCpltCallback(void); |
arostm | 0:4af3ca173992 | 132 | |
arostm | 0:4af3ca173992 | 133 | /** |
arostm | 0:4af3ca173992 | 134 | * @} |
arostm | 0:4af3ca173992 | 135 | */ |
arostm | 0:4af3ca173992 | 136 | |
arostm | 0:4af3ca173992 | 137 | /** |
arostm | 0:4af3ca173992 | 138 | * @} |
arostm | 0:4af3ca173992 | 139 | */ |
arostm | 0:4af3ca173992 | 140 | |
arostm | 0:4af3ca173992 | 141 | /** |
arostm | 0:4af3ca173992 | 142 | * @} |
arostm | 0:4af3ca173992 | 143 | */ |
arostm | 0:4af3ca173992 | 144 | |
arostm | 0:4af3ca173992 | 145 | /** |
arostm | 0:4af3ca173992 | 146 | * @} |
arostm | 0:4af3ca173992 | 147 | */ |
arostm | 0:4af3ca173992 | 148 | |
arostm | 0:4af3ca173992 | 149 | #ifdef __cplusplus |
arostm | 0:4af3ca173992 | 150 | } |
arostm | 0:4af3ca173992 | 151 | #endif |
arostm | 0:4af3ca173992 | 152 | |
arostm | 0:4af3ca173992 | 153 | #endif /* __STM32F413H_DISCOVERY_SD_H */ |
arostm | 0:4af3ca173992 | 154 | |
arostm | 0:4af3ca173992 | 155 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |