fsl_flexspi.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. /*
  2. * The Clear BSD License
  3. * Copyright (c) 2016, Freescale Semiconductor, Inc.
  4. * Copyright 2016-2017 NXP
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without modification,
  8. * are permitted (subject to the limitations in the disclaimer below) provided
  9. * that the following conditions are met:
  10. *
  11. * o Redistributions of source code must retain the above copyright notice, this list
  12. * of conditions and the following disclaimer.
  13. *
  14. * o Redistributions in binary form must reproduce the above copyright notice, this
  15. * list of conditions and the following disclaimer in the documentation and/or
  16. * other materials provided with the distribution.
  17. *
  18. * o Neither the name of the copyright holder nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef __FSL_FLEXSPI_H_
  35. #define __FSL_FLEXSPI_H_
  36. #include <rtthread.h>
  37. #include <stddef.h>
  38. #include "fsl_device_registers.h"
  39. #include "fsl_common.h"
  40. /*!
  41. * @addtogroup flexspi
  42. * @{
  43. */
  44. /*******************************************************************************
  45. * Definitions
  46. ******************************************************************************/
  47. /*! @name Driver version */
  48. /*@{*/
  49. /*! @brief FLEXSPI driver version 2.0.2. */
  50. #define FSL_FLEXSPI_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
  51. /*@}*/
  52. #define FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNTn(0)
  53. /*! @breif Formula to form FLEXSPI instructions in LUT table. */
  54. #define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) \
  55. (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \
  56. FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1))
  57. /*! @brief Status structure of FLEXSPI.*/
  58. enum _flexspi_status
  59. {
  60. kStatus_FLEXSPI_Busy = MAKE_STATUS(kStatusGroup_FLEXSPI, 0), /*!< FLEXSPI is busy */
  61. kStatus_FLEXSPI_SequenceExecutionTimeout = MAKE_STATUS(kStatusGroup_FLEXSPI, 1), /*!< Sequence execution timeout
  62. error occurred during FLEXSPI transfer. */
  63. kStatus_FLEXSPI_IpCommandSequenceError = MAKE_STATUS(kStatusGroup_FLEXSPI, 2), /*!< IP command Sequence execution
  64. timeout error occurred during FLEXSPI transfer. */
  65. kStatus_FLEXSPI_IpCommandGrantTimeout = MAKE_STATUS(kStatusGroup_FLEXSPI, 3), /*!< IP command grant timeout error
  66. occurred during FLEXSPI transfer. */
  67. };
  68. /*! @brief CMD definition of FLEXSPI, use to form LUT instruction. */
  69. enum _flexspi_command
  70. {
  71. kFLEXSPI_Command_STOP = 0x00U, /*!< Stop execution, deassert CS. */
  72. kFLEXSPI_Command_SDR = 0x01U, /*!< Transmit Command code to Flash, using SDR mode. */
  73. kFLEXSPI_Command_RADDR_SDR = 0x02U, /*!< Transmit Row Address to Flash, using SDR mode. */
  74. kFLEXSPI_Command_CADDR_SDR = 0x03U, /*!< Transmit Column Address to Flash, using SDR mode. */
  75. kFLEXSPI_Command_MODE1_SDR = 0x04U, /*!< Transmit 1-bit Mode bits to Flash, using SDR mode. */
  76. kFLEXSPI_Command_MODE2_SDR = 0x05U, /*!< Transmit 2-bit Mode bits to Flash, using SDR mode. */
  77. kFLEXSPI_Command_MODE4_SDR = 0x06U, /*!< Transmit 4-bit Mode bits to Flash, using SDR mode. */
  78. kFLEXSPI_Command_MODE8_SDR = 0x07U, /*!< Transmit 8-bit Mode bits to Flash, using SDR mode. */
  79. kFLEXSPI_Command_WRITE_SDR = 0x08U, /*!< Transmit Programming Data to Flash, using SDR mode. */
  80. kFLEXSPI_Command_READ_SDR = 0x09U, /*!< Receive Read Data from Flash, using SDR mode. */
  81. kFLEXSPI_Command_LEARN_SDR = 0x0AU, /*!< Receive Read Data or Preamble bit from Flash, SDR mode. */
  82. kFLEXSPI_Command_DATSZ_SDR = 0x0BU, /*!< Transmit Read/Program Data size (byte) to Flash, SDR mode. */
  83. kFLEXSPI_Command_DUMMY_SDR = 0x0CU, /*!< Leave data lines undriven by FlexSPI controller.*/
  84. kFLEXSPI_Command_DUMMY_RWDS_SDR = 0x0DU, /*!< Leave data lines undriven by FlexSPI controller,
  85. dummy cycles decided by RWDS. */
  86. kFLEXSPI_Command_DDR = 0x21U, /*!< Transmit Command code to Flash, using DDR mode. */
  87. kFLEXSPI_Command_RADDR_DDR = 0x22U, /*!< Transmit Row Address to Flash, using DDR mode. */
  88. kFLEXSPI_Command_CADDR_DDR = 0x23U, /*!< Transmit Column Address to Flash, using DDR mode. */
  89. kFLEXSPI_Command_MODE1_DDR = 0x24U, /*!< Transmit 1-bit Mode bits to Flash, using DDR mode. */
  90. kFLEXSPI_Command_MODE2_DDR = 0x25U, /*!< Transmit 2-bit Mode bits to Flash, using DDR mode. */
  91. kFLEXSPI_Command_MODE4_DDR = 0x26U, /*!< Transmit 4-bit Mode bits to Flash, using DDR mode. */
  92. kFLEXSPI_Command_MODE8_DDR = 0x27U, /*!< Transmit 8-bit Mode bits to Flash, using DDR mode. */
  93. kFLEXSPI_Command_WRITE_DDR = 0x28U, /*!< Transmit Programming Data to Flash, using DDR mode. */
  94. kFLEXSPI_Command_READ_DDR = 0x29U, /*!< Receive Read Data from Flash, using DDR mode. */
  95. kFLEXSPI_Command_LEARN_DDR = 0x2AU, /*!< Receive Read Data or Preamble bit from Flash, DDR mode. */
  96. kFLEXSPI_Command_DATSZ_DDR = 0x2BU, /*!< Transmit Read/Program Data size (byte) to Flash, DDR mode. */
  97. kFLEXSPI_Command_DUMMY_DDR = 0x2CU, /*!< Leave data lines undriven by FlexSPI controller.*/
  98. kFLEXSPI_Command_DUMMY_RWDS_DDR = 0x2DU, /*!< Leave data lines undriven by FlexSPI controller,
  99. dummy cycles decided by RWDS. */
  100. kFLEXSPI_Command_JUMP_ON_CS = 0x1FU, /*!< Stop execution, deassert CS and save operand[7:0] as the
  101. instruction start pointer for next sequence */
  102. };
  103. /*! @brief pad definition of FLEXSPI, use to form LUT instruction. */
  104. enum _flexspi_pad
  105. {
  106. kFLEXSPI_1PAD = 0x00U, /*!< Transmit command/address and transmit/receive data only through DATA0/DATA1. */
  107. kFLEXSPI_2PAD = 0x01U, /*!< Transmit command/address and transmit/receive data only through DATA[1:0]. */
  108. kFLEXSPI_4PAD = 0x02U, /*!< Transmit command/address and transmit/receive data only through DATA[3:0]. */
  109. kFLEXSPI_8PAD = 0x03U, /*!< Transmit command/address and transmit/receive data only through DATA[7:0]. */
  110. };
  111. /*! @brief FLEXSPI interrupt status flags.*/
  112. typedef enum _flexspi_flags
  113. {
  114. kFLEXSPI_SequenceExecutionTimeoutFlag = FLEXSPI_INTEN_SEQTIMEOUTEN_MASK, /*!< Sequence execution timeout. */
  115. kFLEXSPI_AhbBusTimeoutFlag = FLEXSPI_INTEN_AHBBUSTIMEOUTEN_MASK, /*!< AHB Bus timeout. */
  116. kFLEXSPI_SckStoppedBecauseTxEmptyFlag =
  117. FLEXSPI_INTEN_SCKSTOPBYWREN_MASK, /*!< SCK is stopped during command
  118. sequence because Async TX FIFO empty. */
  119. kFLEXSPI_SckStoppedBecauseRxFullFlag =
  120. FLEXSPI_INTEN_SCKSTOPBYRDEN_MASK, /*!< SCK is stopped during command
  121. sequence because Async RX FIFO full. */
  122. #if !((defined(FSL_FEATURE_FLEXSPI_HAS_NO_DATA_LEARN)) && (FSL_FEATURE_FLEXSPI_HAS_NO_DATA_LEARN))
  123. kFLEXSPI_DataLearningFailedFlag = FLEXSPI_INTEN_DATALEARNFAILEN_MASK, /*!< Data learning failed. */
  124. #endif
  125. kFLEXSPI_IpTxFifoWatermarkEmpltyFlag = FLEXSPI_INTEN_IPTXWEEN_MASK, /*!< IP TX FIFO WaterMark empty. */
  126. kFLEXSPI_IpRxFifoWatermarkAvailableFlag = FLEXSPI_INTEN_IPRXWAEN_MASK, /*!< IP RX FIFO WaterMark available. */
  127. kFLEXSPI_AhbCommandSequenceErrorFlag =
  128. FLEXSPI_INTEN_AHBCMDERREN_MASK, /*!< AHB triggered Command Sequences Error. */
  129. kFLEXSPI_IpCommandSequenceErrorFlag = FLEXSPI_INTEN_IPCMDERREN_MASK, /*!< IP triggered Command Sequences Error. */
  130. kFLEXSPI_AhbCommandGrantTimeoutFlag =
  131. FLEXSPI_INTEN_AHBCMDGEEN_MASK, /*!< AHB triggered Command Sequences Grant Timeout. */
  132. kFLEXSPI_IpCommandGrantTimeoutFlag =
  133. FLEXSPI_INTEN_IPCMDGEEN_MASK, /*!< IP triggered Command Sequences Grant Timeout. */
  134. kFLEXSPI_IpCommandExcutionDoneFlag =
  135. FLEXSPI_INTEN_IPCMDDONEEN_MASK, /*!< IP triggered Command Sequences Execution finished. */
  136. kFLEXSPI_AllInterruptFlags = 0xFFFU, /*!< All flags. */
  137. } flexspi_flags_t;
  138. /*! @brief FLEXSPI sample clock source selection for Flash Reading.*/
  139. typedef enum _flexspi_read_sample_clock
  140. {
  141. kFLEXSPI_ReadSampleClkLoopbackInternally = 0x0U, /*!< Dummy Read strobe generated by FlexSPI Controller
  142. and loopback internally. */
  143. kFLEXSPI_ReadSampleClkLoopbackFromDqsPad = 0x1U, /*!< Dummy Read strobe generated by FlexSPI Controller
  144. and loopback from DQS pad. */
  145. kFLEXSPI_ReadSampleClkLoopbackFromSckPad = 0x2U, /*!< SCK output clock and loopback from SCK pad. */
  146. kFLEXSPI_ReadSampleClkExternalInputFromDqsPad = 0x3U, /*!< Flash provided Read strobe and input from DQS pad. */
  147. } flexspi_read_sample_clock_t;
  148. /*! @brief FLEXSPI interval unit for flash device select.*/
  149. typedef enum _flexspi_cs_interval_cycle_unit
  150. {
  151. kFLEXSPI_CsIntervalUnit1SckCycle = 0x0U, /*!< Chip selection interval: CSINTERVAL * 1 serial clock cycle. */
  152. kFLEXSPI_CsIntervalUnit256SckCycle = 0x1U, /*!< Chip selection interval: CSINTERVAL * 256 serial clock cycle. */
  153. } flexspi_cs_interval_cycle_unit_t;
  154. /*! @brief FLEXSPI AHB wait interval unit for writting.*/
  155. typedef enum _flexspi_ahb_write_wait_unit
  156. {
  157. kFLEXSPI_AhbWriteWaitUnit2AhbCycle = 0x0U, /*!< AWRWAIT unit is 2 ahb clock cycle. */
  158. kFLEXSPI_AhbWriteWaitUnit8AhbCycle = 0x1U, /*!< AWRWAIT unit is 8 ahb clock cycle. */
  159. kFLEXSPI_AhbWriteWaitUnit32AhbCycle = 0x2U, /*!< AWRWAIT unit is 32 ahb clock cycle. */
  160. kFLEXSPI_AhbWriteWaitUnit128AhbCycle = 0x3U, /*!< AWRWAIT unit is 128 ahb clock cycle. */
  161. kFLEXSPI_AhbWriteWaitUnit512AhbCycle = 0x4U, /*!< AWRWAIT unit is 512 ahb clock cycle. */
  162. kFLEXSPI_AhbWriteWaitUnit2048AhbCycle = 0x5U, /*!< AWRWAIT unit is 2048 ahb clock cycle. */
  163. kFLEXSPI_AhbWriteWaitUnit8192AhbCycle = 0x6U, /*!< AWRWAIT unit is 8192 ahb clock cycle. */
  164. kFLEXSPI_AhbWriteWaitUnit32768AhbCycle = 0x7U, /*!< AWRWAIT unit is 32768 ahb clock cycle. */
  165. } flexspi_ahb_write_wait_unit_t;
  166. /*! @brief Error Code when IP command Error detected.*/
  167. typedef enum _flexspi_ip_error_code
  168. {
  169. kFLEXSPI_IpCmdErrorNoError = 0x0U, /*!< No error. */
  170. kFLEXSPI_IpCmdErrorJumpOnCsInIpCmd = 0x2U, /*!< IP command with JMP_ON_CS instruction used. */
  171. kFLEXSPI_IpCmdErrorUnknownOpCode = 0x3U, /*!< Unknown instruction opcode in the sequence. */
  172. kFLEXSPI_IpCmdErrorSdrDummyInDdrSequence = 0x4U, /*!< Instruction DUMMY_SDR/DUMMY_RWDS_SDR
  173. used in DDR sequence. */
  174. kFLEXSPI_IpCmdErrorDdrDummyInSdrSequence = 0x5U, /*!< Instruction DUMMY_DDR/DUMMY_RWDS_DDR
  175. used in SDR sequence. */
  176. kFLEXSPI_IpCmdErrorInvalidAddress = 0x6U, /*!< Flash access start address exceed the whole
  177. flash address range (A1/A2/B1/B2). */
  178. kFLEXSPI_IpCmdErrorSequenceExecutionTimeout = 0xEU, /*!< Sequence execution timeout. */
  179. kFLEXSPI_IpCmdErrorFlashBoundaryAcrosss = 0xFU, /*!< Flash boundary crossed. */
  180. } flexspi_ip_error_code_t;
  181. /*! @brief Error Code when AHB command Error detected.*/
  182. typedef enum _flexspi_ahb_error_code
  183. {
  184. kFLEXSPI_AhbCmdErrorNoError = 0x0U, /*!< No error. */
  185. kFLEXSPI_AhbCmdErrorJumpOnCsInWriteCmd = 0x2U, /*!< AHB Write command with JMP_ON_CS instruction
  186. used in the sequence. */
  187. kFLEXSPI_AhbCmdErrorUnknownOpCode = 0x3U, /*!< Unknown instruction opcode in the sequence. */
  188. kFLEXSPI_AhbCmdErrorSdrDummyInDdrSequence = 0x4U, /*!< Instruction DUMMY_SDR/DUMMY_RWDS_SDR used
  189. in DDR sequence. */
  190. kFLEXSPI_AhbCmdErrorDdrDummyInSdrSequence = 0x5U, /*!< Instruction DUMMY_DDR/DUMMY_RWDS_DDR
  191. used in SDR sequence. */
  192. kFLEXSPI_AhbCmdSequenceExecutionTimeout = 0x6U, /*!< Sequence execution timeout. */
  193. } flexspi_ahb_error_code_t;
  194. /*! @brief FLEXSPI operation port select.*/
  195. typedef enum _flexspi_port
  196. {
  197. kFLEXSPI_PortA1 = 0x0U, /*!< Access flash on A1 port. */
  198. kFLEXSPI_PortA2 = 0x1U, /*!< Access flash on A2 port. */
  199. kFLEXSPI_PortB1 = 0x2U, /*!< Access flash on B1 port. */
  200. kFLEXSPI_PortB2 = 0x3U, /*!< Access flash on B2 port. */
  201. } flexspi_port_t;
  202. /*! @brief Trigger source of current command sequence granted by arbitrator.*/
  203. typedef enum _flexspi_arb_command_source
  204. {
  205. kFLEXSPI_AhbReadCommand = 0x0U,
  206. kFLEXSPI_AhbWriteCommand = 0x1U,
  207. kFLEXSPI_IpCommand = 0x2U,
  208. kFLEXSPI_SuspendedCommand = 0x3U,
  209. } flexspi_arb_command_source_t;
  210. typedef enum _flexspi_command_type
  211. {
  212. kFLEXSPI_Command, /*!< FlexSPI operation: Only command, both TX and Rx buffer are ignored. */
  213. kFLEXSPI_Config, /*!< FlexSPI operation: Configure device mode, the TX fifo size is fixed in LUT. */
  214. kFLEXSPI_Read, /* /!< FlexSPI operation: Read, only Rx Buffer is effective. */
  215. kFLEXSPI_Write, /* /!< FlexSPI operation: Read, only Tx Buffer is effective. */
  216. } flexspi_command_type_t;
  217. typedef struct _flexspi_ahbBuffer_config
  218. {
  219. uint8_t priority; /*!< This priority for AHB Master Read which this AHB RX Buffer is assigned. */
  220. uint8_t masterIndex; /*!< AHB Master ID the AHB RX Buffer is assigned. */
  221. uint16_t bufferSize; /*!< AHB buffer size in byte. */
  222. bool enablePrefetch; /*!< AHB Read Prefetch Enable for current AHB RX Buffer corresponding Master, allows
  223. prefetch disable/enable seperately for each master. */
  224. } flexspi_ahbBuffer_config_t;
  225. /*! @brief FLEXSPI configuration structure. */
  226. typedef struct _flexspi_config
  227. {
  228. flexspi_read_sample_clock_t rxSampleClock; /*!< Sample Clock source selection for Flash Reading. */
  229. bool enableSckFreeRunning; /*!< Enable/disable SCK output free-running. */
  230. bool enableCombination; /*!< Enable/disable combining PORT A and B Data Pins
  231. (SIOA[3:0] and SIOB[3:0]) to support Flash Octal mode. */
  232. bool enableDoze; /*!< Enable/disable doze mode support. */
  233. bool enableHalfSpeedAccess; /*!< Enable/disable divide by 2 of the clock for half
  234. speed commands. */
  235. bool enableSckBDiffOpt; /*!< Enable/disable SCKB pad use as SCKA differential clock
  236. output, when enable, Port B flash access is not available. */
  237. bool enableSameConfigForAll; /*!< Enable/disable same configuration for all connected devices
  238. when enabled, same configuration in FLASHA1CRx is applied to all. */
  239. uint16_t seqTimeoutCycle; /*!< Timeout wait cycle for command sequence execution,
  240. timeout after ahbGrantTimeoutCyle*1024 serial root clock cycles. */
  241. uint8_t ipGrantTimeoutCycle; /*!< Timeout wait cycle for IP command grant, timeout after
  242. ipGrantTimeoutCycle*1024 AHB clock cycles. */
  243. uint8_t txWatermark; /*!< FLEXSPI IP transmit watermark value. */
  244. uint8_t rxWatermark; /*!< FLEXSPI receive watermark value. */
  245. struct
  246. {
  247. bool enableAHBWriteIpTxFifo; /*!< Enable AHB bus write access to IP TX FIFO. */
  248. bool enableAHBWriteIpRxFifo; /*!< Enable AHB bus write access to IP RX FIFO. */
  249. uint8_t ahbGrantTimeoutCycle; /*!< Timeout wait cycle for AHB command grant,
  250. timeout after ahbGrantTimeoutCyle*1024 AHB clock cycles. */
  251. uint16_t ahbBusTimeoutCycle; /*!< Timeout wait cycle for AHB read/write access,
  252. timeout after ahbBusTimeoutCycle*1024 AHB clock cycles. */
  253. uint8_t resumeWaitCycle; /*!< Wait cycle for idle state before suspended command sequence
  254. resume, timeout after ahbBusTimeoutCycle AHB clock cycles. */
  255. flexspi_ahbBuffer_config_t buffer[FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT]; /*!< AHB buffer size. */
  256. bool enableClearAHBBufferOpt; /*!< Enable/disable automatically clean AHB RX Buffer and TX Buffer
  257. when FLEXSPI returns STOP mode ACK. */
  258. bool enableReadAddressOpt; /*!< Enable/disable remove AHB read burst start address alignment limitation.
  259. when eanble, there is no AHB read burst start address alignment limitation. */
  260. bool enableAHBPrefetch; /*!< Enable/disable AHB read prefetch feature, when enabled, FLEXSPI
  261. will fetch more data than current AHB burst. */
  262. bool enableAHBBufferable; /*!< Enable/disable AHB bufferable write access support, when enabled,
  263. FLEXSPI return before waiting for command excution finished. */
  264. bool enableAHBCachable; /*!< Enable AHB bus cachable read access support. */
  265. } ahbConfig;
  266. } flexspi_config_t;
  267. /*! @brief External device configuration items. */
  268. typedef struct _flexspi_device_config
  269. {
  270. uint32_t flexspiRootClk; /*!< FLEXSPI serial root clock. */
  271. bool isSck2Enabled; /*!< FLEXSPI use SCK2. */
  272. uint32_t flashSize; /*!< Flash size in KByte. */
  273. flexspi_cs_interval_cycle_unit_t CSIntervalUnit; /*!< CS interval unit, 1 or 256 cycle. */
  274. uint16_t CSInterval; /*!< CS line assert interval, mutiply CS interval unit to
  275. get the CS line assert interval cycles. */
  276. uint8_t CSHoldTime; /*!< CS line hold time. */
  277. uint8_t CSSetupTime; /*!< CS line setup time. */
  278. uint8_t dataValidTime; /*!< Data valid time for external device. */
  279. uint8_t columnspace; /*!< Column space size. */
  280. bool enableWordAddress; /*!< If enable word address.*/
  281. uint8_t AWRSeqIndex; /*!< Sequence ID for AHB write command. */
  282. uint8_t AWRSeqNumber; /*!< Sequence number for AHB write command. */
  283. uint8_t ARDSeqIndex; /*!< Sequence ID for AHB read command. */
  284. uint8_t ARDSeqNumber; /*!< Sequence number for AHB read command. */
  285. flexspi_ahb_write_wait_unit_t AHBWriteWaitUnit; /*!< AHB write wait unit. */
  286. uint16_t AHBWriteWaitInterval; /*!< AHB write wait interval, mutiply AHB write interval
  287. unit to get the AHB write wait cycles. */
  288. bool enableWriteMask; /*!< Enable/Disable FLEXSPI drive DQS pin as write mask
  289. when writing to external device. */
  290. } flexspi_device_config_t;
  291. /*! @brief Transfer structure for FLEXSPI. */
  292. typedef struct _flexspi_transfer
  293. {
  294. uint32_t deviceAddress; /*!< Operation device address. */
  295. flexspi_port_t port; /*!< Operation port. */
  296. flexspi_command_type_t cmdType; /*!< Execution command type. */
  297. uint8_t seqIndex; /*!< Sequence ID for command. */
  298. uint8_t SeqNumber; /*!< Sequence number for command. */
  299. uint32_t *data; /*!< Data buffer. */
  300. size_t dataSize; /*!< Data size in bytes. */
  301. } flexspi_transfer_t;
  302. /* Forward declaration of the handle typedef. */
  303. typedef struct _flexspi_handle flexspi_handle_t;
  304. /*! @brief FLEXSPI transfer callback function. */
  305. typedef void (*flexspi_transfer_callback_t)(FLEXSPI_Type *base,
  306. flexspi_handle_t *handle,
  307. status_t status,
  308. void *userData);
  309. /*! @brief Transfer handle structure for FLEXSPI. */
  310. struct _flexspi_handle
  311. {
  312. uint32_t state; /*!< Internal state for FLEXSPI transfer */
  313. uint32_t *data; /*!< Data buffer. */
  314. size_t dataSize; /*!< Remaining Data size in bytes. */
  315. size_t transferTotalSize; /*!< Total Data size in bytes. */
  316. flexspi_transfer_callback_t completionCallback; /*!< Callback for users while transfer finish or error occurred */
  317. void *userData; /*!< FLEXSPI callback function parameter.*/
  318. };
  319. /*******************************************************************************
  320. * API
  321. ******************************************************************************/
  322. #if defined(__cplusplus)
  323. extern "C" {
  324. #endif /*_cplusplus. */
  325. /*!
  326. * @name Initialization and deinitialization
  327. * @{
  328. */
  329. /*!
  330. * @brief Initializes the FLEXSPI module and internal state.
  331. *
  332. * This function enables the clock for FLEXSPI and also configures the FLEXSPI with the
  333. * input configure parameters. Users should call this function before any FLEXSPI operations.
  334. *
  335. * @param base FLEXSPI peripheral base address.
  336. * @param config FLEXSPI configure structure.
  337. */
  338. void FLEXSPI_Init(FLEXSPI_Type *base, const flexspi_config_t *config);
  339. /*!
  340. * @brief Gets default settings for FLEXSPI.
  341. *
  342. * @param config FLEXSPI configuration structure.
  343. */
  344. void FLEXSPI_GetDefaultConfig(flexspi_config_t *config);
  345. /*!
  346. * @brief Deinitializes the FLEXSPI module.
  347. *
  348. * Clears the FLEXSPI state and FLEXSPI module registers.
  349. * @param base FLEXSPI peripheral base address.
  350. */
  351. void FLEXSPI_Deinit(FLEXSPI_Type *base);
  352. /*!
  353. * @brief Configures the connected device parameter.
  354. *
  355. * This function configures the connected device relevant parameters, such as the size, command, and so on.
  356. * The flash configuration value cannot have a default value. The user needs to configure it according to the
  357. * connected device.
  358. *
  359. * @param base FLEXSPI peripheral base address.
  360. * @param config Flash configuration parameters.
  361. * @param port FLEXSPI Operation port.
  362. */
  363. void FLEXSPI_SetFlashConfig(FLEXSPI_Type *base, flexspi_device_config_t *config, flexspi_port_t port);
  364. /*!
  365. * @brief Software reset for the FLEXSPI logic.
  366. *
  367. * This function sets the software reset flags for both AHB and buffer domain and
  368. * resets both AHB buffer and also IP FIFOs.
  369. *
  370. * @param base FLEXSPI peripheral base address.
  371. */
  372. static SECTION("itcm") inline void FLEXSPI_SoftwareReset(FLEXSPI_Type *base)
  373. {
  374. base->MCR0 |= FLEXSPI_MCR0_SWRESET_MASK;
  375. while (base->MCR0 & FLEXSPI_MCR0_SWRESET_MASK)
  376. {
  377. }
  378. }
  379. /*!
  380. * @brief Enables or disables the FLEXSPI module.
  381. *
  382. * @param base FLEXSPI peripheral base address.
  383. * @param enable True means enable FLEXSPI, false means disable.
  384. */
  385. static SECTION("itcm") inline void FLEXSPI_Enable(FLEXSPI_Type *base, bool enable)
  386. {
  387. if (enable)
  388. {
  389. base->MCR0 &= ~FLEXSPI_MCR0_MDIS_MASK;
  390. }
  391. else
  392. {
  393. base->MCR0 |= FLEXSPI_MCR0_MDIS_MASK;
  394. }
  395. }
  396. /* @} */
  397. /*!
  398. * @name Interrupts
  399. * @{
  400. */
  401. /*!
  402. * @brief Enables the FLEXSPI interrupts.
  403. *
  404. * @param base FLEXSPI peripheral base address.
  405. * @param mask FLEXSPI interrupt source.
  406. */
  407. static SECTION("itcm") inline void FLEXSPI_EnableInterrupts(FLEXSPI_Type *base, uint32_t mask)
  408. {
  409. base->INTEN |= mask;
  410. }
  411. /*!
  412. * @brief Disable the FLEXSPI interrupts.
  413. *
  414. * @param base FLEXSPI peripheral base address.
  415. * @param mask FLEXSPI interrupt source.
  416. */
  417. static SECTION("itcm") inline void FLEXSPI_DisableInterrupts(FLEXSPI_Type *base, uint32_t mask)
  418. {
  419. base->INTEN &= ~mask;
  420. }
  421. /* @} */
  422. /*! @name DMA control */
  423. /*@{*/
  424. /*!
  425. * @brief Enables or disables FLEXSPI IP Tx FIFO DMA requests.
  426. *
  427. * @param base FLEXSPI peripheral base address.
  428. * @param enable Enable flag for transmit DMA request. Pass true for enable, false for disable.
  429. */
  430. static SECTION("itcm") inline void FLEXSPI_EnableTxDMA(FLEXSPI_Type *base, bool enable)
  431. {
  432. if (enable)
  433. {
  434. base->IPTXFCR |= FLEXSPI_IPTXFCR_TXDMAEN_MASK;
  435. }
  436. else
  437. {
  438. base->IPTXFCR &= ~FLEXSPI_IPTXFCR_TXDMAEN_MASK;
  439. }
  440. }
  441. /*!
  442. * @brief Enables or disables FLEXSPI IP Rx FIFO DMA requests.
  443. *
  444. * @param base FLEXSPI peripheral base address.
  445. * @param enable Enable flag for receive DMA request. Pass true for enable, false for disable.
  446. */
  447. static SECTION("itcm") inline void FLEXSPI_EnableRxDMA(FLEXSPI_Type *base, bool enable)
  448. {
  449. if (enable)
  450. {
  451. base->IPRXFCR |= FLEXSPI_IPRXFCR_RXDMAEN_MASK;
  452. }
  453. else
  454. {
  455. base->IPRXFCR &= ~FLEXSPI_IPRXFCR_RXDMAEN_MASK;
  456. }
  457. }
  458. /*!
  459. * @brief Gets FLEXSPI IP tx fifo address for DMA transfer.
  460. *
  461. * @param base FLEXSPI peripheral base address.
  462. * @retval The tx fifo address.
  463. */
  464. static SECTION("itcm") inline uint32_t FLEXSPI_GetTxFifoAddress(FLEXSPI_Type *base)
  465. {
  466. return (uint32_t)&base->TFDR[0];
  467. }
  468. /*!
  469. * @brief Gets FLEXSPI IP rx fifo address for DMA transfer.
  470. *
  471. * @param base FLEXSPI peripheral base address.
  472. * @retval The rx fifo address.
  473. */
  474. static SECTION("itcm") inline uint32_t FLEXSPI_GetRxFifoAddress(FLEXSPI_Type *base)
  475. {
  476. return (uint32_t)&base->RFDR[0];
  477. }
  478. /*@}*/
  479. /*! @name FIFO control */
  480. /*@{*/
  481. /*! @brief Clears the FLEXSPI IP FIFO logic.
  482. *
  483. * @param base FLEXSPI peripheral base address.
  484. * @param txFifo Pass true to reset TX FIFO.
  485. * @param rxFifo Pass true to reset RX FIFO.
  486. */
  487. static SECTION("itcm") inline void FLEXSPI_ResetFifos(FLEXSPI_Type *base, bool txFifo, bool rxFifo)
  488. {
  489. if (txFifo)
  490. {
  491. base->IPTXFCR |= FLEXSPI_IPTXFCR_CLRIPTXF_MASK;
  492. }
  493. if (rxFifo)
  494. {
  495. base->IPRXFCR |= FLEXSPI_IPRXFCR_CLRIPRXF_MASK;
  496. }
  497. }
  498. /*!
  499. * @brief Gets the valid data entries in the FLEXSPI FIFOs.
  500. *
  501. * @param base FLEXSPI peripheral base address.
  502. * @param[out] txCount Pointer through which the current number of bytes in the transmit FIFO is returned.
  503. * Pass NULL if this value is not required.
  504. * @param[out] rxCount Pointer through which the current number of bytes in the receive FIFO is returned.
  505. * Pass NULL if this value is not required.
  506. */
  507. static SECTION("itcm") inline void FLEXSPI_GetFifoCounts(FLEXSPI_Type *base, size_t *txCount, size_t *rxCount)
  508. {
  509. if (txCount)
  510. {
  511. *txCount = (((base->IPTXFSTS) & FLEXSPI_IPTXFSTS_FILL_MASK) >> FLEXSPI_IPTXFSTS_FILL_SHIFT) * 8U;
  512. }
  513. if (rxCount)
  514. {
  515. *rxCount = (((base->IPRXFSTS) & FLEXSPI_IPRXFSTS_FILL_MASK) >> FLEXSPI_IPRXFSTS_FILL_SHIFT) * 8U;
  516. }
  517. }
  518. /*@}*/
  519. /*!
  520. * @name Status
  521. * @{
  522. */
  523. /*!
  524. * @brief Get the FLEXSPI interrupt status flags.
  525. *
  526. * @param base FLEXSPI peripheral base address.
  527. * @retval interrupt status flag, use status flag to AND #flexspi_flags_t could get the related status.
  528. */
  529. static SECTION("itcm") inline uint32_t FLEXSPI_GetInterruptStatusFlags(FLEXSPI_Type *base)
  530. {
  531. return base->INTR;
  532. }
  533. /*!
  534. * @brief Get the FLEXSPI interrupt status flags.
  535. *
  536. * @param base FLEXSPI peripheral base address.
  537. * @param interrupt status flag.
  538. */
  539. static SECTION("itcm") inline void FLEXSPI_ClearInterruptStatusFlags(FLEXSPI_Type *base, uint32_t mask)
  540. {
  541. base->INTR |= mask;
  542. }
  543. #if !((defined(FSL_FEATURE_FLEXSPI_HAS_NO_DATA_LEARN)) && (FSL_FEATURE_FLEXSPI_HAS_NO_DATA_LEARN))
  544. /*! @brief Gets the sampling clock phase selection after Data Learning.
  545. *
  546. * @param base FLEXSPI peripheral base address.
  547. * @param portAPhase Pointer to a uint8_t type variable to receive the selected clock phase on PORTA.
  548. * @param portBPhase Pointer to a uint8_t type variable to receive the selected clock phase on PORTB.
  549. */
  550. static inline void FLEXSPI_GetDataLearningPhase(FLEXSPI_Type *base, uint8_t *portAPhase, uint8_t *portBPhase)
  551. {
  552. if (portAPhase)
  553. {
  554. *portAPhase = (base->STS0 & FLEXSPI_STS0_DATALEARNPHASEA_MASK) >> FLEXSPI_STS0_DATALEARNPHASEA_SHIFT;
  555. }
  556. if (portBPhase)
  557. {
  558. *portBPhase = (base->STS0 & FLEXSPI_STS0_DATALEARNPHASEB_MASK) >> FLEXSPI_STS0_DATALEARNPHASEB_SHIFT;
  559. }
  560. }
  561. #endif
  562. /*! @brief Gets the trigger source of current command sequence granted by arbitrator.
  563. *
  564. * @param base FLEXSPI peripheral base address.
  565. * @retval trigger source of current command sequence.
  566. */
  567. static SECTION("itcm") inline flexspi_arb_command_source_t FLEXSPI_GetArbitratorCommandSource(FLEXSPI_Type *base)
  568. {
  569. return (flexspi_arb_command_source_t)((base->STS0 & FLEXSPI_STS0_ARBCMDSRC_MASK) >> FLEXSPI_STS0_ARBCMDSRC_SHIFT);
  570. }
  571. /*! @brief Gets the error code when IP command error detected.
  572. *
  573. * @param base FLEXSPI peripheral base address.
  574. * @param index Pointer to a uint8_t type variable to receive the sequence index when error detected.
  575. * @retval error code when IP command error detected.
  576. */
  577. static SECTION("itcm") inline flexspi_ip_error_code_t FLEXSPI_GetIPCommandErrorCode(FLEXSPI_Type *base, uint8_t *index)
  578. {
  579. *index = (base->STS1 & FLEXSPI_STS1_IPCMDERRID_MASK) >> FLEXSPI_STS1_IPCMDERRID_SHIFT;
  580. return (flexspi_ip_error_code_t)((base->STS1 & FLEXSPI_STS1_IPCMDERRCODE_MASK) >> FLEXSPI_STS1_IPCMDERRCODE_SHIFT);
  581. }
  582. /*! @brief Gets the error code when AHB command error detected.
  583. *
  584. * @param base FLEXSPI peripheral base address.
  585. * @param index Pointer to a uint8_t type variable to receive the sequence index when error detected.
  586. * @retval error code when AHB command error detected.
  587. */
  588. static SECTION("itcm") inline flexspi_ahb_error_code_t FLEXSPI_GetAHBCommandErrorCode(FLEXSPI_Type *base, uint8_t *index)
  589. {
  590. *index = (base->STS1 & FLEXSPI_STS1_AHBCMDERRID_MASK) >> FLEXSPI_STS1_AHBCMDERRID_SHIFT;
  591. return (flexspi_ahb_error_code_t)((base->STS1 & FLEXSPI_STS1_AHBCMDERRCODE_MASK) >>
  592. FLEXSPI_STS1_AHBCMDERRCODE_SHIFT);
  593. }
  594. /*! @brief Returns whether the bus is idle.
  595. *
  596. * @param base FLEXSPI peripheral base address.
  597. * @retval true Bus is idle.
  598. * @retval false Bus is busy.
  599. */
  600. static SECTION("itcm") inline bool FLEXSPI_GetBusIdleStatus(FLEXSPI_Type *base)
  601. {
  602. return (base->STS0 & FLEXSPI_STS0_ARBIDLE_MASK) && (base->STS0 & FLEXSPI_STS0_SEQIDLE_MASK);
  603. }
  604. /*@}*/
  605. /*!
  606. * @name Bus Operations
  607. * @{
  608. */
  609. /*! @brief Enables/disables the FLEXSPI IP command parallel mode.
  610. *
  611. * @param base FLEXSPI peripheral base address.
  612. * @param enable True means enable parallel mode, false means disable parallel mode.
  613. */
  614. static SECTION("itcm") inline void FLEXSPI_EnableIPParallelMode(FLEXSPI_Type *base, bool enable)
  615. {
  616. if (enable)
  617. {
  618. base->IPCR1 |= FLEXSPI_IPCR1_IPAREN_MASK;
  619. }
  620. else
  621. {
  622. base->IPCR1 &= ~FLEXSPI_IPCR1_IPAREN_MASK;
  623. }
  624. }
  625. /*! @brief Enables/disables the FLEXSPI AHB command parallel mode.
  626. *
  627. * @param base FLEXSPI peripheral base address.
  628. * @param enable True means enable parallel mode, false means disable parallel mode.
  629. */
  630. static SECTION("itcm") inline void FLEXSPI_EnableAHBParallelMode(FLEXSPI_Type *base, bool enable)
  631. {
  632. if (enable)
  633. {
  634. base->AHBCR |= FLEXSPI_AHBCR_APAREN_MASK;
  635. }
  636. else
  637. {
  638. base->AHBCR &= ~FLEXSPI_AHBCR_APAREN_MASK;
  639. }
  640. }
  641. /*! @brief Updates the LUT table.
  642. *
  643. * @param base FLEXSPI peripheral base address.
  644. * @param index From which index start to update. It could be any index of the LUT table, which
  645. * also allows user to update command content inside a command. Each command consists of up to
  646. * 8 instructions and occupy 4*32-bit memory.
  647. * @param cmd Command sequence array.
  648. * @param count Number of sequences.
  649. */
  650. void FLEXSPI_UpdateLUT(FLEXSPI_Type *base, uint32_t index, const uint32_t *cmd, uint32_t count);
  651. /*!
  652. * @brief Writes data into FIFO.
  653. *
  654. * @param base FLEXSPI peripheral base address
  655. * @param data The data bytes to send
  656. * @param fifoIndex Destination fifo index.
  657. */
  658. static SECTION("itcm") inline void FLEXSPI_WriteData(FLEXSPI_Type *base, uint32_t data, uint8_t fifoIndex)
  659. {
  660. base->TFDR[fifoIndex] = data;
  661. }
  662. /*!
  663. * @brief Receives data from data FIFO.
  664. *
  665. * @param base FLEXSPI peripheral base address
  666. * @param fifoIndex Source fifo index.
  667. * @return The data in the FIFO.
  668. */
  669. static SECTION("itcm") inline uint32_t FLEXSPI_ReadData(FLEXSPI_Type *base, uint8_t fifoIndex)
  670. {
  671. return base->RFDR[fifoIndex];
  672. }
  673. /*!
  674. * @brief Sends a buffer of data bytes using blocking method.
  675. * @note This function blocks via polling until all bytes have been sent.
  676. * @param base FLEXSPI peripheral base address
  677. * @param buffer The data bytes to send
  678. * @param size The number of data bytes to send
  679. * @retval kStatus_Success write success without error
  680. * @retval kStatus_FLEXSPI_SequenceExecutionTimeout sequence execution timeout
  681. * @retval kStatus_FLEXSPI_IpCommandSequenceError IP command sequencen error detected
  682. * @retval kStatus_FLEXSPI_IpCommandGrantTimeout IP command grant timeout detected
  683. */
  684. status_t FLEXSPI_WriteBlocking(FLEXSPI_Type *base, uint32_t *buffer, size_t size);
  685. /*!
  686. * @brief Receives a buffer of data bytes using a blocking method.
  687. * @note This function blocks via polling until all bytes have been sent.
  688. * @param base FLEXSPI peripheral base address
  689. * @param buffer The data bytes to send
  690. * @param size The number of data bytes to receive
  691. * @retval kStatus_Success read success without error
  692. * @retval kStatus_FLEXSPI_SequenceExecutionTimeout sequence execution timeout
  693. * @retval kStatus_FLEXSPI_IpCommandSequenceError IP command sequencen error detected
  694. * @retval kStatus_FLEXSPI_IpCommandGrantTimeout IP command grant timeout detected
  695. */
  696. status_t FLEXSPI_ReadBlocking(FLEXSPI_Type *base, uint32_t *buffer, size_t size);
  697. /*!
  698. * @brief Execute command to transfer a buffer data bytes using a blocking method.
  699. * @param base FLEXSPI peripheral base address
  700. * @param xfer pointer to the transfer structure.
  701. * @retval kStatus_Success command transfer success without error
  702. * @retval kStatus_FLEXSPI_SequenceExecutionTimeout sequence execution timeout
  703. * @retval kStatus_FLEXSPI_IpCommandSequenceError IP command sequencen error detected
  704. * @retval kStatus_FLEXSPI_IpCommandGrantTimeout IP command grant timeout detected
  705. */
  706. status_t FLEXSPI_TransferBlocking(FLEXSPI_Type *base, flexspi_transfer_t *xfer);
  707. /*! @} */
  708. /*!
  709. * @name Transactional
  710. * @{
  711. */
  712. /*!
  713. * @brief Initializes the FLEXSPI handle which is used in transactional functions.
  714. *
  715. * @param base FLEXSPI peripheral base address.
  716. * @param handle pointer to flexspi_handle_t structure to store the transfer state.
  717. * @param callback pointer to user callback function.
  718. * @param userData user parameter passed to the callback function.
  719. */
  720. void FLEXSPI_TransferCreateHandle(FLEXSPI_Type *base,
  721. flexspi_handle_t *handle,
  722. flexspi_transfer_callback_t callback,
  723. void *userData);
  724. /*!
  725. * @brief Performs a interrupt non-blocking transfer on the FLEXSPI bus.
  726. *
  727. * @note Calling the API returns immediately after transfer initiates. The user needs
  728. * to call FLEXSPI_GetTransferCount to poll the transfer status to check whether
  729. * the transfer is finished. If the return status is not kStatus_FLEXSPI_Busy, the transfer
  730. * is finished. For FLEXSPI_Read, the dataSize should be multiple of rx watermark levle, or
  731. * FLEXSPI could not read data properly.
  732. *
  733. * @param base FLEXSPI peripheral base address.
  734. * @param handle pointer to flexspi_handle_t structure which stores the transfer state.
  735. * @param xfer pointer to flexspi_transfer_t structure.
  736. * @retval kStatus_Success Successfully start the data transmission.
  737. * @retval kStatus_FLEXSPI_Busy Previous transmission still not finished.
  738. */
  739. status_t FLEXSPI_TransferNonBlocking(FLEXSPI_Type *base, flexspi_handle_t *handle, flexspi_transfer_t *xfer);
  740. /*!
  741. * @brief Gets the master transfer status during a interrupt non-blocking transfer.
  742. *
  743. * @param base FLEXSPI peripheral base address.
  744. * @param handle pointer to flexspi_handle_t structure which stores the transfer state.
  745. * @param count Number of bytes transferred so far by the non-blocking transaction.
  746. * @retval kStatus_InvalidArgument count is Invalid.
  747. * @retval kStatus_Success Successfully return the count.
  748. */
  749. status_t FLEXSPI_TransferGetCount(FLEXSPI_Type *base, flexspi_handle_t *handle, size_t *count);
  750. /*!
  751. * @brief Aborts an interrupt non-blocking transfer early.
  752. *
  753. * @note This API can be called at any time when an interrupt non-blocking transfer initiates
  754. * to abort the transfer early.
  755. *
  756. * @param base FLEXSPI peripheral base address.
  757. * @param handle pointer to flexspi_handle_t structure which stores the transfer state
  758. */
  759. void FLEXSPI_TransferAbort(FLEXSPI_Type *base, flexspi_handle_t *handle);
  760. /*!
  761. * @brief Master interrupt handler.
  762. *
  763. * @param base FLEXSPI peripheral base address.
  764. * @param handle pointer to flexspi_handle_t structure.
  765. */
  766. void FLEXSPI_TransferHandleIRQ(FLEXSPI_Type *base, flexspi_handle_t *handle);
  767. /*! @} */
  768. #if defined(__cplusplus)
  769. }
  770. #endif /*_cplusplus. */
  771. /*@}*/
  772. #endif /* __FSL_FLEXSPI_H_ */