mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 189:f392fc9709a3 1 /**
AnnaBridge 189:f392fc9709a3 2 ******************************************************************************
AnnaBridge 189:f392fc9709a3 3 * @file stm32l4xx_hal_ospi.h
AnnaBridge 189:f392fc9709a3 4 * @author MCD Application Team
AnnaBridge 189:f392fc9709a3 5 * @brief Header file of OSPI HAL module.
AnnaBridge 189:f392fc9709a3 6 ******************************************************************************
AnnaBridge 189:f392fc9709a3 7 * @attention
AnnaBridge 189:f392fc9709a3 8 *
AnnaBridge 189:f392fc9709a3 9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
AnnaBridge 189:f392fc9709a3 10 *
AnnaBridge 189:f392fc9709a3 11 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 189:f392fc9709a3 12 * are permitted provided that the following conditions are met:
AnnaBridge 189:f392fc9709a3 13 * 1. Redistributions of source code must retain the above copyright notice,
AnnaBridge 189:f392fc9709a3 14 * this list of conditions and the following disclaimer.
AnnaBridge 189:f392fc9709a3 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
AnnaBridge 189:f392fc9709a3 16 * this list of conditions and the following disclaimer in the documentation
AnnaBridge 189:f392fc9709a3 17 * and/or other materials provided with the distribution.
AnnaBridge 189:f392fc9709a3 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
AnnaBridge 189:f392fc9709a3 19 * may be used to endorse or promote products derived from this software
AnnaBridge 189:f392fc9709a3 20 * without specific prior written permission.
AnnaBridge 189:f392fc9709a3 21 *
AnnaBridge 189:f392fc9709a3 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AnnaBridge 189:f392fc9709a3 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
AnnaBridge 189:f392fc9709a3 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 189:f392fc9709a3 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
AnnaBridge 189:f392fc9709a3 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
AnnaBridge 189:f392fc9709a3 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
AnnaBridge 189:f392fc9709a3 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
AnnaBridge 189:f392fc9709a3 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
AnnaBridge 189:f392fc9709a3 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
AnnaBridge 189:f392fc9709a3 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 189:f392fc9709a3 32 *
AnnaBridge 189:f392fc9709a3 33 ******************************************************************************
AnnaBridge 189:f392fc9709a3 34 */
AnnaBridge 189:f392fc9709a3 35
AnnaBridge 189:f392fc9709a3 36 /* Define to prevent recursive inclusion -------------------------------------*/
AnnaBridge 189:f392fc9709a3 37 #ifndef __STM32L4xx_HAL_OSPI_H
AnnaBridge 189:f392fc9709a3 38 #define __STM32L4xx_HAL_OSPI_H
AnnaBridge 189:f392fc9709a3 39
AnnaBridge 189:f392fc9709a3 40 #ifdef __cplusplus
AnnaBridge 189:f392fc9709a3 41 extern "C" {
AnnaBridge 189:f392fc9709a3 42 #endif
AnnaBridge 189:f392fc9709a3 43
AnnaBridge 189:f392fc9709a3 44 /* Includes ------------------------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 45 #include "stm32l4xx_hal_def.h"
AnnaBridge 189:f392fc9709a3 46
AnnaBridge 189:f392fc9709a3 47 #if defined(OCTOSPI) || defined(OCTOSPI1) || defined(OCTOSPI2)
AnnaBridge 189:f392fc9709a3 48
AnnaBridge 189:f392fc9709a3 49 /** @addtogroup STM32L4xx_HAL_Driver
AnnaBridge 189:f392fc9709a3 50 * @{
AnnaBridge 189:f392fc9709a3 51 */
AnnaBridge 189:f392fc9709a3 52
AnnaBridge 189:f392fc9709a3 53 /** @addtogroup OSPI
AnnaBridge 189:f392fc9709a3 54 * @{
AnnaBridge 189:f392fc9709a3 55 */
AnnaBridge 189:f392fc9709a3 56
AnnaBridge 189:f392fc9709a3 57 /* Exported types ------------------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 58 /** @defgroup OSPI_Exported_Types OSPI Exported Types
AnnaBridge 189:f392fc9709a3 59 * @{
AnnaBridge 189:f392fc9709a3 60 */
AnnaBridge 189:f392fc9709a3 61
AnnaBridge 189:f392fc9709a3 62 /**
AnnaBridge 189:f392fc9709a3 63 * @brief OSPI Init structure definition
AnnaBridge 189:f392fc9709a3 64 */
AnnaBridge 189:f392fc9709a3 65 typedef struct
AnnaBridge 189:f392fc9709a3 66 {
AnnaBridge 189:f392fc9709a3 67 uint32_t FifoThreshold; /* This is the threshold used byt the IP to generate the interrupt
AnnaBridge 189:f392fc9709a3 68 indicating that data are available in reception or free place
AnnaBridge 189:f392fc9709a3 69 is available in transmission.
AnnaBridge 189:f392fc9709a3 70 This parameter can be a value between 1 and 32 */
AnnaBridge 189:f392fc9709a3 71 uint32_t DualQuad; /* It enables or not the dual-quad mode which allow to access up to
AnnaBridge 189:f392fc9709a3 72 quad mode on two different devices to increase the throughput.
AnnaBridge 189:f392fc9709a3 73 This parameter can be a value of @ref OSPI_DualQuad */
AnnaBridge 189:f392fc9709a3 74 uint32_t MemoryType; /* It indicates the external device type connected to the OSPI.
AnnaBridge 189:f392fc9709a3 75 This parameter can be a value of @ref OSPI_MemoryType */
AnnaBridge 189:f392fc9709a3 76 uint32_t DeviceSize; /* It defines the size of the external device connected to the OSPI,
AnnaBridge 189:f392fc9709a3 77 it corresponds to the number of address bits required to access
AnnaBridge 189:f392fc9709a3 78 the external device.
AnnaBridge 189:f392fc9709a3 79 This parameter can be a value between 1 and 32 */
AnnaBridge 189:f392fc9709a3 80 uint32_t ChipSelectHighTime; /* It defines the minimun number of clocks which the chip select
AnnaBridge 189:f392fc9709a3 81 must remain high between commands.
AnnaBridge 189:f392fc9709a3 82 This parameter can be a value between 1 and 8 */
AnnaBridge 189:f392fc9709a3 83 uint32_t FreeRunningClock; /* It enables or not the free running clock.
AnnaBridge 189:f392fc9709a3 84 This parameter can be a value of @ref OSPI_FreeRunningClock */
AnnaBridge 189:f392fc9709a3 85 uint32_t ClockMode; /* It indicates the level of clock when the chip select is released.
AnnaBridge 189:f392fc9709a3 86 This parameter can be a value of @ref OSPI_ClockMode */
AnnaBridge 189:f392fc9709a3 87 uint32_t WrapSize; /* It indicates the wrap-size corresponding the external device configuration.
AnnaBridge 189:f392fc9709a3 88 This parameter can be a value of @ref OSPI_WrapSize */
AnnaBridge 189:f392fc9709a3 89 uint32_t ClockPrescaler; /* It specifies the prescaler factor used for generating
AnnaBridge 189:f392fc9709a3 90 the external clock based on the AHB clock.
AnnaBridge 189:f392fc9709a3 91 This parameter can be a value between 1 and 256 */
AnnaBridge 189:f392fc9709a3 92 uint32_t SampleShifting; /* It allows to delay to 1/2 cycle the data sampling in order
AnnaBridge 189:f392fc9709a3 93 to take in account external signal delays.
AnnaBridge 189:f392fc9709a3 94 This parameter can be a value of @ref OSPI_SampleShifting */
AnnaBridge 189:f392fc9709a3 95 uint32_t DelayHoldQuarterCycle; /* It allows to hold to 1/4 cycle the data.
AnnaBridge 189:f392fc9709a3 96 This parameter can be a value of @ref OSPI_DelayHoldQuarterCycle */
AnnaBridge 189:f392fc9709a3 97 uint32_t ChipSelectBoundary; /* It enables the transaction boundary feature and
AnnaBridge 189:f392fc9709a3 98 defines the boundary of bytes to release the chip select.
AnnaBridge 189:f392fc9709a3 99 This parameter can be a value between 0 and 31 */
AnnaBridge 189:f392fc9709a3 100 }OSPI_InitTypeDef;
AnnaBridge 189:f392fc9709a3 101
AnnaBridge 189:f392fc9709a3 102 /**
AnnaBridge 189:f392fc9709a3 103 * @brief HAL OSPI Handle Structure definition
AnnaBridge 189:f392fc9709a3 104 */
AnnaBridge 189:f392fc9709a3 105 typedef struct
AnnaBridge 189:f392fc9709a3 106 {
AnnaBridge 189:f392fc9709a3 107 OCTOSPI_TypeDef *Instance; /* OSPI registers base address */
AnnaBridge 189:f392fc9709a3 108 OSPI_InitTypeDef Init; /* OSPI initialization parameters */
AnnaBridge 189:f392fc9709a3 109 uint8_t *pBuffPtr; /* Address of the OSPI buffer for transfer */
AnnaBridge 189:f392fc9709a3 110 __IO uint32_t XferSize; /* Number of data to transfer */
AnnaBridge 189:f392fc9709a3 111 __IO uint32_t XferCount; /* Counter of data transferred */
AnnaBridge 189:f392fc9709a3 112 DMA_HandleTypeDef *hdma; /* Handle of the DMA channel used for the transfer */
AnnaBridge 189:f392fc9709a3 113 __IO uint32_t State; /* Internal state of the OSPI HAL driver */
AnnaBridge 189:f392fc9709a3 114 __IO uint32_t ErrorCode; /* Error code in case of HAL driver internal error */
AnnaBridge 189:f392fc9709a3 115 uint32_t Timeout; /* Timeout used for the OSPI external device access */
AnnaBridge 189:f392fc9709a3 116 }OSPI_HandleTypeDef;
AnnaBridge 189:f392fc9709a3 117
AnnaBridge 189:f392fc9709a3 118 /**
AnnaBridge 189:f392fc9709a3 119 * @brief HAL OSPI Regular Command Structure definition
AnnaBridge 189:f392fc9709a3 120 */
AnnaBridge 189:f392fc9709a3 121 typedef struct
AnnaBridge 189:f392fc9709a3 122 {
AnnaBridge 189:f392fc9709a3 123 uint32_t OperationType; /* It indicates if the configuration applies to the common regsiters or
AnnaBridge 189:f392fc9709a3 124 to the registers for the write operation (these registers are only
AnnaBridge 189:f392fc9709a3 125 used for memory-mapped mode).
AnnaBridge 189:f392fc9709a3 126 This parameter can be a value of @ref OSPI_OperationType */
AnnaBridge 189:f392fc9709a3 127 uint32_t FlashId; /* It indicates which external device is selected for this command (it
AnnaBridge 189:f392fc9709a3 128 applies only if Dualquad is disabled in the initialization structure).
AnnaBridge 189:f392fc9709a3 129 This parameter can be a value of @ref OSPI_FlashId */
AnnaBridge 189:f392fc9709a3 130 uint32_t Instruction; /* It contains the instruction to be sent to the device.
AnnaBridge 189:f392fc9709a3 131 This parameter can be a value between 0 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 132 uint32_t InstructionMode; /* It indicates the mode of the instruction.
AnnaBridge 189:f392fc9709a3 133 This parameter can be a value of @ref OSPI_InstructionMode */
AnnaBridge 189:f392fc9709a3 134 uint32_t InstructionSize; /* It indicates the size of the instruction.
AnnaBridge 189:f392fc9709a3 135 This parameter can be a value of @ref OSPI_InstructionSize */
AnnaBridge 189:f392fc9709a3 136 uint32_t InstructionDtrMode; /* It enables or not the DTR mode for the instruction phase.
AnnaBridge 189:f392fc9709a3 137 This parameter can be a value of @ref OSPI_InstructionDtrMode */
AnnaBridge 189:f392fc9709a3 138 uint32_t Address; /* It contains the address to be sent to the device.
AnnaBridge 189:f392fc9709a3 139 This parameter can be a value between 0 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 140 uint32_t AddressMode; /* It indicates the mode of the address.
AnnaBridge 189:f392fc9709a3 141 This parameter can be a value of @ref OSPI_AddressMode */
AnnaBridge 189:f392fc9709a3 142 uint32_t AddressSize; /* It indicates the size of the address.
AnnaBridge 189:f392fc9709a3 143 This parameter can be a value of @ref OSPI_AddressSize */
AnnaBridge 189:f392fc9709a3 144 uint32_t AddressDtrMode; /* It enables or not the DTR mode for the address phase.
AnnaBridge 189:f392fc9709a3 145 This parameter can be a value of @ref OSPI_AddressDtrMode */
AnnaBridge 189:f392fc9709a3 146 uint32_t AlternateBytes; /* It contains the alternate bytes to be sent to the device.
AnnaBridge 189:f392fc9709a3 147 This parameter can be a value between 0 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 148 uint32_t AlternateBytesMode; /* It indicates the mode of the alternate bytes.
AnnaBridge 189:f392fc9709a3 149 This parameter can be a value of @ref OSPI_AlternateBytesMode */
AnnaBridge 189:f392fc9709a3 150 uint32_t AlternateBytesSize; /* It indicates the size of the alternate bytes.
AnnaBridge 189:f392fc9709a3 151 This parameter can be a value of @ref OSPI_AlternateBytesSize */
AnnaBridge 189:f392fc9709a3 152 uint32_t AlternateBytesDtrMode; /* It enables or not the DTR mode for the alternate bytes phase.
AnnaBridge 189:f392fc9709a3 153 This parameter can be a value of @ref OSPI_AlternateBytesDtrMode */
AnnaBridge 189:f392fc9709a3 154 uint32_t DataMode; /* It indicates the mode of the data.
AnnaBridge 189:f392fc9709a3 155 This parameter can be a value of @ref OSPI_DataMode */
AnnaBridge 189:f392fc9709a3 156 uint32_t NbData; /* It indicates the number of data transferred with this command.
AnnaBridge 189:f392fc9709a3 157 This field is only used for indirect mode.
AnnaBridge 189:f392fc9709a3 158 This parameter can be a value between 1 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 159 uint32_t DataDtrMode; /* It enables or not the DTR mode for the data phase.
AnnaBridge 189:f392fc9709a3 160 This parameter can be a value of @ref OSPI_DataDtrMode */
AnnaBridge 189:f392fc9709a3 161 uint32_t DummyCycles; /* It indicates the number of dummy cycles inserted before data phase.
AnnaBridge 189:f392fc9709a3 162 This parameter can be a value between 0 and 31 */
AnnaBridge 189:f392fc9709a3 163 uint32_t DQSMode; /* It enables or not the data strobe management.
AnnaBridge 189:f392fc9709a3 164 This parameter can be a value of @ref OSPI_DQSMode */
AnnaBridge 189:f392fc9709a3 165 uint32_t SIOOMode; /* It enables or not the SIOO mode.
AnnaBridge 189:f392fc9709a3 166 This parameter can be a value of @ref OSPI_SIOOMode */
AnnaBridge 189:f392fc9709a3 167 }OSPI_RegularCmdTypeDef;
AnnaBridge 189:f392fc9709a3 168
AnnaBridge 189:f392fc9709a3 169 /**
AnnaBridge 189:f392fc9709a3 170 * @brief HAL OSPI Hyperbus Configuration Structure definition
AnnaBridge 189:f392fc9709a3 171 */
AnnaBridge 189:f392fc9709a3 172 typedef struct
AnnaBridge 189:f392fc9709a3 173 {
AnnaBridge 189:f392fc9709a3 174 uint32_t RWRecoveryTime; /* It indicates the number of cycles for the device read write recovery time.
AnnaBridge 189:f392fc9709a3 175 This parameter can be a value between 0 and 255 */
AnnaBridge 189:f392fc9709a3 176 uint32_t AccessTime; /* It indicates the number of cycles for the device acces time.
AnnaBridge 189:f392fc9709a3 177 This parameter can be a value between 0 and 255 */
AnnaBridge 189:f392fc9709a3 178 uint32_t WriteZeroLatency; /* It enables or not the latency for the write access.
AnnaBridge 189:f392fc9709a3 179 This parameter can be a value of @ref OSPI_WriteZeroLatency */
AnnaBridge 189:f392fc9709a3 180 uint32_t LatencyMode; /* It configures the latency mode.
AnnaBridge 189:f392fc9709a3 181 This parameter can be a value of @ref OSPI_LatencyMode */
AnnaBridge 189:f392fc9709a3 182 }OSPI_HyperbusCfgTypeDef;
AnnaBridge 189:f392fc9709a3 183
AnnaBridge 189:f392fc9709a3 184 /**
AnnaBridge 189:f392fc9709a3 185 * @brief HAL OSPI Hyperbus Command Structure definition
AnnaBridge 189:f392fc9709a3 186 */
AnnaBridge 189:f392fc9709a3 187 typedef struct
AnnaBridge 189:f392fc9709a3 188 {
AnnaBridge 189:f392fc9709a3 189 uint32_t AddressSpace; /* It indicates the address space accessed by the command.
AnnaBridge 189:f392fc9709a3 190 This parameter can be a value of @ref OSPI_AddressSpace */
AnnaBridge 189:f392fc9709a3 191 uint32_t Address; /* It contains the address to be sent tot he device.
AnnaBridge 189:f392fc9709a3 192 This parameter can be a value between 0 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 193 uint32_t AddressSize; /* It indicates the size of the address.
AnnaBridge 189:f392fc9709a3 194 This parameter can be a value of @ref OSPI_AddressSize */
AnnaBridge 189:f392fc9709a3 195 uint32_t NbData; /* It indicates the number of data transferred with this command.
AnnaBridge 189:f392fc9709a3 196 This field is only used for indirect mode.
AnnaBridge 189:f392fc9709a3 197 This parameter can be a value between 1 and 0xFFFFFFFF
AnnaBridge 189:f392fc9709a3 198 In case of autopolling mode, this parameter can be any value between 1 and 4 */
AnnaBridge 189:f392fc9709a3 199 uint32_t DQSMode; /* It enables or not the data strobe management.
AnnaBridge 189:f392fc9709a3 200 This parameter can be a value of @ref OSPI_DQSMode */
AnnaBridge 189:f392fc9709a3 201 }OSPI_HyperbusCmdTypeDef;
AnnaBridge 189:f392fc9709a3 202
AnnaBridge 189:f392fc9709a3 203 /**
AnnaBridge 189:f392fc9709a3 204 * @brief HAL OSPI Auto Polling mode configuration structure definition
AnnaBridge 189:f392fc9709a3 205 */
AnnaBridge 189:f392fc9709a3 206 typedef struct
AnnaBridge 189:f392fc9709a3 207 {
AnnaBridge 189:f392fc9709a3 208 uint32_t Match; /* Specifies the value to be compared with the masked status register to get a match.
AnnaBridge 189:f392fc9709a3 209 This parameter can be any value between 0 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 210 uint32_t Mask; /* Specifies the mask to be applied to the status bytes received.
AnnaBridge 189:f392fc9709a3 211 This parameter can be any value between 0 and 0xFFFFFFFF */
AnnaBridge 189:f392fc9709a3 212 uint32_t MatchMode; /* Specifies the method used for determining a match.
AnnaBridge 189:f392fc9709a3 213 This parameter can be a value of @ref OSPI_MatchMode */
AnnaBridge 189:f392fc9709a3 214 uint32_t AutomaticStop; /* Specifies if automatic polling is stopped after a match.
AnnaBridge 189:f392fc9709a3 215 This parameter can be a value of @ref OSPI_AutomaticStop */
AnnaBridge 189:f392fc9709a3 216 uint32_t Interval; /* Specifies the number of clock cycles between two read during automatic polling phases.
AnnaBridge 189:f392fc9709a3 217 This parameter can be any value between 0 and 0xFFFF */
AnnaBridge 189:f392fc9709a3 218 }OSPI_AutoPollingTypeDef;
AnnaBridge 189:f392fc9709a3 219
AnnaBridge 189:f392fc9709a3 220 /**
AnnaBridge 189:f392fc9709a3 221 * @brief HAL OSPI Memory Mapped mode configuration structure definition
AnnaBridge 189:f392fc9709a3 222 */
AnnaBridge 189:f392fc9709a3 223 typedef struct
AnnaBridge 189:f392fc9709a3 224 {
AnnaBridge 189:f392fc9709a3 225 uint32_t TimeOutActivation; /* Specifies if the timeout counter is enabled to release the chip select.
AnnaBridge 189:f392fc9709a3 226 This parameter can be a value of @ref OSPI_TimeOutActivation */
AnnaBridge 189:f392fc9709a3 227 uint32_t TimeOutPeriod; /* Specifies the number of clock to wait when the FIFO is full before to release the chip select.
AnnaBridge 189:f392fc9709a3 228 This parameter can be any value between 0 and 0xFFFF */
AnnaBridge 189:f392fc9709a3 229 }OSPI_MemoryMappedTypeDef;
AnnaBridge 189:f392fc9709a3 230
AnnaBridge 189:f392fc9709a3 231 /**
AnnaBridge 189:f392fc9709a3 232 * @brief HAL OSPI IO Manager Configuration structure definition
AnnaBridge 189:f392fc9709a3 233 */
AnnaBridge 189:f392fc9709a3 234 typedef struct
AnnaBridge 189:f392fc9709a3 235 {
AnnaBridge 189:f392fc9709a3 236 uint32_t ClkPort; /* It indicates which port of the OSPI IO Manager is used for the CLK pins.
AnnaBridge 189:f392fc9709a3 237 This parameter can be a value between 1 and 8 */
AnnaBridge 189:f392fc9709a3 238 uint32_t DQSPort; /* It indicates which port of the OSPI IO Manager is used for the DQS pin.
AnnaBridge 189:f392fc9709a3 239 This parameter can be a value between 1 and 8 */
AnnaBridge 189:f392fc9709a3 240 uint32_t NCSPort; /* It indicates which port of the OSPI IO Manager is used for the NCS pin.
AnnaBridge 189:f392fc9709a3 241 This parameter can be a value between 1 and 8 */
AnnaBridge 189:f392fc9709a3 242 uint32_t IOLowPort; /* It indicates which port of the OSPI IO Manager is used for the IO[3:0] pins.
AnnaBridge 189:f392fc9709a3 243 This parameter can be a value of @ref OSPIM_IOPort */
AnnaBridge 189:f392fc9709a3 244 uint32_t IOHighPort; /* It indicates which port of the OSPI IO Manager is used for the IO[7:4] pins.
AnnaBridge 189:f392fc9709a3 245 This parameter can be a value of @ref OSPIM_IOPort */
AnnaBridge 189:f392fc9709a3 246 }OSPIM_CfgTypeDef;
AnnaBridge 189:f392fc9709a3 247
AnnaBridge 189:f392fc9709a3 248 /**
AnnaBridge 189:f392fc9709a3 249 * @}
AnnaBridge 189:f392fc9709a3 250 */
AnnaBridge 189:f392fc9709a3 251
AnnaBridge 189:f392fc9709a3 252 /* Exported constants --------------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 253 /** @defgroup OSPI_Exported_Constants OSPI Exported Constants
AnnaBridge 189:f392fc9709a3 254 * @{
AnnaBridge 189:f392fc9709a3 255 */
AnnaBridge 189:f392fc9709a3 256
AnnaBridge 189:f392fc9709a3 257 /** @defgroup OSPI_State OSPI State
AnnaBridge 189:f392fc9709a3 258 * @{
AnnaBridge 189:f392fc9709a3 259 */
AnnaBridge 189:f392fc9709a3 260 #define HAL_OSPI_STATE_RESET ((uint32_t)0x00000000U) /*!< Initial state */
AnnaBridge 189:f392fc9709a3 261 #define HAL_OSPI_STATE_HYPERBUS_INIT ((uint32_t)0x00000001U) /*!< Initialization done in hyperbus mode but timing configuration not done */
AnnaBridge 189:f392fc9709a3 262 #define HAL_OSPI_STATE_READY ((uint32_t)0x00000002U) /*!< Driver ready to be used */
AnnaBridge 189:f392fc9709a3 263 #define HAL_OSPI_STATE_CMD_CFG ((uint32_t)0x00000004U) /*!< Command (regular or hyperbus) configured, ready for an action */
AnnaBridge 189:f392fc9709a3 264 #define HAL_OSPI_STATE_READ_CMD_CFG ((uint32_t)0x00000014U) /*!< Read command configuration done, not the write command configuration */
AnnaBridge 189:f392fc9709a3 265 #define HAL_OSPI_STATE_WRITE_CMD_CFG ((uint32_t)0x00000024U) /*!< Write command configuration done, not the read command configuration */
AnnaBridge 189:f392fc9709a3 266 #define HAL_OSPI_STATE_BUSY_CMD ((uint32_t)0x00000008U) /*!< Command without data on-going */
AnnaBridge 189:f392fc9709a3 267 #define HAL_OSPI_STATE_BUSY_TX ((uint32_t)0x00000018U) /*!< Indirect Tx on-going */
AnnaBridge 189:f392fc9709a3 268 #define HAL_OSPI_STATE_BUSY_RX ((uint32_t)0x00000028U) /*!< Indirect Rx on-going */
AnnaBridge 189:f392fc9709a3 269 #define HAL_OSPI_STATE_BUSY_AUTO_POLLING ((uint32_t)0x00000048U) /*!< Auto-polling on-going */
AnnaBridge 189:f392fc9709a3 270 #define HAL_OSPI_STATE_BUSY_MEM_MAPPED ((uint32_t)0x00000088U) /*!< Memory-mapped on-going */
AnnaBridge 189:f392fc9709a3 271 #define HAL_OSPI_STATE_ABORT ((uint32_t)0x00000100U) /*!< Abort on-going */
AnnaBridge 189:f392fc9709a3 272 #define HAL_OSPI_STATE_ERROR ((uint32_t)0x00000200U) /*!< Blocking error, driver should be re-initialized */
AnnaBridge 189:f392fc9709a3 273 /**
AnnaBridge 189:f392fc9709a3 274 * @}
AnnaBridge 189:f392fc9709a3 275 */
AnnaBridge 189:f392fc9709a3 276
AnnaBridge 189:f392fc9709a3 277 /** @defgroup OSPI_ErrorCode OSPI Error Code
AnnaBridge 189:f392fc9709a3 278 * @{
AnnaBridge 189:f392fc9709a3 279 */
AnnaBridge 189:f392fc9709a3 280 #define HAL_OSPI_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
AnnaBridge 189:f392fc9709a3 281 #define HAL_OSPI_ERROR_TIMEOUT ((uint32_t)0x00000001U) /*!< Timeout error */
AnnaBridge 189:f392fc9709a3 282 #define HAL_OSPI_ERROR_TRANSFER ((uint32_t)0x00000002U) /*!< Transfer error */
AnnaBridge 189:f392fc9709a3 283 #define HAL_OSPI_ERROR_DMA ((uint32_t)0x00000004U) /*!< DMA transfer error */
AnnaBridge 189:f392fc9709a3 284 #define HAL_OSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008U) /*!< Invalid parameters error */
AnnaBridge 189:f392fc9709a3 285 #define HAL_OSPI_ERROR_INVALID_SEQUENCE ((uint32_t)0x00000010U) /*!< Sequence of the state machine is incorrect */
AnnaBridge 189:f392fc9709a3 286 /**
AnnaBridge 189:f392fc9709a3 287 * @}
AnnaBridge 189:f392fc9709a3 288 */
AnnaBridge 189:f392fc9709a3 289
AnnaBridge 189:f392fc9709a3 290 /** @defgroup OSPI_DualQuad OSPI Dual-Quad
AnnaBridge 189:f392fc9709a3 291 * @{
AnnaBridge 189:f392fc9709a3 292 */
AnnaBridge 189:f392fc9709a3 293 #define HAL_OSPI_DUALQUAD_DISABLE ((uint32_t)0x00000000U) /*!< Dual-Quad mode disabled */
AnnaBridge 189:f392fc9709a3 294 #define HAL_OSPI_DUALQUAD_ENABLE ((uint32_t)OCTOSPI_CR_DQM) /*!< Dual-Quad mode enabled */
AnnaBridge 189:f392fc9709a3 295 /**
AnnaBridge 189:f392fc9709a3 296 * @}
AnnaBridge 189:f392fc9709a3 297 */
AnnaBridge 189:f392fc9709a3 298
AnnaBridge 189:f392fc9709a3 299 /** @defgroup OSPI_MemoryType OSPI Memory Type
AnnaBridge 189:f392fc9709a3 300 * @{
AnnaBridge 189:f392fc9709a3 301 */
AnnaBridge 189:f392fc9709a3 302 #define HAL_OSPI_MEMTYPE_MICRON ((uint32_t)0x00000000U) /*!< Micron mode */
AnnaBridge 189:f392fc9709a3 303 #define HAL_OSPI_MEMTYPE_MACRONIX ((uint32_t)OCTOSPI_DCR1_MTYP_0) /*!< Macronix mode */
AnnaBridge 189:f392fc9709a3 304 #define HAL_OSPI_MEMTYPE_MACRONIX_RAM ((uint32_t)(OCTOSPI_DCR1_MTYP_1 | OCTOSPI_DCR1_MTYP_0)) /*!< Macronix RAM mode */
AnnaBridge 189:f392fc9709a3 305 #define HAL_OSPI_MEMTYPE_HYPERBUS ((uint32_t)OCTOSPI_DCR1_MTYP_2) /*!< Hyperbus mode */
AnnaBridge 189:f392fc9709a3 306 /**
AnnaBridge 189:f392fc9709a3 307 * @}
AnnaBridge 189:f392fc9709a3 308 */
AnnaBridge 189:f392fc9709a3 309
AnnaBridge 189:f392fc9709a3 310 /** @defgroup OSPI_FreeRunningClock OSPI Free Running Clock
AnnaBridge 189:f392fc9709a3 311 * @{
AnnaBridge 189:f392fc9709a3 312 */
AnnaBridge 189:f392fc9709a3 313 #define HAL_OSPI_FREERUNCLK_DISABLE ((uint32_t)0x00000000U) /*!< CLK is not free running */
AnnaBridge 189:f392fc9709a3 314 #define HAL_OSPI_FREERUNCLK_ENABLE ((uint32_t)OCTOSPI_DCR1_FRCK) /*!< CLK is free running (always provided) */
AnnaBridge 189:f392fc9709a3 315 /**
AnnaBridge 189:f392fc9709a3 316 * @}
AnnaBridge 189:f392fc9709a3 317 */
AnnaBridge 189:f392fc9709a3 318
AnnaBridge 189:f392fc9709a3 319 /** @defgroup OSPI_ClockMode OSPI Clock Mode
AnnaBridge 189:f392fc9709a3 320 * @{
AnnaBridge 189:f392fc9709a3 321 */
AnnaBridge 189:f392fc9709a3 322 #define HAL_OSPI_CLOCK_MODE_0 ((uint32_t)0x00000000U) /*!< CLK must stay low while nCS is high */
AnnaBridge 189:f392fc9709a3 323 #define HAL_OSPI_CLOCK_MODE_3 ((uint32_t)OCTOSPI_DCR1_CKMODE) /*!< CLK must stay high while nCS is high */
AnnaBridge 189:f392fc9709a3 324 /**
AnnaBridge 189:f392fc9709a3 325 * @}
AnnaBridge 189:f392fc9709a3 326 */
AnnaBridge 189:f392fc9709a3 327
AnnaBridge 189:f392fc9709a3 328 /** @defgroup OSPI_WrapSize OSPI Wrap-Size
AnnaBridge 189:f392fc9709a3 329 * @{
AnnaBridge 189:f392fc9709a3 330 */
AnnaBridge 189:f392fc9709a3 331 #define HAL_OSPI_WRAP_NOT_SUPPORTED ((uint32_t)0x00000000U) /*!< wrapped reads are not supported by the memory */
AnnaBridge 189:f392fc9709a3 332 #define HAL_OSPI_WRAP_16_BYTES ((uint32_t)OCTOSPI_DCR2_WRAPSIZE_1) /*!< external memory supports wrap size of 16 bytes */
AnnaBridge 189:f392fc9709a3 333 #define HAL_OSPI_WRAP_32_BYTES ((uint32_t)(OCTOSPI_DCR2_WRAPSIZE_0 | OCTOSPI_DCR2_WRAPSIZE_1)) /*!< external memory supports wrap size of 32 bytes */
AnnaBridge 189:f392fc9709a3 334 #define HAL_OSPI_WRAP_64_BYTES ((uint32_t)OCTOSPI_DCR2_WRAPSIZE_2) /*!< external memory supports wrap size of 64 bytes */
AnnaBridge 189:f392fc9709a3 335 #define HAL_OSPI_WRAP_128_BYTES ((uint32_t)(OCTOSPI_DCR2_WRAPSIZE_0 | OCTOSPI_DCR2_WRAPSIZE_2)) /*!< external memory supports wrap size of 128 bytes */
AnnaBridge 189:f392fc9709a3 336 /**
AnnaBridge 189:f392fc9709a3 337 * @}
AnnaBridge 189:f392fc9709a3 338 */
AnnaBridge 189:f392fc9709a3 339
AnnaBridge 189:f392fc9709a3 340 /** @defgroup OSPI_SampleShifting OSPI Sample Shifting
AnnaBridge 189:f392fc9709a3 341 * @{
AnnaBridge 189:f392fc9709a3 342 */
AnnaBridge 189:f392fc9709a3 343 #define HAL_OSPI_SAMPLE_SHIFTING_NONE ((uint32_t)0x00000000U) /*!< No shift */
AnnaBridge 189:f392fc9709a3 344 #define HAL_OSPI_SAMPLE_SHIFTING_HALFCYCLE ((uint32_t)OCTOSPI_TCR_SSHIFT) /*!< 1/2 cycle shift */
AnnaBridge 189:f392fc9709a3 345 /**
AnnaBridge 189:f392fc9709a3 346 * @}
AnnaBridge 189:f392fc9709a3 347 */
AnnaBridge 189:f392fc9709a3 348
AnnaBridge 189:f392fc9709a3 349 /** @defgroup OSPI_DelayHoldQuarterCycle OSPI Delay Hold Quarter Cycle
AnnaBridge 189:f392fc9709a3 350 * @{
AnnaBridge 189:f392fc9709a3 351 */
AnnaBridge 189:f392fc9709a3 352 #define HAL_OSPI_DHQC_DISABLE ((uint32_t)0x00000000U) /*!< No Delay */
AnnaBridge 189:f392fc9709a3 353 #define HAL_OSPI_DHQC_ENABLE ((uint32_t)OCTOSPI_TCR_DHQC) /*!< Delay Hold 1/4 cycle */
AnnaBridge 189:f392fc9709a3 354 /**
AnnaBridge 189:f392fc9709a3 355 * @}
AnnaBridge 189:f392fc9709a3 356 */
AnnaBridge 189:f392fc9709a3 357
AnnaBridge 189:f392fc9709a3 358 /** @defgroup OSPI_OperationType OSPI Operation Type
AnnaBridge 189:f392fc9709a3 359 * @{
AnnaBridge 189:f392fc9709a3 360 */
AnnaBridge 189:f392fc9709a3 361 #define HAL_OSPI_OPTYPE_COMMON_CFG ((uint32_t)0x00000000U) /*!< Common configuration (indirect or auto-polling mode) */
AnnaBridge 189:f392fc9709a3 362 #define HAL_OSPI_OPTYPE_READ_CFG ((uint32_t)0x00000001U) /*!< Read configuration (memory-mapped mode) */
AnnaBridge 189:f392fc9709a3 363 #define HAL_OSPI_OPTYPE_WRITE_CFG ((uint32_t)0x00000002U) /*!< Write configuration (memory-mapped mode) */
AnnaBridge 189:f392fc9709a3 364 /**
AnnaBridge 189:f392fc9709a3 365 * @}
AnnaBridge 189:f392fc9709a3 366 */
AnnaBridge 189:f392fc9709a3 367
AnnaBridge 189:f392fc9709a3 368 /** @defgroup OSPI_FlashID OSPI Flash Id
AnnaBridge 189:f392fc9709a3 369 * @{
AnnaBridge 189:f392fc9709a3 370 */
AnnaBridge 189:f392fc9709a3 371 #define HAL_OSPI_FLASH_ID_1 ((uint32_t)0x00000000U) /*!< FLASH 1 selected */
AnnaBridge 189:f392fc9709a3 372 #define HAL_OSPI_FLASH_ID_2 ((uint32_t)OCTOSPI_CR_FSEL) /*!< FLASH 2 selected */
AnnaBridge 189:f392fc9709a3 373 /**
AnnaBridge 189:f392fc9709a3 374 * @}
AnnaBridge 189:f392fc9709a3 375 */
AnnaBridge 189:f392fc9709a3 376
AnnaBridge 189:f392fc9709a3 377 /** @defgroup OSPI_InstructionMode OSPI Instruction Mode
AnnaBridge 189:f392fc9709a3 378 * @{
AnnaBridge 189:f392fc9709a3 379 */
AnnaBridge 189:f392fc9709a3 380 #define HAL_OSPI_INSTRUCTION_NONE ((uint32_t)0x00000000U) /*!< No instruction */
AnnaBridge 189:f392fc9709a3 381 #define HAL_OSPI_INSTRUCTION_1_LINE ((uint32_t)OCTOSPI_CCR_IMODE_0) /*!< Instruction on a single line */
AnnaBridge 189:f392fc9709a3 382 #define HAL_OSPI_INSTRUCTION_2_LINES ((uint32_t)OCTOSPI_CCR_IMODE_1) /*!< Instruction on two lines */
AnnaBridge 189:f392fc9709a3 383 #define HAL_OSPI_INSTRUCTION_4_LINES ((uint32_t)(OCTOSPI_CCR_IMODE_0 | OCTOSPI_CCR_IMODE_1)) /*!< Instruction on four lines */
AnnaBridge 189:f392fc9709a3 384 #define HAL_OSPI_INSTRUCTION_8_LINES ((uint32_t)OCTOSPI_CCR_IMODE_2) /*!< Instruction on eight lines */
AnnaBridge 189:f392fc9709a3 385 /**
AnnaBridge 189:f392fc9709a3 386 * @}
AnnaBridge 189:f392fc9709a3 387 */
AnnaBridge 189:f392fc9709a3 388
AnnaBridge 189:f392fc9709a3 389 /** @defgroup OSPI_InstructionSize OSPI Instruction Size
AnnaBridge 189:f392fc9709a3 390 * @{
AnnaBridge 189:f392fc9709a3 391 */
AnnaBridge 189:f392fc9709a3 392 #define HAL_OSPI_INSTRUCTION_8_BITS ((uint32_t)0x00000000U) /*!< 8-bit instruction */
AnnaBridge 189:f392fc9709a3 393 #define HAL_OSPI_INSTRUCTION_16_BITS ((uint32_t)OCTOSPI_CCR_ISIZE_0) /*!< 16-bit instruction */
AnnaBridge 189:f392fc9709a3 394 #define HAL_OSPI_INSTRUCTION_24_BITS ((uint32_t)OCTOSPI_CCR_ISIZE_1) /*!< 24-bit instruction */
AnnaBridge 189:f392fc9709a3 395 #define HAL_OSPI_INSTRUCTION_32_BITS ((uint32_t)OCTOSPI_CCR_ISIZE) /*!< 32-bit instruction */
AnnaBridge 189:f392fc9709a3 396 /**
AnnaBridge 189:f392fc9709a3 397 * @}
AnnaBridge 189:f392fc9709a3 398 */
AnnaBridge 189:f392fc9709a3 399
AnnaBridge 189:f392fc9709a3 400 /** @defgroup OSPI_InstructionDtrMode OSPI Instruction DTR Mode
AnnaBridge 189:f392fc9709a3 401 * @{
AnnaBridge 189:f392fc9709a3 402 */
AnnaBridge 189:f392fc9709a3 403 #define HAL_OSPI_INSTRUCTION_DTR_DISABLE ((uint32_t)0x00000000U) /*!< DTR mode disabled for instruction phase */
AnnaBridge 189:f392fc9709a3 404 #define HAL_OSPI_INSTRUCTION_DTR_ENABLE ((uint32_t)OCTOSPI_CCR_IDTR) /*!< DTR mode enabled for instruction phase */
AnnaBridge 189:f392fc9709a3 405 /**
AnnaBridge 189:f392fc9709a3 406 * @}
AnnaBridge 189:f392fc9709a3 407 */
AnnaBridge 189:f392fc9709a3 408
AnnaBridge 189:f392fc9709a3 409 /** @defgroup OSPI_AddressMode OSPI Address Mode
AnnaBridge 189:f392fc9709a3 410 * @{
AnnaBridge 189:f392fc9709a3 411 */
AnnaBridge 189:f392fc9709a3 412 #define HAL_OSPI_ADDRESS_NONE ((uint32_t)0x00000000U) /*!< No address */
AnnaBridge 189:f392fc9709a3 413 #define HAL_OSPI_ADDRESS_1_LINE ((uint32_t)OCTOSPI_CCR_ADMODE_0) /*!< Address on a single line */
AnnaBridge 189:f392fc9709a3 414 #define HAL_OSPI_ADDRESS_2_LINES ((uint32_t)OCTOSPI_CCR_ADMODE_1) /*!< Address on two lines */
AnnaBridge 189:f392fc9709a3 415 #define HAL_OSPI_ADDRESS_4_LINES ((uint32_t)(OCTOSPI_CCR_ADMODE_0 | OCTOSPI_CCR_ADMODE_1)) /*!< Address on four lines */
AnnaBridge 189:f392fc9709a3 416 #define HAL_OSPI_ADDRESS_8_LINES ((uint32_t)OCTOSPI_CCR_ADMODE_2) /*!< Address on eight lines */
AnnaBridge 189:f392fc9709a3 417 /**
AnnaBridge 189:f392fc9709a3 418 * @}
AnnaBridge 189:f392fc9709a3 419 */
AnnaBridge 189:f392fc9709a3 420
AnnaBridge 189:f392fc9709a3 421 /** @defgroup OSPI_AddressSize OSPI Address Size
AnnaBridge 189:f392fc9709a3 422 * @{
AnnaBridge 189:f392fc9709a3 423 */
AnnaBridge 189:f392fc9709a3 424 #define HAL_OSPI_ADDRESS_8_BITS ((uint32_t)0x00000000U) /*!< 8-bit address */
AnnaBridge 189:f392fc9709a3 425 #define HAL_OSPI_ADDRESS_16_BITS ((uint32_t)OCTOSPI_CCR_ADSIZE_0) /*!< 16-bit address */
AnnaBridge 189:f392fc9709a3 426 #define HAL_OSPI_ADDRESS_24_BITS ((uint32_t)OCTOSPI_CCR_ADSIZE_1) /*!< 24-bit address */
AnnaBridge 189:f392fc9709a3 427 #define HAL_OSPI_ADDRESS_32_BITS ((uint32_t)OCTOSPI_CCR_ADSIZE) /*!< 32-bit address */
AnnaBridge 189:f392fc9709a3 428 /**
AnnaBridge 189:f392fc9709a3 429 * @}
AnnaBridge 189:f392fc9709a3 430 */
AnnaBridge 189:f392fc9709a3 431
AnnaBridge 189:f392fc9709a3 432 /** @defgroup OSPI_AddressDtrMode OSPI Address DTR Mode
AnnaBridge 189:f392fc9709a3 433 * @{
AnnaBridge 189:f392fc9709a3 434 */
AnnaBridge 189:f392fc9709a3 435 #define HAL_OSPI_ADDRESS_DTR_DISABLE ((uint32_t)0x00000000U) /*!< DTR mode disabled for address phase */
AnnaBridge 189:f392fc9709a3 436 #define HAL_OSPI_ADDRESS_DTR_ENABLE ((uint32_t)OCTOSPI_CCR_ADDTR) /*!< DTR mode enabled for address phase */
AnnaBridge 189:f392fc9709a3 437 /**
AnnaBridge 189:f392fc9709a3 438 * @}
AnnaBridge 189:f392fc9709a3 439 */
AnnaBridge 189:f392fc9709a3 440
AnnaBridge 189:f392fc9709a3 441 /** @defgroup OSPI_AlternateBytesMode OSPI Alternate Bytes Mode
AnnaBridge 189:f392fc9709a3 442 * @{
AnnaBridge 189:f392fc9709a3 443 */
AnnaBridge 189:f392fc9709a3 444 #define HAL_OSPI_ALTERNATE_BYTES_NONE ((uint32_t)0x00000000U) /*!< No alternate bytes */
AnnaBridge 189:f392fc9709a3 445 #define HAL_OSPI_ALTERNATE_BYTES_1_LINE ((uint32_t)OCTOSPI_CCR_ABMODE_0) /*!< Alternate bytes on a single line */
AnnaBridge 189:f392fc9709a3 446 #define HAL_OSPI_ALTERNATE_BYTES_2_LINES ((uint32_t)OCTOSPI_CCR_ABMODE_1) /*!< Alternate bytes on two lines */
AnnaBridge 189:f392fc9709a3 447 #define HAL_OSPI_ALTERNATE_BYTES_4_LINES ((uint32_t)(OCTOSPI_CCR_ABMODE_0 | OCTOSPI_CCR_ABMODE_1)) /*!< Alternate bytes on four lines */
AnnaBridge 189:f392fc9709a3 448 #define HAL_OSPI_ALTERNATE_BYTES_8_LINES ((uint32_t)OCTOSPI_CCR_ABMODE_2) /*!< Alternate bytes on eight lines */
AnnaBridge 189:f392fc9709a3 449 /**
AnnaBridge 189:f392fc9709a3 450 * @}
AnnaBridge 189:f392fc9709a3 451 */
AnnaBridge 189:f392fc9709a3 452
AnnaBridge 189:f392fc9709a3 453 /** @defgroup OSPI_AlternateBytesSize OSPI Alternate Bytes Size
AnnaBridge 189:f392fc9709a3 454 * @{
AnnaBridge 189:f392fc9709a3 455 */
AnnaBridge 189:f392fc9709a3 456 #define HAL_OSPI_ALTERNATE_BYTES_8_BITS ((uint32_t)0x00000000U) /*!< 8-bit alternate bytes */
AnnaBridge 189:f392fc9709a3 457 #define HAL_OSPI_ALTERNATE_BYTES_16_BITS ((uint32_t)OCTOSPI_CCR_ABSIZE_0) /*!< 16-bit alternate bytes */
AnnaBridge 189:f392fc9709a3 458 #define HAL_OSPI_ALTERNATE_BYTES_24_BITS ((uint32_t)OCTOSPI_CCR_ABSIZE_1) /*!< 24-bit alternate bytes */
AnnaBridge 189:f392fc9709a3 459 #define HAL_OSPI_ALTERNATE_BYTES_32_BITS ((uint32_t)OCTOSPI_CCR_ABSIZE) /*!< 32-bit alternate bytes */
AnnaBridge 189:f392fc9709a3 460 /**
AnnaBridge 189:f392fc9709a3 461 * @}
AnnaBridge 189:f392fc9709a3 462 */
AnnaBridge 189:f392fc9709a3 463
AnnaBridge 189:f392fc9709a3 464 /** @defgroup OSPI_AlternateBytesDtrMode OSPI Alternate Bytes DTR Mode
AnnaBridge 189:f392fc9709a3 465 * @{
AnnaBridge 189:f392fc9709a3 466 */
AnnaBridge 189:f392fc9709a3 467 #define HAL_OSPI_ALTERNATE_BYTES_DTR_DISABLE ((uint32_t)0x00000000U) /*!< DTR mode disabled for alternate bytes phase */
AnnaBridge 189:f392fc9709a3 468 #define HAL_OSPI_ALTERNATE_BYTES_DTR_ENABLE ((uint32_t)OCTOSPI_CCR_ABDTR) /*!< DTR mode enabled for alternate bytes phase */
AnnaBridge 189:f392fc9709a3 469 /**
AnnaBridge 189:f392fc9709a3 470 * @}
AnnaBridge 189:f392fc9709a3 471 */
AnnaBridge 189:f392fc9709a3 472
AnnaBridge 189:f392fc9709a3 473 /** @defgroup OSPI_DataMode OSPI Data Mode
AnnaBridge 189:f392fc9709a3 474 * @{
AnnaBridge 189:f392fc9709a3 475 */
AnnaBridge 189:f392fc9709a3 476 #define HAL_OSPI_DATA_NONE ((uint32_t)0x00000000U) /*!< No data */
AnnaBridge 189:f392fc9709a3 477 #define HAL_OSPI_DATA_1_LINE ((uint32_t)OCTOSPI_CCR_DMODE_0) /*!< Data on a single line */
AnnaBridge 189:f392fc9709a3 478 #define HAL_OSPI_DATA_2_LINES ((uint32_t)OCTOSPI_CCR_DMODE_1) /*!< Data on two lines */
AnnaBridge 189:f392fc9709a3 479 #define HAL_OSPI_DATA_4_LINES ((uint32_t)(OCTOSPI_CCR_DMODE_0 | OCTOSPI_CCR_DMODE_1)) /*!< Data on four lines */
AnnaBridge 189:f392fc9709a3 480 #define HAL_OSPI_DATA_8_LINES ((uint32_t)OCTOSPI_CCR_DMODE_2) /*!< Data on eight lines */
AnnaBridge 189:f392fc9709a3 481 /**
AnnaBridge 189:f392fc9709a3 482 * @}
AnnaBridge 189:f392fc9709a3 483 */
AnnaBridge 189:f392fc9709a3 484
AnnaBridge 189:f392fc9709a3 485 /** @defgroup OSPI_DataDtrMode OSPI Data DTR Mode
AnnaBridge 189:f392fc9709a3 486 * @{
AnnaBridge 189:f392fc9709a3 487 */
AnnaBridge 189:f392fc9709a3 488 #define HAL_OSPI_DATA_DTR_DISABLE ((uint32_t)0x00000000U) /*!< DTR mode disabled for data phase */
AnnaBridge 189:f392fc9709a3 489 #define HAL_OSPI_DATA_DTR_ENABLE ((uint32_t)OCTOSPI_CCR_DDTR) /*!< DTR mode enabled for data phase */
AnnaBridge 189:f392fc9709a3 490 /**
AnnaBridge 189:f392fc9709a3 491 * @}
AnnaBridge 189:f392fc9709a3 492 */
AnnaBridge 189:f392fc9709a3 493
AnnaBridge 189:f392fc9709a3 494 /** @defgroup OSPI_DQSMode OSPI DQS Mode
AnnaBridge 189:f392fc9709a3 495 * @{
AnnaBridge 189:f392fc9709a3 496 */
AnnaBridge 189:f392fc9709a3 497 #define HAL_OSPI_DQS_DISABLE ((uint32_t)0x00000000U) /*!< DQS disabled */
AnnaBridge 189:f392fc9709a3 498 #define HAL_OSPI_DQS_ENABLE ((uint32_t)OCTOSPI_CCR_DQSE) /*!< DQS enabled */
AnnaBridge 189:f392fc9709a3 499 /**
AnnaBridge 189:f392fc9709a3 500 * @}
AnnaBridge 189:f392fc9709a3 501 */
AnnaBridge 189:f392fc9709a3 502
AnnaBridge 189:f392fc9709a3 503 /** @defgroup OSPI_SIOOMode OSPI SIOO Mode
AnnaBridge 189:f392fc9709a3 504 * @{
AnnaBridge 189:f392fc9709a3 505 */
AnnaBridge 189:f392fc9709a3 506 #define HAL_OSPI_SIOO_INST_EVERY_CMD ((uint32_t)0x00000000U) /*!< Send instruction on every transaction */
AnnaBridge 189:f392fc9709a3 507 #define HAL_OSPI_SIOO_INST_ONLY_FIRST_CMD ((uint32_t)OCTOSPI_CCR_SIOO) /*!< Send instruction only for the first command */
AnnaBridge 189:f392fc9709a3 508 /**
AnnaBridge 189:f392fc9709a3 509 * @}
AnnaBridge 189:f392fc9709a3 510 */
AnnaBridge 189:f392fc9709a3 511
AnnaBridge 189:f392fc9709a3 512 /** @defgroup OSPI_WriteZeroLatency OSPI Hyperbus Write Zero Latency Activation
AnnaBridge 189:f392fc9709a3 513 * @{
AnnaBridge 189:f392fc9709a3 514 */
AnnaBridge 189:f392fc9709a3 515 #define HAL_OSPI_LATENCY_ON_WRITE ((uint32_t)0x00000000U) /*!< Latency on write accesses */
AnnaBridge 189:f392fc9709a3 516 #define HAL_OSPI_NO_LATENCY_ON_WRITE ((uint32_t)OCTOSPI_HLCR_WZL) /*!< No latency on write accesses */
AnnaBridge 189:f392fc9709a3 517 /**
AnnaBridge 189:f392fc9709a3 518 * @}
AnnaBridge 189:f392fc9709a3 519 */
AnnaBridge 189:f392fc9709a3 520
AnnaBridge 189:f392fc9709a3 521 /** @defgroup OSPI_LatencyMode OSPI Hyperbus Latency Mode
AnnaBridge 189:f392fc9709a3 522 * @{
AnnaBridge 189:f392fc9709a3 523 */
AnnaBridge 189:f392fc9709a3 524 #define HAL_OSPI_VARIABLE_LATENCY ((uint32_t)0x00000000U) /*!< Variable initial latency */
AnnaBridge 189:f392fc9709a3 525 #define HAL_OSPI_FIXED_LATENCY ((uint32_t)OCTOSPI_HLCR_LM) /*!< Fixed latency */
AnnaBridge 189:f392fc9709a3 526 /**
AnnaBridge 189:f392fc9709a3 527 * @}
AnnaBridge 189:f392fc9709a3 528 */
AnnaBridge 189:f392fc9709a3 529
AnnaBridge 189:f392fc9709a3 530 /** @defgroup OSPI_AddressSpace OSPI Hyperbus Address Space
AnnaBridge 189:f392fc9709a3 531 * @{
AnnaBridge 189:f392fc9709a3 532 */
AnnaBridge 189:f392fc9709a3 533 #define HAL_OSPI_MEMORY_ADDRESS_SPACE ((uint32_t)0x00000000U) /*!< HyperBus memory mode */
AnnaBridge 189:f392fc9709a3 534 #define HAL_OSPI_REGISTER_ADDRESS_SPACE ((uint32_t)OCTOSPI_DCR1_MTYP_0) /*!< HyperBus register mode */
AnnaBridge 189:f392fc9709a3 535 /**
AnnaBridge 189:f392fc9709a3 536 * @}
AnnaBridge 189:f392fc9709a3 537 */
AnnaBridge 189:f392fc9709a3 538
AnnaBridge 189:f392fc9709a3 539 /** @defgroup OSPI_MatchMode OSPI Match Mode
AnnaBridge 189:f392fc9709a3 540 * @{
AnnaBridge 189:f392fc9709a3 541 */
AnnaBridge 189:f392fc9709a3 542 #define HAL_OSPI_MATCH_MODE_AND ((uint32_t)0x00000000U) /*!< AND match mode between unmasked bits */
AnnaBridge 189:f392fc9709a3 543 #define HAL_OSPI_MATCH_MODE_OR ((uint32_t)OCTOSPI_CR_PMM) /*!< OR match mode between unmasked bits */
AnnaBridge 189:f392fc9709a3 544 /**
AnnaBridge 189:f392fc9709a3 545 * @}
AnnaBridge 189:f392fc9709a3 546 */
AnnaBridge 189:f392fc9709a3 547
AnnaBridge 189:f392fc9709a3 548 /** @defgroup OSPI_AutomaticStop OSPI Automatic Stop
AnnaBridge 189:f392fc9709a3 549 * @{
AnnaBridge 189:f392fc9709a3 550 */
AnnaBridge 189:f392fc9709a3 551 #define HAL_OSPI_AUTOMATIC_STOP_DISABLE ((uint32_t)0x00000000U) /*!< AutoPolling stops only with abort or OSPI disabling */
AnnaBridge 189:f392fc9709a3 552 #define HAL_OSPI_AUTOMATIC_STOP_ENABLE ((uint32_t)OCTOSPI_CR_APMS) /*!< AutoPolling stops as soon as there is a match */
AnnaBridge 189:f392fc9709a3 553 /**
AnnaBridge 189:f392fc9709a3 554 * @}
AnnaBridge 189:f392fc9709a3 555 */
AnnaBridge 189:f392fc9709a3 556
AnnaBridge 189:f392fc9709a3 557 /** @defgroup OSPI_TimeOutActivation OSPI Timeout Activation
AnnaBridge 189:f392fc9709a3 558 * @{
AnnaBridge 189:f392fc9709a3 559 */
AnnaBridge 189:f392fc9709a3 560 #define HAL_OSPI_TIMEOUT_COUNTER_DISABLE ((uint32_t)0x00000000U) /*!< Timeout counter disabled, nCS remains active */
AnnaBridge 189:f392fc9709a3 561 #define HAL_OSPI_TIMEOUT_COUNTER_ENABLE ((uint32_t)OCTOSPI_CR_TCEN) /*!< Timeout counter enabled, nCS released when timeout expires */
AnnaBridge 189:f392fc9709a3 562 /**
AnnaBridge 189:f392fc9709a3 563 * @}
AnnaBridge 189:f392fc9709a3 564 */
AnnaBridge 189:f392fc9709a3 565
AnnaBridge 189:f392fc9709a3 566 /** @defgroup OSPI_Flags OSPI Flags
AnnaBridge 189:f392fc9709a3 567 * @{
AnnaBridge 189:f392fc9709a3 568 */
AnnaBridge 189:f392fc9709a3 569 #define HAL_OSPI_FLAG_BUSY OCTOSPI_SR_BUSY /*!< Busy flag: operation is ongoing */
AnnaBridge 189:f392fc9709a3 570 #define HAL_OSPI_FLAG_TO OCTOSPI_SR_TOF /*!< Timeout flag: timeout occurs in memory-mapped mode */
AnnaBridge 189:f392fc9709a3 571 #define HAL_OSPI_FLAG_SM OCTOSPI_SR_SMF /*!< Status match flag: received data matches in autopolling mode */
AnnaBridge 189:f392fc9709a3 572 #define HAL_OSPI_FLAG_FT OCTOSPI_SR_FTF /*!< Fifo threshold flag: Fifo threshold reached or data left after read from memory is complete */
AnnaBridge 189:f392fc9709a3 573 #define HAL_OSPI_FLAG_TC OCTOSPI_SR_TCF /*!< Transfer complete flag: programmed number of data have been transferred or the transfer has been aborted */
AnnaBridge 189:f392fc9709a3 574 #define HAL_OSPI_FLAG_TE OCTOSPI_SR_TEF /*!< Transfer error flag: invalid address is being accessed */
AnnaBridge 189:f392fc9709a3 575 /**
AnnaBridge 189:f392fc9709a3 576 * @}
AnnaBridge 189:f392fc9709a3 577 */
AnnaBridge 189:f392fc9709a3 578
AnnaBridge 189:f392fc9709a3 579 /** @defgroup OSPI_Interrupts OSPI Interrupts
AnnaBridge 189:f392fc9709a3 580 * @{
AnnaBridge 189:f392fc9709a3 581 */
AnnaBridge 189:f392fc9709a3 582 #define HAL_OSPI_IT_TO OCTOSPI_CR_TOIE /*!< Interrupt on the timeout flag */
AnnaBridge 189:f392fc9709a3 583 #define HAL_OSPI_IT_SM OCTOSPI_CR_SMIE /*!< Interrupt on the status match flag */
AnnaBridge 189:f392fc9709a3 584 #define HAL_OSPI_IT_FT OCTOSPI_CR_FTIE /*!< Interrupt on the fifo threshold flag */
AnnaBridge 189:f392fc9709a3 585 #define HAL_OSPI_IT_TC OCTOSPI_CR_TCIE /*!< Interrupt on the transfer complete flag */
AnnaBridge 189:f392fc9709a3 586 #define HAL_OSPI_IT_TE OCTOSPI_CR_TEIE /*!< Interrupt on the transfer error flag */
AnnaBridge 189:f392fc9709a3 587 /**
AnnaBridge 189:f392fc9709a3 588 * @}
AnnaBridge 189:f392fc9709a3 589 */
AnnaBridge 189:f392fc9709a3 590
AnnaBridge 189:f392fc9709a3 591 /** @defgroup OSPI_Timeout_definition OSPI Timeout definition
AnnaBridge 189:f392fc9709a3 592 * @{
AnnaBridge 189:f392fc9709a3 593 */
AnnaBridge 189:f392fc9709a3 594 #define HAL_OSPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000U) /* 5 s */
AnnaBridge 189:f392fc9709a3 595 /**
AnnaBridge 189:f392fc9709a3 596 * @}
AnnaBridge 189:f392fc9709a3 597 */
AnnaBridge 189:f392fc9709a3 598
AnnaBridge 189:f392fc9709a3 599 /** @defgroup OSPIM_IOPort OSPI IO Manager IO Port
AnnaBridge 189:f392fc9709a3 600 * @{
AnnaBridge 189:f392fc9709a3 601 */
AnnaBridge 189:f392fc9709a3 602 #define HAL_OSPIM_IOPORT_1_LOW ((uint32_t)(OCTOSPIM_PCR_IOLEN | 0x1)) /*!< Port 1 - IO[3:0] */
AnnaBridge 189:f392fc9709a3 603 #define HAL_OSPIM_IOPORT_1_HIGH ((uint32_t)(OCTOSPIM_PCR_IOHEN | 0x1)) /*!< Port 1 - IO[7:4] */
AnnaBridge 189:f392fc9709a3 604 #define HAL_OSPIM_IOPORT_2_LOW ((uint32_t)(OCTOSPIM_PCR_IOLEN | 0x2)) /*!< Port 2 - IO[3:0] */
AnnaBridge 189:f392fc9709a3 605 #define HAL_OSPIM_IOPORT_2_HIGH ((uint32_t)(OCTOSPIM_PCR_IOHEN | 0x2)) /*!< Port 2 - IO[7:4] */
AnnaBridge 189:f392fc9709a3 606 /**
AnnaBridge 189:f392fc9709a3 607 * @}
AnnaBridge 189:f392fc9709a3 608 */
AnnaBridge 189:f392fc9709a3 609 /**
AnnaBridge 189:f392fc9709a3 610 * @}
AnnaBridge 189:f392fc9709a3 611 */
AnnaBridge 189:f392fc9709a3 612
AnnaBridge 189:f392fc9709a3 613 /* Exported macros -----------------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 614 /** @defgroup OSPI_Exported_Macros OSPI Exported Macros
AnnaBridge 189:f392fc9709a3 615 * @{
AnnaBridge 189:f392fc9709a3 616 */
AnnaBridge 189:f392fc9709a3 617 /** @brief Reset OSPI handle state.
AnnaBridge 189:f392fc9709a3 618 * @param __HANDLE__: OSPI handle.
AnnaBridge 189:f392fc9709a3 619 * @retval None
AnnaBridge 189:f392fc9709a3 620 */
AnnaBridge 189:f392fc9709a3 621 #define __HAL_OSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_OSPI_STATE_RESET)
AnnaBridge 189:f392fc9709a3 622
AnnaBridge 189:f392fc9709a3 623 /** @brief Enable the OSPI peripheral.
AnnaBridge 189:f392fc9709a3 624 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 625 * @retval None
AnnaBridge 189:f392fc9709a3 626 */
AnnaBridge 189:f392fc9709a3 627 #define __HAL_OSPI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, OCTOSPI_CR_EN)
AnnaBridge 189:f392fc9709a3 628
AnnaBridge 189:f392fc9709a3 629 /** @brief Disable the OSPI peripheral.
AnnaBridge 189:f392fc9709a3 630 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 631 * @retval None
AnnaBridge 189:f392fc9709a3 632 */
AnnaBridge 189:f392fc9709a3 633 #define __HAL_OSPI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, OCTOSPI_CR_EN)
AnnaBridge 189:f392fc9709a3 634
AnnaBridge 189:f392fc9709a3 635 /** @brief Enable the specified OSPI interrupt.
AnnaBridge 189:f392fc9709a3 636 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 637 * @param __INTERRUPT__: specifies the OSPI interrupt source to enable.
AnnaBridge 189:f392fc9709a3 638 * This parameter can be one of the following values:
AnnaBridge 189:f392fc9709a3 639 * @arg HAL_OSPI_IT_TO: OSPI Timeout interrupt
AnnaBridge 189:f392fc9709a3 640 * @arg HAL_OSPI_IT_SM: OSPI Status match interrupt
AnnaBridge 189:f392fc9709a3 641 * @arg HAL_OSPI_IT_FT: OSPI FIFO threshold interrupt
AnnaBridge 189:f392fc9709a3 642 * @arg HAL_OSPI_IT_TC: OSPI Transfer complete interrupt
AnnaBridge 189:f392fc9709a3 643 * @arg HAL_OSPI_IT_TE: OSPI Transfer error interrupt
AnnaBridge 189:f392fc9709a3 644 * @retval None
AnnaBridge 189:f392fc9709a3 645 */
AnnaBridge 189:f392fc9709a3 646 #define __HAL_OSPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__))
AnnaBridge 189:f392fc9709a3 647
AnnaBridge 189:f392fc9709a3 648
AnnaBridge 189:f392fc9709a3 649 /** @brief Disable the specified OSPI interrupt.
AnnaBridge 189:f392fc9709a3 650 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 651 * @param __INTERRUPT__: specifies the OSPI interrupt source to disable.
AnnaBridge 189:f392fc9709a3 652 * This parameter can be one of the following values:
AnnaBridge 189:f392fc9709a3 653 * @arg HAL_OSPI_IT_TO: OSPI Timeout interrupt
AnnaBridge 189:f392fc9709a3 654 * @arg HAL_OSPI_IT_SM: OSPI Status match interrupt
AnnaBridge 189:f392fc9709a3 655 * @arg HAL_OSPI_IT_FT: OSPI FIFO threshold interrupt
AnnaBridge 189:f392fc9709a3 656 * @arg HAL_OSPI_IT_TC: OSPI Transfer complete interrupt
AnnaBridge 189:f392fc9709a3 657 * @arg HAL_OSPI_IT_TE: OSPI Transfer error interrupt
AnnaBridge 189:f392fc9709a3 658 * @retval None
AnnaBridge 189:f392fc9709a3 659 */
AnnaBridge 189:f392fc9709a3 660 #define __HAL_OSPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__))
AnnaBridge 189:f392fc9709a3 661
AnnaBridge 189:f392fc9709a3 662 /** @brief Check whether the specified OSPI interrupt source is enabled or not.
AnnaBridge 189:f392fc9709a3 663 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 664 * @param __INTERRUPT__: specifies the OSPI interrupt source to check.
AnnaBridge 189:f392fc9709a3 665 * This parameter can be one of the following values:
AnnaBridge 189:f392fc9709a3 666 * @arg HAL_OSPI_IT_TO: OSPI Timeout interrupt
AnnaBridge 189:f392fc9709a3 667 * @arg HAL_OSPI_IT_SM: OSPI Status match interrupt
AnnaBridge 189:f392fc9709a3 668 * @arg HAL_OSPI_IT_FT: OSPI FIFO threshold interrupt
AnnaBridge 189:f392fc9709a3 669 * @arg HAL_OSPI_IT_TC: OSPI Transfer complete interrupt
AnnaBridge 189:f392fc9709a3 670 * @arg HAL_OSPI_IT_TE: OSPI Transfer error interrupt
AnnaBridge 189:f392fc9709a3 671 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
AnnaBridge 189:f392fc9709a3 672 */
AnnaBridge 189:f392fc9709a3 673 #define __HAL_OSPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__)) == (__INTERRUPT__))
AnnaBridge 189:f392fc9709a3 674
AnnaBridge 189:f392fc9709a3 675 /**
AnnaBridge 189:f392fc9709a3 676 * @brief Check whether the selected OSPI flag is set or not.
AnnaBridge 189:f392fc9709a3 677 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 678 * @param __FLAG__: specifies the OSPI flag to check.
AnnaBridge 189:f392fc9709a3 679 * This parameter can be one of the following values:
AnnaBridge 189:f392fc9709a3 680 * @arg HAL_OSPI_FLAG_BUSY: OSPI Busy flag
AnnaBridge 189:f392fc9709a3 681 * @arg HAL_OSPI_FLAG_TO: OSPI Timeout flag
AnnaBridge 189:f392fc9709a3 682 * @arg HAL_OSPI_FLAG_SM: OSPI Status match flag
AnnaBridge 189:f392fc9709a3 683 * @arg HAL_OSPI_FLAG_FT: OSPI FIFO threshold flag
AnnaBridge 189:f392fc9709a3 684 * @arg HAL_OSPI_FLAG_TC: OSPI Transfer complete flag
AnnaBridge 189:f392fc9709a3 685 * @arg HAL_OSPI_FLAG_TE: OSPI Transfer error flag
AnnaBridge 189:f392fc9709a3 686 * @retval None
AnnaBridge 189:f392fc9709a3 687 */
AnnaBridge 189:f392fc9709a3 688 #define __HAL_OSPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BIT((__HANDLE__)->Instance->SR, (__FLAG__)) != 0) ? SET : RESET)
AnnaBridge 189:f392fc9709a3 689
AnnaBridge 189:f392fc9709a3 690 /** @brief Clears the specified OSPI's flag status.
AnnaBridge 189:f392fc9709a3 691 * @param __HANDLE__: specifies the OSPI Handle.
AnnaBridge 189:f392fc9709a3 692 * @param __FLAG__: specifies the OSPI clear register flag that needs to be set
AnnaBridge 189:f392fc9709a3 693 * This parameter can be one of the following values:
AnnaBridge 189:f392fc9709a3 694 * @arg HAL_OSPI_FLAG_TO: OSPI Timeout flag
AnnaBridge 189:f392fc9709a3 695 * @arg HAL_OSPI_FLAG_SM: OSPI Status match flag
AnnaBridge 189:f392fc9709a3 696 * @arg HAL_OSPI_FLAG_TC: OSPI Transfer complete flag
AnnaBridge 189:f392fc9709a3 697 * @arg HAL_OSPI_FLAG_TE: OSPI Transfer error flag
AnnaBridge 189:f392fc9709a3 698 * @retval None
AnnaBridge 189:f392fc9709a3 699 */
AnnaBridge 189:f392fc9709a3 700 #define __HAL_OSPI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->FCR, (__FLAG__))
AnnaBridge 189:f392fc9709a3 701
AnnaBridge 189:f392fc9709a3 702 /**
AnnaBridge 189:f392fc9709a3 703 * @}
AnnaBridge 189:f392fc9709a3 704 */
AnnaBridge 189:f392fc9709a3 705
AnnaBridge 189:f392fc9709a3 706 /* Exported functions --------------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 707 /** @addtogroup OSPI_Exported_Functions
AnnaBridge 189:f392fc9709a3 708 * @{
AnnaBridge 189:f392fc9709a3 709 */
AnnaBridge 189:f392fc9709a3 710
AnnaBridge 189:f392fc9709a3 711 /* Initialization/de-initialization functions ********************************/
AnnaBridge 189:f392fc9709a3 712 /** @addtogroup OSPI_Exported_Functions_Group1
AnnaBridge 189:f392fc9709a3 713 * @{
AnnaBridge 189:f392fc9709a3 714 */
AnnaBridge 189:f392fc9709a3 715 HAL_StatusTypeDef HAL_OSPI_Init (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 716 void HAL_OSPI_MspInit (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 717 HAL_StatusTypeDef HAL_OSPI_DeInit (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 718 void HAL_OSPI_MspDeInit (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 719
AnnaBridge 189:f392fc9709a3 720 /**
AnnaBridge 189:f392fc9709a3 721 * @}
AnnaBridge 189:f392fc9709a3 722 */
AnnaBridge 189:f392fc9709a3 723
AnnaBridge 189:f392fc9709a3 724 /* IO operation functions *****************************************************/
AnnaBridge 189:f392fc9709a3 725 /** @addtogroup OSPI_Exported_Functions_Group2
AnnaBridge 189:f392fc9709a3 726 * @{
AnnaBridge 189:f392fc9709a3 727 */
AnnaBridge 189:f392fc9709a3 728 /* OSPI IRQ handler function */
AnnaBridge 189:f392fc9709a3 729 void HAL_OSPI_IRQHandler (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 730
AnnaBridge 189:f392fc9709a3 731 /* OSPI command configuration functions */
AnnaBridge 189:f392fc9709a3 732 HAL_StatusTypeDef HAL_OSPI_Command (OSPI_HandleTypeDef *hospi, OSPI_RegularCmdTypeDef *cmd, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 733 HAL_StatusTypeDef HAL_OSPI_Command_IT (OSPI_HandleTypeDef *hospi, OSPI_RegularCmdTypeDef *cmd);
AnnaBridge 189:f392fc9709a3 734 HAL_StatusTypeDef HAL_OSPI_HyperbusCfg (OSPI_HandleTypeDef *hospi, OSPI_HyperbusCfgTypeDef *cfg, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 735 HAL_StatusTypeDef HAL_OSPI_HyperbusCmd (OSPI_HandleTypeDef *hospi, OSPI_HyperbusCmdTypeDef *cmd, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 736
AnnaBridge 189:f392fc9709a3 737 /* OSPI indirect mode functions */
AnnaBridge 189:f392fc9709a3 738 HAL_StatusTypeDef HAL_OSPI_Transmit (OSPI_HandleTypeDef *hospi, uint8_t *pData, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 739 HAL_StatusTypeDef HAL_OSPI_Receive (OSPI_HandleTypeDef *hospi, uint8_t *pData, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 740 HAL_StatusTypeDef HAL_OSPI_Transmit_IT (OSPI_HandleTypeDef *hospi, uint8_t *pData);
AnnaBridge 189:f392fc9709a3 741 HAL_StatusTypeDef HAL_OSPI_Receive_IT (OSPI_HandleTypeDef *hospi, uint8_t *pData);
AnnaBridge 189:f392fc9709a3 742 HAL_StatusTypeDef HAL_OSPI_Transmit_DMA (OSPI_HandleTypeDef *hospi, uint8_t *pData);
AnnaBridge 189:f392fc9709a3 743 HAL_StatusTypeDef HAL_OSPI_Receive_DMA (OSPI_HandleTypeDef *hospi, uint8_t *pData);
AnnaBridge 189:f392fc9709a3 744
AnnaBridge 189:f392fc9709a3 745 /* OSPI status flag polling mode functions */
AnnaBridge 189:f392fc9709a3 746 HAL_StatusTypeDef HAL_OSPI_AutoPolling (OSPI_HandleTypeDef *hospi, OSPI_AutoPollingTypeDef *cfg, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 747 HAL_StatusTypeDef HAL_OSPI_AutoPolling_IT (OSPI_HandleTypeDef *hospi, OSPI_AutoPollingTypeDef *cfg);
AnnaBridge 189:f392fc9709a3 748
AnnaBridge 189:f392fc9709a3 749 /* OSPI memory-mapped mode functions */
AnnaBridge 189:f392fc9709a3 750 HAL_StatusTypeDef HAL_OSPI_MemoryMapped (OSPI_HandleTypeDef *hospi, OSPI_MemoryMappedTypeDef *cfg);
AnnaBridge 189:f392fc9709a3 751
AnnaBridge 189:f392fc9709a3 752 /* Callback functions in non-blocking modes ***********************************/
AnnaBridge 189:f392fc9709a3 753 void HAL_OSPI_ErrorCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 754 void HAL_OSPI_AbortCpltCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 755 void HAL_OSPI_FifoThresholdCallback(OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 756
AnnaBridge 189:f392fc9709a3 757 /* OSPI indirect mode functions */
AnnaBridge 189:f392fc9709a3 758 void HAL_OSPI_CmdCpltCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 759 void HAL_OSPI_RxCpltCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 760 void HAL_OSPI_TxCpltCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 761 void HAL_OSPI_RxHalfCpltCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 762 void HAL_OSPI_TxHalfCpltCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 763
AnnaBridge 189:f392fc9709a3 764 /* OSPI status flag polling mode functions */
AnnaBridge 189:f392fc9709a3 765 void HAL_OSPI_StatusMatchCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 766
AnnaBridge 189:f392fc9709a3 767 /* OSPI memory-mapped mode functions */
AnnaBridge 189:f392fc9709a3 768 void HAL_OSPI_TimeOutCallback (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 769
AnnaBridge 189:f392fc9709a3 770 /**
AnnaBridge 189:f392fc9709a3 771 * @}
AnnaBridge 189:f392fc9709a3 772 */
AnnaBridge 189:f392fc9709a3 773
AnnaBridge 189:f392fc9709a3 774 /* Peripheral Control and State functions ************************************/
AnnaBridge 189:f392fc9709a3 775 /** @addtogroup OSPI_Exported_Functions_Group3
AnnaBridge 189:f392fc9709a3 776 * @{
AnnaBridge 189:f392fc9709a3 777 */
AnnaBridge 189:f392fc9709a3 778 HAL_StatusTypeDef HAL_OSPI_Abort (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 779 HAL_StatusTypeDef HAL_OSPI_Abort_IT (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 780 HAL_StatusTypeDef HAL_OSPI_SetFifoThreshold (OSPI_HandleTypeDef *hospi, uint32_t Threshold);
AnnaBridge 189:f392fc9709a3 781 uint32_t HAL_OSPI_GetFifoThreshold (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 782 HAL_StatusTypeDef HAL_OSPI_SetTimeout (OSPI_HandleTypeDef *hospi, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 783 uint32_t HAL_OSPI_GetError (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 784 uint32_t HAL_OSPI_GetState (OSPI_HandleTypeDef *hospi);
AnnaBridge 189:f392fc9709a3 785
AnnaBridge 189:f392fc9709a3 786 /**
AnnaBridge 189:f392fc9709a3 787 * @}
AnnaBridge 189:f392fc9709a3 788 */
AnnaBridge 189:f392fc9709a3 789
AnnaBridge 189:f392fc9709a3 790 /* OSPI IO Manager configuration function ************************************/
AnnaBridge 189:f392fc9709a3 791 /** @addtogroup OSPI_Exported_Functions_Group4
AnnaBridge 189:f392fc9709a3 792 * @{
AnnaBridge 189:f392fc9709a3 793 */
AnnaBridge 189:f392fc9709a3 794 HAL_StatusTypeDef HAL_OSPIM_Config (OSPI_HandleTypeDef *hospi, OSPIM_CfgTypeDef *cfg, uint32_t Timeout);
AnnaBridge 189:f392fc9709a3 795
AnnaBridge 189:f392fc9709a3 796 /**
AnnaBridge 189:f392fc9709a3 797 * @}
AnnaBridge 189:f392fc9709a3 798 */
AnnaBridge 189:f392fc9709a3 799
AnnaBridge 189:f392fc9709a3 800 /**
AnnaBridge 189:f392fc9709a3 801 * @}
AnnaBridge 189:f392fc9709a3 802 */
AnnaBridge 189:f392fc9709a3 803 /* End of exported functions -------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 804
AnnaBridge 189:f392fc9709a3 805 /* Private macros ------------------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 806 /**
AnnaBridge 189:f392fc9709a3 807 @cond 0
AnnaBridge 189:f392fc9709a3 808 */
AnnaBridge 189:f392fc9709a3 809 #define IS_OSPI_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) >= 1) && ((THRESHOLD) <= 32))
AnnaBridge 189:f392fc9709a3 810
AnnaBridge 189:f392fc9709a3 811 #define IS_OSPI_DUALQUAD_MODE(MODE) (((MODE) == HAL_OSPI_DUALQUAD_DISABLE) || \
AnnaBridge 189:f392fc9709a3 812 ((MODE) == HAL_OSPI_DUALQUAD_ENABLE))
AnnaBridge 189:f392fc9709a3 813
AnnaBridge 189:f392fc9709a3 814 #define IS_OSPI_MEMORY_TYPE(TYPE) (((TYPE) == HAL_OSPI_MEMTYPE_MICRON) || \
AnnaBridge 189:f392fc9709a3 815 ((TYPE) == HAL_OSPI_MEMTYPE_MACRONIX) || \
AnnaBridge 189:f392fc9709a3 816 ((TYPE) == HAL_OSPI_MEMTYPE_HYPERBUS))
AnnaBridge 189:f392fc9709a3 817
AnnaBridge 189:f392fc9709a3 818 #define IS_OSPI_DEVICE_SIZE(SIZE) (((SIZE) >= 1) && ((SIZE) <= 32))
AnnaBridge 189:f392fc9709a3 819
AnnaBridge 189:f392fc9709a3 820 #define IS_OSPI_CS_HIGH_TIME(TIME) (((TIME) >= 1) && ((TIME) <= 8))
AnnaBridge 189:f392fc9709a3 821
AnnaBridge 189:f392fc9709a3 822 #define IS_OSPI_FREE_RUN_CLK(CLK) (((CLK) == HAL_OSPI_FREERUNCLK_DISABLE) || \
AnnaBridge 189:f392fc9709a3 823 ((CLK) == HAL_OSPI_FREERUNCLK_ENABLE))
AnnaBridge 189:f392fc9709a3 824
AnnaBridge 189:f392fc9709a3 825 #define IS_OSPI_CLOCK_MODE(MODE) (((MODE) == HAL_OSPI_CLOCK_MODE_0) || \
AnnaBridge 189:f392fc9709a3 826 ((MODE) == HAL_OSPI_CLOCK_MODE_3))
AnnaBridge 189:f392fc9709a3 827
AnnaBridge 189:f392fc9709a3 828 #define IS_OSPI_WRAP_SIZE(SIZE) (((SIZE) == HAL_OSPI_WRAP_NOT_SUPPORTED) || \
AnnaBridge 189:f392fc9709a3 829 ((SIZE) == HAL_OSPI_WRAP_16_BYTES) || \
AnnaBridge 189:f392fc9709a3 830 ((SIZE) == HAL_OSPI_WRAP_32_BYTES) || \
AnnaBridge 189:f392fc9709a3 831 ((SIZE) == HAL_OSPI_WRAP_64_BYTES) || \
AnnaBridge 189:f392fc9709a3 832 ((SIZE) == HAL_OSPI_WRAP_128_BYTES))
AnnaBridge 189:f392fc9709a3 833
AnnaBridge 189:f392fc9709a3 834 #define IS_OSPI_CLK_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 256))
AnnaBridge 189:f392fc9709a3 835
AnnaBridge 189:f392fc9709a3 836 #define IS_OSPI_SAMPLE_SHIFTING(CYCLE) (((CYCLE) == HAL_OSPI_SAMPLE_SHIFTING_NONE) || \
AnnaBridge 189:f392fc9709a3 837 ((CYCLE) == HAL_OSPI_SAMPLE_SHIFTING_HALFCYCLE))
AnnaBridge 189:f392fc9709a3 838
AnnaBridge 189:f392fc9709a3 839 #define IS_OSPI_DHQC(CYCLE) (((CYCLE) == HAL_OSPI_DHQC_DISABLE) || \
AnnaBridge 189:f392fc9709a3 840 ((CYCLE) == HAL_OSPI_DHQC_ENABLE))
AnnaBridge 189:f392fc9709a3 841
AnnaBridge 189:f392fc9709a3 842 #define IS_OSPI_OPERATION_TYPE(TYPE) (((TYPE) == HAL_OSPI_OPTYPE_COMMON_CFG) || \
AnnaBridge 189:f392fc9709a3 843 ((TYPE) == HAL_OSPI_OPTYPE_READ_CFG) || \
AnnaBridge 189:f392fc9709a3 844 ((TYPE) == HAL_OSPI_OPTYPE_WRITE_CFG))
AnnaBridge 189:f392fc9709a3 845
AnnaBridge 189:f392fc9709a3 846 #define IS_OSPI_FLASH_ID(FLASH) (((FLASH) == HAL_OSPI_FLASH_ID_1) || \
AnnaBridge 189:f392fc9709a3 847 ((FLASH) == HAL_OSPI_FLASH_ID_2))
AnnaBridge 189:f392fc9709a3 848
AnnaBridge 189:f392fc9709a3 849 #define IS_OSPI_INSTRUCTION_MODE(MODE) (((MODE) == HAL_OSPI_INSTRUCTION_NONE) || \
AnnaBridge 189:f392fc9709a3 850 ((MODE) == HAL_OSPI_INSTRUCTION_1_LINE) || \
AnnaBridge 189:f392fc9709a3 851 ((MODE) == HAL_OSPI_INSTRUCTION_2_LINES) || \
AnnaBridge 189:f392fc9709a3 852 ((MODE) == HAL_OSPI_INSTRUCTION_4_LINES) || \
AnnaBridge 189:f392fc9709a3 853 ((MODE) == HAL_OSPI_INSTRUCTION_8_LINES))
AnnaBridge 189:f392fc9709a3 854
AnnaBridge 189:f392fc9709a3 855 #define IS_OSPI_INSTRUCTION_SIZE(SIZE) (((SIZE) == HAL_OSPI_INSTRUCTION_8_BITS) || \
AnnaBridge 189:f392fc9709a3 856 ((SIZE) == HAL_OSPI_INSTRUCTION_16_BITS) || \
AnnaBridge 189:f392fc9709a3 857 ((SIZE) == HAL_OSPI_INSTRUCTION_24_BITS) || \
AnnaBridge 189:f392fc9709a3 858 ((SIZE) == HAL_OSPI_INSTRUCTION_32_BITS))
AnnaBridge 189:f392fc9709a3 859
AnnaBridge 189:f392fc9709a3 860 #define IS_OSPI_INSTRUCTION_DTR_MODE(MODE) (((MODE) == HAL_OSPI_INSTRUCTION_DTR_DISABLE) || \
AnnaBridge 189:f392fc9709a3 861 ((MODE) == HAL_OSPI_INSTRUCTION_DTR_ENABLE))
AnnaBridge 189:f392fc9709a3 862
AnnaBridge 189:f392fc9709a3 863 #define IS_OSPI_ADDRESS_MODE(MODE) (((MODE) == HAL_OSPI_ADDRESS_NONE) || \
AnnaBridge 189:f392fc9709a3 864 ((MODE) == HAL_OSPI_ADDRESS_1_LINE) || \
AnnaBridge 189:f392fc9709a3 865 ((MODE) == HAL_OSPI_ADDRESS_2_LINES) || \
AnnaBridge 189:f392fc9709a3 866 ((MODE) == HAL_OSPI_ADDRESS_4_LINES) || \
AnnaBridge 189:f392fc9709a3 867 ((MODE) == HAL_OSPI_ADDRESS_8_LINES))
AnnaBridge 189:f392fc9709a3 868
AnnaBridge 189:f392fc9709a3 869 #define IS_OSPI_ADDRESS_SIZE(SIZE) (((SIZE) == HAL_OSPI_ADDRESS_8_BITS) || \
AnnaBridge 189:f392fc9709a3 870 ((SIZE) == HAL_OSPI_ADDRESS_16_BITS) || \
AnnaBridge 189:f392fc9709a3 871 ((SIZE) == HAL_OSPI_ADDRESS_24_BITS) || \
AnnaBridge 189:f392fc9709a3 872 ((SIZE) == HAL_OSPI_ADDRESS_32_BITS))
AnnaBridge 189:f392fc9709a3 873
AnnaBridge 189:f392fc9709a3 874 #define IS_OSPI_ADDRESS_DTR_MODE(MODE) (((MODE) == HAL_OSPI_ADDRESS_DTR_DISABLE) || \
AnnaBridge 189:f392fc9709a3 875 ((MODE) == HAL_OSPI_ADDRESS_DTR_ENABLE))
AnnaBridge 189:f392fc9709a3 876
AnnaBridge 189:f392fc9709a3 877 #define IS_OSPI_ALT_BYTES_MODE(MODE) (((MODE) == HAL_OSPI_ALTERNATE_BYTES_NONE) || \
AnnaBridge 189:f392fc9709a3 878 ((MODE) == HAL_OSPI_ALTERNATE_BYTES_1_LINE) || \
AnnaBridge 189:f392fc9709a3 879 ((MODE) == HAL_OSPI_ALTERNATE_BYTES_2_LINES) || \
AnnaBridge 189:f392fc9709a3 880 ((MODE) == HAL_OSPI_ALTERNATE_BYTES_4_LINES) || \
AnnaBridge 189:f392fc9709a3 881 ((MODE) == HAL_OSPI_ALTERNATE_BYTES_8_LINES))
AnnaBridge 189:f392fc9709a3 882
AnnaBridge 189:f392fc9709a3 883 #define IS_OSPI_ALT_BYTES_SIZE(SIZE) (((SIZE) == HAL_OSPI_ALTERNATE_BYTES_8_BITS) || \
AnnaBridge 189:f392fc9709a3 884 ((SIZE) == HAL_OSPI_ALTERNATE_BYTES_16_BITS) || \
AnnaBridge 189:f392fc9709a3 885 ((SIZE) == HAL_OSPI_ALTERNATE_BYTES_24_BITS) || \
AnnaBridge 189:f392fc9709a3 886 ((SIZE) == HAL_OSPI_ALTERNATE_BYTES_32_BITS))
AnnaBridge 189:f392fc9709a3 887
AnnaBridge 189:f392fc9709a3 888 #define IS_OSPI_ALT_BYTES_DTR_MODE(MODE) (((MODE) == HAL_OSPI_ALTERNATE_BYTES_DTR_DISABLE) || \
AnnaBridge 189:f392fc9709a3 889 ((MODE) == HAL_OSPI_ALTERNATE_BYTES_DTR_ENABLE))
AnnaBridge 189:f392fc9709a3 890
AnnaBridge 189:f392fc9709a3 891 #define IS_OSPI_DATA_MODE(MODE) (((MODE) == HAL_OSPI_DATA_NONE) || \
AnnaBridge 189:f392fc9709a3 892 ((MODE) == HAL_OSPI_DATA_1_LINE) || \
AnnaBridge 189:f392fc9709a3 893 ((MODE) == HAL_OSPI_DATA_2_LINES) || \
AnnaBridge 189:f392fc9709a3 894 ((MODE) == HAL_OSPI_DATA_4_LINES) || \
AnnaBridge 189:f392fc9709a3 895 ((MODE) == HAL_OSPI_DATA_8_LINES))
AnnaBridge 189:f392fc9709a3 896
AnnaBridge 189:f392fc9709a3 897 #define IS_OSPI_NUMBER_DATA(NUMBER) ((NUMBER) >= 1)
AnnaBridge 189:f392fc9709a3 898
AnnaBridge 189:f392fc9709a3 899 #define IS_OSPI_DATA_DTR_MODE(MODE) (((MODE) == HAL_OSPI_DATA_DTR_DISABLE) || \
AnnaBridge 189:f392fc9709a3 900 ((MODE) == HAL_OSPI_DATA_DTR_ENABLE))
AnnaBridge 189:f392fc9709a3 901
AnnaBridge 189:f392fc9709a3 902 #define IS_OSPI_DUMMY_CYCLES(NUMBER) ((NUMBER) <= 31)
AnnaBridge 189:f392fc9709a3 903
AnnaBridge 189:f392fc9709a3 904 #define IS_OSPI_DQS_MODE(MODE) (((MODE) == HAL_OSPI_DQS_DISABLE) || \
AnnaBridge 189:f392fc9709a3 905 ((MODE) == HAL_OSPI_DQS_ENABLE))
AnnaBridge 189:f392fc9709a3 906
AnnaBridge 189:f392fc9709a3 907 #define IS_OSPI_SIOO_MODE(MODE) (((MODE) == HAL_OSPI_SIOO_INST_EVERY_CMD) || \
AnnaBridge 189:f392fc9709a3 908 ((MODE) == HAL_OSPI_SIOO_INST_ONLY_FIRST_CMD))
AnnaBridge 189:f392fc9709a3 909
AnnaBridge 189:f392fc9709a3 910 #define IS_OSPI_RW_RECOVERY_TIME(NUMBER) ((NUMBER) <= 255)
AnnaBridge 189:f392fc9709a3 911
AnnaBridge 189:f392fc9709a3 912 #define IS_OSPI_ACCESS_TIME(NUMBER) ((NUMBER) <= 255)
AnnaBridge 189:f392fc9709a3 913
AnnaBridge 189:f392fc9709a3 914 #define IS_OSPI_WRITE_ZERO_LATENCY(MODE) (((MODE) == HAL_OSPI_LATENCY_ON_WRITE) || \
AnnaBridge 189:f392fc9709a3 915 ((MODE) == HAL_OSPI_NO_LATENCY_ON_WRITE))
AnnaBridge 189:f392fc9709a3 916
AnnaBridge 189:f392fc9709a3 917 #define IS_OSPI_LATENCY_MODE(MODE) (((MODE) == HAL_OSPI_VARIABLE_LATENCY) || \
AnnaBridge 189:f392fc9709a3 918 ((MODE) == HAL_OSPI_FIXED_LATENCY))
AnnaBridge 189:f392fc9709a3 919
AnnaBridge 189:f392fc9709a3 920 #define IS_OSPI_ADDRESS_SPACE(SPACE) (((SPACE) == HAL_OSPI_MEMORY_ADDRESS_SPACE) || \
AnnaBridge 189:f392fc9709a3 921 ((SPACE) == HAL_OSPI_REGISTER_ADDRESS_SPACE))
AnnaBridge 189:f392fc9709a3 922
AnnaBridge 189:f392fc9709a3 923 #define IS_OSPI_MATCH_MODE(MODE) (((MODE) == HAL_OSPI_MATCH_MODE_AND) || \
AnnaBridge 189:f392fc9709a3 924 ((MODE) == HAL_OSPI_MATCH_MODE_OR))
AnnaBridge 189:f392fc9709a3 925
AnnaBridge 189:f392fc9709a3 926 #define IS_OSPI_AUTOMATIC_STOP(MODE) (((MODE) == HAL_OSPI_AUTOMATIC_STOP_ENABLE) || \
AnnaBridge 189:f392fc9709a3 927 ((MODE) == HAL_OSPI_AUTOMATIC_STOP_DISABLE))
AnnaBridge 189:f392fc9709a3 928
AnnaBridge 189:f392fc9709a3 929 #define IS_OSPI_INTERVAL(INTERVAL) ((INTERVAL) <= 0xFFFF)
AnnaBridge 189:f392fc9709a3 930
AnnaBridge 189:f392fc9709a3 931 #define IS_OSPI_STATUS_BYTES_SIZE(SIZE) (((SIZE) >= 1) && ((SIZE) <= 4))
AnnaBridge 189:f392fc9709a3 932
AnnaBridge 189:f392fc9709a3 933 #define IS_OSPI_TIMEOUT_ACTIVATION(MODE) (((MODE) == HAL_OSPI_TIMEOUT_COUNTER_DISABLE) || \
AnnaBridge 189:f392fc9709a3 934 ((MODE) == HAL_OSPI_TIMEOUT_COUNTER_ENABLE))
AnnaBridge 189:f392fc9709a3 935
AnnaBridge 189:f392fc9709a3 936 #define IS_OSPI_TIMEOUT_PERIOD(PERIOD) ((PERIOD) <= 0xFFFF)
AnnaBridge 189:f392fc9709a3 937
AnnaBridge 189:f392fc9709a3 938 #define IS_OSPI_CS_BOUNDARY(BOUNDARY) ((BOUNDARY) <= 31)
AnnaBridge 189:f392fc9709a3 939
AnnaBridge 189:f392fc9709a3 940 #define IS_OSPIM_PORT(NUMBER) (((NUMBER) >= 1) && ((NUMBER) <= 2))
AnnaBridge 189:f392fc9709a3 941
AnnaBridge 189:f392fc9709a3 942 #define IS_OSPIM_IO_PORT(PORT) (((PORT) == HAL_OSPIM_IOPORT_1_LOW) || \
AnnaBridge 189:f392fc9709a3 943 ((PORT) == HAL_OSPIM_IOPORT_1_HIGH) || \
AnnaBridge 189:f392fc9709a3 944 ((PORT) == HAL_OSPIM_IOPORT_2_LOW) || \
AnnaBridge 189:f392fc9709a3 945 ((PORT) == HAL_OSPIM_IOPORT_2_HIGH))
AnnaBridge 189:f392fc9709a3 946 /**
AnnaBridge 189:f392fc9709a3 947 @endcond
AnnaBridge 189:f392fc9709a3 948 */
AnnaBridge 189:f392fc9709a3 949
AnnaBridge 189:f392fc9709a3 950 /* End of private macros -----------------------------------------------------*/
AnnaBridge 189:f392fc9709a3 951
AnnaBridge 189:f392fc9709a3 952 /**
AnnaBridge 189:f392fc9709a3 953 * @}
AnnaBridge 189:f392fc9709a3 954 */
AnnaBridge 189:f392fc9709a3 955
AnnaBridge 189:f392fc9709a3 956 /**
AnnaBridge 189:f392fc9709a3 957 * @}
AnnaBridge 189:f392fc9709a3 958 */
AnnaBridge 189:f392fc9709a3 959
AnnaBridge 189:f392fc9709a3 960 #endif /* OCTOSPI || OCTOSPI1 || OCTOSPI2 */
AnnaBridge 189:f392fc9709a3 961
AnnaBridge 189:f392fc9709a3 962 #ifdef __cplusplus
AnnaBridge 189:f392fc9709a3 963 }
AnnaBridge 189:f392fc9709a3 964 #endif
AnnaBridge 189:f392fc9709a3 965
AnnaBridge 189:f392fc9709a3 966 #endif /* __STM32L4xx_HAL_OSPI_H */
AnnaBridge 189:f392fc9709a3 967
AnnaBridge 189:f392fc9709a3 968 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/