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)

Committer:
arostm
Date:
Wed May 17 10:23:19 2017 +0200
Revision:
0:4af3ca173992
Child:
3:42b354f5069c
creation of the DISCO_F413ZH BSP library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arostm 0:4af3ca173992 1 /**
arostm 0:4af3ca173992 2 ******************************************************************************
arostm 0:4af3ca173992 3 * @file stm32f413h_discovery_qspi.h
arostm 0:4af3ca173992 4 * @author MCD Application Team
arostm 0:4af3ca173992 5 * @version V1.0.0
arostm 0:4af3ca173992 6 * @date 27-January-2017
arostm 0:4af3ca173992 7 * @brief This file contains the common defines and functions prototypes for
arostm 0:4af3ca173992 8 * the stm32f413h_discovery_qspi.c driver.
arostm 0:4af3ca173992 9 ******************************************************************************
arostm 0:4af3ca173992 10 * @attention
arostm 0:4af3ca173992 11 *
arostm 0:4af3ca173992 12 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
arostm 0:4af3ca173992 13 *
arostm 0:4af3ca173992 14 * Redistribution and use in source and binary forms, with or without modification,
arostm 0:4af3ca173992 15 * are permitted provided that the following conditions are met:
arostm 0:4af3ca173992 16 * 1. Redistributions of source code must retain the above copyright notice,
arostm 0:4af3ca173992 17 * this list of conditions and the following disclaimer.
arostm 0:4af3ca173992 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
arostm 0:4af3ca173992 19 * this list of conditions and the following disclaimer in the documentation
arostm 0:4af3ca173992 20 * and/or other materials provided with the distribution.
arostm 0:4af3ca173992 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
arostm 0:4af3ca173992 22 * may be used to endorse or promote products derived from this software
arostm 0:4af3ca173992 23 * without specific prior written permission.
arostm 0:4af3ca173992 24 *
arostm 0:4af3ca173992 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
arostm 0:4af3ca173992 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
arostm 0:4af3ca173992 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
arostm 0:4af3ca173992 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
arostm 0:4af3ca173992 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
arostm 0:4af3ca173992 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
arostm 0:4af3ca173992 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
arostm 0:4af3ca173992 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
arostm 0:4af3ca173992 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
arostm 0:4af3ca173992 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
arostm 0:4af3ca173992 35 *
arostm 0:4af3ca173992 36 ******************************************************************************
arostm 0:4af3ca173992 37 */
arostm 0:4af3ca173992 38
arostm 0:4af3ca173992 39 /** @addtogroup BSP
arostm 0:4af3ca173992 40 * @{
arostm 0:4af3ca173992 41 */
arostm 0:4af3ca173992 42
arostm 0:4af3ca173992 43 /** @addtogroup STM32F413H_DISCOVERY
arostm 0:4af3ca173992 44 * @{
arostm 0:4af3ca173992 45 */
arostm 0:4af3ca173992 46
arostm 0:4af3ca173992 47 /* Define to prevent recursive inclusion -------------------------------------*/
arostm 0:4af3ca173992 48 #ifndef __STM32F413H_DISCOVERY_QSPI_H
arostm 0:4af3ca173992 49 #define __STM32F413H_DISCOVERY_QSPI_H
arostm 0:4af3ca173992 50
arostm 0:4af3ca173992 51 #ifdef __cplusplus
arostm 0:4af3ca173992 52 extern "C" {
arostm 0:4af3ca173992 53 #endif
arostm 0:4af3ca173992 54
arostm 0:4af3ca173992 55 /* Includes ------------------------------------------------------------------*/
arostm 0:4af3ca173992 56 #include "stm32f4xx_hal.h"
arostm 0:4af3ca173992 57 #include "../Components/n25q128a/n25q128a.h"
arostm 0:4af3ca173992 58
arostm 0:4af3ca173992 59 /** @addtogroup STM32F413H_DISCOVERY_QSPI
arostm 0:4af3ca173992 60 * @{
arostm 0:4af3ca173992 61 */
arostm 0:4af3ca173992 62
arostm 0:4af3ca173992 63
arostm 0:4af3ca173992 64 /* Exported constants --------------------------------------------------------*/
arostm 0:4af3ca173992 65 /** @defgroup STM32F413H_DISCOVERY_QSPI_Exported_Constants STM32F413H DISCOVERY Exported Constants
arostm 0:4af3ca173992 66 * @{
arostm 0:4af3ca173992 67 */
arostm 0:4af3ca173992 68 /* QSPI Error codes */
arostm 0:4af3ca173992 69 #define QSPI_OK ((uint8_t)0x00)
arostm 0:4af3ca173992 70 #define QSPI_ERROR ((uint8_t)0x01)
arostm 0:4af3ca173992 71 #define QSPI_BUSY ((uint8_t)0x02)
arostm 0:4af3ca173992 72 #define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
arostm 0:4af3ca173992 73 #define QSPI_SUSPENDED ((uint8_t)0x08)
arostm 0:4af3ca173992 74
arostm 0:4af3ca173992 75
arostm 0:4af3ca173992 76 /* Definition for QSPI clock resources */
arostm 0:4af3ca173992 77 #define QSPI_CLK_ENABLE() __HAL_RCC_QSPI_CLK_ENABLE()
arostm 0:4af3ca173992 78 #define QSPI_CLK_DISABLE() __HAL_RCC_QSPI_CLK_DISABLE()
arostm 0:4af3ca173992 79
arostm 0:4af3ca173992 80 #define QSPI_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
arostm 0:4af3ca173992 81 #define QSPI_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
arostm 0:4af3ca173992 82 #define QSPI_CLK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
arostm 0:4af3ca173992 83 #define QSPI_CLK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
arostm 0:4af3ca173992 84
arostm 0:4af3ca173992 85 #define QSPI_D0_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
arostm 0:4af3ca173992 86 #define QSPI_D1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
arostm 0:4af3ca173992 87 #define QSPI_D2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
arostm 0:4af3ca173992 88 #define QSPI_D3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
arostm 0:4af3ca173992 89
arostm 0:4af3ca173992 90 #define QSPI_D0_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
arostm 0:4af3ca173992 91 #define QSPI_D1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
arostm 0:4af3ca173992 92 #define QSPI_D2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
arostm 0:4af3ca173992 93 #define QSPI_D3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
arostm 0:4af3ca173992 94
arostm 0:4af3ca173992 95 #define QSPI_FORCE_RESET() __HAL_RCC_QSPI_FORCE_RESET()
arostm 0:4af3ca173992 96 #define QSPI_RELEASE_RESET() __HAL_RCC_QSPI_RELEASE_RESET()
arostm 0:4af3ca173992 97
arostm 0:4af3ca173992 98 /* Definition for QSPI Pins */
arostm 0:4af3ca173992 99 #define QSPI_CS_PIN GPIO_PIN_6
arostm 0:4af3ca173992 100 #define QSPI_CS_GPIO_PORT GPIOG
arostm 0:4af3ca173992 101 #define QSPI_CLK_PIN GPIO_PIN_2
arostm 0:4af3ca173992 102 #define QSPI_CLK_GPIO_PORT GPIOB
arostm 0:4af3ca173992 103 #define QSPI_D0_PIN GPIO_PIN_8
arostm 0:4af3ca173992 104 #define QSPI_D0_GPIO_PORT GPIOF
arostm 0:4af3ca173992 105 #define QSPI_D1_PIN GPIO_PIN_9
arostm 0:4af3ca173992 106 #define QSPI_D1_GPIO_PORT GPIOF
arostm 0:4af3ca173992 107 #define QSPI_D2_PIN GPIO_PIN_2
arostm 0:4af3ca173992 108 #define QSPI_D2_GPIO_PORT GPIOE
arostm 0:4af3ca173992 109 #define QSPI_D3_PIN GPIO_PIN_13
arostm 0:4af3ca173992 110 #define QSPI_D3_GPIO_PORT GPIOD
arostm 0:4af3ca173992 111
arostm 0:4af3ca173992 112 /* N25Q128A13EF840F Micron memory */
arostm 0:4af3ca173992 113 /* Size of the flash */
arostm 0:4af3ca173992 114 #define QSPI_FLASH_SIZE 23 /* Address bus width to access whole memory space */
arostm 0:4af3ca173992 115 #define QSPI_PAGE_SIZE 256
arostm 0:4af3ca173992 116
arostm 0:4af3ca173992 117 /**
arostm 0:4af3ca173992 118 * @}
arostm 0:4af3ca173992 119 */
arostm 0:4af3ca173992 120
arostm 0:4af3ca173992 121 /* Exported types ------------------------------------------------------------*/
arostm 0:4af3ca173992 122 /** @defgroup STM32F413H_DISCOVERY_QSPI_Exported_Types STM32F413H DISCOVERY Exported Types
arostm 0:4af3ca173992 123 * @{
arostm 0:4af3ca173992 124 */
arostm 0:4af3ca173992 125 /* QSPI Info */
arostm 0:4af3ca173992 126 typedef struct {
arostm 0:4af3ca173992 127 uint32_t FlashSize; /*!< Size of the flash */
arostm 0:4af3ca173992 128 uint32_t EraseSectorSize; /*!< Size of sectors for the erase operation */
arostm 0:4af3ca173992 129 uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
arostm 0:4af3ca173992 130 uint32_t ProgPageSize; /*!< Size of pages for the program operation */
arostm 0:4af3ca173992 131 uint32_t ProgPagesNumber; /*!< Number of pages for the program operation */
arostm 0:4af3ca173992 132 } QSPI_Info;
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 /* Exported functions --------------------------------------------------------*/
arostm 0:4af3ca173992 140 /** @defgroup STM32F413H_DISCOVERY_QSPI_Exported_Functions STM32F413H DISCOVERY Exported Functions
arostm 0:4af3ca173992 141 * @{
arostm 0:4af3ca173992 142 */
arostm 0:4af3ca173992 143 uint8_t BSP_QSPI_Init (void);
arostm 0:4af3ca173992 144 uint8_t BSP_QSPI_DeInit (void);
arostm 0:4af3ca173992 145 uint8_t BSP_QSPI_Read (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
arostm 0:4af3ca173992 146 uint8_t BSP_QSPI_Write (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
arostm 0:4af3ca173992 147 uint8_t BSP_QSPI_Erase_Block(uint32_t BlockAddress);
arostm 0:4af3ca173992 148 uint8_t BSP_QSPI_Erase_Chip (void);
arostm 0:4af3ca173992 149 uint8_t BSP_QSPI_GetStatus (void);
arostm 0:4af3ca173992 150 uint8_t BSP_QSPI_GetInfo (QSPI_Info* pInfo);
arostm 0:4af3ca173992 151 uint8_t BSP_QSPI_EnableMemoryMappedMode(void);
arostm 0:4af3ca173992 152 /* BSP Aliased function maintained for legacy purpose */
arostm 0:4af3ca173992 153 #define BSP_QSPI_MemoryMappedMode BSP_QSPI_EnableMemoryMappedMode
arostm 0:4af3ca173992 154
arostm 0:4af3ca173992 155 /* These functions can be modified in case the current settings
arostm 0:4af3ca173992 156 need to be changed for specific application needs */
arostm 0:4af3ca173992 157 void BSP_QSPI_MspInit(QSPI_HandleTypeDef *hqspi, void *Params);
arostm 0:4af3ca173992 158 void BSP_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi, void *Params);
arostm 0:4af3ca173992 159
arostm 0:4af3ca173992 160 /**
arostm 0:4af3ca173992 161 * @}
arostm 0:4af3ca173992 162 */
arostm 0:4af3ca173992 163
arostm 0:4af3ca173992 164 /**
arostm 0:4af3ca173992 165 * @}
arostm 0:4af3ca173992 166 */
arostm 0:4af3ca173992 167
arostm 0:4af3ca173992 168 #ifdef __cplusplus
arostm 0:4af3ca173992 169 }
arostm 0:4af3ca173992 170 #endif
arostm 0:4af3ca173992 171
arostm 0:4af3ca173992 172 #endif /* __STM32F413H_DISCOVERY_QSPI_H */
arostm 0:4af3ca173992 173 /**
arostm 0:4af3ca173992 174 * @}
arostm 0:4af3ca173992 175 */
arostm 0:4af3ca173992 176
arostm 0:4af3ca173992 177 /**
arostm 0:4af3ca173992 178 * @}
arostm 0:4af3ca173992 179 */
arostm 0:4af3ca173992 180
arostm 0:4af3ca173992 181 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/