fsl_lpuart.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2020 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 
18 /*******************************************************************************
19  * Definitions
20  ******************************************************************************/
21 
25 #define FSL_LPUART_DRIVER_VERSION (MAKE_VERSION(2, 3, 0))
26 
29 #ifndef UART_RETRY_TIMES
30 #define UART_RETRY_TIMES 0U /* Defining to zero means to keep waiting for the flag until it is assert/deassert. */
31 #endif
32 
34 enum
35 {
54 };
55 
57 typedef enum _lpuart_parity_mode
58 {
63 
65 typedef enum _lpuart_data_bits
66 {
68 #if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
69  kLPUART_SevenDataBits = 0x1U,
70 #endif
72 
75 {
79 
80 #if defined(FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT) && FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT
81 
82 typedef enum _lpuart_transmit_cts_source
83 {
84  kLPUART_CtsSourcePin = 0U,
85  kLPUART_CtsSourceMatchResult = 1U,
86 } lpuart_transmit_cts_source_t;
87 
89 typedef enum _lpuart_transmit_cts_config
90 {
91  kLPUART_CtsSampleAtStart = 0U,
92  kLPUART_CtsSampleAtIdle = 1U,
93 } lpuart_transmit_cts_config_t;
94 #endif
95 
98 {
102 
108 {
118 
125 {
126 #if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
127  kLPUART_LinBreakInterruptEnable = (LPUART_BAUD_LBKDIE_MASK >> 8),
128 #endif
138 #if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
139  kLPUART_TxFifoOverflowInterruptEnable = (LPUART_FIFO_TXOFE_MASK >> 8),
140  kLPUART_RxFifoUnderflowInterruptEnable = (LPUART_FIFO_RXUFE_MASK >> 8),
141 #endif
142 };
143 
150 {
165 #if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
166  kLPUART_LinBreakFlag = (int)(LPUART_STAT_LBKDIF_MASK),
168 #endif
173 #if defined(FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING) && FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING
174  kLPUART_DataMatch1Flag = LPUART_STAT_MA1F_MASK,
175  kLPUART_DataMatch2Flag = LPUART_STAT_MA2F_MASK,
176 #endif
177 #if defined(FSL_FEATURE_LPUART_HAS_EXTENDED_DATA_REGISTER_FLAGS) && FSL_FEATURE_LPUART_HAS_EXTENDED_DATA_REGISTER_FLAGS
178  kLPUART_NoiseErrorInRxDataRegFlag =
179  (LPUART_DATA_NOISY_MASK >> 10),
180  kLPUART_ParityErrorInRxDataRegFlag =
181  (LPUART_DATA_PARITYE_MASK >> 10),
182 #endif
183 #if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
184  kLPUART_TxFifoEmptyFlag = (LPUART_FIFO_TXEMPT_MASK >> 16),
185  kLPUART_RxFifoEmptyFlag = (LPUART_FIFO_RXEMPT_MASK >> 16),
186  kLPUART_TxFifoOverflowFlag =
187  (LPUART_FIFO_TXOF_MASK >> 16),
188  kLPUART_RxFifoUnderflowFlag =
189  (LPUART_FIFO_RXUF_MASK >> 16),
190 #endif
191 };
192 
194 typedef struct _lpuart_config
195 {
196  uint32_t baudRate_Bps;
199  bool isMsb;
200 #if defined(FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT) && FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT
201  lpuart_stop_bit_count_t stopBitCount;
202 #endif
203 #if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
204  uint8_t txFifoWatermark;
205  uint8_t rxFifoWatermark;
206 #endif
207 #if defined(FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT) && FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT
208  bool enableRxRTS;
209  bool enableTxCTS;
210  lpuart_transmit_cts_source_t txCtsSource;
211  lpuart_transmit_cts_config_t txCtsConfig;
212 #endif
215  bool enableTx;
216  bool enableRx;
218 
220 typedef struct _lpuart_transfer
221 {
222  uint8_t *data;
223  size_t dataSize;
225 
226 /* Forward declaration of the handle typedef. */
228 
230 typedef void (*lpuart_transfer_callback_t)(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData);
231 
234 {
235  uint8_t *volatile txData;
236  volatile size_t txDataSize;
237  size_t txDataSizeAll;
238  uint8_t *volatile rxData;
239  volatile size_t rxDataSize;
240  size_t rxDataSizeAll;
242  uint8_t *rxRingBuffer;
244  volatile uint16_t rxRingBufferHead;
245  volatile uint16_t rxRingBufferTail;
248  void *userData;
250  volatile uint8_t txState;
251  volatile uint8_t rxState;
253 #if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
254  bool isSevenDataBits;
255 #endif
256 };
257 
258 /*******************************************************************************
259  * API
260  ******************************************************************************/
261 
262 #if defined(__cplusplus)
263 extern "C" {
264 #endif /* _cplusplus */
265 
266 #if defined(FSL_FEATURE_LPUART_HAS_GLOBAL) && FSL_FEATURE_LPUART_HAS_GLOBAL
267 
281 static inline void LPUART_SoftwareReset(LPUART_Type *base)
282 {
284  base->GLOBAL &= ~LPUART_GLOBAL_RST_MASK;
285 }
286 /* @} */
287 #endif /*FSL_FEATURE_LPUART_HAS_GLOBAL*/
288 
318 status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz);
319 
327 void LPUART_Deinit(LPUART_Type *base);
328 
349 
365 status_t LPUART_SetBaudRate(LPUART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz);
366 
367 /* @} */
368 
391 uint32_t LPUART_GetStatusFlags(LPUART_Type *base);
392 
412 status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask);
413 
414 /* @} */
415 
434 void LPUART_EnableInterrupts(LPUART_Type *base, uint32_t mask);
435 
449 void LPUART_DisableInterrupts(LPUART_Type *base, uint32_t mask);
450 
472 
473 #if defined(FSL_FEATURE_LPUART_HAS_DMA_ENABLE) && FSL_FEATURE_LPUART_HAS_DMA_ENABLE
474 
482 static inline uint32_t LPUART_GetDataRegisterAddress(LPUART_Type *base)
483 {
484  return (uint32_t) & (base->DATA);
485 }
486 
495 static inline void LPUART_EnableTxDMA(LPUART_Type *base, bool enable)
496 {
497  if (enable)
498  {
499  base->BAUD |= LPUART_BAUD_TDMAE_MASK;
500  }
501  else
502  {
503  base->BAUD &= ~LPUART_BAUD_TDMAE_MASK;
504  }
505 }
506 
515 static inline void LPUART_EnableRxDMA(LPUART_Type *base, bool enable)
516 {
517  if (enable)
518  {
519  base->BAUD |= LPUART_BAUD_RDMAE_MASK;
520  }
521  else
522  {
523  base->BAUD &= ~LPUART_BAUD_RDMAE_MASK;
524  }
525 }
526 
527 /* @} */
528 #endif /* FSL_FEATURE_LPUART_HAS_DMA_ENABLE */
529 
541 uint32_t LPUART_GetInstance(LPUART_Type *base);
542 
551 static inline void LPUART_EnableTx(LPUART_Type *base, bool enable)
552 {
553  if (enable)
554  {
555  base->CTRL |= LPUART_CTRL_TE_MASK;
556  }
557  else
558  {
559  base->CTRL &= ~LPUART_CTRL_TE_MASK;
560  }
561 }
562 
571 static inline void LPUART_EnableRx(LPUART_Type *base, bool enable)
572 {
573  if (enable)
574  {
575  base->CTRL |= LPUART_CTRL_RE_MASK;
576  }
577  else
578  {
579  base->CTRL &= ~LPUART_CTRL_RE_MASK;
580  }
581 }
582 
592 static inline void LPUART_WriteByte(LPUART_Type *base, uint8_t data)
593 {
594  base->DATA = data;
595 }
596 
606 static inline uint8_t LPUART_ReadByte(LPUART_Type *base)
607 {
608 #if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
609  uint32_t ctrl = base->CTRL;
610  uint8_t result;
611  bool isSevenDataBits = (((ctrl & LPUART_CTRL_M7_MASK) != 0U) ||
612  (((ctrl & LPUART_CTRL_M7_MASK) == 0U) && ((ctrl & LPUART_CTRL_M_MASK) == 0U) &&
613  ((ctrl & LPUART_CTRL_PE_MASK) != 0U)));
614 
615  if (isSevenDataBits)
616  {
617  result = (uint8_t)(base->DATA & 0x7FU);
618  }
619  else
620  {
621  result = (uint8_t)base->DATA;
622  }
623 
624  return result;
625 #else
626  return (uint8_t)(base->DATA);
627 #endif
628 }
629 
642 status_t LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length);
643 
660 status_t LPUART_ReadBlocking(LPUART_Type *base, uint8_t *data, size_t length);
661 
662 /* @} */
663 
688  lpuart_handle_t *handle,
690  void *userData);
711 
730  lpuart_handle_t *handle,
731  uint8_t *ringBuffer,
732  size_t ringBufferSize);
733 
743 
752 
763 
777 
805  lpuart_handle_t *handle,
806  lpuart_transfer_t *xfer,
807  size_t *receivedBytes);
808 
819 
833 
843 
853 
854 /* @} */
855 
856 #if defined(__cplusplus)
857 }
858 #endif
859 
862 #endif /* _FSL_LPUART_H_ */
fsl_common.h
LPUART_TransferGetRxRingBufferLength
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:137
kLPUART_TransmissionCompleteInterruptEnable
@ kLPUART_TransmissionCompleteInterruptEnable
Definition: fsl_lpuart.h:131
_lpuart_interrupt_enable
_lpuart_interrupt_enable
LPUART interrupt configuration structure, default settings all disabled.
Definition: fsl_lpuart.h:124
kLPUART_IdleCharacter128
@ kLPUART_IdleCharacter128
Definition: fsl_lpuart.h:116
kStatus_LPUART_FramingError
@ kStatus_LPUART_FramingError
Definition: fsl_lpuart.h:48
lpuart_parity_mode_t
enum _lpuart_parity_mode lpuart_parity_mode_t
LPUART parity mode.
kLPUART_EightDataBits
@ kLPUART_EightDataBits
Definition: fsl_lpuart.h:67
kStatus_LPUART_NoiseError
@ kStatus_LPUART_NoiseError
Definition: fsl_lpuart.h:47
LPUART_BAUD_LBKDIE_MASK
#define LPUART_BAUD_LBKDIE_MASK
Definition: MIMXRT1052.h:26875
kStatus_LPUART_RxWatermarkTooLarge
@ kStatus_LPUART_RxWatermarkTooLarge
Definition: fsl_lpuart.h:41
_lpuart_handle::rxDataSizeAll
size_t rxDataSizeAll
Definition: fsl_lpuart.h:240
_lpuart_idle_type_select
_lpuart_idle_type_select
LPUART idle flag type defines when the receiver starts counting.
Definition: fsl_lpuart.h:97
LPUART_TransferHandleIRQ
void LPUART_TransferHandleIRQ(LPUART_Type *base, lpuart_handle_t *handle)
LPUART IRQ handle function.
Definition: fsl_lpuart.c:1440
LPUART_GetInstance
uint32_t LPUART_GetInstance(LPUART_Type *base)
Get the LPUART instance from peripheral base address.
Definition: fsl_lpuart.c:113
LPUART_STAT_OR_MASK
#define LPUART_STAT_OR_MASK
Definition: MIMXRT1052.h:27023
LPUART_STAT_RAF_MASK
#define LPUART_STAT_RAF_MASK
Definition: MIMXRT1052.h:27058
_lpuart_config::dataBitsCount
lpuart_data_bits_t dataBitsCount
Definition: fsl_lpuart.h:198
LPUART_SetBaudRate
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
_lpuart_config::parityMode
lpuart_parity_mode_t parityMode
Definition: fsl_lpuart.h:197
kStatus_LPUART_RxBusy
@ kStatus_LPUART_RxBusy
Definition: fsl_lpuart.h:37
LPUART_CTRL_RIE_MASK
#define LPUART_CTRL_RIE_MASK
Definition: MIMXRT1052.h:27248
lpuart_transfer_t
struct _lpuart_transfer lpuart_transfer_t
LPUART transfer structure.
kStatus_LPUART_TxWatermarkTooLarge
@ kStatus_LPUART_TxWatermarkTooLarge
Definition: fsl_lpuart.h:40
kLPUART_IdleCharacter16
@ kLPUART_IdleCharacter16
Definition: fsl_lpuart.h:113
kStatus_LPUART_TxIdle
@ kStatus_LPUART_TxIdle
Definition: fsl_lpuart.h:38
kStatusGroup_LPUART
@ kStatusGroup_LPUART
Definition: fsl_common.h:80
LPUART_CTRL_PE_MASK
#define LPUART_CTRL_PE_MASK
Definition: MIMXRT1052.h:27130
_lpuart_handle::rxRingBufferTail
volatile uint16_t rxRingBufferTail
Definition: fsl_lpuart.h:245
LPUART_TransferReceiveNonBlocking
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.
Definition: fsl_lpuart.c:1256
kLPUART_FramingErrorInterruptEnable
@ kLPUART_FramingErrorInterruptEnable
Definition: fsl_lpuart.h:136
_lpuart_handle::txData
uint8_t *volatile txData
Definition: fsl_lpuart.h:235
_lpuart_handle::userData
void * userData
Definition: fsl_lpuart.h:248
LPUART_ReadByte
static uint8_t LPUART_ReadByte(LPUART_Type *base)
Reads the receiver register.
Definition: fsl_lpuart.h:606
kLPUART_TxDataRegEmptyFlag
@ kLPUART_TxDataRegEmptyFlag
Definition: fsl_lpuart.h:151
LPUART_CTRL_TIE_MASK
#define LPUART_CTRL_TIE_MASK
Definition: MIMXRT1052.h:27262
kLPUART_NoiseErrorInterruptEnable
@ kLPUART_NoiseErrorInterruptEnable
Definition: fsl_lpuart.h:135
_lpuart_transfer
LPUART transfer structure.
Definition: fsl_lpuart.h:220
LPUART_EnableInterrupts
void LPUART_EnableInterrupts(LPUART_Type *base, uint32_t mask)
Enables LPUART interrupts according to a provided mask.
Definition: fsl_lpuart.c:657
LPUART_TransferStopRingBuffer
void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the background transfer and uninstalls the ring buffer.
Definition: fsl_lpuart.c:1101
kLPUART_RxActiveEdgeInterruptEnable
@ kLPUART_RxActiveEdgeInterruptEnable
Definition: fsl_lpuart.h:129
_lpuart_transfer::dataSize
size_t dataSize
Definition: fsl_lpuart.h:223
LPUART_CTRL_FEIE_MASK
#define LPUART_CTRL_FEIE_MASK
Definition: MIMXRT1052.h:27276
LPUART_TransferAbortReceive
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data receiving.
Definition: fsl_lpuart.c:1383
LPUART_EnableTx
static void LPUART_EnableTx(LPUART_Type *base, bool enable)
Enables or disables the LPUART transmitter.
Definition: fsl_lpuart.h:551
_lpuart_config::isMsb
bool isMsb
Definition: fsl_lpuart.h:199
kLPUART_ParityEven
@ kLPUART_ParityEven
Definition: fsl_lpuart.h:60
LPUART_STAT_LBKDIF_MASK
#define LPUART_STAT_LBKDIF_MASK
Definition: MIMXRT1052.h:27112
kLPUART_OneStopBit
@ kLPUART_OneStopBit
Definition: fsl_lpuart.h:76
LPUART_ReadBlocking
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:890
_lpuart_transfer::data
uint8_t * data
Definition: fsl_lpuart.h:222
lpuart_idle_type_select_t
enum _lpuart_idle_type_select lpuart_idle_type_select_t
LPUART idle flag type defines when the receiver starts counting.
LPUART_EnableRx
static void LPUART_EnableRx(LPUART_Type *base, bool enable)
Enables or disables the LPUART receiver.
Definition: fsl_lpuart.h:571
kLPUART_IdleTypeStartBit
@ kLPUART_IdleTypeStartBit
Definition: fsl_lpuart.h:99
LPUART_DisableInterrupts
void LPUART_DisableInterrupts(LPUART_Type *base, uint32_t mask)
Disables LPUART interrupts according to a provided mask.
Definition: fsl_lpuart.c:681
_lpuart_stop_bit_count
_lpuart_stop_bit_count
LPUART stop bit count.
Definition: fsl_lpuart.h:74
_lpuart_config::baudRate_Bps
uint32_t baudRate_Bps
Definition: fsl_lpuart.h:196
kLPUART_ParityErrorFlag
@ kLPUART_ParityErrorFlag
Definition: fsl_lpuart.h:164
kStatus_LPUART_TxBusy
@ kStatus_LPUART_TxBusy
Definition: fsl_lpuart.h:36
LPUART_BAUD_RDMAE_MASK
#define LPUART_BAUD_RDMAE_MASK
Definition: MIMXRT1052.h:26912
kLPUART_RxActiveFlag
@ kLPUART_RxActiveFlag
Definition: fsl_lpuart.h:171
_lpuart_idle_config
_lpuart_idle_config
LPUART idle detected configuration. This structure defines the number of idle characters that must be...
Definition: fsl_lpuart.h:107
LPUART_GetDefaultConfig
void LPUART_GetDefaultConfig(lpuart_config_t *config)
Gets the default configuration structure.
Definition: fsl_lpuart.c:519
_lpuart_parity_mode
_lpuart_parity_mode
LPUART parity mode.
Definition: fsl_lpuart.h:57
lpuart_config_t
struct _lpuart_config lpuart_config_t
LPUART configuration structure.
LPUART_STAT_IDLE_MASK
#define LPUART_STAT_IDLE_MASK
Definition: MIMXRT1052.h:27030
lpuart_transfer_callback_t
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:230
MAKE_STATUS
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:43
LPUART_Type::DATA
__IO uint32_t DATA
Definition: MIMXRT1052.h:26779
LPUART_FIFO_TXOFE_MASK
#define LPUART_FIFO_TXOFE_MASK
Definition: MIMXRT1052.h:27549
_lpuart_handle::callback
lpuart_transfer_callback_t callback
Definition: fsl_lpuart.h:247
LPUART_TransferHandleErrorIRQ
void LPUART_TransferHandleErrorIRQ(LPUART_Type *base, lpuart_handle_t *handle)
LPUART Error IRQ handle function.
Definition: fsl_lpuart.c:1675
LPUART_STAT_FE_MASK
#define LPUART_STAT_FE_MASK
Definition: MIMXRT1052.h:27009
kStatus_LPUART_RxIdle
@ kStatus_LPUART_RxIdle
Definition: fsl_lpuart.h:39
kStatus_LPUART_Error
@ kStatus_LPUART_Error
Definition: fsl_lpuart.h:43
kLPUART_TxDataRegEmptyInterruptEnable
@ kLPUART_TxDataRegEmptyInterruptEnable
Definition: fsl_lpuart.h:130
LPUART_TransferGetSendCount
status_t LPUART_TransferGetSendCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
Gets the number of bytes that have been sent out to bus.
Definition: fsl_lpuart.c:1198
kStatus_LPUART_RxHardwareOverrun
@ kStatus_LPUART_RxHardwareOverrun
Definition: fsl_lpuart.h:46
kLPUART_ParityDisabled
@ kLPUART_ParityDisabled
Definition: fsl_lpuart.h:59
LPUART_STAT_TDRE_MASK
#define LPUART_STAT_TDRE_MASK
Definition: MIMXRT1052.h:27051
LPUART_CTRL_RE_MASK
#define LPUART_CTRL_RE_MASK
Definition: MIMXRT1052.h:27227
LPUART_GLOBAL_RST_MASK
#define LPUART_GLOBAL_RST_MASK
Definition: MIMXRT1052.h:26832
_lpuart_handle::txState
volatile uint8_t txState
Definition: fsl_lpuart.h:250
LPUART_CTRL_TE_MASK
#define LPUART_CTRL_TE_MASK
Definition: MIMXRT1052.h:27234
_lpuart_handle::rxRingBuffer
uint8_t * rxRingBuffer
Definition: fsl_lpuart.h:242
_lpuart_handle::rxData
uint8_t *volatile rxData
Definition: fsl_lpuart.h:238
_lpuart_handle
LPUART handle structure.
Definition: fsl_lpuart.h:233
LPUART_FIFO_RXUFE_MASK
#define LPUART_FIFO_RXUFE_MASK
Definition: MIMXRT1052.h:27542
_lpuart_handle::rxRingBufferSize
size_t rxRingBufferSize
Definition: fsl_lpuart.h:243
count
size_t count
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/tests/test_common/ma_test_common.c:31
LPUART_STAT_TC_MASK
#define LPUART_STAT_TC_MASK
Definition: MIMXRT1052.h:27044
LPUART_TransferStartRingBuffer
void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
Sets up the RX ring buffer.
Definition: fsl_lpuart.c:1074
LPUART_STAT_PF_MASK
#define LPUART_STAT_PF_MASK
Definition: MIMXRT1052.h:27002
LPUART_GetEnabledInterrupts
uint32_t LPUART_GetEnabledInterrupts(LPUART_Type *base)
Gets enabled LPUART interrupts.
Definition: fsl_lpuart.c:712
LPUART_FIFO_RXEMPT_MASK
#define LPUART_FIFO_RXEMPT_MASK
Definition: MIMXRT1052.h:27597
LPUART_Type::GLOBAL
__IO uint32_t GLOBAL
Definition: MIMXRT1052.h:26774
LPUART_Type::CTRL
__IO uint32_t CTRL
Definition: MIMXRT1052.h:26778
_lpuart_handle::rxDataSize
volatile size_t rxDataSize
Definition: fsl_lpuart.h:239
_lpuart_config::enableTx
bool enableTx
Definition: fsl_lpuart.h:215
lpuart_stop_bit_count_t
enum _lpuart_stop_bit_count lpuart_stop_bit_count_t
LPUART stop bit count.
kLPUART_IdleCharacter8
@ kLPUART_IdleCharacter8
Definition: fsl_lpuart.h:112
LPUART_Type::BAUD
__IO uint32_t BAUD
Definition: MIMXRT1052.h:26776
LPUART_CTRL_M7_MASK
#define LPUART_CTRL_M7_MASK
Definition: MIMXRT1052.h:27192
LPUART_WriteBlocking
status_t 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:825
lpuart_data_bits_t
enum _lpuart_data_bits lpuart_data_bits_t
LPUART data bits count.
_lpuart_data_bits
_lpuart_data_bits
LPUART data bits count.
Definition: fsl_lpuart.h:65
kLPUART_RxDataRegFullFlag
@ kLPUART_RxDataRegFullFlag
Definition: fsl_lpuart.h:155
_lpuart_config
LPUART configuration structure.
Definition: fsl_lpuart.h:194
_lpuart_config::enableRx
bool enableRx
Definition: fsl_lpuart.h:216
kStatus_LPUART_ParityError
@ kStatus_LPUART_ParityError
Definition: fsl_lpuart.h:49
kLPUART_NoiseErrorFlag
@ kLPUART_NoiseErrorFlag
Definition: fsl_lpuart.h:160
lpuart_idle_config_t
enum _lpuart_idle_config lpuart_idle_config_t
LPUART idle detected configuration. This structure defines the number of idle characters that must be...
LPUART_Init
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:243
LPUART_STAT_NF_MASK
#define LPUART_STAT_NF_MASK
Definition: MIMXRT1052.h:27016
LPUART_BAUD_TDMAE_MASK
#define LPUART_BAUD_TDMAE_MASK
Definition: MIMXRT1052.h:26919
LPUART_TransferSendNonBlocking
status_t LPUART_TransferSendNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer)
Transmits a buffer of data using the interrupt method.
Definition: fsl_lpuart.c:1136
kLPUART_RxOverrunInterruptEnable
@ kLPUART_RxOverrunInterruptEnable
Definition: fsl_lpuart.h:134
kLPUART_IdleLineFlag
@ kLPUART_IdleLineFlag
Definition: fsl_lpuart.h:157
LPUART_CTRL_NEIE_MASK
#define LPUART_CTRL_NEIE_MASK
Definition: MIMXRT1052.h:27283
LPUART_DATA_PARITYE_MASK
#define LPUART_DATA_PARITYE_MASK
Definition: MIMXRT1052.h:27396
LPUART_CTRL_ILIE_MASK
#define LPUART_CTRL_ILIE_MASK
Definition: MIMXRT1052.h:27241
kStatus_LPUART_RxRingBufferOverrun
@ kStatus_LPUART_RxRingBufferOverrun
Definition: fsl_lpuart.h:44
kLPUART_FramingErrorFlag
@ kLPUART_FramingErrorFlag
Definition: fsl_lpuart.h:162
LPUART_DATA_NOISY_MASK
#define LPUART_DATA_NOISY_MASK
Definition: MIMXRT1052.h:27403
_lpuart_flags
_lpuart_flags
LPUART status flags.
Definition: fsl_lpuart.h:149
kLPUART_IdleTypeStopBit
@ kLPUART_IdleTypeStopBit
Definition: fsl_lpuart.h:100
LPUART_FIFO_RXUF_MASK
#define LPUART_FIFO_RXUF_MASK
Definition: MIMXRT1052.h:27583
LPUART_STAT_MA2F_MASK
#define LPUART_STAT_MA2F_MASK
Definition: MIMXRT1052.h:26988
kStatus_LPUART_BaudrateNotSupport
@ kStatus_LPUART_BaudrateNotSupport
Definition: fsl_lpuart.h:50
kLPUART_ParityOdd
@ kLPUART_ParityOdd
Definition: fsl_lpuart.h:61
_lpuart_config::rxIdleConfig
lpuart_idle_config_t rxIdleConfig
Definition: fsl_lpuart.h:214
LPUART_ClearStatusFlags
status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask)
Clears status flags with a provided mask.
Definition: fsl_lpuart.c:772
LPUART_CTRL_M_MASK
#define LPUART_CTRL_M_MASK
Definition: MIMXRT1052.h:27151
LPUART_CTRL_ORIE_MASK
#define LPUART_CTRL_ORIE_MASK
Definition: MIMXRT1052.h:27290
LPUART_STAT_MA1F_MASK
#define LPUART_STAT_MA1F_MASK
Definition: MIMXRT1052.h:26995
kLPUART_IdleCharacter2
@ kLPUART_IdleCharacter2
Definition: fsl_lpuart.h:110
kLPUART_TwoStopBit
@ kLPUART_TwoStopBit
Definition: fsl_lpuart.h:77
LPUART_FIFO_TXEMPT_MASK
#define LPUART_FIFO_TXEMPT_MASK
Definition: MIMXRT1052.h:27604
_lpuart_handle::rxState
volatile uint8_t rxState
Definition: fsl_lpuart.h:251
kStatus_LPUART_IdleLineDetected
@ kStatus_LPUART_IdleLineDetected
Definition: fsl_lpuart.h:52
kLPUART_RxOverrunFlag
@ kLPUART_RxOverrunFlag
Definition: fsl_lpuart.h:158
_lpuart_config::rxIdleType
lpuart_idle_type_select_t rxIdleType
Definition: fsl_lpuart.h:213
kLPUART_IdleCharacter4
@ kLPUART_IdleCharacter4
Definition: fsl_lpuart.h:111
LPUART_FIFO_TXOF_MASK
#define LPUART_FIFO_TXOF_MASK
Definition: MIMXRT1052.h:27590
kStatus_LPUART_Timeout
@ kStatus_LPUART_Timeout
Definition: fsl_lpuart.h:53
_lpuart_handle::rxRingBufferHead
volatile uint16_t rxRingBufferHead
Definition: fsl_lpuart.h:244
LPUART_WriteByte
static void LPUART_WriteByte(LPUART_Type *base, uint8_t data)
Writes to the transmitter register.
Definition: fsl_lpuart.h:592
config
static sai_transceiver_t config
Definition: imxrt1050/imxrt1050-evkb/source/pv_audio_rec.c:75
LPUART_TransferGetReceiveCount
status_t LPUART_TransferGetReceiveCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
Gets the number of bytes that have been received.
Definition: fsl_lpuart.c:1412
LPUART_GetStatusFlags
uint32_t LPUART_GetStatusFlags(LPUART_Type *base)
Gets LPUART status flags.
Definition: fsl_lpuart.c:741
kLPUART_IdleCharacter32
@ kLPUART_IdleCharacter32
Definition: fsl_lpuart.h:114
kStatus_LPUART_FlagCannotClearManually
@ kStatus_LPUART_FlagCannotClearManually
Definition: fsl_lpuart.h:42
kLPUART_ParityErrorInterruptEnable
@ kLPUART_ParityErrorInterruptEnable
Definition: fsl_lpuart.h:137
kLPUART_TransmissionCompleteFlag
@ kLPUART_TransmissionCompleteFlag
Definition: fsl_lpuart.h:153
kLPUART_IdleCharacter64
@ kLPUART_IdleCharacter64
Definition: fsl_lpuart.h:115
LPUART_Type
Definition: MIMXRT1052.h:26771
LPUART_STAT_RXEDGIF_MASK
#define LPUART_STAT_RXEDGIF_MASK
Definition: MIMXRT1052.h:27105
_lpuart_handle::txDataSize
volatile size_t txDataSize
Definition: fsl_lpuart.h:236
LPUART_CTRL_PEIE_MASK
#define LPUART_CTRL_PEIE_MASK
Definition: MIMXRT1052.h:27269
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:189
LPUART_CTRL_TCIE_MASK
#define LPUART_CTRL_TCIE_MASK
Definition: MIMXRT1052.h:27255
LPUART_TransferCreateHandle
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:1009
kLPUART_RxActiveEdgeFlag
@ kLPUART_RxActiveEdgeFlag
Definition: fsl_lpuart.h:169
_lpuart_handle::txDataSizeAll
size_t txDataSizeAll
Definition: fsl_lpuart.h:237
LPUART_TransferAbortSend
void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data transmit.
Definition: fsl_lpuart.c:1175
kLPUART_RxDataRegFullInterruptEnable
@ kLPUART_RxDataRegFullInterruptEnable
Definition: fsl_lpuart.h:132
kLPUART_IdleLineInterruptEnable
@ kLPUART_IdleLineInterruptEnable
Definition: fsl_lpuart.h:133
LPUART_Deinit
void LPUART_Deinit(LPUART_Type *base)
Deinitializes a LPUART instance.
Definition: fsl_lpuart.c:455
LPUART_BAUD_RXEDGIE_MASK
#define LPUART_BAUD_RXEDGIE_MASK
Definition: MIMXRT1052.h:26868
LPUART_STAT_RDRF_MASK
#define LPUART_STAT_RDRF_MASK
Definition: MIMXRT1052.h:27037
kLPUART_IdleCharacter1
@ kLPUART_IdleCharacter1
Definition: fsl_lpuart.h:109


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:56