Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

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