meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Child:
90:cb3d968589d8
Release 82 of the mbed library

Main changes:

- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /*
bogdanm 82:6473597d706e 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
bogdanm 82:6473597d706e 3 * All rights reserved.
bogdanm 82:6473597d706e 4 *
bogdanm 82:6473597d706e 5 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 82:6473597d706e 6 * are permitted provided that the following conditions are met:
bogdanm 82:6473597d706e 7 *
bogdanm 82:6473597d706e 8 * o Redistributions of source code must retain the above copyright notice, this list
bogdanm 82:6473597d706e 9 * of conditions and the following disclaimer.
bogdanm 82:6473597d706e 10 *
bogdanm 82:6473597d706e 11 * o Redistributions in binary form must reproduce the above copyright notice, this
bogdanm 82:6473597d706e 12 * list of conditions and the following disclaimer in the documentation and/or
bogdanm 82:6473597d706e 13 * other materials provided with the distribution.
bogdanm 82:6473597d706e 14 *
bogdanm 82:6473597d706e 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
bogdanm 82:6473597d706e 16 * contributors may be used to endorse or promote products derived from this
bogdanm 82:6473597d706e 17 * software without specific prior written permission.
bogdanm 82:6473597d706e 18 *
bogdanm 82:6473597d706e 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
bogdanm 82:6473597d706e 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
bogdanm 82:6473597d706e 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 82:6473597d706e 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
bogdanm 82:6473597d706e 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
bogdanm 82:6473597d706e 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
bogdanm 82:6473597d706e 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
bogdanm 82:6473597d706e 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
bogdanm 82:6473597d706e 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
bogdanm 82:6473597d706e 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 82:6473597d706e 29 */
bogdanm 82:6473597d706e 30 #ifndef __FSL_UART_HAL_H__
bogdanm 82:6473597d706e 31 #define __FSL_UART_HAL_H__
bogdanm 82:6473597d706e 32
bogdanm 82:6473597d706e 33 #include <assert.h>
bogdanm 82:6473597d706e 34 #include <stdint.h>
bogdanm 82:6473597d706e 35 #include <stdbool.h>
bogdanm 82:6473597d706e 36 #include "fsl_uart_features.h"
bogdanm 82:6473597d706e 37 #include "fsl_device_registers.h"
bogdanm 82:6473597d706e 38
bogdanm 82:6473597d706e 39 /*!
bogdanm 82:6473597d706e 40 * @addtogroup uart_hal
bogdanm 82:6473597d706e 41 * @{
bogdanm 82:6473597d706e 42 */
bogdanm 82:6473597d706e 43
bogdanm 82:6473597d706e 44 /*! @file*/
bogdanm 82:6473597d706e 45
bogdanm 82:6473597d706e 46 /*******************************************************************************
bogdanm 82:6473597d706e 47 * Definitions
bogdanm 82:6473597d706e 48 ******************************************************************************/
bogdanm 82:6473597d706e 49
bogdanm 82:6473597d706e 50 /*! @brief Error codes for the UART driver. */
bogdanm 82:6473597d706e 51 typedef enum _uart_status
bogdanm 82:6473597d706e 52 {
bogdanm 82:6473597d706e 53 kStatus_UART_Success = 0,
bogdanm 82:6473597d706e 54 kStatus_UART_BaudRateCalculationError,/*!< UART Baud Rate calculation error out of range */
bogdanm 82:6473597d706e 55 kStatus_UART_BaudRatePercentDiffExceeded, /*!< UART Baud Rate exceeds percentage difference */
bogdanm 82:6473597d706e 56 kStatus_UART_BitCountNotSupported, /*!< UART bit count config not supported */
bogdanm 82:6473597d706e 57 kStatus_UART_StopBitCountNotSupported, /*!< UART stop bit count config not supported */
bogdanm 82:6473597d706e 58 kStatus_UART_RxStandbyModeError, /*!< UART unable to place receiver in standby mode */
bogdanm 82:6473597d706e 59 kStatus_UART_ClearStatusFlagError, /*!< UART clear status flag error */
bogdanm 82:6473597d706e 60 kStatus_UART_MSBFirstNotSupported, /*!< UART MSB first feature not supported */
bogdanm 82:6473597d706e 61 kStatus_UART_ResyncNotSupported, /*!< UART resync disable operation not supported */
bogdanm 82:6473597d706e 62 kStatus_UART_TxNotDisabled, /*!< UART Transmitter not disabled before enabling feature */
bogdanm 82:6473597d706e 63 kStatus_UART_RxNotDisabled, /*!< UART Receiver not disabled before enabling feature */
bogdanm 82:6473597d706e 64 kStatus_UART_TxOrRxNotDisabled, /*!< UART Transmitter or Receiver not disabled */
bogdanm 82:6473597d706e 65 kStatus_UART_TxBusy, /*!< UART transmit still in progress */
bogdanm 82:6473597d706e 66 kStatus_UART_RxBusy, /*!< UART receive still in progress */
bogdanm 82:6473597d706e 67 kStatus_UART_NoTransmitInProgress, /*!< UART no transmit in progress */
bogdanm 82:6473597d706e 68 kStatus_UART_NoReceiveInProgress, /*!< UART no receive in progress */
bogdanm 82:6473597d706e 69 kStatus_UART_InvalidInstanceNumber, /*!< Invalid UART instance number */
bogdanm 82:6473597d706e 70 kStatus_UART_InvalidBitSetting, /*!< Invalid setting for desired UART register bit field */
bogdanm 82:6473597d706e 71 kStatus_UART_OverSamplingNotSupported, /*!< UART oversampling not supported */
bogdanm 82:6473597d706e 72 kStatus_UART_BothEdgeNotSupported, /*!< UART both edge sampling not supported */
bogdanm 82:6473597d706e 73 kStatus_UART_Timeout, /*!< UART transfer timed out*/
bogdanm 82:6473597d706e 74 } uart_status_t;
bogdanm 82:6473597d706e 75
bogdanm 82:6473597d706e 76 /*!
bogdanm 82:6473597d706e 77 * @brief UART number of stop bits.
bogdanm 82:6473597d706e 78 *
bogdanm 82:6473597d706e 79 * These constants define the number of allowable stop bits to configure in a UART instance.
bogdanm 82:6473597d706e 80 */
bogdanm 82:6473597d706e 81 typedef enum _uart_stop_bit_count {
bogdanm 82:6473597d706e 82 kUartOneStopBit = 0, /*!< one stop bit */
bogdanm 82:6473597d706e 83 kUartTwoStopBit = 1, /*!< two stop bits */
bogdanm 82:6473597d706e 84 } uart_stop_bit_count_t;
bogdanm 82:6473597d706e 85
bogdanm 82:6473597d706e 86 /*!
bogdanm 82:6473597d706e 87 * @brief UART parity mode.
bogdanm 82:6473597d706e 88 *
bogdanm 82:6473597d706e 89 * These constants define the UART parity mode options: disabled or enabled of type even or odd.
bogdanm 82:6473597d706e 90 */
bogdanm 82:6473597d706e 91 typedef enum _uart_parity_mode {
bogdanm 82:6473597d706e 92 kUartParityDisabled = 0x0, /*!< parity disabled */
bogdanm 82:6473597d706e 93 kUartParityEven = 0x2, /*!< parity enabled, type even, bit setting: PE|PT = 10 */
bogdanm 82:6473597d706e 94 kUartParityOdd = 0x3, /*!< parity enabled, type odd, bit setting: PE|PT = 11 */
bogdanm 82:6473597d706e 95 } uart_parity_mode_t;
bogdanm 82:6473597d706e 96
bogdanm 82:6473597d706e 97 /*!
bogdanm 82:6473597d706e 98 * @brief UART number of bits in a character.
bogdanm 82:6473597d706e 99 *
bogdanm 82:6473597d706e 100 * These constants define the number of allowable data bits per UART character. Note, check the
bogdanm 82:6473597d706e 101 * UART documentation to determine if the desired UART instance supports the desired number
bogdanm 82:6473597d706e 102 * of data bits per UART character.
bogdanm 82:6473597d706e 103 */
bogdanm 82:6473597d706e 104 typedef enum _uart_bit_count_per_char {
bogdanm 82:6473597d706e 105 kUart8BitsPerChar = 0, /*!< 8-bit data characters */
bogdanm 82:6473597d706e 106 kUart9BitsPerChar = 1, /*!< 9-bit data characters */
bogdanm 82:6473597d706e 107 kUart10BitsPerChar = 2, /*!< 10-bit data characters */
bogdanm 82:6473597d706e 108 } uart_bit_count_per_char_t;
bogdanm 82:6473597d706e 109
bogdanm 82:6473597d706e 110 /*!
bogdanm 82:6473597d706e 111 * @brief UART operation configuration constants.
bogdanm 82:6473597d706e 112 *
bogdanm 82:6473597d706e 113 * This provides constants for UART operational states: "operates normally"
bogdanm 82:6473597d706e 114 * or "stops/ceases operation"
bogdanm 82:6473597d706e 115 */
bogdanm 82:6473597d706e 116 typedef enum _uart_operation_config {
bogdanm 82:6473597d706e 117 kUartOperates = 0, /*!< UART continues to operate normally */
bogdanm 82:6473597d706e 118 kUartStops = 1, /*!< UART ceases operation */
bogdanm 82:6473597d706e 119 } uart_operation_config_t;
bogdanm 82:6473597d706e 120
bogdanm 82:6473597d706e 121 /*!
bogdanm 82:6473597d706e 122 * @brief UART wakeup from standby method constants.
bogdanm 82:6473597d706e 123 *
bogdanm 82:6473597d706e 124 * This provides constants for the two UART wakeup methods: idle-line or address-mark.
bogdanm 82:6473597d706e 125 */
bogdanm 82:6473597d706e 126 typedef enum _uart_wakeup_method {
bogdanm 82:6473597d706e 127 kUartIdleLineWake = 0, /*!< The idle-line wakes UART receiver from standby */
bogdanm 82:6473597d706e 128 kUartAddrMarkWake = 1, /*!< The address-mark wakes UART receiver from standby */
bogdanm 82:6473597d706e 129 } uart_wakeup_method_t;
bogdanm 82:6473597d706e 130
bogdanm 82:6473597d706e 131 /*!
bogdanm 82:6473597d706e 132 * @brief UART idle-line detect selection types.
bogdanm 82:6473597d706e 133 *
bogdanm 82:6473597d706e 134 * This provides constants for the UART idle character bit-count start: either after start or
bogdanm 82:6473597d706e 135 * stop bit.
bogdanm 82:6473597d706e 136 */
bogdanm 82:6473597d706e 137 typedef enum _uart_idle_line_select {
bogdanm 82:6473597d706e 138 kUartIdleLineAfterStartBit = 0, /*!< UART idle character bit count start after start bit */
bogdanm 82:6473597d706e 139 kUartIdleLineAfterStopBit = 1, /*!< UART idle character bit count start after stop bit */
bogdanm 82:6473597d706e 140 } uart_idle_line_select_t;
bogdanm 82:6473597d706e 141
bogdanm 82:6473597d706e 142 /*!
bogdanm 82:6473597d706e 143 * @brief UART break character length settings for transmit/detect.
bogdanm 82:6473597d706e 144 *
bogdanm 82:6473597d706e 145 * This provides constants for the UART break character length for both transmission and detection
bogdanm 82:6473597d706e 146 * purposes. Note that the actual maximum bit times may vary depending on the UART instance.
bogdanm 82:6473597d706e 147 */
bogdanm 82:6473597d706e 148 typedef enum _uart_break_char_length {
bogdanm 82:6473597d706e 149 kUartBreakChar10BitMinimum = 0, /*!< UART break char length 10 bit times (if M = 0, SBNS = 0) or
bogdanm 82:6473597d706e 150 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1,
bogdanm 82:6473597d706e 151 SBNS = 1 or M10 = 1, SNBS = 0) or 13 (if M10 = 1, SNBS = 1) */
bogdanm 82:6473597d706e 152 kUartBreakChar13BitMinimum = 1, /*!< UART break char length 13 bit times (if M = 0, SBNS = 0) or
bogdanm 82:6473597d706e 153 14 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 15 (if M = 1,
bogdanm 82:6473597d706e 154 SBNS = 1 or M10 = 1, SNBS = 0) or 16 (if M10 = 1, SNBS = 1) */
bogdanm 82:6473597d706e 155 } uart_break_char_length_t;
bogdanm 82:6473597d706e 156
bogdanm 82:6473597d706e 157 /*!
bogdanm 82:6473597d706e 158 * @brief UART single-wire mode transmit direction.
bogdanm 82:6473597d706e 159 *
bogdanm 82:6473597d706e 160 * This provides constants for the UART transmit direction when configured for single-wire mode.
bogdanm 82:6473597d706e 161 * The transmit line TXDIR is either an input or output.
bogdanm 82:6473597d706e 162 */
bogdanm 82:6473597d706e 163 typedef enum _uart_singlewire_txdir {
bogdanm 82:6473597d706e 164 kUartSinglewireTxdirIn = 0, /*!< UART Single-Wire mode TXDIR input */
bogdanm 82:6473597d706e 165 kUartSinglewireTxdirOut = 1, /*!< UART Single-Wire mode TXDIR output */
bogdanm 82:6473597d706e 166 } uart_singlewire_txdir_t;
bogdanm 82:6473597d706e 167
bogdanm 82:6473597d706e 168 /*!
bogdanm 82:6473597d706e 169 * @brief UART status flags.
bogdanm 82:6473597d706e 170 *
bogdanm 82:6473597d706e 171 * This provides constants for the UART status flags for use in the UART functions.
bogdanm 82:6473597d706e 172 */
bogdanm 82:6473597d706e 173 typedef enum _uart_status_flag {
bogdanm 82:6473597d706e 174 kUartTransmitDataRegisterEmpty, /*!< Transmit data register empty flag, sets when transmit
bogdanm 82:6473597d706e 175 buffer is empty */
bogdanm 82:6473597d706e 176 kUartTransmissionComplete, /*!< Transmission complete flag, sets when transmitter is idle
bogdanm 82:6473597d706e 177 (transmission activity complete) */
bogdanm 82:6473597d706e 178 kUartReceiveDataRegisterFull, /*!< Receive data register full flag, sets when the receive data
bogdanm 82:6473597d706e 179 buffer is full */
bogdanm 82:6473597d706e 180 kUartIdleLineDetect, /*!< Idle line detect flag, sets when idle line detected */
bogdanm 82:6473597d706e 181 kUartReceiveOverrun, /*!< Receiver Overrun, sets when new data is received before data
bogdanm 82:6473597d706e 182 is read from receive register */
bogdanm 82:6473597d706e 183 kUartNoiseDetect, /*!< Receiver takes 3 samples of each received bit. If any of
bogdanm 82:6473597d706e 184 these samples differ, noise flag sets */
bogdanm 82:6473597d706e 185 kUartFrameError, /*!< Frame error flag, sets if logic 0 was detected where stop
bogdanm 82:6473597d706e 186 bit expected */
bogdanm 82:6473597d706e 187 kUartParityError, /*!< If parity enabled, sets upon parity error detection */
bogdanm 82:6473597d706e 188 kUartLineBreakDetect, /*!< LIN break detect interrupt flag, sets when
bogdanm 82:6473597d706e 189 LIN break char detected and LIN circuit enabled */
bogdanm 82:6473597d706e 190 kUartReceiveActiveEdgeDetect, /*!< Receive pin active edge interrupt flag, sets when active
bogdanm 82:6473597d706e 191 edge detected */
bogdanm 82:6473597d706e 192 kUartReceiverActive, /*!< Receiver Active Flag (RAF), sets at beginning of valid start
bogdanm 82:6473597d706e 193 bit */
bogdanm 82:6473597d706e 194 #if FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
bogdanm 82:6473597d706e 195 kUartNoiseInCurrentWord, /*!< NOISY bit, sets if noise detected in current data word */
bogdanm 82:6473597d706e 196 kUartParityErrorInCurrentWord, /*!< PARITYE bit, sets if noise detected in current data word */
bogdanm 82:6473597d706e 197 #endif
bogdanm 82:6473597d706e 198 #if FSL_FEATURE_UART_HAS_FIFO
bogdanm 82:6473597d706e 199 kUartTxBufferEmpty, /*!< TXEMPT bit, sets if transmit buffer is empty */
bogdanm 82:6473597d706e 200 kUartRxBufferEmpty, /*!< RXEMPT bit, sets if transmit buffer is empty */
bogdanm 82:6473597d706e 201 kUartTxBufferOverflow, /*!< TXOF bit, sets if transmit buffer overflow occurred */
bogdanm 82:6473597d706e 202 kUartRxBufferUnderflow, /*!< RXUF bit, sets if receive buffer underflow occurred */
bogdanm 82:6473597d706e 203 #endif
bogdanm 82:6473597d706e 204 } uart_status_flag_t;
bogdanm 82:6473597d706e 205
bogdanm 82:6473597d706e 206 /*!
bogdanm 82:6473597d706e 207 * @brief UART infrared transmitter pulse width options.
bogdanm 82:6473597d706e 208 *
bogdanm 82:6473597d706e 209 * This provides constants for the UART infrared (IR) pulse widths. Options include 3/16, 1/16
bogdanm 82:6473597d706e 210 * 1/32, and 1/4 pulse widths.
bogdanm 82:6473597d706e 211 */
bogdanm 82:6473597d706e 212 typedef enum _uart_ir_tx_pulsewidth {
bogdanm 82:6473597d706e 213 kUartIrThreeSixteenthsWidth = 0, /*!< 3/16 pulse */
bogdanm 82:6473597d706e 214 kUartIrOneSixteenthWidth = 1, /*!< 1/16 pulse */
bogdanm 82:6473597d706e 215 kUartIrOneThirtysecondsWidth = 2, /*!< 1/32 pulse */
bogdanm 82:6473597d706e 216 kUartIrOneFourthWidth = 3, /*!< 1/4 pulse */
bogdanm 82:6473597d706e 217 } uart_ir_tx_pulsewidth_t;
bogdanm 82:6473597d706e 218
bogdanm 82:6473597d706e 219 /*!
bogdanm 82:6473597d706e 220 * @brief Structure for idle line configuration settings.
bogdanm 82:6473597d706e 221 *
bogdanm 82:6473597d706e 222 * This structure contains settings for the UART idle line configuration such as the Idle
bogdanm 82:6473597d706e 223 * Line Type (ILT) and the Receiver Wake Up Idle Detect (RWUID).
bogdanm 82:6473597d706e 224 */
bogdanm 82:6473597d706e 225 typedef struct UartIdleLineConfig {
bogdanm 82:6473597d706e 226 unsigned idleLineType : 1; /*!< ILT, Idle bit count start: 0 - after start bit (default),
bogdanm 82:6473597d706e 227 1 - after stop bit */
bogdanm 82:6473597d706e 228 unsigned rxWakeIdleDetect : 1; /*!< RWUID, Receiver Wake Up Idle Detect. IDLE status bit
bogdanm 82:6473597d706e 229 operation during receive standby. Controls whether idle
bogdanm 82:6473597d706e 230 character that wakes up receiver will also set
bogdanm 82:6473597d706e 231 IDLE status bit 0 - IDLE status bit doesn't
bogdanm 82:6473597d706e 232 get set (default), 1 - IDLE status bit gets set */
bogdanm 82:6473597d706e 233 } uart_idle_line_config_t;
bogdanm 82:6473597d706e 234
bogdanm 82:6473597d706e 235 /*! @brief Structure for all UART status flags.
bogdanm 82:6473597d706e 236 *
bogdanm 82:6473597d706e 237 * This structure contains the settings for all of the UART status flags.
bogdanm 82:6473597d706e 238 */
bogdanm 82:6473597d706e 239 typedef struct UartStatusAll {
bogdanm 82:6473597d706e 240 unsigned transmitDataRegisterEmpty : 1; /*!< Transmit data register empty flag, sets when
bogdanm 82:6473597d706e 241 transmit buffer is empty */
bogdanm 82:6473597d706e 242 unsigned transmissionComplete : 1; /*!< Transmission complete flag, sets when transmitter
bogdanm 82:6473597d706e 243 is idle (transmission activity complete)*/
bogdanm 82:6473597d706e 244 unsigned receiveDataRegisterFull : 1; /*!< Receive data register full flag, sets when the
bogdanm 82:6473597d706e 245 receive data buffer is full */
bogdanm 82:6473597d706e 246 unsigned idleLineDetect : 1; /*!< Idle line detect flag, sets when idle line detected */
bogdanm 82:6473597d706e 247 unsigned receiveOverrun : 1; /*!< Receiver Overrun, sets when new data is received
bogdanm 82:6473597d706e 248 before data is read from receive register */
bogdanm 82:6473597d706e 249 unsigned noiseDetect : 1; /*!< Receiver takes 3 samples of each received bit.
bogdanm 82:6473597d706e 250 If any of these samples differ, noise flag sets */
bogdanm 82:6473597d706e 251 unsigned frameError : 1; /*!< Frame error flag, sets if logic 0 was detected
bogdanm 82:6473597d706e 252 where stop bit expected */
bogdanm 82:6473597d706e 253 unsigned parityError : 1; /*!< If parity enabled, will set upon parity
bogdanm 82:6473597d706e 254 error detection */
bogdanm 82:6473597d706e 255 unsigned lineBreakDetect : 1; /*!< LIN break detect interrupt flag, sets when
bogdanm 82:6473597d706e 256 LIN break char detected and LIN circuit enabled */
bogdanm 82:6473597d706e 257 unsigned receiveActiveEdgeDetect : 1; /*!< Receive pin active edge interrupt flag, sets
bogdanm 82:6473597d706e 258 when active edge detected */
bogdanm 82:6473597d706e 259 unsigned receiverActive : 1; /*!< Receiver Active Flag (RAF), sets at beginning of
bogdanm 82:6473597d706e 260 valid start bit */
bogdanm 82:6473597d706e 261 #if FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
bogdanm 82:6473597d706e 262 unsigned noiseInCurrentWord : 1; /*!< NOISY bit, sets if noise detected in current data word */
bogdanm 82:6473597d706e 263 unsigned parityErrorInCurrentWord : 1; /*!< PARITYE bit, sets if noise detected in
bogdanm 82:6473597d706e 264 current data word */
bogdanm 82:6473597d706e 265 #endif
bogdanm 82:6473597d706e 266 #if FSL_FEATURE_UART_HAS_FIFO
bogdanm 82:6473597d706e 267 unsigned txBufferEmpty : 1; /*!< TXEMPT bit, sets if transmit buffer is empty */
bogdanm 82:6473597d706e 268 unsigned rxBufferEmpty : 1; /*!< RXEMPT bit, sets if transmit buffer is empty */
bogdanm 82:6473597d706e 269 unsigned txBufferOverflow : 1; /*!< TXOF bit, sets if transmit buffer overflow occurred */
bogdanm 82:6473597d706e 270 unsigned rxBufferUnderflow : 1; /*!< RXUF bit, sets if receive buffer underflow occurred */
bogdanm 82:6473597d706e 271 #endif
bogdanm 82:6473597d706e 272 } uart_status_flag_all_t;
bogdanm 82:6473597d706e 273
bogdanm 82:6473597d706e 274 /*!
bogdanm 82:6473597d706e 275 * @brief UART interrupt configuration structure, default settings are 0 (disabled).
bogdanm 82:6473597d706e 276 *
bogdanm 82:6473597d706e 277 * This structure contains the settings for all of the UART interrupt configurations.
bogdanm 82:6473597d706e 278 */
bogdanm 82:6473597d706e 279 typedef struct UartInterruptConfig {
bogdanm 82:6473597d706e 280 unsigned linBreakDetect : 1; /*!< LIN break detect: 0 - disable interrupt,
bogdanm 82:6473597d706e 281 1 - enable interrupt */
bogdanm 82:6473597d706e 282 unsigned rxActiveEdge : 1; /*!< RX Active Edge: 0 - disable interrupt,
bogdanm 82:6473597d706e 283 1 - enable interrupt */
bogdanm 82:6473597d706e 284 unsigned transmitDataRegisterEmpty : 1; /*!< Transmit data register empty:
bogdanm 82:6473597d706e 285 0 - disable interrupt, 1 - enable interrupt */
bogdanm 82:6473597d706e 286 unsigned transmitComplete : 1; /*!< Transmission complete: 0 - disable interrupt,
bogdanm 82:6473597d706e 287 1 - enable interrupt */
bogdanm 82:6473597d706e 288 unsigned receiverDataRegisterFull : 1; /*!< Receiver data register full:
bogdanm 82:6473597d706e 289 0 - disable interrupt, 1 - enable interrupt */
bogdanm 82:6473597d706e 290 unsigned idleLine : 1; /*!< Idle line: 0 - disable interrupt, 1 - enable interrupt*/
bogdanm 82:6473597d706e 291 unsigned receiverOverrun : 1; /*!< Receiver Overrun: 0 - disable interrupt,
bogdanm 82:6473597d706e 292 1 - enable interrupt */
bogdanm 82:6473597d706e 293 unsigned noiseErrorFlag : 1; /*!< Noise error flag: 0 - disable interrupt,
bogdanm 82:6473597d706e 294 1 - enable interrupt */
bogdanm 82:6473597d706e 295 unsigned frameErrorFlag : 1; /*!< Framing error flag: 0 - disable interrupt,
bogdanm 82:6473597d706e 296 1 - enable interrupt */
bogdanm 82:6473597d706e 297 unsigned parityErrorFlag : 1; /*!< Parity error flag: 0 - disable interrupt,
bogdanm 82:6473597d706e 298 1 - enable interrupt */
bogdanm 82:6473597d706e 299 #if FSL_FEATURE_UART_HAS_FIFO
bogdanm 82:6473597d706e 300 unsigned txFifoOverflow : 1; /*!< TX FIFO Overflow: 0 - disable interrupt,
bogdanm 82:6473597d706e 301 1 - enable interrupt */
bogdanm 82:6473597d706e 302 unsigned rxFifoUnderflow : 1; /*!< RX FIFO Underflow: 0 - disable interrupt,
bogdanm 82:6473597d706e 303 1 - enable interrupt */
bogdanm 82:6473597d706e 304 #endif
bogdanm 82:6473597d706e 305 } uart_interrupt_config_t;
bogdanm 82:6473597d706e 306
bogdanm 82:6473597d706e 307 /*!
bogdanm 82:6473597d706e 308 * @brief UART configuration structure.
bogdanm 82:6473597d706e 309 *
bogdanm 82:6473597d706e 310 * This structure contains the settings for the most common UART configurations including
bogdanm 82:6473597d706e 311 * the UART module source clock, baud rate, parity mode, stop bit count, data bit count per
bogdanm 82:6473597d706e 312 * character, and tx/rx inversion options (which is the least common of the configurations).
bogdanm 82:6473597d706e 313 */
bogdanm 82:6473597d706e 314 typedef struct UartConfig {
bogdanm 82:6473597d706e 315 uint32_t uartSourceClockInHz; /*!< UART module source clock in Hz */
bogdanm 82:6473597d706e 316 uint32_t baudRate; /*!< UART baud rate */
bogdanm 82:6473597d706e 317 uart_parity_mode_t parityMode; /*!< Parity mode, disabled (default), even, or odd */
bogdanm 82:6473597d706e 318 uart_stop_bit_count_t stopBitCount; /*!< Number of stop bits, 1 stop bit (default)
bogdanm 82:6473597d706e 319 or 2 stop bits */
bogdanm 82:6473597d706e 320 uart_bit_count_per_char_t bitCountPerChar; /*!< Number of bits, 8-bit (default) or 9-bit
bogdanm 82:6473597d706e 321 in a word (up to 10-bits in
bogdanm 82:6473597d706e 322 some UART instances) */
bogdanm 82:6473597d706e 323 unsigned rxDataInvert : 1; /*!< Receive Data Inversion: 0 - not inverted (default),
bogdanm 82:6473597d706e 324 1 - inverted */
bogdanm 82:6473597d706e 325 unsigned txDataInvert : 1; /*!< Transmit Data Inversion: 0 - not inverted (default),
bogdanm 82:6473597d706e 326 1 - inverted */
bogdanm 82:6473597d706e 327 } uart_config_t;
bogdanm 82:6473597d706e 328
bogdanm 82:6473597d706e 329 /*******************************************************************************
bogdanm 82:6473597d706e 330 * API
bogdanm 82:6473597d706e 331 ******************************************************************************/
bogdanm 82:6473597d706e 332
bogdanm 82:6473597d706e 333 #if defined(__cplusplus)
bogdanm 82:6473597d706e 334 extern "C" {
bogdanm 82:6473597d706e 335 #endif
bogdanm 82:6473597d706e 336
bogdanm 82:6473597d706e 337 /*!
bogdanm 82:6473597d706e 338 * @name UART Common Configurations
bogdanm 82:6473597d706e 339 * @{
bogdanm 82:6473597d706e 340 */
bogdanm 82:6473597d706e 341
bogdanm 82:6473597d706e 342 /*!
bogdanm 82:6473597d706e 343 * @brief Initialize the UART controller.
bogdanm 82:6473597d706e 344 *
bogdanm 82:6473597d706e 345 * This function initializes the module to user defined settings and default settings.
bogdanm 82:6473597d706e 346 * Here is an example demonstrating how to define the uart_config_t structure and call
bogdanm 82:6473597d706e 347 * the uart_hal_init function:
bogdanm 82:6473597d706e 348 @code
bogdanm 82:6473597d706e 349 uart_config_t uartConfig;
bogdanm 82:6473597d706e 350 uartConfig.uartSourceClockInHz = uartSourceClock;
bogdanm 82:6473597d706e 351 uartConfig.baudRate = baudRate;
bogdanm 82:6473597d706e 352 uartConfig.bitCountPerChar = kUart8BitsPerChar;
bogdanm 82:6473597d706e 353 uartConfig.parityMode = kUartParityDisabled;
bogdanm 82:6473597d706e 354 uartConfig.stopBitCount = kUartOneStopBit;
bogdanm 82:6473597d706e 355 uartConfig.txDataInvert = 0;
bogdanm 82:6473597d706e 356 uartConfig.rxDataInvert = 0;
bogdanm 82:6473597d706e 357 uart_hal_init(uartInstance, &uartConfig);
bogdanm 82:6473597d706e 358 @endcode
bogdanm 82:6473597d706e 359 *
bogdanm 82:6473597d706e 360 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 361 * @param config UART configuration data.
bogdanm 82:6473597d706e 362 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 363 */
bogdanm 82:6473597d706e 364 uart_status_t uart_hal_init(uint32_t uartInstance, const uart_config_t *config);
bogdanm 82:6473597d706e 365
bogdanm 82:6473597d706e 366 /*!
bogdanm 82:6473597d706e 367 * @brief Configure the UART baud rate.
bogdanm 82:6473597d706e 368 *
bogdanm 82:6473597d706e 369 * This function programs the UART baud rate to the desired value passed in by the user. The user
bogdanm 82:6473597d706e 370 * must also pass in the module source clock so that the function can calculate the baud
bogdanm 82:6473597d706e 371 * rate divisors to their appropriate values.
bogdanm 82:6473597d706e 372 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 373 * before calling this function.
bogdanm 82:6473597d706e 374 * Generally this is applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 375 *
bogdanm 82:6473597d706e 376 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 377 * @param sourceClockInHz UART source input clock in Hz.
bogdanm 82:6473597d706e 378 * @param desiredBaudRate UART desired baud rate.
bogdanm 82:6473597d706e 379 * @return An error code or kStatus_UART_Success
bogdanm 82:6473597d706e 380 */
bogdanm 82:6473597d706e 381 uart_status_t uart_hal_set_baud_rate(uint32_t uartInstance, uint32_t sourceClockInHz,
bogdanm 82:6473597d706e 382 uint32_t desiredBaudRate);
bogdanm 82:6473597d706e 383
bogdanm 82:6473597d706e 384 /*!
bogdanm 82:6473597d706e 385 * @brief Set the UART baud rate modulo divisor value.
bogdanm 82:6473597d706e 386 *
bogdanm 82:6473597d706e 387 * This function allows the user to program the baud rate divisor directly in situations
bogdanm 82:6473597d706e 388 * where the divisor value is known. In this case, the user may not want to call the
bogdanm 82:6473597d706e 389 * uart_hal_set_baud_rate() function, as the divisor is already known.
bogdanm 82:6473597d706e 390 *
bogdanm 82:6473597d706e 391 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 392 * @param baudRateDivisor The baud rate modulo division "SBR" value.
bogdanm 82:6473597d706e 393 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 394 */
bogdanm 82:6473597d706e 395 uart_status_t uart_hal_set_baud_rate_divisor(uint32_t uartInstance, uint32_t baudRateDivisor);
bogdanm 82:6473597d706e 396
bogdanm 82:6473597d706e 397 #if FSL_FEATURE_UART_HAS_BAUD_RATE_FINE_ADJUST_SUPPORT
bogdanm 82:6473597d706e 398 /*!
bogdanm 82:6473597d706e 399 * @brief Set the UART baud rate fine adjust. (Note: Feature available on select
bogdanm 82:6473597d706e 400 * UART instances used in conjunction with baud rate programming)
bogdanm 82:6473597d706e 401 *
bogdanm 82:6473597d706e 402 * This function, which programs the baud rate fine adjust, is used in conjunction with
bogdanm 82:6473597d706e 403 * programming the baud rate modulo divisor in situations where these divisors value are known.
bogdanm 82:6473597d706e 404 * In this case, the user may not want to call the uart_hal_set_baud_rate() function, as the
bogdanm 82:6473597d706e 405 * divisors are already known.
bogdanm 82:6473597d706e 406 *
bogdanm 82:6473597d706e 407 *
bogdanm 82:6473597d706e 408 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 409 * @param baudFineAdjust Value of 5-bit field used to add more timing resolution to average
bogdanm 82:6473597d706e 410 * baud rate frequency is 1/32 increments.
bogdanm 82:6473597d706e 411 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 412 */
bogdanm 82:6473597d706e 413 uart_status_t uart_hal_set_baud_rate_fine_adjust(uint32_t uartInstance, uint8_t baudFineAdjust);
bogdanm 82:6473597d706e 414 #endif
bogdanm 82:6473597d706e 415
bogdanm 82:6473597d706e 416 #if FSL_FEATURE_UART_HAS_BAUD_RATE_OVER_SAMPLING_SUPPORT
bogdanm 82:6473597d706e 417 /*!
bogdanm 82:6473597d706e 418 * @brief Set the UART baud rate oversampling ratio. (Note: Feature available on select
bogdanm 82:6473597d706e 419 * UART instances used in conjunction with baud rate programming)
bogdanm 82:6473597d706e 420 *
bogdanm 82:6473597d706e 421 * This function allows the user to directly configure the oversampling ratio (OSR). Normally this
bogdanm 82:6473597d706e 422 * ratio is automatically configured when calling the uart_hal_set_baud_rate(). However, if the user
bogdanm 82:6473597d706e 423 * knows the necessary dividers and wishes to directly program them, they also have the option to
bogdanm 82:6473597d706e 424 * directly program the OSR.
bogdanm 82:6473597d706e 425 * The oversampling ratio should be set between 4x (00011) and 32x (11111), writing
bogdanm 82:6473597d706e 426 * an invalid oversampling ratio results in an error and is set to a default
bogdanm 82:6473597d706e 427 * 16x (01111) oversampling ratio.
bogdanm 82:6473597d706e 428 * It is required that the transmitter/receiver be disabled before calling
bogdanm 82:6473597d706e 429 * this function.
bogdanm 82:6473597d706e 430 *
bogdanm 82:6473597d706e 431 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 432 * @param overSamplingRatio The oversampling ratio "OSR" value.
bogdanm 82:6473597d706e 433 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 434 */
bogdanm 82:6473597d706e 435 uart_status_t uart_hal_set_oversampling_ratio(uint32_t uartInstance, uint32_t overSamplingRatio);
bogdanm 82:6473597d706e 436 #endif
bogdanm 82:6473597d706e 437
bogdanm 82:6473597d706e 438 #if FSL_FEATURE_UART_HAS_BOTH_EDGE_SAMPLING_SUPPORT
bogdanm 82:6473597d706e 439 /*!
bogdanm 82:6473597d706e 440 * @brief Configure the UART baud rate both edge sampling option. (Note: Feature available on select
bogdanm 82:6473597d706e 441 * UART instances used in conjunction with baud rate programming)
bogdanm 82:6473597d706e 442 *
bogdanm 82:6473597d706e 443 * This function allows the user to directly configure the both edge sampling option.
bogdanm 82:6473597d706e 444 * When enabled, the received data is sampled on both edges of the baud rate clock.
bogdanm 82:6473597d706e 445 * This must be set when the oversampling ratio is between 4x and 7x.
bogdanm 82:6473597d706e 446 * This function should only be called when the receiver is disabled.
bogdanm 82:6473597d706e 447 *
bogdanm 82:6473597d706e 448 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 449 * @param enableBothEdgeSampling Enable (true) or disable (false) Both Edge Sampling option.
bogdanm 82:6473597d706e 450 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 451 */
bogdanm 82:6473597d706e 452 uart_status_t uart_hal_configure_both_edge_sampling(uint32_t uartInstance,
bogdanm 82:6473597d706e 453 bool enableBothEdgeSampling);
bogdanm 82:6473597d706e 454 #endif
bogdanm 82:6473597d706e 455
bogdanm 82:6473597d706e 456 /*!
bogdanm 82:6473597d706e 457 * @brief Configure number of bits per character in the UART controller.
bogdanm 82:6473597d706e 458 *
bogdanm 82:6473597d706e 459 * This function allows the user to configure the number of bits per character according to the
bogdanm 82:6473597d706e 460 * typedef uart_bit_count_per_char_t.
bogdanm 82:6473597d706e 461 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 462 * before calling this function.
bogdanm 82:6473597d706e 463 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 464 *
bogdanm 82:6473597d706e 465 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 466 * @param bitCountPerChar Number of bits per char (8, 9, or 10, depending on the UART instance).
bogdanm 82:6473597d706e 467 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 468 */
bogdanm 82:6473597d706e 469 uart_status_t uart_hal_configure_bit_count_per_char(uint32_t uartInstance,
bogdanm 82:6473597d706e 470 uart_bit_count_per_char_t bitCountPerChar);
bogdanm 82:6473597d706e 471
bogdanm 82:6473597d706e 472 /*!
bogdanm 82:6473597d706e 473 * @brief Configure the parity mode in the UART controller.
bogdanm 82:6473597d706e 474 *
bogdanm 82:6473597d706e 475 * This function allows the user to configure the parity mode of the UART controller to disable
bogdanm 82:6473597d706e 476 * it or enable it for even parity or for odd parity.
bogdanm 82:6473597d706e 477 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 478 * before calling this function.
bogdanm 82:6473597d706e 479 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 480 *
bogdanm 82:6473597d706e 481 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 482 * @param parityModeType Parity mode setting (enabled, disable, odd, even - see
bogdanm 82:6473597d706e 483 * parity_mode_t struct).
bogdanm 82:6473597d706e 484 */
bogdanm 82:6473597d706e 485 void uart_hal_configure_parity_mode(uint32_t uartInstance, uart_parity_mode_t parityModeType);
bogdanm 82:6473597d706e 486
bogdanm 82:6473597d706e 487 /*!
bogdanm 82:6473597d706e 488 * @brief Configure the number of stop bits in the UART controller.
bogdanm 82:6473597d706e 489 *
bogdanm 82:6473597d706e 490 * This function allows the user to configure the number of stop bits in the UART controller
bogdanm 82:6473597d706e 491 * to be one or two stop bits.
bogdanm 82:6473597d706e 492 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 493 * before calling this function.
bogdanm 82:6473597d706e 494 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 495 *
bogdanm 82:6473597d706e 496 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 497 * @param stopBitCount Number of stop bits setting (1 or 2 - see uart_stop_bit_count_t struct).
bogdanm 82:6473597d706e 498 * @return An error code (an unsupported setting in some UARTs) or kStatus_UART_Success.
bogdanm 82:6473597d706e 499 */
bogdanm 82:6473597d706e 500 uart_status_t uart_hal_configure_stop_bit_count(uint32_t uartInstance,
bogdanm 82:6473597d706e 501 uart_stop_bit_count_t stopBitCount);
bogdanm 82:6473597d706e 502
bogdanm 82:6473597d706e 503 /*!
bogdanm 82:6473597d706e 504 * @brief Configure the transmit and receive inversion control in UART controller.
bogdanm 82:6473597d706e 505 *
bogdanm 82:6473597d706e 506 * This function allows the user to invert the transmit and receive signals, independently.
bogdanm 82:6473597d706e 507 * This function should only be called when the UART is between transmit and receive packets.
bogdanm 82:6473597d706e 508 *
bogdanm 82:6473597d706e 509 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 510 * @param rxInvert Enable (1) or disable (0) receive inversion.
bogdanm 82:6473597d706e 511 * @param txInvert Enable (1) or disable (0) transmit inversion.
bogdanm 82:6473597d706e 512 */
bogdanm 82:6473597d706e 513 void uart_hal_configure_tx_rx_inversion(uint32_t uartInstance, uint32_t rxInvert,
bogdanm 82:6473597d706e 514 uint32_t txInvert);
bogdanm 82:6473597d706e 515
bogdanm 82:6473597d706e 516 /*!
bogdanm 82:6473597d706e 517 * @brief Enable the UART transmitter.
bogdanm 82:6473597d706e 518 *
bogdanm 82:6473597d706e 519 * This function allows the user to enable the UART transmitter.
bogdanm 82:6473597d706e 520 *
bogdanm 82:6473597d706e 521 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 522 */
bogdanm 82:6473597d706e 523 void uart_hal_enable_transmitter(uint32_t uartInstance);
bogdanm 82:6473597d706e 524
bogdanm 82:6473597d706e 525 /*!
bogdanm 82:6473597d706e 526 * @brief Disable the UART transmitter.
bogdanm 82:6473597d706e 527 *
bogdanm 82:6473597d706e 528 * This function allows the user to disable the UART transmitter.
bogdanm 82:6473597d706e 529 *
bogdanm 82:6473597d706e 530 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 531 */
bogdanm 82:6473597d706e 532 void uart_hal_disable_transmitter(uint32_t uartInstance);
bogdanm 82:6473597d706e 533
bogdanm 82:6473597d706e 534 /*!
bogdanm 82:6473597d706e 535 * @brief Get the UART transmitter enabled/disabled configuration setting.
bogdanm 82:6473597d706e 536 *
bogdanm 82:6473597d706e 537 * This function allows the user to get the setting of the UART transmitter.
bogdanm 82:6473597d706e 538 *
bogdanm 82:6473597d706e 539 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 540 * @return The state of UART transmitter enable(true)/disable(false) setting.
bogdanm 82:6473597d706e 541 */
bogdanm 82:6473597d706e 542 bool uart_hal_is_transmitter_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 543
bogdanm 82:6473597d706e 544 /*!
bogdanm 82:6473597d706e 545 * @brief Enable the UART receiver.
bogdanm 82:6473597d706e 546 *
bogdanm 82:6473597d706e 547 * This function allows the user to enable the UART receiver.
bogdanm 82:6473597d706e 548 *
bogdanm 82:6473597d706e 549 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 550 */
bogdanm 82:6473597d706e 551 void uart_hal_enable_receiver(uint32_t uartInstance);
bogdanm 82:6473597d706e 552
bogdanm 82:6473597d706e 553 /*!
bogdanm 82:6473597d706e 554 * @brief Disable the UART receiver.
bogdanm 82:6473597d706e 555 *
bogdanm 82:6473597d706e 556 * This function allows the user to disable the UART receiver.
bogdanm 82:6473597d706e 557 *
bogdanm 82:6473597d706e 558 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 559 */
bogdanm 82:6473597d706e 560 void uart_hal_disable_receiver(uint32_t uartInstance);
bogdanm 82:6473597d706e 561
bogdanm 82:6473597d706e 562 /*!
bogdanm 82:6473597d706e 563 * @brief Get the UART receiver enabled/disabled configuration setting.
bogdanm 82:6473597d706e 564 *
bogdanm 82:6473597d706e 565 * This function allows the user to get the setting of the UART receiver.
bogdanm 82:6473597d706e 566 *
bogdanm 82:6473597d706e 567 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 568 * @return The state of UART receiver enable(true)/disable(false) setting.
bogdanm 82:6473597d706e 569 */
bogdanm 82:6473597d706e 570 bool uart_hal_is_receiver_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 571
bogdanm 82:6473597d706e 572 /*@}*/
bogdanm 82:6473597d706e 573
bogdanm 82:6473597d706e 574 /*!
bogdanm 82:6473597d706e 575 * @name UART Interrupts and DMA
bogdanm 82:6473597d706e 576 * @{
bogdanm 82:6473597d706e 577 */
bogdanm 82:6473597d706e 578
bogdanm 82:6473597d706e 579 /*!
bogdanm 82:6473597d706e 580 * @brief Configure the UART module interrupts to enable/disable various interrupt sources.
bogdanm 82:6473597d706e 581 *
bogdanm 82:6473597d706e 582 * This function allows the user to configure all of the UART interrupts with one function call.
bogdanm 82:6473597d706e 583 * The user will first need to initialize and pass in a structure of type uart_interrupt_config_t
bogdanm 82:6473597d706e 584 * which sets the configuration of each interrupt.
bogdanm 82:6473597d706e 585 *
bogdanm 82:6473597d706e 586 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 587 * @param interruptConfig UART interrupt configuration data.
bogdanm 82:6473597d706e 588 */
bogdanm 82:6473597d706e 589 void uart_hal_configure_interrupts(uint32_t uartInstance,
bogdanm 82:6473597d706e 590 const uart_interrupt_config_t * interruptConfig);
bogdanm 82:6473597d706e 591
bogdanm 82:6473597d706e 592 /*!
bogdanm 82:6473597d706e 593 * @brief Enable the break_detect_interrupt.
bogdanm 82:6473597d706e 594 *
bogdanm 82:6473597d706e 595 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 596 */
bogdanm 82:6473597d706e 597 void uart_hal_enable_break_detect_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 598
bogdanm 82:6473597d706e 599 /*!
bogdanm 82:6473597d706e 600 * @brief Disable the break_detect_interrupt.
bogdanm 82:6473597d706e 601 *
bogdanm 82:6473597d706e 602 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 603 */
bogdanm 82:6473597d706e 604 void uart_hal_disable_break_detect_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 605
bogdanm 82:6473597d706e 606 /*!
bogdanm 82:6473597d706e 607 * @brief Get the configuration of the break_detect_interrupt enable setting.
bogdanm 82:6473597d706e 608 *
bogdanm 82:6473597d706e 609 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 610 * @return The bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 611 */
bogdanm 82:6473597d706e 612 bool uart_hal_is_break_detect_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 613
bogdanm 82:6473597d706e 614 /*!
bogdanm 82:6473597d706e 615 * @brief Enable the rx_active_edge_interrupt.
bogdanm 82:6473597d706e 616 *
bogdanm 82:6473597d706e 617 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 618 */
bogdanm 82:6473597d706e 619 void uart_hal_enable_rx_active_edge_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 620
bogdanm 82:6473597d706e 621 /*!
bogdanm 82:6473597d706e 622 * @brief Disable the rx_active_edge_interrupt.
bogdanm 82:6473597d706e 623 *
bogdanm 82:6473597d706e 624 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 625 */
bogdanm 82:6473597d706e 626 void uart_hal_disable_rx_active_edge_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 627
bogdanm 82:6473597d706e 628 /*!
bogdanm 82:6473597d706e 629 * @brief Get the configuration of the rx_active_edge_interrupt enable setting.
bogdanm 82:6473597d706e 630 *
bogdanm 82:6473597d706e 631 * @param uartInstance UART instance number.
bogdanm 82:6473597d706e 632 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 633 */
bogdanm 82:6473597d706e 634 bool uart_hal_is_rx_active_edge_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 635
bogdanm 82:6473597d706e 636 /*!
bogdanm 82:6473597d706e 637 * @brief Enable the tx_data_register_empty_interrupt.
bogdanm 82:6473597d706e 638 *
bogdanm 82:6473597d706e 639 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 640 */
bogdanm 82:6473597d706e 641 void uart_hal_enable_tx_data_register_empty_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 642
bogdanm 82:6473597d706e 643 /*!
bogdanm 82:6473597d706e 644 * @brief Disable the tx_data_register_empty_interrupt.
bogdanm 82:6473597d706e 645 *
bogdanm 82:6473597d706e 646 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 647 */
bogdanm 82:6473597d706e 648 void uart_hal_disable_tx_data_register_empty_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 649
bogdanm 82:6473597d706e 650 /*!
bogdanm 82:6473597d706e 651 * @brief Get the configuration of the tx_data_register_empty_interrupt enable setting.
bogdanm 82:6473597d706e 652 *
bogdanm 82:6473597d706e 653 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 654 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 655 */
bogdanm 82:6473597d706e 656 bool uart_hal_is_tx_data_register_empty_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 657
bogdanm 82:6473597d706e 658 /*!
bogdanm 82:6473597d706e 659 * @brief Enable the transmission_complete_interrupt.
bogdanm 82:6473597d706e 660 *
bogdanm 82:6473597d706e 661 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 662 */
bogdanm 82:6473597d706e 663 void uart_hal_enable_transmission_complete_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 664
bogdanm 82:6473597d706e 665 /*!
bogdanm 82:6473597d706e 666 * @brief Disable the transmission_complete_interrupt.
bogdanm 82:6473597d706e 667 *
bogdanm 82:6473597d706e 668 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 669 */
bogdanm 82:6473597d706e 670 void uart_hal_disable_transmission_complete_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 671
bogdanm 82:6473597d706e 672 /*!
bogdanm 82:6473597d706e 673 * @brief Get the configuration of the transmission_complete_interrupt enable setting.
bogdanm 82:6473597d706e 674 *
bogdanm 82:6473597d706e 675 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 676 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 677 */
bogdanm 82:6473597d706e 678 bool uart_hal_is_transmission_complete_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 679
bogdanm 82:6473597d706e 680 /*!
bogdanm 82:6473597d706e 681 * @brief Enable the rx_data_register_full_interrupt.
bogdanm 82:6473597d706e 682 *
bogdanm 82:6473597d706e 683 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 684 */
bogdanm 82:6473597d706e 685 void uart_hal_enable_rx_data_register_full_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 686
bogdanm 82:6473597d706e 687 /*!
bogdanm 82:6473597d706e 688 * @brief Disable the rx_data_register_full_interrupt.
bogdanm 82:6473597d706e 689 *
bogdanm 82:6473597d706e 690 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 691 */
bogdanm 82:6473597d706e 692 void uart_hal_disable_rx_data_register_full_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 693
bogdanm 82:6473597d706e 694 /*!
bogdanm 82:6473597d706e 695 * @brief Get the configuration of the rx_data_register_full_interrupt enable setting.
bogdanm 82:6473597d706e 696 *
bogdanm 82:6473597d706e 697 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 698 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 699 */
bogdanm 82:6473597d706e 700 bool uart_hal_is_receive_data_full_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 701
bogdanm 82:6473597d706e 702 /*!
bogdanm 82:6473597d706e 703 * @brief Enable the idle_line_interrupt.
bogdanm 82:6473597d706e 704 *
bogdanm 82:6473597d706e 705 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 706 */
bogdanm 82:6473597d706e 707 void uart_hal_enable_idle_line_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 708
bogdanm 82:6473597d706e 709 /*!
bogdanm 82:6473597d706e 710 * @brief Disable the idle_line_interrupt.
bogdanm 82:6473597d706e 711 *
bogdanm 82:6473597d706e 712 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 713 */
bogdanm 82:6473597d706e 714 void uart_hal_disable_idle_line_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 715
bogdanm 82:6473597d706e 716 /*!
bogdanm 82:6473597d706e 717 * @brief Get the configuration of the idle_line_interrupt enable setting.
bogdanm 82:6473597d706e 718 *
bogdanm 82:6473597d706e 719 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 720 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 721 */
bogdanm 82:6473597d706e 722 bool uart_hal_is_idle_line_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 723
bogdanm 82:6473597d706e 724 /*!
bogdanm 82:6473597d706e 725 * @brief Enable the rx_overrun_interrupt.
bogdanm 82:6473597d706e 726 *
bogdanm 82:6473597d706e 727 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 728 */
bogdanm 82:6473597d706e 729 void uart_hal_enable_rx_overrun_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 730
bogdanm 82:6473597d706e 731 /*!
bogdanm 82:6473597d706e 732 * @brief Disable the rx_overrun_interrupt.
bogdanm 82:6473597d706e 733 *
bogdanm 82:6473597d706e 734 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 735 */
bogdanm 82:6473597d706e 736 void uart_hal_disable_rx_overrun_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 737
bogdanm 82:6473597d706e 738 /*!
bogdanm 82:6473597d706e 739 * @brief Get the configuration of the rx_overrun_interrupt enable setting.
bogdanm 82:6473597d706e 740 *
bogdanm 82:6473597d706e 741 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 742 * @return Bit setting of the interrupt enable bit .
bogdanm 82:6473597d706e 743 */
bogdanm 82:6473597d706e 744 bool uart_hal_is_rx_overrun_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 745
bogdanm 82:6473597d706e 746 /*!
bogdanm 82:6473597d706e 747 * @brief Enable the noise_error_interrupt.
bogdanm 82:6473597d706e 748 *
bogdanm 82:6473597d706e 749 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 750 */
bogdanm 82:6473597d706e 751 void uart_hal_enable_noise_error_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 752
bogdanm 82:6473597d706e 753 /*!
bogdanm 82:6473597d706e 754 * @brief Disable the noise_error_interrupt.
bogdanm 82:6473597d706e 755 *
bogdanm 82:6473597d706e 756 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 757 */
bogdanm 82:6473597d706e 758 void uart_hal_disable_noise_error_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 759
bogdanm 82:6473597d706e 760 /*!
bogdanm 82:6473597d706e 761 * @brief Get the configuration of the noise_error_interrupt enable setting.
bogdanm 82:6473597d706e 762 *
bogdanm 82:6473597d706e 763 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 764 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 765 */
bogdanm 82:6473597d706e 766 bool uart_hal_is_noise_error_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 767
bogdanm 82:6473597d706e 768 /*!
bogdanm 82:6473597d706e 769 * @brief Enable the framing_error_interrupt.
bogdanm 82:6473597d706e 770 *
bogdanm 82:6473597d706e 771 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 772 */
bogdanm 82:6473597d706e 773 void uart_hal_enable_framing_error_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 774
bogdanm 82:6473597d706e 775 /*!
bogdanm 82:6473597d706e 776 * @brief Disable the framing_error_interrupt.
bogdanm 82:6473597d706e 777 *
bogdanm 82:6473597d706e 778 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 779 */
bogdanm 82:6473597d706e 780 void uart_hal_disable_framing_error_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 781
bogdanm 82:6473597d706e 782 /*!
bogdanm 82:6473597d706e 783 * @brief Get the configuration of the framing_error_interrupt enable setting.
bogdanm 82:6473597d706e 784 *
bogdanm 82:6473597d706e 785 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 786 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 787 */
bogdanm 82:6473597d706e 788 bool uart_hal_is_framing_error_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 789
bogdanm 82:6473597d706e 790 /*!
bogdanm 82:6473597d706e 791 * @brief Enable the parity_error_interrupt.
bogdanm 82:6473597d706e 792 *
bogdanm 82:6473597d706e 793 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 794 */
bogdanm 82:6473597d706e 795 void uart_hal_enable_parity_error_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 796
bogdanm 82:6473597d706e 797 /*!
bogdanm 82:6473597d706e 798 * @brief Disable the parity_error_interrupt.
bogdanm 82:6473597d706e 799 *
bogdanm 82:6473597d706e 800 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 801 */
bogdanm 82:6473597d706e 802 void uart_hal_disable_parity_error_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 803
bogdanm 82:6473597d706e 804 /*!
bogdanm 82:6473597d706e 805 * @brief Get the configuration of the parity_error_interrupt enable setting.
bogdanm 82:6473597d706e 806 *
bogdanm 82:6473597d706e 807 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 808 * @return Bit setting of the interrupt enable bit.
bogdanm 82:6473597d706e 809 */
bogdanm 82:6473597d706e 810 bool uart_hal_is_parity_error_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 811
bogdanm 82:6473597d706e 812 /*!
bogdanm 82:6473597d706e 813 * @brief Configure the UART DMA requests for the Transmitter and Receiver.
bogdanm 82:6473597d706e 814 *
bogdanm 82:6473597d706e 815 * This function allows the user to configure the transmit data register empty flag to
bogdanm 82:6473597d706e 816 * generate an interrupt request (default) or a DMA request. Similarly, this function
bogdanm 82:6473597d706e 817 * allows the user to configure the receive data register full flag to generate an interrupt
bogdanm 82:6473597d706e 818 * request (default) or a DMA request.
bogdanm 82:6473597d706e 819 *
bogdanm 82:6473597d706e 820 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 821 * @param txDmaConfig Transmit DMA request configuration setting (enable: true /disable: false).
bogdanm 82:6473597d706e 822 * @param rxDmaConfig Receive DMA request configuration setting (enable: true/disable: false).
bogdanm 82:6473597d706e 823 */
bogdanm 82:6473597d706e 824 void uart_hal_configure_dma(uint32_t uartInstance, bool txDmaConfig, bool rxDmaConfig);
bogdanm 82:6473597d706e 825
bogdanm 82:6473597d706e 826 /*!
bogdanm 82:6473597d706e 827 * @brief Get the UART Transmit DMA request configuration setting.
bogdanm 82:6473597d706e 828 *
bogdanm 82:6473597d706e 829 * This function returns the configuration setting of the Transmit DMA request.
bogdanm 82:6473597d706e 830 *
bogdanm 82:6473597d706e 831 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 832 * @return Transmit DMA request configuration setting (enable: true /disable: false).
bogdanm 82:6473597d706e 833 */
bogdanm 82:6473597d706e 834 bool uart_hal_is_txdma_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 835
bogdanm 82:6473597d706e 836 /*!
bogdanm 82:6473597d706e 837 * @brief Get the UART Receive DMA request configuration setting.
bogdanm 82:6473597d706e 838 *
bogdanm 82:6473597d706e 839 * This function returns the configuration setting of the Receive DMA request.
bogdanm 82:6473597d706e 840 *
bogdanm 82:6473597d706e 841 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 842 * @return Receive DMA request configuration setting (enable: true /disable: false).
bogdanm 82:6473597d706e 843 */
bogdanm 82:6473597d706e 844 bool uart_hal_is_rxdma_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 845
bogdanm 82:6473597d706e 846 /*@}*/
bogdanm 82:6473597d706e 847
bogdanm 82:6473597d706e 848 /*!
bogdanm 82:6473597d706e 849 * @name UART Transfer Functions
bogdanm 82:6473597d706e 850 * @{
bogdanm 82:6473597d706e 851 */
bogdanm 82:6473597d706e 852
bogdanm 82:6473597d706e 853 /*!
bogdanm 82:6473597d706e 854 * @brief This function allows the user to send an 8-bit character from the UART data register.
bogdanm 82:6473597d706e 855 *
bogdanm 82:6473597d706e 856 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 857 * @param data The data to send of size 8-bit.
bogdanm 82:6473597d706e 858 */
bogdanm 82:6473597d706e 859 void uart_hal_putchar(uint32_t uartInstance, uint8_t data);
bogdanm 82:6473597d706e 860
bogdanm 82:6473597d706e 861 /*!
bogdanm 82:6473597d706e 862 * @brief This function allows the user to send a 9-bit character from the UART data register.
bogdanm 82:6473597d706e 863 *
bogdanm 82:6473597d706e 864 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 865 * @param data The data to send of size 9-bit.
bogdanm 82:6473597d706e 866 */
bogdanm 82:6473597d706e 867 void uart_hal_putchar9(uint32_t uartInstance, uint16_t data);
bogdanm 82:6473597d706e 868
bogdanm 82:6473597d706e 869 /*!
bogdanm 82:6473597d706e 870 * @brief This function allows the user to send a 10-bit character from the UART data register.
bogdanm 82:6473597d706e 871 * (Note: Feature available on select UART instances)
bogdanm 82:6473597d706e 872 *
bogdanm 82:6473597d706e 873 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 874 * @param data The data to send of size 10-bit.
bogdanm 82:6473597d706e 875 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 876 */
bogdanm 82:6473597d706e 877 uart_status_t uart_hal_putchar10(uint32_t uartInstance, uint16_t data);
bogdanm 82:6473597d706e 878
bogdanm 82:6473597d706e 879 /*!
bogdanm 82:6473597d706e 880 * @brief This function gets a received 8-bit character from the UART data register.
bogdanm 82:6473597d706e 881 *
bogdanm 82:6473597d706e 882 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 883 * @param readData The received data read from data register of size 8-bit.
bogdanm 82:6473597d706e 884 */
bogdanm 82:6473597d706e 885 void uart_hal_getchar(uint32_t uartInstance, uint8_t *readData);
bogdanm 82:6473597d706e 886
bogdanm 82:6473597d706e 887 /*!
bogdanm 82:6473597d706e 888 * @brief This function gets a received 9-bit character from the UART data register.
bogdanm 82:6473597d706e 889 *
bogdanm 82:6473597d706e 890 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 891 * @param readData The received data read from data register of size 9-bit.
bogdanm 82:6473597d706e 892 */
bogdanm 82:6473597d706e 893 void uart_hal_getchar9(uint32_t uartInstance, uint16_t *readData);
bogdanm 82:6473597d706e 894
bogdanm 82:6473597d706e 895 /*!
bogdanm 82:6473597d706e 896 * @brief This function gets a received 10-bit character from the UART data register.
bogdanm 82:6473597d706e 897 * (Note: Feature available on select UART instances)
bogdanm 82:6473597d706e 898 *
bogdanm 82:6473597d706e 899 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 900 * @param readData The received data read from data register of size 10-bit.
bogdanm 82:6473597d706e 901 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 902 */
bogdanm 82:6473597d706e 903 uart_status_t uart_hal_getchar10(uint32_t uartInstance, uint16_t *readData);
bogdanm 82:6473597d706e 904
bogdanm 82:6473597d706e 905 #if FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
bogdanm 82:6473597d706e 906 /*!
bogdanm 82:6473597d706e 907 * @brief Configure the UART bit 10 (if enabled) or bit 9 (if disabled) as the parity bit in the
bogdanm 82:6473597d706e 908 * serial transmission.
bogdanm 82:6473597d706e 909 *
bogdanm 82:6473597d706e 910 * This function configures bit 10 or bit 9 to be the parity bit. To configure bit 10 as the parity
bogdanm 82:6473597d706e 911 * bit, the function sets UARTx_C4[M10]; it also sets UARTx_C1[M] and UARTx_C1[PE] as required.
bogdanm 82:6473597d706e 912 *
bogdanm 82:6473597d706e 913 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 914 * @param enable The setting to enable (true), which configures bit 10 as the parity bit or to
bogdanm 82:6473597d706e 915 * disable (false), which configures bit 9 as the parity bit in the serial
bogdanm 82:6473597d706e 916 * transmission.
bogdanm 82:6473597d706e 917 */
bogdanm 82:6473597d706e 918 void uart_hal_configure_bit10_as_paritybit_operation(uint32_t uartInstance, bool enable);
bogdanm 82:6473597d706e 919
bogdanm 82:6473597d706e 920 /*!
bogdanm 82:6473597d706e 921 * @brief Get the configuration of the UART bit 10 (if enabled) or bit 9 (if disabled) as the
bogdanm 82:6473597d706e 922 * parity bit in the serial transmission.
bogdanm 82:6473597d706e 923 *
bogdanm 82:6473597d706e 924 * This function returns true if bit 10 is configured as the parity bit, otherwise it returns
bogdanm 82:6473597d706e 925 * false if bit 9 is configured as the parity bit.
bogdanm 82:6473597d706e 926 *
bogdanm 82:6473597d706e 927 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 928 * @return The configuration setting of bit 10 (true), or bit 9 (false) as the
bogdanm 82:6473597d706e 929 * parity bit in the serial transmission.
bogdanm 82:6473597d706e 930 */
bogdanm 82:6473597d706e 931 bool uart_hal_is_bit10_set_as_paritybit(uint32_t uartInstance);
bogdanm 82:6473597d706e 932
bogdanm 82:6473597d706e 933 /*!
bogdanm 82:6473597d706e 934 * @brief Determine if the UART received data word was received with noise.
bogdanm 82:6473597d706e 935 *
bogdanm 82:6473597d706e 936 * This function returns true if the received data word was received with noise. Otherwise,
bogdanm 82:6473597d706e 937 * it returns false indicating no noise was detected.
bogdanm 82:6473597d706e 938 *
bogdanm 82:6473597d706e 939 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 940 * @return The status of the NOISY bit in the UART extended data register.
bogdanm 82:6473597d706e 941 */
bogdanm 82:6473597d706e 942 bool uart_hal_is_current_dataword_received_with_noise(uint32_t uartInstance);
bogdanm 82:6473597d706e 943
bogdanm 82:6473597d706e 944 /*!
bogdanm 82:6473597d706e 945 * @brief Determine if the UART received data word was received with a parity error.
bogdanm 82:6473597d706e 946 *
bogdanm 82:6473597d706e 947 * This function returns true if the received data word was received with a parity error.
bogdanm 82:6473597d706e 948 * Otherwise, it returns false indicating no parity error was detected.
bogdanm 82:6473597d706e 949 *
bogdanm 82:6473597d706e 950 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 951 * @return The status of the PARITYE (parity error) bit in the UART extended data register.
bogdanm 82:6473597d706e 952 */
bogdanm 82:6473597d706e 953 bool uart_hal_is_current_dataword_received_with_parityerror(uint32_t uartInstance);
bogdanm 82:6473597d706e 954 #endif /* FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS*/
bogdanm 82:6473597d706e 955
bogdanm 82:6473597d706e 956 /*@}*/
bogdanm 82:6473597d706e 957
bogdanm 82:6473597d706e 958 /*!
bogdanm 82:6473597d706e 959 * @name UART Special Feature Configurations
bogdanm 82:6473597d706e 960 * @{
bogdanm 82:6473597d706e 961 */
bogdanm 82:6473597d706e 962
bogdanm 82:6473597d706e 963 /*!
bogdanm 82:6473597d706e 964 * @brief Configure the UART to either operate or cease to operate in WAIT mode.
bogdanm 82:6473597d706e 965 *
bogdanm 82:6473597d706e 966 * The function configures the UART to either operate or cease to operate when WAIT mode is
bogdanm 82:6473597d706e 967 * entered.
bogdanm 82:6473597d706e 968 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 969 * before calling this function.
bogdanm 82:6473597d706e 970 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 971 *
bogdanm 82:6473597d706e 972 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 973 * @param mode The UART WAIT mode operation - operates or ceases to operate in WAIT mode.
bogdanm 82:6473597d706e 974 */
bogdanm 82:6473597d706e 975 void uart_hal_configure_wait_mode_operation(uint32_t uartInstance, uart_operation_config_t mode);
bogdanm 82:6473597d706e 976
bogdanm 82:6473597d706e 977 /*!
bogdanm 82:6473597d706e 978 * @brief Determine if the UART operates or ceases to operate in WAIT mode.
bogdanm 82:6473597d706e 979 *
bogdanm 82:6473597d706e 980 * This function returns kUartOperates if the UART has been configured to operate in WAIT mode.
bogdanm 82:6473597d706e 981 * Else it returns KUartStops if the UART has been configured to cease-to-operate in WAIT mode.
bogdanm 82:6473597d706e 982 *
bogdanm 82:6473597d706e 983 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 984 * @return The UART WAIT mode operation configuration, returns either kUartOperates or KUartStops.
bogdanm 82:6473597d706e 985 */
bogdanm 82:6473597d706e 986 uart_operation_config_t uart_hal_get_wait_mode_operation_config(uint32_t uartInstance);
bogdanm 82:6473597d706e 987
bogdanm 82:6473597d706e 988 /*!
bogdanm 82:6473597d706e 989 * @brief Configure the UART loopback operation.
bogdanm 82:6473597d706e 990 *
bogdanm 82:6473597d706e 991 * This function enables or disables the UART loopback operation.
bogdanm 82:6473597d706e 992 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 993 * before calling this function.
bogdanm 82:6473597d706e 994 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 995 *
bogdanm 82:6473597d706e 996 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 997 * @param enable The UART loopback mode configuration, either disabled (false) or enabled (true).
bogdanm 82:6473597d706e 998 */
bogdanm 82:6473597d706e 999 void uart_hal_configure_loopback_mode(uint32_t uartInstance, bool enable);
bogdanm 82:6473597d706e 1000
bogdanm 82:6473597d706e 1001 /*!
bogdanm 82:6473597d706e 1002 * @brief Configure the UART single-wire operation.
bogdanm 82:6473597d706e 1003 *
bogdanm 82:6473597d706e 1004 * This function enables or disables the UART single-wire operation.
bogdanm 82:6473597d706e 1005 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 1006 * before calling this function.
bogdanm 82:6473597d706e 1007 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 1008 *
bogdanm 82:6473597d706e 1009 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1010 * @param enable The UART single-wire mode configuration, either disabled (false) or enabled (true).
bogdanm 82:6473597d706e 1011 */
bogdanm 82:6473597d706e 1012 void uart_hal_configure_singlewire_mode(uint32_t uartInstance, bool enable);
bogdanm 82:6473597d706e 1013
bogdanm 82:6473597d706e 1014 /*!
bogdanm 82:6473597d706e 1015 * @brief Configure the UART transmit direction while in single-wire mode.
bogdanm 82:6473597d706e 1016 *
bogdanm 82:6473597d706e 1017 * This function configures the transmitter direction when the UART is configured for single-wire
bogdanm 82:6473597d706e 1018 * operation.
bogdanm 82:6473597d706e 1019 *
bogdanm 82:6473597d706e 1020 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1021 * @param direction The UART single-wire mode transmit direction configuration of type
bogdanm 82:6473597d706e 1022 * uart_singlewire_txdir_t (either kUartSinglewireTxdirIn or
bogdanm 82:6473597d706e 1023 * kUartSinglewireTxdirOut.
bogdanm 82:6473597d706e 1024 */
bogdanm 82:6473597d706e 1025 void uart_hal_configure_txdir_in_singlewire_mode(uint32_t uartInstance,
bogdanm 82:6473597d706e 1026 uart_singlewire_txdir_t direction);
bogdanm 82:6473597d706e 1027
bogdanm 82:6473597d706e 1028 /*!
bogdanm 82:6473597d706e 1029 * @brief Place the UART receiver in standby mode.
bogdanm 82:6473597d706e 1030 *
bogdanm 82:6473597d706e 1031 * This function, when called, places the UART receiver into standby mode.
bogdanm 82:6473597d706e 1032 * In some UART instances, there are conditions that must be met before placing rx in standby mode.
bogdanm 82:6473597d706e 1033 * Before placing UART in standby, determine if receiver is set to
bogdanm 82:6473597d706e 1034 * wake on idle, and if receiver is already in idle state.
bogdanm 82:6473597d706e 1035 * NOTE: RWU should only be set with C1[WAKE] = 0 (wakeup on idle) if the channel is currently
bogdanm 82:6473597d706e 1036 * not idle.
bogdanm 82:6473597d706e 1037 * This can be determined by the S2[RAF] flag. If set to wake up FROM an IDLE event and the channel
bogdanm 82:6473597d706e 1038 * is already idle, it is possible that the UART will discard data because data must be received
bogdanm 82:6473597d706e 1039 * (or a LIN break detect) after an IDLE is detected before IDLE is allowed to be reasserted.
bogdanm 82:6473597d706e 1040 *
bogdanm 82:6473597d706e 1041 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1042 * @return Error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 1043 */
bogdanm 82:6473597d706e 1044 uart_status_t uart_hal_put_receiver_in_standby_mode(uint32_t uartInstance);
bogdanm 82:6473597d706e 1045
bogdanm 82:6473597d706e 1046 /*!
bogdanm 82:6473597d706e 1047 * @brief Place the UART receiver in normal mode (disable standby mode operation).
bogdanm 82:6473597d706e 1048 *
bogdanm 82:6473597d706e 1049 * This function, when called, places the UART receiver into normal mode and out of
bogdanm 82:6473597d706e 1050 * standby mode.
bogdanm 82:6473597d706e 1051 *
bogdanm 82:6473597d706e 1052 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1053 */
bogdanm 82:6473597d706e 1054 void uart_hal_put_receiver_in_normal_mode(uint32_t uartInstance);
bogdanm 82:6473597d706e 1055
bogdanm 82:6473597d706e 1056 /*!
bogdanm 82:6473597d706e 1057 * @brief Determine if the UART receiver is currently in standby mode.
bogdanm 82:6473597d706e 1058 *
bogdanm 82:6473597d706e 1059 * This function determines the state of the UART receiver. If it returns true, this means
bogdanm 82:6473597d706e 1060 * that the UART receiver is in standby mode; if it returns false, the UART receiver
bogdanm 82:6473597d706e 1061 * is in normal mode.
bogdanm 82:6473597d706e 1062 *
bogdanm 82:6473597d706e 1063 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1064 * @return The UART receiver is in normal mode (false) or standby mode (true).
bogdanm 82:6473597d706e 1065 */
bogdanm 82:6473597d706e 1066 bool uart_hal_is_receiver_in_standby(uint32_t uartInstance);
bogdanm 82:6473597d706e 1067
bogdanm 82:6473597d706e 1068 /*!
bogdanm 82:6473597d706e 1069 * @brief Select the UART receiver wakeup method (idle-line or address-mark) from standby mode.
bogdanm 82:6473597d706e 1070 *
bogdanm 82:6473597d706e 1071 * This function configures the wakeup method of the UART receiver from standby mode. The options
bogdanm 82:6473597d706e 1072 * are idle-line wake or address-mark wake.
bogdanm 82:6473597d706e 1073 *
bogdanm 82:6473597d706e 1074 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1075 * @param method The UART receiver wakeup method options: kUartIdleLineWake - Idle-line wake or
bogdanm 82:6473597d706e 1076 * kUartAddrMarkWake - address-mark wake.
bogdanm 82:6473597d706e 1077 */
bogdanm 82:6473597d706e 1078 void uart_hal_select_receiver_wakeup_method(uint32_t uartInstance, uart_wakeup_method_t method);
bogdanm 82:6473597d706e 1079
bogdanm 82:6473597d706e 1080 /*!
bogdanm 82:6473597d706e 1081 * @brief Get the UART receiver wakeup method (idle-line or address-mark) from standby mode.
bogdanm 82:6473597d706e 1082 *
bogdanm 82:6473597d706e 1083 * This function returns how the UART receiver is configured to wake from standby mode. The
bogdanm 82:6473597d706e 1084 * wake method options that can be returned are kUartIdleLineWake or kUartAddrMarkWake.
bogdanm 82:6473597d706e 1085 *
bogdanm 82:6473597d706e 1086 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1087 * @return The UART receiver wakeup from standby method, false: kUartIdleLineWake (idle-line wake)
bogdanm 82:6473597d706e 1088 * or true: kUartAddrMarkWake (address-mark wake).
bogdanm 82:6473597d706e 1089 */
bogdanm 82:6473597d706e 1090 uart_wakeup_method_t uart_hal_get_receiver_wakeup_method(uint32_t uartInstance);
bogdanm 82:6473597d706e 1091
bogdanm 82:6473597d706e 1092 /*!
bogdanm 82:6473597d706e 1093 * @brief Configure the operation options of the UART idle line detect.
bogdanm 82:6473597d706e 1094 *
bogdanm 82:6473597d706e 1095 * This function allows the user to configure the UART idle-line detect operation. There are two
bogdanm 82:6473597d706e 1096 * separate operations for the user to configure, the idle line bit-count start and the receive
bogdanm 82:6473597d706e 1097 * wake up affect on IDLE status bit. The user will pass in a structure of type
bogdanm 82:6473597d706e 1098 * uart_idle_line_config_t.
bogdanm 82:6473597d706e 1099 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 1100 * before calling this function.
bogdanm 82:6473597d706e 1101 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 1102 *
bogdanm 82:6473597d706e 1103 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1104 * @param config The UART configuration pointer to the structure for idle-line detect operation
bogdanm 82:6473597d706e 1105 * of type uart_idle_line_config_t.
bogdanm 82:6473597d706e 1106 */
bogdanm 82:6473597d706e 1107 void uart_hal_configure_idle_line_detect(uint32_t uartInstance,
bogdanm 82:6473597d706e 1108 const uart_idle_line_config_t *config);
bogdanm 82:6473597d706e 1109
bogdanm 82:6473597d706e 1110 /*!
bogdanm 82:6473597d706e 1111 * @brief Configure the UART break character transmit length.
bogdanm 82:6473597d706e 1112 *
bogdanm 82:6473597d706e 1113 * This function allows the user to configure the UART break character transmit length. Refer to
bogdanm 82:6473597d706e 1114 * the typedef uart_break_char_length_t for setting options.
bogdanm 82:6473597d706e 1115 * In some UART instances it is required that the transmitter be disabled before calling
bogdanm 82:6473597d706e 1116 * this function. This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 1117 *
bogdanm 82:6473597d706e 1118 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1119 * @param length The UART break character length setting of type uart_break_char_length_t, either a
bogdanm 82:6473597d706e 1120 * minimum 10-bit times or a minimum 13-bit times.
bogdanm 82:6473597d706e 1121 */
bogdanm 82:6473597d706e 1122 void uart_hal_set_break_char_transmit_length(uint32_t uartInstance,
bogdanm 82:6473597d706e 1123 uart_break_char_length_t length);
bogdanm 82:6473597d706e 1124
bogdanm 82:6473597d706e 1125 /*!
bogdanm 82:6473597d706e 1126 * @brief Configure the UART break character detect length.
bogdanm 82:6473597d706e 1127 *
bogdanm 82:6473597d706e 1128 * This function allows the user to configure the UART break character detect length. Refer to
bogdanm 82:6473597d706e 1129 * the typedef uart_break_char_length_t for setting options.
bogdanm 82:6473597d706e 1130 *
bogdanm 82:6473597d706e 1131 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1132 * @param length The UART break character length setting of type uart_break_char_length_t, either a
bogdanm 82:6473597d706e 1133 * minimum 10-bit times or a minimum 13-bit times.
bogdanm 82:6473597d706e 1134 */
bogdanm 82:6473597d706e 1135 void uart_hal_set_break_char_detect_length(uint32_t uartInstance,
bogdanm 82:6473597d706e 1136 uart_break_char_length_t length);
bogdanm 82:6473597d706e 1137
bogdanm 82:6473597d706e 1138 /*!
bogdanm 82:6473597d706e 1139 * @brief Configure the UART transmit send break character operation.
bogdanm 82:6473597d706e 1140 *
bogdanm 82:6473597d706e 1141 * This function allows the user to queue a UART break character to send. If true is passed into
bogdanm 82:6473597d706e 1142 * the function, then a break character is queued for transmission. A break character will
bogdanm 82:6473597d706e 1143 * continuously be queued until this function is called again when a false is passed into this
bogdanm 82:6473597d706e 1144 * function.
bogdanm 82:6473597d706e 1145 *
bogdanm 82:6473597d706e 1146 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1147 * @param enable If false, the UART normal/queue break character setting is disabled, which
bogdanm 82:6473597d706e 1148 * configures the UART for normal transmitter operation. If true, a break
bogdanm 82:6473597d706e 1149 * character is queued for transmission.
bogdanm 82:6473597d706e 1150 */
bogdanm 82:6473597d706e 1151 void uart_hal_queue_break_char_to_send(uint32_t uartInstance, bool enable);
bogdanm 82:6473597d706e 1152
bogdanm 82:6473597d706e 1153 /*!
bogdanm 82:6473597d706e 1154 * @brief Configure the UART match address mode control operation. (Note: Feature available on
bogdanm 82:6473597d706e 1155 * select UART instances)
bogdanm 82:6473597d706e 1156 *
bogdanm 82:6473597d706e 1157 * The function allows the user to configure the UART match address control operation. The user
bogdanm 82:6473597d706e 1158 * has the option to enable the match address mode and to program the match address value. There
bogdanm 82:6473597d706e 1159 * are two match address modes, each with its own enable and programmable match address value.
bogdanm 82:6473597d706e 1160 *
bogdanm 82:6473597d706e 1161 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1162 * @param matchAddrMode1 If true, this enables match address mode 1 (MAEN1), where false disables.
bogdanm 82:6473597d706e 1163 * @param matchAddrMode2 If true, this enables match address mode 2 (MAEN2), where false disables.
bogdanm 82:6473597d706e 1164 * @param matchAddrValue1 The match address value to program for match address mode 1.
bogdanm 82:6473597d706e 1165 * @param matchAddrValue2 The match address value to program for match address mode 2.
bogdanm 82:6473597d706e 1166 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 1167 */
bogdanm 82:6473597d706e 1168 uart_status_t uart_hal_configure_match_address_operation(
bogdanm 82:6473597d706e 1169 uint32_t uartInstance,
bogdanm 82:6473597d706e 1170 bool matchAddrMode1,
bogdanm 82:6473597d706e 1171 bool matchAddrMode2,
bogdanm 82:6473597d706e 1172 uint8_t matchAddrValue1,
bogdanm 82:6473597d706e 1173 uint8_t matchAddrValue2);
bogdanm 82:6473597d706e 1174
bogdanm 82:6473597d706e 1175 /*!
bogdanm 82:6473597d706e 1176 * @brief Configure the UART to send data MSB first
bogdanm 82:6473597d706e 1177 * (Note: Feature available on select UART instances)
bogdanm 82:6473597d706e 1178 *
bogdanm 82:6473597d706e 1179 * The function allows the user to configure the UART to send data MSB first or LSB first.
bogdanm 82:6473597d706e 1180 * In some UART instances it is required that the transmitter/receiver be disabled
bogdanm 82:6473597d706e 1181 * before calling this function.
bogdanm 82:6473597d706e 1182 * This may be applied to all UARTs to ensure safe operation.
bogdanm 82:6473597d706e 1183 *
bogdanm 82:6473597d706e 1184 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1185 * @param enable This configures send MSB first mode configuration. If true, the data is sent MSB
bogdanm 82:6473597d706e 1186 * first; if false, it is sent LSB first.
bogdanm 82:6473597d706e 1187 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 1188 */
bogdanm 82:6473597d706e 1189 uart_status_t uart_hal_configure_send_msb_first_operation(uint32_t uartInstance, bool enable);
bogdanm 82:6473597d706e 1190
bogdanm 82:6473597d706e 1191 /*!
bogdanm 82:6473597d706e 1192 * @brief Configuration option to disable the UART resynchronization during received data.
bogdanm 82:6473597d706e 1193 * (Note: Feature available on select UART instances)
bogdanm 82:6473597d706e 1194 *
bogdanm 82:6473597d706e 1195 * This function allows the user to disable the UART resync of received data. The default setting
bogdanm 82:6473597d706e 1196 * is false, meaning that resynchronization during the received data word is supported.
bogdanm 82:6473597d706e 1197 * If the user passes in true, this disables resynchronization during the received data word.
bogdanm 82:6473597d706e 1198 *
bogdanm 82:6473597d706e 1199 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1200 * @param enable If false, then resynchronization during the received data word is supported.
bogdanm 82:6473597d706e 1201 * If true, resynchronization during the received data word is disabled.
bogdanm 82:6473597d706e 1202 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 1203 */
bogdanm 82:6473597d706e 1204 uart_status_t uart_hal_configure_receive_resync_disable_operation(uint32_t uartInstance,
bogdanm 82:6473597d706e 1205 bool enable);
bogdanm 82:6473597d706e 1206
bogdanm 82:6473597d706e 1207 #if FSL_FEATURE_UART_HAS_MODEM_SUPPORT
bogdanm 82:6473597d706e 1208 /*!
bogdanm 82:6473597d706e 1209 * @brief Enable the UART receiver request-to-send functionality.
bogdanm 82:6473597d706e 1210 *
bogdanm 82:6473597d706e 1211 * This function allows the user to enable the UART receiver request-to-send (RTS) functionality.
bogdanm 82:6473597d706e 1212 * By enabling, it allows the RTS output to control the CTS input of the transmitting device to
bogdanm 82:6473597d706e 1213 * prevent receiver overrun. RTS is deasserted if the number of characters in the receiver data
bogdanm 82:6473597d706e 1214 * register (FIFO) is equal to or greater than RWFIFO[RXWATER]. RTS is asserted when the
bogdanm 82:6473597d706e 1215 * number of characters in the receiver data register (FIFO) is less than RWFIFO[RXWATER].
bogdanm 82:6473597d706e 1216 * Do not set both RXRTSE and TXRTSE.
bogdanm 82:6473597d706e 1217 *
bogdanm 82:6473597d706e 1218 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1219 */
bogdanm 82:6473597d706e 1220 void uart_hal_enable_receiver_rts(uint32_t uartInstance);
bogdanm 82:6473597d706e 1221
bogdanm 82:6473597d706e 1222 /*!
bogdanm 82:6473597d706e 1223 * @brief Disable the UART receiver request-to-send functionality.
bogdanm 82:6473597d706e 1224 *
bogdanm 82:6473597d706e 1225 * This function allows the user to disable the UART receiver request-to-send (RTS) functionality.
bogdanm 82:6473597d706e 1226 *
bogdanm 82:6473597d706e 1227 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1228 */
bogdanm 82:6473597d706e 1229 void uart_hal_disable_receiver_rts(uint32_t uartInstance);
bogdanm 82:6473597d706e 1230
bogdanm 82:6473597d706e 1231 /*!
bogdanm 82:6473597d706e 1232 * @brief Enable the UART transmitter request-to-send functionality.
bogdanm 82:6473597d706e 1233 *
bogdanm 82:6473597d706e 1234 * This function allows the user to enable the UART transmitter request-to-send (RTS) functionality.
bogdanm 82:6473597d706e 1235 * When enabled, it allows the UART to control the RTS assertion before and after a transmission
bogdanm 82:6473597d706e 1236 * such that when a character is placed into an empty transmitter data buffer, RTS
bogdanm 82:6473597d706e 1237 * asserts one bit time before the start bit is transmitted. RTS deasserts one bit time after all
bogdanm 82:6473597d706e 1238 * characters in the transmitter data buffer and shift register are completely sent, including
bogdanm 82:6473597d706e 1239 * the last stop bit.
bogdanm 82:6473597d706e 1240 *
bogdanm 82:6473597d706e 1241 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1242 */
bogdanm 82:6473597d706e 1243 void uart_hal_enable_transmitter_rts(uint32_t uartInstance);
bogdanm 82:6473597d706e 1244
bogdanm 82:6473597d706e 1245 /*!
bogdanm 82:6473597d706e 1246 * @brief Disable the UART transmitter request-to-send functionality.
bogdanm 82:6473597d706e 1247 *
bogdanm 82:6473597d706e 1248 * This function allows the user to disable the UART transmitter request-to-send (RTS)
bogdanm 82:6473597d706e 1249 * functionality.
bogdanm 82:6473597d706e 1250 *
bogdanm 82:6473597d706e 1251 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1252 */
bogdanm 82:6473597d706e 1253 void uart_hal_disable_transmitter_rts(uint32_t uartInstance);
bogdanm 82:6473597d706e 1254
bogdanm 82:6473597d706e 1255 /*!
bogdanm 82:6473597d706e 1256 * @brief Configure the UART transmitter RTS polarity.
bogdanm 82:6473597d706e 1257 *
bogdanm 82:6473597d706e 1258 * This function allows the user configure the transmitter RTS polarity to be either active low
bogdanm 82:6473597d706e 1259 * or active high.
bogdanm 82:6473597d706e 1260 *
bogdanm 82:6473597d706e 1261 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1262 * @param polarity The UART transmitter RTS polarity setting (false - active low,
bogdanm 82:6473597d706e 1263 * true - active high).
bogdanm 82:6473597d706e 1264 */
bogdanm 82:6473597d706e 1265 void uart_hal_configure_transmitter_rts_polarity(uint32_t uartInstance, bool polarity);
bogdanm 82:6473597d706e 1266
bogdanm 82:6473597d706e 1267 /*!
bogdanm 82:6473597d706e 1268 * @brief Enable the UART transmitter clear-to-send functionality.
bogdanm 82:6473597d706e 1269 *
bogdanm 82:6473597d706e 1270 * This function allows the user to enable the UART transmitter clear-to-send (CTS) functionality.
bogdanm 82:6473597d706e 1271 * When enabled, the transmitter checks the state of CTS each time it is ready to send a character.
bogdanm 82:6473597d706e 1272 * If CTS is asserted, the character is sent. If CTS is deasserted, the signal TXD remains in
bogdanm 82:6473597d706e 1273 * the mark state and transmission is delayed until CTS is asserted. Changes in CTS as a
bogdanm 82:6473597d706e 1274 * character is being sent do not affect its transmission.
bogdanm 82:6473597d706e 1275 *
bogdanm 82:6473597d706e 1276 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1277 */
bogdanm 82:6473597d706e 1278 void uart_hal_enable_transmitter_cts(uint32_t uartInstance);
bogdanm 82:6473597d706e 1279
bogdanm 82:6473597d706e 1280 /*!
bogdanm 82:6473597d706e 1281 * @brief Disable the UART transmitter clear-to-send functionality.
bogdanm 82:6473597d706e 1282 *
bogdanm 82:6473597d706e 1283 * This function allows the user to disable the UART transmitter clear-to-send (CTS)
bogdanm 82:6473597d706e 1284 * functionality.
bogdanm 82:6473597d706e 1285 *
bogdanm 82:6473597d706e 1286 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1287 */
bogdanm 82:6473597d706e 1288 void uart_hal_disable_transmitter_cts(uint32_t uartInstance);
bogdanm 82:6473597d706e 1289 #endif /* FSL_FEATURE_UART_HAS_MODEM_SUPPORT*/
bogdanm 82:6473597d706e 1290
bogdanm 82:6473597d706e 1291 #if FSL_FEATURE_UART_HAS_IR_SUPPORT
bogdanm 82:6473597d706e 1292 /*!
bogdanm 82:6473597d706e 1293 * @brief Configure the UART infrared operation.
bogdanm 82:6473597d706e 1294 *
bogdanm 82:6473597d706e 1295 * The function allows the user to enable or disable the UART infrared (IR) operation
bogdanm 82:6473597d706e 1296 * and to configure the IR pulse width.
bogdanm 82:6473597d706e 1297 *
bogdanm 82:6473597d706e 1298 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1299 * @param enable Enable (true) or disable (false) the infrared operation.
bogdanm 82:6473597d706e 1300 * @param pulseWidth The UART transmit narrow pulse width setting of type uart_ir_tx_pulsewidth_t.
bogdanm 82:6473597d706e 1301 */
bogdanm 82:6473597d706e 1302 void uart_hal_configure_infrared_operation(uint32_t uartInstance, bool enable,
bogdanm 82:6473597d706e 1303 uart_ir_tx_pulsewidth_t pulseWidth);
bogdanm 82:6473597d706e 1304 #endif /* FSL_FEATURE_UART_HAS_IR_SUPPORT*/
bogdanm 82:6473597d706e 1305
bogdanm 82:6473597d706e 1306 /*@}*/
bogdanm 82:6473597d706e 1307
bogdanm 82:6473597d706e 1308 /*!
bogdanm 82:6473597d706e 1309 * @name UART Status Flags
bogdanm 82:6473597d706e 1310 * @{
bogdanm 82:6473597d706e 1311 */
bogdanm 82:6473597d706e 1312
bogdanm 82:6473597d706e 1313 /*!
bogdanm 82:6473597d706e 1314 * @brief Get all of the UART status flag states.
bogdanm 82:6473597d706e 1315 *
bogdanm 82:6473597d706e 1316 * This function gets all of the UART status flag states and places into a structure of
bogdanm 82:6473597d706e 1317 * type uart_status_flag_all_t. The user must pass in a pointer to this structure.
bogdanm 82:6473597d706e 1318 *
bogdanm 82:6473597d706e 1319 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1320 * @param allStatusFlag Pointer to the structure of all the UART status flags states.
bogdanm 82:6473597d706e 1321 */
bogdanm 82:6473597d706e 1322 void uart_hal_get_all_status_flag(uint32_t uartInstance, uart_status_flag_all_t *allStatusFlag);
bogdanm 82:6473597d706e 1323
bogdanm 82:6473597d706e 1324 /*!
bogdanm 82:6473597d706e 1325 * @brief Get the UART Transmit data register empty flag.
bogdanm 82:6473597d706e 1326 *
bogdanm 82:6473597d706e 1327 * This function returns the state of the UART Transmit data register empty flag.
bogdanm 82:6473597d706e 1328 *
bogdanm 82:6473597d706e 1329 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1330 * @return The status of Transmit data register empty flag, which is set when transmit buffer
bogdanm 82:6473597d706e 1331 * is empty.
bogdanm 82:6473597d706e 1332 */
bogdanm 82:6473597d706e 1333 bool uart_hal_is_transmit_data_register_empty(uint32_t uartInstance);
bogdanm 82:6473597d706e 1334
bogdanm 82:6473597d706e 1335 /*!
bogdanm 82:6473597d706e 1336 * @brief Get the UART Transmission complete flag.
bogdanm 82:6473597d706e 1337 *
bogdanm 82:6473597d706e 1338 * This function returns the state of the UART Transmission complete flag.
bogdanm 82:6473597d706e 1339 *
bogdanm 82:6473597d706e 1340 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1341 * @return The status of Transmission complete flag, which is set when the transmitter is idle
bogdanm 82:6473597d706e 1342 * (transmission activity complete).
bogdanm 82:6473597d706e 1343 */
bogdanm 82:6473597d706e 1344 bool uart_hal_is_transmission_complete(uint32_t uartInstance);
bogdanm 82:6473597d706e 1345
bogdanm 82:6473597d706e 1346 /*!
bogdanm 82:6473597d706e 1347 * @brief Get the UART Receive data register full flag.
bogdanm 82:6473597d706e 1348 *
bogdanm 82:6473597d706e 1349 * This function returns the state of the UART Receive data register full flag.
bogdanm 82:6473597d706e 1350 *
bogdanm 82:6473597d706e 1351 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1352 * @return The status of Receive data register full flag, which is set when the receive data buffer
bogdanm 82:6473597d706e 1353 * is full.
bogdanm 82:6473597d706e 1354 */
bogdanm 82:6473597d706e 1355 bool uart_hal_is_receive_data_register_full(uint32_t uartInstance);
bogdanm 82:6473597d706e 1356
bogdanm 82:6473597d706e 1357 /*!
bogdanm 82:6473597d706e 1358 * @brief Get the UART Idle-line detect flag.
bogdanm 82:6473597d706e 1359 *
bogdanm 82:6473597d706e 1360 * This function returns the state of the UART Idle-line detect flag.
bogdanm 82:6473597d706e 1361 *
bogdanm 82:6473597d706e 1362 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1363 * @return The status of Idle-line detect flag which is set when an idle-line detected.
bogdanm 82:6473597d706e 1364 */
bogdanm 82:6473597d706e 1365 bool uart_hal_is_idle_line_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1366
bogdanm 82:6473597d706e 1367 /*!
bogdanm 82:6473597d706e 1368 * @brief Get the UART Receiver Overrun status flag.
bogdanm 82:6473597d706e 1369 *
bogdanm 82:6473597d706e 1370 * This function returns the state of the the UART Receiver Overrun status flag.
bogdanm 82:6473597d706e 1371 *
bogdanm 82:6473597d706e 1372 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1373 * @return The status of Receiver Overrun, which is set when new data is received before data is
bogdanm 82:6473597d706e 1374 * read from receive register.
bogdanm 82:6473597d706e 1375 */
bogdanm 82:6473597d706e 1376 bool uart_hal_is_receive_overrun_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1377
bogdanm 82:6473597d706e 1378 /*!
bogdanm 82:6473597d706e 1379 * @brief Get the UART noise status flag.
bogdanm 82:6473597d706e 1380 *
bogdanm 82:6473597d706e 1381 * This function returns the state of the UART noise status flag.
bogdanm 82:6473597d706e 1382 *
bogdanm 82:6473597d706e 1383 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1384 * @return The status of the noise flag, which is set if any of the 3 samples taken on
bogdanm 82:6473597d706e 1385 * receive differ.
bogdanm 82:6473597d706e 1386 */
bogdanm 82:6473597d706e 1387 bool uart_hal_is_noise_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1388
bogdanm 82:6473597d706e 1389 /*!
bogdanm 82:6473597d706e 1390 * @brief Get the UART Frame error status flag.
bogdanm 82:6473597d706e 1391 *
bogdanm 82:6473597d706e 1392 * This function returns the state of the UART Frame error status flag.
bogdanm 82:6473597d706e 1393 *
bogdanm 82:6473597d706e 1394 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1395 * @return The status of Frame error flag, which is set if a logic 0 was detected where a stop bit
bogdanm 82:6473597d706e 1396 * was expected.
bogdanm 82:6473597d706e 1397 */
bogdanm 82:6473597d706e 1398 bool uart_hal_is_frame_error_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1399
bogdanm 82:6473597d706e 1400 /*!
bogdanm 82:6473597d706e 1401 * @brief Get the UART parity error status flag.
bogdanm 82:6473597d706e 1402 *
bogdanm 82:6473597d706e 1403 * This function returns the state of the UART parity error status flag.
bogdanm 82:6473597d706e 1404 *
bogdanm 82:6473597d706e 1405 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1406 * @return The status of parity error detection flag, which is set if parity mode enabled and the
bogdanm 82:6473597d706e 1407 * parity bit received does not match what was expected.
bogdanm 82:6473597d706e 1408 */
bogdanm 82:6473597d706e 1409 bool uart_hal_is_parity_error_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1410
bogdanm 82:6473597d706e 1411 /*!
bogdanm 82:6473597d706e 1412 * @brief Get the UART LIN break detect interrupt status flag.
bogdanm 82:6473597d706e 1413 *
bogdanm 82:6473597d706e 1414 * This function returns the state of the UART LIN break detect interrupt status flag.
bogdanm 82:6473597d706e 1415 *
bogdanm 82:6473597d706e 1416 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1417 * @return The status of LIN break detect interrupt flag, which is set when the LIN break char
bogdanm 82:6473597d706e 1418 * is detected assuming the LIN circuit is enabled.
bogdanm 82:6473597d706e 1419 */
bogdanm 82:6473597d706e 1420 bool uart_hal_is_line_break_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1421
bogdanm 82:6473597d706e 1422 /*!
bogdanm 82:6473597d706e 1423 * @brief Get the UART Receive pin active edge interrupt status flag.
bogdanm 82:6473597d706e 1424 *
bogdanm 82:6473597d706e 1425 * This function returns the state of the UART Receive pin active edge interrupt status flag.
bogdanm 82:6473597d706e 1426 *
bogdanm 82:6473597d706e 1427 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1428 * @return The status of Receive pin active edge interrupt flag, which is set when active edge
bogdanm 82:6473597d706e 1429 * detected on the receive pin.
bogdanm 82:6473597d706e 1430 */
bogdanm 82:6473597d706e 1431 bool uart_hal_is_receive_active_edge_detected(uint32_t uartInstance);
bogdanm 82:6473597d706e 1432
bogdanm 82:6473597d706e 1433 /*!
bogdanm 82:6473597d706e 1434 * @brief Get the UART Receiver Active Flag (RAF) state.
bogdanm 82:6473597d706e 1435 *
bogdanm 82:6473597d706e 1436 * This function returns the state of the UART Receiver Active Flag (RAF).
bogdanm 82:6473597d706e 1437 *
bogdanm 82:6473597d706e 1438 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1439 * @return The status of the Receiver Active Flag (RAF), which is set at the beginning of a
bogdanm 82:6473597d706e 1440 * received valid start bit.
bogdanm 82:6473597d706e 1441 */
bogdanm 82:6473597d706e 1442 bool uart_hal_is_receiver_active(uint32_t uartInstance);
bogdanm 82:6473597d706e 1443
bogdanm 82:6473597d706e 1444 /*!
bogdanm 82:6473597d706e 1445 * @brief Clear an individual and specific UART status flag.
bogdanm 82:6473597d706e 1446 *
bogdanm 82:6473597d706e 1447 * This function allows the user to clear an individual and specific UART status flag. Refer to
bogdanm 82:6473597d706e 1448 * structure definition uart_status_flag_t for list of status bits.
bogdanm 82:6473597d706e 1449 *
bogdanm 82:6473597d706e 1450 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1451 * @param statusFlag The desired UART status flag to clear.
bogdanm 82:6473597d706e 1452 * @return An error code or kStatus_UART_Success.
bogdanm 82:6473597d706e 1453 */
bogdanm 82:6473597d706e 1454 uart_status_t uart_hal_clear_status_flag(uint32_t uartInstance, uart_status_flag_t statusFlag);
bogdanm 82:6473597d706e 1455
bogdanm 82:6473597d706e 1456 /*!
bogdanm 82:6473597d706e 1457 * @brief Clear ALL of the UART status flags.
bogdanm 82:6473597d706e 1458 *
bogdanm 82:6473597d706e 1459 * This function tries to clear all of the UART status flags. In some cases, some of the status
bogdanm 82:6473597d706e 1460 * flags may not get cleared because the condition that set the flag may still exist.
bogdanm 82:6473597d706e 1461 *
bogdanm 82:6473597d706e 1462 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1463 */
bogdanm 82:6473597d706e 1464 void uart_hal_clear_all_non_autoclear_status_flags(uint32_t uartInstance);
bogdanm 82:6473597d706e 1465
bogdanm 82:6473597d706e 1466 /*@}*/
bogdanm 82:6473597d706e 1467
bogdanm 82:6473597d706e 1468 /*!
bogdanm 82:6473597d706e 1469 * @name UART FIFO Configurations
bogdanm 82:6473597d706e 1470 * @{
bogdanm 82:6473597d706e 1471 */
bogdanm 82:6473597d706e 1472
bogdanm 82:6473597d706e 1473 #if FSL_FEATURE_UART_HAS_FIFO
bogdanm 82:6473597d706e 1474 /*!
bogdanm 82:6473597d706e 1475 * @brief Enable the UART transmit FIFO.
bogdanm 82:6473597d706e 1476 *
bogdanm 82:6473597d706e 1477 * This function allows the user to enable the UART transmit FIFO.
bogdanm 82:6473597d706e 1478 * It is required that the transmitter/receiver be disabled before calling this function
bogdanm 82:6473597d706e 1479 * when the FIFO is empty.
bogdanm 82:6473597d706e 1480 * Additionally, TXFLUSH and RXFLUSH commands should be issued after calling this function.
bogdanm 82:6473597d706e 1481 *
bogdanm 82:6473597d706e 1482 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1483 * @return Error code if it is detected that the transmitter or receiver is enabled or
bogdanm 82:6473597d706e 1484 * kStatus_UART_Success.
bogdanm 82:6473597d706e 1485 */
bogdanm 82:6473597d706e 1486 uart_status_t uart_hal_enable_tx_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1487
bogdanm 82:6473597d706e 1488 /*!
bogdanm 82:6473597d706e 1489 * @brief Disable the UART transmit FIFO.
bogdanm 82:6473597d706e 1490 *
bogdanm 82:6473597d706e 1491 * This function allows the user to disable the UART transmit FIFO.
bogdanm 82:6473597d706e 1492 * It is required that the transmitter/receiver be disabled before calling this function
bogdanm 82:6473597d706e 1493 * when the FIFO is empty.
bogdanm 82:6473597d706e 1494 * Additionally, TXFLUSH and RXFLUSH commands should be issued after calling this function.
bogdanm 82:6473597d706e 1495 *
bogdanm 82:6473597d706e 1496 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1497 * @return Error code if it is detected that the transmitter or receiver is enabled or
bogdanm 82:6473597d706e 1498 * kStatus_UART_Success.
bogdanm 82:6473597d706e 1499 */
bogdanm 82:6473597d706e 1500 uart_status_t uart_hal_disable_tx_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1501
bogdanm 82:6473597d706e 1502 /*!
bogdanm 82:6473597d706e 1503 * @brief Enable the UART receive FIFO.
bogdanm 82:6473597d706e 1504 *
bogdanm 82:6473597d706e 1505 * This function allows the user to enable the UART receive FIFO.
bogdanm 82:6473597d706e 1506 * It is required that the transmitter/receiver be disabled before calling this function
bogdanm 82:6473597d706e 1507 * when the FIFO is empty.
bogdanm 82:6473597d706e 1508 * Additionally, TXFLUSH and RXFLUSH commands should be issued after calling this function.
bogdanm 82:6473597d706e 1509 *
bogdanm 82:6473597d706e 1510 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1511 * @return Error code if it is detected that the transmitter or receiver is enabled or
bogdanm 82:6473597d706e 1512 * kStatus_UART_Success.
bogdanm 82:6473597d706e 1513 */
bogdanm 82:6473597d706e 1514 uart_status_t uart_hal_enable_rx_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1515
bogdanm 82:6473597d706e 1516 /*!
bogdanm 82:6473597d706e 1517 * @brief Disable the UART receive FIFO.
bogdanm 82:6473597d706e 1518 *
bogdanm 82:6473597d706e 1519 * This function allows the user to disable the UART receive FIFO.
bogdanm 82:6473597d706e 1520 * It is required that the transmitter/receiver be disabled before calling this function
bogdanm 82:6473597d706e 1521 * when the FIFO is empty.
bogdanm 82:6473597d706e 1522 * Additionally, TXFLUSH and RXFLUSH commands should be issued after calling this function.
bogdanm 82:6473597d706e 1523 *
bogdanm 82:6473597d706e 1524 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1525 * @return Error code if it is detected that the transmitter or receiver is enabled or
bogdanm 82:6473597d706e 1526 * kStatus_UART_Success.
bogdanm 82:6473597d706e 1527 */
bogdanm 82:6473597d706e 1528 uart_status_t uart_hal_disable_rx_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1529
bogdanm 82:6473597d706e 1530 /*!
bogdanm 82:6473597d706e 1531 * @brief Get the size of the UART transmit FIFO.
bogdanm 82:6473597d706e 1532 *
bogdanm 82:6473597d706e 1533 * This function returns the size (number of entries) supported in the UART transmit FIFO for
bogdanm 82:6473597d706e 1534 * a particular module instance.
bogdanm 82:6473597d706e 1535 *
bogdanm 82:6473597d706e 1536 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1537 * @return The UART transmit FIFO size as follows:
bogdanm 82:6473597d706e 1538 * 0x0: 1 data word; 0x1: 4 data words; 0x2: 8 data words; 0x3: 16 data words
bogdanm 82:6473597d706e 1539 * 0x4: 32 data words; 0x5: 64 data words; 0x6: 128 data words; 0x7: reserved
bogdanm 82:6473597d706e 1540 */
bogdanm 82:6473597d706e 1541 uint8_t uart_hal_get_tx_fifo_size(uint32_t uartInstance);
bogdanm 82:6473597d706e 1542
bogdanm 82:6473597d706e 1543 /*!
bogdanm 82:6473597d706e 1544 * @brief Get the size of the UART receive FIFO.
bogdanm 82:6473597d706e 1545 *
bogdanm 82:6473597d706e 1546 * This function returns the size (number of entries) supported in the UART receive FIFO for
bogdanm 82:6473597d706e 1547 * a particular module instance.
bogdanm 82:6473597d706e 1548 *
bogdanm 82:6473597d706e 1549 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1550 * @return The receive FIFO size as follows:
bogdanm 82:6473597d706e 1551 * 0x0: 1 data word; 0x1: 4 data words; 0x2: 8 data words; 0x3: 16 data words
bogdanm 82:6473597d706e 1552 * 0x4: 32 data words; 0x5: 64 data words; 0x6: 128 data words; 0x7: reserved
bogdanm 82:6473597d706e 1553 */
bogdanm 82:6473597d706e 1554 uint8_t uart_hal_get_rx_fifo_size(uint32_t uartInstance);
bogdanm 82:6473597d706e 1555
bogdanm 82:6473597d706e 1556 /*!
bogdanm 82:6473597d706e 1557 * @brief Flush the UART transmit FIFO.
bogdanm 82:6473597d706e 1558 *
bogdanm 82:6473597d706e 1559 * This function allows the user to flush the UART transmit FIFO for a particular module instance.
bogdanm 82:6473597d706e 1560 * Flushing the FIFO may result in data loss.
bogdanm 82:6473597d706e 1561 * It is recommended that the transmitter be disabled before calling this function.
bogdanm 82:6473597d706e 1562 *
bogdanm 82:6473597d706e 1563 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1564 * @return Error code if it is detected that the transmitter or receiver is enabled or
bogdanm 82:6473597d706e 1565 * kStatus_UART_Success.
bogdanm 82:6473597d706e 1566 */
bogdanm 82:6473597d706e 1567 uart_status_t uart_hal_flush_tx_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1568
bogdanm 82:6473597d706e 1569 /*!
bogdanm 82:6473597d706e 1570 * @brief Flush the UART receive FIFO.
bogdanm 82:6473597d706e 1571 *
bogdanm 82:6473597d706e 1572 * This function allows the user to flush the UART receive FIFO for a particular module instance.
bogdanm 82:6473597d706e 1573 * Flushing the FIFO may result in data loss.
bogdanm 82:6473597d706e 1574 * It is recommended that the receiver be disabled before calling this function.
bogdanm 82:6473597d706e 1575 *
bogdanm 82:6473597d706e 1576 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1577 * @return Error code if it is detected that the transmitter or receiver is enabled or
bogdanm 82:6473597d706e 1578 * kStatus_UART_Success.
bogdanm 82:6473597d706e 1579 */
bogdanm 82:6473597d706e 1580 uart_status_t uart_hal_flush_rx_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1581
bogdanm 82:6473597d706e 1582 /*!
bogdanm 82:6473597d706e 1583 * @brief Enable the UART transmit FIFO overflow interrupt.
bogdanm 82:6473597d706e 1584 *
bogdanm 82:6473597d706e 1585 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1586 */
bogdanm 82:6473597d706e 1587 void uart_hal_enable_tx_fifo_overflow_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 1588
bogdanm 82:6473597d706e 1589
bogdanm 82:6473597d706e 1590 /*!
bogdanm 82:6473597d706e 1591 * @brief Disable the UART transmit FIFO overflow interrupt.
bogdanm 82:6473597d706e 1592 *
bogdanm 82:6473597d706e 1593 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1594 */
bogdanm 82:6473597d706e 1595 void uart_hal_disable_tx_fifo_overflow_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 1596
bogdanm 82:6473597d706e 1597
bogdanm 82:6473597d706e 1598 /*!
bogdanm 82:6473597d706e 1599 * @brief Get the configuration of the UART transmit FIFO overflow interrupt enable.
bogdanm 82:6473597d706e 1600 *
bogdanm 82:6473597d706e 1601 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1602 * @return The UART transmit FIFO overflow interrupt enable state: true=enable; false=disable.
bogdanm 82:6473597d706e 1603 */
bogdanm 82:6473597d706e 1604 bool uart_hal_is_tx_fifo_overflow_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 1605
bogdanm 82:6473597d706e 1606
bogdanm 82:6473597d706e 1607 /*!
bogdanm 82:6473597d706e 1608 * @brief Enable the UART receive FIFO underflow interrupt.
bogdanm 82:6473597d706e 1609 *
bogdanm 82:6473597d706e 1610 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1611 */
bogdanm 82:6473597d706e 1612 void uart_hal_enable_rx_fifo_underflow_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 1613
bogdanm 82:6473597d706e 1614
bogdanm 82:6473597d706e 1615 /*!
bogdanm 82:6473597d706e 1616 * @brief Disable the UART receive FIFO underflow interrupt.
bogdanm 82:6473597d706e 1617 *
bogdanm 82:6473597d706e 1618 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1619 */
bogdanm 82:6473597d706e 1620 void uart_hal_disable_rx_fifo_underflow_interrupt(uint32_t uartInstance);
bogdanm 82:6473597d706e 1621
bogdanm 82:6473597d706e 1622
bogdanm 82:6473597d706e 1623 /*!
bogdanm 82:6473597d706e 1624 * @brief Get the configuration of the UART receive FIFO underflow interrupt enable.
bogdanm 82:6473597d706e 1625 *
bogdanm 82:6473597d706e 1626 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1627 * @return The UART receive FIFO underflow interrupt enable state: true=enable; false=disable.
bogdanm 82:6473597d706e 1628 */
bogdanm 82:6473597d706e 1629 bool uart_hal_is_rx_fifo_underflow_interrupt_enabled(uint32_t uartInstance);
bogdanm 82:6473597d706e 1630
bogdanm 82:6473597d706e 1631 /*!
bogdanm 82:6473597d706e 1632 * @brief Get the UART transmit FIFO empty status state.
bogdanm 82:6473597d706e 1633 *
bogdanm 82:6473597d706e 1634 * The function returns the state of the transmit FIFO empty status state, but does not take into
bogdanm 82:6473597d706e 1635 * account data in the shift register.
bogdanm 82:6473597d706e 1636 *
bogdanm 82:6473597d706e 1637 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1638 * @return The UART transmit FIFO empty status: true=empty; false=not-empty.
bogdanm 82:6473597d706e 1639 */
bogdanm 82:6473597d706e 1640 bool uart_hal_is_tx_fifo_empty(uint32_t uartInstance);
bogdanm 82:6473597d706e 1641
bogdanm 82:6473597d706e 1642 /*!
bogdanm 82:6473597d706e 1643 * @brief Get the UART receive FIFO empty status state.
bogdanm 82:6473597d706e 1644 *
bogdanm 82:6473597d706e 1645 * The function returns the state of the receive FIFO empty status state, but does not take into
bogdanm 82:6473597d706e 1646 * account data in the shift register.
bogdanm 82:6473597d706e 1647 *
bogdanm 82:6473597d706e 1648 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1649 * @return The UART receive FIFO empty status: true=empty; false=not-empty.
bogdanm 82:6473597d706e 1650 */
bogdanm 82:6473597d706e 1651 bool uart_hal_is_rx_fifo_empty(uint32_t uartInstance);
bogdanm 82:6473597d706e 1652
bogdanm 82:6473597d706e 1653 /*!
bogdanm 82:6473597d706e 1654 * @brief Get the UART transmit FIFO overflow status state.
bogdanm 82:6473597d706e 1655 *
bogdanm 82:6473597d706e 1656 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1657 * @return The UART transmit FIFO overflow status state: true=overflow; false=no overflow.
bogdanm 82:6473597d706e 1658 */
bogdanm 82:6473597d706e 1659 bool uart_hal_is_tx_fifo_overflow(uint32_t uartInstance);
bogdanm 82:6473597d706e 1660
bogdanm 82:6473597d706e 1661 /*!
bogdanm 82:6473597d706e 1662 * @brief Clear the UART transmit FIFO overflow status.
bogdanm 82:6473597d706e 1663 *
bogdanm 82:6473597d706e 1664 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1665 */
bogdanm 82:6473597d706e 1666 void uart_hal_clear_tx_fifo_overflow(uint32_t uartInstance);
bogdanm 82:6473597d706e 1667
bogdanm 82:6473597d706e 1668 /*!
bogdanm 82:6473597d706e 1669 * @brief Get the UART receive FIFO underflow status state.
bogdanm 82:6473597d706e 1670 *
bogdanm 82:6473597d706e 1671 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1672 * @return The receive FIFO underflow status state: true=overflow; false=no overflow.
bogdanm 82:6473597d706e 1673 */
bogdanm 82:6473597d706e 1674 bool uart_hal_is_rx_fifo_underflow(uint32_t uartInstance);
bogdanm 82:6473597d706e 1675
bogdanm 82:6473597d706e 1676 /*!
bogdanm 82:6473597d706e 1677 * @brief Clear the UART receive FIFO underflow status.
bogdanm 82:6473597d706e 1678 *
bogdanm 82:6473597d706e 1679 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1680 */
bogdanm 82:6473597d706e 1681 void uart_hal_clear_rx_fifo_underflow(uint32_t uartInstance);
bogdanm 82:6473597d706e 1682
bogdanm 82:6473597d706e 1683 /*!
bogdanm 82:6473597d706e 1684 * @brief Set the UART transmit FIFO watermark value.
bogdanm 82:6473597d706e 1685 *
bogdanm 82:6473597d706e 1686 * Programming the transmit watermark should be done when UART the transmitter is disabled
bogdanm 82:6473597d706e 1687 * and the value must be set less than the size obtained from uart_hal_get_tx_fifo_size.
bogdanm 82:6473597d706e 1688 *
bogdanm 82:6473597d706e 1689 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1690 * @param watermark The UART transmit watermark value to be programmed.
bogdanm 82:6473597d706e 1691 * @return Error code if transmitter is enabled or kStatus_UART_Success.
bogdanm 82:6473597d706e 1692 */
bogdanm 82:6473597d706e 1693 uart_status_t uart_hal_set_tx_fifo_watermark(uint32_t uartInstance, uint8_t watermark);
bogdanm 82:6473597d706e 1694
bogdanm 82:6473597d706e 1695 /*!
bogdanm 82:6473597d706e 1696 * @brief Get the UART transmit FIFO watermark value.
bogdanm 82:6473597d706e 1697 *
bogdanm 82:6473597d706e 1698 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1699 * @return The value currently programmed for the UART transmit watermark.
bogdanm 82:6473597d706e 1700 */
bogdanm 82:6473597d706e 1701 uint8_t uart_hal_get_tx_fifo_watermark(uint32_t uartInstance);
bogdanm 82:6473597d706e 1702
bogdanm 82:6473597d706e 1703 /*!
bogdanm 82:6473597d706e 1704 * @brief Get the UART transmit FIFO data word count (number of words in the transmit FIFO).
bogdanm 82:6473597d706e 1705 *
bogdanm 82:6473597d706e 1706 * The function uart_hal_get_tx_dataword_count_in_fifo excludes any data that may
bogdanm 82:6473597d706e 1707 * be in the UART transmit shift register
bogdanm 82:6473597d706e 1708 *
bogdanm 82:6473597d706e 1709 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1710 * @return The number of data words currently in the UART transmit FIFO.
bogdanm 82:6473597d706e 1711 */
bogdanm 82:6473597d706e 1712 uint8_t uart_hal_get_tx_dataword_count_in_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1713
bogdanm 82:6473597d706e 1714 /*!
bogdanm 82:6473597d706e 1715 * @brief Set the UART receive FIFO watermark value.
bogdanm 82:6473597d706e 1716 *
bogdanm 82:6473597d706e 1717 * Programming the receive watermark should be done when the receiver is disabled
bogdanm 82:6473597d706e 1718 * and the value must be set less than the size obtained from uart_hal_get_rx_fifo_size and
bogdanm 82:6473597d706e 1719 * greater than zero.
bogdanm 82:6473597d706e 1720 *
bogdanm 82:6473597d706e 1721 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1722 * @param watermark The UART receive watermark value to be programmed.
bogdanm 82:6473597d706e 1723 * @return Error code if receiver is enabled or kStatus_UART_Success.
bogdanm 82:6473597d706e 1724 */
bogdanm 82:6473597d706e 1725 uart_status_t uart_hal_set_rx_fifo_watermark(uint32_t uartInstance, uint8_t watermark);
bogdanm 82:6473597d706e 1726
bogdanm 82:6473597d706e 1727 /*!
bogdanm 82:6473597d706e 1728 * @brief Get the UART receive FIFO data word count (number of words in the receive FIFO).
bogdanm 82:6473597d706e 1729 *
bogdanm 82:6473597d706e 1730 * The function uart_hal_get_rx_dataword_count_in_fifo excludes any data that may be
bogdanm 82:6473597d706e 1731 * in the receive shift register.
bogdanm 82:6473597d706e 1732 *
bogdanm 82:6473597d706e 1733 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1734 * @return The number of data words currently in the UART receive FIFO.
bogdanm 82:6473597d706e 1735 */
bogdanm 82:6473597d706e 1736 uint8_t uart_hal_get_rx_dataword_count_in_fifo(uint32_t uartInstance);
bogdanm 82:6473597d706e 1737
bogdanm 82:6473597d706e 1738 /*!
bogdanm 82:6473597d706e 1739 * @brief Get the UART receive FIFO watermark value.
bogdanm 82:6473597d706e 1740 *
bogdanm 82:6473597d706e 1741 * @param uartInstance UART module instance number.
bogdanm 82:6473597d706e 1742 * @return The value currently programmed for the UART receive watermark.
bogdanm 82:6473597d706e 1743 */
bogdanm 82:6473597d706e 1744 uint8_t uart_hal_get_rx_fifo_watermark(uint32_t uartInstance);
bogdanm 82:6473597d706e 1745
bogdanm 82:6473597d706e 1746 #endif /* FSL_FEATURE_UART_HAS_FIFO*/
bogdanm 82:6473597d706e 1747
bogdanm 82:6473597d706e 1748 /*@}*/
bogdanm 82:6473597d706e 1749
bogdanm 82:6473597d706e 1750 #if defined(__cplusplus)
bogdanm 82:6473597d706e 1751 }
bogdanm 82:6473597d706e 1752 #endif
bogdanm 82:6473597d706e 1753
bogdanm 82:6473597d706e 1754 /*! @}*/
bogdanm 82:6473597d706e 1755
bogdanm 82:6473597d706e 1756 #endif /* __FSL_UART_HAL_H__*/
bogdanm 82:6473597d706e 1757 /*******************************************************************************
bogdanm 82:6473597d706e 1758 * EOF
bogdanm 82:6473597d706e 1759 ******************************************************************************/
bogdanm 82:6473597d706e 1760