Kintis:LPUART add RX DMA

This commit is contained in:
David Sidrane
2021-07-20 19:28:51 -07:00
committed by Xiang Xiao
parent 34eb918665
commit 19fddc451c
3 changed files with 655 additions and 11 deletions
+56
View File
@@ -1398,6 +1398,62 @@ config KINETIS_SERIAL_RXDMA_BUFFER_SIZE
endmenu # Kinetis UART Configuration
menu "Kinetis LPUART Configuration"
if KINETIS_SERIALDRIVER || OTHER_SERIALDRIVER
comment "LP Uart Driver Configuration"
config KINETIS_LPUART0_RXDMA
bool "LPUART0 Rx DMA"
default n
depends on KINETIS_LPUART0 && KINETIS_EDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
config KINETIS_LPUART1_RXDMA
bool "LPUART1 Rx DMA"
default n
depends on KINETIS_LPUART1 && KINETIS_EDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
config KINETIS_LPUART2_RXDMA
bool "LPUART2 Rx DMA"
default n
depends on KINETIS_LPUART2 && KINETIS_EDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
config KINETIS_LPUART3_RXDMA
bool "LPUART3 Rx DMA"
default n
depends on KINETIS_LPUART3 && KINETIS_EDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
config KINETIS_LPUART4_RXDMA
bool "LPUART4 Rx DMA"
default n
depends on KINETIS_LPUART4 && KINETIS_EDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
config KINETIS_LPUART_RXDMA_BUFFER_SIZE
int "Rx DMA buffer size"
default 32
depends on KINETIS_LPUART0_RXDMA || KINETIS_LPUART1_RXDMA || KINETIS_LPUART2_RXDMA || KINETIS_LPUART3_RXDMA || KINETIS_LPUART4_RXDMA
---help---
The DMA buffer size when using RX DMA to emulate a FIFO.
When streaming data, the generic serial layer will be called
every time the FIFO receives half this number of bytes.
Value given here will be rounded up to next multiple of 32 bytes.
endif # KINETIS_SERIALDRIVER || OTHER_SERIALDRIVER
endmenu # Kinetis LPUART Configuration
config KINETIS_MERGE_TTY
bool "Kinetis Merge TTY names for LPUARTS"
default n
File diff suppressed because it is too large Load Diff
+101
View File
@@ -0,0 +1,101 @@
/****************************************************************************
* arch/arm/src/kinetis/kinetis_lpuart.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_KINETIS_KINETIS_LPUART_H
#define __ARCH_ARM_SRC_KINETIS_KINETIS_LPUART_H
#if defined(HAVE_UART_DEVICE) && defined(USE_SERIALDRIVER)
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Is DMA available on any (enabled) LPUART? */
#undef LPSERIAL_HAVE_DMA
#if defined(CONFIG_KINETIS_LPUART0_RXDMA) || defined(CONFIG_KINETIS_LPUART1_RXDMA) || \
defined(CONFIG_KINETIS_LPUART2_RXDMA) || defined(CONFIG_KINETIS_LPUART3_RXDMA) || \
defined(CONFIG_KINETIS_LPUART4_RXDMA)
# define LPSERIAL_HAVE_DMA 1
/* Is DMA available on All (enabled) LPUART? */
#define LPSERIAL_HAVE_ALL_DMA 1
# if (defined(CONFIG_KINETIS_LPUART0) && !defined(CONFIG_KINETIS_LPUART0_RXDMA)) || \
(defined(CONFIG_KINETIS_LPUART1) && !defined(CONFIG_KINETIS_LPUART1_RXDMA)) || \
(defined(CONFIG_KINETIS_LPUART2) && !defined(CONFIG_KINETIS_LPUART2_RXDMA)) || \
(defined(CONFIG_KINETIS_LPUART3) && !defined(CONFIG_KINETIS_LPUART3_RXDMA)) || \
(defined(CONFIG_KINETIS_LPUART4) && !defined(CONFIG_KINETIS_LPUART4_RXDMA))
# undef LPSERIAL_HAVE_ALL_DMA
# endif
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
/****************************************************************************
* Name: kinetis_serial_dma_poll
*
* Description:
* Must be called periodically if any Kinetis LPUART is configured for DMA.
* The DMA callback is triggered for each fifo size/2 bytes, but this can
* result in some bytes being transferred but not collected if the incoming
* data is not a whole multiple of half the FIFO size.
*
* May be safely called from either interrupt or thread context.
*
****************************************************************************/
#ifdef LPSERIAL_HAVE_DMA
void kinetis_lpserial_dma_poll(void);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* HAVE_UART_DEVICE && USE_SERIALDRIVER) */
#endif /* __ARCH_ARM_SRC_KINETIS_KINETIS_UART_H */