Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 ******************************************************************************
lypinator 0:bb348c97df44 3 * @file stm32f4xx_hal_qspi.h
lypinator 0:bb348c97df44 4 * @author MCD Application Team
lypinator 0:bb348c97df44 5 * @brief Header file of QSPI HAL module.
lypinator 0:bb348c97df44 6 ******************************************************************************
lypinator 0:bb348c97df44 7 * @attention
lypinator 0:bb348c97df44 8 *
lypinator 0:bb348c97df44 9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
lypinator 0:bb348c97df44 10 *
lypinator 0:bb348c97df44 11 * Redistribution and use in source and binary forms, with or without modification,
lypinator 0:bb348c97df44 12 * are permitted provided that the following conditions are met:
lypinator 0:bb348c97df44 13 * 1. Redistributions of source code must retain the above copyright notice,
lypinator 0:bb348c97df44 14 * this list of conditions and the following disclaimer.
lypinator 0:bb348c97df44 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
lypinator 0:bb348c97df44 16 * this list of conditions and the following disclaimer in the documentation
lypinator 0:bb348c97df44 17 * and/or other materials provided with the distribution.
lypinator 0:bb348c97df44 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
lypinator 0:bb348c97df44 19 * may be used to endorse or promote products derived from this software
lypinator 0:bb348c97df44 20 * without specific prior written permission.
lypinator 0:bb348c97df44 21 *
lypinator 0:bb348c97df44 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
lypinator 0:bb348c97df44 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
lypinator 0:bb348c97df44 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
lypinator 0:bb348c97df44 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
lypinator 0:bb348c97df44 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
lypinator 0:bb348c97df44 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
lypinator 0:bb348c97df44 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
lypinator 0:bb348c97df44 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
lypinator 0:bb348c97df44 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
lypinator 0:bb348c97df44 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lypinator 0:bb348c97df44 32 *
lypinator 0:bb348c97df44 33 ******************************************************************************
lypinator 0:bb348c97df44 34 */
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 /* Define to prevent recursive inclusion -------------------------------------*/
lypinator 0:bb348c97df44 37 #ifndef __STM32F4xx_HAL_QSPI_H
lypinator 0:bb348c97df44 38 #define __STM32F4xx_HAL_QSPI_H
lypinator 0:bb348c97df44 39
lypinator 0:bb348c97df44 40 #ifdef __cplusplus
lypinator 0:bb348c97df44 41 extern "C" {
lypinator 0:bb348c97df44 42 #endif
lypinator 0:bb348c97df44 43
lypinator 0:bb348c97df44 44 #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
lypinator 0:bb348c97df44 45 defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 46 /* Includes ------------------------------------------------------------------*/
lypinator 0:bb348c97df44 47 #include "stm32f4xx_hal_def.h"
lypinator 0:bb348c97df44 48
lypinator 0:bb348c97df44 49 /** @addtogroup STM32F4xx_HAL_Driver
lypinator 0:bb348c97df44 50 * @{
lypinator 0:bb348c97df44 51 */
lypinator 0:bb348c97df44 52
lypinator 0:bb348c97df44 53 /** @addtogroup QSPI
lypinator 0:bb348c97df44 54 * @{
lypinator 0:bb348c97df44 55 */
lypinator 0:bb348c97df44 56
lypinator 0:bb348c97df44 57 /* Exported types ------------------------------------------------------------*/
lypinator 0:bb348c97df44 58 /** @defgroup QSPI_Exported_Types QSPI Exported Types
lypinator 0:bb348c97df44 59 * @{
lypinator 0:bb348c97df44 60 */
lypinator 0:bb348c97df44 61
lypinator 0:bb348c97df44 62 /**
lypinator 0:bb348c97df44 63 * @brief QSPI Init structure definition
lypinator 0:bb348c97df44 64 */
lypinator 0:bb348c97df44 65
lypinator 0:bb348c97df44 66 typedef struct
lypinator 0:bb348c97df44 67 {
lypinator 0:bb348c97df44 68 uint32_t ClockPrescaler; /* Specifies the prescaler factor for generating clock based on the AHB clock.
lypinator 0:bb348c97df44 69 This parameter can be a number between 0 and 255 */
lypinator 0:bb348c97df44 70
lypinator 0:bb348c97df44 71 uint32_t FifoThreshold; /* Specifies the threshold number of bytes in the FIFO (used only in indirect mode)
lypinator 0:bb348c97df44 72 This parameter can be a value between 1 and 32 */
lypinator 0:bb348c97df44 73
lypinator 0:bb348c97df44 74 uint32_t SampleShifting; /* Specifies the Sample Shift. The data is sampled 1/2 clock cycle delay later to
lypinator 0:bb348c97df44 75 take in account external signal delays. (It should be QSPI_SAMPLE_SHIFTING_NONE in DDR mode)
lypinator 0:bb348c97df44 76 This parameter can be a value of @ref QSPI_SampleShifting */
lypinator 0:bb348c97df44 77
lypinator 0:bb348c97df44 78 uint32_t FlashSize; /* Specifies the Flash Size. FlashSize+1 is effectively the number of address bits
lypinator 0:bb348c97df44 79 required to address the flash memory. The flash capacity can be up to 4GB
lypinator 0:bb348c97df44 80 (addressed using 32 bits) in indirect mode, but the addressable space in
lypinator 0:bb348c97df44 81 memory-mapped mode is limited to 256MB
lypinator 0:bb348c97df44 82 This parameter can be a number between 0 and 31 */
lypinator 0:bb348c97df44 83
lypinator 0:bb348c97df44 84 uint32_t ChipSelectHighTime; /* Specifies the Chip Select High Time. ChipSelectHighTime+1 defines the minimum number
lypinator 0:bb348c97df44 85 of clock cycles which the chip select must remain high between commands.
lypinator 0:bb348c97df44 86 This parameter can be a value of @ref QSPI_ChipSelectHighTime */
lypinator 0:bb348c97df44 87
lypinator 0:bb348c97df44 88 uint32_t ClockMode; /* Specifies the Clock Mode. It indicates the level that clock takes between commands.
lypinator 0:bb348c97df44 89 This parameter can be a value of @ref QSPI_ClockMode */
lypinator 0:bb348c97df44 90
lypinator 0:bb348c97df44 91 uint32_t FlashID; /* Specifies the Flash which will be used,
lypinator 0:bb348c97df44 92 This parameter can be a value of @ref QSPI_Flash_Select */
lypinator 0:bb348c97df44 93
lypinator 0:bb348c97df44 94 uint32_t DualFlash; /* Specifies the Dual Flash Mode State
lypinator 0:bb348c97df44 95 This parameter can be a value of @ref QSPI_DualFlash_Mode */
lypinator 0:bb348c97df44 96 }QSPI_InitTypeDef;
lypinator 0:bb348c97df44 97
lypinator 0:bb348c97df44 98 /**
lypinator 0:bb348c97df44 99 * @brief HAL QSPI State structures definition
lypinator 0:bb348c97df44 100 */
lypinator 0:bb348c97df44 101 typedef enum
lypinator 0:bb348c97df44 102 {
lypinator 0:bb348c97df44 103 HAL_QSPI_STATE_RESET = 0x00U, /*!< Peripheral not initialized */
lypinator 0:bb348c97df44 104 HAL_QSPI_STATE_READY = 0x01U, /*!< Peripheral initialized and ready for use */
lypinator 0:bb348c97df44 105 HAL_QSPI_STATE_BUSY = 0x02U, /*!< Peripheral in indirect mode and busy */
lypinator 0:bb348c97df44 106 HAL_QSPI_STATE_BUSY_INDIRECT_TX = 0x12U, /*!< Peripheral in indirect mode with transmission ongoing */
lypinator 0:bb348c97df44 107 HAL_QSPI_STATE_BUSY_INDIRECT_RX = 0x22U, /*!< Peripheral in indirect mode with reception ongoing */
lypinator 0:bb348c97df44 108 HAL_QSPI_STATE_BUSY_AUTO_POLLING = 0x42U, /*!< Peripheral in auto polling mode ongoing */
lypinator 0:bb348c97df44 109 HAL_QSPI_STATE_BUSY_MEM_MAPPED = 0x82U, /*!< Peripheral in memory mapped mode ongoing */
lypinator 0:bb348c97df44 110 HAL_QSPI_STATE_ABORT = 0x08U, /*!< Peripheral with abort request ongoing */
lypinator 0:bb348c97df44 111 HAL_QSPI_STATE_ERROR = 0x04U /*!< Peripheral in error */
lypinator 0:bb348c97df44 112 }HAL_QSPI_StateTypeDef;
lypinator 0:bb348c97df44 113
lypinator 0:bb348c97df44 114 /**
lypinator 0:bb348c97df44 115 * @brief QSPI Handle Structure definition
lypinator 0:bb348c97df44 116 */
lypinator 0:bb348c97df44 117 typedef struct
lypinator 0:bb348c97df44 118 {
lypinator 0:bb348c97df44 119 QUADSPI_TypeDef *Instance; /* QSPI registers base address */
lypinator 0:bb348c97df44 120 QSPI_InitTypeDef Init; /* QSPI communication parameters */
lypinator 0:bb348c97df44 121 uint8_t *pTxBuffPtr; /* Pointer to QSPI Tx transfer Buffer */
lypinator 0:bb348c97df44 122 __IO uint32_t TxXferSize; /* QSPI Tx Transfer size */
lypinator 0:bb348c97df44 123 __IO uint32_t TxXferCount; /* QSPI Tx Transfer Counter */
lypinator 0:bb348c97df44 124 uint8_t *pRxBuffPtr; /* Pointer to QSPI Rx transfer Buffer */
lypinator 0:bb348c97df44 125 __IO uint32_t RxXferSize; /* QSPI Rx Transfer size */
lypinator 0:bb348c97df44 126 __IO uint32_t RxXferCount; /* QSPI Rx Transfer Counter */
lypinator 0:bb348c97df44 127 DMA_HandleTypeDef *hdma; /* QSPI Rx/Tx DMA Handle parameters */
lypinator 0:bb348c97df44 128 __IO HAL_LockTypeDef Lock; /* Locking object */
lypinator 0:bb348c97df44 129 __IO HAL_QSPI_StateTypeDef State; /* QSPI communication state */
lypinator 0:bb348c97df44 130 __IO uint32_t ErrorCode; /* QSPI Error code */
lypinator 0:bb348c97df44 131 uint32_t Timeout; /* Timeout for the QSPI memory access */
lypinator 0:bb348c97df44 132 }QSPI_HandleTypeDef;
lypinator 0:bb348c97df44 133
lypinator 0:bb348c97df44 134 /**
lypinator 0:bb348c97df44 135 * @brief QSPI Command structure definition
lypinator 0:bb348c97df44 136 */
lypinator 0:bb348c97df44 137 typedef struct
lypinator 0:bb348c97df44 138 {
lypinator 0:bb348c97df44 139 uint32_t Instruction; /* Specifies the Instruction to be sent
lypinator 0:bb348c97df44 140 This parameter can be a value (8-bit) between 0x00 and 0xFF */
lypinator 0:bb348c97df44 141 uint32_t Address; /* Specifies the Address to be sent (Size from 1 to 4 bytes according AddressSize)
lypinator 0:bb348c97df44 142 This parameter can be a value (32-bits) between 0x0 and 0xFFFFFFFFU */
lypinator 0:bb348c97df44 143 uint32_t AlternateBytes; /* Specifies the Alternate Bytes to be sent (Size from 1 to 4 bytes according AlternateBytesSize)
lypinator 0:bb348c97df44 144 This parameter can be a value (32-bits) between 0x0 and 0xFFFFFFFFU */
lypinator 0:bb348c97df44 145 uint32_t AddressSize; /* Specifies the Address Size
lypinator 0:bb348c97df44 146 This parameter can be a value of @ref QSPI_AddressSize */
lypinator 0:bb348c97df44 147 uint32_t AlternateBytesSize; /* Specifies the Alternate Bytes Size
lypinator 0:bb348c97df44 148 This parameter can be a value of @ref QSPI_AlternateBytesSize */
lypinator 0:bb348c97df44 149 uint32_t DummyCycles; /* Specifies the Number of Dummy Cycles.
lypinator 0:bb348c97df44 150 This parameter can be a number between 0 and 31 */
lypinator 0:bb348c97df44 151 uint32_t InstructionMode; /* Specifies the Instruction Mode
lypinator 0:bb348c97df44 152 This parameter can be a value of @ref QSPI_InstructionMode */
lypinator 0:bb348c97df44 153 uint32_t AddressMode; /* Specifies the Address Mode
lypinator 0:bb348c97df44 154 This parameter can be a value of @ref QSPI_AddressMode */
lypinator 0:bb348c97df44 155 uint32_t AlternateByteMode; /* Specifies the Alternate Bytes Mode
lypinator 0:bb348c97df44 156 This parameter can be a value of @ref QSPI_AlternateBytesMode */
lypinator 0:bb348c97df44 157 uint32_t DataMode; /* Specifies the Data Mode (used for dummy cycles and data phases)
lypinator 0:bb348c97df44 158 This parameter can be a value of @ref QSPI_DataMode */
lypinator 0:bb348c97df44 159 uint32_t NbData; /* Specifies the number of data to transfer.
lypinator 0:bb348c97df44 160 This parameter can be any value between 0 and 0xFFFFFFFFU (0 means undefined length
lypinator 0:bb348c97df44 161 until end of memory)*/
lypinator 0:bb348c97df44 162 uint32_t DdrMode; /* Specifies the double data rate mode for address, alternate byte and data phase
lypinator 0:bb348c97df44 163 This parameter can be a value of @ref QSPI_DdrMode */
lypinator 0:bb348c97df44 164 uint32_t DdrHoldHalfCycle; /* Specifies the DDR hold half cycle. It delays the data output by one half of
lypinator 0:bb348c97df44 165 system clock in DDR mode.
lypinator 0:bb348c97df44 166 This parameter can be a value of @ref QSPI_DdrHoldHalfCycle */
lypinator 0:bb348c97df44 167 uint32_t SIOOMode; /* Specifies the send instruction only once mode
lypinator 0:bb348c97df44 168 This parameter can be a value of @ref QSPI_SIOOMode */
lypinator 0:bb348c97df44 169 }QSPI_CommandTypeDef;
lypinator 0:bb348c97df44 170
lypinator 0:bb348c97df44 171 /**
lypinator 0:bb348c97df44 172 * @brief QSPI Auto Polling mode configuration structure definition
lypinator 0:bb348c97df44 173 */
lypinator 0:bb348c97df44 174 typedef struct
lypinator 0:bb348c97df44 175 {
lypinator 0:bb348c97df44 176 uint32_t Match; /* Specifies the value to be compared with the masked status register to get a match.
lypinator 0:bb348c97df44 177 This parameter can be any value between 0 and 0xFFFFFFFFU */
lypinator 0:bb348c97df44 178 uint32_t Mask; /* Specifies the mask to be applied to the status bytes received.
lypinator 0:bb348c97df44 179 This parameter can be any value between 0 and 0xFFFFFFFFU */
lypinator 0:bb348c97df44 180 uint32_t Interval; /* Specifies the number of clock cycles between two read during automatic polling phases.
lypinator 0:bb348c97df44 181 This parameter can be any value between 0 and 0xFFFFU */
lypinator 0:bb348c97df44 182 uint32_t StatusBytesSize; /* Specifies the size of the status bytes received.
lypinator 0:bb348c97df44 183 This parameter can be any value between 1 and 4 */
lypinator 0:bb348c97df44 184 uint32_t MatchMode; /* Specifies the method used for determining a match.
lypinator 0:bb348c97df44 185 This parameter can be a value of @ref QSPI_MatchMode */
lypinator 0:bb348c97df44 186 uint32_t AutomaticStop; /* Specifies if automatic polling is stopped after a match.
lypinator 0:bb348c97df44 187 This parameter can be a value of @ref QSPI_AutomaticStop */
lypinator 0:bb348c97df44 188 }QSPI_AutoPollingTypeDef;
lypinator 0:bb348c97df44 189
lypinator 0:bb348c97df44 190 /**
lypinator 0:bb348c97df44 191 * @brief QSPI Memory Mapped mode configuration structure definition
lypinator 0:bb348c97df44 192 */
lypinator 0:bb348c97df44 193 typedef struct
lypinator 0:bb348c97df44 194 {
lypinator 0:bb348c97df44 195 uint32_t TimeOutPeriod; /* Specifies the number of clock to wait when the FIFO is full before to release the chip select.
lypinator 0:bb348c97df44 196 This parameter can be any value between 0 and 0xFFFFU */
lypinator 0:bb348c97df44 197 uint32_t TimeOutActivation; /* Specifies if the time out counter is enabled to release the chip select.
lypinator 0:bb348c97df44 198 This parameter can be a value of @ref QSPI_TimeOutActivation */
lypinator 0:bb348c97df44 199 }QSPI_MemoryMappedTypeDef;
lypinator 0:bb348c97df44 200 /**
lypinator 0:bb348c97df44 201 * @}
lypinator 0:bb348c97df44 202 */
lypinator 0:bb348c97df44 203
lypinator 0:bb348c97df44 204 /* Exported constants --------------------------------------------------------*/
lypinator 0:bb348c97df44 205 /** @defgroup QSPI_Exported_Constants QSPI Exported Constants
lypinator 0:bb348c97df44 206 * @{
lypinator 0:bb348c97df44 207 */
lypinator 0:bb348c97df44 208 /** @defgroup QSPI_ErrorCode QSPI Error Code
lypinator 0:bb348c97df44 209 * @{
lypinator 0:bb348c97df44 210 */
lypinator 0:bb348c97df44 211 #define HAL_QSPI_ERROR_NONE 0x00000000U /*!< No error */
lypinator 0:bb348c97df44 212 #define HAL_QSPI_ERROR_TIMEOUT 0x00000001U /*!< Timeout error */
lypinator 0:bb348c97df44 213 #define HAL_QSPI_ERROR_TRANSFER 0x00000002U /*!< Transfer error */
lypinator 0:bb348c97df44 214 #define HAL_QSPI_ERROR_DMA 0x00000004U /*!< DMA transfer error */
lypinator 0:bb348c97df44 215 #define HAL_QSPI_ERROR_INVALID_PARAM 0x00000008U /*!< Invalid parameters error */
lypinator 0:bb348c97df44 216 /**
lypinator 0:bb348c97df44 217 * @}
lypinator 0:bb348c97df44 218 */
lypinator 0:bb348c97df44 219
lypinator 0:bb348c97df44 220 /** @defgroup QSPI_SampleShifting QSPI Sample Shifting
lypinator 0:bb348c97df44 221 * @{
lypinator 0:bb348c97df44 222 */
lypinator 0:bb348c97df44 223 #define QSPI_SAMPLE_SHIFTING_NONE 0x00000000U /*!<No clock cycle shift to sample data*/
lypinator 0:bb348c97df44 224 #define QSPI_SAMPLE_SHIFTING_HALFCYCLE ((uint32_t)QUADSPI_CR_SSHIFT) /*!<1/2 clock cycle shift to sample data*/
lypinator 0:bb348c97df44 225 /**
lypinator 0:bb348c97df44 226 * @}
lypinator 0:bb348c97df44 227 */
lypinator 0:bb348c97df44 228
lypinator 0:bb348c97df44 229 /** @defgroup QSPI_ChipSelectHighTime QSPI Chip Select High Time
lypinator 0:bb348c97df44 230 * @{
lypinator 0:bb348c97df44 231 */
lypinator 0:bb348c97df44 232 #define QSPI_CS_HIGH_TIME_1_CYCLE 0x00000000U /*!<nCS stay high for at least 1 clock cycle between commands*/
lypinator 0:bb348c97df44 233 #define QSPI_CS_HIGH_TIME_2_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_0) /*!<nCS stay high for at least 2 clock cycles between commands*/
lypinator 0:bb348c97df44 234 #define QSPI_CS_HIGH_TIME_3_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_1) /*!<nCS stay high for at least 3 clock cycles between commands*/
lypinator 0:bb348c97df44 235 #define QSPI_CS_HIGH_TIME_4_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_0 | QUADSPI_DCR_CSHT_1) /*!<nCS stay high for at least 4 clock cycles between commands*/
lypinator 0:bb348c97df44 236 #define QSPI_CS_HIGH_TIME_5_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_2) /*!<nCS stay high for at least 5 clock cycles between commands*/
lypinator 0:bb348c97df44 237 #define QSPI_CS_HIGH_TIME_6_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_2 | QUADSPI_DCR_CSHT_0) /*!<nCS stay high for at least 6 clock cycles between commands*/
lypinator 0:bb348c97df44 238 #define QSPI_CS_HIGH_TIME_7_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_2 | QUADSPI_DCR_CSHT_1) /*!<nCS stay high for at least 7 clock cycles between commands*/
lypinator 0:bb348c97df44 239 #define QSPI_CS_HIGH_TIME_8_CYCLE ((uint32_t)QUADSPI_DCR_CSHT) /*!<nCS stay high for at least 8 clock cycles between commands*/
lypinator 0:bb348c97df44 240 /**
lypinator 0:bb348c97df44 241 * @}
lypinator 0:bb348c97df44 242 */
lypinator 0:bb348c97df44 243
lypinator 0:bb348c97df44 244 /** @defgroup QSPI_ClockMode QSPI Clock Mode
lypinator 0:bb348c97df44 245 * @{
lypinator 0:bb348c97df44 246 */
lypinator 0:bb348c97df44 247 #define QSPI_CLOCK_MODE_0 0x00000000U /*!<Clk stays low while nCS is released*/
lypinator 0:bb348c97df44 248 #define QSPI_CLOCK_MODE_3 ((uint32_t)QUADSPI_DCR_CKMODE) /*!<Clk goes high while nCS is released*/
lypinator 0:bb348c97df44 249 /**
lypinator 0:bb348c97df44 250 * @}
lypinator 0:bb348c97df44 251 */
lypinator 0:bb348c97df44 252
lypinator 0:bb348c97df44 253 /** @defgroup QSPI_Flash_Select QSPI Flash Select
lypinator 0:bb348c97df44 254 * @{
lypinator 0:bb348c97df44 255 */
lypinator 0:bb348c97df44 256 #define QSPI_FLASH_ID_1 0x00000000U
lypinator 0:bb348c97df44 257 #define QSPI_FLASH_ID_2 ((uint32_t)QUADSPI_CR_FSEL)
lypinator 0:bb348c97df44 258 /**
lypinator 0:bb348c97df44 259 * @}
lypinator 0:bb348c97df44 260 */
lypinator 0:bb348c97df44 261
lypinator 0:bb348c97df44 262 /** @defgroup QSPI_DualFlash_Mode QSPI Dual Flash Mode
lypinator 0:bb348c97df44 263 * @{
lypinator 0:bb348c97df44 264 */
lypinator 0:bb348c97df44 265 #define QSPI_DUALFLASH_ENABLE ((uint32_t)QUADSPI_CR_DFM)
lypinator 0:bb348c97df44 266 #define QSPI_DUALFLASH_DISABLE 0x00000000U
lypinator 0:bb348c97df44 267 /**
lypinator 0:bb348c97df44 268 * @}
lypinator 0:bb348c97df44 269 */
lypinator 0:bb348c97df44 270
lypinator 0:bb348c97df44 271 /** @defgroup QSPI_AddressSize QSPI Address Size
lypinator 0:bb348c97df44 272 * @{
lypinator 0:bb348c97df44 273 */
lypinator 0:bb348c97df44 274 #define QSPI_ADDRESS_8_BITS 0x00000000U /*!<8-bit address*/
lypinator 0:bb348c97df44 275 #define QSPI_ADDRESS_16_BITS ((uint32_t)QUADSPI_CCR_ADSIZE_0) /*!<16-bit address*/
lypinator 0:bb348c97df44 276 #define QSPI_ADDRESS_24_BITS ((uint32_t)QUADSPI_CCR_ADSIZE_1) /*!<24-bit address*/
lypinator 0:bb348c97df44 277 #define QSPI_ADDRESS_32_BITS ((uint32_t)QUADSPI_CCR_ADSIZE) /*!<32-bit address*/
lypinator 0:bb348c97df44 278 /**
lypinator 0:bb348c97df44 279 * @}
lypinator 0:bb348c97df44 280 */
lypinator 0:bb348c97df44 281
lypinator 0:bb348c97df44 282 /** @defgroup QSPI_AlternateBytesSize QSPI Alternate Bytes Size
lypinator 0:bb348c97df44 283 * @{
lypinator 0:bb348c97df44 284 */
lypinator 0:bb348c97df44 285 #define QSPI_ALTERNATE_BYTES_8_BITS 0x00000000U /*!<8-bit alternate bytes*/
lypinator 0:bb348c97df44 286 #define QSPI_ALTERNATE_BYTES_16_BITS ((uint32_t)QUADSPI_CCR_ABSIZE_0) /*!<16-bit alternate bytes*/
lypinator 0:bb348c97df44 287 #define QSPI_ALTERNATE_BYTES_24_BITS ((uint32_t)QUADSPI_CCR_ABSIZE_1) /*!<24-bit alternate bytes*/
lypinator 0:bb348c97df44 288 #define QSPI_ALTERNATE_BYTES_32_BITS ((uint32_t)QUADSPI_CCR_ABSIZE) /*!<32-bit alternate bytes*/
lypinator 0:bb348c97df44 289 /**
lypinator 0:bb348c97df44 290 * @}
lypinator 0:bb348c97df44 291 */
lypinator 0:bb348c97df44 292
lypinator 0:bb348c97df44 293 /** @defgroup QSPI_InstructionMode QSPI Instruction Mode
lypinator 0:bb348c97df44 294 * @{
lypinator 0:bb348c97df44 295 */
lypinator 0:bb348c97df44 296 #define QSPI_INSTRUCTION_NONE 0x00000000U /*!<No instruction*/
lypinator 0:bb348c97df44 297 #define QSPI_INSTRUCTION_1_LINE ((uint32_t)QUADSPI_CCR_IMODE_0) /*!<Instruction on a single line*/
lypinator 0:bb348c97df44 298 #define QSPI_INSTRUCTION_2_LINES ((uint32_t)QUADSPI_CCR_IMODE_1) /*!<Instruction on two lines*/
lypinator 0:bb348c97df44 299 #define QSPI_INSTRUCTION_4_LINES ((uint32_t)QUADSPI_CCR_IMODE) /*!<Instruction on four lines*/
lypinator 0:bb348c97df44 300 /**
lypinator 0:bb348c97df44 301 * @}
lypinator 0:bb348c97df44 302 */
lypinator 0:bb348c97df44 303
lypinator 0:bb348c97df44 304 /** @defgroup QSPI_AddressMode QSPI Address Mode
lypinator 0:bb348c97df44 305 * @{
lypinator 0:bb348c97df44 306 */
lypinator 0:bb348c97df44 307 #define QSPI_ADDRESS_NONE 0x00000000U /*!<No address*/
lypinator 0:bb348c97df44 308 #define QSPI_ADDRESS_1_LINE ((uint32_t)QUADSPI_CCR_ADMODE_0) /*!<Address on a single line*/
lypinator 0:bb348c97df44 309 #define QSPI_ADDRESS_2_LINES ((uint32_t)QUADSPI_CCR_ADMODE_1) /*!<Address on two lines*/
lypinator 0:bb348c97df44 310 #define QSPI_ADDRESS_4_LINES ((uint32_t)QUADSPI_CCR_ADMODE) /*!<Address on four lines*/
lypinator 0:bb348c97df44 311 /**
lypinator 0:bb348c97df44 312 * @}
lypinator 0:bb348c97df44 313 */
lypinator 0:bb348c97df44 314
lypinator 0:bb348c97df44 315 /** @defgroup QSPI_AlternateBytesMode QSPI Alternate Bytes Mode
lypinator 0:bb348c97df44 316 * @{
lypinator 0:bb348c97df44 317 */
lypinator 0:bb348c97df44 318 #define QSPI_ALTERNATE_BYTES_NONE 0x00000000U /*!<No alternate bytes*/
lypinator 0:bb348c97df44 319 #define QSPI_ALTERNATE_BYTES_1_LINE ((uint32_t)QUADSPI_CCR_ABMODE_0) /*!<Alternate bytes on a single line*/
lypinator 0:bb348c97df44 320 #define QSPI_ALTERNATE_BYTES_2_LINES ((uint32_t)QUADSPI_CCR_ABMODE_1) /*!<Alternate bytes on two lines*/
lypinator 0:bb348c97df44 321 #define QSPI_ALTERNATE_BYTES_4_LINES ((uint32_t)QUADSPI_CCR_ABMODE) /*!<Alternate bytes on four lines*/
lypinator 0:bb348c97df44 322 /**
lypinator 0:bb348c97df44 323 * @}
lypinator 0:bb348c97df44 324 */
lypinator 0:bb348c97df44 325
lypinator 0:bb348c97df44 326 /** @defgroup QSPI_DataMode QSPI Data Mode
lypinator 0:bb348c97df44 327 * @{
lypinator 0:bb348c97df44 328 */
lypinator 0:bb348c97df44 329 #define QSPI_DATA_NONE 0x00000000U /*!<No data*/
lypinator 0:bb348c97df44 330 #define QSPI_DATA_1_LINE ((uint32_t)QUADSPI_CCR_DMODE_0) /*!<Data on a single line*/
lypinator 0:bb348c97df44 331 #define QSPI_DATA_2_LINES ((uint32_t)QUADSPI_CCR_DMODE_1) /*!<Data on two lines*/
lypinator 0:bb348c97df44 332 #define QSPI_DATA_4_LINES ((uint32_t)QUADSPI_CCR_DMODE) /*!<Data on four lines*/
lypinator 0:bb348c97df44 333 /**
lypinator 0:bb348c97df44 334 * @}
lypinator 0:bb348c97df44 335 */
lypinator 0:bb348c97df44 336
lypinator 0:bb348c97df44 337 /** @defgroup QSPI_DdrMode QSPI Ddr Mode
lypinator 0:bb348c97df44 338 * @{
lypinator 0:bb348c97df44 339 */
lypinator 0:bb348c97df44 340 #define QSPI_DDR_MODE_DISABLE 0x00000000U /*!<Double data rate mode disabled*/
lypinator 0:bb348c97df44 341 #define QSPI_DDR_MODE_ENABLE ((uint32_t)QUADSPI_CCR_DDRM) /*!<Double data rate mode enabled*/
lypinator 0:bb348c97df44 342 /**
lypinator 0:bb348c97df44 343 * @}
lypinator 0:bb348c97df44 344 */
lypinator 0:bb348c97df44 345
lypinator 0:bb348c97df44 346 /** @defgroup QSPI_DdrHoldHalfCycle QSPI Ddr HoldHalfCycle
lypinator 0:bb348c97df44 347 * @{
lypinator 0:bb348c97df44 348 */
lypinator 0:bb348c97df44 349 #define QSPI_DDR_HHC_ANALOG_DELAY 0x00000000U /*!<Delay the data output using analog delay in DDR mode*/
lypinator 0:bb348c97df44 350 #define QSPI_DDR_HHC_HALF_CLK_DELAY ((uint32_t)QUADSPI_CCR_DHHC) /*!<Delay the data output by 1/2 clock cycle in DDR mode*/
lypinator 0:bb348c97df44 351 /**
lypinator 0:bb348c97df44 352 * @}
lypinator 0:bb348c97df44 353 */
lypinator 0:bb348c97df44 354
lypinator 0:bb348c97df44 355 /** @defgroup QSPI_SIOOMode QSPI SIOO Mode
lypinator 0:bb348c97df44 356 * @{
lypinator 0:bb348c97df44 357 */
lypinator 0:bb348c97df44 358 #define QSPI_SIOO_INST_EVERY_CMD 0x00000000U /*!<Send instruction on every transaction*/
lypinator 0:bb348c97df44 359 #define QSPI_SIOO_INST_ONLY_FIRST_CMD ((uint32_t)QUADSPI_CCR_SIOO) /*!<Send instruction only for the first command*/
lypinator 0:bb348c97df44 360 /**
lypinator 0:bb348c97df44 361 * @}
lypinator 0:bb348c97df44 362 */
lypinator 0:bb348c97df44 363
lypinator 0:bb348c97df44 364 /** @defgroup QSPI_MatchMode QSPI Match Mode
lypinator 0:bb348c97df44 365 * @{
lypinator 0:bb348c97df44 366 */
lypinator 0:bb348c97df44 367 #define QSPI_MATCH_MODE_AND 0x00000000U /*!<AND match mode between unmasked bits*/
lypinator 0:bb348c97df44 368 #define QSPI_MATCH_MODE_OR ((uint32_t)QUADSPI_CR_PMM) /*!<OR match mode between unmasked bits*/
lypinator 0:bb348c97df44 369 /**
lypinator 0:bb348c97df44 370 * @}
lypinator 0:bb348c97df44 371 */
lypinator 0:bb348c97df44 372
lypinator 0:bb348c97df44 373 /** @defgroup QSPI_AutomaticStop QSPI Automatic Stop
lypinator 0:bb348c97df44 374 * @{
lypinator 0:bb348c97df44 375 */
lypinator 0:bb348c97df44 376 #define QSPI_AUTOMATIC_STOP_DISABLE 0x00000000U /*!<AutoPolling stops only with abort or QSPI disabling*/
lypinator 0:bb348c97df44 377 #define QSPI_AUTOMATIC_STOP_ENABLE ((uint32_t)QUADSPI_CR_APMS) /*!<AutoPolling stops as soon as there is a match*/
lypinator 0:bb348c97df44 378 /**
lypinator 0:bb348c97df44 379 * @}
lypinator 0:bb348c97df44 380 */
lypinator 0:bb348c97df44 381
lypinator 0:bb348c97df44 382 /** @defgroup QSPI_TimeOutActivation QSPI TimeOut Activation
lypinator 0:bb348c97df44 383 * @{
lypinator 0:bb348c97df44 384 */
lypinator 0:bb348c97df44 385 #define QSPI_TIMEOUT_COUNTER_DISABLE 0x00000000U /*!<Timeout counter disabled, nCS remains active*/
lypinator 0:bb348c97df44 386 #define QSPI_TIMEOUT_COUNTER_ENABLE ((uint32_t)QUADSPI_CR_TCEN) /*!<Timeout counter enabled, nCS released when timeout expires*/
lypinator 0:bb348c97df44 387 /**
lypinator 0:bb348c97df44 388 * @}
lypinator 0:bb348c97df44 389 */
lypinator 0:bb348c97df44 390
lypinator 0:bb348c97df44 391 /** @defgroup QSPI_Flags QSPI Flags
lypinator 0:bb348c97df44 392 * @{
lypinator 0:bb348c97df44 393 */
lypinator 0:bb348c97df44 394 #define QSPI_FLAG_BUSY QUADSPI_SR_BUSY /*!<Busy flag: operation is ongoing*/
lypinator 0:bb348c97df44 395 #define QSPI_FLAG_TO QUADSPI_SR_TOF /*!<Timeout flag: timeout occurs in memory-mapped mode*/
lypinator 0:bb348c97df44 396 #define QSPI_FLAG_SM QUADSPI_SR_SMF /*!<Status match flag: received data matches in autopolling mode*/
lypinator 0:bb348c97df44 397 #define QSPI_FLAG_FT QUADSPI_SR_FTF /*!<Fifo threshold flag: Fifo threshold reached or data left after read from memory is complete*/
lypinator 0:bb348c97df44 398 #define QSPI_FLAG_TC QUADSPI_SR_TCF /*!<Transfer complete flag: programmed number of data have been transferred or the transfer has been aborted*/
lypinator 0:bb348c97df44 399 #define QSPI_FLAG_TE QUADSPI_SR_TEF /*!<Transfer error flag: invalid address is being accessed*/
lypinator 0:bb348c97df44 400 /**
lypinator 0:bb348c97df44 401 * @}
lypinator 0:bb348c97df44 402 */
lypinator 0:bb348c97df44 403
lypinator 0:bb348c97df44 404 /** @defgroup QSPI_Interrupts QSPI Interrupts
lypinator 0:bb348c97df44 405 * @{
lypinator 0:bb348c97df44 406 */
lypinator 0:bb348c97df44 407 #define QSPI_IT_TO QUADSPI_CR_TOIE /*!<Interrupt on the timeout flag*/
lypinator 0:bb348c97df44 408 #define QSPI_IT_SM QUADSPI_CR_SMIE /*!<Interrupt on the status match flag*/
lypinator 0:bb348c97df44 409 #define QSPI_IT_FT QUADSPI_CR_FTIE /*!<Interrupt on the fifo threshold flag*/
lypinator 0:bb348c97df44 410 #define QSPI_IT_TC QUADSPI_CR_TCIE /*!<Interrupt on the transfer complete flag*/
lypinator 0:bb348c97df44 411 #define QSPI_IT_TE QUADSPI_CR_TEIE /*!<Interrupt on the transfer error flag*/
lypinator 0:bb348c97df44 412 /**
lypinator 0:bb348c97df44 413 * @}
lypinator 0:bb348c97df44 414 */
lypinator 0:bb348c97df44 415
lypinator 0:bb348c97df44 416 /** @defgroup QSPI_Timeout_definition QSPI Timeout definition
lypinator 0:bb348c97df44 417 * @{
lypinator 0:bb348c97df44 418 */
lypinator 0:bb348c97df44 419 #define HAL_QPSI_TIMEOUT_DEFAULT_VALUE 5000U /* 5 s */
lypinator 0:bb348c97df44 420 /**
lypinator 0:bb348c97df44 421 * @}
lypinator 0:bb348c97df44 422 */
lypinator 0:bb348c97df44 423
lypinator 0:bb348c97df44 424 /**
lypinator 0:bb348c97df44 425 * @}
lypinator 0:bb348c97df44 426 */
lypinator 0:bb348c97df44 427
lypinator 0:bb348c97df44 428 /* Exported macros -----------------------------------------------------------*/
lypinator 0:bb348c97df44 429 /** @defgroup QSPI_Exported_Macros QSPI Exported Macros
lypinator 0:bb348c97df44 430 * @{
lypinator 0:bb348c97df44 431 */
lypinator 0:bb348c97df44 432
lypinator 0:bb348c97df44 433 /** @brief Reset QSPI handle state
lypinator 0:bb348c97df44 434 * @param __HANDLE__ QSPI handle.
lypinator 0:bb348c97df44 435 * @retval None
lypinator 0:bb348c97df44 436 */
lypinator 0:bb348c97df44 437 #define __HAL_QSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_QSPI_STATE_RESET)
lypinator 0:bb348c97df44 438
lypinator 0:bb348c97df44 439 /** @brief Enable QSPI
lypinator 0:bb348c97df44 440 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 441 * @retval None
lypinator 0:bb348c97df44 442 */
lypinator 0:bb348c97df44 443 #define __HAL_QSPI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, QUADSPI_CR_EN)
lypinator 0:bb348c97df44 444
lypinator 0:bb348c97df44 445 /** @brief Disable QSPI
lypinator 0:bb348c97df44 446 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 447 * @retval None
lypinator 0:bb348c97df44 448 */
lypinator 0:bb348c97df44 449 #define __HAL_QSPI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, QUADSPI_CR_EN)
lypinator 0:bb348c97df44 450
lypinator 0:bb348c97df44 451 /** @brief Enables the specified QSPI interrupt.
lypinator 0:bb348c97df44 452 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 453 * @param __INTERRUPT__ specifies the QSPI interrupt source to enable.
lypinator 0:bb348c97df44 454 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 455 * @arg QSPI_IT_TO: QSPI Time out interrupt
lypinator 0:bb348c97df44 456 * @arg QSPI_IT_SM: QSPI Status match interrupt
lypinator 0:bb348c97df44 457 * @arg QSPI_IT_FT: QSPI FIFO threshold interrupt
lypinator 0:bb348c97df44 458 * @arg QSPI_IT_TC: QSPI Transfer complete interrupt
lypinator 0:bb348c97df44 459 * @arg QSPI_IT_TE: QSPI Transfer error interrupt
lypinator 0:bb348c97df44 460 * @retval None
lypinator 0:bb348c97df44 461 */
lypinator 0:bb348c97df44 462 #define __HAL_QSPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__))
lypinator 0:bb348c97df44 463
lypinator 0:bb348c97df44 464
lypinator 0:bb348c97df44 465 /** @brief Disables the specified QSPI interrupt.
lypinator 0:bb348c97df44 466 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 467 * @param __INTERRUPT__ specifies the QSPI interrupt source to disable.
lypinator 0:bb348c97df44 468 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 469 * @arg QSPI_IT_TO: QSPI Timeout interrupt
lypinator 0:bb348c97df44 470 * @arg QSPI_IT_SM: QSPI Status match interrupt
lypinator 0:bb348c97df44 471 * @arg QSPI_IT_FT: QSPI FIFO threshold interrupt
lypinator 0:bb348c97df44 472 * @arg QSPI_IT_TC: QSPI Transfer complete interrupt
lypinator 0:bb348c97df44 473 * @arg QSPI_IT_TE: QSPI Transfer error interrupt
lypinator 0:bb348c97df44 474 * @retval None
lypinator 0:bb348c97df44 475 */
lypinator 0:bb348c97df44 476 #define __HAL_QSPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__))
lypinator 0:bb348c97df44 477
lypinator 0:bb348c97df44 478 /** @brief Checks whether the specified QSPI interrupt source is enabled.
lypinator 0:bb348c97df44 479 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 480 * @param __INTERRUPT__ specifies the QSPI interrupt source to check.
lypinator 0:bb348c97df44 481 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 482 * @arg QSPI_IT_TO: QSPI Time out interrupt
lypinator 0:bb348c97df44 483 * @arg QSPI_IT_SM: QSPI Status match interrupt
lypinator 0:bb348c97df44 484 * @arg QSPI_IT_FT: QSPI FIFO threshold interrupt
lypinator 0:bb348c97df44 485 * @arg QSPI_IT_TC: QSPI Transfer complete interrupt
lypinator 0:bb348c97df44 486 * @arg QSPI_IT_TE: QSPI Transfer error interrupt
lypinator 0:bb348c97df44 487 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
lypinator 0:bb348c97df44 488 */
lypinator 0:bb348c97df44 489 #define __HAL_QSPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__)) == (__INTERRUPT__))
lypinator 0:bb348c97df44 490
lypinator 0:bb348c97df44 491 /**
lypinator 0:bb348c97df44 492 * @brief Get the selected QSPI's flag status.
lypinator 0:bb348c97df44 493 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 494 * @param __FLAG__ specifies the QSPI flag to check.
lypinator 0:bb348c97df44 495 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 496 * @arg QSPI_FLAG_BUSY: QSPI Busy flag
lypinator 0:bb348c97df44 497 * @arg QSPI_FLAG_TO: QSPI Time out flag
lypinator 0:bb348c97df44 498 * @arg QSPI_FLAG_SM: QSPI Status match flag
lypinator 0:bb348c97df44 499 * @arg QSPI_FLAG_FT: QSPI FIFO threshold flag
lypinator 0:bb348c97df44 500 * @arg QSPI_FLAG_TC: QSPI Transfer complete flag
lypinator 0:bb348c97df44 501 * @arg QSPI_FLAG_TE: QSPI Transfer error flag
lypinator 0:bb348c97df44 502 * @retval None
lypinator 0:bb348c97df44 503 */
lypinator 0:bb348c97df44 504 #define __HAL_QSPI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->SR, (__FLAG__)) != 0U)
lypinator 0:bb348c97df44 505
lypinator 0:bb348c97df44 506 /** @brief Clears the specified QSPI's flag status.
lypinator 0:bb348c97df44 507 * @param __HANDLE__ specifies the QSPI Handle.
lypinator 0:bb348c97df44 508 * @param __FLAG__ specifies the QSPI clear register flag that needs to be set
lypinator 0:bb348c97df44 509 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 510 * @arg QSPI_FLAG_TO: QSPI Time out flag
lypinator 0:bb348c97df44 511 * @arg QSPI_FLAG_SM: QSPI Status match flag
lypinator 0:bb348c97df44 512 * @arg QSPI_FLAG_TC: QSPI Transfer complete flag
lypinator 0:bb348c97df44 513 * @arg QSPI_FLAG_TE: QSPI Transfer error flag
lypinator 0:bb348c97df44 514 * @retval None
lypinator 0:bb348c97df44 515 */
lypinator 0:bb348c97df44 516 #define __HAL_QSPI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->FCR, (__FLAG__))
lypinator 0:bb348c97df44 517 /**
lypinator 0:bb348c97df44 518 * @}
lypinator 0:bb348c97df44 519 */
lypinator 0:bb348c97df44 520
lypinator 0:bb348c97df44 521 /* Exported functions --------------------------------------------------------*/
lypinator 0:bb348c97df44 522 /** @addtogroup QSPI_Exported_Functions
lypinator 0:bb348c97df44 523 * @{
lypinator 0:bb348c97df44 524 */
lypinator 0:bb348c97df44 525
lypinator 0:bb348c97df44 526 /** @addtogroup QSPI_Exported_Functions_Group1
lypinator 0:bb348c97df44 527 * @{
lypinator 0:bb348c97df44 528 */
lypinator 0:bb348c97df44 529 /* Initialization/de-initialization functions ********************************/
lypinator 0:bb348c97df44 530 HAL_StatusTypeDef HAL_QSPI_Init (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 531 HAL_StatusTypeDef HAL_QSPI_DeInit (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 532 void HAL_QSPI_MspInit (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 533 void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 534 /**
lypinator 0:bb348c97df44 535 * @}
lypinator 0:bb348c97df44 536 */
lypinator 0:bb348c97df44 537
lypinator 0:bb348c97df44 538 /** @addtogroup QSPI_Exported_Functions_Group2
lypinator 0:bb348c97df44 539 * @{
lypinator 0:bb348c97df44 540 */
lypinator 0:bb348c97df44 541 /* IO operation functions *****************************************************/
lypinator 0:bb348c97df44 542 /* QSPI IRQ handler method */
lypinator 0:bb348c97df44 543 void HAL_QSPI_IRQHandler(QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 544
lypinator 0:bb348c97df44 545 /* QSPI indirect mode */
lypinator 0:bb348c97df44 546 HAL_StatusTypeDef HAL_QSPI_Command (QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, uint32_t Timeout);
lypinator 0:bb348c97df44 547 HAL_StatusTypeDef HAL_QSPI_Transmit (QSPI_HandleTypeDef *hqspi, uint8_t *pData, uint32_t Timeout);
lypinator 0:bb348c97df44 548 HAL_StatusTypeDef HAL_QSPI_Receive (QSPI_HandleTypeDef *hqspi, uint8_t *pData, uint32_t Timeout);
lypinator 0:bb348c97df44 549 HAL_StatusTypeDef HAL_QSPI_Command_IT (QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd);
lypinator 0:bb348c97df44 550 HAL_StatusTypeDef HAL_QSPI_Transmit_IT (QSPI_HandleTypeDef *hqspi, uint8_t *pData);
lypinator 0:bb348c97df44 551 HAL_StatusTypeDef HAL_QSPI_Receive_IT (QSPI_HandleTypeDef *hqspi, uint8_t *pData);
lypinator 0:bb348c97df44 552 HAL_StatusTypeDef HAL_QSPI_Transmit_DMA (QSPI_HandleTypeDef *hqspi, uint8_t *pData);
lypinator 0:bb348c97df44 553 HAL_StatusTypeDef HAL_QSPI_Receive_DMA (QSPI_HandleTypeDef *hqspi, uint8_t *pData);
lypinator 0:bb348c97df44 554
lypinator 0:bb348c97df44 555 /* QSPI status flag polling mode */
lypinator 0:bb348c97df44 556 HAL_StatusTypeDef HAL_QSPI_AutoPolling (QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, QSPI_AutoPollingTypeDef *cfg, uint32_t Timeout);
lypinator 0:bb348c97df44 557 HAL_StatusTypeDef HAL_QSPI_AutoPolling_IT(QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, QSPI_AutoPollingTypeDef *cfg);
lypinator 0:bb348c97df44 558
lypinator 0:bb348c97df44 559 /* QSPI memory-mapped mode */
lypinator 0:bb348c97df44 560 HAL_StatusTypeDef HAL_QSPI_MemoryMapped(QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, QSPI_MemoryMappedTypeDef *cfg);
lypinator 0:bb348c97df44 561 /**
lypinator 0:bb348c97df44 562 * @}
lypinator 0:bb348c97df44 563 */
lypinator 0:bb348c97df44 564
lypinator 0:bb348c97df44 565 /** @addtogroup QSPI_Exported_Functions_Group3
lypinator 0:bb348c97df44 566 * @{
lypinator 0:bb348c97df44 567 */
lypinator 0:bb348c97df44 568 /* Callback functions in non-blocking modes ***********************************/
lypinator 0:bb348c97df44 569 void HAL_QSPI_ErrorCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 570 void HAL_QSPI_AbortCpltCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 571 void HAL_QSPI_FifoThresholdCallback(QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 572
lypinator 0:bb348c97df44 573 /* QSPI indirect mode */
lypinator 0:bb348c97df44 574 void HAL_QSPI_CmdCpltCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 575 void HAL_QSPI_RxCpltCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 576 void HAL_QSPI_TxCpltCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 577 void HAL_QSPI_RxHalfCpltCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 578 void HAL_QSPI_TxHalfCpltCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 579
lypinator 0:bb348c97df44 580 /* QSPI status flag polling mode */
lypinator 0:bb348c97df44 581 void HAL_QSPI_StatusMatchCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 582
lypinator 0:bb348c97df44 583 /* QSPI memory-mapped mode */
lypinator 0:bb348c97df44 584 void HAL_QSPI_TimeOutCallback (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 585 /**
lypinator 0:bb348c97df44 586 * @}
lypinator 0:bb348c97df44 587 */
lypinator 0:bb348c97df44 588
lypinator 0:bb348c97df44 589 /** @addtogroup QSPI_Exported_Functions_Group4
lypinator 0:bb348c97df44 590 * @{
lypinator 0:bb348c97df44 591 */
lypinator 0:bb348c97df44 592 /* Peripheral Control and State functions ************************************/
lypinator 0:bb348c97df44 593 HAL_QSPI_StateTypeDef HAL_QSPI_GetState (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 594 uint32_t HAL_QSPI_GetError (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 595 HAL_StatusTypeDef HAL_QSPI_Abort (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 596 HAL_StatusTypeDef HAL_QSPI_Abort_IT (QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 597 void HAL_QSPI_SetTimeout (QSPI_HandleTypeDef *hqspi, uint32_t Timeout);
lypinator 0:bb348c97df44 598 HAL_StatusTypeDef HAL_QSPI_SetFifoThreshold(QSPI_HandleTypeDef *hqspi, uint32_t Threshold);
lypinator 0:bb348c97df44 599 uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi);
lypinator 0:bb348c97df44 600 /**
lypinator 0:bb348c97df44 601 * @}
lypinator 0:bb348c97df44 602 */
lypinator 0:bb348c97df44 603
lypinator 0:bb348c97df44 604 /* Private macros ------------------------------------------------------------*/
lypinator 0:bb348c97df44 605 /** @defgroup QSPI_Private_Macros QSPI Private Macros
lypinator 0:bb348c97df44 606 * @{
lypinator 0:bb348c97df44 607 */
lypinator 0:bb348c97df44 608 /** @defgroup QSPI_ClockPrescaler QSPI Clock Prescaler
lypinator 0:bb348c97df44 609 * @{
lypinator 0:bb348c97df44 610 */
lypinator 0:bb348c97df44 611 #define IS_QSPI_CLOCK_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFU)
lypinator 0:bb348c97df44 612 /**
lypinator 0:bb348c97df44 613 * @}
lypinator 0:bb348c97df44 614 */
lypinator 0:bb348c97df44 615
lypinator 0:bb348c97df44 616 /** @defgroup QSPI_FifoThreshold QSPI Fifo Threshold
lypinator 0:bb348c97df44 617 * @{
lypinator 0:bb348c97df44 618 */
lypinator 0:bb348c97df44 619 #define IS_QSPI_FIFO_THRESHOLD(THR) (((THR) > 0U) && ((THR) <= 32U))
lypinator 0:bb348c97df44 620 /**
lypinator 0:bb348c97df44 621 * @}
lypinator 0:bb348c97df44 622 */
lypinator 0:bb348c97df44 623
lypinator 0:bb348c97df44 624 #define IS_QSPI_SSHIFT(SSHIFT) (((SSHIFT) == QSPI_SAMPLE_SHIFTING_NONE) || \
lypinator 0:bb348c97df44 625 ((SSHIFT) == QSPI_SAMPLE_SHIFTING_HALFCYCLE))
lypinator 0:bb348c97df44 626
lypinator 0:bb348c97df44 627 /** @defgroup QSPI_FlashSize QSPI Flash Size
lypinator 0:bb348c97df44 628 * @{
lypinator 0:bb348c97df44 629 */
lypinator 0:bb348c97df44 630 #define IS_QSPI_FLASH_SIZE(FSIZE) (((FSIZE) <= 31U))
lypinator 0:bb348c97df44 631 /**
lypinator 0:bb348c97df44 632 * @}
lypinator 0:bb348c97df44 633 */
lypinator 0:bb348c97df44 634
lypinator 0:bb348c97df44 635 #define IS_QSPI_CS_HIGH_TIME(CSHTIME) (((CSHTIME) == QSPI_CS_HIGH_TIME_1_CYCLE) || \
lypinator 0:bb348c97df44 636 ((CSHTIME) == QSPI_CS_HIGH_TIME_2_CYCLE) || \
lypinator 0:bb348c97df44 637 ((CSHTIME) == QSPI_CS_HIGH_TIME_3_CYCLE) || \
lypinator 0:bb348c97df44 638 ((CSHTIME) == QSPI_CS_HIGH_TIME_4_CYCLE) || \
lypinator 0:bb348c97df44 639 ((CSHTIME) == QSPI_CS_HIGH_TIME_5_CYCLE) || \
lypinator 0:bb348c97df44 640 ((CSHTIME) == QSPI_CS_HIGH_TIME_6_CYCLE) || \
lypinator 0:bb348c97df44 641 ((CSHTIME) == QSPI_CS_HIGH_TIME_7_CYCLE) || \
lypinator 0:bb348c97df44 642 ((CSHTIME) == QSPI_CS_HIGH_TIME_8_CYCLE))
lypinator 0:bb348c97df44 643
lypinator 0:bb348c97df44 644 #define IS_QSPI_CLOCK_MODE(CLKMODE) (((CLKMODE) == QSPI_CLOCK_MODE_0) || \
lypinator 0:bb348c97df44 645 ((CLKMODE) == QSPI_CLOCK_MODE_3))
lypinator 0:bb348c97df44 646
lypinator 0:bb348c97df44 647 #define IS_QSPI_FLASH_ID(FLA) (((FLA) == QSPI_FLASH_ID_1) || \
lypinator 0:bb348c97df44 648 ((FLA) == QSPI_FLASH_ID_2))
lypinator 0:bb348c97df44 649
lypinator 0:bb348c97df44 650 #define IS_QSPI_DUAL_FLASH_MODE(MODE) (((MODE) == QSPI_DUALFLASH_ENABLE) || \
lypinator 0:bb348c97df44 651 ((MODE) == QSPI_DUALFLASH_DISABLE))
lypinator 0:bb348c97df44 652
lypinator 0:bb348c97df44 653
lypinator 0:bb348c97df44 654 /** @defgroup QSPI_Instruction QSPI Instruction
lypinator 0:bb348c97df44 655 * @{
lypinator 0:bb348c97df44 656 */
lypinator 0:bb348c97df44 657 #define IS_QSPI_INSTRUCTION(INSTRUCTION) ((INSTRUCTION) <= 0xFFU)
lypinator 0:bb348c97df44 658 /**
lypinator 0:bb348c97df44 659 * @}
lypinator 0:bb348c97df44 660 */
lypinator 0:bb348c97df44 661
lypinator 0:bb348c97df44 662 #define IS_QSPI_ADDRESS_SIZE(ADDR_SIZE) (((ADDR_SIZE) == QSPI_ADDRESS_8_BITS) || \
lypinator 0:bb348c97df44 663 ((ADDR_SIZE) == QSPI_ADDRESS_16_BITS) || \
lypinator 0:bb348c97df44 664 ((ADDR_SIZE) == QSPI_ADDRESS_24_BITS) || \
lypinator 0:bb348c97df44 665 ((ADDR_SIZE) == QSPI_ADDRESS_32_BITS))
lypinator 0:bb348c97df44 666
lypinator 0:bb348c97df44 667 #define IS_QSPI_ALTERNATE_BYTES_SIZE(SIZE) (((SIZE) == QSPI_ALTERNATE_BYTES_8_BITS) || \
lypinator 0:bb348c97df44 668 ((SIZE) == QSPI_ALTERNATE_BYTES_16_BITS) || \
lypinator 0:bb348c97df44 669 ((SIZE) == QSPI_ALTERNATE_BYTES_24_BITS) || \
lypinator 0:bb348c97df44 670 ((SIZE) == QSPI_ALTERNATE_BYTES_32_BITS))
lypinator 0:bb348c97df44 671
lypinator 0:bb348c97df44 672
lypinator 0:bb348c97df44 673 /** @defgroup QSPI_DummyCycles QSPI Dummy Cycles
lypinator 0:bb348c97df44 674 * @{
lypinator 0:bb348c97df44 675 */
lypinator 0:bb348c97df44 676 #define IS_QSPI_DUMMY_CYCLES(DCY) ((DCY) <= 31U)
lypinator 0:bb348c97df44 677 /**
lypinator 0:bb348c97df44 678 * @}
lypinator 0:bb348c97df44 679 */
lypinator 0:bb348c97df44 680
lypinator 0:bb348c97df44 681 #define IS_QSPI_INSTRUCTION_MODE(MODE) (((MODE) == QSPI_INSTRUCTION_NONE) || \
lypinator 0:bb348c97df44 682 ((MODE) == QSPI_INSTRUCTION_1_LINE) || \
lypinator 0:bb348c97df44 683 ((MODE) == QSPI_INSTRUCTION_2_LINES) || \
lypinator 0:bb348c97df44 684 ((MODE) == QSPI_INSTRUCTION_4_LINES))
lypinator 0:bb348c97df44 685
lypinator 0:bb348c97df44 686 #define IS_QSPI_ADDRESS_MODE(MODE) (((MODE) == QSPI_ADDRESS_NONE) || \
lypinator 0:bb348c97df44 687 ((MODE) == QSPI_ADDRESS_1_LINE) || \
lypinator 0:bb348c97df44 688 ((MODE) == QSPI_ADDRESS_2_LINES) || \
lypinator 0:bb348c97df44 689 ((MODE) == QSPI_ADDRESS_4_LINES))
lypinator 0:bb348c97df44 690
lypinator 0:bb348c97df44 691 #define IS_QSPI_ALTERNATE_BYTES_MODE(MODE) (((MODE) == QSPI_ALTERNATE_BYTES_NONE) || \
lypinator 0:bb348c97df44 692 ((MODE) == QSPI_ALTERNATE_BYTES_1_LINE) || \
lypinator 0:bb348c97df44 693 ((MODE) == QSPI_ALTERNATE_BYTES_2_LINES) || \
lypinator 0:bb348c97df44 694 ((MODE) == QSPI_ALTERNATE_BYTES_4_LINES))
lypinator 0:bb348c97df44 695
lypinator 0:bb348c97df44 696 #define IS_QSPI_DATA_MODE(MODE) (((MODE) == QSPI_DATA_NONE) || \
lypinator 0:bb348c97df44 697 ((MODE) == QSPI_DATA_1_LINE) || \
lypinator 0:bb348c97df44 698 ((MODE) == QSPI_DATA_2_LINES) || \
lypinator 0:bb348c97df44 699 ((MODE) == QSPI_DATA_4_LINES))
lypinator 0:bb348c97df44 700
lypinator 0:bb348c97df44 701 #define IS_QSPI_DDR_MODE(DDR_MODE) (((DDR_MODE) == QSPI_DDR_MODE_DISABLE) || \
lypinator 0:bb348c97df44 702 ((DDR_MODE) == QSPI_DDR_MODE_ENABLE))
lypinator 0:bb348c97df44 703
lypinator 0:bb348c97df44 704 #define IS_QSPI_DDR_HHC(DDR_HHC) (((DDR_HHC) == QSPI_DDR_HHC_ANALOG_DELAY) || \
lypinator 0:bb348c97df44 705 ((DDR_HHC) == QSPI_DDR_HHC_HALF_CLK_DELAY))
lypinator 0:bb348c97df44 706
lypinator 0:bb348c97df44 707 #define IS_QSPI_SIOO_MODE(SIOO_MODE) (((SIOO_MODE) == QSPI_SIOO_INST_EVERY_CMD) || \
lypinator 0:bb348c97df44 708 ((SIOO_MODE) == QSPI_SIOO_INST_ONLY_FIRST_CMD))
lypinator 0:bb348c97df44 709
lypinator 0:bb348c97df44 710 /** @defgroup QSPI_Interval QSPI Interval
lypinator 0:bb348c97df44 711 * @{
lypinator 0:bb348c97df44 712 */
lypinator 0:bb348c97df44 713 #define IS_QSPI_INTERVAL(INTERVAL) ((INTERVAL) <= QUADSPI_PIR_INTERVAL)
lypinator 0:bb348c97df44 714 /**
lypinator 0:bb348c97df44 715 * @}
lypinator 0:bb348c97df44 716 */
lypinator 0:bb348c97df44 717
lypinator 0:bb348c97df44 718 /** @defgroup QSPI_StatusBytesSize QSPI Status Bytes Size
lypinator 0:bb348c97df44 719 * @{
lypinator 0:bb348c97df44 720 */
lypinator 0:bb348c97df44 721 #define IS_QSPI_STATUS_BYTES_SIZE(SIZE) (((SIZE) >= 1U) && ((SIZE) <= 4U))
lypinator 0:bb348c97df44 722 /**
lypinator 0:bb348c97df44 723 * @}
lypinator 0:bb348c97df44 724 */
lypinator 0:bb348c97df44 725 #define IS_QSPI_MATCH_MODE(MODE) (((MODE) == QSPI_MATCH_MODE_AND) || \
lypinator 0:bb348c97df44 726 ((MODE) == QSPI_MATCH_MODE_OR))
lypinator 0:bb348c97df44 727
lypinator 0:bb348c97df44 728 #define IS_QSPI_AUTOMATIC_STOP(APMS) (((APMS) == QSPI_AUTOMATIC_STOP_DISABLE) || \
lypinator 0:bb348c97df44 729 ((APMS) == QSPI_AUTOMATIC_STOP_ENABLE))
lypinator 0:bb348c97df44 730
lypinator 0:bb348c97df44 731 #define IS_QSPI_TIMEOUT_ACTIVATION(TCEN) (((TCEN) == QSPI_TIMEOUT_COUNTER_DISABLE) || \
lypinator 0:bb348c97df44 732 ((TCEN) == QSPI_TIMEOUT_COUNTER_ENABLE))
lypinator 0:bb348c97df44 733
lypinator 0:bb348c97df44 734 /** @defgroup QSPI_TimeOutPeriod QSPI TimeOut Period
lypinator 0:bb348c97df44 735 * @{
lypinator 0:bb348c97df44 736 */
lypinator 0:bb348c97df44 737 #define IS_QSPI_TIMEOUT_PERIOD(PERIOD) ((PERIOD) <= 0xFFFFU)
lypinator 0:bb348c97df44 738 /**
lypinator 0:bb348c97df44 739 * @}
lypinator 0:bb348c97df44 740 */
lypinator 0:bb348c97df44 741
lypinator 0:bb348c97df44 742 #define IS_QSPI_GET_FLAG(FLAG) (((FLAG) == QSPI_FLAG_BUSY) || \
lypinator 0:bb348c97df44 743 ((FLAG) == QSPI_FLAG_TO) || \
lypinator 0:bb348c97df44 744 ((FLAG) == QSPI_FLAG_SM) || \
lypinator 0:bb348c97df44 745 ((FLAG) == QSPI_FLAG_FT) || \
lypinator 0:bb348c97df44 746 ((FLAG) == QSPI_FLAG_TC) || \
lypinator 0:bb348c97df44 747 ((FLAG) == QSPI_FLAG_TE))
lypinator 0:bb348c97df44 748
lypinator 0:bb348c97df44 749 #define IS_QSPI_IT(IT) ((((IT) & 0xFFE0FFFFU) == 0x00000000U) && ((IT) != 0x00000000U))
lypinator 0:bb348c97df44 750 /**
lypinator 0:bb348c97df44 751 * @}
lypinator 0:bb348c97df44 752 */
lypinator 0:bb348c97df44 753
lypinator 0:bb348c97df44 754 /* Private functions ---------------------------------------------------------*/
lypinator 0:bb348c97df44 755 /** @defgroup QSPI_Private_Functions QSPI Private Functions
lypinator 0:bb348c97df44 756 * @{
lypinator 0:bb348c97df44 757 */
lypinator 0:bb348c97df44 758
lypinator 0:bb348c97df44 759 /**
lypinator 0:bb348c97df44 760 * @}
lypinator 0:bb348c97df44 761 */
lypinator 0:bb348c97df44 762
lypinator 0:bb348c97df44 763 /**
lypinator 0:bb348c97df44 764 * @}
lypinator 0:bb348c97df44 765 */
lypinator 0:bb348c97df44 766
lypinator 0:bb348c97df44 767 /**
lypinator 0:bb348c97df44 768 * @}
lypinator 0:bb348c97df44 769 */
lypinator 0:bb348c97df44 770
lypinator 0:bb348c97df44 771 /**
lypinator 0:bb348c97df44 772 * @}
lypinator 0:bb348c97df44 773 */
lypinator 0:bb348c97df44 774 #endif /* STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx ||
lypinator 0:bb348c97df44 775 STM32F413xx || STM32F423xx */
lypinator 0:bb348c97df44 776
lypinator 0:bb348c97df44 777 #ifdef __cplusplus
lypinator 0:bb348c97df44 778 }
lypinator 0:bb348c97df44 779 #endif
lypinator 0:bb348c97df44 780
lypinator 0:bb348c97df44 781 #endif /* __STM32F4xx_HAL_QSPI_H */
lypinator 0:bb348c97df44 782
lypinator 0:bb348c97df44 783 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/