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