arch/arm/src/stm32l4: Port 1wire driver from stm32.

This commit is contained in:
Juha Niskanen 2018-03-20 06:50:30 -06:00 committed by Gregory Nutt
parent 2d4ad03d2c
commit b9d0930761
7 changed files with 1467 additions and 61 deletions

View File

@ -1213,7 +1213,8 @@ FAR struct onewire_dev_s *stm32_1wireinitialize(int port)
/* Allocate instance */
if (!(inst = kmm_malloc(sizeof(struct stm32_1wire_inst_s))))
inst = kmm_malloc(sizeof(*inst));
if (inst == NULL)
{
return NULL;
}
@ -1259,7 +1260,7 @@ int stm32_1wireuninitialize(FAR struct onewire_dev_s *dev)
struct stm32_1wire_priv_s *priv = ((struct stm32_1wire_inst_s *)dev)->priv;
int irqs;
ASSERT(dev);
DEBUGASSERT(priv);
/* Decrement reference count and check for underflow */

View File

@ -822,6 +822,26 @@ config STM32L4_HAVE_TIM17
bool
default n
config STM32L4_HAVE_USART1
bool
default n
config STM32L4_HAVE_USART2
bool
default n
config STM32L4_HAVE_USART3
bool
default n
config STM32L4_HAVE_UART4
bool
default n
config STM32L4_HAVE_UART5
bool
default n
# These "hidden" settings are the OR of individual peripheral selections
# indicating that the general capability is required.
@ -1152,7 +1172,6 @@ config STM32L4_USART2
default n
depends on STM32L4_HAVE_USART2
select ARCH_HAVE_SERIAL_TERMIOS
select USART2_SERIALDRIVER
select STM32L4_USART
config STM32L4_USART3
@ -1160,7 +1179,6 @@ config STM32L4_USART3
default n
depends on STM32L4_HAVE_USART3
select ARCH_HAVE_SERIAL_TERMIOS
select USART3_SERIALDRIVER
select STM32L4_USART
config STM32L4_UART4
@ -1168,7 +1186,6 @@ config STM32L4_UART4
default n
depends on STM32L4_HAVE_UART4
select ARCH_HAVE_SERIAL_TERMIOS
select UART4_SERIALDRIVER
select STM32L4_USART
config STM32L4_UART5
@ -1176,7 +1193,6 @@ config STM32L4_UART5
default n
depends on STM32L4_HAVE_UART5
select ARCH_HAVE_SERIAL_TERMIOS
select UART5_SERIALDRIVER
select STM32L4_USART
config STM32L4_I2C1
@ -1294,7 +1310,6 @@ config STM32L4_USART1
default n
depends on STM32L4_HAVE_USART1
select ARCH_HAVE_SERIAL_TERMIOS
select USART1_SERIALDRIVER
select STM32L4_USART
config STM32L4_TIM15
@ -3458,29 +3473,33 @@ config STM32L4_DFSDM1_DMA
endmenu
config STM32L4_HAVE_USART1
config STM32L4_SERIALDRIVER
bool
default n
config STM32L4_HAVE_USART2
config STM32L4_1WIREDRIVER
bool
default n
config STM32L4_HAVE_USART3
bool
default n
config STM32L4_HAVE_UART4
bool
default n
config STM32L4_HAVE_UART5
bool
default n
menu "U[S]ART Configuration"
depends on STM32L4_USART
choice
prompt "USART1 Driver Configuration"
default STM32L4_USART1_SERIALDRIVER
depends on STM32L4_USART1
config STM32L4_USART1_SERIALDRIVER
bool "Standard serial driver"
select USART1_SERIALDRIVER
select STM32L4_SERIALDRIVER
config STM32L4_USART1_1WIREDRIVER
bool "1-Wire driver"
select STM32L4_1WIREDRIVER
endchoice # USART1 Driver Configuration
if USART1_SERIALDRIVER
config USART1_RS485
bool "RS-485 on USART1"
default n
@ -3506,6 +3525,26 @@ config USART1_RXDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endif # USART1_SERIALDRIVER
choice
prompt "USART2 Driver Configuration"
default STM32L4_USART2_SERIALDRIVER
depends on STM32L4_USART2
config STM32L4_USART2_SERIALDRIVER
bool "Standard serial driver"
select USART2_SERIALDRIVER
select STM32L4_SERIALDRIVER
config STM32L4_USART2_1WIREDRIVER
bool "1-Wire driver"
select STM32L4_1WIREDRIVER
endchoice # USART2 Driver Configuration
if USART2_SERIALDRIVER
config USART2_RS485
bool "RS-485 on USART2"
default n
@ -3531,6 +3570,26 @@ config USART2_RXDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endif # USART2_SERIALDRIVER
choice
prompt "USART3 Driver Configuration"
default STM32L4_USART3_SERIALDRIVER
depends on STM32L4_USART3
config STM32L4_USART3_SERIALDRIVER
bool "Standard serial driver"
select USART3_SERIALDRIVER
select STM32L4_SERIALDRIVER
config STM32L4_USART3_1WIREDRIVER
bool "1-Wire driver"
select STM32L4_1WIREDRIVER
endchoice # USART3 Driver Configuration
if USART3_SERIALDRIVER
config USART3_RS485
bool "RS-485 on USART3"
default n
@ -3556,6 +3615,26 @@ config USART3_RXDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endif # USART3_SERIALDRIVER
choice
prompt "UART4 Driver Configuration"
default STM32L4_UART4_SERIALDRIVER
depends on STM32L4_UART4
config STM32L4_UART4_SERIALDRIVER
bool "Standard serial driver"
select UART4_SERIALDRIVER
select STM32L4_SERIALDRIVER
config STM32L4_UART4_1WIREDRIVER
bool "1-Wire driver"
select STM32L4_1WIREDRIVER
endchoice # UART4 Driver Configuration
if UART4_SERIALDRIVER
config UART4_RS485
bool "RS-485 on UART4"
default n
@ -3581,6 +3660,26 @@ config UART4_RXDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endif # UART4_SERIALDRIVER
choice
prompt "UART5 Driver Configuration"
default STM32L4_UART5_SERIALDRIVER
depends on STM32L4_UART5
config STM32L4_UART5_SERIALDRIVER
bool "Standard serial driver"
select UART5_SERIALDRIVER
select STM32L4_SERIALDRIVER
config STM32L4_UART5_1WIREDRIVER
bool "1-Wire driver"
select STM32L4_1WIREDRIVER
endchoice # UART5 Driver Configuration
if UART5_SERIALDRIVER
config UART5_RS485
bool "RS-485 on UART5"
default n
@ -3606,6 +3705,12 @@ config UART5_RXDMA
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endif # UART5_SERIALDRIVER
if STM32L4_SERIALDRIVER
comment "Serial Driver Configuration"
config STM32L4_SERIAL_RXDMA_BUFFER_SIZE
int "Rx DMA buffer size"
default 32
@ -3662,6 +3767,14 @@ config STM32L4_SERIALBRK_BSDCOMPAT
on because the SW starts the break and then the HW automatically clears
the break. This makes it is difficult to sent a long break.
config STM32L4_USART_SINGLEWIRE
bool "Single Wire Support"
default n
depends on STM32L4_USART
---help---
Enable single wire UART support. The option enables support for the
TIOCSSINGLEWIRE ioctl in the STM32 serial driver.
if PM
config PM_SERIAL_ACTIVITY
int "PM serial activity"
@ -3671,6 +3784,8 @@ config PM_SERIAL_ACTIVITY
interrupt.
endif
endif # STM32L4_SERIALDRIVER
endmenu # U[S]ART Configuration
menu "SPI Configuration"

View File

@ -242,3 +242,7 @@ endif
ifeq ($(CONFIG_STM32L4_SDMMC1),y)
CHIP_CSRCS += stm32l4_sdmmc.c
endif
ifeq ($(CONFIG_STM32L4_1WIREDRIVER),y)
CHIP_CSRCS += stm32l4_1wire.c
endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_1wire.h
*
* Copyright (C) 2016 Aleksandr Vyhovanec. All rights reserved.
* Author: Aleksandr Vyhovanec <www.desh@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_1WIRE_H
#define __ARCH_ARM_SRC_STM32L4_STM32L4_1WIRE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "stm32l4_uart.h"
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: stm32l4_1wireinitialize
*
* Description:
* Initialize the selected 1-Wire port. And return a unique instance of struct
* struct onewire_dev_s. This function may be called to obtain multiple
* instances of the interface, each of which may be set up with a
* different frequency and slave address.
*
* Input Parameters:
* Port number (for hardware that has multiple 1-Wire interfaces)
*
* Returned Value:
* Valid 1-Wire device structure reference on succcess; a NULL on failure
*
****************************************************************************/
FAR struct onewire_dev_s *stm32l4_1wireinitialize(int port);
/****************************************************************************
* Name: stm32l4_1wireuninitialize
*
* Description:
* De-initialize the selected 1-Wire port, and power down the device.
*
* Input Parameters:
* Device structure as returned by the stm32l4_1wireinitialize()
*
* Returned Value:
* OK on success, ERROR when internal reference count mismatch or dev
* points to invalid hardware device.
*
****************************************************************************/
int stm32l4_1wireuninitialize(FAR struct onewire_dev_s *dev);
#endif /* __ARCH_ARM_SRC_STM32L4_STM32L4_1WIRE_H */

View File

@ -387,7 +387,7 @@ static const struct uart_ops_s g_uart_dma_ops =
/* I/O buffers */
#ifdef CONFIG_STM32L4_USART1
#ifdef CONFIG_STM32L4_USART1_SERIALDRIVER
static char g_usart1rxbuffer[CONFIG_USART1_RXBUFSIZE];
static char g_usart1txbuffer[CONFIG_USART1_TXBUFSIZE];
# ifdef CONFIG_USART1_RXDMA
@ -395,7 +395,7 @@ static char g_usart1rxfifo[RXDMA_BUFFER_SIZE];
# endif
#endif
#ifdef CONFIG_STM32L4_USART2
#ifdef CONFIG_STM32L4_USART2_SERIALDRIVER
static char g_usart2rxbuffer[CONFIG_USART2_RXBUFSIZE];
static char g_usart2txbuffer[CONFIG_USART2_TXBUFSIZE];
# ifdef CONFIG_USART2_RXDMA
@ -403,7 +403,7 @@ static char g_usart2rxfifo[RXDMA_BUFFER_SIZE];
# endif
#endif
#ifdef CONFIG_STM32L4_USART3
#ifdef CONFIG_STM32L4_USART3_SERIALDRIVER
static char g_usart3rxbuffer[CONFIG_USART3_RXBUFSIZE];
static char g_usart3txbuffer[CONFIG_USART3_TXBUFSIZE];
# ifdef CONFIG_USART3_RXDMA
@ -411,7 +411,7 @@ static char g_usart3rxfifo[RXDMA_BUFFER_SIZE];
# endif
#endif
#ifdef CONFIG_STM32L4_UART4
#ifdef CONFIG_STM32L4_UART4_SERIALDRIVER
static char g_uart4rxbuffer[CONFIG_UART4_RXBUFSIZE];
static char g_uart4txbuffer[CONFIG_UART4_TXBUFSIZE];
# ifdef CONFIG_UART4_RXDMA
@ -419,7 +419,7 @@ static char g_uart4rxfifo[RXDMA_BUFFER_SIZE];
# endif
#endif
#ifdef CONFIG_STM32L4_UART5
#ifdef CONFIG_STM32L4_UART5_SERIALDRIVER
static char g_uart5rxbuffer[CONFIG_UART5_RXBUFSIZE];
static char g_uart5txbuffer[CONFIG_UART5_TXBUFSIZE];
# ifdef CONFIG_UART5_RXDMA
@ -429,7 +429,7 @@ static char g_uart5rxfifo[RXDMA_BUFFER_SIZE];
/* This describes the state of the STM32 USART1 ports. */
#ifdef CONFIG_STM32L4_USART1
#ifdef CONFIG_STM32L4_USART1_SERIALDRIVER
static struct stm32l4_serial_s g_usart1priv =
{
.dev =
@ -490,7 +490,7 @@ static struct stm32l4_serial_s g_usart1priv =
/* This describes the state of the STM32 USART2 port. */
#ifdef CONFIG_STM32L4_USART2
#ifdef CONFIG_STM32L4_USART2_SERIALDRIVER
static struct stm32l4_serial_s g_usart2priv =
{
.dev =
@ -551,7 +551,7 @@ static struct stm32l4_serial_s g_usart2priv =
/* This describes the state of the STM32 USART3 port. */
#ifdef CONFIG_STM32L4_USART3
#ifdef CONFIG_STM32L4_USART3_SERIALDRIVER
static struct stm32l4_serial_s g_usart3priv =
{
.dev =
@ -612,7 +612,7 @@ static struct stm32l4_serial_s g_usart3priv =
/* This describes the state of the STM32 UART4 port. */
#ifdef CONFIG_STM32L4_UART4
#ifdef CONFIG_STM32L4_UART4_SERIALDRIVER
static struct stm32l4_serial_s g_uart4priv =
{
.dev =
@ -677,7 +677,7 @@ static struct stm32l4_serial_s g_uart4priv =
/* This describes the state of the STM32 UART5 port. */
#ifdef CONFIG_STM32L4_UART5
#ifdef CONFIG_STM32L4_UART5_SERIALDRIVER
static struct stm32l4_serial_s g_uart5priv =
{
.dev =
@ -744,19 +744,19 @@ static struct stm32l4_serial_s g_uart5priv =
FAR static struct stm32l4_serial_s * const uart_devs[STM32L4_NUSART + STM32L4_NUART] =
{
#ifdef CONFIG_STM32L4_USART1
#ifdef CONFIG_STM32L4_USART1_SERIALDRIVER
[0] = &g_usart1priv,
#endif
#ifdef CONFIG_STM32L4_USART2
#ifdef CONFIG_STM32L4_USART2_SERIALDRIVER
[1] = &g_usart2priv,
#endif
#ifdef CONFIG_STM32L4_USART3
#ifdef CONFIG_STM32L4_USART3_SERIALDRIVER
[2] = &g_usart3priv,
#endif
#ifdef CONFIG_STM32L4_UART4
#ifdef CONFIG_STM32L4_UART4_SERIALDRIVER
[3] = &g_uart4priv,
#endif
#ifdef CONFIG_STM32L4_UART5
#ifdef CONFIG_STM32L4_UART5_SERIALDRIVER
[4] = &g_uart5priv,
#endif
};
@ -1236,31 +1236,31 @@ static void stm32l4serial_setapbclock(FAR struct uart_dev_s *dev, bool on)
{
default:
return;
#ifdef CONFIG_STM32L4_USART1
#ifdef CONFIG_STM32L4_USART1_SERIALDRIVER
case STM32L4_USART1_BASE:
rcc_en = RCC_APB2ENR_USART1EN;
regaddr = STM32L4_RCC_APB2ENR;
break;
#endif
#ifdef CONFIG_STM32L4_USART2
#ifdef CONFIG_STM32L4_USART2_SERIALDRIVER
case STM32L4_USART2_BASE:
rcc_en = RCC_APB1ENR1_USART2EN;
regaddr = STM32L4_RCC_APB1ENR1;
break;
#endif
#ifdef CONFIG_STM32L4_USART3
#ifdef CONFIG_STM32L4_USART3_SERIALDRIVER
case STM32L4_USART3_BASE:
rcc_en = RCC_APB1ENR1_USART3EN;
regaddr = STM32L4_RCC_APB1ENR1;
break;
#endif
#ifdef CONFIG_STM32L4_UART4
#ifdef CONFIG_STM32L4_UART4_SERIALDRIVER
case STM32L4_UART4_BASE:
rcc_en = RCC_APB1ENR1_UART4EN;
regaddr = STM32L4_RCC_APB1ENR1;
break;
#endif
#ifdef CONFIG_STM32L4_UART5
#ifdef CONFIG_STM32L4_UART5_SERIALDRIVER
case STM32L4_UART5_BASE:
rcc_en = RCC_APB1ENR1_UART5EN;
regaddr = STM32L4_RCC_APB1ENR1;
@ -1688,8 +1688,8 @@ static int up_interrupt(int irq, FAR void *context, FAR void *arg)
* " " USART_ISR_ORE Overrun Error Detected
* USART_CR3_CTSIE USART_ISR_CTS CTS flag (not used)
*
* NOTE: Some of these status bits must be cleared by explicity writing zero
* to the SR register: USART_ISR_CTS, USART_ISR_LBD. Note of those are currently
* NOTE: Some of these status bits must be cleared by explicity writing one
* to the ICR register: USART_ICR_CTSCF, USART_ICR_LBDCF. Note of those are currently
* being used.
*/
@ -1787,7 +1787,6 @@ static int stm32l4serial_ioctl(FAR struct file *filep, int cmd,
#endif
#ifdef CONFIG_STM32L4_USART_SINGLEWIRE
#warning please review the potential use of ALTERNATE_FUNCTION_OPENDRAIN
case TIOCSSINGLEWIRE:
{
/* Change the TX port to be open-drain/push-pull and enable/disable

View File

@ -75,6 +75,29 @@
# undef CONFIG_STM32L4_USART1
#endif
/* Sanity checks */
#if !defined(CONFIG_STM32L4_USART1)
# undef CONFIG_STM32L4_USART1_SERIALDRIVER
# undef CONFIG_STM32L4_USART1_1WIREDRIVER
#endif
#if !defined(CONFIG_STM32L4_USART2)
# undef CONFIG_STM32L4_USART2_SERIALDRIVER
# undef CONFIG_STM32L4_USART2_1WIREDRIVER
#endif
#if !defined(CONFIG_STM32L4_USART3)
# undef CONFIG_STM32L4_USART3_SERIALDRIVER
# undef CONFIG_STM32L4_USART3_1WIREDRIVER
#endif
#if !defined(CONFIG_STM32L4_UART4)
# undef CONFIG_STM32L4_UART4_SERIALDRIVER
# undef CONFIG_STM32L4_UART4_1WIREDRIVER
#endif
#if !defined(CONFIG_STM32L4_UART5)
# undef CONFIG_STM32L4_UART5_SERIALDRIVER
# undef CONFIG_STM32L4_UART5_1WIREDRIVER
#endif
/* Is there a USART enabled? */
#if defined(CONFIG_STM32L4_USART1) || defined(CONFIG_STM32L4_USART2) || \
@ -85,35 +108,35 @@
/* Is there a serial console? */
#if defined(CONFIG_USART1_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_USART1)
#if defined(CONFIG_USART1_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_USART1_SERIALDRIVER)
# undef CONFIG_USART2_SERIAL_CONSOLE
# undef CONFIG_USART3_SERIAL_CONSOLE
# undef CONFIG_UART4_SERIAL_CONSOLE
# undef CONFIG_UART5_SERIAL_CONSOLE
# define CONSOLE_UART 1
# define HAVE_CONSOLE 1
#elif defined(CONFIG_USART2_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_USART2)
#elif defined(CONFIG_USART2_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_USART2_SERIALDRIVER)
# undef CONFIG_USART1_SERIAL_CONSOLE
# undef CONFIG_USART3_SERIAL_CONSOLE
# undef CONFIG_UART4_SERIAL_CONSOLE
# undef CONFIG_UART5_SERIAL_CONSOLE
# define CONSOLE_UART 2
# define HAVE_CONSOLE 1
#elif defined(CONFIG_USART3_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_USART3)
#elif defined(CONFIG_USART3_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_USART3_SERIALDRIVER)
# undef CONFIG_USART1_SERIAL_CONSOLE
# undef CONFIG_USART2_SERIAL_CONSOLE
# undef CONFIG_UART4_SERIAL_CONSOLE
# undef CONFIG_UART5_SERIAL_CONSOLE
# define CONSOLE_UART 3
# define HAVE_CONSOLE 1
#elif defined(CONFIG_UART4_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_UART4)
#elif defined(CONFIG_UART4_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_UART4_SERIALDRIVER)
# undef CONFIG_USART1_SERIAL_CONSOLE
# undef CONFIG_USART2_SERIAL_CONSOLE
# undef CONFIG_USART3_SERIAL_CONSOLE
# undef CONFIG_UART5_SERIAL_CONSOLE
# define CONSOLE_UART 4
# define HAVE_CONSOLE 1
#elif defined(CONFIG_UART5_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_UART5)
#elif defined(CONFIG_UART5_SERIAL_CONSOLE) && defined(CONFIG_STM32L4_UART5_SERIALDRIVER)
# undef CONFIG_USART1_SERIAL_CONSOLE
# undef CONFIG_USART2_SERIAL_CONSOLE
# undef CONFIG_USART3_SERIAL_CONSOLE
@ -142,23 +165,23 @@
/* Disable the DMA configuration on all unused USARTs */
#ifndef CONFIG_STM32L4_USART1
#ifndef CONFIG_STM32L4_USART1_SERIALDRIVER
# undef CONFIG_USART1_RXDMA
#endif
#ifndef CONFIG_STM32L4_USART2
#ifndef CONFIG_STM32L4_USART2_SERIALDRIVER
# undef CONFIG_USART2_RXDMA
#endif
#ifndef CONFIG_STM32L4_USART3
#ifndef CONFIG_STM32L4_USART3_SERIALDRIVER
# undef CONFIG_USART3_RXDMA
#endif
#ifndef CONFIG_STM32L4_UART4
#ifndef CONFIG_STM32L4_UART4_SERIALDRIVER
# undef CONFIG_UART4_RXDMA
#endif
#ifndef CONFIG_STM32L4_UART5
#ifndef CONFIG_STM32L4_UART5_SERIALDRIVER
# undef CONFIG_UART5_RXDMA
#endif
@ -189,15 +212,15 @@
/* Is DMA used on all (enabled) USARTs */
#define SERIAL_HAVE_ONLY_DMA 1
#if defined(CONFIG_STM32L4_USART1) && !defined(CONFIG_USART1_RXDMA)
#if defined(CONFIG_STM32L4_USART1_SERIALDRIVER) && !defined(CONFIG_USART1_RXDMA)
# undef SERIAL_HAVE_ONLY_DMA
#elif defined(CONFIG_STM32L4_USART2) && !defined(CONFIG_USART2_RXDMA)
#elif defined(CONFIG_STM32L4_USART2_SERIALDRIVER) && !defined(CONFIG_USART2_RXDMA)
# undef SERIAL_HAVE_ONLY_DMA
#elif defined(CONFIG_STM32L4_USART3) && !defined(CONFIG_USART3_RXDMA)
#elif defined(CONFIG_STM32L4_USART3_SERIALDRIVER) && !defined(CONFIG_USART3_RXDMA)
# undef SERIAL_HAVE_ONLY_DMA
#elif defined(CONFIG_STM32L4_UART4) && !defined(CONFIG_UART4_RXDMA)
#elif defined(CONFIG_STM32L4_UART4_SERIALDRIVER) && !defined(CONFIG_UART4_RXDMA)
# undef SERIAL_HAVE_ONLY_DMA
#elif defined(CONFIG_STM32L4_UART5) && !defined(CONFIG_UART5_RXDMA)
#elif defined(CONFIG_STM32L4_UART5_SERIALDRIVER) && !defined(CONFIG_UART5_RXDMA)
# undef SERIAL_HAVE_ONLY_DMA
#endif