mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
drivers/serial/serial_io.c and serial_dma.c: Fix some long lines.
This commit is contained in:
+44
-38
@@ -1,4 +1,4 @@
|
|||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* drivers/serial/serial_dma.c
|
* drivers/serial/serial_dma.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved.
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* 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.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
@@ -48,25 +48,27 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_SERIAL_TXDMA) || defined(CONFIG_SERIAL_RXDMA)
|
#if defined(CONFIG_SERIAL_TXDMA) || defined(CONFIG_SERIAL_RXDMA)
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: uart_check_signo
|
* Name: uart_check_signo
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Check if the SIGINT or SIGSTP character is in the contiguous Rx DMA buffer
|
* Check if the SIGINT or SIGSTP character is in the contiguous Rx DMA
|
||||||
* region. The first signal associated with the first such character is returned.
|
* buffer region. The first signal associated with the first such
|
||||||
|
* character is returned.
|
||||||
*
|
*
|
||||||
* If there multiple such characters in the buffer, only the signal associated
|
* If there multiple such characters in the buffer, only the signal
|
||||||
* with the first is returned (this a bug!)
|
* associated with the first is returned (this a bug!)
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0 if a signal-related character does not appear in the. Otherwise, SIGKILL or
|
* 0 if a signal-related character does not appear in the. Otherwise,
|
||||||
* SIGSTP may be returned to indicate the appropriate signal action.
|
* SIGKILL or SIGSTP may be returned to indicate the appropriate signal
|
||||||
|
* action.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGSTP)
|
#if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGSTP)
|
||||||
static int uart_check_signo(const char *buf, size_t size)
|
static int uart_check_signo(const char *buf, size_t size)
|
||||||
@@ -94,16 +96,17 @@ static int uart_check_signo(const char *buf, size_t size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: uart_recvchars_signo
|
* Name: uart_recvchars_signo
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Check if the SIGINT character is anywhere in the newly received DMA buffer.
|
* Check if the SIGINT character is anywhere in the newly received DMA
|
||||||
|
* buffer.
|
||||||
*
|
*
|
||||||
* REVISIT: We must also remove the SIGINT/SIGSTP character from the Rx buffer. It
|
* REVISIT: We must also remove the SIGINT/SIGSTP character from the Rx
|
||||||
* should not be read as normal data by the caller.
|
* buffer. It should not be read as normal data by the caller.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SERIAL_RXDMA) && \
|
#if defined(CONFIG_SERIAL_RXDMA) && \
|
||||||
(defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGSTP))
|
(defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGSTP))
|
||||||
@@ -133,17 +136,17 @@ static int uart_recvchars_signo(FAR uart_dev_t *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* 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)
|
||||||
@@ -176,15 +179,16 @@ 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)
|
||||||
@@ -206,8 +210,8 @@ void uart_xmitchars_done(FAR uart_dev_t *dev)
|
|||||||
xfer->length = xfer->nlength = 0;
|
xfer->length = xfer->nlength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If any bytes were removed from the buffer, inform any waiters there there is
|
/* If any bytes were removed from the buffer, inform any waiters there
|
||||||
* space available.
|
* there is space available.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (nbytes)
|
if (nbytes)
|
||||||
@@ -217,13 +221,13 @@ 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)
|
||||||
@@ -260,7 +264,8 @@ void uart_recvchars_dma(FAR uart_dev_t *dev)
|
|||||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS
|
#ifdef CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS
|
||||||
/* Pre-calcuate the watermark level that we will need to test against. */
|
/* Pre-calcuate the watermark level that we will need to test against. */
|
||||||
|
|
||||||
watermark = (CONFIG_SERIAL_IFLOWCONTROL_UPPER_WATERMARK * rxbuf->size) / 100;
|
watermark = (CONFIG_SERIAL_IFLOWCONTROL_UPPER_WATERMARK * rxbuf->size) /
|
||||||
|
100;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||||
@@ -346,15 +351,16 @@ 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
|
||||||
* waiting for new data to become available in the RX circular buffer.
|
* have 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)
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ void uart_xmitchars(FAR uart_dev_t *dev)
|
|||||||
* Description:
|
* Description:
|
||||||
* This function is called from the UART interrupt handler when an
|
* This function is called from the UART interrupt handler when an
|
||||||
* interrupt is received indicating that are bytes available in the
|
* interrupt is received indicating that are bytes available in the
|
||||||
* receive fifo. This function will add chars to head of receive buffer.
|
* receive FIFO. This function will add chars to head of receive buffer.
|
||||||
* Driver read() logic will take characters from the tail of the buffer.
|
* Driver read() logic will take characters from the tail of the buffer.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user