1 /*
2  * Copyright (c) 2023 STMicroelectronics
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_DRIVERS_FLASH_OSPI_STM32_H_
8 #define ZEPHYR_DRIVERS_FLASH_OSPI_STM32_H_
9 
10 #if defined(CONFIG_SOC_SERIES_STM32H5X)
11 
12 #define NbData DataLength
13 #define AddressSize AddressWidth
14 #define InstructionDtrMode InstructionDTRMode
15 #define AddressDtrMode AddressDTRMode
16 #define DataDtrMode DataDTRMode
17 #define InstructionSize InstructionWidth
18 #define FifoThreshold FifoThresholdByte
19 #define ChipSelectHighTime ChipSelectHighTimeCycle
20 #define FlashId IOSelect
21 #define Match MatchValue
22 #define Mask MatchMask
23 #define Interval IntervalTime
24 #define DeviceSize MemorySize
25 #define DualQuad MemoryMode
26 
27 #define OSPI_InitTypeDef XSPI_InitTypeDef
28 #define OSPI_HandleTypeDef XSPI_HandleTypeDef
29 #define OSPI_RegularCmdTypeDef XSPI_RegularCmdTypeDef
30 #define OSPI_AutoPollingTypeDef XSPI_AutoPollingTypeDef
31 
32 #define HAL_OSPI_Init HAL_XSPI_Init
33 #define HAL_OSPI_Command HAL_XSPI_Command
34 #define HAL_OSPI_Receive HAL_XSPI_Receive
35 #define HAL_OSPI_Receive_DMA HAL_XSPI_Receive_DMA
36 #define HAL_OSPI_Receive_IT HAL_XSPI_Receive_IT
37 #define HAL_OSPI_Transmit HAL_XSPI_Transmit
38 #define HAL_OSPI_Transmit_DMA HAL_XSPI_Transmit_DMA
39 #define HAL_OSPI_Transmit_IT HAL_XSPI_Transmit_IT
40 #define HAL_OSPI_AutoPolling HAL_XSPI_AutoPolling
41 #define HAL_OSPI_AutoPolling_IT HAL_XSPI_AutoPolling_IT
42 #define HAL_OSPI_IRQHandler HAL_XSPI_IRQHandler
43 #define HAL_OSPI_Abort HAL_XSPI_Abort
44 
45 #define HAL_OSPI_ErrorCallback HAL_XSPI_ErrorCallback
46 #define HAL_OSPI_CmdCpltCallback HAL_XSPI_CmdCpltCallback
47 #define HAL_OSPI_RxCpltCallback HAL_XSPI_RxCpltCallback
48 #define HAL_OSPI_TxCpltCallback HAL_XSPI_TxCpltCallback
49 #define HAL_OSPI_StatusMatchCallback HAL_XSPI_StatusMatchCallback
50 #define HAL_OSPI_TimeOutCallback HAL_XSPI_TimeOutCallback
51 
52 #define HAL_OSPI_ADDRESS_NONE HAL_XSPI_ADDRESS_NONE
53 #define HAL_OSPI_ADDRESS_8_LINES HAL_XSPI_ADDRESS_8_LINES
54 #define HAL_OSPI_ADDRESS_4_LINES HAL_XSPI_ADDRESS_4_LINES
55 #define HAL_OSPI_ADDRESS_2_LINES HAL_XSPI_ADDRESS_2_LINES
56 #define HAL_OSPI_ADDRESS_1_LINE HAL_XSPI_ADDRESS_1_LINE
57 #define HAL_OSPI_ADDRESS_32_BITS HAL_XSPI_ADDRESS_32_BITS
58 #define HAL_OSPI_ADDRESS_24_BITS HAL_XSPI_ADDRESS_24_BITS
59 #define HAL_OSPI_ADDRESS_16_BITS HAL_XSPI_ADDRESS_16_BITS
60 #define HAL_OSPI_ADDRESS_8_BITS HAL_XSPI_ADDRESS_8_BITS
61 #define HAL_OSPI_ADDRESS_DTR_ENABLE HAL_XSPI_ADDRESS_DTR_ENABLE
62 #define HAL_OSPI_ADDRESS_DTR_DISABLE HAL_XSPI_ADDRESS_DTR_DISABLE
63 #define HAL_OSPI_INSTRUCTION_8_LINES HAL_XSPI_INSTRUCTION_8_LINES
64 #define HAL_OSPI_INSTRUCTION_4_LINES HAL_XSPI_INSTRUCTION_4_LINES
65 #define HAL_OSPI_INSTRUCTION_2_LINES HAL_XSPI_INSTRUCTION_2_LINES
66 #define HAL_OSPI_INSTRUCTION_1_LINE HAL_XSPI_INSTRUCTION_1_LINE
67 #define HAL_OSPI_INSTRUCTION_32_BITS HAL_XSPI_INSTRUCTION_32_BITS
68 #define HAL_OSPI_INSTRUCTION_16_BITS HAL_XSPI_INSTRUCTION_16_BITS
69 #define HAL_OSPI_INSTRUCTION_8_BITS HAL_XSPI_INSTRUCTION_8_BITS
70 #define HAL_OSPI_INSTRUCTION_DTR_ENABLE HAL_XSPI_INSTRUCTION_DTR_ENABLE
71 #define HAL_OSPI_INSTRUCTION_DTR_DISABLE HAL_XSPI_INSTRUCTION_DTR_DISABLE
72 
73 #define HAL_OSPI_ALTERNATE_BYTES_NONE HAL_XSPI_ALT_BYTES_NONE
74 #define HAL_OSPI_DATA_NONE HAL_XSPI_DATA_NONE
75 #define HAL_OSPI_DATA_8_LINES HAL_XSPI_DATA_8_LINES
76 #define HAL_OSPI_DATA_4_LINES HAL_XSPI_DATA_4_LINES
77 #define HAL_OSPI_DATA_2_LINES HAL_XSPI_DATA_2_LINES
78 #define HAL_OSPI_DATA_1_LINE HAL_XSPI_DATA_1_LINE
79 #define HAL_OSPI_DATA_DTR_ENABLE HAL_XSPI_DATA_DTR_ENABLE
80 #define HAL_OSPI_DATA_DTR_DISABLE HAL_XSPI_DATA_DTR_DISABLE
81 #define HAL_OSPI_DQS_ENABLE HAL_XSPI_DQS_ENABLE
82 #define HAL_OSPI_DQS_DISABLE HAL_XSPI_DQS_DISABLE
83 
84 #define HAL_OSPI_MATCH_MODE_AND HAL_XSPI_MATCH_MODE_AND
85 #define HAL_OSPI_SIOO_INST_EVERY_CMD HAL_XSPI_SIOO_INST_EVERY_CMD
86 #define HAL_OSPI_AUTOMATIC_STOP_ENABLE HAL_XSPI_AUTOMATIC_STOP_ENABLE
87 #define HAL_OSPI_OPTYPE_COMMON_CFG HAL_XSPI_OPTYPE_COMMON_CFG
88 #define HAL_OSPI_TIMEOUT_DEFAULT_VALUE HAL_XSPI_TIMEOUT_DEFAULT_VALUE
89 
90 #define HAL_OSPI_CLOCK_MODE_0 HAL_XSPI_CLOCK_MODE_0
91 #define HAL_OSPI_FLASH_ID_1 HAL_XSPI_SELECT_IO_7_0
92 #define HAL_OSPI_DUALQUAD_DISABLE HAL_XSPI_SINGLE_MEM
93 #define HAL_OSPI_DUALQUAD_ENABLE HAL_XSPI_DUAL_MEM
94 #define HAL_OSPI_SAMPLE_SHIFTING_NONE HAL_XSPI_SAMPLE_SHIFT_NONE
95 #define HAL_OSPI_SAMPLE_SHIFTING_HALFCYCLE HAL_XSPI_SAMPLE_SHIFT_HALFCYCLE
96 #define HAL_OSPI_DELAY_BLOCK_USED HAL_XSPI_DELAY_BLOCK_ON
97 #define HAL_OSPI_DELAY_BLOCK_BYPASSED HAL_XSPI_DELAY_BLOCK_BYPASS
98 #define HAL_OSPI_MEMTYPE_MICRON HAL_XSPI_MEMTYPE_MICRON
99 #define HAL_OSPI_MEMTYPE_MACRONIX HAL_XSPI_MEMTYPE_MACRONIX
100 #define HAL_OSPI_DHQC_ENABLE HAL_XSPI_DHQC_ENABLE
101 #define HAL_OSPI_DHQC_DISABLE HAL_XSPI_DHQC_DISABLE
102 #define HAL_OSPI_WRAP_NOT_SUPPORTED HAL_XSPI_WRAP_NOT_SUPPORTED
103 #define HAL_OSPI_FREERUNCLK_DISABLE HAL_XSPI_FREERUNCLK_DISABLE
104 #endif /* CONFIG_SOC_SERIES_STM32H5X */
105 
106 #endif /* ZEPHYR_DRIVERS_FLASH_OSPIH_STM32_H_ */
107