mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

Committer:
mbed_official
Date:
Thu Apr 03 11:45:06 2014 +0100
Revision:
149:1fb5f62b92bd
Parent:
targets/hal/TARGET_Freescale/TARGET_KSDK_MCUS/TARGET_KSDK_CODE/hal/uart/fsl_uart_hal_status_flags.c@146:f64d43ff0c18
Synchronized with git revision 220c0bb39ceee40016e1e86350c058963d01ed42

Full URL: https://github.com/mbedmicro/mbed/commit/220c0bb39ceee40016e1e86350c058963d01ed42/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 146:f64d43ff0c18 1 /*
mbed_official 146:f64d43ff0c18 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
mbed_official 146:f64d43ff0c18 3 * All rights reserved.
mbed_official 146:f64d43ff0c18 4 *
mbed_official 146:f64d43ff0c18 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 146:f64d43ff0c18 6 * are permitted provided that the following conditions are met:
mbed_official 146:f64d43ff0c18 7 *
mbed_official 146:f64d43ff0c18 8 * o Redistributions of source code must retain the above copyright notice, this list
mbed_official 146:f64d43ff0c18 9 * of conditions and the following disclaimer.
mbed_official 146:f64d43ff0c18 10 *
mbed_official 146:f64d43ff0c18 11 * o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 146:f64d43ff0c18 12 * list of conditions and the following disclaimer in the documentation and/or
mbed_official 146:f64d43ff0c18 13 * other materials provided with the distribution.
mbed_official 146:f64d43ff0c18 14 *
mbed_official 146:f64d43ff0c18 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 146:f64d43ff0c18 16 * contributors may be used to endorse or promote products derived from this
mbed_official 146:f64d43ff0c18 17 * software without specific prior written permission.
mbed_official 146:f64d43ff0c18 18 *
mbed_official 146:f64d43ff0c18 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 146:f64d43ff0c18 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 146:f64d43ff0c18 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 146:f64d43ff0c18 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 146:f64d43ff0c18 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 146:f64d43ff0c18 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 146:f64d43ff0c18 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 146:f64d43ff0c18 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 146:f64d43ff0c18 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 146:f64d43ff0c18 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 146:f64d43ff0c18 29 */
mbed_official 146:f64d43ff0c18 30 #include "fsl_uart_hal.h"
mbed_official 146:f64d43ff0c18 31
mbed_official 146:f64d43ff0c18 32 /*******************************************************************************
mbed_official 146:f64d43ff0c18 33 * Definitions
mbed_official 146:f64d43ff0c18 34 ******************************************************************************/
mbed_official 146:f64d43ff0c18 35
mbed_official 146:f64d43ff0c18 36 /*******************************************************************************
mbed_official 146:f64d43ff0c18 37 * Code
mbed_official 146:f64d43ff0c18 38 ******************************************************************************/
mbed_official 146:f64d43ff0c18 39
mbed_official 146:f64d43ff0c18 40 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 41 *
mbed_official 146:f64d43ff0c18 42 * Function Name : uart_hal_get_all_status_flag
mbed_official 146:f64d43ff0c18 43 * Description : Get all of the UART status flag states.
mbed_official 146:f64d43ff0c18 44 * This function gets all of the UART status flag states and places into a structure of
mbed_official 146:f64d43ff0c18 45 * type uart_status_flag_all_t. The user must pass in a pointer to this structure.
mbed_official 146:f64d43ff0c18 46 *
mbed_official 146:f64d43ff0c18 47 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 48 void uart_hal_get_all_status_flag(uint32_t uartInstance, uart_status_flag_all_t *allStatusFlag)
mbed_official 146:f64d43ff0c18 49 {
mbed_official 146:f64d43ff0c18 50 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 51
mbed_official 146:f64d43ff0c18 52 /* return status condition of all status flags */
mbed_official 146:f64d43ff0c18 53 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 54 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 55 {
mbed_official 146:f64d43ff0c18 56 allStatusFlag->transmitDataRegisterEmpty = HW_UART0_S1.B.TDRE;
mbed_official 146:f64d43ff0c18 57 allStatusFlag->transmissionComplete = HW_UART0_S1.B.TC;
mbed_official 146:f64d43ff0c18 58 allStatusFlag->receiveDataRegisterFull = HW_UART0_S1.B.RDRF;
mbed_official 146:f64d43ff0c18 59 allStatusFlag->idleLineDetect = HW_UART0_S1.B.IDLE;
mbed_official 146:f64d43ff0c18 60 allStatusFlag->receiveOverrun = HW_UART0_S1.B.OR;
mbed_official 146:f64d43ff0c18 61 allStatusFlag->noiseDetect = HW_UART0_S1.B.NF;
mbed_official 146:f64d43ff0c18 62 allStatusFlag->frameError = HW_UART0_S1.B.FE;
mbed_official 146:f64d43ff0c18 63 allStatusFlag->parityError = HW_UART0_S1.B.PF;
mbed_official 146:f64d43ff0c18 64 allStatusFlag->lineBreakDetect = HW_UART0_S2.B.LBKDIF;
mbed_official 146:f64d43ff0c18 65 allStatusFlag->receiveActiveEdgeDetect = HW_UART0_S2.B.RXEDGIF;
mbed_official 146:f64d43ff0c18 66 allStatusFlag->receiverActive = HW_UART0_S2.B.RAF;
mbed_official 146:f64d43ff0c18 67 }
mbed_official 146:f64d43ff0c18 68 else
mbed_official 146:f64d43ff0c18 69 #endif
mbed_official 146:f64d43ff0c18 70 {
mbed_official 146:f64d43ff0c18 71 allStatusFlag->transmitDataRegisterEmpty = HW_UART_S1(uartInstance).B.TDRE;
mbed_official 146:f64d43ff0c18 72 allStatusFlag->transmissionComplete = HW_UART_S1(uartInstance).B.TC;
mbed_official 146:f64d43ff0c18 73 allStatusFlag->receiveDataRegisterFull = HW_UART_S1(uartInstance).B.RDRF;
mbed_official 146:f64d43ff0c18 74 allStatusFlag->idleLineDetect = HW_UART_S1(uartInstance).B.IDLE;
mbed_official 146:f64d43ff0c18 75 allStatusFlag->receiveOverrun = HW_UART_S1(uartInstance).B.OR;
mbed_official 146:f64d43ff0c18 76 allStatusFlag->noiseDetect = HW_UART_S1(uartInstance).B.NF;
mbed_official 146:f64d43ff0c18 77 allStatusFlag->frameError = HW_UART_S1(uartInstance).B.FE;
mbed_official 146:f64d43ff0c18 78 allStatusFlag->parityError = HW_UART_S1(uartInstance).B.PF;
mbed_official 146:f64d43ff0c18 79 allStatusFlag->lineBreakDetect = HW_UART_S2(uartInstance).B.LBKDIF;
mbed_official 146:f64d43ff0c18 80 allStatusFlag->receiveActiveEdgeDetect = HW_UART_S2(uartInstance).B.RXEDGIF;
mbed_official 146:f64d43ff0c18 81 allStatusFlag->receiverActive = HW_UART_S2(uartInstance).B.RAF;
mbed_official 146:f64d43ff0c18 82 #if FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
mbed_official 146:f64d43ff0c18 83 allStatusFlag->noiseInCurrentWord = HW_UART_ED(uartInstance).B.NOISY;
mbed_official 146:f64d43ff0c18 84 allStatusFlag->parityErrorInCurrentWord = HW_UART_ED(uartInstance).B.PARITYE;
mbed_official 146:f64d43ff0c18 85 #endif
mbed_official 146:f64d43ff0c18 86 #if FSL_FEATURE_UART_HAS_FIFO
mbed_official 146:f64d43ff0c18 87 allStatusFlag->txBufferEmpty = HW_UART_SFIFO(uartInstance).B.TXEMPT;
mbed_official 146:f64d43ff0c18 88 allStatusFlag->rxBufferEmpty = HW_UART_SFIFO(uartInstance).B.RXEMPT;
mbed_official 146:f64d43ff0c18 89 allStatusFlag->txBufferOverflow = HW_UART_SFIFO(uartInstance).B.TXOF;
mbed_official 146:f64d43ff0c18 90 allStatusFlag->rxBufferUnderflow = HW_UART_SFIFO(uartInstance).B.RXUF;
mbed_official 146:f64d43ff0c18 91 #endif
mbed_official 146:f64d43ff0c18 92 }
mbed_official 146:f64d43ff0c18 93 }
mbed_official 146:f64d43ff0c18 94
mbed_official 146:f64d43ff0c18 95 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 96 *
mbed_official 146:f64d43ff0c18 97 * Function Name : uart_hal_is_transmit_data_register_empty
mbed_official 146:f64d43ff0c18 98 * Description : Get the UART Transmit data register empty flag.
mbed_official 146:f64d43ff0c18 99 * This function returns the state of the UART Transmit data register empty flag.
mbed_official 146:f64d43ff0c18 100 *
mbed_official 146:f64d43ff0c18 101 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 102 bool uart_hal_is_transmit_data_register_empty(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 103 {
mbed_official 146:f64d43ff0c18 104 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 105
mbed_official 146:f64d43ff0c18 106 /* return status condition of TDRE flag */
mbed_official 146:f64d43ff0c18 107 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 108 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 109 {
mbed_official 146:f64d43ff0c18 110 return HW_UART0_S1.B.TDRE;
mbed_official 146:f64d43ff0c18 111 }
mbed_official 146:f64d43ff0c18 112 else
mbed_official 146:f64d43ff0c18 113 #endif
mbed_official 146:f64d43ff0c18 114 {
mbed_official 146:f64d43ff0c18 115 return HW_UART_S1(uartInstance).B.TDRE;
mbed_official 146:f64d43ff0c18 116 }
mbed_official 146:f64d43ff0c18 117 }
mbed_official 146:f64d43ff0c18 118
mbed_official 146:f64d43ff0c18 119 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 120 *
mbed_official 146:f64d43ff0c18 121 * Function Name : uart_hal_is_transmission_complete
mbed_official 146:f64d43ff0c18 122 * Description : Get the UART Transmission complete flag.
mbed_official 146:f64d43ff0c18 123 * This function returns the state of the UART Transmission complete flag.
mbed_official 146:f64d43ff0c18 124 *
mbed_official 146:f64d43ff0c18 125 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 126 bool uart_hal_is_transmission_complete(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 127 {
mbed_official 146:f64d43ff0c18 128 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 129
mbed_official 146:f64d43ff0c18 130 /* return status condition of TC flag */
mbed_official 146:f64d43ff0c18 131 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 132 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 133 {
mbed_official 146:f64d43ff0c18 134 return HW_UART0_S1.B.TC;
mbed_official 146:f64d43ff0c18 135 }
mbed_official 146:f64d43ff0c18 136 else
mbed_official 146:f64d43ff0c18 137 #endif
mbed_official 146:f64d43ff0c18 138 {
mbed_official 146:f64d43ff0c18 139 return HW_UART_S1(uartInstance).B.TC;
mbed_official 146:f64d43ff0c18 140 }
mbed_official 146:f64d43ff0c18 141 }
mbed_official 146:f64d43ff0c18 142
mbed_official 146:f64d43ff0c18 143 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 144 *
mbed_official 146:f64d43ff0c18 145 * Function Name : uart_hal_is_receive_data_register_full
mbed_official 146:f64d43ff0c18 146 * Description : Get the UART Receive data register full flag.
mbed_official 146:f64d43ff0c18 147 * This function returns the state of the UART Receive data register full flag.
mbed_official 146:f64d43ff0c18 148 *
mbed_official 146:f64d43ff0c18 149 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 150 bool uart_hal_is_receive_data_register_full(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 151 {
mbed_official 146:f64d43ff0c18 152 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 153
mbed_official 146:f64d43ff0c18 154 /* return status condition of RDRF flag */
mbed_official 146:f64d43ff0c18 155 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 156 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 157 {
mbed_official 146:f64d43ff0c18 158 return HW_UART0_S1.B.RDRF;
mbed_official 146:f64d43ff0c18 159 }
mbed_official 146:f64d43ff0c18 160 else
mbed_official 146:f64d43ff0c18 161 #endif
mbed_official 146:f64d43ff0c18 162 {
mbed_official 146:f64d43ff0c18 163 return HW_UART_S1(uartInstance).B.RDRF;
mbed_official 146:f64d43ff0c18 164 }
mbed_official 146:f64d43ff0c18 165 }
mbed_official 146:f64d43ff0c18 166
mbed_official 146:f64d43ff0c18 167 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 168 *
mbed_official 146:f64d43ff0c18 169 * Function Name : uart_hal_is_idle_line_detected
mbed_official 146:f64d43ff0c18 170 * Description : Get the UART Idle line detect flag.
mbed_official 146:f64d43ff0c18 171 * This function returns the state of the UART Idle line detect flag.
mbed_official 146:f64d43ff0c18 172 *
mbed_official 146:f64d43ff0c18 173 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 174 bool uart_hal_is_idle_line_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 175 {
mbed_official 146:f64d43ff0c18 176 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 177
mbed_official 146:f64d43ff0c18 178 /* return status condition of IDLE flag */
mbed_official 146:f64d43ff0c18 179 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 180 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 181 {
mbed_official 146:f64d43ff0c18 182 return HW_UART0_S1.B.IDLE;
mbed_official 146:f64d43ff0c18 183 }
mbed_official 146:f64d43ff0c18 184 else
mbed_official 146:f64d43ff0c18 185 #endif
mbed_official 146:f64d43ff0c18 186 {
mbed_official 146:f64d43ff0c18 187 return HW_UART_S1(uartInstance).B.IDLE;
mbed_official 146:f64d43ff0c18 188 }
mbed_official 146:f64d43ff0c18 189 }
mbed_official 146:f64d43ff0c18 190
mbed_official 146:f64d43ff0c18 191 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 192 *
mbed_official 146:f64d43ff0c18 193 * Function Name : uart_hal_is_receive_overrun_detected
mbed_official 146:f64d43ff0c18 194 * Description : Get the UART Receiver Overrun status flag.
mbed_official 146:f64d43ff0c18 195 * This function returns the state of the the UART Receiver Overrun status flag.
mbed_official 146:f64d43ff0c18 196 *
mbed_official 146:f64d43ff0c18 197 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 198 bool uart_hal_is_receive_overrun_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 199 {
mbed_official 146:f64d43ff0c18 200 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 201
mbed_official 146:f64d43ff0c18 202 /* return status condition of OR flag */
mbed_official 146:f64d43ff0c18 203 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 204 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 205 {
mbed_official 146:f64d43ff0c18 206 return HW_UART0_S1.B.OR;
mbed_official 146:f64d43ff0c18 207 }
mbed_official 146:f64d43ff0c18 208 else
mbed_official 146:f64d43ff0c18 209 #endif
mbed_official 146:f64d43ff0c18 210 {
mbed_official 146:f64d43ff0c18 211 return HW_UART_S1(uartInstance).B.OR;
mbed_official 146:f64d43ff0c18 212 }
mbed_official 146:f64d43ff0c18 213 }
mbed_official 146:f64d43ff0c18 214
mbed_official 146:f64d43ff0c18 215 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 216 *
mbed_official 146:f64d43ff0c18 217 * Function Name : uart_hal_is_noise_detected
mbed_official 146:f64d43ff0c18 218 * Description : Get the UART noise status flag.
mbed_official 146:f64d43ff0c18 219 * This function returns the state of the UART noise status flag.
mbed_official 146:f64d43ff0c18 220 *
mbed_official 146:f64d43ff0c18 221 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 222 bool uart_hal_is_noise_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 223 {
mbed_official 146:f64d43ff0c18 224 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 225
mbed_official 146:f64d43ff0c18 226 /* return status condition of NF flag */
mbed_official 146:f64d43ff0c18 227 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 228 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 229 {
mbed_official 146:f64d43ff0c18 230 return HW_UART0_S1.B.NF;
mbed_official 146:f64d43ff0c18 231 }
mbed_official 146:f64d43ff0c18 232 else
mbed_official 146:f64d43ff0c18 233 #endif
mbed_official 146:f64d43ff0c18 234 {
mbed_official 146:f64d43ff0c18 235 return HW_UART_S1(uartInstance).B.NF;
mbed_official 146:f64d43ff0c18 236 }
mbed_official 146:f64d43ff0c18 237 }
mbed_official 146:f64d43ff0c18 238
mbed_official 146:f64d43ff0c18 239 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 240 *
mbed_official 146:f64d43ff0c18 241 * Function Name : uart_hal_is_frame_error_detected
mbed_official 146:f64d43ff0c18 242 * Description : Get the UART Frame error status flag.
mbed_official 146:f64d43ff0c18 243 * This function returns the state of the UART Frame error status flag.
mbed_official 146:f64d43ff0c18 244 *
mbed_official 146:f64d43ff0c18 245 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 246 bool uart_hal_is_frame_error_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 247 {
mbed_official 146:f64d43ff0c18 248 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 249
mbed_official 146:f64d43ff0c18 250 /* return status condition of FE flag */
mbed_official 146:f64d43ff0c18 251 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 252 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 253 {
mbed_official 146:f64d43ff0c18 254 return HW_UART0_S1.B.FE;
mbed_official 146:f64d43ff0c18 255 }
mbed_official 146:f64d43ff0c18 256 else
mbed_official 146:f64d43ff0c18 257 #endif
mbed_official 146:f64d43ff0c18 258 {
mbed_official 146:f64d43ff0c18 259 return HW_UART_S1(uartInstance).B.FE;
mbed_official 146:f64d43ff0c18 260 }
mbed_official 146:f64d43ff0c18 261 }
mbed_official 146:f64d43ff0c18 262
mbed_official 146:f64d43ff0c18 263 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 264 *
mbed_official 146:f64d43ff0c18 265 * Function Name : uart_hal_is_parity_error_detected
mbed_official 146:f64d43ff0c18 266 * Description : Get the UART parity error status flag.
mbed_official 146:f64d43ff0c18 267 * This function returns the state of the UART parity error status flag.
mbed_official 146:f64d43ff0c18 268 *
mbed_official 146:f64d43ff0c18 269 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 270 bool uart_hal_is_parity_error_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 271 {
mbed_official 146:f64d43ff0c18 272 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 273
mbed_official 146:f64d43ff0c18 274 /* return status condition of PF flag */
mbed_official 146:f64d43ff0c18 275 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 276 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 277 {
mbed_official 146:f64d43ff0c18 278 return HW_UART0_S1.B.PF;
mbed_official 146:f64d43ff0c18 279 }
mbed_official 146:f64d43ff0c18 280 else
mbed_official 146:f64d43ff0c18 281 #endif
mbed_official 146:f64d43ff0c18 282 {
mbed_official 146:f64d43ff0c18 283 return HW_UART_S1(uartInstance).B.PF;
mbed_official 146:f64d43ff0c18 284 }
mbed_official 146:f64d43ff0c18 285 }
mbed_official 146:f64d43ff0c18 286
mbed_official 146:f64d43ff0c18 287 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 288 *
mbed_official 146:f64d43ff0c18 289 * Function Name : uart_hal_is_line_break_detected
mbed_official 146:f64d43ff0c18 290 * Description : Get the UART LIN break detect interrupt status flag.
mbed_official 146:f64d43ff0c18 291 * This function returns the state of the UART LIN break detect interrupt status flag.
mbed_official 146:f64d43ff0c18 292 *
mbed_official 146:f64d43ff0c18 293 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 294 bool uart_hal_is_line_break_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 295 {
mbed_official 146:f64d43ff0c18 296 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 297
mbed_official 146:f64d43ff0c18 298 /* return status condition of LBKDIF flag */
mbed_official 146:f64d43ff0c18 299 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 300 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 301 {
mbed_official 146:f64d43ff0c18 302 return HW_UART0_S2.B.LBKDIF;
mbed_official 146:f64d43ff0c18 303 }
mbed_official 146:f64d43ff0c18 304 else
mbed_official 146:f64d43ff0c18 305 #endif
mbed_official 146:f64d43ff0c18 306 {
mbed_official 146:f64d43ff0c18 307 return HW_UART_S2(uartInstance).B.LBKDIF;
mbed_official 146:f64d43ff0c18 308 }
mbed_official 146:f64d43ff0c18 309 }
mbed_official 146:f64d43ff0c18 310
mbed_official 146:f64d43ff0c18 311 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 312 *
mbed_official 146:f64d43ff0c18 313 * Function Name : uart_hal_is_receive_active_edge_detected
mbed_official 146:f64d43ff0c18 314 * Description : Get the UART Receive pin active edge interrupt status flag.
mbed_official 146:f64d43ff0c18 315 * This function returns the state of the UART Receive pin active edge interrupt status flag.
mbed_official 146:f64d43ff0c18 316 *
mbed_official 146:f64d43ff0c18 317 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 318 bool uart_hal_is_receive_active_edge_detected(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 319 {
mbed_official 146:f64d43ff0c18 320 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 321
mbed_official 146:f64d43ff0c18 322 /* return status condition of RXEDGIF flag */
mbed_official 146:f64d43ff0c18 323 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 324 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 325 {
mbed_official 146:f64d43ff0c18 326 return HW_UART0_S2.B.RXEDGIF;
mbed_official 146:f64d43ff0c18 327 }
mbed_official 146:f64d43ff0c18 328 else
mbed_official 146:f64d43ff0c18 329 #endif
mbed_official 146:f64d43ff0c18 330 {
mbed_official 146:f64d43ff0c18 331 return HW_UART_S2(uartInstance).B.RXEDGIF;
mbed_official 146:f64d43ff0c18 332 }
mbed_official 146:f64d43ff0c18 333 }
mbed_official 146:f64d43ff0c18 334
mbed_official 146:f64d43ff0c18 335 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 336 *
mbed_official 146:f64d43ff0c18 337 * Function Name : uart_hal_is_receiver_active
mbed_official 146:f64d43ff0c18 338 * Description : Get the UART Receiver Active Flag (RAF) state.
mbed_official 146:f64d43ff0c18 339 * This function returns the state of the UART Receiver Active Flag (RAF).
mbed_official 146:f64d43ff0c18 340 *
mbed_official 146:f64d43ff0c18 341 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 342 bool uart_hal_is_receiver_active(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 343 {
mbed_official 146:f64d43ff0c18 344 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 345
mbed_official 146:f64d43ff0c18 346 /* return status condition of RAF flag */
mbed_official 146:f64d43ff0c18 347 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 348 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 349 {
mbed_official 146:f64d43ff0c18 350 return HW_UART0_S2.B.RAF;
mbed_official 146:f64d43ff0c18 351 }
mbed_official 146:f64d43ff0c18 352 else
mbed_official 146:f64d43ff0c18 353 #endif
mbed_official 146:f64d43ff0c18 354 {
mbed_official 146:f64d43ff0c18 355 return HW_UART_S2(uartInstance).B.RAF;
mbed_official 146:f64d43ff0c18 356 }
mbed_official 146:f64d43ff0c18 357 }
mbed_official 146:f64d43ff0c18 358
mbed_official 146:f64d43ff0c18 359 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 360 *
mbed_official 146:f64d43ff0c18 361 * Function Name : uart_hal_clear_status_flag
mbed_official 146:f64d43ff0c18 362 * Description : Clear an individual and specific UART status flag.
mbed_official 146:f64d43ff0c18 363 * This function allows the user to clear an individual and specific UART status flag. Refer to
mbed_official 146:f64d43ff0c18 364 * structure definition uart_status_flag_t for list of status bits.
mbed_official 146:f64d43ff0c18 365 *
mbed_official 146:f64d43ff0c18 366 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 367 uart_status_t uart_hal_clear_status_flag(uint32_t uartInstance, uart_status_flag_t statusFlag)
mbed_official 146:f64d43ff0c18 368 {
mbed_official 146:f64d43ff0c18 369 uart_status_t returnCode; /* return code variable */
mbed_official 146:f64d43ff0c18 370
mbed_official 146:f64d43ff0c18 371 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 372
mbed_official 146:f64d43ff0c18 373 returnCode = kStatus_UART_Success; /* default return code, unless changed by error condition*/
mbed_official 146:f64d43ff0c18 374
mbed_official 146:f64d43ff0c18 375 /* clear the desired, individual status flag as passed in through statusFlag */
mbed_official 146:f64d43ff0c18 376 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 377 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 378 {
mbed_official 146:f64d43ff0c18 379 switch(statusFlag)
mbed_official 146:f64d43ff0c18 380 {
mbed_official 146:f64d43ff0c18 381 case kUartTransmitDataRegisterEmpty:
mbed_official 146:f64d43ff0c18 382 /* This flag is cleared automatically by other uart operations
mbed_official 146:f64d43ff0c18 383 * and cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 384 */
mbed_official 146:f64d43ff0c18 385 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 386 break;
mbed_official 146:f64d43ff0c18 387
mbed_official 146:f64d43ff0c18 388 case kUartTransmissionComplete:
mbed_official 146:f64d43ff0c18 389 /* This flag is cleared automatically by other uart operations
mbed_official 146:f64d43ff0c18 390 * and cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 391 */
mbed_official 146:f64d43ff0c18 392 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 393 break;
mbed_official 146:f64d43ff0c18 394
mbed_official 146:f64d43ff0c18 395 case kUartReceiveDataRegisterFull:
mbed_official 146:f64d43ff0c18 396 /* This flag is cleared automatically by other uart operations and
mbed_official 146:f64d43ff0c18 397 * cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 398 */
mbed_official 146:f64d43ff0c18 399 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 400 break;
mbed_official 146:f64d43ff0c18 401
mbed_official 146:f64d43ff0c18 402 case kUartIdleLineDetect:
mbed_official 146:f64d43ff0c18 403 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 404 HW_UART0_S1_SET(BM_UART0_S1_IDLE);
mbed_official 146:f64d43ff0c18 405 break;
mbed_official 146:f64d43ff0c18 406
mbed_official 146:f64d43ff0c18 407 case kUartReceiveOverrun:
mbed_official 146:f64d43ff0c18 408 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 409 HW_UART0_S1_SET(BM_UART0_S1_OR);
mbed_official 146:f64d43ff0c18 410 break;
mbed_official 146:f64d43ff0c18 411
mbed_official 146:f64d43ff0c18 412 case kUartNoiseDetect:
mbed_official 146:f64d43ff0c18 413 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 414 HW_UART0_S1_SET(BM_UART0_S1_NF);
mbed_official 146:f64d43ff0c18 415 break;
mbed_official 146:f64d43ff0c18 416
mbed_official 146:f64d43ff0c18 417 case kUartFrameError:
mbed_official 146:f64d43ff0c18 418 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 419 HW_UART0_S1_SET(BM_UART0_S1_FE);
mbed_official 146:f64d43ff0c18 420 break;
mbed_official 146:f64d43ff0c18 421
mbed_official 146:f64d43ff0c18 422 case kUartParityError:
mbed_official 146:f64d43ff0c18 423 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 424 HW_UART0_S1_SET(BM_UART0_S1_PF);
mbed_official 146:f64d43ff0c18 425 break;
mbed_official 146:f64d43ff0c18 426
mbed_official 146:f64d43ff0c18 427 case kUartLineBreakDetect:
mbed_official 146:f64d43ff0c18 428 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 429 HW_UART0_S2_SET(BM_UART0_S2_LBKDIF);
mbed_official 146:f64d43ff0c18 430 break;
mbed_official 146:f64d43ff0c18 431
mbed_official 146:f64d43ff0c18 432 case kUartReceiveActiveEdgeDetect:
mbed_official 146:f64d43ff0c18 433 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 434 HW_UART0_S2_SET(BM_UART0_S2_RXEDGIF);
mbed_official 146:f64d43ff0c18 435 break;
mbed_official 146:f64d43ff0c18 436
mbed_official 146:f64d43ff0c18 437 case kUartReceiverActive:
mbed_official 146:f64d43ff0c18 438 /* This flag is cleared automatically by other uart operations and
mbed_official 146:f64d43ff0c18 439 * cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 440 */
mbed_official 146:f64d43ff0c18 441 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 442 break;
mbed_official 146:f64d43ff0c18 443
mbed_official 146:f64d43ff0c18 444 default: /* catch inputs that are not recognized*/
mbed_official 146:f64d43ff0c18 445 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 446 break;
mbed_official 146:f64d43ff0c18 447 }
mbed_official 146:f64d43ff0c18 448 }
mbed_official 146:f64d43ff0c18 449 else
mbed_official 146:f64d43ff0c18 450 #endif
mbed_official 146:f64d43ff0c18 451 {
mbed_official 146:f64d43ff0c18 452 switch(statusFlag)
mbed_official 146:f64d43ff0c18 453 {
mbed_official 146:f64d43ff0c18 454 case kUartTransmitDataRegisterEmpty:
mbed_official 146:f64d43ff0c18 455 /* This flag is cleared automatically by other uart operations and
mbed_official 146:f64d43ff0c18 456 * cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 457 */
mbed_official 146:f64d43ff0c18 458 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 459 break;
mbed_official 146:f64d43ff0c18 460
mbed_official 146:f64d43ff0c18 461 case kUartTransmissionComplete:
mbed_official 146:f64d43ff0c18 462 /* This flag is cleared automatically by other uart operations and
mbed_official 146:f64d43ff0c18 463 * cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 464 */
mbed_official 146:f64d43ff0c18 465 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 466 break;
mbed_official 146:f64d43ff0c18 467
mbed_official 146:f64d43ff0c18 468 case kUartReceiveDataRegisterFull:
mbed_official 146:f64d43ff0c18 469 /* This flag is cleared automatically by other uart operations and
mbed_official 146:f64d43ff0c18 470 * cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 471 */
mbed_official 146:f64d43ff0c18 472 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 473 break;
mbed_official 146:f64d43ff0c18 474
mbed_official 146:f64d43ff0c18 475 case kUartIdleLineDetect:
mbed_official 146:f64d43ff0c18 476 /* to clear the status is a two-step process:
mbed_official 146:f64d43ff0c18 477 * first, read S1 register with the status flag set
mbed_official 146:f64d43ff0c18 478 */
mbed_official 146:f64d43ff0c18 479 HW_UART_S1_RD(uartInstance);
mbed_official 146:f64d43ff0c18 480 /* second, read the data register*/
mbed_official 146:f64d43ff0c18 481 HW_UART_D_RD(uartInstance);
mbed_official 146:f64d43ff0c18 482 break;
mbed_official 146:f64d43ff0c18 483
mbed_official 146:f64d43ff0c18 484 case kUartReceiveOverrun:
mbed_official 146:f64d43ff0c18 485 /* to clear the status is a two-step process:
mbed_official 146:f64d43ff0c18 486 * first, read S1 register with the status flag set
mbed_official 146:f64d43ff0c18 487 */
mbed_official 146:f64d43ff0c18 488 HW_UART_S1_RD(uartInstance);
mbed_official 146:f64d43ff0c18 489 /* second, read the data register*/
mbed_official 146:f64d43ff0c18 490 HW_UART_D_RD(uartInstance);
mbed_official 146:f64d43ff0c18 491 break;
mbed_official 146:f64d43ff0c18 492
mbed_official 146:f64d43ff0c18 493 case kUartNoiseDetect:
mbed_official 146:f64d43ff0c18 494 /* to clear the status is a two-step process:
mbed_official 146:f64d43ff0c18 495 * first, read S1 register with the status flag set
mbed_official 146:f64d43ff0c18 496 */
mbed_official 146:f64d43ff0c18 497 HW_UART_S1_RD(uartInstance);
mbed_official 146:f64d43ff0c18 498 /* second, read the data register*/
mbed_official 146:f64d43ff0c18 499 HW_UART_D_RD(uartInstance);
mbed_official 146:f64d43ff0c18 500 break;
mbed_official 146:f64d43ff0c18 501
mbed_official 146:f64d43ff0c18 502 case kUartFrameError:
mbed_official 146:f64d43ff0c18 503 /* to clear the status is a two-step process:
mbed_official 146:f64d43ff0c18 504 * first, read S1 register with the status flag set
mbed_official 146:f64d43ff0c18 505 */
mbed_official 146:f64d43ff0c18 506 HW_UART_S1_RD(uartInstance);
mbed_official 146:f64d43ff0c18 507 /* second, read the data register*/
mbed_official 146:f64d43ff0c18 508 HW_UART_D_RD(uartInstance);
mbed_official 146:f64d43ff0c18 509 break;
mbed_official 146:f64d43ff0c18 510
mbed_official 146:f64d43ff0c18 511 case kUartParityError:
mbed_official 146:f64d43ff0c18 512 /* to clear the status is a two-step process:
mbed_official 146:f64d43ff0c18 513 * first, read S1 register with the status flag set
mbed_official 146:f64d43ff0c18 514 */
mbed_official 146:f64d43ff0c18 515 HW_UART_S1_RD(uartInstance);
mbed_official 146:f64d43ff0c18 516 /* second, read the data register*/
mbed_official 146:f64d43ff0c18 517 HW_UART_D_RD(uartInstance);
mbed_official 146:f64d43ff0c18 518 break;
mbed_official 146:f64d43ff0c18 519
mbed_official 146:f64d43ff0c18 520 case kUartLineBreakDetect:
mbed_official 146:f64d43ff0c18 521 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 522 HW_UART_S2_SET(uartInstance, BM_UART_S2_LBKDIF);
mbed_official 146:f64d43ff0c18 523 break;
mbed_official 146:f64d43ff0c18 524
mbed_official 146:f64d43ff0c18 525 case kUartReceiveActiveEdgeDetect:
mbed_official 146:f64d43ff0c18 526 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 527 HW_UART_S2_SET(uartInstance, BM_UART_S2_RXEDGIF);
mbed_official 146:f64d43ff0c18 528 break;
mbed_official 146:f64d43ff0c18 529
mbed_official 146:f64d43ff0c18 530 case kUartReceiverActive:
mbed_official 146:f64d43ff0c18 531 /* This flag is cleared automatically by other uart operations and
mbed_official 146:f64d43ff0c18 532 * cannot be manually cleared, return error code
mbed_official 146:f64d43ff0c18 533 */
mbed_official 146:f64d43ff0c18 534 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 535 break;
mbed_official 146:f64d43ff0c18 536
mbed_official 146:f64d43ff0c18 537 #if FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
mbed_official 146:f64d43ff0c18 538 case kUartNoiseInCurrentWord:
mbed_official 146:f64d43ff0c18 539 /* This flag is not clearable, it simply reflects the status in the
mbed_official 146:f64d43ff0c18 540 * current data word and changes with each new data word
mbed_official 146:f64d43ff0c18 541 */
mbed_official 146:f64d43ff0c18 542 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 543 break;
mbed_official 146:f64d43ff0c18 544
mbed_official 146:f64d43ff0c18 545 case kUartParityErrorInCurrentWord:
mbed_official 146:f64d43ff0c18 546 /* This flag is not clearable, it simply reflects the status in the
mbed_official 146:f64d43ff0c18 547 * current data word and changes with each new data word
mbed_official 146:f64d43ff0c18 548 */
mbed_official 146:f64d43ff0c18 549 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 550 break;
mbed_official 146:f64d43ff0c18 551 #endif
mbed_official 146:f64d43ff0c18 552 #if FSL_FEATURE_UART_HAS_FIFO
mbed_official 146:f64d43ff0c18 553 case kUartTxBufferEmpty:
mbed_official 146:f64d43ff0c18 554 /* This flag is not clearable, it simply reflects the current
mbed_official 146:f64d43ff0c18 555 * status of the buffer/FIFO
mbed_official 146:f64d43ff0c18 556 */
mbed_official 146:f64d43ff0c18 557 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 558 break;
mbed_official 146:f64d43ff0c18 559
mbed_official 146:f64d43ff0c18 560 case kUartRxBufferEmpty:
mbed_official 146:f64d43ff0c18 561 /* This flag is not clearable, it simply reflects the current
mbed_official 146:f64d43ff0c18 562 * status of the buffer/FIFO
mbed_official 146:f64d43ff0c18 563 */
mbed_official 146:f64d43ff0c18 564 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 565 break;
mbed_official 146:f64d43ff0c18 566
mbed_official 146:f64d43ff0c18 567 case kUartTxBufferOverflow:
mbed_official 146:f64d43ff0c18 568 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 569 HW_UART_SFIFO_SET(uartInstance, BM_UART_SFIFO_TXOF);
mbed_official 146:f64d43ff0c18 570 break;
mbed_official 146:f64d43ff0c18 571
mbed_official 146:f64d43ff0c18 572 case kUartRxBufferUnderflow:
mbed_official 146:f64d43ff0c18 573 /* write one to clear status flag */
mbed_official 146:f64d43ff0c18 574 HW_UART_SFIFO_SET(uartInstance, BM_UART_SFIFO_RXUF);
mbed_official 146:f64d43ff0c18 575 break;
mbed_official 146:f64d43ff0c18 576 #endif
mbed_official 146:f64d43ff0c18 577 default: /* catch inputs that are not recognized*/
mbed_official 146:f64d43ff0c18 578 returnCode = kStatus_UART_ClearStatusFlagError;
mbed_official 146:f64d43ff0c18 579 break;
mbed_official 146:f64d43ff0c18 580 }
mbed_official 146:f64d43ff0c18 581 }
mbed_official 146:f64d43ff0c18 582
mbed_official 146:f64d43ff0c18 583 return (returnCode);
mbed_official 146:f64d43ff0c18 584 }
mbed_official 146:f64d43ff0c18 585
mbed_official 146:f64d43ff0c18 586 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 587 *
mbed_official 146:f64d43ff0c18 588 * Function Name : uart_hal_clear_all_non_autoclear_status_flags
mbed_official 146:f64d43ff0c18 589 * Description : Clear ALL of the UART status flags.
mbed_official 146:f64d43ff0c18 590 * This function tries to clear all of the UART status flags. In some cases, some of the status
mbed_official 146:f64d43ff0c18 591 * flags may not get cleared because of the condition that set the flag may still exist.
mbed_official 146:f64d43ff0c18 592 *
mbed_official 146:f64d43ff0c18 593 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 594 void uart_hal_clear_all_non_autoclear_status_flags(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 595 {
mbed_official 146:f64d43ff0c18 596 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 597
mbed_official 146:f64d43ff0c18 598 /* clear the status flags that can be manually cleared
mbed_official 146:f64d43ff0c18 599 * note, some flags are automatically cleared and cannot be cleared automatically
mbed_official 146:f64d43ff0c18 600 */
mbed_official 146:f64d43ff0c18 601 uart_hal_clear_status_flag(uartInstance, kUartIdleLineDetect);
mbed_official 146:f64d43ff0c18 602 uart_hal_clear_status_flag(uartInstance, kUartReceiveOverrun);
mbed_official 146:f64d43ff0c18 603 uart_hal_clear_status_flag(uartInstance, kUartNoiseDetect);
mbed_official 146:f64d43ff0c18 604 uart_hal_clear_status_flag(uartInstance, kUartFrameError);
mbed_official 146:f64d43ff0c18 605 uart_hal_clear_status_flag(uartInstance, kUartParityError);
mbed_official 146:f64d43ff0c18 606 uart_hal_clear_status_flag(uartInstance, kUartLineBreakDetect);
mbed_official 146:f64d43ff0c18 607 uart_hal_clear_status_flag(uartInstance, kUartReceiveActiveEdgeDetect);
mbed_official 146:f64d43ff0c18 608 #if FSL_FEATURE_UART_HAS_FIFO
mbed_official 146:f64d43ff0c18 609 uart_hal_clear_status_flag(uartInstance, kUartTxBufferOverflow);
mbed_official 146:f64d43ff0c18 610 uart_hal_clear_status_flag(uartInstance, kUartRxBufferUnderflow);
mbed_official 146:f64d43ff0c18 611 #endif
mbed_official 146:f64d43ff0c18 612 }
mbed_official 146:f64d43ff0c18 613
mbed_official 146:f64d43ff0c18 614 /*******************************************************************************
mbed_official 146:f64d43ff0c18 615 * EOF
mbed_official 146:f64d43ff0c18 616 ******************************************************************************/
mbed_official 146:f64d43ff0c18 617