fsl_flexio_i2s.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2020 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_FLEXIO_I2S_H_
  9. #define _FSL_FLEXIO_I2S_H_
  10. #include "fsl_common.h"
  11. #include "fsl_flexio.h"
  12. /*!
  13. * @addtogroup flexio_i2s
  14. * @{
  15. */
  16. /*******************************************************************************
  17. * Definitions
  18. ******************************************************************************/
  19. /*! @name Driver version */
  20. /*@{*/
  21. /*! @brief FlexIO I2S driver version 2.2.0. */
  22. #define FSL_FLEXIO_I2S_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))
  23. /*@}*/
  24. /*! @brief Retry times for waiting flag. */
  25. #ifndef I2S_RETRY_TIMES
  26. #define I2S_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */
  27. #endif
  28. /*! @brief FlexIO I2S transfer status */
  29. enum
  30. {
  31. kStatus_FLEXIO_I2S_Idle = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 0), /*!< FlexIO I2S is in idle state */
  32. kStatus_FLEXIO_I2S_TxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 1), /*!< FlexIO I2S Tx is busy */
  33. kStatus_FLEXIO_I2S_RxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 2), /*!< FlexIO I2S Tx is busy */
  34. kStatus_FLEXIO_I2S_Error = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 3), /*!< FlexIO I2S error occurred */
  35. kStatus_FLEXIO_I2S_QueueFull = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 4), /*!< FlexIO I2S transfer queue is full. */
  36. kStatus_FLEXIO_I2S_Timeout =
  37. MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 5), /*!< FlexIO I2S timeout polling status flags. */
  38. };
  39. /*! @brief Define FlexIO I2S access structure typedef */
  40. typedef struct _flexio_i2s_type
  41. {
  42. FLEXIO_Type *flexioBase; /*!< FlexIO base pointer */
  43. uint8_t txPinIndex; /*!< Tx data pin index in FlexIO pins */
  44. uint8_t rxPinIndex; /*!< Rx data pin index */
  45. uint8_t bclkPinIndex; /*!< Bit clock pin index */
  46. uint8_t fsPinIndex; /*!< Frame sync pin index */
  47. uint8_t txShifterIndex; /*!< Tx data shifter index */
  48. uint8_t rxShifterIndex; /*!< Rx data shifter index */
  49. uint8_t bclkTimerIndex; /*!< Bit clock timer index */
  50. uint8_t fsTimerIndex; /*!< Frame sync timer index */
  51. } FLEXIO_I2S_Type;
  52. /*! @brief Master or slave mode */
  53. typedef enum _flexio_i2s_master_slave
  54. {
  55. kFLEXIO_I2S_Master = 0x0U, /*!< Master mode */
  56. kFLEXIO_I2S_Slave = 0x1U /*!< Slave mode */
  57. } flexio_i2s_master_slave_t;
  58. /*! @brief _flexio_i2s_interrupt_enable Define FlexIO FlexIO I2S interrupt mask. */
  59. enum
  60. {
  61. kFLEXIO_I2S_TxDataRegEmptyInterruptEnable = 0x1U, /*!< Transmit buffer empty interrupt enable. */
  62. kFLEXIO_I2S_RxDataRegFullInterruptEnable = 0x2U, /*!< Receive buffer full interrupt enable. */
  63. };
  64. /*! @brief _flexio_i2s_status_flags Define FlexIO FlexIO I2S status mask. */
  65. enum
  66. {
  67. kFLEXIO_I2S_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */
  68. kFLEXIO_I2S_RxDataRegFullFlag = 0x2U, /*!< Receive buffer full flag. */
  69. };
  70. /*! @brief FlexIO I2S configure structure */
  71. typedef struct _flexio_i2s_config
  72. {
  73. bool enableI2S; /*!< Enable FlexIO I2S */
  74. flexio_i2s_master_slave_t masterSlave; /*!< Master or slave */
  75. flexio_pin_polarity_t txPinPolarity; /*!< Tx data pin polarity, active high or low */
  76. flexio_pin_polarity_t rxPinPolarity; /*!< Rx data pin polarity */
  77. flexio_pin_polarity_t bclkPinPolarity; /*!< Bit clock pin polarity */
  78. flexio_pin_polarity_t fsPinPolarity; /*!< Frame sync pin polarity */
  79. flexio_shifter_timer_polarity_t txTimerPolarity; /*!< Tx data valid on bclk rising or falling edge */
  80. flexio_shifter_timer_polarity_t rxTimerPolarity; /*!< Rx data valid on bclk rising or falling edge */
  81. } flexio_i2s_config_t;
  82. /*! @brief FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx */
  83. typedef struct _flexio_i2s_format
  84. {
  85. uint8_t bitWidth; /*!< Bit width of audio data, always 8/16/24/32 bits */
  86. uint32_t sampleRate_Hz; /*!< Sample rate of the audio data */
  87. } flexio_i2s_format_t;
  88. /*!@brief FlexIO I2S transfer queue size, user can refine it according to use case. */
  89. #define FLEXIO_I2S_XFER_QUEUE_SIZE (4U)
  90. /*! @brief Audio sample rate */
  91. typedef enum _flexio_i2s_sample_rate
  92. {
  93. kFLEXIO_I2S_SampleRate8KHz = 8000U, /*!< Sample rate 8000Hz */
  94. kFLEXIO_I2S_SampleRate11025Hz = 11025U, /*!< Sample rate 11025Hz */
  95. kFLEXIO_I2S_SampleRate12KHz = 12000U, /*!< Sample rate 12000Hz */
  96. kFLEXIO_I2S_SampleRate16KHz = 16000U, /*!< Sample rate 16000Hz */
  97. kFLEXIO_I2S_SampleRate22050Hz = 22050U, /*!< Sample rate 22050Hz */
  98. kFLEXIO_I2S_SampleRate24KHz = 24000U, /*!< Sample rate 24000Hz */
  99. kFLEXIO_I2S_SampleRate32KHz = 32000U, /*!< Sample rate 32000Hz */
  100. kFLEXIO_I2S_SampleRate44100Hz = 44100U, /*!< Sample rate 44100Hz */
  101. kFLEXIO_I2S_SampleRate48KHz = 48000U, /*!< Sample rate 48000Hz */
  102. kFLEXIO_I2S_SampleRate96KHz = 96000U /*!< Sample rate 96000Hz */
  103. } flexio_i2s_sample_rate_t;
  104. /*! @brief Audio word width */
  105. typedef enum _flexio_i2s_word_width
  106. {
  107. kFLEXIO_I2S_WordWidth8bits = 8U, /*!< Audio data width 8 bits */
  108. kFLEXIO_I2S_WordWidth16bits = 16U, /*!< Audio data width 16 bits */
  109. kFLEXIO_I2S_WordWidth24bits = 24U, /*!< Audio data width 24 bits */
  110. kFLEXIO_I2S_WordWidth32bits = 32U /*!< Audio data width 32 bits */
  111. } flexio_i2s_word_width_t;
  112. /*! @brief Define FlexIO I2S transfer structure. */
  113. typedef struct _flexio_i2s_transfer
  114. {
  115. uint8_t *data; /*!< Data buffer start pointer */
  116. size_t dataSize; /*!< Bytes to be transferred. */
  117. } flexio_i2s_transfer_t;
  118. typedef struct _flexio_i2s_handle flexio_i2s_handle_t;
  119. /*! @brief FlexIO I2S xfer callback prototype */
  120. typedef void (*flexio_i2s_callback_t)(FLEXIO_I2S_Type *base,
  121. flexio_i2s_handle_t *handle,
  122. status_t status,
  123. void *userData);
  124. /*! @brief Define FlexIO I2S handle structure. */
  125. struct _flexio_i2s_handle
  126. {
  127. uint32_t state; /*!< Internal state */
  128. flexio_i2s_callback_t callback; /*!< Callback function called at transfer event*/
  129. void *userData; /*!< Callback parameter passed to callback function*/
  130. uint8_t bitWidth; /*!< Bit width for transfer, 8/16/24/32bits */
  131. flexio_i2s_transfer_t queue[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Transfer queue storing queued transfer */
  132. size_t transferSize[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Data bytes need to transfer */
  133. volatile uint8_t queueUser; /*!< Index for user to queue transfer */
  134. volatile uint8_t queueDriver; /*!< Index for driver to get the transfer data and size */
  135. };
  136. /*******************************************************************************
  137. * API
  138. ******************************************************************************/
  139. #if defined(__cplusplus)
  140. extern "C" {
  141. #endif /*_cplusplus*/
  142. /*!
  143. * @name Initialization and deinitialization
  144. * @{
  145. */
  146. /*!
  147. * @brief Initializes the FlexIO I2S.
  148. *
  149. * This API configures FlexIO pins and shifter to I2S and configures the FlexIO I2S with a configuration structure.
  150. * The configuration structure can be filled by the user, or be set with default values by
  151. * FLEXIO_I2S_GetDefaultConfig().
  152. *
  153. * @note This API should be called at the beginning of the application to use
  154. * the FlexIO I2S driver. Otherwise, any access to the FlexIO I2S module can cause hard fault
  155. * because the clock is not enabled.
  156. *
  157. * @param base FlexIO I2S base pointer
  158. * @param config FlexIO I2S configure structure.
  159. */
  160. void FLEXIO_I2S_Init(FLEXIO_I2S_Type *base, const flexio_i2s_config_t *config);
  161. /*!
  162. * @brief Sets the FlexIO I2S configuration structure to default values.
  163. *
  164. * The purpose of this API is to get the configuration structure initialized for use in FLEXIO_I2S_Init().
  165. * Users may use the initialized structure unchanged in FLEXIO_I2S_Init() or modify
  166. * some fields of the structure before calling FLEXIO_I2S_Init().
  167. *
  168. * @param config pointer to master configuration structure
  169. */
  170. void FLEXIO_I2S_GetDefaultConfig(flexio_i2s_config_t *config);
  171. /*!
  172. * @brief De-initializes the FlexIO I2S.
  173. *
  174. * Calling this API resets the FlexIO I2S shifter and timer config. After calling this API,
  175. * call the FLEXO_I2S_Init to use the FlexIO I2S module.
  176. *
  177. * @param base FlexIO I2S base pointer
  178. */
  179. void FLEXIO_I2S_Deinit(FLEXIO_I2S_Type *base);
  180. /*!
  181. * @brief Enables/disables the FlexIO I2S module operation.
  182. *
  183. * @param base Pointer to FLEXIO_I2S_Type
  184. * @param enable True to enable, false dose not have any effect.
  185. */
  186. static inline void FLEXIO_I2S_Enable(FLEXIO_I2S_Type *base, bool enable)
  187. {
  188. if (enable)
  189. {
  190. base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK;
  191. }
  192. }
  193. /*! @} */
  194. /*!
  195. * @name Status
  196. * @{
  197. */
  198. /*!
  199. * @brief Gets the FlexIO I2S status flags.
  200. *
  201. * @param base Pointer to FLEXIO_I2S_Type structure
  202. * @return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags.
  203. */
  204. uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base);
  205. /*! @} */
  206. /*!
  207. * @name Interrupts
  208. * @{
  209. */
  210. /*!
  211. * @brief Enables the FlexIO I2S interrupt.
  212. *
  213. * This function enables the FlexIO UART interrupt.
  214. *
  215. * @param base Pointer to FLEXIO_I2S_Type structure
  216. * @param mask interrupt source
  217. */
  218. void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask);
  219. /*!
  220. * @brief Disables the FlexIO I2S interrupt.
  221. *
  222. * This function enables the FlexIO UART interrupt.
  223. *
  224. * @param base pointer to FLEXIO_I2S_Type structure
  225. * @param mask interrupt source
  226. */
  227. void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask);
  228. /*! @} */
  229. /*!
  230. * @name DMA Control
  231. * @{
  232. */
  233. /*!
  234. * @brief Enables/disables the FlexIO I2S Tx DMA requests.
  235. *
  236. * @param base FlexIO I2S base pointer
  237. * @param enable True means enable DMA, false means disable DMA.
  238. */
  239. static inline void FLEXIO_I2S_TxEnableDMA(FLEXIO_I2S_Type *base, bool enable)
  240. {
  241. FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->txShifterIndex, enable);
  242. }
  243. /*!
  244. * @brief Enables/disables the FlexIO I2S Rx DMA requests.
  245. *
  246. * @param base FlexIO I2S base pointer
  247. * @param enable True means enable DMA, false means disable DMA.
  248. */
  249. static inline void FLEXIO_I2S_RxEnableDMA(FLEXIO_I2S_Type *base, bool enable)
  250. {
  251. FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->rxShifterIndex, enable);
  252. }
  253. /*!
  254. * @brief Gets the FlexIO I2S send data register address.
  255. *
  256. * This function returns the I2S data register address, mainly used by DMA/eDMA.
  257. *
  258. * @param base Pointer to FLEXIO_I2S_Type structure
  259. * @return FlexIO i2s send data register address.
  260. */
  261. static inline uint32_t FLEXIO_I2S_TxGetDataRegisterAddress(FLEXIO_I2S_Type *base)
  262. {
  263. return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->txShifterIndex);
  264. }
  265. /*!
  266. * @brief Gets the FlexIO I2S receive data register address.
  267. *
  268. * This function returns the I2S data register address, mainly used by DMA/eDMA.
  269. *
  270. * @param base Pointer to FLEXIO_I2S_Type structure
  271. * @return FlexIO i2s receive data register address.
  272. */
  273. static inline uint32_t FLEXIO_I2S_RxGetDataRegisterAddress(FLEXIO_I2S_Type *base)
  274. {
  275. return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->rxShifterIndex);
  276. }
  277. /*! @} */
  278. /*!
  279. * @name Bus Operations
  280. * @{
  281. */
  282. /*!
  283. * @brief Configures the FlexIO I2S audio format in master mode.
  284. *
  285. * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data
  286. * format to be transferred.
  287. *
  288. * @param base Pointer to FLEXIO_I2S_Type structure
  289. * @param format Pointer to FlexIO I2S audio data format structure.
  290. * @param srcClock_Hz I2S master clock source frequency in Hz.
  291. */
  292. void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz);
  293. /*!
  294. * @brief Configures the FlexIO I2S audio format in slave mode.
  295. *
  296. * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data
  297. * format to be transferred.
  298. *
  299. * @param base Pointer to FLEXIO_I2S_Type structure
  300. * @param format Pointer to FlexIO I2S audio data format structure.
  301. */
  302. void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format);
  303. /*!
  304. * @brief Sends data using a blocking method.
  305. *
  306. * @note This function blocks via polling until data is ready to be sent.
  307. *
  308. * @param base FlexIO I2S base pointer.
  309. * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
  310. * @param txData Pointer to the data to be written.
  311. * @param size Bytes to be written.
  312. * @retval kStatus_Success Successfully write data.
  313. * @retval kStatus_FLEXIO_I2C_Timeout Timeout polling status flags.
  314. */
  315. status_t FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size);
  316. /*!
  317. * @brief Writes data into a data register.
  318. *
  319. * @param base FlexIO I2S base pointer.
  320. * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
  321. * @param data Data to be written.
  322. */
  323. static inline void FLEXIO_I2S_WriteData(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint32_t data)
  324. {
  325. base->flexioBase->SHIFTBUFBIS[base->txShifterIndex] = (data << (32U - bitWidth));
  326. }
  327. /*!
  328. * @brief Receives a piece of data using a blocking method.
  329. *
  330. * @note This function blocks via polling until data is ready to be sent.
  331. *
  332. * @param base FlexIO I2S base pointer
  333. * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
  334. * @param rxData Pointer to the data to be read.
  335. * @param size Bytes to be read.
  336. * @retval kStatus_Success Successfully read data.
  337. * @retval kStatus_FLEXIO_I2C_Timeout Timeout polling status flags.
  338. */
  339. status_t FLEXIO_I2S_ReadBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size);
  340. /*!
  341. * @brief Reads a data from the data register.
  342. *
  343. * @param base FlexIO I2S base pointer
  344. * @return Data read from data register.
  345. */
  346. static inline uint32_t FLEXIO_I2S_ReadData(FLEXIO_I2S_Type *base)
  347. {
  348. return base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex];
  349. }
  350. /*! @} */
  351. /*!
  352. * @name Transactional
  353. * @{
  354. */
  355. /*!
  356. * @brief Initializes the FlexIO I2S handle.
  357. *
  358. * This function initializes the FlexIO I2S handle which can be used for other
  359. * FlexIO I2S transactional APIs. Call this API once to get the
  360. * initialized handle.
  361. *
  362. * @param base Pointer to FLEXIO_I2S_Type structure
  363. * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state.
  364. * @param callback FlexIO I2S callback function, which is called while finished a block.
  365. * @param userData User parameter for the FlexIO I2S callback.
  366. */
  367. void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base,
  368. flexio_i2s_handle_t *handle,
  369. flexio_i2s_callback_t callback,
  370. void *userData);
  371. /*!
  372. * @brief Configures the FlexIO I2S audio format.
  373. *
  374. * Audio format can be changed at run-time of FlexIO I2S. This function configures the sample rate and audio data
  375. * format to be transferred.
  376. *
  377. * @param base Pointer to FLEXIO_I2S_Type structure.
  378. * @param handle FlexIO I2S handle pointer.
  379. * @param format Pointer to audio data format structure.
  380. * @param srcClock_Hz FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode.
  381. */
  382. void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base,
  383. flexio_i2s_handle_t *handle,
  384. flexio_i2s_format_t *format,
  385. uint32_t srcClock_Hz);
  386. /*!
  387. * @brief Initializes the FlexIO I2S receive handle.
  388. *
  389. * This function initializes the FlexIO I2S handle which can be used for other
  390. * FlexIO I2S transactional APIs. Call this API once to get the
  391. * initialized handle.
  392. *
  393. * @param base Pointer to FLEXIO_I2S_Type structure.
  394. * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state.
  395. * @param callback FlexIO I2S callback function, which is called while finished a block.
  396. * @param userData User parameter for the FlexIO I2S callback.
  397. */
  398. void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base,
  399. flexio_i2s_handle_t *handle,
  400. flexio_i2s_callback_t callback,
  401. void *userData);
  402. /*!
  403. * @brief Performs an interrupt non-blocking send transfer on FlexIO I2S.
  404. *
  405. * @note The API returns immediately after transfer initiates.
  406. * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status and check whether
  407. * the transfer is finished. If the return status is 0, the transfer is finished.
  408. *
  409. * @param base Pointer to FLEXIO_I2S_Type structure.
  410. * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
  411. * @param xfer Pointer to flexio_i2s_transfer_t structure
  412. * @retval kStatus_Success Successfully start the data transmission.
  413. * @retval kStatus_FLEXIO_I2S_TxBusy Previous transmission still not finished, data not all written to TX register yet.
  414. * @retval kStatus_InvalidArgument The input parameter is invalid.
  415. */
  416. status_t FLEXIO_I2S_TransferSendNonBlocking(FLEXIO_I2S_Type *base,
  417. flexio_i2s_handle_t *handle,
  418. flexio_i2s_transfer_t *xfer);
  419. /*!
  420. * @brief Performs an interrupt non-blocking receive transfer on FlexIO I2S.
  421. *
  422. * @note The API returns immediately after transfer initiates.
  423. * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status to check whether
  424. * the transfer is finished. If the return status is 0, the transfer is finished.
  425. *
  426. * @param base Pointer to FLEXIO_I2S_Type structure.
  427. * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
  428. * @param xfer Pointer to flexio_i2s_transfer_t structure
  429. * @retval kStatus_Success Successfully start the data receive.
  430. * @retval kStatus_FLEXIO_I2S_RxBusy Previous receive still not finished.
  431. * @retval kStatus_InvalidArgument The input parameter is invalid.
  432. */
  433. status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base,
  434. flexio_i2s_handle_t *handle,
  435. flexio_i2s_transfer_t *xfer);
  436. /*!
  437. * @brief Aborts the current send.
  438. *
  439. * @note This API can be called at any time when interrupt non-blocking transfer initiates
  440. * to abort the transfer in a early time.
  441. *
  442. * @param base Pointer to FLEXIO_I2S_Type structure.
  443. * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
  444. */
  445. void FLEXIO_I2S_TransferAbortSend(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle);
  446. /*!
  447. * @brief Aborts the current receive.
  448. *
  449. * @note This API can be called at any time when interrupt non-blocking transfer initiates
  450. * to abort the transfer in a early time.
  451. *
  452. * @param base Pointer to FLEXIO_I2S_Type structure.
  453. * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
  454. */
  455. void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle);
  456. /*!
  457. * @brief Gets the remaining bytes to be sent.
  458. *
  459. * @param base Pointer to FLEXIO_I2S_Type structure.
  460. * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
  461. * @param count Bytes sent.
  462. * @retval kStatus_Success Succeed get the transfer count.
  463. * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
  464. */
  465. status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count);
  466. /*!
  467. * @brief Gets the remaining bytes to be received.
  468. *
  469. * @param base Pointer to FLEXIO_I2S_Type structure.
  470. * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
  471. * @param count Bytes recieved.
  472. * @return count Bytes received.
  473. * @retval kStatus_Success Succeed get the transfer count.
  474. * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
  475. */
  476. status_t FLEXIO_I2S_TransferGetReceiveCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count);
  477. /*!
  478. * @brief Tx interrupt handler.
  479. *
  480. * @param i2sBase Pointer to FLEXIO_I2S_Type structure.
  481. * @param i2sHandle Pointer to flexio_i2s_handle_t structure
  482. */
  483. void FLEXIO_I2S_TransferTxHandleIRQ(void *i2sBase, void *i2sHandle);
  484. /*!
  485. * @brief Rx interrupt handler.
  486. *
  487. * @param i2sBase Pointer to FLEXIO_I2S_Type structure.
  488. * @param i2sHandle Pointer to flexio_i2s_handle_t structure.
  489. */
  490. void FLEXIO_I2S_TransferRxHandleIRQ(void *i2sBase, void *i2sHandle);
  491. /*! @} */
  492. #if defined(__cplusplus)
  493. }
  494. #endif /*_cplusplus*/
  495. /*! @} */
  496. #endif /* _FSL_FLEXIO_I2S_H_ */