lpuart_adapter.c
Go to the documentation of this file.
1 /*
2  * Copyright 2018, 2020 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #include "fsl_common.h"
10 #include "fsl_lpuart.h"
11 
12 #include "uart.h"
13 
14 /*******************************************************************************
15  * Definitions
16  ******************************************************************************/
17 #ifndef NDEBUG
18 #if (defined(DEBUG_CONSOLE_ASSERT_DISABLE) && (DEBUG_CONSOLE_ASSERT_DISABLE > 0U))
19 #undef assert
20 #define assert(n)
21 #endif
22 #endif
23 
24 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
25 
26 typedef struct _hal_uart_receive_state
27 {
28  uint8_t *volatile buffer;
29  volatile uint32_t bufferLength;
30  volatile uint32_t bufferSofar;
31 } hal_uart_receive_state_t;
32 
34 typedef struct _hal_uart_send_state
35 {
36  uint8_t *volatile buffer;
37  volatile uint32_t bufferLength;
38  volatile uint32_t bufferSofar;
39 } hal_uart_send_state_t;
40 #endif
41 
42 typedef struct _hal_uart_state
43 {
44 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
46  void *callbackParam;
47 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
48  lpuart_handle_t hardwareHandle;
49 #endif
50  hal_uart_receive_state_t rx;
51  hal_uart_send_state_t tx;
52 #endif
53 #if (defined(HAL_UART_ADAPTER_LOWPOWER) && (HAL_UART_ADAPTER_LOWPOWER > 0U))
55 #endif
56  uint8_t instance;
58 
59 /*******************************************************************************
60  * Prototypes
61  ******************************************************************************/
62 
63 /*******************************************************************************
64  * Variables
65  ******************************************************************************/
67 
68 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
69 
70 #if !(defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
71 /* Array of LPUART IRQ number. */
72 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
73 static const IRQn_Type s_LpuartRxIRQ[] = LPUART_RX_IRQS;
74 static const IRQn_Type s_LpuartTxIRQ[] = LPUART_TX_IRQS;
75 #else
76 static const IRQn_Type s_LpuartIRQ[] = LPUART_RX_TX_IRQS;
77 #endif
78 #endif
79 
80 #if !(defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
81 static hal_uart_state_t *s_UartState[sizeof(s_LpuartAdapterBase) / sizeof(LPUART_Type *)];
82 #endif
83 
84 #endif
85 
86 /*******************************************************************************
87  * Code
88  ******************************************************************************/
89 
90 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
92 {
94  switch (status)
95  {
96  case (int32_t)kStatus_Success:
97  uartStatus = kStatus_HAL_UartSuccess;
98  break;
99  case (int32_t)kStatus_LPUART_TxBusy:
100  uartStatus = kStatus_HAL_UartTxBusy;
101  break;
102  case (int32_t)kStatus_LPUART_RxBusy:
103  uartStatus = kStatus_HAL_UartRxBusy;
104  break;
105  case (int32_t)kStatus_LPUART_TxIdle:
106  uartStatus = kStatus_HAL_UartTxIdle;
107  break;
108  case (int32_t)kStatus_LPUART_RxIdle:
109  uartStatus = kStatus_HAL_UartRxIdle;
110  break;
111  case (int32_t)kStatus_LPUART_BaudrateNotSupport:
113  break;
114  case (int32_t)kStatus_LPUART_NoiseError:
115  case (int32_t)kStatus_LPUART_FramingError:
116  case (int32_t)kStatus_LPUART_ParityError:
117  uartStatus = kStatus_HAL_UartProtocolError;
118  break;
119  default:
120  /*MISRA rule 16.4*/
121  break;
122  }
123  return uartStatus;
124 }
125 #else
127 {
128  if ((int32_t)kStatus_Success == status)
129  {
131  }
132  else
133  {
134  return kStatus_HAL_UartError;
135  }
136 }
137 #endif
138 
139 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
140 
141 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
142 static void HAL_UartCallback(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *callbackParam)
143 {
144  hal_uart_state_t *uartHandle;
145  hal_uart_status_t uartStatus = HAL_UartGetStatus(status);
146  assert(callbackParam);
147 
148  uartHandle = (hal_uart_state_t *)callbackParam;
149 
150  if (kStatus_HAL_UartProtocolError == uartStatus)
151  {
152  if (0U != uartHandle->hardwareHandle.rxDataSize)
153  {
154  uartStatus = kStatus_HAL_UartError;
155  }
156  }
157 
158  if (NULL != uartHandle->callback)
159  {
160  uartHandle->callback(uartHandle, uartStatus, uartHandle->callbackParam);
161  }
162 }
163 
164 #else
165 
166 static void HAL_UartInterruptHandle(uint8_t instance)
167 {
168  hal_uart_state_t *uartHandle = s_UartState[instance];
169  uint32_t status;
170 
171  if (NULL == uartHandle)
172  {
173  return;
174  }
175 
176  status = LPUART_GetStatusFlags(s_LpuartAdapterBase[instance]);
177 
178  /* Receive data register full */
179  if ((0U != (LPUART_STAT_RDRF_MASK & status)) && (0U != (LPUART_GetEnabledInterrupts(s_LpuartAdapterBase[instance]) &
181  {
182  if (NULL != uartHandle->rx.buffer)
183  {
184  uartHandle->rx.buffer[uartHandle->rx.bufferSofar++] = LPUART_ReadByte(s_LpuartAdapterBase[instance]);
185  if (uartHandle->rx.bufferSofar >= uartHandle->rx.bufferLength)
186  {
189  uartHandle->rx.buffer = NULL;
190  if (NULL != uartHandle->callback)
191  {
192  uartHandle->callback(uartHandle, kStatus_HAL_UartRxIdle, uartHandle->callbackParam);
193  }
194  }
195  }
196  }
197 
198  /* Send data register empty and the interrupt is enabled. */
199  if ((0U != (LPUART_STAT_TDRE_MASK & status)) && (0U != (LPUART_GetEnabledInterrupts(s_LpuartAdapterBase[instance]) &
201  {
202  if (NULL != uartHandle->tx.buffer)
203  {
204  LPUART_WriteByte(s_LpuartAdapterBase[instance], uartHandle->tx.buffer[uartHandle->tx.bufferSofar++]);
205  if (uartHandle->tx.bufferSofar >= uartHandle->tx.bufferLength)
206  {
209  uartHandle->tx.buffer = NULL;
210  if (NULL != uartHandle->callback)
211  {
212  uartHandle->callback(uartHandle, kStatus_HAL_UartTxIdle, uartHandle->callbackParam);
213  }
214  }
215  }
216  }
217 
218 #if 1
219  (void)LPUART_ClearStatusFlags(s_LpuartAdapterBase[instance], status);
220 #endif
221 }
222 #endif
223 
224 #endif
225 
227 {
228  hal_uart_state_t *uartHandle;
229  lpuart_config_t lpuartConfig;
230  status_t status;
231  assert(handle);
232  assert(config);
233  assert(config->instance < (sizeof(s_LpuartAdapterBase) / sizeof(LPUART_Type *)));
234  assert(s_LpuartAdapterBase[config->instance]);
235  assert(HAL_UART_HANDLE_SIZE >= sizeof(hal_uart_state_t));
236 
237  LPUART_GetDefaultConfig(&lpuartConfig);
238  lpuartConfig.baudRate_Bps = config->baudRate_Bps;
239 
240  if (kHAL_UartParityEven == config->parityMode)
241  {
242  lpuartConfig.parityMode = kLPUART_ParityEven;
243  }
244  else if (kHAL_UartParityOdd == config->parityMode)
245  {
246  lpuartConfig.parityMode = kLPUART_ParityOdd;
247  }
248  else
249  {
250  lpuartConfig.parityMode = kLPUART_ParityDisabled;
251  }
252 
253  if (kHAL_UartTwoStopBit == config->stopBitCount)
254  {
255  lpuartConfig.stopBitCount = kLPUART_TwoStopBit;
256  }
257  else
258  {
259  lpuartConfig.stopBitCount = kLPUART_OneStopBit;
260  }
261  lpuartConfig.enableRx = (bool)config->enableRx;
262  lpuartConfig.enableTx = (bool)config->enableTx;
263 
264  status = LPUART_Init(s_LpuartAdapterBase[config->instance], (void *)&lpuartConfig, config->srcClock_Hz);
265 
266  if ((int32_t)kStatus_Success != status)
267  {
268  return HAL_UartGetStatus(status);
269  }
270 
271  uartHandle = (hal_uart_state_t *)handle;
272  uartHandle->instance = config->instance;
273 #if (defined(HAL_UART_ADAPTER_LOWPOWER) && (HAL_UART_ADAPTER_LOWPOWER > 0U))
274  uartHandle->config = *config;
275 #endif
276 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
277 
278 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
279  LPUART_TransferCreateHandle(s_LpuartAdapterBase[config->instance], &uartHandle->hardwareHandle,
280  (lpuart_transfer_callback_t)HAL_UartCallback, handle);
281 #else
282  s_UartState[uartHandle->instance] = uartHandle;
283 /* Enable interrupt in NVIC. */
284 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
285 #if defined(FSL_FEATURE_SOC_INTMUX_COUNT) && (FSL_FEATURE_SOC_INTMUX_COUNT > 0)
286  if (s_LpuartRxIRQ[uartHandle->instance] < FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS)
287 #endif
288  {
289  NVIC_SetPriority((IRQn_Type)s_LpuartRxIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
290  EnableIRQ(s_LpuartRxIRQ[uartHandle->instance]);
291  NVIC_SetPriority((IRQn_Type)s_LpuartTxIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
292  EnableIRQ(s_LpuartTxIRQ[uartHandle->instance]);
293  }
294 #else
295 #if defined(FSL_FEATURE_SOC_INTMUX_COUNT) && (FSL_FEATURE_SOC_INTMUX_COUNT > 0)
296  if (s_LpuartIRQ[uartHandle->instance] < FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS)
297 #endif
298  {
299  NVIC_SetPriority((IRQn_Type)s_LpuartIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
300  (void)EnableIRQ(s_LpuartIRQ[uartHandle->instance]);
301  }
302 #endif
303 #endif
304 
305 #endif
306 
308 }
309 
311 {
312  hal_uart_state_t *uartHandle;
313 
314  assert(handle);
315 
316  uartHandle = (hal_uart_state_t *)handle;
317 
319 
320 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
321 
322 #if !(defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
323  s_UartState[uartHandle->instance] = NULL;
324 #endif
325 
326 #endif
327 
329 }
330 
331 hal_uart_status_t HAL_UartReceiveBlocking(hal_uart_handle_t handle, uint8_t *data, size_t length)
332 {
333  hal_uart_state_t *uartHandle;
334  status_t status;
335  assert(handle);
336  assert(data);
337  assert(length);
338 
339  uartHandle = (hal_uart_state_t *)handle;
340 
341 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
342  if (NULL != uartHandle->rx.buffer)
343  {
344  return kStatus_HAL_UartRxBusy;
345  }
346 #endif
347 
348  status = LPUART_ReadBlocking(s_LpuartAdapterBase[uartHandle->instance], data, length);
349 
350  return HAL_UartGetStatus(status);
351 }
352 
353 hal_uart_status_t HAL_UartSendBlocking(hal_uart_handle_t handle, const uint8_t *data, size_t length)
354 {
355  hal_uart_state_t *uartHandle;
356  assert(handle);
357  assert(data);
358  assert(length);
359 
360  uartHandle = (hal_uart_state_t *)handle;
361 
362 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
363  if (NULL != uartHandle->tx.buffer)
364  {
365  return kStatus_HAL_UartTxBusy;
366  }
367 #endif
368 
369  LPUART_WriteBlocking(s_LpuartAdapterBase[uartHandle->instance], data, length);
370 
372 }
373 
375 {
376  assert(handle);
377 
379 }
380 
382 {
383 #if (defined(HAL_UART_ADAPTER_LOWPOWER) && (HAL_UART_ADAPTER_LOWPOWER > 0U))
384  hal_uart_state_t *uartHandle;
385  assert(handle);
386 
387  uartHandle = (hal_uart_state_t *)handle;
388 
389  HAL_UartInit(handle, &uartHandle->config);
390 #endif
392 }
393 
394 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
395 
396 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
397 
398 hal_uart_status_t HAL_UartTransferInstallCallback(hal_uart_handle_t handle,
400  void *callbackParam)
401 {
402  hal_uart_state_t *uartHandle;
403 
404  assert(handle);
405  assert(HAL_UART_TRANSFER_MODE);
406 
407  uartHandle = (hal_uart_state_t *)handle;
408 
409  uartHandle->callbackParam = callbackParam;
410  uartHandle->callback = callback;
411 
413 }
414 
415 hal_uart_status_t HAL_UartTransferReceiveNonBlocking(hal_uart_handle_t handle, hal_uart_transfer_t *transfer)
416 {
417  hal_uart_state_t *uartHandle;
418  status_t status;
419  assert(handle);
420  assert(transfer);
421  assert(HAL_UART_TRANSFER_MODE);
422 
423  uartHandle = (hal_uart_state_t *)handle;
424 
425  status = LPUART_TransferReceiveNonBlocking(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle,
426  (lpuart_transfer_t *)(void *)transfer, NULL);
427 
428  return HAL_UartGetStatus(status);
429 }
430 
431 hal_uart_status_t HAL_UartTransferSendNonBlocking(hal_uart_handle_t handle, hal_uart_transfer_t *transfer)
432 {
433  hal_uart_state_t *uartHandle;
434  status_t status;
435  assert(handle);
436  assert(transfer);
437  assert(HAL_UART_TRANSFER_MODE);
438 
439  uartHandle = (hal_uart_state_t *)handle;
440 
441  status = LPUART_TransferSendNonBlocking(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle,
442  (lpuart_transfer_t *)(void *)transfer);
443 
444  return HAL_UartGetStatus(status);
445 }
446 
447 hal_uart_status_t HAL_UartTransferGetReceiveCount(hal_uart_handle_t handle, uint32_t *count)
448 {
449  hal_uart_state_t *uartHandle;
450  status_t status;
451  assert(handle);
452  assert(count);
453  assert(HAL_UART_TRANSFER_MODE);
454 
455  uartHandle = (hal_uart_state_t *)handle;
456 
457  status =
458  LPUART_TransferGetReceiveCount(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle, count);
459 
460  return HAL_UartGetStatus(status);
461 }
462 
463 hal_uart_status_t HAL_UartTransferGetSendCount(hal_uart_handle_t handle, uint32_t *count)
464 {
465  hal_uart_state_t *uartHandle;
466  status_t status;
467  assert(handle);
468  assert(count);
469  assert(HAL_UART_TRANSFER_MODE);
470 
471  uartHandle = (hal_uart_state_t *)handle;
472 
473  status = LPUART_TransferGetSendCount(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle, count);
474 
475  return HAL_UartGetStatus(status);
476 }
477 
478 hal_uart_status_t HAL_UartTransferAbortReceive(hal_uart_handle_t handle)
479 {
480  hal_uart_state_t *uartHandle;
481  assert(handle);
482  assert(HAL_UART_TRANSFER_MODE);
483 
484  uartHandle = (hal_uart_state_t *)handle;
485 
486  LPUART_TransferAbortReceive(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle);
487 
489 }
490 
491 hal_uart_status_t HAL_UartTransferAbortSend(hal_uart_handle_t handle)
492 {
493  hal_uart_state_t *uartHandle;
494  assert(handle);
495  assert(HAL_UART_TRANSFER_MODE);
496 
497  uartHandle = (hal_uart_state_t *)handle;
498 
499  LPUART_TransferAbortSend(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle);
500 
502 }
503 
504 #else
505 
506 /* None transactional API with non-blocking mode. */
507 hal_uart_status_t HAL_UartInstallCallback(hal_uart_handle_t handle,
509  void *callbackParam)
510 {
511  hal_uart_state_t *uartHandle;
512 
513  assert(handle);
514  assert(!HAL_UART_TRANSFER_MODE);
515 
516  uartHandle = (hal_uart_state_t *)handle;
517 
518  uartHandle->callbackParam = callbackParam;
519  uartHandle->callback = callback;
520 
522 }
523 
524 hal_uart_status_t HAL_UartReceiveNonBlocking(hal_uart_handle_t handle, uint8_t *data, size_t length)
525 {
526  hal_uart_state_t *uartHandle;
527  assert(handle);
528  assert(data);
529  assert(length);
530  assert(!HAL_UART_TRANSFER_MODE);
531 
532  uartHandle = (hal_uart_state_t *)handle;
533 
534  if (NULL != uartHandle->rx.buffer)
535  {
536  return kStatus_HAL_UartRxBusy;
537  }
538 
539  uartHandle->rx.bufferLength = length;
540  uartHandle->rx.bufferSofar = 0;
541  uartHandle->rx.buffer = data;
545 }
546 
547 hal_uart_status_t HAL_UartSendNonBlocking(hal_uart_handle_t handle, uint8_t *data, size_t length)
548 {
549  hal_uart_state_t *uartHandle;
550  assert(handle);
551  assert(data);
552  assert(length);
553  assert(!HAL_UART_TRANSFER_MODE);
554 
555  uartHandle = (hal_uart_state_t *)handle;
556 
557  if (NULL != uartHandle->tx.buffer)
558  {
559  return kStatus_HAL_UartTxBusy;
560  }
561  uartHandle->tx.bufferLength = length;
562  uartHandle->tx.bufferSofar = 0;
563  uartHandle->tx.buffer = data;
566 }
567 
568 hal_uart_status_t HAL_UartGetReceiveCount(hal_uart_handle_t handle, uint32_t *reCount)
569 {
570  hal_uart_state_t *uartHandle;
571  assert(handle);
572  assert(reCount);
573  assert(!HAL_UART_TRANSFER_MODE);
574 
575  uartHandle = (hal_uart_state_t *)handle;
576 
577  if (NULL != uartHandle->rx.buffer)
578  {
579  *reCount = uartHandle->rx.bufferSofar;
581  }
582  return kStatus_HAL_UartError;
583 }
584 
585 hal_uart_status_t HAL_UartGetSendCount(hal_uart_handle_t handle, uint32_t *seCount)
586 {
587  hal_uart_state_t *uartHandle;
588  assert(handle);
589  assert(seCount);
590  assert(!HAL_UART_TRANSFER_MODE);
591 
592  uartHandle = (hal_uart_state_t *)handle;
593 
594  if (NULL != uartHandle->tx.buffer)
595  {
596  *seCount = uartHandle->tx.bufferSofar;
598  }
599  return kStatus_HAL_UartError;
600 }
601 
602 hal_uart_status_t HAL_UartAbortReceive(hal_uart_handle_t handle)
603 {
604  hal_uart_state_t *uartHandle;
605  assert(handle);
606  assert(!HAL_UART_TRANSFER_MODE);
607 
608  uartHandle = (hal_uart_state_t *)handle;
609 
610  if (NULL != uartHandle->rx.buffer)
611  {
613  s_LpuartAdapterBase[uartHandle->instance],
615  uartHandle->rx.buffer = NULL;
616  }
617 
619 }
620 
621 hal_uart_status_t HAL_UartAbortSend(hal_uart_handle_t handle)
622 {
623  hal_uart_state_t *uartHandle;
624  assert(handle);
625  assert(!HAL_UART_TRANSFER_MODE);
626 
627  uartHandle = (hal_uart_state_t *)handle;
628 
629  if (NULL != uartHandle->tx.buffer)
630  {
633  uartHandle->tx.buffer = NULL;
634  }
635 
637 }
638 
639 #endif
640 
641 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
642 
643 void HAL_UartIsrFunction(hal_uart_handle_t handle)
644 {
645  hal_uart_state_t *uartHandle;
646  assert(handle);
647  assert(HAL_UART_TRANSFER_MODE);
648 
649  uartHandle = (hal_uart_state_t *)handle;
650 
651 #if 0
652 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
653  DisableIRQ(s_LpuartRxIRQ[uartHandle->instance]);
654  DisableIRQ(s_LpuartTxIRQ[uartHandle->instance]);
655 #else
656  DisableIRQ(s_LpuartIRQ[uartHandle->instance]);
657 #endif
658 #endif
659  LPUART_TransferHandleIRQ(s_LpuartAdapterBase[uartHandle->instance], &uartHandle->hardwareHandle);
660 #if 0
661 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
662  NVIC_SetPriority((IRQn_Type)s_LpuartRxIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
663  EnableIRQ(s_LpuartRxIRQ[uartHandle->instance]);
664  NVIC_SetPriority((IRQn_Type)s_LpuartTxIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
665  EnableIRQ(s_LpuartTxIRQ[uartHandle->instance]);
666 #else
667  NVIC_SetPriority((IRQn_Type)s_LpuartIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
668  EnableIRQ(s_LpuartIRQ[uartHandle->instance]);
669 #endif
670 #endif
671 }
672 
673 #else
674 
675 void HAL_UartIsrFunction(hal_uart_handle_t handle)
676 {
677  hal_uart_state_t *uartHandle;
678  assert(handle);
679  assert(!HAL_UART_TRANSFER_MODE);
680 
681  uartHandle = (hal_uart_state_t *)handle;
682 
683 #if 0
684 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
685  DisableIRQ(s_LpuartRxIRQ[uartHandle->instance]);
686  DisableIRQ(s_LpuartTxIRQ[uartHandle->instance]);
687 #else
688  DisableIRQ(s_LpuartIRQ[uartHandle->instance]);
689 #endif
690 #endif
691  HAL_UartInterruptHandle(uartHandle->instance);
692 #if 0
693 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
694  NVIC_SetPriority((IRQn_Type)s_LpuartRxIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
695  EnableIRQ(s_LpuartRxIRQ[uartHandle->instance]);
696  NVIC_SetPriority((IRQn_Type)s_LpuartTxIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
697  EnableIRQ(s_LpuartTxIRQ[uartHandle->instance]);
698 #else
699  NVIC_SetPriority((IRQn_Type)s_LpuartIRQ[uartHandle->instance], HAL_UART_ISR_PRIORITY);
700  EnableIRQ(s_LpuartIRQ[uartHandle->instance]);
701 #endif
702 #endif
703 }
704 
705 #if defined(FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1) && FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1
706 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
707 void LPUART0_LPUART1_RX_IRQHandler(void)
708 {
709  if ((s_UartState[0]))
710  {
711  if ((LPUART_STAT_OR_MASK & LPUART0->STAT) ||
712  ((LPUART_STAT_RDRF_MASK & LPUART0->STAT) && (LPUART_CTRL_RIE_MASK & LPUART0->CTRL)))
713  {
714  HAL_UartInterruptHandle(0);
715  }
716  }
717  if ((s_UartState[1]))
718  {
719  if ((LPUART_STAT_OR_MASK & LPUART1->STAT) ||
721  {
722  HAL_UartInterruptHandle(1);
723  }
724  }
726 }
727 void LPUART0_LPUART1_TX_IRQHandler(void)
728 {
729  if ((s_UartState[0]))
730  {
731  if ((LPUART_STAT_OR_MASK & LPUART0->STAT) ||
732  ((LPUART0->STAT & LPUART_STAT_TDRE_MASK) && (LPUART0->CTRL & LPUART_CTRL_TIE_MASK)))
733  {
734  HAL_UartInterruptHandle(0);
735  }
736  }
737  if ((s_UartState[1]))
738  {
739  if ((LPUART_STAT_OR_MASK & LPUART1->STAT) ||
741  {
742  HAL_UartInterruptHandle(1);
743  }
744  }
746 }
747 #else
748 void LPUART0_LPUART1_IRQHandler(void);
749 void LPUART0_LPUART1_IRQHandler(void)
750 {
751  uint32_t orMask;
752  uint32_t rdrfMask;
753  uint32_t rieMask;
754  uint32_t tdreMask;
755  uint32_t tieMask;
756  if (NULL != (s_UartState[0]))
757  {
758  orMask = LPUART_STAT_OR_MASK & LPUART0->STAT;
759  rdrfMask = LPUART_STAT_RDRF_MASK & LPUART0->STAT;
760  rieMask = LPUART_CTRL_RIE_MASK & LPUART0->CTRL;
761  tdreMask = LPUART0->STAT & LPUART_STAT_TDRE_MASK;
762  tieMask = LPUART0->CTRL & LPUART_CTRL_TIE_MASK;
763  if ((bool)orMask || ((bool)rdrfMask && (bool)rieMask) || ((bool)tdreMask && (bool)tieMask))
764  {
765  HAL_UartInterruptHandle(0);
766  }
767  }
768  if (NULL != (s_UartState[1]))
769  {
770  orMask = LPUART_STAT_OR_MASK & LPUART1->STAT;
771  rdrfMask = LPUART_STAT_RDRF_MASK & LPUART1->STAT;
772  rieMask = LPUART_CTRL_RIE_MASK & LPUART1->CTRL;
773  tdreMask = LPUART1->STAT & LPUART_STAT_TDRE_MASK;
774  tieMask = LPUART1->CTRL & LPUART_CTRL_TIE_MASK;
775  if ((bool)orMask || ((bool)rdrfMask && (bool)rieMask) || ((bool)tdreMask && (bool)tieMask))
776  {
777  HAL_UartInterruptHandle(1);
778  }
779  }
781 }
782 #endif
783 #endif
784 
785 #if defined(LPUART0)
786 #if !(defined(FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1) && FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1)
787 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
788 void LPUART0_TX_IRQHandler(void)
789 {
790  HAL_UartInterruptHandle(0);
792 }
793 void LPUART0_RX_IRQHandler(void)
794 {
795  HAL_UartInterruptHandle(0);
797 }
798 #else
799 void LPUART0_IRQHandler(void)
800 {
801  HAL_UartInterruptHandle(0);
803 }
804 #endif
805 #endif
806 #endif
807 
808 #if defined(LPUART1)
809 #if !(defined(FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1) && FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1)
810 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
811 void LPUART1_TX_IRQHandler(void)
812 {
813  HAL_UartInterruptHandle(1);
815 }
816 void LPUART1_RX_IRQHandler(void)
817 {
818  HAL_UartInterruptHandle(1);
820 }
821 #else
822 void LPUART1_IRQHandler(void)
823 {
824  HAL_UartInterruptHandle(1);
826 }
827 #endif
828 #endif
829 #endif
830 
831 #if defined(LPUART2)
832 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
833 void LPUART2_TX_IRQHandler(void)
834 {
835  HAL_UartInterruptHandle(2);
837 }
838 void LPUART2_RX_IRQHandler(void)
839 {
840  HAL_UartInterruptHandle(2);
842 }
843 #else
844 void LPUART2_IRQHandler(void)
845 {
846  HAL_UartInterruptHandle(2);
848 }
849 #endif
850 #endif
851 
852 #if defined(LPUART3)
853 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
854 void LPUART3_TX_IRQHandler(void)
855 {
856  HAL_UartInterruptHandle(3);
858 }
859 void LPUART3_RX_IRQHandler(void)
860 {
861  HAL_UartInterruptHandle(3);
863 }
864 #else
865 void LPUART3_IRQHandler(void)
866 {
867  HAL_UartInterruptHandle(3);
869 }
870 #endif
871 #endif
872 
873 #if defined(LPUART4)
874 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
875 void LPUART4_TX_IRQHandler(void)
876 {
877  HAL_UartInterruptHandle(4);
879 }
880 void LPUART4_RX_IRQHandler(void)
881 {
882  HAL_UartInterruptHandle(4);
884 }
885 #else
886 void LPUART4_IRQHandler(void)
887 {
888  HAL_UartInterruptHandle(4);
890 }
891 #endif
892 #endif
893 
894 #if defined(LPUART5)
895 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
896 void LPUART5_TX_IRQHandler(void)
897 {
898  HAL_UartInterruptHandle(5);
900 }
901 void LPUART5_RX_IRQHandler(void)
902 {
903  HAL_UartInterruptHandle(5);
905 }
906 #else
907 void LPUART5_IRQHandler(void)
908 {
909  HAL_UartInterruptHandle(5);
911 }
912 #endif
913 #endif
914 
915 #if defined(LPUART6)
916 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
917 void LPUART6_TX_IRQHandler(void)
918 {
919  HAL_UartInterruptHandle(6);
921 }
922 void LPUART6_RX_IRQHandler(void)
923 {
924  HAL_UartInterruptHandle(6);
926 }
927 #else
928 void LPUART6_IRQHandler(void)
929 {
930  HAL_UartInterruptHandle(6);
932 }
933 #endif
934 #endif
935 
936 #if defined(LPUART7)
937 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
938 void LPUART7_TX_IRQHandler(void)
939 {
940  HAL_UartInterruptHandle(7);
942 }
943 void LPUART7_RX_IRQHandler(void)
944 {
945  HAL_UartInterruptHandle(7);
947 }
948 #else
949 void LPUART7_IRQHandler(void)
950 {
951  HAL_UartInterruptHandle(7);
953 }
954 #endif
955 #endif
956 
957 #if defined(LPUART8)
958 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
959 void LPUART8_TX_IRQHandler(void)
960 {
961  HAL_UartInterruptHandle(8);
963 }
964 void LPUART8_RX_IRQHandler(void)
965 {
966  HAL_UartInterruptHandle(8);
968 }
969 #else
970 void LPUART8_IRQHandler(void)
971 {
972  HAL_UartInterruptHandle(8);
974 }
975 #endif
976 #endif
977 
978 #if defined(CM4_0__LPUART)
979 void M4_0_LPUART_IRQHandler(void)
980 {
981  HAL_UartInterruptHandle(LPUART_GetInstance(CM4_0__LPUART));
983 }
984 #endif
985 
986 #if defined(CM4_1__LPUART)
987 void M4_1_LPUART_IRQHandler(void)
988 {
989  HAL_UartInterruptHandle(LPUART_GetInstance(CM4_1__LPUART));
991 }
992 #endif
993 
994 #if defined(CM4__LPUART)
995 void M4_LPUART_IRQHandler(void)
996 {
997  HAL_UartInterruptHandle(LPUART_GetInstance(CM4__LPUART));
999 }
1000 #endif
1001 
1002 #if defined(DMA__LPUART0)
1003 void DMA_UART0_INT_IRQHandler(void)
1004 {
1005  HAL_UartInterruptHandle(LPUART_GetInstance(DMA__LPUART0));
1007 }
1008 #endif
1009 
1010 #if defined(DMA__LPUART1)
1011 void DMA_UART1_INT_IRQHandler(void)
1012 {
1013  HAL_UartInterruptHandle(LPUART_GetInstance(DMA__LPUART1));
1015 }
1016 #endif
1017 
1018 #if defined(DMA__LPUART2)
1019 void DMA_UART2_INT_IRQHandler(void)
1020 {
1021  HAL_UartInterruptHandle(LPUART_GetInstance(DMA__LPUART2));
1023 }
1024 #endif
1025 
1026 #if defined(DMA__LPUART3)
1027 void DMA_UART3_INT_IRQHandler(void)
1028 {
1029  HAL_UartInterruptHandle(LPUART_GetInstance(DMA__LPUART3));
1031 }
1032 #endif
1033 
1034 #if defined(DMA__LPUART4)
1035 void DMA_UART4_INT_IRQHandler(void)
1036 {
1037  HAL_UartInterruptHandle(LPUART_GetInstance(DMA__LPUART4));
1039 }
1040 #endif
1041 
1042 #if defined(ADMA__LPUART0)
1043 void ADMA_UART0_INT_IRQHandler(void)
1044 {
1045  HAL_UartInterruptHandle(LPUART_GetInstance(ADMA__LPUART0));
1047 }
1048 #endif
1049 
1050 #if defined(ADMA__LPUART1)
1051 void ADMA_UART1_INT_IRQHandler(void)
1052 {
1053  HAL_UartInterruptHandle(LPUART_GetInstance(ADMA__LPUART1));
1055 }
1056 #endif
1057 
1058 #if defined(ADMA__LPUART2)
1059 void ADMA_UART2_INT_IRQHandler(void)
1060 {
1061  HAL_UartInterruptHandle(LPUART_GetInstance(ADMA__LPUART2));
1063 }
1064 #endif
1065 
1066 #if defined(ADMA__LPUART3)
1067 void ADMA_UART3_INT_IRQHandler(void)
1068 {
1069  HAL_UartInterruptHandle(LPUART_GetInstance(ADMA__LPUART3));
1071 }
1072 #endif
1073 
1074 #endif
1075 
1076 #endif
fsl_common.h
kStatus_LPUART_FramingError
@ kStatus_LPUART_FramingError
Definition: fsl_lpuart.h:48
kStatus_LPUART_NoiseError
@ kStatus_LPUART_NoiseError
Definition: fsl_lpuart.h:47
HAL_UartInit
hal_uart_status_t HAL_UartInit(hal_uart_handle_t handle, hal_uart_config_t *config)
Initializes a UART instance with the UART handle and the user configuration structure.
Definition: lpuart_adapter.c:226
LPUART2_IRQHandler
WEAK void LPUART2_IRQHandler(void)
Definition: startup_mimxrt1052.c:865
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
LPUART5_IRQHandler
WEAK void LPUART5_IRQHandler(void)
Definition: startup_mimxrt1052.c:877
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
_lpuart_config::parityMode
lpuart_parity_mode_t parityMode
Definition: fsl_lpuart.h:197
HAL_UART_TRANSFER_MODE
#define HAL_UART_TRANSFER_MODE
Whether enable transactional function of the UART. (0 - disable, 1 - enable)
Definition: uart.h:93
kStatus_HAL_UartBaudrateNotSupport
@ kStatus_HAL_UartBaudrateNotSupport
Definition: uart.h:107
_hal_uart_state::instance
uint8_t instance
Definition: lpuart_adapter.c:58
kHAL_UartTwoStopBit
@ kHAL_UartTwoStopBit
Definition: uart.h:128
HAL_UART_ISR_PRIORITY
#define HAL_UART_ISR_PRIORITY
Definition: uart.h:58
kStatus_LPUART_RxBusy
@ kStatus_LPUART_RxBusy
Definition: fsl_lpuart.h:37
hal_uart_handle_t
void * hal_uart_handle_t
The handle of uart adapter.
Definition: uart.h:97
LPUART3_IRQHandler
WEAK void LPUART3_IRQHandler(void)
Definition: startup_mimxrt1052.c:869
_hal_uart_config
UART configuration structure.
Definition: uart.h:132
LPUART_CTRL_RIE_MASK
#define LPUART_CTRL_RIE_MASK
Definition: MIMXRT1052.h:27248
kStatus_LPUART_TxIdle
@ kStatus_LPUART_TxIdle
Definition: fsl_lpuart.h:38
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
LPUART6_IRQHandler
WEAK void LPUART6_IRQHandler(void)
Definition: startup_mimxrt1052.c:881
LPUART_ReadByte
static uint8_t LPUART_ReadByte(LPUART_Type *base)
Reads the receiver register.
Definition: fsl_lpuart.h:606
LPUART_CTRL_TIE_MASK
#define LPUART_CTRL_TIE_MASK
Definition: MIMXRT1052.h:27262
_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
kStatus_HAL_UartTxBusy
@ kStatus_HAL_UartTxBusy
Definition: uart.h:103
HAL_UartDeinit
hal_uart_status_t HAL_UartDeinit(hal_uart_handle_t handle)
Deinitializes a UART instance.
Definition: lpuart_adapter.c:310
LPUART_TransferAbortReceive
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data receiving.
Definition: fsl_lpuart.c:1383
kLPUART_ParityEven
@ kLPUART_ParityEven
Definition: fsl_lpuart.h:60
kLPUART_OneStopBit
@ kLPUART_OneStopBit
Definition: fsl_lpuart.h:76
kHAL_UartParityOdd
@ kHAL_UartParityOdd
Definition: uart.h:121
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
s_LpuartAdapterBase
static LPUART_Type *const s_LpuartAdapterBase[]
Definition: lpuart_adapter.c:66
hal_uart_transfer_callback_t
void(* hal_uart_transfer_callback_t)(hal_uart_handle_t handle, hal_uart_status_t status, void *callbackParam)
UART transfer callback function.
Definition: uart.h:146
hal_uart_state_t
struct _hal_uart_state hal_uart_state_t
uart state structure.
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_config::baudRate_Bps
uint32_t baudRate_Bps
Definition: fsl_lpuart.h:196
kStatus_LPUART_TxBusy
@ kStatus_LPUART_TxBusy
Definition: fsl_lpuart.h:36
HAL_UartSendBlocking
hal_uart_status_t HAL_UartSendBlocking(hal_uart_handle_t handle, const uint8_t *data, size_t length)
Writes to the TX register using a blocking method.
Definition: lpuart_adapter.c:353
LPUART_GetDefaultConfig
void LPUART_GetDefaultConfig(lpuart_config_t *config)
Gets the default configuration structure.
Definition: fsl_lpuart.c:519
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
uart.h
SDK_ISR_EXIT_BARRIER
#define SDK_ISR_EXIT_BARRIER
Definition: fsl_common.h:250
kStatus_LPUART_RxIdle
@ kStatus_LPUART_RxIdle
Definition: fsl_lpuart.h:39
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
LPUART7_IRQHandler
WEAK void LPUART7_IRQHandler(void)
Definition: startup_mimxrt1052.c:885
_hal_uart_transfer
UART transfer structure.
Definition: uart.h:149
DisableIRQ
static status_t DisableIRQ(IRQn_Type interrupt)
Disable specific interrupt.
Definition: fsl_common.h:522
kLPUART_ParityDisabled
@ kLPUART_ParityDisabled
Definition: fsl_lpuart.h:59
LPUART_STAT_TDRE_MASK
#define LPUART_STAT_TDRE_MASK
Definition: MIMXRT1052.h:27051
kStatus_HAL_UartTxIdle
@ kStatus_HAL_UartTxIdle
Definition: uart.h:105
HAL_UartEnterLowpower
hal_uart_status_t HAL_UartEnterLowpower(hal_uart_handle_t handle)
Prepares to enter low power consumption.
Definition: lpuart_adapter.c:374
LPUART1
#define LPUART1
Definition: MIMXRT1052.h:27647
_lpuart_handle
LPUART handle structure.
Definition: fsl_lpuart.h:233
IRQn_Type
IRQn_Type
STM32F4XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
Definition: stm32f407xx.h:66
count
size_t count
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/tests/test_common/ma_test_common.c:31
LPUART_GetEnabledInterrupts
uint32_t LPUART_GetEnabledInterrupts(LPUART_Type *base)
Gets enabled LPUART interrupts.
Definition: fsl_lpuart.c:712
LPUART_BASE_PTRS
#define LPUART_BASE_PTRS
Definition: MIMXRT1052.h:27679
_lpuart_config::enableTx
bool enableTx
Definition: fsl_lpuart.h:215
kStatus_HAL_UartError
@ kStatus_HAL_UartError
Definition: uart.h:113
LPUART1_IRQHandler
WEAK void LPUART1_IRQHandler(void)
Definition: startup_mimxrt1052.c:861
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_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
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_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
LPUART8_IRQHandler
WEAK void LPUART8_IRQHandler(void)
Definition: startup_mimxrt1052.c:889
kLPUART_RxOverrunInterruptEnable
@ kLPUART_RxOverrunInterruptEnable
Definition: fsl_lpuart.h:134
LPUART4_IRQHandler
WEAK void LPUART4_IRQHandler(void)
Definition: startup_mimxrt1052.c:873
HAL_UartReceiveBlocking
hal_uart_status_t HAL_UartReceiveBlocking(hal_uart_handle_t handle, uint8_t *data, size_t length)
Reads RX data register using a blocking method.
Definition: lpuart_adapter.c:331
NVIC_SetPriority
#define NVIC_SetPriority
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1835
HAL_UartExitLowpower
hal_uart_status_t HAL_UartExitLowpower(hal_uart_handle_t handle)
Restores from low power consumption.
Definition: lpuart_adapter.c:381
EnableIRQ
static status_t EnableIRQ(IRQn_Type interrupt)
Enable specific interrupt.
Definition: fsl_common.h:484
kStatus_LPUART_BaudrateNotSupport
@ kStatus_LPUART_BaudrateNotSupport
Definition: fsl_lpuart.h:50
kLPUART_ParityOdd
@ kLPUART_ParityOdd
Definition: fsl_lpuart.h:61
HAL_UartGetStatus
static hal_uart_status_t HAL_UartGetStatus(status_t status)
Definition: lpuart_adapter.c:126
kStatus_HAL_UartRxBusy
@ kStatus_HAL_UartRxBusy
Definition: uart.h:104
kStatus_HAL_UartSuccess
@ kStatus_HAL_UartSuccess
Definition: uart.h:102
LPUART_ClearStatusFlags
status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask)
Clears status flags with a provided mask.
Definition: fsl_lpuart.c:772
_hal_uart_state
uart state structure.
Definition: lpuart_adapter.c:42
kLPUART_TwoStopBit
@ kLPUART_TwoStopBit
Definition: fsl_lpuart.h:77
kHAL_UartParityEven
@ kHAL_UartParityEven
Definition: uart.h:120
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
LPUART_Type
Definition: MIMXRT1052.h:26771
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:189
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
LPUART_TransferAbortSend
void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle)
Aborts the interrupt-driven data transmit.
Definition: fsl_lpuart.c:1175
HAL_UART_HANDLE_SIZE
#define HAL_UART_HANDLE_SIZE
Definition of uart adapter handle size.
Definition: uart.h:71
kStatus_HAL_UartProtocolError
@ kStatus_HAL_UartProtocolError
Definition: uart.h:109
kStatus_Success
@ kStatus_Success
Definition: fsl_common.h:179
hal_uart_status_t
enum _hal_uart_status hal_uart_status_t
UART status.
kStatus_HAL_UartRxIdle
@ kStatus_HAL_UartRxIdle
Definition: uart.h:106
LPUART_RX_TX_IRQS
#define LPUART_RX_TX_IRQS
Definition: MIMXRT1052.h:27681
kLPUART_RxDataRegFullInterruptEnable
@ kLPUART_RxDataRegFullInterruptEnable
Definition: fsl_lpuart.h:132
LPUART_Deinit
void LPUART_Deinit(LPUART_Type *base)
Deinitializes a LPUART instance.
Definition: fsl_lpuart.c:455
LPUART_STAT_RDRF_MASK
#define LPUART_STAT_RDRF_MASK
Definition: MIMXRT1052.h:27037
fsl_lpuart.h


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