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