mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Aug 14 13:15:17 2015 +0100
Revision:
610:813dcc80987e
Synchronized with git revision 6d84db41c6833e0b9b024741eb0616a5f62d5599

Full URL: https://github.com/mbedmicro/mbed/commit/6d84db41c6833e0b9b024741eb0616a5f62d5599/

DISCO_F746NG - Improvements

Who changed what in which revision?

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