arch/arm/src/str71x/str71x_serial.c: Appease nxstyle

This commit is contained in:
YAMAMOTO Takashi 2020-11-10 18:11:14 +09:00 committed by Xiang Xiao
parent 2af9bf33b7
commit c07b45152e

View File

@ -1,7 +1,8 @@
/****************************************************************************
* arch/arm/src/str71x/str71x_serial.c
*
* Copyright (C) 2008-2009, 2012-2013, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2012-2013, 2017 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -202,9 +203,9 @@
# define RXENABLE_BITS STR71X_UARTIER_RNE
#endif
/* Which ever model is used, there seems to be some timing disconnects between
* Rx FIFO not full and Rx FIFO half full indications. Best bet is to use
* both.
/* Which ever model is used, there seems to be some timing disconnects
* between Rx FIFO not full and Rx FIFO half full indications. Best bet
* is to use both.
*/
#define RXAVAILABLE_BITS (STR71X_UARTSR_RNE|STR71X_UARTSR_RHF)
@ -232,7 +233,8 @@ struct up_dev_s
/* Internal Helpers */
static inline uint16_t up_serialin(struct up_dev_s *priv, int offset);
static inline void up_serialout(struct up_dev_s *priv, int offset, uint16_t value);
static inline void up_serialout(struct up_dev_s *priv, int offset,
uint16_t value);
static inline void up_disableuartint(struct up_dev_s *priv, uint16_t *ier);
static inline void up_restoreuartint(struct up_dev_s *priv, uint16_t ier);
#ifdef HAVE_CONSOLE
@ -351,7 +353,7 @@ static uart_dev_t g_uart1port =
{
.size = CONFIG_UART1_TXBUFSIZE,
.buffer = g_uart1txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart1priv,
};
@ -434,7 +436,8 @@ static inline uint16_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, uint16_t value)
static inline void up_serialout(struct up_dev_s *priv, int offset,
uint16_t value)
{
putreg16(value, priv->uartbase + offset);
}
@ -482,6 +485,7 @@ static inline void up_waittxnotfull(struct up_dev_s *priv)
if ((up_serialin(priv, STR71X_UART_SR_OFFSET) & STR71X_UARTSR_TF) == 0)
{
/* The TX FIFO is not full... return */
break;
}
}
@ -509,7 +513,7 @@ static int up_setup(struct uart_dev_s *dev)
/* Set the BAUD rate */
divisor = 16 * priv->baud;
baud = (STR71X_PCLK1 + divisor/2) / divisor;
baud = (STR71X_PCLK1 + divisor / 2) / divisor;
up_serialout(priv, STR71X_UART_BR_OFFSET, baud);
/* Get mode setting */
@ -591,14 +595,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.
*
****************************************************************************/
@ -627,8 +632,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.
*
****************************************************************************/
@ -788,6 +793,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
{
priv->ier &= ~RXENABLE_BITS;
}
up_serialout(priv, STR71X_UART_IER_OFFSET, priv->ier);
}
@ -802,7 +808,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, STR71X_UART_SR_OFFSET) & RXAVAILABLE_BITS) != 0);
return ((up_serialin(priv, STR71X_UART_SR_OFFSET) &
RXAVAILABLE_BITS) != 0);
}
/****************************************************************************
@ -844,6 +851,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
priv->ier &= ~STR71X_UARTSR_THE;
}
up_serialout(priv, STR71X_UART_IER_OFFSET, priv->ier);
}
@ -858,7 +866,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, STR71X_UART_SR_OFFSET) & STR71X_UARTSR_TF) == 0);
return ((up_serialin(priv, STR71X_UART_SR_OFFSET) &
STR71X_UARTSR_TF) == 0);
}
/****************************************************************************
@ -872,7 +881,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, STR71X_UART_SR_OFFSET) & STR71X_UARTSR_TE) != 0);
return ((up_serialin(priv, STR71X_UART_SR_OFFSET) &
STR71X_UARTSR_TE) != 0);
}
/****************************************************************************