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