From 83ebb6448cc539f1e8de3145e04440df99cfa523 Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Thu, 28 Jan 2021 17:23:15 +0100 Subject: [PATCH] include: nuttx: serial: nxstyle error fix Nxstyle error fix to silence the CI. Signed-off-by: Alin Jerpelea --- include/nuttx/serial/mxser.h | 21 ++-- include/nuttx/serial/serial.h | 190 +++++++++++++++--------------- include/nuttx/serial/tioctl.h | 24 ++-- include/nuttx/serial/uart_16550.h | 57 +++++---- 4 files changed, 152 insertions(+), 140 deletions(-) diff --git a/include/nuttx/serial/mxser.h b/include/nuttx/serial/mxser.h index f20f2d6225c..63c92398904 100644 --- a/include/nuttx/serial/mxser.h +++ b/include/nuttx/serial/mxser.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * include/nuttx/serial/mxser.h * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. @@ -31,23 +31,24 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ -/* This function should not be included directly. Rather, it should be included indirectly - * via include/nuttx/fs/ioctl.h. + ****************************************************************************/ + +/* This function should not be included directly. + * Rather, it should be included indirectly via include/nuttx/fs/ioctl.h. */ #ifndef __INCLUDE_NUTTX_SERIAL_MXSER_H #define __INCLUDE_NUTTX_SERIAL_MXSER_H -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ #define MOXA 0x400 #define MOXA_SET_OP_MODE (MOXA + 66) @@ -59,9 +60,9 @@ #define RS485_4WIRE_MODE 3 #define OP_MODE_MASK 3 -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" diff --git a/include/nuttx/serial/serial.h b/include/nuttx/serial/serial.h index 147c5c2a9ae..4c7019c2d35 100644 --- a/include/nuttx/serial/serial.h +++ b/include/nuttx/serial/serial.h @@ -1,7 +1,8 @@ -/************************************************************************************ +/**************************************************************************** * include/nuttx/serial/serial.h * - * Copyright (C) 2007-2008, 2012-2015, 2018 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2008, 2012-2015, 2018 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -31,14 +32,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SERIAL_SERIAL_H #define __INCLUDE_NUTTX_SERIAL_SERIAL_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -53,9 +54,9 @@ #include #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ /* Maximum number of threads than can be waiting for POLL events */ @@ -126,13 +127,13 @@ (dev->ops->rxflowcontrol && dev->ops->rxflowcontrol(dev,n,u)) #endif -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/* This structure defines one serial I/O buffer. The serial infrastructure will - * initialize the 'sem' field but all other fields must be initialized by the - * caller of uart_register(). +/* This structure defines one serial I/O buffer. + * The serial infrastructure will initialize the 'sem' field but all other + * fields must be initialized by the caller of uart_register(). */ struct uart_buffer_s @@ -155,46 +156,47 @@ struct uart_dmaxfer_s }; #endif /* CONFIG_SERIAL_RXDMA || CONFIG_SERIAL_TXDMA */ -/* This structure defines all of the operations providd by the architecture specific - * logic. All fields must be provided with non-NULL function pointers by the - * caller of uart_register(). +/* This structure defines all of the operations providd by the architecture + * specific logic. All fields must be provided with non-NULL function + * pointers by the caller of uart_register(). */ struct uart_dev_s; struct uart_ops_s { /* Configure the UART baud, bits, parity, fifos, etc. This method is called - * the first time that the serial port is opened. For the serial console, - * this will occur very early in initialization; for other serial ports this - * will occur when the port is first opened. This setup does not include - * attaching or enabling interrupts. That portion of the UART setup is - * performed when the attach() method is called. + * the first time that the serial port is opened. For the serial console, + * this will occur very early in initialization; for other serial ports + * this will occur when the port is first opened. This setup does not + * include attaching or enabling interrupts. That portion of the UART setup + * is performed when the attach() method is called. */ CODE int (*setup)(FAR struct uart_dev_s *dev); /* Disable the UART. This method is called when the serial port is closed. - * This method reverses the operation the setup method. NOTE that the serial - * console is never shutdown. + * This method reverses the operation the setup method. + * NOTE that the serial console is never shutdown. */ CODE void (*shutdown)(FAR struct uart_dev_s *dev); - /* Configure the UART to operation in interrupt driven mode. This method is - * called when the serial port is opened. Normally, this is just after the + /* Configure the UART to operation in interrupt driven mode. This method is + * called when the serial port is opened. Normally, this is just after the * the setup() method is called, however, the serial console may operate in * a non-interrupt driven mode during the boot phase. * - * RX and TX interrupts are not enabled when by the attach method (unless the - * hardware supports multiple levels of interrupt enabling). The RX and TX - * interrupts are not enabled until the txint() and rxint() methods are called. + * RX and TX interrupts are not enabled when by the attach method (unless + * the hardware supports multiple levels of interrupt enabling). The RX + * and TX interrupts are not enabled until the txint() and rxint() methods + * are called. */ CODE int (*attach)(FAR struct uart_dev_s *dev); - /* Detach UART interrupts. This method is called when the serial port is - * closed normally just before the shutdown method is called. The exception is - * the serial console which is never shutdown. + /* Detach UART interrupts. This method is called when the serial port is + * closed normally just before the shutdown method is called. + * The exception is the serial console which is never shutdown. */ CODE void (*detach)(FAR struct uart_dev_s *dev); @@ -257,8 +259,8 @@ struct uart_ops_s CODE void (*txint)(FAR struct uart_dev_s *dev, bool enable); - /* Return true if the tranmsit hardware is ready to send another byte. This - * is used to determine if send() method can be called. + /* Return true if the tranmsit hardware is ready to send another byte. + * This is used to determine if send() method can be called. */ CODE bool (*txready)(FAR struct uart_dev_s *dev); @@ -341,9 +343,9 @@ struct uart_dev_s typedef struct uart_dev_s uart_dev_t; -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -354,155 +356,159 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: uart_register * * Description: * Register serial console and serial ports. * - ************************************************************************************/ + ****************************************************************************/ int uart_register(FAR const char *path, FAR uart_dev_t *dev); -/************************************************************************************ +/**************************************************************************** * Name: uart_xmitchars * * Description: - * This function is called from the UART interrupt handler when an interrupt - * is received indicating that there is more space in the transmit FIFO. This - * function will send characters from the tail of the xmit buffer while the driver - * write() logic adds data to the head of the xmit buffer. + * This function is called from the UART interrupt handler when an interrupt + * is received indicating that there is more space in the transmit FIFO. + * This function will send characters from the tail of the xmit buffer while + * the driver write() logic adds data to the head of the xmit buffer. * - ************************************************************************************/ + ****************************************************************************/ void uart_xmitchars(FAR uart_dev_t *dev); -/************************************************************************************ +/**************************************************************************** * Name: uart_receivechars * * Description: - * This function is called from the UART interrupt handler when an interrupt - * is received indicating that are bytes available to be received. This - * function will add chars to head of receive buffer. Driver read() logic - * will take characters from the tail of the buffer. + * This function is called from the UART interrupt handler when an interrupt + * is received indicating that are bytes available to be received. This + * function will add chars to head of receive buffer. Driver read() logic + * will take characters from the tail of the buffer. * - ************************************************************************************/ + ****************************************************************************/ void uart_recvchars(FAR uart_dev_t *dev); -/************************************************************************************ +/**************************************************************************** * Name: uart_datareceived * * Description: - * This function is called from uart_recvchars when new serial data is place in - * the driver's circular buffer. This function will wake-up any stalled read() - * operations that are waiting for incoming data. + * This function is called from uart_recvchars when new serial data is place + * in the driver's circular buffer. This function will wake-up any stalled + * read() operations that are waiting for incoming data. * - ************************************************************************************/ + ****************************************************************************/ void uart_datareceived(FAR uart_dev_t *dev); -/************************************************************************************ +/**************************************************************************** * Name: uart_datasent * * Description: - * This function is called from uart_xmitchars after serial data has been sent, - * freeing up some space in the driver's circular buffer. This function will - * wake-up any stalled write() operations that was waiting for space to buffer - * outgoing data. + * This function is called from uart_xmitchars after serial data has been + * sent, freeing up some space in the driver's circular buffer. + * This function will wake-up any stalled write() operations that was + * waiting for space to buffer outgoing data. * - ************************************************************************************/ + ****************************************************************************/ void uart_datasent(FAR uart_dev_t *dev); -/************************************************************************************ +/**************************************************************************** * Name: uart_connected * * Description: - * Serial devices (like USB serial) can be removed. In that case, the "upper - * half" serial driver must be informed that there is no longer a valid serial - * channel associated with the driver. + * Serial devices (like USB serial) can be removed. In that case, the "upper + * half" serial driver must be informed that there is no longer a valid + * serial channel associated with the driver. * - * In this case, the driver will terminate all pending transfers wint ENOTCONN and - * will refuse all further transactions while the "lower half" is disconnected. - * The driver will continue to be registered, but will be in an unusable state. + * In this case, the driver will terminate all pending transfers wint + * ENOTCONN and will refuse all further transactions while the "lower half" + * is disconnected. + * The driver will continue to be registered, but will be in an unusable + * state. * - * Conversely, the "upper half" serial driver needs to know when the serial - * device is reconnected so that it can resume normal operations. + * Conversely, the "upper half" serial driver needs to know when the + * serial device is reconnected so that it can resume normal operations. * * Assumptions/Limitations: - * This function may be called from an interrupt handler. + * This function may be called from an interrupt handler. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SERIAL_REMOVABLE void uart_connected(FAR uart_dev_t *dev, bool connected); #endif -/************************************************************************************ +/**************************************************************************** * Name: uart_xmitchars_dma * * Description: - * Set up to transfer bytes from the TX circular buffer using DMA + * Set up to transfer bytes from the TX circular buffer using DMA * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SERIAL_TXDMA void uart_xmitchars_dma(FAR uart_dev_t *dev); #endif -/************************************************************************************ +/**************************************************************************** * Name: uart_xmitchars_done * * Description: - * Perform operations necessary at the complete of DMA including adjusting the - * TX circular buffer indices and waking up of any threads that may have been - * waiting for space to become available in the TX circular buffer. + * Perform operations necessary at the complete of DMA including adjusting + * the TX circular buffer indices and waking up of any threads that may + * have been waiting for space to become available in the TX circular + * buffer. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SERIAL_TXDMA void uart_xmitchars_done(FAR uart_dev_t *dev); #endif -/************************************************************************************ +/**************************************************************************** * Name: uart_recvchars_dma * * Description: - * Set up to receive bytes into the RX circular buffer using DMA + * Set up to receive bytes into the RX circular buffer using DMA * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SERIAL_RXDMA void uart_recvchars_dma(FAR uart_dev_t *dev); #endif -/************************************************************************************ +/**************************************************************************** * Name: uart_recvchars_done * * Description: - * Perform operations necessary at the complete of DMA including adjusting the - * RX circular buffer indices and waking up of any threads that may have been - * waiting for new data to become available in the RX circular buffer. + * Perform operations necessary at the complete of DMA including adjusting + * the RX circular buffer indices and waking up of any threads that may have + * been waiting for new data to become available in the RX circular buffer. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SERIAL_RXDMA void uart_recvchars_done(FAR uart_dev_t *dev); #endif -/************************************************************************************ +/**************************************************************************** * Name: uart_reset_sem * * Description: - * This function is called when need reset uart semaphore, this may used in - * kill one process, but this process was reading/writing with the semaphore. + * This function is called when need reset uart semaphore, this may used in + * kill one process, but this process was reading/writing with the + * semaphore. * - ************************************************************************************/ + ****************************************************************************/ void uart_reset_sem(FAR uart_dev_t *dev); diff --git a/include/nuttx/serial/tioctl.h b/include/nuttx/serial/tioctl.h index 0c146e50bc6..e991c2dab63 100644 --- a/include/nuttx/serial/tioctl.h +++ b/include/nuttx/serial/tioctl.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * include/nuttx/serial/tioctl.h * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. @@ -31,24 +31,24 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ -/* This function should not be included directly. Rather, it should be included indirectly - * via include/nuttx/fs/ioctl.h. +/* This function should not be included directly. + * Rather, it should be included indirectly via include/nuttx/fs/ioctl.h. */ #ifndef __INCLUDE_NUTTX_SERIAL_TIOCTL_H #define __INCLUDE_NUTTX_SERIAL_TIOCTL_H -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ /* Get and Set Terminal Attributes (see termios.h) */ @@ -212,9 +212,9 @@ #define SER_SWAP_ENABLED (1 << 0) /* Enable/disable RX/TX swap */ -/******************************************************************************************** +/**************************************************************************** * Public Type Definitions - ********************************************************************************************/ + ****************************************************************************/ /* Used with TTY ioctls */ @@ -237,9 +237,9 @@ struct serial_rs485 uint32_t delay_rts_after_send; /* Delay after send (milliseconds) */ }; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" diff --git a/include/nuttx/serial/uart_16550.h b/include/nuttx/serial/uart_16550.h index a40b5647813..5593e94ff39 100644 --- a/include/nuttx/serial/uart_16550.h +++ b/include/nuttx/serial/uart_16550.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * include/nuttx/serial/uart_16550.h * Serial driver for 16550 UART * @@ -32,24 +32,24 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SERIAL_UART_16550_H #define __INCLUDE_NUTTX_SERIAL_UART_16550_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #ifdef CONFIG_16550_UART -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* CONFIGURATION ********************************************************************/ +/* CONFIGURATION ************************************************************/ /* Are any UARTs enabled? */ @@ -59,8 +59,8 @@ # define HAVE_UART 1 #endif -/* We need to be told the address increment between registers and the register bit - * width. +/* We need to be told the address increment between registers and the + * register bit width. */ #ifndef CONFIG_16550_REGINCR @@ -87,7 +87,9 @@ # error "CONFIG_16550_ADDRWIDTH not supported" #endif -/* If a UART is enabled, then its base address, clock, and IRQ must also be provided */ +/* If a UART is enabled, then its base address, clock, and IRQ + * must also be provided + */ #ifdef CONFIG_16550_UART0 # ifndef CONFIG_16550_UART0_BASE @@ -149,8 +151,8 @@ # endif #endif -/* Is there a serial console? There should be at most one defined. It could be on - * any UARTn, n=0,1,2,3 +/* Is there a serial console? There should be at most one defined. + * It could be on any UARTn, n=0,1,2,3 */ #if defined(CONFIG_16550_UART0_SERIAL_CONSOLE) && defined(CONFIG_16550_UART0) @@ -181,7 +183,7 @@ # undef HAVE_16550_CONSOLE #endif -/* Register offsets *****************************************************************/ +/* Register offsets *********************************************************/ #define UART_RBR_INCR 0 /* (DLAB =0) Receiver Buffer Register */ #define UART_THR_INCR 0 /* (DLAB =0) Transmit Holding Register */ @@ -209,7 +211,7 @@ #define UART_MSR_OFFSET (CONFIG_16550_REGINCR*UART_MSR_INCR) #define UART_SCR_OFFSET (CONFIG_16550_REGINCR*UART_SCR_INCR) -/* Register bit definitions *********************************************************/ +/* Register bit definitions *************************************************/ /* RBR (DLAB =0) Receiver Buffer Register */ @@ -250,6 +252,7 @@ # define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* Receive Data Available (RDA) */ # define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* Receiver Line Status (RLS) */ # define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* Character Time-out Indicator (CTI) */ + /* Bits 4-5: Reserved */ #define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: RCVR FIFO interrupt */ #define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT) @@ -308,9 +311,9 @@ #define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */ -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ #if CONFIG_16550_REGWIDTH == 8 typedef uint8_t uart_datawidth_t; @@ -328,27 +331,29 @@ typedef uint16_t uart_addrwidth_t; typedef uint32_t uart_addrwidth_t; #endif -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ - * Public Functions - ************************************************************************************/ +/**************************************************************************** + * Public Functions Defintions + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: uart_getreg(), uart_putreg(), uart_ioctl() * * Description: - * These functions must be provided by the processor-specific code in order to - * correctly access 16550 registers + * These functions must be provided by the processor-specific code in order + * to correctly access 16550 registers * uart_ioctl() is optional to provide custom IOCTLs * - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SERIAL_UART_ARCH_MMIO uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset); -void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value); +void uart_putreg(uart_addrwidth_t base, + unsigned int offset, + uart_datawidth_t value); #endif struct file; /* Forward reference */