The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /*
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
AnnaBridge 171:3a7713b1edbc 3 * All rights reserved.
AnnaBridge 171:3a7713b1edbc 4 *
AnnaBridge 171:3a7713b1edbc 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 171:3a7713b1edbc 6 * are permitted provided that the following conditions are met:
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 171:3a7713b1edbc 9 * of conditions and the following disclaimer.
AnnaBridge 171:3a7713b1edbc 10 *
AnnaBridge 171:3a7713b1edbc 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 171:3a7713b1edbc 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 171:3a7713b1edbc 13 * other materials provided with the distribution.
AnnaBridge 171:3a7713b1edbc 14 *
AnnaBridge 171:3a7713b1edbc 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 171:3a7713b1edbc 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 171:3a7713b1edbc 17 * software without specific prior written permission.
AnnaBridge 171:3a7713b1edbc 18 *
AnnaBridge 171:3a7713b1edbc 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 171:3a7713b1edbc 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 171:3a7713b1edbc 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 171:3a7713b1edbc 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 171:3a7713b1edbc 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 171:3a7713b1edbc 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 171:3a7713b1edbc 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 171:3a7713b1edbc 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 171:3a7713b1edbc 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 171:3a7713b1edbc 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 171:3a7713b1edbc 29 */
AnnaBridge 171:3a7713b1edbc 30 #ifndef _FSL_UART_H_
AnnaBridge 171:3a7713b1edbc 31 #define _FSL_UART_H_
AnnaBridge 171:3a7713b1edbc 32
AnnaBridge 171:3a7713b1edbc 33 #include "fsl_common.h"
AnnaBridge 171:3a7713b1edbc 34
AnnaBridge 171:3a7713b1edbc 35 /*!
AnnaBridge 171:3a7713b1edbc 36 * @addtogroup uart_driver
AnnaBridge 171:3a7713b1edbc 37 * @{
AnnaBridge 171:3a7713b1edbc 38 */
AnnaBridge 171:3a7713b1edbc 39
AnnaBridge 171:3a7713b1edbc 40 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 41 * Definitions
AnnaBridge 171:3a7713b1edbc 42 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 43
AnnaBridge 171:3a7713b1edbc 44 /*! @name Driver version */
AnnaBridge 171:3a7713b1edbc 45 /*@{*/
AnnaBridge 171:3a7713b1edbc 46 /*! @brief UART driver version 2.1.4. */
AnnaBridge 171:3a7713b1edbc 47 #define FSL_UART_DRIVER_VERSION (MAKE_VERSION(2, 1, 4))
AnnaBridge 171:3a7713b1edbc 48 /*@}*/
AnnaBridge 171:3a7713b1edbc 49
AnnaBridge 171:3a7713b1edbc 50 /*! @brief Error codes for the UART driver. */
AnnaBridge 171:3a7713b1edbc 51 enum _uart_status
AnnaBridge 171:3a7713b1edbc 52 {
AnnaBridge 171:3a7713b1edbc 53 kStatus_UART_TxBusy = MAKE_STATUS(kStatusGroup_UART, 0), /*!< Transmitter is busy. */
AnnaBridge 171:3a7713b1edbc 54 kStatus_UART_RxBusy = MAKE_STATUS(kStatusGroup_UART, 1), /*!< Receiver is busy. */
AnnaBridge 171:3a7713b1edbc 55 kStatus_UART_TxIdle = MAKE_STATUS(kStatusGroup_UART, 2), /*!< UART transmitter is idle. */
AnnaBridge 171:3a7713b1edbc 56 kStatus_UART_RxIdle = MAKE_STATUS(kStatusGroup_UART, 3), /*!< UART receiver is idle. */
AnnaBridge 171:3a7713b1edbc 57 kStatus_UART_TxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_UART, 4), /*!< TX FIFO watermark too large */
AnnaBridge 171:3a7713b1edbc 58 kStatus_UART_RxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_UART, 5), /*!< RX FIFO watermark too large */
AnnaBridge 171:3a7713b1edbc 59 kStatus_UART_FlagCannotClearManually =
AnnaBridge 171:3a7713b1edbc 60 MAKE_STATUS(kStatusGroup_UART, 6), /*!< UART flag can't be manually cleared. */
AnnaBridge 171:3a7713b1edbc 61 kStatus_UART_Error = MAKE_STATUS(kStatusGroup_UART, 7), /*!< Error happens on UART. */
AnnaBridge 171:3a7713b1edbc 62 kStatus_UART_RxRingBufferOverrun = MAKE_STATUS(kStatusGroup_UART, 8), /*!< UART RX software ring buffer overrun. */
AnnaBridge 171:3a7713b1edbc 63 kStatus_UART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_UART, 9), /*!< UART RX receiver overrun. */
AnnaBridge 171:3a7713b1edbc 64 kStatus_UART_NoiseError = MAKE_STATUS(kStatusGroup_UART, 10), /*!< UART noise error. */
AnnaBridge 171:3a7713b1edbc 65 kStatus_UART_FramingError = MAKE_STATUS(kStatusGroup_UART, 11), /*!< UART framing error. */
AnnaBridge 171:3a7713b1edbc 66 kStatus_UART_ParityError = MAKE_STATUS(kStatusGroup_UART, 12), /*!< UART parity error. */
AnnaBridge 171:3a7713b1edbc 67 kStatus_UART_BaudrateNotSupport =
AnnaBridge 171:3a7713b1edbc 68 MAKE_STATUS(kStatusGroup_UART, 13), /*!< Baudrate is not support in current clock source */
AnnaBridge 171:3a7713b1edbc 69 };
AnnaBridge 171:3a7713b1edbc 70
AnnaBridge 171:3a7713b1edbc 71 /*! @brief UART parity mode. */
AnnaBridge 171:3a7713b1edbc 72 typedef enum _uart_parity_mode
AnnaBridge 171:3a7713b1edbc 73 {
AnnaBridge 171:3a7713b1edbc 74 kUART_ParityDisabled = 0x0U, /*!< Parity disabled */
AnnaBridge 171:3a7713b1edbc 75 kUART_ParityEven = 0x2U, /*!< Parity enabled, type even, bit setting: PE|PT = 10 */
AnnaBridge 171:3a7713b1edbc 76 kUART_ParityOdd = 0x3U, /*!< Parity enabled, type odd, bit setting: PE|PT = 11 */
AnnaBridge 171:3a7713b1edbc 77 } uart_parity_mode_t;
AnnaBridge 171:3a7713b1edbc 78
AnnaBridge 171:3a7713b1edbc 79 /*! @brief UART stop bit count. */
AnnaBridge 171:3a7713b1edbc 80 typedef enum _uart_stop_bit_count
AnnaBridge 171:3a7713b1edbc 81 {
AnnaBridge 171:3a7713b1edbc 82 kUART_OneStopBit = 0U, /*!< One stop bit */
AnnaBridge 171:3a7713b1edbc 83 kUART_TwoStopBit = 1U, /*!< Two stop bits */
AnnaBridge 171:3a7713b1edbc 84 } uart_stop_bit_count_t;
AnnaBridge 171:3a7713b1edbc 85
AnnaBridge 171:3a7713b1edbc 86 /*!
AnnaBridge 171:3a7713b1edbc 87 * @brief UART interrupt configuration structure, default settings all disabled.
AnnaBridge 171:3a7713b1edbc 88 *
AnnaBridge 171:3a7713b1edbc 89 * This structure contains the settings for all of the UART interrupt configurations.
AnnaBridge 171:3a7713b1edbc 90 */
AnnaBridge 171:3a7713b1edbc 91 enum _uart_interrupt_enable
AnnaBridge 171:3a7713b1edbc 92 {
AnnaBridge 171:3a7713b1edbc 93 #if defined(FSL_FEATURE_UART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_UART_HAS_LIN_BREAK_DETECT
AnnaBridge 171:3a7713b1edbc 94 kUART_LinBreakInterruptEnable = (UART_BDH_LBKDIE_MASK), /*!< LIN break detect interrupt. */
AnnaBridge 171:3a7713b1edbc 95 #endif
AnnaBridge 171:3a7713b1edbc 96 kUART_RxActiveEdgeInterruptEnable = (UART_BDH_RXEDGIE_MASK), /*!< RX active edge interrupt. */
AnnaBridge 171:3a7713b1edbc 97 kUART_TxDataRegEmptyInterruptEnable = (UART_C2_TIE_MASK << 8), /*!< Transmit data register empty interrupt. */
AnnaBridge 171:3a7713b1edbc 98 kUART_TransmissionCompleteInterruptEnable = (UART_C2_TCIE_MASK << 8), /*!< Transmission complete interrupt. */
AnnaBridge 171:3a7713b1edbc 99 kUART_RxDataRegFullInterruptEnable = (UART_C2_RIE_MASK << 8), /*!< Receiver data register full interrupt. */
AnnaBridge 171:3a7713b1edbc 100 kUART_IdleLineInterruptEnable = (UART_C2_ILIE_MASK << 8), /*!< Idle line interrupt. */
AnnaBridge 171:3a7713b1edbc 101 kUART_RxOverrunInterruptEnable = (UART_C3_ORIE_MASK << 16), /*!< Receiver overrun interrupt. */
AnnaBridge 171:3a7713b1edbc 102 kUART_NoiseErrorInterruptEnable = (UART_C3_NEIE_MASK << 16), /*!< Noise error flag interrupt. */
AnnaBridge 171:3a7713b1edbc 103 kUART_FramingErrorInterruptEnable = (UART_C3_FEIE_MASK << 16), /*!< Framing error flag interrupt. */
AnnaBridge 171:3a7713b1edbc 104 kUART_ParityErrorInterruptEnable = (UART_C3_PEIE_MASK << 16), /*!< Parity error flag interrupt. */
AnnaBridge 171:3a7713b1edbc 105 #if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
AnnaBridge 171:3a7713b1edbc 106 kUART_RxFifoOverflowInterruptEnable = (UART_CFIFO_RXOFE_MASK << 24), /*!< RX FIFO overflow interrupt. */
AnnaBridge 171:3a7713b1edbc 107 kUART_TxFifoOverflowInterruptEnable = (UART_CFIFO_TXOFE_MASK << 24), /*!< TX FIFO overflow interrupt. */
AnnaBridge 171:3a7713b1edbc 108 kUART_RxFifoUnderflowInterruptEnable = (UART_CFIFO_RXUFE_MASK << 24), /*!< RX FIFO underflow interrupt. */
AnnaBridge 171:3a7713b1edbc 109 #endif
AnnaBridge 171:3a7713b1edbc 110 kUART_AllInterruptsEnable =
AnnaBridge 171:3a7713b1edbc 111 #if defined(FSL_FEATURE_UART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_UART_HAS_LIN_BREAK_DETECT
AnnaBridge 171:3a7713b1edbc 112 kUART_LinBreakInterruptEnable |
AnnaBridge 171:3a7713b1edbc 113 #endif
AnnaBridge 171:3a7713b1edbc 114 kUART_RxActiveEdgeInterruptEnable | kUART_TxDataRegEmptyInterruptEnable |
AnnaBridge 171:3a7713b1edbc 115 kUART_TransmissionCompleteInterruptEnable | kUART_RxDataRegFullInterruptEnable | kUART_IdleLineInterruptEnable |
AnnaBridge 171:3a7713b1edbc 116 kUART_RxOverrunInterruptEnable | kUART_NoiseErrorInterruptEnable | kUART_FramingErrorInterruptEnable |
AnnaBridge 171:3a7713b1edbc 117 kUART_ParityErrorInterruptEnable
AnnaBridge 171:3a7713b1edbc 118 #if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
AnnaBridge 171:3a7713b1edbc 119 |
AnnaBridge 171:3a7713b1edbc 120 kUART_RxFifoOverflowInterruptEnable | kUART_TxFifoOverflowInterruptEnable | kUART_RxFifoUnderflowInterruptEnable
AnnaBridge 171:3a7713b1edbc 121 #endif
AnnaBridge 171:3a7713b1edbc 122 ,
AnnaBridge 171:3a7713b1edbc 123 };
AnnaBridge 171:3a7713b1edbc 124
AnnaBridge 171:3a7713b1edbc 125 /*!
AnnaBridge 171:3a7713b1edbc 126 * @brief UART status flags.
AnnaBridge 171:3a7713b1edbc 127 *
AnnaBridge 171:3a7713b1edbc 128 * This provides constants for the UART status flags for use in the UART functions.
AnnaBridge 171:3a7713b1edbc 129 */
AnnaBridge 171:3a7713b1edbc 130 enum _uart_flags
AnnaBridge 171:3a7713b1edbc 131 {
AnnaBridge 171:3a7713b1edbc 132 kUART_TxDataRegEmptyFlag = (UART_S1_TDRE_MASK), /*!< TX data register empty flag. */
AnnaBridge 171:3a7713b1edbc 133 kUART_TransmissionCompleteFlag = (UART_S1_TC_MASK), /*!< Transmission complete flag. */
AnnaBridge 171:3a7713b1edbc 134 kUART_RxDataRegFullFlag = (UART_S1_RDRF_MASK), /*!< RX data register full flag. */
AnnaBridge 171:3a7713b1edbc 135 kUART_IdleLineFlag = (UART_S1_IDLE_MASK), /*!< Idle line detect flag. */
AnnaBridge 171:3a7713b1edbc 136 kUART_RxOverrunFlag = (UART_S1_OR_MASK), /*!< RX overrun flag. */
AnnaBridge 171:3a7713b1edbc 137 kUART_NoiseErrorFlag = (UART_S1_NF_MASK), /*!< RX takes 3 samples of each received bit.
AnnaBridge 171:3a7713b1edbc 138 If any of these samples differ, noise flag sets */
AnnaBridge 171:3a7713b1edbc 139 kUART_FramingErrorFlag = (UART_S1_FE_MASK), /*!< Frame error flag, sets if logic 0 was detected
AnnaBridge 171:3a7713b1edbc 140 where stop bit expected */
AnnaBridge 171:3a7713b1edbc 141 kUART_ParityErrorFlag = (UART_S1_PF_MASK), /*!< If parity enabled, sets upon parity error detection */
AnnaBridge 171:3a7713b1edbc 142 #if defined(FSL_FEATURE_UART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_UART_HAS_LIN_BREAK_DETECT
AnnaBridge 171:3a7713b1edbc 143 kUART_LinBreakFlag =
AnnaBridge 171:3a7713b1edbc 144 (UART_S2_LBKDIF_MASK
AnnaBridge 171:3a7713b1edbc 145 << 8), /*!< LIN break detect interrupt flag, sets when
AnnaBridge 171:3a7713b1edbc 146 LIN break char detected and LIN circuit enabled */
AnnaBridge 171:3a7713b1edbc 147 #endif
AnnaBridge 171:3a7713b1edbc 148 kUART_RxActiveEdgeFlag =
AnnaBridge 171:3a7713b1edbc 149 (UART_S2_RXEDGIF_MASK << 8), /*!< RX pin active edge interrupt flag,
AnnaBridge 171:3a7713b1edbc 150 sets when active edge detected */
AnnaBridge 171:3a7713b1edbc 151 kUART_RxActiveFlag =
AnnaBridge 171:3a7713b1edbc 152 (UART_S2_RAF_MASK << 8), /*!< Receiver Active Flag (RAF),
AnnaBridge 171:3a7713b1edbc 153 sets at beginning of valid start bit */
AnnaBridge 171:3a7713b1edbc 154 #if defined(FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS) && FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
AnnaBridge 171:3a7713b1edbc 155 kUART_NoiseErrorInRxDataRegFlag = (UART_ED_NOISY_MASK << 16), /*!< Noisy bit, sets if noise detected. */
AnnaBridge 171:3a7713b1edbc 156 kUART_ParityErrorInRxDataRegFlag = (UART_ED_PARITYE_MASK << 16), /*!< Paritye bit, sets if parity error detected. */
AnnaBridge 171:3a7713b1edbc 157 #endif
AnnaBridge 171:3a7713b1edbc 158 #if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
AnnaBridge 171:3a7713b1edbc 159 kUART_TxFifoEmptyFlag = (UART_SFIFO_TXEMPT_MASK << 24), /*!< TXEMPT bit, sets if TX buffer is empty */
AnnaBridge 171:3a7713b1edbc 160 kUART_RxFifoEmptyFlag = (UART_SFIFO_RXEMPT_MASK << 24), /*!< RXEMPT bit, sets if RX buffer is empty */
AnnaBridge 171:3a7713b1edbc 161 kUART_TxFifoOverflowFlag = (UART_SFIFO_TXOF_MASK << 24), /*!< TXOF bit, sets if TX buffer overflow occurred */
AnnaBridge 171:3a7713b1edbc 162 kUART_RxFifoOverflowFlag = (UART_SFIFO_RXOF_MASK << 24), /*!< RXOF bit, sets if receive buffer overflow */
AnnaBridge 171:3a7713b1edbc 163 kUART_RxFifoUnderflowFlag = (UART_SFIFO_RXUF_MASK << 24), /*!< RXUF bit, sets if receive buffer underflow */
AnnaBridge 171:3a7713b1edbc 164 #endif
AnnaBridge 171:3a7713b1edbc 165 };
AnnaBridge 171:3a7713b1edbc 166
AnnaBridge 171:3a7713b1edbc 167 /*! @brief UART configuration structure. */
AnnaBridge 171:3a7713b1edbc 168 typedef struct _uart_config
AnnaBridge 171:3a7713b1edbc 169 {
AnnaBridge 171:3a7713b1edbc 170 uint32_t baudRate_Bps; /*!< UART baud rate */
AnnaBridge 171:3a7713b1edbc 171 uart_parity_mode_t parityMode; /*!< Parity mode, disabled (default), even, odd */
AnnaBridge 171:3a7713b1edbc 172 #if defined(FSL_FEATURE_UART_HAS_STOP_BIT_CONFIG_SUPPORT) && FSL_FEATURE_UART_HAS_STOP_BIT_CONFIG_SUPPORT
AnnaBridge 171:3a7713b1edbc 173 uart_stop_bit_count_t stopBitCount; /*!< Number of stop bits, 1 stop bit (default) or 2 stop bits */
AnnaBridge 171:3a7713b1edbc 174 #endif
AnnaBridge 171:3a7713b1edbc 175 #if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
AnnaBridge 171:3a7713b1edbc 176 uint8_t txFifoWatermark; /*!< TX FIFO watermark */
AnnaBridge 171:3a7713b1edbc 177 uint8_t rxFifoWatermark; /*!< RX FIFO watermark */
AnnaBridge 171:3a7713b1edbc 178 #endif
AnnaBridge 171:3a7713b1edbc 179 bool enableTx; /*!< Enable TX */
AnnaBridge 171:3a7713b1edbc 180 bool enableRx; /*!< Enable RX */
AnnaBridge 171:3a7713b1edbc 181 } uart_config_t;
AnnaBridge 171:3a7713b1edbc 182
AnnaBridge 171:3a7713b1edbc 183 /*! @brief UART transfer structure. */
AnnaBridge 171:3a7713b1edbc 184 typedef struct _uart_transfer
AnnaBridge 171:3a7713b1edbc 185 {
AnnaBridge 171:3a7713b1edbc 186 uint8_t *data; /*!< The buffer of data to be transfer.*/
AnnaBridge 171:3a7713b1edbc 187 size_t dataSize; /*!< The byte count to be transfer. */
AnnaBridge 171:3a7713b1edbc 188 } uart_transfer_t;
AnnaBridge 171:3a7713b1edbc 189
AnnaBridge 171:3a7713b1edbc 190 /* Forward declaration of the handle typedef. */
AnnaBridge 171:3a7713b1edbc 191 typedef struct _uart_handle uart_handle_t;
AnnaBridge 171:3a7713b1edbc 192
AnnaBridge 171:3a7713b1edbc 193 /*! @brief UART transfer callback function. */
AnnaBridge 171:3a7713b1edbc 194 typedef void (*uart_transfer_callback_t)(UART_Type *base, uart_handle_t *handle, status_t status, void *userData);
AnnaBridge 171:3a7713b1edbc 195
AnnaBridge 171:3a7713b1edbc 196 /*! @brief UART handle structure. */
AnnaBridge 171:3a7713b1edbc 197 struct _uart_handle
AnnaBridge 171:3a7713b1edbc 198 {
AnnaBridge 171:3a7713b1edbc 199 uint8_t *volatile txData; /*!< Address of remaining data to send. */
AnnaBridge 171:3a7713b1edbc 200 volatile size_t txDataSize; /*!< Size of the remaining data to send. */
AnnaBridge 171:3a7713b1edbc 201 size_t txDataSizeAll; /*!< Size of the data to send out. */
AnnaBridge 171:3a7713b1edbc 202 uint8_t *volatile rxData; /*!< Address of remaining data to receive. */
AnnaBridge 171:3a7713b1edbc 203 volatile size_t rxDataSize; /*!< Size of the remaining data to receive. */
AnnaBridge 171:3a7713b1edbc 204 size_t rxDataSizeAll; /*!< Size of the data to receive. */
AnnaBridge 171:3a7713b1edbc 205
AnnaBridge 171:3a7713b1edbc 206 uint8_t *rxRingBuffer; /*!< Start address of the receiver ring buffer. */
AnnaBridge 171:3a7713b1edbc 207 size_t rxRingBufferSize; /*!< Size of the ring buffer. */
AnnaBridge 171:3a7713b1edbc 208 volatile uint16_t rxRingBufferHead; /*!< Index for the driver to store received data into ring buffer. */
AnnaBridge 171:3a7713b1edbc 209 volatile uint16_t rxRingBufferTail; /*!< Index for the user to get data from the ring buffer. */
AnnaBridge 171:3a7713b1edbc 210
AnnaBridge 171:3a7713b1edbc 211 uart_transfer_callback_t callback; /*!< Callback function. */
AnnaBridge 171:3a7713b1edbc 212 void *userData; /*!< UART callback function parameter.*/
AnnaBridge 171:3a7713b1edbc 213
AnnaBridge 171:3a7713b1edbc 214 volatile uint8_t txState; /*!< TX transfer state. */
AnnaBridge 171:3a7713b1edbc 215 volatile uint8_t rxState; /*!< RX transfer state */
AnnaBridge 171:3a7713b1edbc 216 };
AnnaBridge 171:3a7713b1edbc 217
AnnaBridge 171:3a7713b1edbc 218 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 219 * API
AnnaBridge 171:3a7713b1edbc 220 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 221
AnnaBridge 171:3a7713b1edbc 222 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 223 extern "C" {
AnnaBridge 171:3a7713b1edbc 224 #endif /* _cplusplus */
AnnaBridge 171:3a7713b1edbc 225
AnnaBridge 171:3a7713b1edbc 226 /*!
AnnaBridge 171:3a7713b1edbc 227 * @name Initialization and deinitialization
AnnaBridge 171:3a7713b1edbc 228 * @{
AnnaBridge 171:3a7713b1edbc 229 */
AnnaBridge 171:3a7713b1edbc 230
AnnaBridge 171:3a7713b1edbc 231 /*!
AnnaBridge 171:3a7713b1edbc 232 * @brief Initializes a UART instance with a user configuration structure and peripheral clock.
AnnaBridge 171:3a7713b1edbc 233 *
AnnaBridge 171:3a7713b1edbc 234 * This function configures the UART module with the user-defined settings. The user can configure the configuration
AnnaBridge 171:3a7713b1edbc 235 * structure and also get the default configuration by using the UART_GetDefaultConfig() function.
AnnaBridge 171:3a7713b1edbc 236 * The example below shows how to use this API to configure UART.
AnnaBridge 171:3a7713b1edbc 237 * @code
AnnaBridge 171:3a7713b1edbc 238 * uart_config_t uartConfig;
AnnaBridge 171:3a7713b1edbc 239 * uartConfig.baudRate_Bps = 115200U;
AnnaBridge 171:3a7713b1edbc 240 * uartConfig.parityMode = kUART_ParityDisabled;
AnnaBridge 171:3a7713b1edbc 241 * uartConfig.stopBitCount = kUART_OneStopBit;
AnnaBridge 171:3a7713b1edbc 242 * uartConfig.txFifoWatermark = 0;
AnnaBridge 171:3a7713b1edbc 243 * uartConfig.rxFifoWatermark = 1;
AnnaBridge 171:3a7713b1edbc 244 * UART_Init(UART1, &uartConfig, 20000000U);
AnnaBridge 171:3a7713b1edbc 245 * @endcode
AnnaBridge 171:3a7713b1edbc 246 *
AnnaBridge 171:3a7713b1edbc 247 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 248 * @param config Pointer to the user-defined configuration structure.
AnnaBridge 171:3a7713b1edbc 249 * @param srcClock_Hz UART clock source frequency in HZ.
AnnaBridge 171:3a7713b1edbc 250 * @retval kStatus_UART_BaudrateNotSupport Baudrate is not support in current clock source.
AnnaBridge 171:3a7713b1edbc 251 * @retval kStatus_Success Status UART initialize succeed
AnnaBridge 171:3a7713b1edbc 252 */
AnnaBridge 171:3a7713b1edbc 253 status_t UART_Init(UART_Type *base, const uart_config_t *config, uint32_t srcClock_Hz);
AnnaBridge 171:3a7713b1edbc 254
AnnaBridge 171:3a7713b1edbc 255 /*!
AnnaBridge 171:3a7713b1edbc 256 * @brief Deinitializes a UART instance.
AnnaBridge 171:3a7713b1edbc 257 *
AnnaBridge 171:3a7713b1edbc 258 * This function waits for TX complete, disables TX and RX, and disables the UART clock.
AnnaBridge 171:3a7713b1edbc 259 *
AnnaBridge 171:3a7713b1edbc 260 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 261 */
AnnaBridge 171:3a7713b1edbc 262 void UART_Deinit(UART_Type *base);
AnnaBridge 171:3a7713b1edbc 263
AnnaBridge 171:3a7713b1edbc 264 /*!
AnnaBridge 171:3a7713b1edbc 265 * @brief Gets the default configuration structure.
AnnaBridge 171:3a7713b1edbc 266 *
AnnaBridge 171:3a7713b1edbc 267 * This function initializes the UART configuration structure to a default value. The default
AnnaBridge 171:3a7713b1edbc 268 * values are as follows.
AnnaBridge 171:3a7713b1edbc 269 * uartConfig->baudRate_Bps = 115200U;
AnnaBridge 171:3a7713b1edbc 270 * uartConfig->bitCountPerChar = kUART_8BitsPerChar;
AnnaBridge 171:3a7713b1edbc 271 * uartConfig->parityMode = kUART_ParityDisabled;
AnnaBridge 171:3a7713b1edbc 272 * uartConfig->stopBitCount = kUART_OneStopBit;
AnnaBridge 171:3a7713b1edbc 273 * uartConfig->txFifoWatermark = 0;
AnnaBridge 171:3a7713b1edbc 274 * uartConfig->rxFifoWatermark = 1;
AnnaBridge 171:3a7713b1edbc 275 * uartConfig->enableTx = false;
AnnaBridge 171:3a7713b1edbc 276 * uartConfig->enableRx = false;
AnnaBridge 171:3a7713b1edbc 277 *
AnnaBridge 171:3a7713b1edbc 278 * @param config Pointer to configuration structure.
AnnaBridge 171:3a7713b1edbc 279 */
AnnaBridge 171:3a7713b1edbc 280 void UART_GetDefaultConfig(uart_config_t *config);
AnnaBridge 171:3a7713b1edbc 281
AnnaBridge 171:3a7713b1edbc 282 /*!
AnnaBridge 171:3a7713b1edbc 283 * @brief Sets the UART instance baud rate.
AnnaBridge 171:3a7713b1edbc 284 *
AnnaBridge 171:3a7713b1edbc 285 * This function configures the UART module baud rate. This function is used to update
AnnaBridge 171:3a7713b1edbc 286 * the UART module baud rate after the UART module is initialized by the UART_Init.
AnnaBridge 171:3a7713b1edbc 287 * @code
AnnaBridge 171:3a7713b1edbc 288 * UART_SetBaudRate(UART1, 115200U, 20000000U);
AnnaBridge 171:3a7713b1edbc 289 * @endcode
AnnaBridge 171:3a7713b1edbc 290 *
AnnaBridge 171:3a7713b1edbc 291 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 292 * @param baudRate_Bps UART baudrate to be set.
AnnaBridge 171:3a7713b1edbc 293 * @param srcClock_Hz UART clock source freqency in Hz.
AnnaBridge 171:3a7713b1edbc 294 * @retval kStatus_UART_BaudrateNotSupport Baudrate is not support in the current clock source.
AnnaBridge 171:3a7713b1edbc 295 * @retval kStatus_Success Set baudrate succeeded.
AnnaBridge 171:3a7713b1edbc 296 */
AnnaBridge 171:3a7713b1edbc 297 status_t UART_SetBaudRate(UART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz);
AnnaBridge 171:3a7713b1edbc 298
AnnaBridge 171:3a7713b1edbc 299 /* @} */
AnnaBridge 171:3a7713b1edbc 300
AnnaBridge 171:3a7713b1edbc 301 /*!
AnnaBridge 171:3a7713b1edbc 302 * @name Status
AnnaBridge 171:3a7713b1edbc 303 * @{
AnnaBridge 171:3a7713b1edbc 304 */
AnnaBridge 171:3a7713b1edbc 305
AnnaBridge 171:3a7713b1edbc 306 /*!
AnnaBridge 171:3a7713b1edbc 307 * @brief Gets UART status flags.
AnnaBridge 171:3a7713b1edbc 308 *
AnnaBridge 171:3a7713b1edbc 309 * This function gets all UART status flags. The flags are returned as the logical
AnnaBridge 171:3a7713b1edbc 310 * OR value of the enumerators @ref _uart_flags. To check a specific status,
AnnaBridge 171:3a7713b1edbc 311 * compare the return value with enumerators in @ref _uart_flags.
AnnaBridge 171:3a7713b1edbc 312 * For example, to check whether the TX is empty, do the following.
AnnaBridge 171:3a7713b1edbc 313 * @code
AnnaBridge 171:3a7713b1edbc 314 * if (kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(UART1))
AnnaBridge 171:3a7713b1edbc 315 * {
AnnaBridge 171:3a7713b1edbc 316 * ...
AnnaBridge 171:3a7713b1edbc 317 * }
AnnaBridge 171:3a7713b1edbc 318 * @endcode
AnnaBridge 171:3a7713b1edbc 319 *
AnnaBridge 171:3a7713b1edbc 320 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 321 * @return UART status flags which are ORed by the enumerators in the _uart_flags.
AnnaBridge 171:3a7713b1edbc 322 */
AnnaBridge 171:3a7713b1edbc 323 uint32_t UART_GetStatusFlags(UART_Type *base);
AnnaBridge 171:3a7713b1edbc 324
AnnaBridge 171:3a7713b1edbc 325 /*!
AnnaBridge 171:3a7713b1edbc 326 * @brief Clears status flags with the provided mask.
AnnaBridge 171:3a7713b1edbc 327 *
AnnaBridge 171:3a7713b1edbc 328 * This function clears UART status flags with a provided mask. An automatically cleared flag
AnnaBridge 171:3a7713b1edbc 329 * can't be cleared by this function.
AnnaBridge 171:3a7713b1edbc 330 * These flags can only be cleared or set by hardware.
AnnaBridge 171:3a7713b1edbc 331 * kUART_TxDataRegEmptyFlag, kUART_TransmissionCompleteFlag, kUART_RxDataRegFullFlag,
AnnaBridge 171:3a7713b1edbc 332 * kUART_RxActiveFlag, kUART_NoiseErrorInRxDataRegFlag, kUART_ParityErrorInRxDataRegFlag,
AnnaBridge 171:3a7713b1edbc 333 * kUART_TxFifoEmptyFlag,kUART_RxFifoEmptyFlag
AnnaBridge 171:3a7713b1edbc 334 * Note that this API should be called when the Tx/Rx is idle. Otherwise it has no effect.
AnnaBridge 171:3a7713b1edbc 335 *
AnnaBridge 171:3a7713b1edbc 336 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 337 * @param mask The status flags to be cleared; it is logical OR value of @ref _uart_flags.
AnnaBridge 171:3a7713b1edbc 338 * @retval kStatus_UART_FlagCannotClearManually The flag can't be cleared by this function but
AnnaBridge 171:3a7713b1edbc 339 * it is cleared automatically by hardware.
AnnaBridge 171:3a7713b1edbc 340 * @retval kStatus_Success Status in the mask is cleared.
AnnaBridge 171:3a7713b1edbc 341 */
AnnaBridge 171:3a7713b1edbc 342 status_t UART_ClearStatusFlags(UART_Type *base, uint32_t mask);
AnnaBridge 171:3a7713b1edbc 343
AnnaBridge 171:3a7713b1edbc 344 /* @} */
AnnaBridge 171:3a7713b1edbc 345
AnnaBridge 171:3a7713b1edbc 346 /*!
AnnaBridge 171:3a7713b1edbc 347 * @name Interrupts
AnnaBridge 171:3a7713b1edbc 348 * @{
AnnaBridge 171:3a7713b1edbc 349 */
AnnaBridge 171:3a7713b1edbc 350
AnnaBridge 171:3a7713b1edbc 351 /*!
AnnaBridge 171:3a7713b1edbc 352 * @brief Enables UART interrupts according to the provided mask.
AnnaBridge 171:3a7713b1edbc 353 *
AnnaBridge 171:3a7713b1edbc 354 * This function enables the UART interrupts according to the provided mask. The mask
AnnaBridge 171:3a7713b1edbc 355 * is a logical OR of enumeration members. See @ref _uart_interrupt_enable.
AnnaBridge 171:3a7713b1edbc 356 * For example, to enable TX empty interrupt and RX full interrupt, do the following.
AnnaBridge 171:3a7713b1edbc 357 * @code
AnnaBridge 171:3a7713b1edbc 358 * UART_EnableInterrupts(UART1,kUART_TxDataRegEmptyInterruptEnable | kUART_RxDataRegFullInterruptEnable);
AnnaBridge 171:3a7713b1edbc 359 * @endcode
AnnaBridge 171:3a7713b1edbc 360 *
AnnaBridge 171:3a7713b1edbc 361 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 362 * @param mask The interrupts to enable. Logical OR of @ref _uart_interrupt_enable.
AnnaBridge 171:3a7713b1edbc 363 */
AnnaBridge 171:3a7713b1edbc 364 void UART_EnableInterrupts(UART_Type *base, uint32_t mask);
AnnaBridge 171:3a7713b1edbc 365
AnnaBridge 171:3a7713b1edbc 366 /*!
AnnaBridge 171:3a7713b1edbc 367 * @brief Disables the UART interrupts according to the provided mask.
AnnaBridge 171:3a7713b1edbc 368 *
AnnaBridge 171:3a7713b1edbc 369 * This function disables the UART interrupts according to the provided mask. The mask
AnnaBridge 171:3a7713b1edbc 370 * is a logical OR of enumeration members. See @ref _uart_interrupt_enable.
AnnaBridge 171:3a7713b1edbc 371 * For example, to disable TX empty interrupt and RX full interrupt do the following.
AnnaBridge 171:3a7713b1edbc 372 * @code
AnnaBridge 171:3a7713b1edbc 373 * UART_DisableInterrupts(UART1,kUART_TxDataRegEmptyInterruptEnable | kUART_RxDataRegFullInterruptEnable);
AnnaBridge 171:3a7713b1edbc 374 * @endcode
AnnaBridge 171:3a7713b1edbc 375 *
AnnaBridge 171:3a7713b1edbc 376 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 377 * @param mask The interrupts to disable. Logical OR of @ref _uart_interrupt_enable.
AnnaBridge 171:3a7713b1edbc 378 */
AnnaBridge 171:3a7713b1edbc 379 void UART_DisableInterrupts(UART_Type *base, uint32_t mask);
AnnaBridge 171:3a7713b1edbc 380
AnnaBridge 171:3a7713b1edbc 381 /*!
AnnaBridge 171:3a7713b1edbc 382 * @brief Gets the enabled UART interrupts.
AnnaBridge 171:3a7713b1edbc 383 *
AnnaBridge 171:3a7713b1edbc 384 * This function gets the enabled UART interrupts. The enabled interrupts are returned
AnnaBridge 171:3a7713b1edbc 385 * as the logical OR value of the enumerators @ref _uart_interrupt_enable. To check
AnnaBridge 171:3a7713b1edbc 386 * a specific interrupts enable status, compare the return value with enumerators
AnnaBridge 171:3a7713b1edbc 387 * in @ref _uart_interrupt_enable.
AnnaBridge 171:3a7713b1edbc 388 * For example, to check whether TX empty interrupt is enabled, do the following.
AnnaBridge 171:3a7713b1edbc 389 * @code
AnnaBridge 171:3a7713b1edbc 390 * uint32_t enabledInterrupts = UART_GetEnabledInterrupts(UART1);
AnnaBridge 171:3a7713b1edbc 391 *
AnnaBridge 171:3a7713b1edbc 392 * if (kUART_TxDataRegEmptyInterruptEnable & enabledInterrupts)
AnnaBridge 171:3a7713b1edbc 393 * {
AnnaBridge 171:3a7713b1edbc 394 * ...
AnnaBridge 171:3a7713b1edbc 395 * }
AnnaBridge 171:3a7713b1edbc 396 * @endcode
AnnaBridge 171:3a7713b1edbc 397 *
AnnaBridge 171:3a7713b1edbc 398 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 399 * @return UART interrupt flags which are logical OR of the enumerators in @ref _uart_interrupt_enable.
AnnaBridge 171:3a7713b1edbc 400 */
AnnaBridge 171:3a7713b1edbc 401 uint32_t UART_GetEnabledInterrupts(UART_Type *base);
AnnaBridge 171:3a7713b1edbc 402
AnnaBridge 171:3a7713b1edbc 403 /* @} */
AnnaBridge 171:3a7713b1edbc 404
AnnaBridge 171:3a7713b1edbc 405 #if defined(FSL_FEATURE_UART_HAS_DMA_SELECT) && FSL_FEATURE_UART_HAS_DMA_SELECT
AnnaBridge 171:3a7713b1edbc 406 /*!
AnnaBridge 171:3a7713b1edbc 407 * @name DMA Control
AnnaBridge 171:3a7713b1edbc 408 * @{
AnnaBridge 171:3a7713b1edbc 409 */
AnnaBridge 171:3a7713b1edbc 410
AnnaBridge 171:3a7713b1edbc 411 /*!
AnnaBridge 171:3a7713b1edbc 412 * @brief Gets the UART data register address.
AnnaBridge 171:3a7713b1edbc 413 *
AnnaBridge 171:3a7713b1edbc 414 * This function returns the UART data register address, which is mainly used by DMA/eDMA.
AnnaBridge 171:3a7713b1edbc 415 *
AnnaBridge 171:3a7713b1edbc 416 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 417 * @return UART data register addresses which are used both by the transmitter and the receiver.
AnnaBridge 171:3a7713b1edbc 418 */
AnnaBridge 171:3a7713b1edbc 419 static inline uint32_t UART_GetDataRegisterAddress(UART_Type *base)
AnnaBridge 171:3a7713b1edbc 420 {
AnnaBridge 171:3a7713b1edbc 421 return (uint32_t) & (base->D);
AnnaBridge 171:3a7713b1edbc 422 }
AnnaBridge 171:3a7713b1edbc 423
AnnaBridge 171:3a7713b1edbc 424 /*!
AnnaBridge 171:3a7713b1edbc 425 * @brief Enables or disables the UART transmitter DMA request.
AnnaBridge 171:3a7713b1edbc 426 *
AnnaBridge 171:3a7713b1edbc 427 * This function enables or disables the transmit data register empty flag, S1[TDRE], to generate the DMA requests.
AnnaBridge 171:3a7713b1edbc 428 *
AnnaBridge 171:3a7713b1edbc 429 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 430 * @param enable True to enable, false to disable.
AnnaBridge 171:3a7713b1edbc 431 */
AnnaBridge 171:3a7713b1edbc 432 static inline void UART_EnableTxDMA(UART_Type *base, bool enable)
AnnaBridge 171:3a7713b1edbc 433 {
AnnaBridge 171:3a7713b1edbc 434 if (enable)
AnnaBridge 171:3a7713b1edbc 435 {
AnnaBridge 171:3a7713b1edbc 436 #if (defined(FSL_FEATURE_UART_IS_SCI) && FSL_FEATURE_UART_IS_SCI)
AnnaBridge 171:3a7713b1edbc 437 base->C4 |= UART_C4_TDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 438 #else
AnnaBridge 171:3a7713b1edbc 439 base->C5 |= UART_C5_TDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 440 #endif
AnnaBridge 171:3a7713b1edbc 441 base->C2 |= UART_C2_TIE_MASK;
AnnaBridge 171:3a7713b1edbc 442 }
AnnaBridge 171:3a7713b1edbc 443 else
AnnaBridge 171:3a7713b1edbc 444 {
AnnaBridge 171:3a7713b1edbc 445 #if (defined(FSL_FEATURE_UART_IS_SCI) && FSL_FEATURE_UART_IS_SCI)
AnnaBridge 171:3a7713b1edbc 446 base->C4 &= ~UART_C4_TDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 447 #else
AnnaBridge 171:3a7713b1edbc 448 base->C5 &= ~UART_C5_TDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 449 #endif
AnnaBridge 171:3a7713b1edbc 450 base->C2 &= ~UART_C2_TIE_MASK;
AnnaBridge 171:3a7713b1edbc 451 }
AnnaBridge 171:3a7713b1edbc 452 }
AnnaBridge 171:3a7713b1edbc 453
AnnaBridge 171:3a7713b1edbc 454 /*!
AnnaBridge 171:3a7713b1edbc 455 * @brief Enables or disables the UART receiver DMA.
AnnaBridge 171:3a7713b1edbc 456 *
AnnaBridge 171:3a7713b1edbc 457 * This function enables or disables the receiver data register full flag, S1[RDRF], to generate DMA requests.
AnnaBridge 171:3a7713b1edbc 458 *
AnnaBridge 171:3a7713b1edbc 459 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 460 * @param enable True to enable, false to disable.
AnnaBridge 171:3a7713b1edbc 461 */
AnnaBridge 171:3a7713b1edbc 462 static inline void UART_EnableRxDMA(UART_Type *base, bool enable)
AnnaBridge 171:3a7713b1edbc 463 {
AnnaBridge 171:3a7713b1edbc 464 if (enable)
AnnaBridge 171:3a7713b1edbc 465 {
AnnaBridge 171:3a7713b1edbc 466 #if (defined(FSL_FEATURE_UART_IS_SCI) && FSL_FEATURE_UART_IS_SCI)
AnnaBridge 171:3a7713b1edbc 467 base->C4 |= UART_C4_RDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 468 #else
AnnaBridge 171:3a7713b1edbc 469 base->C5 |= UART_C5_RDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 470 #endif
AnnaBridge 171:3a7713b1edbc 471 base->C2 |= UART_C2_RIE_MASK;
AnnaBridge 171:3a7713b1edbc 472 }
AnnaBridge 171:3a7713b1edbc 473 else
AnnaBridge 171:3a7713b1edbc 474 {
AnnaBridge 171:3a7713b1edbc 475 #if (defined(FSL_FEATURE_UART_IS_SCI) && FSL_FEATURE_UART_IS_SCI)
AnnaBridge 171:3a7713b1edbc 476 base->C4 &= ~UART_C4_RDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 477 #else
AnnaBridge 171:3a7713b1edbc 478 base->C5 &= ~UART_C5_RDMAS_MASK;
AnnaBridge 171:3a7713b1edbc 479 #endif
AnnaBridge 171:3a7713b1edbc 480 base->C2 &= ~UART_C2_RIE_MASK;
AnnaBridge 171:3a7713b1edbc 481 }
AnnaBridge 171:3a7713b1edbc 482 }
AnnaBridge 171:3a7713b1edbc 483
AnnaBridge 171:3a7713b1edbc 484 /* @} */
AnnaBridge 171:3a7713b1edbc 485 #endif /* FSL_FEATURE_UART_HAS_DMA_SELECT */
AnnaBridge 171:3a7713b1edbc 486
AnnaBridge 171:3a7713b1edbc 487 /*!
AnnaBridge 171:3a7713b1edbc 488 * @name Bus Operations
AnnaBridge 171:3a7713b1edbc 489 * @{
AnnaBridge 171:3a7713b1edbc 490 */
AnnaBridge 171:3a7713b1edbc 491
AnnaBridge 171:3a7713b1edbc 492 /*!
AnnaBridge 171:3a7713b1edbc 493 * @brief Enables or disables the UART transmitter.
AnnaBridge 171:3a7713b1edbc 494 *
AnnaBridge 171:3a7713b1edbc 495 * This function enables or disables the UART transmitter.
AnnaBridge 171:3a7713b1edbc 496 *
AnnaBridge 171:3a7713b1edbc 497 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 498 * @param enable True to enable, false to disable.
AnnaBridge 171:3a7713b1edbc 499 */
AnnaBridge 171:3a7713b1edbc 500 static inline void UART_EnableTx(UART_Type *base, bool enable)
AnnaBridge 171:3a7713b1edbc 501 {
AnnaBridge 171:3a7713b1edbc 502 if (enable)
AnnaBridge 171:3a7713b1edbc 503 {
AnnaBridge 171:3a7713b1edbc 504 base->C2 |= UART_C2_TE_MASK;
AnnaBridge 171:3a7713b1edbc 505 }
AnnaBridge 171:3a7713b1edbc 506 else
AnnaBridge 171:3a7713b1edbc 507 {
AnnaBridge 171:3a7713b1edbc 508 base->C2 &= ~UART_C2_TE_MASK;
AnnaBridge 171:3a7713b1edbc 509 }
AnnaBridge 171:3a7713b1edbc 510 }
AnnaBridge 171:3a7713b1edbc 511
AnnaBridge 171:3a7713b1edbc 512 /*!
AnnaBridge 171:3a7713b1edbc 513 * @brief Enables or disables the UART receiver.
AnnaBridge 171:3a7713b1edbc 514 *
AnnaBridge 171:3a7713b1edbc 515 * This function enables or disables the UART receiver.
AnnaBridge 171:3a7713b1edbc 516 *
AnnaBridge 171:3a7713b1edbc 517 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 518 * @param enable True to enable, false to disable.
AnnaBridge 171:3a7713b1edbc 519 */
AnnaBridge 171:3a7713b1edbc 520 static inline void UART_EnableRx(UART_Type *base, bool enable)
AnnaBridge 171:3a7713b1edbc 521 {
AnnaBridge 171:3a7713b1edbc 522 if (enable)
AnnaBridge 171:3a7713b1edbc 523 {
AnnaBridge 171:3a7713b1edbc 524 base->C2 |= UART_C2_RE_MASK;
AnnaBridge 171:3a7713b1edbc 525 }
AnnaBridge 171:3a7713b1edbc 526 else
AnnaBridge 171:3a7713b1edbc 527 {
AnnaBridge 171:3a7713b1edbc 528 base->C2 &= ~UART_C2_RE_MASK;
AnnaBridge 171:3a7713b1edbc 529 }
AnnaBridge 171:3a7713b1edbc 530 }
AnnaBridge 171:3a7713b1edbc 531
AnnaBridge 171:3a7713b1edbc 532 /*!
AnnaBridge 171:3a7713b1edbc 533 * @brief Writes to the TX register.
AnnaBridge 171:3a7713b1edbc 534 *
AnnaBridge 171:3a7713b1edbc 535 * This function writes data to the TX register directly. The upper layer must ensure
AnnaBridge 171:3a7713b1edbc 536 * that the TX register is empty or TX FIFO has empty room before calling this function.
AnnaBridge 171:3a7713b1edbc 537 *
AnnaBridge 171:3a7713b1edbc 538 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 539 * @param data The byte to write.
AnnaBridge 171:3a7713b1edbc 540 */
AnnaBridge 171:3a7713b1edbc 541 static inline void UART_WriteByte(UART_Type *base, uint8_t data)
AnnaBridge 171:3a7713b1edbc 542 {
AnnaBridge 171:3a7713b1edbc 543 base->D = data;
AnnaBridge 171:3a7713b1edbc 544 }
AnnaBridge 171:3a7713b1edbc 545
AnnaBridge 171:3a7713b1edbc 546 /*!
AnnaBridge 171:3a7713b1edbc 547 * @brief Reads the RX register directly.
AnnaBridge 171:3a7713b1edbc 548 *
AnnaBridge 171:3a7713b1edbc 549 * This function reads data from the RX register directly. The upper layer must
AnnaBridge 171:3a7713b1edbc 550 * ensure that the RX register is full or that the TX FIFO has data before calling this function.
AnnaBridge 171:3a7713b1edbc 551 *
AnnaBridge 171:3a7713b1edbc 552 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 553 * @return The byte read from UART data register.
AnnaBridge 171:3a7713b1edbc 554 */
AnnaBridge 171:3a7713b1edbc 555 static inline uint8_t UART_ReadByte(UART_Type *base)
AnnaBridge 171:3a7713b1edbc 556 {
AnnaBridge 171:3a7713b1edbc 557 return base->D;
AnnaBridge 171:3a7713b1edbc 558 }
AnnaBridge 171:3a7713b1edbc 559
AnnaBridge 171:3a7713b1edbc 560 /*!
AnnaBridge 171:3a7713b1edbc 561 * @brief Writes to the TX register using a blocking method.
AnnaBridge 171:3a7713b1edbc 562 *
AnnaBridge 171:3a7713b1edbc 563 * This function polls the TX register, waits for the TX register to be empty or for the TX FIFO
AnnaBridge 171:3a7713b1edbc 564 * to have room and writes data to the TX buffer.
AnnaBridge 171:3a7713b1edbc 565 *
AnnaBridge 171:3a7713b1edbc 566 * @note This function does not check whether all data is sent out to the bus.
AnnaBridge 171:3a7713b1edbc 567 * Before disabling the TX, check kUART_TransmissionCompleteFlag to ensure that the TX is
AnnaBridge 171:3a7713b1edbc 568 * finished.
AnnaBridge 171:3a7713b1edbc 569 *
AnnaBridge 171:3a7713b1edbc 570 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 571 * @param data Start address of the data to write.
AnnaBridge 171:3a7713b1edbc 572 * @param length Size of the data to write.
AnnaBridge 171:3a7713b1edbc 573 */
AnnaBridge 171:3a7713b1edbc 574 void UART_WriteBlocking(UART_Type *base, const uint8_t *data, size_t length);
AnnaBridge 171:3a7713b1edbc 575
AnnaBridge 171:3a7713b1edbc 576 /*!
AnnaBridge 171:3a7713b1edbc 577 * @brief Read RX data register using a blocking method.
AnnaBridge 171:3a7713b1edbc 578 *
AnnaBridge 171:3a7713b1edbc 579 * This function polls the RX register, waits for the RX register to be full or for RX FIFO to
AnnaBridge 171:3a7713b1edbc 580 * have data, and reads data from the TX register.
AnnaBridge 171:3a7713b1edbc 581 *
AnnaBridge 171:3a7713b1edbc 582 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 583 * @param data Start address of the buffer to store the received data.
AnnaBridge 171:3a7713b1edbc 584 * @param length Size of the buffer.
AnnaBridge 171:3a7713b1edbc 585 * @retval kStatus_UART_RxHardwareOverrun Receiver overrun occurred while receiving data.
AnnaBridge 171:3a7713b1edbc 586 * @retval kStatus_UART_NoiseError A noise error occurred while receiving data.
AnnaBridge 171:3a7713b1edbc 587 * @retval kStatus_UART_FramingError A framing error occurred while receiving data.
AnnaBridge 171:3a7713b1edbc 588 * @retval kStatus_UART_ParityError A parity error occurred while receiving data.
AnnaBridge 171:3a7713b1edbc 589 * @retval kStatus_Success Successfully received all data.
AnnaBridge 171:3a7713b1edbc 590 */
AnnaBridge 171:3a7713b1edbc 591 status_t UART_ReadBlocking(UART_Type *base, uint8_t *data, size_t length);
AnnaBridge 171:3a7713b1edbc 592
AnnaBridge 171:3a7713b1edbc 593 /* @} */
AnnaBridge 171:3a7713b1edbc 594
AnnaBridge 171:3a7713b1edbc 595 /*!
AnnaBridge 171:3a7713b1edbc 596 * @name Transactional
AnnaBridge 171:3a7713b1edbc 597 * @{
AnnaBridge 171:3a7713b1edbc 598 */
AnnaBridge 171:3a7713b1edbc 599
AnnaBridge 171:3a7713b1edbc 600 /*!
AnnaBridge 171:3a7713b1edbc 601 * @brief Initializes the UART handle.
AnnaBridge 171:3a7713b1edbc 602 *
AnnaBridge 171:3a7713b1edbc 603 * This function initializes the UART handle which can be used for other UART
AnnaBridge 171:3a7713b1edbc 604 * transactional APIs. Usually, for a specified UART instance,
AnnaBridge 171:3a7713b1edbc 605 * call this API once to get the initialized handle.
AnnaBridge 171:3a7713b1edbc 606 *
AnnaBridge 171:3a7713b1edbc 607 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 608 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 609 * @param callback The callback function.
AnnaBridge 171:3a7713b1edbc 610 * @param userData The parameter of the callback function.
AnnaBridge 171:3a7713b1edbc 611 */
AnnaBridge 171:3a7713b1edbc 612 void UART_TransferCreateHandle(UART_Type *base,
AnnaBridge 171:3a7713b1edbc 613 uart_handle_t *handle,
AnnaBridge 171:3a7713b1edbc 614 uart_transfer_callback_t callback,
AnnaBridge 171:3a7713b1edbc 615 void *userData);
AnnaBridge 171:3a7713b1edbc 616
AnnaBridge 171:3a7713b1edbc 617 /*!
AnnaBridge 171:3a7713b1edbc 618 * @brief Sets up the RX ring buffer.
AnnaBridge 171:3a7713b1edbc 619 *
AnnaBridge 171:3a7713b1edbc 620 * This function sets up the RX ring buffer to a specific UART handle.
AnnaBridge 171:3a7713b1edbc 621 *
AnnaBridge 171:3a7713b1edbc 622 * When the RX ring buffer is used, data received are stored into the ring buffer even when the
AnnaBridge 171:3a7713b1edbc 623 * user doesn't call the UART_TransferReceiveNonBlocking() API. If data is already received
AnnaBridge 171:3a7713b1edbc 624 * in the ring buffer, the user can get the received data from the ring buffer directly.
AnnaBridge 171:3a7713b1edbc 625 *
AnnaBridge 171:3a7713b1edbc 626 * @note When using the RX ring buffer, one byte is reserved for internal use. In other
AnnaBridge 171:3a7713b1edbc 627 * words, if @p ringBufferSize is 32, only 31 bytes are used for saving data.
AnnaBridge 171:3a7713b1edbc 628 *
AnnaBridge 171:3a7713b1edbc 629 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 630 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 631 * @param ringBuffer Start address of the ring buffer for background receiving. Pass NULL to disable the ring buffer.
AnnaBridge 171:3a7713b1edbc 632 * @param ringBufferSize Size of the ring buffer.
AnnaBridge 171:3a7713b1edbc 633 */
AnnaBridge 171:3a7713b1edbc 634 void UART_TransferStartRingBuffer(UART_Type *base, uart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize);
AnnaBridge 171:3a7713b1edbc 635
AnnaBridge 171:3a7713b1edbc 636 /*!
AnnaBridge 171:3a7713b1edbc 637 * @brief Aborts the background transfer and uninstalls the ring buffer.
AnnaBridge 171:3a7713b1edbc 638 *
AnnaBridge 171:3a7713b1edbc 639 * This function aborts the background transfer and uninstalls the ring buffer.
AnnaBridge 171:3a7713b1edbc 640 *
AnnaBridge 171:3a7713b1edbc 641 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 642 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 643 */
AnnaBridge 171:3a7713b1edbc 644 void UART_TransferStopRingBuffer(UART_Type *base, uart_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 645
AnnaBridge 171:3a7713b1edbc 646 /*!
AnnaBridge 171:3a7713b1edbc 647 * @brief Transmits a buffer of data using the interrupt method.
AnnaBridge 171:3a7713b1edbc 648 *
AnnaBridge 171:3a7713b1edbc 649 * This function sends data using an interrupt method. This is a non-blocking function, which
AnnaBridge 171:3a7713b1edbc 650 * returns directly without waiting for all data to be written to the TX register. When
AnnaBridge 171:3a7713b1edbc 651 * all data is written to the TX register in the ISR, the UART driver calls the callback
AnnaBridge 171:3a7713b1edbc 652 * function and passes the @ref kStatus_UART_TxIdle as status parameter.
AnnaBridge 171:3a7713b1edbc 653 *
AnnaBridge 171:3a7713b1edbc 654 * @note The kStatus_UART_TxIdle is passed to the upper layer when all data is written
AnnaBridge 171:3a7713b1edbc 655 * to the TX register. However, it does not ensure that all data is sent out. Before disabling the TX,
AnnaBridge 171:3a7713b1edbc 656 * check the kUART_TransmissionCompleteFlag to ensure that the TX is finished.
AnnaBridge 171:3a7713b1edbc 657 *
AnnaBridge 171:3a7713b1edbc 658 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 659 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 660 * @param xfer UART transfer structure. See #uart_transfer_t.
AnnaBridge 171:3a7713b1edbc 661 * @retval kStatus_Success Successfully start the data transmission.
AnnaBridge 171:3a7713b1edbc 662 * @retval kStatus_UART_TxBusy Previous transmission still not finished; data not all written to TX register yet.
AnnaBridge 171:3a7713b1edbc 663 * @retval kStatus_InvalidArgument Invalid argument.
AnnaBridge 171:3a7713b1edbc 664 */
AnnaBridge 171:3a7713b1edbc 665 status_t UART_TransferSendNonBlocking(UART_Type *base, uart_handle_t *handle, uart_transfer_t *xfer);
AnnaBridge 171:3a7713b1edbc 666
AnnaBridge 171:3a7713b1edbc 667 /*!
AnnaBridge 171:3a7713b1edbc 668 * @brief Aborts the interrupt-driven data transmit.
AnnaBridge 171:3a7713b1edbc 669 *
AnnaBridge 171:3a7713b1edbc 670 * This function aborts the interrupt-driven data sending. The user can get the remainBytes to find out
AnnaBridge 171:3a7713b1edbc 671 * how many bytes are not sent out.
AnnaBridge 171:3a7713b1edbc 672 *
AnnaBridge 171:3a7713b1edbc 673 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 674 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 675 */
AnnaBridge 171:3a7713b1edbc 676 void UART_TransferAbortSend(UART_Type *base, uart_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 677
AnnaBridge 171:3a7713b1edbc 678 /*!
AnnaBridge 171:3a7713b1edbc 679 * @brief Gets the number of bytes written to the UART TX register.
AnnaBridge 171:3a7713b1edbc 680 *
AnnaBridge 171:3a7713b1edbc 681 * This function gets the number of bytes written to the UART TX
AnnaBridge 171:3a7713b1edbc 682 * register by using the interrupt method.
AnnaBridge 171:3a7713b1edbc 683 *
AnnaBridge 171:3a7713b1edbc 684 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 685 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 686 * @param count Send bytes count.
AnnaBridge 171:3a7713b1edbc 687 * @retval kStatus_NoTransferInProgress No send in progress.
AnnaBridge 171:3a7713b1edbc 688 * @retval kStatus_InvalidArgument The parameter is invalid.
AnnaBridge 171:3a7713b1edbc 689 * @retval kStatus_Success Get successfully through the parameter \p count;
AnnaBridge 171:3a7713b1edbc 690 */
AnnaBridge 171:3a7713b1edbc 691 status_t UART_TransferGetSendCount(UART_Type *base, uart_handle_t *handle, uint32_t *count);
AnnaBridge 171:3a7713b1edbc 692
AnnaBridge 171:3a7713b1edbc 693 /*!
AnnaBridge 171:3a7713b1edbc 694 * @brief Receives a buffer of data using an interrupt method.
AnnaBridge 171:3a7713b1edbc 695 *
AnnaBridge 171:3a7713b1edbc 696 * This function receives data using an interrupt method. This is a non-blocking function, which
AnnaBridge 171:3a7713b1edbc 697 * returns without waiting for all data to be received.
AnnaBridge 171:3a7713b1edbc 698 * If the RX ring buffer is used and not empty, the data in the ring buffer is copied and
AnnaBridge 171:3a7713b1edbc 699 * the parameter @p receivedBytes shows how many bytes are copied from the ring buffer.
AnnaBridge 171:3a7713b1edbc 700 * After copying, if the data in the ring buffer is not enough to read, the receive
AnnaBridge 171:3a7713b1edbc 701 * request is saved by the UART driver. When the new data arrives, the receive request
AnnaBridge 171:3a7713b1edbc 702 * is serviced first. When all data is received, the UART driver notifies the upper layer
AnnaBridge 171:3a7713b1edbc 703 * through a callback function and passes the status parameter @ref kStatus_UART_RxIdle.
AnnaBridge 171:3a7713b1edbc 704 * For example, the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer.
AnnaBridge 171:3a7713b1edbc 705 * The 5 bytes are copied to the xfer->data and this function returns with the
AnnaBridge 171:3a7713b1edbc 706 * parameter @p receivedBytes set to 5. For the left 5 bytes, newly arrived data is
AnnaBridge 171:3a7713b1edbc 707 * saved from the xfer->data[5]. When 5 bytes are received, the UART driver notifies the upper layer.
AnnaBridge 171:3a7713b1edbc 708 * If the RX ring buffer is not enabled, this function enables the RX and RX interrupt
AnnaBridge 171:3a7713b1edbc 709 * to receive data to the xfer->data. When all data is received, the upper layer is notified.
AnnaBridge 171:3a7713b1edbc 710 *
AnnaBridge 171:3a7713b1edbc 711 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 712 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 713 * @param xfer UART transfer structure, see #uart_transfer_t.
AnnaBridge 171:3a7713b1edbc 714 * @param receivedBytes Bytes received from the ring buffer directly.
AnnaBridge 171:3a7713b1edbc 715 * @retval kStatus_Success Successfully queue the transfer into transmit queue.
AnnaBridge 171:3a7713b1edbc 716 * @retval kStatus_UART_RxBusy Previous receive request is not finished.
AnnaBridge 171:3a7713b1edbc 717 * @retval kStatus_InvalidArgument Invalid argument.
AnnaBridge 171:3a7713b1edbc 718 */
AnnaBridge 171:3a7713b1edbc 719 status_t UART_TransferReceiveNonBlocking(UART_Type *base,
AnnaBridge 171:3a7713b1edbc 720 uart_handle_t *handle,
AnnaBridge 171:3a7713b1edbc 721 uart_transfer_t *xfer,
AnnaBridge 171:3a7713b1edbc 722 size_t *receivedBytes);
AnnaBridge 171:3a7713b1edbc 723
AnnaBridge 171:3a7713b1edbc 724 /*!
AnnaBridge 171:3a7713b1edbc 725 * @brief Aborts the interrupt-driven data receiving.
AnnaBridge 171:3a7713b1edbc 726 *
AnnaBridge 171:3a7713b1edbc 727 * This function aborts the interrupt-driven data receiving. The user can get the remainBytes to know
AnnaBridge 171:3a7713b1edbc 728 * how many bytes are not received yet.
AnnaBridge 171:3a7713b1edbc 729 *
AnnaBridge 171:3a7713b1edbc 730 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 731 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 732 */
AnnaBridge 171:3a7713b1edbc 733 void UART_TransferAbortReceive(UART_Type *base, uart_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 734
AnnaBridge 171:3a7713b1edbc 735 /*!
AnnaBridge 171:3a7713b1edbc 736 * @brief Gets the number of bytes that have been received.
AnnaBridge 171:3a7713b1edbc 737 *
AnnaBridge 171:3a7713b1edbc 738 * This function gets the number of bytes that have been received.
AnnaBridge 171:3a7713b1edbc 739 *
AnnaBridge 171:3a7713b1edbc 740 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 741 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 742 * @param count Receive bytes count.
AnnaBridge 171:3a7713b1edbc 743 * @retval kStatus_NoTransferInProgress No receive in progress.
AnnaBridge 171:3a7713b1edbc 744 * @retval kStatus_InvalidArgument Parameter is invalid.
AnnaBridge 171:3a7713b1edbc 745 * @retval kStatus_Success Get successfully through the parameter \p count;
AnnaBridge 171:3a7713b1edbc 746 */
AnnaBridge 171:3a7713b1edbc 747 status_t UART_TransferGetReceiveCount(UART_Type *base, uart_handle_t *handle, uint32_t *count);
AnnaBridge 171:3a7713b1edbc 748
AnnaBridge 171:3a7713b1edbc 749 /*!
AnnaBridge 171:3a7713b1edbc 750 * @brief UART IRQ handle function.
AnnaBridge 171:3a7713b1edbc 751 *
AnnaBridge 171:3a7713b1edbc 752 * This function handles the UART transmit and receive IRQ request.
AnnaBridge 171:3a7713b1edbc 753 *
AnnaBridge 171:3a7713b1edbc 754 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 755 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 756 */
AnnaBridge 171:3a7713b1edbc 757 void UART_TransferHandleIRQ(UART_Type *base, uart_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 758
AnnaBridge 171:3a7713b1edbc 759 /*!
AnnaBridge 171:3a7713b1edbc 760 * @brief UART Error IRQ handle function.
AnnaBridge 171:3a7713b1edbc 761 *
AnnaBridge 171:3a7713b1edbc 762 * This function handles the UART error IRQ request.
AnnaBridge 171:3a7713b1edbc 763 *
AnnaBridge 171:3a7713b1edbc 764 * @param base UART peripheral base address.
AnnaBridge 171:3a7713b1edbc 765 * @param handle UART handle pointer.
AnnaBridge 171:3a7713b1edbc 766 */
AnnaBridge 171:3a7713b1edbc 767 void UART_TransferHandleErrorIRQ(UART_Type *base, uart_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 768
AnnaBridge 171:3a7713b1edbc 769 /* @} */
AnnaBridge 171:3a7713b1edbc 770
AnnaBridge 171:3a7713b1edbc 771 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 772 }
AnnaBridge 171:3a7713b1edbc 773 #endif
AnnaBridge 171:3a7713b1edbc 774
AnnaBridge 171:3a7713b1edbc 775 /*! @}*/
AnnaBridge 171:3a7713b1edbc 776
AnnaBridge 171:3a7713b1edbc 777 #endif /* _FSL_UART_H_ */