You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/16 13:47:25 UTC
[incubator-nuttx] 20/35: arch/arm/src/lpc214x/lpc214x_serial.c:
Appease nxstyle
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 4eb92e5410f67187064ea0bf2f37723b7b7af0cf
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Nov 10 18:21:09 2020 +0900
arch/arm/src/lpc214x/lpc214x_serial.c: Appease nxstyle
---
arch/arm/src/lpc214x/lpc214x_serial.c | 41 +++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 14 deletions(-)
diff --git a/arch/arm/src/lpc214x/lpc214x_serial.c b/arch/arm/src/lpc214x/lpc214x_serial.c
index 2384596..89ec23d 100644
--- a/arch/arm/src/lpc214x/lpc214x_serial.c
+++ b/arch/arm/src/lpc214x/lpc214x_serial.c
@@ -1,7 +1,8 @@
/****************************************************************************
* arch/arm/src/lpc214x/lpc214x_serial.c
*
- * Copyright (C) 2007-2009, 2012-2013, 2017 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2012-2013, 2017 Gregory Nutt.
+ * All rights reserved.
* Author: Gregory Nutt <gn...@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -178,7 +179,7 @@ static uart_dev_t g_uart1port =
{
.size = CONFIG_UART1_TXBUFSIZE,
.buffer = g_uart1txbuffer,
- },
+ },
.ops = &g_uart_ops,
.priv = &g_uart1priv,
};
@@ -214,7 +215,8 @@ static inline uint8_t up_serialin(struct up_dev_s *priv, int offset)
* Name: up_serialout
****************************************************************************/
-static inline void up_serialout(struct up_dev_s *priv, int offset, uint8_t value)
+static inline void up_serialout(struct up_dev_s *priv, int offset,
+ uint8_t value)
{
putreg8(value, priv->uartbase + offset);
}
@@ -253,12 +255,16 @@ static inline void up_waittxready(struct up_dev_s *priv)
int tmp;
/* Limit how long we will wait for the TX available condition */
+
for (tmp = 1000 ; tmp > 0 ; tmp--)
{
/* Check if the tranmitter holding register (THR) is empty */
- if ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) & LPC214X_LSR_THRE) != 0)
+
+ if ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) &
+ LPC214X_LSR_THRE) != 0)
{
/* The THR is empty, return */
+
break;
}
}
@@ -394,14 +400,15 @@ static void up_shutdown(struct uart_dev_s *dev)
* Name: up_attach
*
* Description:
- * 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 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.
*
****************************************************************************/
@@ -430,8 +437,8 @@ static int up_attach(struct uart_dev_s *dev)
*
* Description:
* 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.
+ * closed normally just before the shutdown method is called. The
+ * exception is the serial console which is never shutdown.
*
****************************************************************************/
@@ -542,6 +549,7 @@ static int up_interrupt(int irq, void *context, void *arg)
}
}
}
+
return OK;
}
@@ -644,6 +652,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
{
priv->ier &= ~LPC214X_IER_ERBFI;
}
+
up_serialout(priv, LPC214X_UART_IER_OFFSET, priv->ier);
}
@@ -658,7 +667,8 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
static bool up_rxavailable(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) & LPC214X_LSR_RDR) != 0);
+ return ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) &
+ LPC214X_LSR_RDR) != 0);
}
/****************************************************************************
@@ -696,6 +706,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
{
priv->ier &= ~LPC214X_IER_ETBEI;
}
+
up_serialout(priv, LPC214X_UART_IER_OFFSET, priv->ier);
}
@@ -710,7 +721,8 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
static bool up_txready(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) & LPC214X_LSR_THRE) != 0);
+ return ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) &
+ LPC214X_LSR_THRE) != 0);
}
/****************************************************************************
@@ -724,7 +736,8 @@ static bool up_txready(struct uart_dev_s *dev)
static bool up_txempty(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) & LPC214X_LSR_THRE) != 0);
+ return ((up_serialin(priv, LPC214X_UART_LSR_OFFSET) &
+ LPC214X_LSR_THRE) != 0);
}
/****************************************************************************