mbed library sources. Supersedes mbed-src. removed serial

Fork of mbed-dev by mbed official

Committer:
mrcrsch
Date:
Mon Feb 13 14:26:36 2017 +0000
Revision:
158:aa577577efe0
Parent:
157:ff67d9f36b67
removed stdio and serial to reduce size

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 157:ff67d9f36b67 1 /**
<> 157:ff67d9f36b67 2 * @file
<> 157:ff67d9f36b67 3 * @brief UART data types, definitions and function prototypes.
<> 157:ff67d9f36b67 4 */
<> 157:ff67d9f36b67 5 /* ****************************************************************************
<> 157:ff67d9f36b67 6 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
<> 157:ff67d9f36b67 7 *
<> 157:ff67d9f36b67 8 * Permission is hereby granted, free of charge, to any person obtaining a
<> 157:ff67d9f36b67 9 * copy of this software and associated documentation files (the "Software"),
<> 157:ff67d9f36b67 10 * to deal in the Software without restriction, including without limitation
<> 157:ff67d9f36b67 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
<> 157:ff67d9f36b67 12 * and/or sell copies of the Software, and to permit persons to whom the
<> 157:ff67d9f36b67 13 * Software is furnished to do so, subject to the following conditions:
<> 157:ff67d9f36b67 14 *
<> 157:ff67d9f36b67 15 * The above copyright notice and this permission notice shall be included
<> 157:ff67d9f36b67 16 * in all copies or substantial portions of the Software.
<> 157:ff67d9f36b67 17 *
<> 157:ff67d9f36b67 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<> 157:ff67d9f36b67 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<> 157:ff67d9f36b67 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
<> 157:ff67d9f36b67 21 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
<> 157:ff67d9f36b67 22 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
<> 157:ff67d9f36b67 23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
<> 157:ff67d9f36b67 24 * OTHER DEALINGS IN THE SOFTWARE.
<> 157:ff67d9f36b67 25 *
<> 157:ff67d9f36b67 26 * Except as contained in this notice, the name of Maxim Integrated
<> 157:ff67d9f36b67 27 * Products, Inc. shall not be used except as stated in the Maxim Integrated
<> 157:ff67d9f36b67 28 * Products, Inc. Branding Policy.
<> 157:ff67d9f36b67 29 *
<> 157:ff67d9f36b67 30 * The mere transfer of this software does not imply any licenses
<> 157:ff67d9f36b67 31 * of trade secrets, proprietary technology, copyrights, patents,
<> 157:ff67d9f36b67 32 * trademarks, maskwork rights, or any other form of intellectual
<> 157:ff67d9f36b67 33 * property whatsoever. Maxim Integrated Products, Inc. retains all
<> 157:ff67d9f36b67 34 * ownership rights.
<> 157:ff67d9f36b67 35 *
<> 157:ff67d9f36b67 36 * $Date: 2016-10-10 19:51:14 -0500 (Mon, 10 Oct 2016) $
<> 157:ff67d9f36b67 37 * $Revision: 24676 $
<> 157:ff67d9f36b67 38 *
<> 157:ff67d9f36b67 39 **************************************************************************** */
<> 157:ff67d9f36b67 40
<> 157:ff67d9f36b67 41
<> 157:ff67d9f36b67 42 /* **** Includes **** */
<> 157:ff67d9f36b67 43 #include "mxc_config.h"
<> 157:ff67d9f36b67 44 #include "mxc_sys.h"
<> 157:ff67d9f36b67 45 #include "uart_regs.h"
<> 157:ff67d9f36b67 46
<> 157:ff67d9f36b67 47 /* Define to prevent redundant inclusion */
<> 157:ff67d9f36b67 48 #ifndef _UART_H_
<> 157:ff67d9f36b67 49 #define _UART_H_
<> 157:ff67d9f36b67 50
<> 157:ff67d9f36b67 51 #ifdef __cplusplus
<> 157:ff67d9f36b67 52 extern "C" {
<> 157:ff67d9f36b67 53 #endif
<> 157:ff67d9f36b67 54
<> 157:ff67d9f36b67 55 /**
<> 157:ff67d9f36b67 56 * @ingroup commperipherals
<> 157:ff67d9f36b67 57 * @defgroup uart_comm UART
<> 157:ff67d9f36b67 58 * @brief UART serial communications peripheral.
<> 157:ff67d9f36b67 59 * @{
<> 157:ff67d9f36b67 60 */
<> 157:ff67d9f36b67 61
<> 157:ff67d9f36b67 62 /* **** Definitions **** */
<> 157:ff67d9f36b67 63
<> 157:ff67d9f36b67 64 /**
<> 157:ff67d9f36b67 65 * Enumeration type for defining the number of bits per character.
<> 157:ff67d9f36b67 66 */
<> 157:ff67d9f36b67 67 typedef enum {
<> 157:ff67d9f36b67 68 UART_DATA_SIZE_5_BITS = MXC_V_UART_CTRL_DATA_SIZE_5_BITS,
<> 157:ff67d9f36b67 69 UART_DATA_SIZE_6_BITS = MXC_V_UART_CTRL_DATA_SIZE_6_BITS,
<> 157:ff67d9f36b67 70 UART_DATA_SIZE_7_BITS = MXC_V_UART_CTRL_DATA_SIZE_7_BITS,
<> 157:ff67d9f36b67 71 UART_DATA_SIZE_8_BITS = MXC_V_UART_CTRL_DATA_SIZE_8_BITS
<> 157:ff67d9f36b67 72 }
<> 157:ff67d9f36b67 73 uart_data_size_t;
<> 157:ff67d9f36b67 74
<> 157:ff67d9f36b67 75 /**
<> 157:ff67d9f36b67 76 * Enumeration type for selecting Parity and type.
<> 157:ff67d9f36b67 77 */
<> 157:ff67d9f36b67 78 typedef enum {
<> 157:ff67d9f36b67 79 UART_PARITY_DISABLE = MXC_V_UART_CTRL_PARITY_DISABLE,
<> 157:ff67d9f36b67 80 UART_PARITY_ODD = MXC_V_UART_CTRL_PARITY_ODD,
<> 157:ff67d9f36b67 81 UART_PARITY_EVEN = MXC_V_UART_CTRL_PARITY_EVEN,
<> 157:ff67d9f36b67 82 UART_PARITY_MARK = MXC_V_UART_CTRL_PARITY_MARK
<> 157:ff67d9f36b67 83 } uart_parity_t;
<> 157:ff67d9f36b67 84
<> 157:ff67d9f36b67 85 /**
<> 157:ff67d9f36b67 86 * Configuration structure type for a UART port.
<> 157:ff67d9f36b67 87 */
<> 157:ff67d9f36b67 88 typedef struct {
<> 157:ff67d9f36b67 89 uint8_t extra_stop; /**< Number of stop bits.
<> 157:ff67d9f36b67 90 * @li 0 for one stop bit
<> 157:ff67d9f36b67 91 * @li 1 for two stop bits
<> 157:ff67d9f36b67 92 */
<> 157:ff67d9f36b67 93 uint8_t cts; /**< CTS Enable/Disable.
<> 157:ff67d9f36b67 94 * @li 1 to enable CTS
<> 157:ff67d9f36b67 95 * @li 0 to disable CTS
<> 157:ff67d9f36b67 96 */
<> 157:ff67d9f36b67 97 uint8_t rts; /**< RTS Enable/Disable.
<> 157:ff67d9f36b67 98 * @li 1 to enable RTS
<> 157:ff67d9f36b67 99 * @li 0 to disable RTS
<> 157:ff67d9f36b67 100 */
<> 157:ff67d9f36b67 101 uint32_t baud; /**< Baud rate in Hz. */
<> 157:ff67d9f36b67 102 uart_data_size_t size; /**< Set the number of bits per character, see #uart_data_size_t. */
<> 157:ff67d9f36b67 103 uart_parity_t parity; /**< Set the parity, see #uart_parity_t for supported parity types. */
<> 157:ff67d9f36b67 104 } uart_cfg_t;
<> 157:ff67d9f36b67 105
<> 157:ff67d9f36b67 106 /**
<> 157:ff67d9f36b67 107 * Structure type for a UART asynchronous transaction request.
<> 157:ff67d9f36b67 108 */
<> 157:ff67d9f36b67 109 typedef struct uart_req uart_req_t;
<> 157:ff67d9f36b67 110
<> 157:ff67d9f36b67 111 /**
<> 157:ff67d9f36b67 112 * @brief Type alias \c uart_async_callback for a callback function with signature of: \code void callback)(uart_req_t* , int error_code) \endcode
<> 157:ff67d9f36b67 113 * @param uart_req_t* Pointer to the transaction request.
<> 157:ff67d9f36b67 114 * @param error_code Return code for the UART request. @see mxc_errors.h.
<> 157:ff67d9f36b67 115 * @addtogroup uart_async
<> 157:ff67d9f36b67 116 */
<> 157:ff67d9f36b67 117 typedef void (*uart_async_callback)(uart_req_t*, int);
<> 157:ff67d9f36b67 118
<> 157:ff67d9f36b67 119 /**
<> 157:ff67d9f36b67 120 * Structure for a UART asynchronous transaction request.
<> 157:ff67d9f36b67 121 * @note When using this structure for an asynchronous operation, the
<> 157:ff67d9f36b67 122 * structure must remain allocated until the callback is completed.
<> 157:ff67d9f36b67 123 * @addtogroup uart_async
<> 157:ff67d9f36b67 124 */
<> 157:ff67d9f36b67 125 struct uart_req {
<> 157:ff67d9f36b67 126 uint8_t *data; /**< Data buffer for characters. */
<> 157:ff67d9f36b67 127 unsigned len; /**< Length of characters in data to send or receive. */
<> 157:ff67d9f36b67 128 unsigned num; /**< Number of characters actually sent or received. */
<> 157:ff67d9f36b67 129 uart_async_callback callback; /**< Pointer to a callback function of type uart_async_callback(). */
<> 157:ff67d9f36b67 130 };
<> 157:ff67d9f36b67 131
<> 157:ff67d9f36b67 132
<> 157:ff67d9f36b67 133 /* **** Globals **** */
<> 157:ff67d9f36b67 134
<> 157:ff67d9f36b67 135 /* **** Function Prototypes **** */
<> 157:ff67d9f36b67 136
<> 157:ff67d9f36b67 137 /**
<> 157:ff67d9f36b67 138 * @brief Initialize and enable UART module.
<> 157:ff67d9f36b67 139 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 140 * @param cfg Pointer to UART configuration.
<> 157:ff67d9f36b67 141 * @param sys_cfg Pointer to system configuration object
<> 157:ff67d9f36b67 142 * @returns #E_NO_ERROR UART initialized successfully, @ref MXC_Error_Codes "error" if
<> 157:ff67d9f36b67 143 * unsuccessful.
<> 157:ff67d9f36b67 144 */
<> 157:ff67d9f36b67 145 int UART_Init(mxc_uart_regs_t *uart, const uart_cfg_t *cfg, const sys_cfg_uart_t *sys_cfg);
<> 157:ff67d9f36b67 146
<> 157:ff67d9f36b67 147 /**
<> 157:ff67d9f36b67 148 * @brief Shutdown UART module.
<> 157:ff67d9f36b67 149 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 150 * @returns #E_NO_ERROR UART shutdown successfully, @ref MXC_Error_Codes "error" if
<> 157:ff67d9f36b67 151 * unsuccessful.
<> 157:ff67d9f36b67 152 */
<> 157:ff67d9f36b67 153 int UART_Shutdown(mxc_uart_regs_t *uart);
<> 157:ff67d9f36b67 154
<> 157:ff67d9f36b67 155 /**
<> 157:ff67d9f36b67 156 * @brief Write UART data. This function blocks until the write transaction
<> 157:ff67d9f36b67 157 * is complete.
<> 157:ff67d9f36b67 158 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 159 * @param data Pointer to buffer for write data.
<> 157:ff67d9f36b67 160 * @param len Number of bytes to write.
<> 157:ff67d9f36b67 161 * @note Will return once data has been put into FIFO, not necessarily
<> 157:ff67d9f36b67 162 * transmitted.
<> 157:ff67d9f36b67 163 * @return Number of bytes written if successful, error if unsuccessful.
<> 157:ff67d9f36b67 164 */
<> 157:ff67d9f36b67 165 int UART_Write(mxc_uart_regs_t *uart, uint8_t* data, int len);
<> 157:ff67d9f36b67 166
<> 157:ff67d9f36b67 167 /**
<> 157:ff67d9f36b67 168 * @brief Read UART data, <em>blocking</em> until transaction is complete.
<> 157:ff67d9f36b67 169 *
<> 157:ff67d9f36b67 170 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 171 * @param data Pointer to buffer to save the data read.
<> 157:ff67d9f36b67 172 * @param len Number of bytes to read.
<> 157:ff67d9f36b67 173 * @param num Pointer to store the number of bytes actually read, pass NULL if not needed.
<> 157:ff67d9f36b67 174 *
<> 157:ff67d9f36b67 175 * @return Number of bytes read, @ref MXC_Error_Codes "error" if
<> 157:ff67d9f36b67 176 * unsuccessful.
<> 157:ff67d9f36b67 177 */
<> 157:ff67d9f36b67 178 int UART_Read(mxc_uart_regs_t *uart, uint8_t* data, int len, int *num);
<> 157:ff67d9f36b67 179
<> 157:ff67d9f36b67 180 /**
<> 157:ff67d9f36b67 181 * @ingroup uart_comm
<> 157:ff67d9f36b67 182 * @defgroup uart_async UART Asynchronous Functions
<> 157:ff67d9f36b67 183 */
<> 157:ff67d9f36b67 184
<> 157:ff67d9f36b67 185 /**
<> 157:ff67d9f36b67 186 * @brief Asynchronously write/transmit data to the UART.
<> 157:ff67d9f36b67 187 *
<> 157:ff67d9f36b67 188 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 189 * @param req Request for a UART transaction.
<> 157:ff67d9f36b67 190 * @note Request struct must remain allocated until callback.
<> 157:ff67d9f36b67 191 *
<> 157:ff67d9f36b67 192 * @return #E_NO_ERROR Asynchronous write successfully started, @ref
<> 157:ff67d9f36b67 193 * MXC_Error_Codes "error" if unsuccessful.
<> 157:ff67d9f36b67 194 * @addtogroup uart_async
<> 157:ff67d9f36b67 195 */
<> 157:ff67d9f36b67 196 int UART_WriteAsync(mxc_uart_regs_t *uart, uart_req_t *req);
<> 157:ff67d9f36b67 197
<> 157:ff67d9f36b67 198 /**
<> 157:ff67d9f36b67 199 * @brief Asynchronously Read UART data.
<> 157:ff67d9f36b67 200 *
<> 157:ff67d9f36b67 201 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 202 * @param req Pointer to request for a UART transaction.
<> 157:ff67d9f36b67 203 * @note Request struct must remain allocated until callback function is called.
<> 157:ff67d9f36b67 204 *
<> 157:ff67d9f36b67 205 * @return #E_NO_ERROR Asynchronous read successfully started, @ref
<> 157:ff67d9f36b67 206 * MXC_Error_Codes "error" if unsuccessful.
<> 157:ff67d9f36b67 207 * @addtogroup uart_async
<> 157:ff67d9f36b67 208 */
<> 157:ff67d9f36b67 209 int UART_ReadAsync(mxc_uart_regs_t *uart, uart_req_t *req);
<> 157:ff67d9f36b67 210
<> 157:ff67d9f36b67 211 /**
<> 157:ff67d9f36b67 212 * @brief Abort asynchronous request.
<> 157:ff67d9f36b67 213 *
<> 157:ff67d9f36b67 214 * @param req Pointer to a request for a UART transaction, see #uart_req.
<> 157:ff67d9f36b67 215 *
<> 157:ff67d9f36b67 216 * @return #E_NO_ERROR Asynchronous request aborted successfully, error if unsuccessful.
<> 157:ff67d9f36b67 217 * @addtogroup uart_async
<> 157:ff67d9f36b67 218 */
<> 157:ff67d9f36b67 219 int UART_AbortAsync(uart_req_t *req);
<> 157:ff67d9f36b67 220
<> 157:ff67d9f36b67 221 /**
<> 157:ff67d9f36b67 222 * @brief UART interrupt handler.
<> 157:ff67d9f36b67 223 * @details This function should be called by the application from the
<> 157:ff67d9f36b67 224 * interrupt handler if UART interrupts are enabled. Alternately,
<> 157:ff67d9f36b67 225 * this function can be periodically called by the application if
<> 157:ff67d9f36b67 226 * UART interrupts are disabled. Only necessary to call this when
<> 157:ff67d9f36b67 227 * using asynchronous functions.
<> 157:ff67d9f36b67 228 *
<> 157:ff67d9f36b67 229 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 230 * @addtogroup uart_async
<> 157:ff67d9f36b67 231 */
<> 157:ff67d9f36b67 232 void UART_Handler(mxc_uart_regs_t *uart);
<> 157:ff67d9f36b67 233
<> 157:ff67d9f36b67 234 /**
<> 157:ff67d9f36b67 235 * @brief Check to see if the UART is busy.
<> 157:ff67d9f36b67 236 *
<> 157:ff67d9f36b67 237 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 238 *
<> 157:ff67d9f36b67 239 * @return #E_NO_ERROR UART is idle.
<> 157:ff67d9f36b67 240 * @return #E_BUSY UART is in use.
<> 157:ff67d9f36b67 241 */
<> 157:ff67d9f36b67 242 int UART_Busy(mxc_uart_regs_t *uart);
<> 157:ff67d9f36b67 243
<> 157:ff67d9f36b67 244 /**
<> 157:ff67d9f36b67 245 * @brief Prepare the UART for entry into a Low-Power mode (LP0/LP1).
<> 157:ff67d9f36b67 246 * @details Checks for any ongoing transactions. Disables interrupts if the
<> 157:ff67d9f36b67 247 * UART is idle.
<> 157:ff67d9f36b67 248 *
<> 157:ff67d9f36b67 249 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 250 * @return #E_NO_ERROR UART is ready to enter Low-Power modes (LP0/LP1).
<> 157:ff67d9f36b67 251 * @return #E_BUSY UART is active and busy and not ready to enter a
<> 157:ff67d9f36b67 252 * Low-Power mode (LP0/LP1).
<> 157:ff67d9f36b67 253 *
<> 157:ff67d9f36b67 254 */
<> 157:ff67d9f36b67 255 int UART_PrepForSleep(mxc_uart_regs_t *uart);
<> 157:ff67d9f36b67 256
<> 157:ff67d9f36b67 257 /**
<> 157:ff67d9f36b67 258 * @brief Enables the UART.
<> 157:ff67d9f36b67 259 * @note This function does not change the existing UART configuration.
<> 157:ff67d9f36b67 260 *
<> 157:ff67d9f36b67 261 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 262 */
<> 157:ff67d9f36b67 263 __STATIC_INLINE void UART_Enable(mxc_uart_regs_t *uart)
<> 157:ff67d9f36b67 264 {
<> 157:ff67d9f36b67 265 uart->ctrl |= (MXC_F_UART_CTRL_UART_EN | MXC_F_UART_CTRL_TX_FIFO_EN |
<> 157:ff67d9f36b67 266 MXC_F_UART_CTRL_RX_FIFO_EN);
<> 157:ff67d9f36b67 267 }
<> 157:ff67d9f36b67 268
<> 157:ff67d9f36b67 269 /**
<> 157:ff67d9f36b67 270 * @brief Drains/empties and data in the RX FIFO.
<> 157:ff67d9f36b67 271 *
<> 157:ff67d9f36b67 272 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 273 */
<> 157:ff67d9f36b67 274 __STATIC_INLINE void UART_DrainRX(mxc_uart_regs_t *uart)
<> 157:ff67d9f36b67 275 {
<> 157:ff67d9f36b67 276 uint32_t ctrl_save = uart->ctrl;
<> 157:ff67d9f36b67 277 uart->ctrl = (ctrl_save & ~MXC_F_UART_CTRL_RX_FIFO_EN);
<> 157:ff67d9f36b67 278 uart->ctrl = ctrl_save;
<> 157:ff67d9f36b67 279 }
<> 157:ff67d9f36b67 280
<> 157:ff67d9f36b67 281 /**
<> 157:ff67d9f36b67 282 * @brief Drains/empties any data in the TX FIFO.
<> 157:ff67d9f36b67 283 *
<> 157:ff67d9f36b67 284 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 285 */
<> 157:ff67d9f36b67 286 __STATIC_INLINE void UART_DrainTX(mxc_uart_regs_t *uart)
<> 157:ff67d9f36b67 287 {
<> 157:ff67d9f36b67 288 uint32_t ctrl_save = uart->ctrl;
<> 157:ff67d9f36b67 289 uart->ctrl = (ctrl_save & ~MXC_F_UART_CTRL_TX_FIFO_EN);
<> 157:ff67d9f36b67 290 uart->ctrl = ctrl_save;
<> 157:ff67d9f36b67 291 }
<> 157:ff67d9f36b67 292
<> 157:ff67d9f36b67 293 /**
<> 157:ff67d9f36b67 294 * @brief Returns the number of unused bytes available in the UART TX FIFO.
<> 157:ff67d9f36b67 295 *
<> 157:ff67d9f36b67 296 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 297 *
<> 157:ff67d9f36b67 298 * @return Number of unused bytes in the TX FIFO.
<> 157:ff67d9f36b67 299 */
<> 157:ff67d9f36b67 300 __STATIC_INLINE unsigned UART_NumWriteAvail(mxc_uart_regs_t *uart)
<> 157:ff67d9f36b67 301 {
<> 157:ff67d9f36b67 302 return (MXC_UART_FIFO_DEPTH - (uart->tx_fifo_ctrl & MXC_F_UART_TX_FIFO_CTRL_FIFO_ENTRY));
<> 157:ff67d9f36b67 303 }
<> 157:ff67d9f36b67 304
<> 157:ff67d9f36b67 305 /**
<> 157:ff67d9f36b67 306 * @brief Returns the number of bytes available to be read from the RX
<> 157:ff67d9f36b67 307 * FIFO.
<> 157:ff67d9f36b67 308 *
<> 157:ff67d9f36b67 309 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 310 *
<> 157:ff67d9f36b67 311 * @return The number of bytes available to read in the RX FIFO.
<> 157:ff67d9f36b67 312 */
<> 157:ff67d9f36b67 313 __STATIC_INLINE unsigned UART_NumReadAvail(mxc_uart_regs_t *uart)
<> 157:ff67d9f36b67 314 {
<> 157:ff67d9f36b67 315 return (uart->rx_fifo_ctrl & MXC_F_UART_RX_FIFO_CTRL_FIFO_ENTRY);
<> 157:ff67d9f36b67 316 }
<> 157:ff67d9f36b67 317
<> 157:ff67d9f36b67 318 /**
<> 157:ff67d9f36b67 319 * @brief Clear interrupt flags.
<> 157:ff67d9f36b67 320 *
<> 157:ff67d9f36b67 321 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 322 * @param mask Mask of the UART interrupts to clear, see
<> 157:ff67d9f36b67 323 * @ref UART_INTFL_Register Register.
<> 157:ff67d9f36b67 324 */
<> 157:ff67d9f36b67 325 __STATIC_INLINE void UART_ClearFlags(mxc_uart_regs_t *uart, uint32_t mask)
<> 157:ff67d9f36b67 326 {
<> 157:ff67d9f36b67 327 uart->intfl = mask;
<> 157:ff67d9f36b67 328 }
<> 157:ff67d9f36b67 329
<> 157:ff67d9f36b67 330 /**
<> 157:ff67d9f36b67 331 * @brief Get interrupt flags.
<> 157:ff67d9f36b67 332 *
<> 157:ff67d9f36b67 333 * @param uart Pointer to the UART registers.
<> 157:ff67d9f36b67 334 *
<> 157:ff67d9f36b67 335 * @return Mask of active flags.
<> 157:ff67d9f36b67 336 */
<> 157:ff67d9f36b67 337 __STATIC_INLINE unsigned UART_GetFlags(mxc_uart_regs_t *uart)
<> 157:ff67d9f36b67 338 {
<> 157:ff67d9f36b67 339 return (uart->intfl);
<> 157:ff67d9f36b67 340 }
<> 157:ff67d9f36b67 341
<> 157:ff67d9f36b67 342 /**@} end of group uart_comm */
<> 157:ff67d9f36b67 343 #ifdef __cplusplus
<> 157:ff67d9f36b67 344 }
<> 157:ff67d9f36b67 345 #endif
<> 157:ff67d9f36b67 346
<> 157:ff67d9f36b67 347 #endif /* _UART_H_ */