rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_lpuart.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2017 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_LPUART_H_
9#define _FSL_LPUART_H_
10
11#include "fsl_common.h"
12
13/*!
14 * @addtogroup lpuart_driver
15 * @{
16 */
17
18/*******************************************************************************
19 * Definitions
20 ******************************************************************************/
21
22/*! @name Driver version */
23/*@{*/
24/*! @brief LPUART driver version 2.2.6. */
25#define FSL_LPUART_DRIVER_VERSION (MAKE_VERSION(2, 2, 6))
26/*@}*/
27
28/*! @brief Error codes for the LPUART driver. */
30{
31 kStatus_LPUART_TxBusy = MAKE_STATUS(kStatusGroup_LPUART, 0), /*!< TX busy */
32 kStatus_LPUART_RxBusy = MAKE_STATUS(kStatusGroup_LPUART, 1), /*!< RX busy */
33 kStatus_LPUART_TxIdle = MAKE_STATUS(kStatusGroup_LPUART, 2), /*!< LPUART transmitter is idle. */
34 kStatus_LPUART_RxIdle = MAKE_STATUS(kStatusGroup_LPUART, 3), /*!< LPUART receiver is idle. */
35 kStatus_LPUART_TxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 4), /*!< TX FIFO watermark too large */
36 kStatus_LPUART_RxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 5), /*!< RX FIFO watermark too large */
37 kStatus_LPUART_FlagCannotClearManually = MAKE_STATUS(kStatusGroup_LPUART, 6), /*!< Some flag can't manually clear */
38 kStatus_LPUART_Error = MAKE_STATUS(kStatusGroup_LPUART, 7), /*!< Error happens on LPUART. */
40 MAKE_STATUS(kStatusGroup_LPUART, 8), /*!< LPUART RX software ring buffer overrun. */
41 kStatus_LPUART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_LPUART, 9), /*!< LPUART RX receiver overrun. */
42 kStatus_LPUART_NoiseError = MAKE_STATUS(kStatusGroup_LPUART, 10), /*!< LPUART noise error. */
43 kStatus_LPUART_FramingError = MAKE_STATUS(kStatusGroup_LPUART, 11), /*!< LPUART framing error. */
44 kStatus_LPUART_ParityError = MAKE_STATUS(kStatusGroup_LPUART, 12), /*!< LPUART parity error. */
46 MAKE_STATUS(kStatusGroup_LPUART, 13), /*!< Baudrate is not support in current clock source */
47 kStatus_LPUART_IdleLineDetected = MAKE_STATUS(kStatusGroup_LPUART, 14), /*!< IDLE flag. */
48};
49
50/*! @brief LPUART parity mode. */
52{
53 kLPUART_ParityDisabled = 0x0U, /*!< Parity disabled */
54 kLPUART_ParityEven = 0x2U, /*!< Parity enabled, type even, bit setting: PE|PT = 10 */
55 kLPUART_ParityOdd = 0x3U, /*!< Parity enabled, type odd, bit setting: PE|PT = 11 */
57
58/*! @brief LPUART data bits count. */
60{
61 kLPUART_EightDataBits = 0x0U, /*!< Eight data bit */
62#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
63 kLPUART_SevenDataBits = 0x1U, /*!< Seven data bit */
64#endif
66
67/*! @brief LPUART stop bit count. */
69{
70 kLPUART_OneStopBit = 0U, /*!< One stop bit */
71 kLPUART_TwoStopBit = 1U, /*!< Two stop bits */
73
74#if defined(FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT) && FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT
75/*! @brief LPUART transmit CTS source. */
77{
78 kLPUART_CtsSourcePin = 0U, /*!< CTS resource is the LPUART_CTS pin. */
79 kLPUART_CtsSourceMatchResult = 1U, /*!< CTS resource is the match result. */
81
82/*! @brief LPUART transmit CTS configure. */
84{
85 kLPUART_CtsSampleAtStart = 0U, /*!< CTS input is sampled at the start of each character. */
86 kLPUART_CtsSampleAtIdle = 1U, /*!< CTS input is sampled when the transmitter is idle */
88#endif
89
90/*! @brief LPUART idle flag type defines when the receiver starts counting. */
92{
93 kLPUART_IdleTypeStartBit = 0U, /*!< Start counting after a valid start bit. */
94 kLPUART_IdleTypeStopBit = 1U, /*!< Start counting after a stop bit. */
96
97/*! @brief LPUART idle detected configuration.
98 * This structure defines the number of idle characters that must be received before
99 * the IDLE flag is set.
100 */
102{
103 kLPUART_IdleCharacter1 = 0U, /*!< the number of idle characters. */
104 kLPUART_IdleCharacter2 = 1U, /*!< the number of idle characters. */
105 kLPUART_IdleCharacter4 = 2U, /*!< the number of idle characters. */
106 kLPUART_IdleCharacter8 = 3U, /*!< the number of idle characters. */
107 kLPUART_IdleCharacter16 = 4U, /*!< the number of idle characters. */
108 kLPUART_IdleCharacter32 = 5U, /*!< the number of idle characters. */
109 kLPUART_IdleCharacter64 = 6U, /*!< the number of idle characters. */
110 kLPUART_IdleCharacter128 = 7U, /*!< the number of idle characters. */
112
113/*!
114 * @brief LPUART interrupt configuration structure, default settings all disabled.
115 *
116 * This structure contains the settings for all LPUART interrupt configurations.
117 */
119{
120#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
121 kLPUART_LinBreakInterruptEnable = (LPUART_BAUD_LBKDIE_MASK >> 8), /*!< LIN break detect. */
122#endif
123 kLPUART_RxActiveEdgeInterruptEnable = (LPUART_BAUD_RXEDGIE_MASK >> 8), /*!< Receive Active Edge. */
124 kLPUART_TxDataRegEmptyInterruptEnable = (LPUART_CTRL_TIE_MASK), /*!< Transmit data register empty. */
125 kLPUART_TransmissionCompleteInterruptEnable = (LPUART_CTRL_TCIE_MASK), /*!< Transmission complete. */
126 kLPUART_RxDataRegFullInterruptEnable = (LPUART_CTRL_RIE_MASK), /*!< Receiver data register full. */
127 kLPUART_IdleLineInterruptEnable = (LPUART_CTRL_ILIE_MASK), /*!< Idle line. */
128 kLPUART_RxOverrunInterruptEnable = (LPUART_CTRL_ORIE_MASK), /*!< Receiver Overrun. */
129 kLPUART_NoiseErrorInterruptEnable = (LPUART_CTRL_NEIE_MASK), /*!< Noise error flag. */
130 kLPUART_FramingErrorInterruptEnable = (LPUART_CTRL_FEIE_MASK), /*!< Framing error flag. */
131 kLPUART_ParityErrorInterruptEnable = (LPUART_CTRL_PEIE_MASK), /*!< Parity error flag. */
132#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
133 kLPUART_TxFifoOverflowInterruptEnable = (LPUART_FIFO_TXOFE_MASK >> 8), /*!< Transmit FIFO Overflow. */
134 kLPUART_RxFifoUnderflowInterruptEnable = (LPUART_FIFO_RXUFE_MASK >> 8), /*!< Receive FIFO Underflow. */
135#endif
136};
137
138/*!
139 * @brief LPUART status flags.
140 *
141 * This provides constants for the LPUART status flags for use in the LPUART functions.
142 */
144{
146 (LPUART_STAT_TDRE_MASK), /*!< Transmit data register empty flag, sets when transmit buffer is empty */
148 (LPUART_STAT_TC_MASK), /*!< Transmission complete flag, sets when transmission activity complete */
150 (LPUART_STAT_RDRF_MASK), /*!< Receive data register full flag, sets when the receive data buffer is full */
151 kLPUART_IdleLineFlag = (LPUART_STAT_IDLE_MASK), /*!< Idle line detect flag, sets when idle line detected */
152 kLPUART_RxOverrunFlag = (LPUART_STAT_OR_MASK), /*!< Receive Overrun, sets when new data is received before data is
153 read from receive register */
154 kLPUART_NoiseErrorFlag = (LPUART_STAT_NF_MASK), /*!< Receive takes 3 samples of each received bit. If any of these
155 samples differ, noise flag sets */
157 (LPUART_STAT_FE_MASK), /*!< Frame error flag, sets if logic 0 was detected where stop bit expected */
158 kLPUART_ParityErrorFlag = (LPUART_STAT_PF_MASK), /*!< If parity enabled, sets upon parity error detection */
159#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
161 (int)(LPUART_STAT_LBKDIF_MASK), /*!< LIN break detect interrupt flag, sets when LIN break char
162 detected and LIN circuit enabled */
163#endif
165 (LPUART_STAT_RXEDGIF_MASK), /*!< Receive pin active edge interrupt flag, sets when active edge detected */
167 (LPUART_STAT_RAF_MASK), /*!< Receiver Active Flag (RAF), sets at beginning of valid start bit */
168#if defined(FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING) && FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING
169 kLPUART_DataMatch1Flag = LPUART_STAT_MA1F_MASK, /*!< The next character to be read from LPUART_DATA matches MA1*/
170 kLPUART_DataMatch2Flag = LPUART_STAT_MA2F_MASK, /*!< The next character to be read from LPUART_DATA matches MA2*/
171#endif
172#if defined(FSL_FEATURE_LPUART_HAS_EXTENDED_DATA_REGISTER_FLAGS) && FSL_FEATURE_LPUART_HAS_EXTENDED_DATA_REGISTER_FLAGS
174 (LPUART_DATA_NOISY_MASK >> 10), /*!< NOISY bit, sets if noise detected in current data word */
176 (LPUART_DATA_PARITYE_MASK >> 10), /*!< PARITYE bit, sets if noise detected in current data word */
177#endif
178#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
179 kLPUART_TxFifoEmptyFlag = (LPUART_FIFO_TXEMPT_MASK >> 16), /*!< TXEMPT bit, sets if transmit buffer is empty */
180 kLPUART_RxFifoEmptyFlag = (LPUART_FIFO_RXEMPT_MASK >> 16), /*!< RXEMPT bit, sets if receive buffer is empty */
182 (LPUART_FIFO_TXOF_MASK >> 16), /*!< TXOF bit, sets if transmit buffer overflow occurred */
184 (LPUART_FIFO_RXUF_MASK >> 16), /*!< RXUF bit, sets if receive buffer underflow occurred */
185#endif
186};
187
188/*! @brief LPUART configuration structure. */
189typedef struct _lpuart_config
190{
191 uint32_t baudRate_Bps; /*!< LPUART baud rate */
192 lpuart_parity_mode_t parityMode; /*!< Parity mode, disabled (default), even, odd */
193 lpuart_data_bits_t dataBitsCount; /*!< Data bits count, eight (default), seven */
194 bool isMsb; /*!< Data bits order, LSB (default), MSB */
195#if defined(FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT) && FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT
196 lpuart_stop_bit_count_t stopBitCount; /*!< Number of stop bits, 1 stop bit (default) or 2 stop bits */
197#endif
198#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
199 uint8_t txFifoWatermark; /*!< TX FIFO watermark */
200 uint8_t rxFifoWatermark; /*!< RX FIFO watermark */
201#endif
202#if defined(FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT) && FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT
203 bool enableRxRTS; /*!< RX RTS enable */
204 bool enableTxCTS; /*!< TX CTS enable */
207#endif
209 lpuart_idle_config_t rxIdleConfig; /*!< RX IDLE configuration. */
210 bool enableTx; /*!< Enable TX */
211 bool enableRx; /*!< Enable RX */
213
214/*! @brief LPUART transfer structure. */
215typedef struct _lpuart_transfer
216{
217 uint8_t *data; /*!< The buffer of data to be transfer.*/
218 size_t dataSize; /*!< The byte count to be transfer. */
220
221/* Forward declaration of the handle typedef. */
223
224/*! @brief LPUART transfer callback function. */
225typedef void (*lpuart_transfer_callback_t)(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData);
226
227/*! @brief LPUART handle structure. */
229{
230 uint8_t *volatile txData; /*!< Address of remaining data to send. */
231 volatile size_t txDataSize; /*!< Size of the remaining data to send. */
232 size_t txDataSizeAll; /*!< Size of the data to send out. */
233 uint8_t *volatile rxData; /*!< Address of remaining data to receive. */
234 volatile size_t rxDataSize; /*!< Size of the remaining data to receive. */
235 size_t rxDataSizeAll; /*!< Size of the data to receive. */
236
237 uint8_t *rxRingBuffer; /*!< Start address of the receiver ring buffer. */
238 size_t rxRingBufferSize; /*!< Size of the ring buffer. */
239 volatile uint16_t rxRingBufferHead; /*!< Index for the driver to store received data into ring buffer. */
240 volatile uint16_t rxRingBufferTail; /*!< Index for the user to get data from the ring buffer. */
241
242 lpuart_transfer_callback_t callback; /*!< Callback function. */
243 void *userData; /*!< LPUART callback function parameter.*/
244
245 volatile uint8_t txState; /*!< TX transfer state. */
246 volatile uint8_t rxState; /*!< RX transfer state. */
247
248#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
249 bool isSevenDataBits; /*!< Seven data bits flag. */
250#endif
251};
252
253/*******************************************************************************
254 * API
255 ******************************************************************************/
256
257#if defined(__cplusplus)
258extern "C" {
259#endif /* _cplusplus */
260
261#if defined(FSL_FEATURE_LPUART_HAS_GLOBAL) && FSL_FEATURE_LPUART_HAS_GLOBAL
262
263/*!
264 * @name Software Reset
265 * @{
266 */
267
268/*!
269 * @brief Resets the LPUART using software.
270 *
271 * This function resets all internal logic and registers except the Global Register.
272 * Remains set until cleared by software.
273 *
274 * @param base LPUART peripheral base address.
275 */
276static inline void LPUART_SoftwareReset(LPUART_Type *base)
277{
278 base->GLOBAL |= LPUART_GLOBAL_RST_MASK;
279 base->GLOBAL &= ~LPUART_GLOBAL_RST_MASK;
280}
281/* @} */
282#endif /*FSL_FEATURE_LPUART_HAS_GLOBAL*/
283
284/*!
285 * @name Initialization and deinitialization
286 * @{
287 */
288
289/*!
290 * @brief Initializes an LPUART instance with the user configuration structure and the peripheral clock.
291 *
292 * This function configures the LPUART module with user-defined settings. Call the LPUART_GetDefaultConfig() function
293 * to configure the configuration structure and get the default configuration.
294 * The example below shows how to use this API to configure the LPUART.
295 * @code
296 * lpuart_config_t lpuartConfig;
297 * lpuartConfig.baudRate_Bps = 115200U;
298 * lpuartConfig.parityMode = kLPUART_ParityDisabled;
299 * lpuartConfig.dataBitsCount = kLPUART_EightDataBits;
300 * lpuartConfig.isMsb = false;
301 * lpuartConfig.stopBitCount = kLPUART_OneStopBit;
302 * lpuartConfig.txFifoWatermark = 0;
303 * lpuartConfig.rxFifoWatermark = 1;
304 * LPUART_Init(LPUART1, &lpuartConfig, 20000000U);
305 * @endcode
306 *
307 * @param base LPUART peripheral base address.
308 * @param config Pointer to a user-defined configuration structure.
309 * @param srcClock_Hz LPUART clock source frequency in HZ.
310 * @retval kStatus_LPUART_BaudrateNotSupport Baudrate is not support in current clock source.
311 * @retval kStatus_Success LPUART initialize succeed
312 */
313status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz);
314
315/*!
316 * @brief Deinitializes a LPUART instance.
317 *
318 * This function waits for transmit to complete, disables TX and RX, and disables the LPUART clock.
319 *
320 * @param base LPUART peripheral base address.
321 */
322void LPUART_Deinit(LPUART_Type *base);
323
324/*!
325 * @brief Gets the default configuration structure.
326 *
327 * This function initializes the LPUART configuration structure to a default value. The default
328 * values are:
329 * lpuartConfig->baudRate_Bps = 115200U;
330 * lpuartConfig->parityMode = kLPUART_ParityDisabled;
331 * lpuartConfig->dataBitsCount = kLPUART_EightDataBits;
332 * lpuartConfig->isMsb = false;
333 * lpuartConfig->stopBitCount = kLPUART_OneStopBit;
334 * lpuartConfig->txFifoWatermark = 0;
335 * lpuartConfig->rxFifoWatermark = 1;
336 * lpuartConfig->rxIdleType = kLPUART_IdleTypeStartBit;
337 * lpuartConfig->rxIdleConfig = kLPUART_IdleCharacter1;
338 * lpuartConfig->enableTx = false;
339 * lpuartConfig->enableRx = false;
340 *
341 * @param config Pointer to a configuration structure.
342 */
344
345/*!
346 * @brief Sets the LPUART instance baudrate.
347 *
348 * This function configures the LPUART module baudrate. This function is used to update
349 * the LPUART module baudrate after the LPUART module is initialized by the LPUART_Init.
350 * @code
351 * LPUART_SetBaudRate(LPUART1, 115200U, 20000000U);
352 * @endcode
353 *
354 * @param base LPUART peripheral base address.
355 * @param baudRate_Bps LPUART baudrate to be set.
356 * @param srcClock_Hz LPUART clock source frequency in HZ.
357 * @retval kStatus_LPUART_BaudrateNotSupport Baudrate is not supported in the current clock source.
358 * @retval kStatus_Success Set baudrate succeeded.
359 */
360status_t LPUART_SetBaudRate(LPUART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz);
361
362/* @} */
363
364/*!
365 * @name Status
366 * @{
367 */
368
369/*!
370 * @brief Gets LPUART status flags.
371 *
372 * This function gets all LPUART status flags. The flags are returned as the logical
373 * OR value of the enumerators @ref _lpuart_flags. To check for a specific status,
374 * compare the return value with enumerators in the @ref _lpuart_flags.
375 * For example, to check whether the TX is empty:
376 * @code
377 * if (kLPUART_TxDataRegEmptyFlag & LPUART_GetStatusFlags(LPUART1))
378 * {
379 * ...
380 * }
381 * @endcode
382 *
383 * @param base LPUART peripheral base address.
384 * @return LPUART status flags which are ORed by the enumerators in the _lpuart_flags.
385 */
386uint32_t LPUART_GetStatusFlags(LPUART_Type *base);
387
388/*!
389 * @brief Clears status flags with a provided mask.
390 *
391 * This function clears LPUART status flags with a provided mask. Automatically cleared flags
392 * can't be cleared by this function.
393 * Flags that can only cleared or set by hardware are:
394 * kLPUART_TxDataRegEmptyFlag, kLPUART_TransmissionCompleteFlag, kLPUART_RxDataRegFullFlag,
395 * kLPUART_RxActiveFlag, kLPUART_NoiseErrorInRxDataRegFlag, kLPUART_ParityErrorInRxDataRegFlag,
396 * kLPUART_TxFifoEmptyFlag,kLPUART_RxFifoEmptyFlag
397 * Note: This API should be called when the Tx/Rx is idle, otherwise it takes no effects.
398 *
399 * @param base LPUART peripheral base address.
400 * @param mask the status flags to be cleared. The user can use the enumerators in the
401 * _lpuart_status_flag_t to do the OR operation and get the mask.
402 * @return 0 succeed, others failed.
403 * @retval kStatus_LPUART_FlagCannotClearManually The flag can't be cleared by this function but
404 * it is cleared automatically by hardware.
405 * @retval kStatus_Success Status in the mask are cleared.
406 */
407status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask);
408
409/* @} */
410
411/*!
412 * @name Interrupts
413 * @{
414 */
415
416/*!
417 * @brief Enables LPUART interrupts according to a provided mask.
418 *
419 * This function enables the LPUART interrupts according to a provided mask. The mask
420 * is a logical OR of enumeration members. See the @ref _lpuart_interrupt_enable.
421 * This examples shows how to enable TX empty interrupt and RX full interrupt:
422 * @code
423 * LPUART_EnableInterrupts(LPUART1,kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable);
424 * @endcode
425 *
426 * @param base LPUART peripheral base address.
427 * @param mask The interrupts to enable. Logical OR of @ref _uart_interrupt_enable.
428 */
429void LPUART_EnableInterrupts(LPUART_Type *base, uint32_t mask);
430
431/*!
432 * @brief Disables LPUART interrupts according to a provided mask.
433 *
434 * This function disables the LPUART interrupts according to a provided mask. The mask
435 * is a logical OR of enumeration members. See @ref _lpuart_interrupt_enable.
436 * This example shows how to disable the TX empty interrupt and RX full interrupt:
437 * @code
438 * LPUART_DisableInterrupts(LPUART1,kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable);
439 * @endcode
440 *
441 * @param base LPUART peripheral base address.
442 * @param mask The interrupts to disable. Logical OR of @ref _lpuart_interrupt_enable.
443 */
444void LPUART_DisableInterrupts(LPUART_Type *base, uint32_t mask);
445
446/*!
447 * @brief Gets enabled LPUART interrupts.
448 *
449 * This function gets the enabled LPUART interrupts. The enabled interrupts are returned
450 * as the logical OR value of the enumerators @ref _lpuart_interrupt_enable. To check
451 * a specific interrupt enable status, compare the return value with enumerators
452 * in @ref _lpuart_interrupt_enable.
453 * For example, to check whether the TX empty interrupt is enabled:
454 * @code
455 * uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(LPUART1);
456 *
457 * if (kLPUART_TxDataRegEmptyInterruptEnable & enabledInterrupts)
458 * {
459 * ...
460 * }
461 * @endcode
462 *
463 * @param base LPUART peripheral base address.
464 * @return LPUART interrupt flags which are logical OR of the enumerators in @ref _lpuart_interrupt_enable.
465 */
466uint32_t LPUART_GetEnabledInterrupts(LPUART_Type *base);
467
468#if defined(FSL_FEATURE_LPUART_HAS_DMA_ENABLE) && FSL_FEATURE_LPUART_HAS_DMA_ENABLE
469/*!
470 * @brief Gets the LPUART data register address.
471 *
472 * This function returns the LPUART data register address, which is mainly used by the DMA/eDMA.
473 *
474 * @param base LPUART peripheral base address.
475 * @return LPUART data register addresses which are used both by the transmitter and receiver.
476 */
477static inline uint32_t LPUART_GetDataRegisterAddress(LPUART_Type *base)
478{
479 return (uint32_t) & (base->DATA);
480}
481
482/*!
483 * @brief Enables or disables the LPUART transmitter DMA request.
484 *
485 * This function enables or disables the transmit data register empty flag, STAT[TDRE], to generate DMA requests.
486 *
487 * @param base LPUART peripheral base address.
488 * @param enable True to enable, false to disable.
489 */
490static inline void LPUART_EnableTxDMA(LPUART_Type *base, bool enable)
491{
492 if (enable)
493 {
494 base->BAUD |= LPUART_BAUD_TDMAE_MASK;
495 }
496 else
497 {
498 base->BAUD &= ~LPUART_BAUD_TDMAE_MASK;
499 }
500}
501
502/*!
503 * @brief Enables or disables the LPUART receiver DMA.
504 *
505 * This function enables or disables the receiver data register full flag, STAT[RDRF], to generate DMA requests.
506 *
507 * @param base LPUART peripheral base address.
508 * @param enable True to enable, false to disable.
509 */
510static inline void LPUART_EnableRxDMA(LPUART_Type *base, bool enable)
511{
512 if (enable)
513 {
514 base->BAUD |= LPUART_BAUD_RDMAE_MASK;
515 }
516 else
517 {
518 base->BAUD &= ~LPUART_BAUD_RDMAE_MASK;
519 }
520}
521
522/* @} */
523#endif /* FSL_FEATURE_LPUART_HAS_DMA_ENABLE */
524
525/*!
526 * @name Bus Operations
527 * @{
528 */
529
530/*!
531 * @brief Get the LPUART instance from peripheral base address.
532 *
533 * @param base LPUART peripheral base address.
534 * @return LPUART instance.
535 */
536uint32_t LPUART_GetInstance(LPUART_Type *base);
537
538/*!
539 * @brief Enables or disables the LPUART transmitter.
540 *
541 * This function enables or disables the LPUART transmitter.
542 *
543 * @param base LPUART peripheral base address.
544 * @param enable True to enable, false to disable.
545 */
546static inline void LPUART_EnableTx(LPUART_Type *base, bool enable)
547{
548 if (enable)
549 {
550 base->CTRL |= LPUART_CTRL_TE_MASK;
551 }
552 else
553 {
554 base->CTRL &= ~LPUART_CTRL_TE_MASK;
555 }
556}
557
558/*!
559 * @brief Enables or disables the LPUART receiver.
560 *
561 * This function enables or disables the LPUART receiver.
562 *
563 * @param base LPUART peripheral base address.
564 * @param enable True to enable, false to disable.
565 */
566static inline void LPUART_EnableRx(LPUART_Type *base, bool enable)
567{
568 if (enable)
569 {
570 base->CTRL |= LPUART_CTRL_RE_MASK;
571 }
572 else
573 {
574 base->CTRL &= ~LPUART_CTRL_RE_MASK;
575 }
576}
577
578/*!
579 * @brief Writes to the transmitter register.
580 *
581 * This function writes data to the transmitter register directly. The upper layer must
582 * ensure that the TX register is empty or that the TX FIFO has room before calling this function.
583 *
584 * @param base LPUART peripheral base address.
585 * @param data Data write to the TX register.
586 */
587static inline void LPUART_WriteByte(LPUART_Type *base, uint8_t data)
588{
589 base->DATA = data;
590}
591
592/*!
593 * @brief Reads the receiver register.
594 *
595 * This function reads data from the receiver register directly. The upper layer must
596 * ensure that the receiver register is full or that the RX FIFO has data before calling this function.
597 *
598 * @param base LPUART peripheral base address.
599 * @return Data read from data register.
600 */
601static inline uint8_t LPUART_ReadByte(LPUART_Type *base)
602{
603#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
604 uint32_t ctrl = base->CTRL;
605 bool isSevenDataBits =
606 ((ctrl & LPUART_CTRL_M7_MASK) ||
607 ((!(ctrl & LPUART_CTRL_M7_MASK)) && (!(ctrl & LPUART_CTRL_M_MASK)) && (ctrl & LPUART_CTRL_PE_MASK)));
608
609 if (isSevenDataBits)
610 {
611 return (base->DATA & 0x7F);
612 }
613 else
614 {
615 return base->DATA;
616 }
617#else
618 return base->DATA;
619#endif
620}
621
622/*!
623 * @brief Writes to the transmitter register using a blocking method.
624 *
625 * This function polls the transmitter register, waits for the register to be empty or for TX FIFO to have
626 * room, and writes data to the transmitter buffer.
627 *
628 * @note This function does not check whether all data has been sent out to the bus.
629 * Before disabling the transmitter, check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is
630 * finished.
631 *
632 * @param base LPUART peripheral base address.
633 * @param data Start address of the data to write.
634 * @param length Size of the data to write.
635 */
636void LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length);
637
638/*!
639* @brief Reads the receiver data register using a blocking method.
640 *
641 * This function polls the receiver register, waits for the receiver register full or receiver FIFO
642 * has data, and reads data from the TX register.
643 *
644 * @param base LPUART peripheral base address.
645 * @param data Start address of the buffer to store the received data.
646 * @param length Size of the buffer.
647 * @retval kStatus_LPUART_RxHardwareOverrun Receiver overrun happened while receiving data.
648 * @retval kStatus_LPUART_NoiseError Noise error happened while receiving data.
649 * @retval kStatus_LPUART_FramingError Framing error happened while receiving data.
650 * @retval kStatus_LPUART_ParityError Parity error happened while receiving data.
651 * @retval kStatus_Success Successfully received all data.
652 */
653status_t LPUART_ReadBlocking(LPUART_Type *base, uint8_t *data, size_t length);
654
655/* @} */
656
657/*!
658 * @name Transactional
659 * @{
660 */
661
662/*!
663 * @brief Initializes the LPUART handle.
664 *
665 * This function initializes the LPUART handle, which can be used for other LPUART
666 * transactional APIs. Usually, for a specified LPUART instance,
667 * call this API once to get the initialized handle.
668 *
669 * The LPUART driver supports the "background" receiving, which means that user can set up
670 * an RX ring buffer optionally. Data received is stored into the ring buffer even when the
671 * user doesn't call the LPUART_TransferReceiveNonBlocking() API. If there is already data received
672 * in the ring buffer, the user can get the received data from the ring buffer directly.
673 * The ring buffer is disabled if passing NULL as @p ringBuffer.
674 *
675 * @param base LPUART peripheral base address.
676 * @param handle LPUART handle pointer.
677 * @param callback Callback function.
678 * @param userData User data.
679 */
680void LPUART_TransferCreateHandle(LPUART_Type *base,
681 lpuart_handle_t *handle,
683 void *userData);
684/*!
685 * @brief Transmits a buffer of data using the interrupt method.
686 *
687 * This function send data using an interrupt method. This is a non-blocking function, which
688 * returns directly without waiting for all data written to the transmitter register. When
689 * all data is written to the TX register in the ISR, the LPUART driver calls the callback
690 * function and passes the @ref kStatus_LPUART_TxIdle as status parameter.
691 *
692 * @note The kStatus_LPUART_TxIdle is passed to the upper layer when all data are written
693 * to the TX register. However, there is no check to ensure that all the data sent out. Before disabling the TX,
694 * check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is finished.
695 *
696 * @param base LPUART peripheral base address.
697 * @param handle LPUART handle pointer.
698 * @param xfer LPUART transfer structure, see #lpuart_transfer_t.
699 * @retval kStatus_Success Successfully start the data transmission.
700 * @retval kStatus_LPUART_TxBusy Previous transmission still not finished, data not all written to the TX register.
701 * @retval kStatus_InvalidArgument Invalid argument.
702 */
704
705/*!
706 * @brief Sets up the RX ring buffer.
707 *
708 * This function sets up the RX ring buffer to a specific UART handle.
709 *
710 * When the RX ring buffer is used, data received is stored into the ring buffer even when
711 * the user doesn't call the UART_TransferReceiveNonBlocking() API. If there is already data received
712 * in the ring buffer, the user can get the received data from the ring buffer directly.
713 *
714 * @note When using RX ring buffer, one byte is reserved for internal use. In other
715 * words, if @p ringBufferSize is 32, then only 31 bytes are used for saving data.
716 *
717 * @param base LPUART peripheral base address.
718 * @param handle LPUART handle pointer.
719 * @param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer.
720 * @param ringBufferSize size of the ring buffer.
721 */
722void LPUART_TransferStartRingBuffer(LPUART_Type *base,
723 lpuart_handle_t *handle,
724 uint8_t *ringBuffer,
725 size_t ringBufferSize);
726
727/*!
728 * @brief Aborts the background transfer and uninstalls the ring buffer.
729 *
730 * This function aborts the background transfer and uninstalls the ring buffer.
731 *
732 * @param base LPUART peripheral base address.
733 * @param handle LPUART handle pointer.
734 */
735void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle);
736
737/*!
738 * @brief Get the length of received data in RX ring buffer.
739 *
740 * @param handle LPUART handle pointer.
741 * @return Length of received data in RX ring buffer.
742 */
743size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle);
744
745/*!
746 * @brief Aborts the interrupt-driven data transmit.
747 *
748 * This function aborts the interrupt driven data sending. The user can get the remainBtyes to find out
749 * how many bytes are not sent out.
750 *
751 * @param base LPUART peripheral base address.
752 * @param handle LPUART handle pointer.
753 */
754void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle);
755
756/*!
757 * @brief Gets the number of bytes that have been written to the LPUART transmitter register.
758 *
759 * This function gets the number of bytes that have been written to LPUART TX
760 * register by an interrupt method.
761 *
762 * @param base LPUART peripheral base address.
763 * @param handle LPUART handle pointer.
764 * @param count Send bytes count.
765 * @retval kStatus_NoTransferInProgress No send in progress.
766 * @retval kStatus_InvalidArgument Parameter is invalid.
767 * @retval kStatus_Success Get successfully through the parameter \p count;
768 */
769status_t LPUART_TransferGetSendCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count);
770
771/*!
772 * @brief Receives a buffer of data using the interrupt method.
773 *
774 * This function receives data using an interrupt method. This is a non-blocking function
775 * which returns without waiting to ensure that all data are received.
776 * If the RX ring buffer is used and not empty, the data in the ring buffer is copied and
777 * the parameter @p receivedBytes shows how many bytes are copied from the ring buffer.
778 * After copying, if the data in the ring buffer is not enough for read, the receive
779 * request is saved by the LPUART driver. When the new data arrives, the receive request
780 * is serviced first. When all data is received, the LPUART driver notifies the upper layer
781 * through a callback function and passes a status parameter @ref kStatus_UART_RxIdle.
782 * For example, the upper layer needs 10 bytes but there are only 5 bytes in ring buffer.
783 * The 5 bytes are copied to xfer->data, which returns with the
784 * parameter @p receivedBytes set to 5. For the remaining 5 bytes, the newly arrived data is
785 * saved from xfer->data[5]. When 5 bytes are received, the LPUART driver notifies the upper layer.
786 * If the RX ring buffer is not enabled, this function enables the RX and RX interrupt
787 * to receive data to xfer->data. When all data is received, the upper layer is notified.
788 *
789 * @param base LPUART peripheral base address.
790 * @param handle LPUART handle pointer.
791 * @param xfer LPUART transfer structure, see #uart_transfer_t.
792 * @param receivedBytes Bytes received from the ring buffer directly.
793 * @retval kStatus_Success Successfully queue the transfer into the transmit queue.
794 * @retval kStatus_LPUART_RxBusy Previous receive request is not finished.
795 * @retval kStatus_InvalidArgument Invalid argument.
796 */
798 lpuart_handle_t *handle,
799 lpuart_transfer_t *xfer,
800 size_t *receivedBytes);
801
802/*!
803 * @brief Aborts the interrupt-driven data receiving.
804 *
805 * This function aborts the interrupt-driven data receiving. The user can get the remainBytes to find out
806 * how many bytes not received yet.
807 *
808 * @param base LPUART peripheral base address.
809 * @param handle LPUART handle pointer.
810 */
811void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle);
812
813/*!
814 * @brief Gets the number of bytes that have been received.
815 *
816 * This function gets the number of bytes that have been received.
817 *
818 * @param base LPUART peripheral base address.
819 * @param handle LPUART handle pointer.
820 * @param count Receive bytes count.
821 * @retval kStatus_NoTransferInProgress No receive in progress.
822 * @retval kStatus_InvalidArgument Parameter is invalid.
823 * @retval kStatus_Success Get successfully through the parameter \p count;
824 */
825status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count);
826
827/*!
828 * @brief LPUART IRQ handle function.
829 *
830 * This function handles the LPUART transmit and receive IRQ request.
831 *
832 * @param base LPUART peripheral base address.
833 * @param handle LPUART handle pointer.
834 */
835void LPUART_TransferHandleIRQ(LPUART_Type *base, lpuart_handle_t *handle);
836
837/*!
838 * @brief LPUART Error IRQ handle function.
839 *
840 * This function handles the LPUART error IRQ request.
841 *
842 * @param base LPUART peripheral base address.
843 * @param handle LPUART handle pointer.
844 */
845void LPUART_TransferHandleErrorIRQ(LPUART_Type *base, lpuart_handle_t *handle);
846
847/* @} */
848
849#if defined(__cplusplus)
850}
851#endif
852
853/*! @}*/
854
855#endif /* _FSL_LPUART_H_ */
static constexpr persistent_config_s * config
int32_t status_t
Type used for all status and error return values.
Definition fsl_common.h:169
@ kStatusGroup_LPUART
Definition fsl_common.h:73
lpuart_transmit_cts_config_t txCtsConfig
Definition fsl_lpuart.h:206
static uint8_t LPUART_ReadByte(LPUART_Type *base)
Reads the receiver register.
Definition fsl_lpuart.h:601
uint8_t rxFifoWatermark
Definition fsl_lpuart.h:200
size_t rxRingBufferSize
Definition fsl_lpuart.h:238
void LPUART_TransferCreateHandle(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_callback_t callback, void *userData)
Initializes the LPUART handle.
Definition fsl_lpuart.c:942
uint8_t * rxRingBuffer
Definition fsl_lpuart.h:237
_lpuart_idle_config
LPUART idle detected configuration. This structure defines the number of idle characters that must be...
Definition fsl_lpuart.h:102
volatile uint8_t txState
Definition fsl_lpuart.h:245
uint32_t LPUART_GetEnabledInterrupts(LPUART_Type *base)
Gets enabled LPUART interrupts.
Definition fsl_lpuart.c:717
enum _lpuart_transmit_cts_source lpuart_transmit_cts_source_t
LPUART transmit CTS source.
_lpuart_interrupt_enable
LPUART interrupt configuration structure, default settings all disabled.
Definition fsl_lpuart.h:119
uint8_t txFifoWatermark
Definition fsl_lpuart.h:199
volatile uint16_t rxRingBufferHead
Definition fsl_lpuart.h:239
void LPUART_TransferHandleErrorIRQ(LPUART_Type *base, lpuart_handle_t *handle)
LPUART Error IRQ handle function.
_lpuart_parity_mode
LPUART parity mode.
Definition fsl_lpuart.h:52
uint8_t *volatile rxData
Definition fsl_lpuart.h:233
lpuart_transmit_cts_source_t txCtsSource
Definition fsl_lpuart.h:205
_lpuart_flags
LPUART status flags.
Definition fsl_lpuart.h:144
size_t txDataSizeAll
Definition fsl_lpuart.h:232
void LPUART_DisableInterrupts(LPUART_Type *base, uint32_t mask)
Disables LPUART interrupts according to a provided mask.
Definition fsl_lpuart.c:686
status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz)
Initializes an LPUART instance with the user configuration structure and the peripheral clock.
Definition fsl_lpuart.c:239
volatile uint16_t rxRingBufferTail
Definition fsl_lpuart.h:240
void LPUART_Deinit(LPUART_Type *base)
Deinitializes a LPUART instance.
Definition fsl_lpuart.c:455
struct _lpuart_transfer lpuart_transfer_t
LPUART transfer structure.
enum _lpuart_idle_type_select lpuart_idle_type_select_t
LPUART idle flag type defines when the receiver starts counting.
lpuart_parity_mode_t parityMode
Definition fsl_lpuart.h:192
lpuart_idle_type_select_t rxIdleType
Definition fsl_lpuart.h:208
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data receiving.
static void LPUART_EnableTx(LPUART_Type *base, bool enable)
Enables or disables the LPUART transmitter.
Definition fsl_lpuart.h:546
void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
Sets up the RX ring buffer.
size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
Get the length of received data in RX ring buffer.
Definition fsl_lpuart.c:135
void(* lpuart_transfer_callback_t)(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData)
LPUART transfer callback function.
Definition fsl_lpuart.h:225
_lpuart_data_bits
LPUART data bits count.
Definition fsl_lpuart.h:60
static void LPUART_SoftwareReset(LPUART_Type *base)
Resets the LPUART using software.
Definition fsl_lpuart.h:276
uint8_t *volatile txData
Definition fsl_lpuart.h:230
_lpuart_idle_type_select
LPUART idle flag type defines when the receiver starts counting.
Definition fsl_lpuart.h:92
enum _lpuart_transmit_cts_config lpuart_transmit_cts_config_t
LPUART transmit CTS configure.
enum _lpuart_data_bits lpuart_data_bits_t
LPUART data bits count.
void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data transmit.
struct _lpuart_config lpuart_config_t
LPUART configuration structure.
status_t LPUART_TransferReceiveNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer, size_t *receivedBytes)
Receives a buffer of data using the interrupt method.
_lpuart_status
Error codes for the LPUART driver.
Definition fsl_lpuart.h:30
lpuart_stop_bit_count_t stopBitCount
Definition fsl_lpuart.h:196
void LPUART_GetDefaultConfig(lpuart_config_t *config)
Gets the default configuration structure.
Definition fsl_lpuart.c:519
static void LPUART_WriteByte(LPUART_Type *base, uint8_t data)
Writes to the transmitter register.
Definition fsl_lpuart.h:587
volatile size_t txDataSize
Definition fsl_lpuart.h:231
enum _lpuart_stop_bit_count lpuart_stop_bit_count_t
LPUART stop bit count.
static void LPUART_EnableTxDMA(LPUART_Type *base, bool enable)
Enables or disables the LPUART transmitter DMA request.
Definition fsl_lpuart.h:490
static void LPUART_EnableRx(LPUART_Type *base, bool enable)
Enables or disables the LPUART receiver.
Definition fsl_lpuart.h:566
enum _lpuart_parity_mode lpuart_parity_mode_t
LPUART parity mode.
uint32_t LPUART_GetInstance(LPUART_Type *base)
Get the LPUART instance from peripheral base address.
Definition fsl_lpuart.c:111
enum _lpuart_idle_config lpuart_idle_config_t
LPUART idle detected configuration. This structure defines the number of idle characters that must be...
lpuart_transfer_callback_t callback
Definition fsl_lpuart.h:242
lpuart_idle_config_t rxIdleConfig
Definition fsl_lpuart.h:209
void LPUART_EnableInterrupts(LPUART_Type *base, uint32_t mask)
Enables LPUART interrupts according to a provided mask.
Definition fsl_lpuart.c:662
uint32_t LPUART_GetStatusFlags(LPUART_Type *base)
Gets LPUART status flags.
Definition fsl_lpuart.c:746
status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
Gets the number of bytes that have been received.
volatile uint8_t rxState
Definition fsl_lpuart.h:246
void LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
Writes to the transmitter register using a blocking method.
Definition fsl_lpuart.c:832
status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask)
Clears status flags with a provided mask.
Definition fsl_lpuart.c:777
void LPUART_TransferHandleIRQ(LPUART_Type *base, lpuart_handle_t *handle)
LPUART IRQ handle function.
volatile size_t rxDataSize
Definition fsl_lpuart.h:234
_lpuart_stop_bit_count
LPUART stop bit count.
Definition fsl_lpuart.h:69
void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the background transfer and uninstalls the ring buffer.
status_t LPUART_TransferGetSendCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
Gets the number of bytes that have been written to the LPUART transmitter register.
static void LPUART_EnableRxDMA(LPUART_Type *base, bool enable)
Enables or disables the LPUART receiver DMA.
Definition fsl_lpuart.h:510
size_t rxDataSizeAll
Definition fsl_lpuart.h:235
status_t LPUART_ReadBlocking(LPUART_Type *base, uint8_t *data, size_t length)
Reads the receiver data register using a blocking method.
Definition fsl_lpuart.c:862
uint32_t baudRate_Bps
Definition fsl_lpuart.h:191
_lpuart_transmit_cts_config
LPUART transmit CTS configure.
Definition fsl_lpuart.h:84
status_t LPUART_SetBaudRate(LPUART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
Sets the LPUART instance baudrate.
Definition fsl_lpuart.c:564
static uint32_t LPUART_GetDataRegisterAddress(LPUART_Type *base)
Gets the LPUART data register address.
Definition fsl_lpuart.h:477
_lpuart_transmit_cts_source
LPUART transmit CTS source.
Definition fsl_lpuart.h:77
lpuart_data_bits_t dataBitsCount
Definition fsl_lpuart.h:193
status_t LPUART_TransferSendNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer)
Transmits a buffer of data using the interrupt method.
@ kLPUART_IdleCharacter32
Definition fsl_lpuart.h:108
@ kLPUART_IdleCharacter2
Definition fsl_lpuart.h:104
@ kLPUART_IdleCharacter128
Definition fsl_lpuart.h:110
@ kLPUART_IdleCharacter1
Definition fsl_lpuart.h:103
@ kLPUART_IdleCharacter64
Definition fsl_lpuart.h:109
@ kLPUART_IdleCharacter4
Definition fsl_lpuart.h:105
@ kLPUART_IdleCharacter16
Definition fsl_lpuart.h:107
@ kLPUART_IdleCharacter8
Definition fsl_lpuart.h:106
@ kLPUART_TransmissionCompleteInterruptEnable
Definition fsl_lpuart.h:125
@ kLPUART_TxDataRegEmptyInterruptEnable
Definition fsl_lpuart.h:124
@ kLPUART_ParityErrorInterruptEnable
Definition fsl_lpuart.h:131
@ kLPUART_FramingErrorInterruptEnable
Definition fsl_lpuart.h:130
@ kLPUART_TxFifoOverflowInterruptEnable
Definition fsl_lpuart.h:133
@ kLPUART_RxActiveEdgeInterruptEnable
Definition fsl_lpuart.h:123
@ kLPUART_RxDataRegFullInterruptEnable
Definition fsl_lpuart.h:126
@ kLPUART_RxOverrunInterruptEnable
Definition fsl_lpuart.h:128
@ kLPUART_RxFifoUnderflowInterruptEnable
Definition fsl_lpuart.h:134
@ kLPUART_NoiseErrorInterruptEnable
Definition fsl_lpuart.h:129
@ kLPUART_LinBreakInterruptEnable
Definition fsl_lpuart.h:121
@ kLPUART_IdleLineInterruptEnable
Definition fsl_lpuart.h:127
@ kLPUART_ParityDisabled
Definition fsl_lpuart.h:53
@ kLPUART_ParityEven
Definition fsl_lpuart.h:54
@ kLPUART_ParityOdd
Definition fsl_lpuart.h:55
@ kLPUART_RxFifoUnderflowFlag
Definition fsl_lpuart.h:183
@ kLPUART_NoiseErrorInRxDataRegFlag
Definition fsl_lpuart.h:173
@ kLPUART_RxActiveFlag
Definition fsl_lpuart.h:166
@ kLPUART_NoiseErrorFlag
Definition fsl_lpuart.h:154
@ kLPUART_ParityErrorInRxDataRegFlag
Definition fsl_lpuart.h:175
@ kLPUART_ParityErrorFlag
Definition fsl_lpuart.h:158
@ kLPUART_TxFifoOverflowFlag
Definition fsl_lpuart.h:181
@ kLPUART_DataMatch2Flag
Definition fsl_lpuart.h:170
@ kLPUART_RxFifoEmptyFlag
Definition fsl_lpuart.h:180
@ kLPUART_RxOverrunFlag
Definition fsl_lpuart.h:152
@ kLPUART_RxDataRegFullFlag
Definition fsl_lpuart.h:149
@ kLPUART_TxDataRegEmptyFlag
Definition fsl_lpuart.h:145
@ kLPUART_IdleLineFlag
Definition fsl_lpuart.h:151
@ kLPUART_FramingErrorFlag
Definition fsl_lpuart.h:156
@ kLPUART_TxFifoEmptyFlag
Definition fsl_lpuart.h:179
@ kLPUART_DataMatch1Flag
Definition fsl_lpuart.h:169
@ kLPUART_TransmissionCompleteFlag
Definition fsl_lpuart.h:147
@ kLPUART_LinBreakFlag
Definition fsl_lpuart.h:160
@ kLPUART_RxActiveEdgeFlag
Definition fsl_lpuart.h:164
@ kLPUART_SevenDataBits
Definition fsl_lpuart.h:63
@ kLPUART_EightDataBits
Definition fsl_lpuart.h:61
@ kLPUART_IdleTypeStartBit
Definition fsl_lpuart.h:93
@ kLPUART_IdleTypeStopBit
Definition fsl_lpuart.h:94
@ kStatus_LPUART_RxIdle
Definition fsl_lpuart.h:34
@ kStatus_LPUART_TxIdle
Definition fsl_lpuart.h:33
@ kStatus_LPUART_FlagCannotClearManually
Definition fsl_lpuart.h:37
@ kStatus_LPUART_FramingError
Definition fsl_lpuart.h:43
@ kStatus_LPUART_IdleLineDetected
Definition fsl_lpuart.h:47
@ kStatus_LPUART_RxRingBufferOverrun
Definition fsl_lpuart.h:39
@ kStatus_LPUART_NoiseError
Definition fsl_lpuart.h:42
@ kStatus_LPUART_RxBusy
Definition fsl_lpuart.h:32
@ kStatus_LPUART_BaudrateNotSupport
Definition fsl_lpuart.h:45
@ kStatus_LPUART_TxWatermarkTooLarge
Definition fsl_lpuart.h:35
@ kStatus_LPUART_TxBusy
Definition fsl_lpuart.h:31
@ kStatus_LPUART_RxWatermarkTooLarge
Definition fsl_lpuart.h:36
@ kStatus_LPUART_ParityError
Definition fsl_lpuart.h:44
@ kStatus_LPUART_Error
Definition fsl_lpuart.h:38
@ kStatus_LPUART_RxHardwareOverrun
Definition fsl_lpuart.h:41
@ kLPUART_OneStopBit
Definition fsl_lpuart.h:70
@ kLPUART_TwoStopBit
Definition fsl_lpuart.h:71
@ kLPUART_CtsSampleAtStart
Definition fsl_lpuart.h:85
@ kLPUART_CtsSampleAtIdle
Definition fsl_lpuart.h:86
@ kLPUART_CtsSourceMatchResult
Definition fsl_lpuart.h:79
@ kLPUART_CtsSourcePin
Definition fsl_lpuart.h:78
static void enable(const char *param)
Definition settings.cpp:441
LPUART configuration structure.
Definition fsl_lpuart.h:190
LPUART handle structure.
Definition fsl_lpuart.h:229
LPUART transfer structure.
Definition fsl_lpuart.h:216
uint16_t count
Definition tunerstudio.h:1