1 /*
2  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2020 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _FSL_FLEXIO_UART_H_
10 #define _FSL_FLEXIO_UART_H_
11 
12 #include "fsl_common.h"
13 #include "fsl_flexio.h"
14 
15 /*!
16  * @addtogroup flexio_uart
17  * @{
18  */
19 
20 /*******************************************************************************
21  * Definitions
22  ******************************************************************************/
23 
24 /*! @name Driver version */
25 /*@{*/
26 /*! @brief FlexIO UART driver version 2.2.0. */
27 #define FSL_FLEXIO_UART_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))
28 /*@}*/
29 
30 /*! @brief Retry times for waiting flag. */
31 #ifndef UART_RETRY_TIMES
32 #define UART_RETRY_TIMES 0U /* Defining to zero means to keep waiting for the flag until it is assert/deassert. */
33 #endif
34 
35 /*! @brief Error codes for the UART driver. */
36 enum
37 {
38     kStatus_FLEXIO_UART_TxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 0), /*!< Transmitter is busy. */
39     kStatus_FLEXIO_UART_RxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 1), /*!< Receiver is busy. */
40     kStatus_FLEXIO_UART_TxIdle = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 2), /*!< UART transmitter is idle. */
41     kStatus_FLEXIO_UART_RxIdle = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 3), /*!< UART receiver is idle. */
42     kStatus_FLEXIO_UART_ERROR  = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 4), /*!< ERROR happens on UART. */
43     kStatus_FLEXIO_UART_RxRingBufferOverrun =
44         MAKE_STATUS(kStatusGroup_FLEXIO_UART, 5), /*!< UART RX software ring buffer overrun. */
45     kStatus_FLEXIO_UART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 6), /*!< UART RX receiver overrun. */
46     kStatus_FLEXIO_UART_Timeout           = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 7)  /*!< UART times out. */
47 };
48 
49 /*! @brief FlexIO UART bit count per char. */
50 typedef enum _flexio_uart_bit_count_per_char
51 {
52     kFLEXIO_UART_7BitsPerChar = 7U, /*!< 7-bit data characters */
53     kFLEXIO_UART_8BitsPerChar = 8U, /*!< 8-bit data characters */
54     kFLEXIO_UART_9BitsPerChar = 9U, /*!< 9-bit data characters */
55 } flexio_uart_bit_count_per_char_t;
56 
57 /*! @brief Define FlexIO UART interrupt mask. */
58 enum _flexio_uart_interrupt_enable
59 {
60     kFLEXIO_UART_TxDataRegEmptyInterruptEnable = 0x1U, /*!< Transmit buffer empty interrupt enable. */
61     kFLEXIO_UART_RxDataRegFullInterruptEnable  = 0x2U, /*!< Receive buffer full interrupt enable. */
62 };
63 
64 /*! @brief Define FlexIO UART status mask. */
65 enum _flexio_uart_status_flags
66 {
67     kFLEXIO_UART_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */
68     kFLEXIO_UART_RxDataRegFullFlag  = 0x2U, /*!< Receive buffer full flag. */
69     kFLEXIO_UART_RxOverRunFlag      = 0x4U, /*!< Receive buffer over run flag. */
70 };
71 
72 /*! @brief Define FlexIO UART access structure typedef. */
73 typedef struct _flexio_uart_type
74 {
75     FLEXIO_Type *flexioBase; /*!< FlexIO base pointer. */
76     uint8_t TxPinIndex;      /*!< Pin select for UART_Tx. */
77     uint8_t RxPinIndex;      /*!< Pin select for UART_Rx. */
78     uint8_t shifterIndex[2]; /*!< Shifter index used in FlexIO UART. */
79     uint8_t timerIndex[2];   /*!< Timer index used in FlexIO UART. */
80 } FLEXIO_UART_Type;
81 
82 /*! @brief Define FlexIO UART user configuration structure. */
83 typedef struct _flexio_uart_config
84 {
85     bool enableUart;                                  /*!< Enable/disable FlexIO UART TX & RX. */
86     bool enableInDoze;                                /*!< Enable/disable FlexIO operation in doze mode*/
87     bool enableInDebug;                               /*!< Enable/disable FlexIO operation in debug mode*/
88     bool enableFastAccess;                            /*!< Enable/disable fast access to FlexIO registers,
89                                                        fast access requires the FlexIO clock to be at least
90                                                        twice the frequency of the bus clock. */
91     uint32_t baudRate_Bps;                            /*!< Baud rate in Bps. */
92     flexio_uart_bit_count_per_char_t bitCountPerChar; /*!< number of bits, 7/8/9 -bit */
93 } flexio_uart_config_t;
94 
95 /*! @brief Define FlexIO UART transfer structure. */
96 typedef struct _flexio_uart_transfer
97 {
98     uint8_t *data;   /*!< Transfer buffer*/
99     size_t dataSize; /*!< Transfer size*/
100 } flexio_uart_transfer_t;
101 
102 /* Forward declaration of the handle typedef. */
103 typedef struct _flexio_uart_handle flexio_uart_handle_t;
104 
105 /*! @brief FlexIO UART transfer callback function. */
106 typedef void (*flexio_uart_transfer_callback_t)(FLEXIO_UART_Type *base,
107                                                 flexio_uart_handle_t *handle,
108                                                 status_t status,
109                                                 void *userData);
110 
111 /*! @brief Define FLEXIO UART handle structure*/
112 struct _flexio_uart_handle
113 {
114     uint8_t *volatile txData;   /*!< Address of remaining data to send. */
115     volatile size_t txDataSize; /*!< Size of the remaining data to send. */
116     uint8_t *volatile rxData;   /*!< Address of remaining data to receive. */
117     volatile size_t rxDataSize; /*!< Size of the remaining data to receive. */
118     size_t txDataSizeAll;       /*!< Total bytes to be sent. */
119     size_t rxDataSizeAll;       /*!< Total bytes to be received. */
120 
121     uint8_t *rxRingBuffer;              /*!< Start address of the receiver ring buffer. */
122     size_t rxRingBufferSize;            /*!< Size of the ring buffer. */
123     volatile uint16_t rxRingBufferHead; /*!< Index for the driver to store received data into ring buffer. */
124     volatile uint16_t rxRingBufferTail; /*!< Index for the user to get data from the ring buffer. */
125 
126     flexio_uart_transfer_callback_t callback; /*!< Callback function. */
127     void *userData;                           /*!< UART callback function parameter.*/
128 
129     volatile uint8_t txState; /*!< TX transfer state. */
130     volatile uint8_t rxState; /*!< RX transfer state */
131 };
132 
133 /*******************************************************************************
134  * API
135  ******************************************************************************/
136 
137 #if defined(__cplusplus)
138 extern "C" {
139 #endif /*_cplusplus*/
140 
141 /*!
142  * @name Initialization and deinitialization
143  * @{
144  */
145 
146 /*!
147  * @brief Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART
148  * hardware, and configures the FlexIO UART with FlexIO UART configuration.
149  * The configuration structure can be filled by the user or be set with
150  * default values by FLEXIO_UART_GetDefaultConfig().
151  *
152  * Example
153    @code
154    FLEXIO_UART_Type base = {
155    .flexioBase = FLEXIO,
156    .TxPinIndex = 0,
157    .RxPinIndex = 1,
158    .shifterIndex = {0,1},
159    .timerIndex = {0,1}
160    };
161    flexio_uart_config_t config = {
162    .enableInDoze = false,
163    .enableInDebug = true,
164    .enableFastAccess = false,
165    .baudRate_Bps = 115200U,
166    .bitCountPerChar = 8
167    };
168    FLEXIO_UART_Init(base, &config, srcClock_Hz);
169    @endcode
170  *
171  * @param base Pointer to the FLEXIO_UART_Type structure.
172  * @param userConfig Pointer to the flexio_uart_config_t structure.
173  * @param srcClock_Hz FlexIO source clock in Hz.
174  * @retval kStatus_Success Configuration success
175  * @retval kStatus_InvalidArgument Buadrate configuration out of range
176 */
177 status_t FLEXIO_UART_Init(FLEXIO_UART_Type *base, const flexio_uart_config_t *userConfig, uint32_t srcClock_Hz);
178 
179 /*!
180  * @brief Resets the FlexIO UART shifter and timer config.
181  *
182  * @note After calling this API, call the FLEXO_UART_Init to use the FlexIO UART module.
183  *
184  * @param base Pointer to FLEXIO_UART_Type structure
185  */
186 void FLEXIO_UART_Deinit(FLEXIO_UART_Type *base);
187 
188 /*!
189  * @brief Gets the default configuration to configure the FlexIO UART. The configuration
190  * can be used directly for calling the FLEXIO_UART_Init().
191  * Example:
192    @code
193    flexio_uart_config_t config;
194    FLEXIO_UART_GetDefaultConfig(&userConfig);
195    @endcode
196  * @param userConfig Pointer to the flexio_uart_config_t structure.
197 */
198 void FLEXIO_UART_GetDefaultConfig(flexio_uart_config_t *userConfig);
199 
200 /* @} */
201 
202 /*!
203  * @name Status
204  * @{
205  */
206 
207 /*!
208  * @brief Gets the FlexIO UART status flags.
209  *
210  * @param base Pointer to the FLEXIO_UART_Type structure.
211  * @return FlexIO UART status flags.
212  */
213 
214 uint32_t FLEXIO_UART_GetStatusFlags(FLEXIO_UART_Type *base);
215 
216 /*!
217  * @brief Gets the FlexIO UART status flags.
218  *
219  * @param base Pointer to the FLEXIO_UART_Type structure.
220  * @param mask Status flag.
221  *      The parameter can be any combination of the following values:
222  *          @arg kFLEXIO_UART_TxDataRegEmptyFlag
223  *          @arg kFLEXIO_UART_RxEmptyFlag
224  *          @arg kFLEXIO_UART_RxOverRunFlag
225  */
226 
227 void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask);
228 
229 /* @} */
230 
231 /*!
232  * @name Interrupts
233  * @{
234  */
235 
236 /*!
237  * @brief Enables the FlexIO UART interrupt.
238  *
239  * This function enables the FlexIO UART interrupt.
240  *
241  * @param base Pointer to the FLEXIO_UART_Type structure.
242  * @param mask Interrupt source.
243  */
244 void FLEXIO_UART_EnableInterrupts(FLEXIO_UART_Type *base, uint32_t mask);
245 
246 /*!
247  * @brief Disables the FlexIO UART interrupt.
248  *
249  * This function disables the FlexIO UART interrupt.
250  *
251  * @param base Pointer to the FLEXIO_UART_Type structure.
252  * @param mask Interrupt source.
253  */
254 void FLEXIO_UART_DisableInterrupts(FLEXIO_UART_Type *base, uint32_t mask);
255 
256 /* @} */
257 
258 /*!
259  * @name DMA Control
260  * @{
261  */
262 
263 /*!
264  * @brief Gets the FlexIO UARt transmit data register address.
265  *
266  * This function returns the UART data register address, which is mainly used by DMA/eDMA.
267  *
268  * @param base Pointer to the FLEXIO_UART_Type structure.
269  * @return FlexIO UART transmit data register address.
270  */
FLEXIO_UART_GetTxDataRegisterAddress(FLEXIO_UART_Type * base)271 static inline uint32_t FLEXIO_UART_GetTxDataRegisterAddress(FLEXIO_UART_Type *base)
272 {
273     return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBuffer, base->shifterIndex[0]);
274 }
275 
276 /*!
277  * @brief Gets the FlexIO UART receive data register address.
278  *
279  * This function returns the UART data register address, which is mainly used by DMA/eDMA.
280  *
281  * @param base Pointer to the FLEXIO_UART_Type structure.
282  * @return FlexIO UART receive data register address.
283  */
FLEXIO_UART_GetRxDataRegisterAddress(FLEXIO_UART_Type * base)284 static inline uint32_t FLEXIO_UART_GetRxDataRegisterAddress(FLEXIO_UART_Type *base)
285 {
286     return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferByteSwapped, base->shifterIndex[1]);
287 }
288 
289 /*!
290  * @brief Enables/disables the FlexIO UART transmit DMA.
291  * This function enables/disables the FlexIO UART Tx DMA,
292  * which means asserting the kFLEXIO_UART_TxDataRegEmptyFlag does/doesn't trigger the DMA request.
293  *
294  * @param base Pointer to the FLEXIO_UART_Type structure.
295  * @param enable True to enable, false to disable.
296  */
FLEXIO_UART_EnableTxDMA(FLEXIO_UART_Type * base,bool enable)297 static inline void FLEXIO_UART_EnableTxDMA(FLEXIO_UART_Type *base, bool enable)
298 {
299     FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->shifterIndex[0], enable);
300 }
301 
302 /*!
303  * @brief Enables/disables the FlexIO UART receive DMA.
304  * This function enables/disables the FlexIO UART Rx DMA,
305  * which means asserting kFLEXIO_UART_RxDataRegFullFlag does/doesn't trigger the DMA request.
306  *
307  * @param base Pointer to the FLEXIO_UART_Type structure.
308  * @param enable True to enable, false to disable.
309  */
FLEXIO_UART_EnableRxDMA(FLEXIO_UART_Type * base,bool enable)310 static inline void FLEXIO_UART_EnableRxDMA(FLEXIO_UART_Type *base, bool enable)
311 {
312     FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->shifterIndex[1], enable);
313 }
314 
315 /* @} */
316 
317 /*!
318  * @name Bus Operations
319  * @{
320  */
321 
322 /*!
323  * @brief Enables/disables the FlexIO UART module operation.
324  *
325  * @param base Pointer to the FLEXIO_UART_Type.
326  * @param enable True to enable, false does not have any effect.
327  */
FLEXIO_UART_Enable(FLEXIO_UART_Type * base,bool enable)328 static inline void FLEXIO_UART_Enable(FLEXIO_UART_Type *base, bool enable)
329 {
330     if (enable)
331     {
332         base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK;
333     }
334 }
335 
336 /*!
337  * @brief Writes one byte of data.
338  *
339  * @note This is a non-blocking API, which returns directly after the data is put into the
340  * data register. Ensure that the TxEmptyFlag is asserted before calling
341  * this API.
342  *
343  * @param base Pointer to the FLEXIO_UART_Type structure.
344  * @param buffer The data bytes to send.
345  */
FLEXIO_UART_WriteByte(FLEXIO_UART_Type * base,const uint8_t * buffer)346 static inline void FLEXIO_UART_WriteByte(FLEXIO_UART_Type *base, const uint8_t *buffer)
347 {
348     base->flexioBase->SHIFTBUF[base->shifterIndex[0]] = *buffer;
349 }
350 
351 /*!
352  * @brief Reads one byte of data.
353  *
354  * @note This is a non-blocking API, which returns directly after the data is read from the
355  * data register. Ensure that the RxFullFlag is asserted before calling this API.
356  *
357  * @param base Pointer to the FLEXIO_UART_Type structure.
358  * @param buffer The buffer to store the received bytes.
359  */
FLEXIO_UART_ReadByte(FLEXIO_UART_Type * base,uint8_t * buffer)360 static inline void FLEXIO_UART_ReadByte(FLEXIO_UART_Type *base, uint8_t *buffer)
361 {
362     *buffer = (uint8_t)(base->flexioBase->SHIFTBUFBYS[base->shifterIndex[1]]);
363 }
364 
365 /*!
366  * @brief Sends a buffer of data bytes.
367  *
368  * @note This function blocks using the polling method until all bytes have been sent.
369  *
370  * @param base Pointer to the FLEXIO_UART_Type structure.
371  * @param txData The data bytes to send.
372  * @param txSize The number of data bytes to send.
373  * @retval kStatus_FLEXIO_UART_Timeout Transmission timed out and was aborted.
374  * @retval kStatus_Success Successfully wrote all data.
375  */
376 status_t FLEXIO_UART_WriteBlocking(FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize);
377 
378 /*!
379  * @brief Receives a buffer of bytes.
380  *
381  * @note This function blocks using the polling method until all bytes have been received.
382  *
383  * @param base Pointer to the FLEXIO_UART_Type structure.
384  * @param rxData The buffer to store the received bytes.
385  * @param rxSize The number of data bytes to be received.
386  * @retval kStatus_FLEXIO_UART_Timeout Transmission timed out and was aborted.
387  * @retval kStatus_Success Successfully received all data.
388  */
389 status_t FLEXIO_UART_ReadBlocking(FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize);
390 
391 /* @} */
392 
393 /*!
394  * @name Transactional
395  * @{
396  */
397 
398 /*!
399  * @brief Initializes the UART handle.
400  *
401  * This function initializes the FlexIO UART handle, which can be used for other FlexIO
402  * UART transactional APIs. Call this API once to get the
403  * initialized handle.
404  *
405  * The UART driver supports the "background" receiving, which means that users can set up
406  * a RX ring buffer optionally. Data received is stored into the ring buffer even when
407  * the user doesn't call the FLEXIO_UART_TransferReceiveNonBlocking() API. If there is already data
408  * received in the ring buffer, users can get the received data from the ring buffer
409  * directly. The ring buffer is disabled if passing NULL as @p ringBuffer.
410  *
411  * @param base to FLEXIO_UART_Type structure.
412  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
413  * @param callback The callback function.
414  * @param userData The parameter of the callback function.
415  * @retval kStatus_Success Successfully create the handle.
416  * @retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range.
417  */
418 status_t FLEXIO_UART_TransferCreateHandle(FLEXIO_UART_Type *base,
419                                           flexio_uart_handle_t *handle,
420                                           flexio_uart_transfer_callback_t callback,
421                                           void *userData);
422 
423 /*!
424  * @brief Sets up the RX ring buffer.
425  *
426  * This function sets up the RX ring buffer to a specific UART handle.
427  *
428  * When the RX ring buffer is used, data received is stored into the ring buffer even when
429  * the user doesn't call the UART_ReceiveNonBlocking() API. If there is already data received
430  * in the ring buffer, users can get the received data from the ring buffer directly.
431  *
432  * @note When using the RX ring buffer, one byte is reserved for internal use. In other
433  * words, if @p ringBufferSize is 32, only 31 bytes are used for saving data.
434  *
435  * @param base Pointer to the FLEXIO_UART_Type structure.
436  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
437  * @param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer.
438  * @param ringBufferSize Size of the ring buffer.
439  */
440 void FLEXIO_UART_TransferStartRingBuffer(FLEXIO_UART_Type *base,
441                                          flexio_uart_handle_t *handle,
442                                          uint8_t *ringBuffer,
443                                          size_t ringBufferSize);
444 
445 /*!
446  * @brief Aborts the background transfer and uninstalls the ring buffer.
447  *
448  * This function aborts the background transfer and uninstalls the ring buffer.
449  *
450  * @param base Pointer to the FLEXIO_UART_Type structure.
451  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
452  */
453 void FLEXIO_UART_TransferStopRingBuffer(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle);
454 
455 /*!
456  * @brief Transmits a buffer of data using the interrupt method.
457  *
458  * This function sends data using an interrupt method. This is a non-blocking function,
459  * which returns directly without waiting for all data to be written to the TX register. When
460  * all data is written to the TX register in ISR, the FlexIO UART driver calls the callback
461  * function and passes the @ref kStatus_FLEXIO_UART_TxIdle as status parameter.
462  *
463  * @note The kStatus_FLEXIO_UART_TxIdle is passed to the upper layer when all data is written
464  * to the TX register. However, it does not ensure that all data is sent out.
465  *
466  * @param base Pointer to the FLEXIO_UART_Type structure.
467  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
468  * @param xfer FlexIO UART transfer structure. See #flexio_uart_transfer_t.
469  * @retval kStatus_Success Successfully starts the data transmission.
470  * @retval kStatus_UART_TxBusy Previous transmission still not finished, data not written to the TX register.
471  */
472 status_t FLEXIO_UART_TransferSendNonBlocking(FLEXIO_UART_Type *base,
473                                              flexio_uart_handle_t *handle,
474                                              flexio_uart_transfer_t *xfer);
475 
476 /*!
477  * @brief Aborts the interrupt-driven data transmit.
478  *
479  * This function aborts the interrupt-driven data sending. Get the remainBytes to find out
480  * how many bytes are still not sent out.
481  *
482  * @param base Pointer to the FLEXIO_UART_Type structure.
483  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
484  */
485 void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle);
486 
487 /*!
488  * @brief Gets the number of bytes sent.
489  *
490  * This function gets the number of bytes sent driven by interrupt.
491  *
492  * @param base Pointer to the FLEXIO_UART_Type structure.
493  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
494  * @param count Number of bytes sent so far by the non-blocking transaction.
495  * @retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress.
496  * @retval kStatus_Success Successfully return the count.
497  */
498 status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count);
499 
500 /*!
501  * @brief Receives a buffer of data using the interrupt method.
502  *
503  * This function receives data using the interrupt method. This is a non-blocking function,
504  * which returns without waiting for all data to be received.
505  * If the RX ring buffer is used and not empty, the data in ring buffer is copied and
506  * the parameter @p receivedBytes shows how many bytes are copied from the ring buffer.
507  * After copying, if the data in ring buffer is not enough to read, the receive
508  * request is saved by the UART driver. When new data arrives, the receive request
509  * is serviced first. When all data is received, the UART driver notifies the upper layer
510  * through a callback function and passes the status parameter kStatus_UART_RxIdle.
511  * For example, if the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer,
512  * the 5 bytes are copied to xfer->data. This function returns with the
513  * parameter @p receivedBytes set to 5. For the last 5 bytes, newly arrived data is
514  * saved from the xfer->data[5]. When 5 bytes are received, the UART driver notifies upper layer.
515  * If the RX ring buffer is not enabled, this function enables the RX and RX interrupt
516  * to receive data to xfer->data. When all data is received, the upper layer is notified.
517  *
518  * @param base Pointer to the FLEXIO_UART_Type structure.
519  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
520  * @param xfer UART transfer structure. See #flexio_uart_transfer_t.
521  * @param receivedBytes Bytes received from the ring buffer directly.
522  * @retval kStatus_Success Successfully queue the transfer into the transmit queue.
523  * @retval kStatus_FLEXIO_UART_RxBusy Previous receive request is not finished.
524  */
525 status_t FLEXIO_UART_TransferReceiveNonBlocking(FLEXIO_UART_Type *base,
526                                                 flexio_uart_handle_t *handle,
527                                                 flexio_uart_transfer_t *xfer,
528                                                 size_t *receivedBytes);
529 
530 /*!
531  * @brief Aborts the receive data which was using IRQ.
532  *
533  * This function aborts the receive data which was using IRQ.
534  *
535  * @param base Pointer to the FLEXIO_UART_Type structure.
536  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
537  */
538 void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle);
539 
540 /*!
541  * @brief Gets the number of bytes received.
542  *
543  * This function gets the number of bytes received driven by interrupt.
544  *
545  * @param base Pointer to the FLEXIO_UART_Type structure.
546  * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.
547  * @param count Number of bytes received so far by the non-blocking transaction.
548  * @retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress.
549  * @retval kStatus_Success Successfully return the count.
550  */
551 status_t FLEXIO_UART_TransferGetReceiveCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count);
552 
553 /*!
554  * @brief FlexIO UART IRQ handler function.
555  *
556  * This function processes the FlexIO UART transmit and receives the IRQ request.
557  *
558  * @param uartType Pointer to the FLEXIO_UART_Type structure.
559  * @param uartHandle Pointer to the flexio_uart_handle_t structure to store the transfer state.
560  */
561 void FLEXIO_UART_TransferHandleIRQ(void *uartType, void *uartHandle);
562 
563 /*@}*/
564 
565 #if defined(__cplusplus)
566 }
567 #endif /*_cplusplus*/
568 /*@}*/
569 
570 #endif /*_FSL_FLEXIO_UART_H_*/
571