arch: serial: fix typos and run nxstyle

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
This commit is contained in:
Juha Niskanen 2020-10-31 14:30:10 +02:00 committed by Abdelatif Guettouche
parent 2073730d1a
commit d65acc6db4
18 changed files with 194 additions and 172 deletions

View File

@ -63,7 +63,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Some sanity checks *******************************************************/ /* Some sanity checks *******************************************************/
/* Is there at least one UART enabled and configured as a RS-232 device? */ /* Is there at least one UART enabled and configured as a RS-232 device? */
#ifndef HAVE_LEUART_DEVICE #ifndef HAVE_LEUART_DEVICE
@ -76,8 +78,9 @@
#ifdef USE_SERIALDRIVER #ifdef USE_SERIALDRIVER
/* Which LEUART with be ttyLE0/console and which ttyLE1? The console will always /* Which LEUART with be ttyLE0/console and which ttyLE1? The console will
* be ttyLE0. If there is no console then will use the lowest numbered LEUART. * always be ttyLE0. If there is no console then will use the lowest
* numbered LEUART.
*/ */
/* First pick the console and ttys0. This could be either LEUART0-1 */ /* First pick the console and ttys0. This could be either LEUART0-1 */
@ -150,7 +153,8 @@ struct efm32_leuart_s
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static inline uint32_t efm32_serialin(struct efm32_leuart_s *priv, int offset); static inline uint32_t efm32_serialin(struct efm32_leuart_s *priv,
int offset);
static inline void efm32_serialout(struct efm32_leuart_s *priv, int offset, static inline void efm32_serialout(struct efm32_leuart_s *priv, int offset,
uint32_t value); uint32_t value);
static inline void efm32_setuartint(struct efm32_leuart_s *priv); static inline void efm32_setuartint(struct efm32_leuart_s *priv);
@ -283,7 +287,8 @@ static struct uart_dev_s g_leuart1port =
* Name: efm32_serialin * Name: efm32_serialin
****************************************************************************/ ****************************************************************************/
static inline uint32_t efm32_serialin(struct efm32_leuart_s *priv, int offset) static inline uint32_t efm32_serialin(struct efm32_leuart_s *priv,
int offset)
{ {
return getreg32(priv->config->uartbase + offset); return getreg32(priv->config->uartbase + offset);
} }
@ -315,7 +320,9 @@ static void efm32_restoreuartint(struct efm32_leuart_s *priv, uint32_t ien)
{ {
irqstate_t flags; irqstate_t flags;
/* Re-enable/re-disable interrupts corresponding to the state of bits in ien */ /* Re-enable/re-disable interrupts corresponding to the state of
* bits in ien.
*/
flags = enter_critical_section(); flags = enter_critical_section();
priv->ien = ien; priv->ien = ien;
@ -398,14 +405,15 @@ static void efm32_shutdown(struct uart_dev_s *dev)
* Name: efm32_attach * Name: efm32_attach
* *
* Description: * Description:
* Configure the UART to operation in interrupt driven mode. This method is * Configure the UART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * 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 * 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.
* *
****************************************************************************/ ****************************************************************************/
@ -432,9 +440,9 @@ static int efm32_attach(struct uart_dev_s *dev)
* Name: efm32_detach * Name: efm32_detach
* *
* Description: * Description:
* Detach UART interrupts. This method is called when the serial port is * Detach UART interrupts. This method is called when the serial port
* closed normally just before the shutdown method is called. The exception * is closed normally just before the shutdown method is called. The
* is the serial console which is never shutdown. * exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -616,8 +624,8 @@ static void efm32_rxint(struct uart_dev_s *dev, bool enable)
flags = enter_critical_section(); flags = enter_critical_section();
if (enable) if (enable)
{ {
/* Receive an interrupt when their is anything in the Rx data register (or an Rx /* Receive an interrupt when there is anything in the Rx data register
* timeout occurs). * (or an Rx timeout occurs).
*/ */
#ifndef CONFIG_SUPPRESS_SERIAL_INTS #ifndef CONFIG_SUPPRESS_SERIAL_INTS
@ -638,7 +646,7 @@ static void efm32_rxint(struct uart_dev_s *dev, bool enable)
* Name: efm32_rxavailable * Name: efm32_rxavailable
* *
* Description: * Description:
* Return true if the receive register is not empty * Return true if the receive register is not empty.
* *
****************************************************************************/ ****************************************************************************/
@ -648,7 +656,8 @@ static bool efm32_rxavailable(struct uart_dev_s *dev)
/* Return true if the receive data is available (RXDATAV). */ /* Return true if the receive data is available (RXDATAV). */
return (efm32_serialin(priv, EFM32_LEUART_STATUS_OFFSET) & LEUART_STATUS_RXDATAV) != 0; return (efm32_serialin(priv, EFM32_LEUART_STATUS_OFFSET) &
LEUART_STATUS_RXDATAV) != 0;
} }
/**************************************************************************** /****************************************************************************
@ -722,7 +731,8 @@ static bool efm32_txready(struct uart_dev_s *dev)
* when it is full. * when it is full.
*/ */
return (efm32_serialin(priv, EFM32_LEUART_STATUS_OFFSET) & LEUART_STATUS_TXBL) != 0; return (efm32_serialin(priv, EFM32_LEUART_STATUS_OFFSET) &
LEUART_STATUS_TXBL) != 0;
} }
/**************************************************************************** /****************************************************************************
@ -741,7 +751,8 @@ static bool efm32_txempty(struct uart_dev_s *dev)
* data is available in the transmit buffer. * data is available in the transmit buffer.
*/ */
return (efm32_serialin(priv, EFM32_LEUART_STATUS_OFFSET) & LEUART_STATUS_TXC) != 0; return (efm32_serialin(priv, EFM32_LEUART_STATUS_OFFSET) &
LEUART_STATUS_TXC) != 0;
} }
/**************************************************************************** /****************************************************************************
@ -757,23 +768,21 @@ static bool efm32_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before arm_serialinit. NOTE: This function depends on GPIO pin * before arm_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in efm32_consoleinit() and main clock iniialization * configuration performed in efm32_consoleinit() and main clock
* performed in efm32_clkinitialize(). * initialization performed in efm32_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/
void arm_earlyserialinit(void) void arm_earlyserialinit(void)
{ {
/* Disable interrupts from all UARTS. The console is enabled in /* Disable interrupts from all UARTS. */
* pic32mx_consoleinit()
*/
efm32_restoreuartint(TTYLE0_DEV.priv, 0); efm32_restoreuartint(TTYLE0_DEV.priv, 0);
#ifdef TTYLE1_DEV #ifdef TTYLE1_DEV
efm32_restoreuartint(TTYLE1_DEV.priv, 0); efm32_restoreuartint(TTYLE1_DEV.priv, 0);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef CONSOLE_DEV #ifdef CONSOLE_DEV
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;

View File

@ -1129,16 +1129,14 @@ static bool efm32_txempty(struct uart_dev_s *dev)
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before arm_serialinit. NOTE: This function depends on GPIO pin * before arm_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in efm32_consoleinit() and main clock * configuration performed in efm32_consoleinit() and main clock
* iniialization performed in efm32_clkinitialize(). * initialization performed in efm32_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/
#ifdef USE_EARLYSERIALINIT #ifdef USE_EARLYSERIALINIT
void arm_earlyserialinit(void) void arm_earlyserialinit(void)
{ {
/* Disable interrupts from all UARTS. The console is enabled in /* Disable interrupts from all UARTS. */
* pic32mx_consoleinit()
*/
efm32_restoreuartint(TTYS0_DEV.priv, 0); efm32_restoreuartint(TTYS0_DEV.priv, 0);
#ifdef TTYS1_DEV #ifdef TTYS1_DEV
@ -1154,7 +1152,7 @@ void arm_earlyserialinit(void)
efm32_restoreuartint(TTYS4_DEV.priv, 0); efm32_restoreuartint(TTYS4_DEV.priv, 0);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef CONSOLE_DEV #ifdef CONSOLE_DEV
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;

View File

@ -1988,9 +1988,7 @@ static void up_dma_rxcallback(DMA_HANDLE handle, void *arg, int result)
#if defined(USE_EARLYSERIALINIT) #if defined(USE_EARLYSERIALINIT)
void kinetis_uart_earlyserialinit(void) void kinetis_uart_earlyserialinit(void)
{ {
/* Disable interrupts from all UARTS. The console is enabled in /* Disable interrupts from all UARTS. */
* pic32mx_consoleinit()
*/
up_restoreuartint(TTYS0_DEV.priv, 0); up_restoreuartint(TTYS0_DEV.priv, 0);
#ifdef TTYS1_DEV #ifdef TTYS1_DEV
@ -2009,7 +2007,7 @@ void kinetis_uart_earlyserialinit(void)
up_restoreuartint(TTYS5_DEV.priv, 0); up_restoreuartint(TTYS5_DEV.priv, 0);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef HAVE_UART_CONSOLE #ifdef HAVE_UART_CONSOLE
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;

View File

@ -67,6 +67,7 @@
****************************************************************************/ ****************************************************************************/
/* Some sanity checks *******************************************************/ /* Some sanity checks *******************************************************/
/* Is there at least one UART enabled and configured as a RS-232 device? */ /* Is there at least one UART enabled and configured as a RS-232 device? */
#ifndef HAVE_UART_DEVICE #ifndef HAVE_UART_DEVICE
@ -324,7 +325,8 @@ static inline uint8_t up_serialin(struct up_dev_s *priv, int offset)
* Name: up_serialout * 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); putreg8(value, priv->uartbase + offset);
} }
@ -338,7 +340,9 @@ static void up_setuartint(struct up_dev_s *priv)
irqstate_t flags; irqstate_t flags;
uint8_t regval; uint8_t regval;
/* Re-enable/re-disable interrupts corresponding to the state of bits in ie */ /* Re-enable/re-disable interrupts corresponding to the state of bits
* in ie.
*/
flags = enter_critical_section(); flags = enter_critical_section();
regval = up_serialin(priv, KL_UART_C2_OFFSET); regval = up_serialin(priv, KL_UART_C2_OFFSET);
@ -356,7 +360,9 @@ static void up_restoreuartint(struct up_dev_s *priv, uint8_t ie)
{ {
irqstate_t flags; irqstate_t flags;
/* Re-enable/re-disable interrupts corresponding to the state of bits in ie */ /* Re-enable/re-disable interrupts corresponding to the state of bits
* in ie.
*/
flags = enter_critical_section(); flags = enter_critical_section();
priv->ie = ie & UART_C2_ALLINTS; priv->ie = ie & UART_C2_ALLINTS;
@ -413,7 +419,7 @@ static int up_setup(struct uart_dev_s *dev)
* *
* Description: * Description:
* Disable the UART. This method is called when the serial * Disable the UART. This method is called when the serial
* port is closed * port is closed.
* *
****************************************************************************/ ****************************************************************************/
@ -434,14 +440,15 @@ static void up_shutdown(struct uart_dev_s *dev)
* Name: up_attach * Name: up_attach
* *
* Description: * Description:
* Configure the UART to operation in interrupt driven mode. This method is * Configure the UART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * 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 * 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.
* *
****************************************************************************/ ****************************************************************************/
@ -467,9 +474,9 @@ static int up_attach(struct uart_dev_s *dev)
* Name: up_detach * Name: up_detach
* *
* Description: * Description:
* Detach UART interrupts. This method is called when the serial port is * Detach UART interrupts. This method is called when the serial port
* closed normally just before the shutdown method is called. The exception * is closed normally just before the shutdown method is called. The
* is the serial console which is never shutdown. * exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -566,7 +573,8 @@ static int up_interrupts(int irq, void *context, void *arg)
* FE: Framing error. To clear FE, write a logic one to the FE flag. * FE: Framing error. To clear FE, write a logic one to the FE flag.
* NF: Noise flag. To clear NF, write logic one to the NF. * NF: Noise flag. To clear NF, write logic one to the NF.
* PF: Parity error flag. To clear PF, write a logic one to the PF. * PF: Parity error flag. To clear PF, write a logic one to the PF.
* OR: Receiver Overrun Flag. To clear OR, write a logic 1 to the OR flag. * OR: Receiver Overrun Flag. To clear OR, write a logic 1 to the OR
* flag.
*/ */
if ((s1 & UART_S1_ERRORS) != 0) if ((s1 & UART_S1_ERRORS) != 0)
@ -810,9 +818,7 @@ static bool up_txready(struct uart_dev_s *dev)
void arm_earlyserialinit(void) void arm_earlyserialinit(void)
{ {
/* Disable interrupts from all UARTS. The console is enabled in /* Disable interrupts from all UARTS. */
* pic32mx_consoleinit()
*/
up_restoreuartint(TTYS0_DEV.priv, 0); up_restoreuartint(TTYS0_DEV.priv, 0);
#ifdef TTYS1_DEV #ifdef TTYS1_DEV
@ -831,7 +837,7 @@ void arm_earlyserialinit(void)
up_restoreuartint(TTYS5_DEV.priv, 0); up_restoreuartint(TTYS5_DEV.priv, 0);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef HAVE_SERIAL_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;

View File

@ -68,7 +68,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Some sanity checks *******************************************************/ /* Some sanity checks *******************************************************/
/* Is there at least one USART enabled and configured as a RS-232 device? */ /* Is there at least one USART enabled and configured as a RS-232 device? */
#ifndef HAVE_USART_DEVICE #ifndef HAVE_USART_DEVICE
@ -911,8 +913,9 @@ static inline void lpc54_serialout(struct lpc54_dev_s *priv,
* Name: lpc54_modifyreg * Name: lpc54_modifyreg
****************************************************************************/ ****************************************************************************/
static inline void lpc54_modifyreg(struct lpc54_dev_s *priv, unsigned int offset, static inline void lpc54_modifyreg(struct lpc54_dev_s *priv,
uint32_t setbits, uint32_t clrbits) unsigned int offset, uint32_t setbits,
uint32_t clrbits)
{ {
irqstate_t flags; irqstate_t flags;
uintptr_t regaddr = priv->uartbase + offset; uintptr_t regaddr = priv->uartbase + offset;
@ -932,7 +935,8 @@ static inline void lpc54_modifyreg(struct lpc54_dev_s *priv, unsigned int offset
* Name: lpc54_fifoint_enable * Name: lpc54_fifoint_enable
****************************************************************************/ ****************************************************************************/
static inline void lpc54_fifoint_enable(struct lpc54_dev_s *priv, uint32_t intset) static inline void lpc54_fifoint_enable(struct lpc54_dev_s *priv,
uint32_t intset)
{ {
lpc54_serialout(priv, LPC54_USART_FIFOINTENSET_OFFSET, intset); lpc54_serialout(priv, LPC54_USART_FIFOINTENSET_OFFSET, intset);
} }
@ -941,7 +945,8 @@ static inline void lpc54_fifoint_enable(struct lpc54_dev_s *priv, uint32_t intse
* Name: lpc54_fifoint_disable * Name: lpc54_fifoint_disable
****************************************************************************/ ****************************************************************************/
static inline void lpc54_fifoint_disable(struct lpc54_dev_s *priv, uint32_t intset) static inline void lpc54_fifoint_disable(struct lpc54_dev_s *priv,
uint32_t intset)
{ {
lpc54_serialout(priv, LPC54_USART_FIFOINTENCLR_OFFSET, intset); lpc54_serialout(priv, LPC54_USART_FIFOINTENCLR_OFFSET, intset);
} }
@ -950,7 +955,8 @@ static inline void lpc54_fifoint_disable(struct lpc54_dev_s *priv, uint32_t ints
* Name: lpc54_fifoint_disableall * Name: lpc54_fifoint_disableall
****************************************************************************/ ****************************************************************************/
static void lpc54_fifoint_disableall(struct lpc54_dev_s *priv, uint32_t *intset) static void lpc54_fifoint_disableall(struct lpc54_dev_s *priv,
uint32_t *intset)
{ {
irqstate_t flags; irqstate_t flags;
@ -994,7 +1000,7 @@ static int lpc54_setup(struct uart_dev_s *dev)
* *
* Description: * Description:
* Disable the USART. This method is called when the serial * Disable the USART. This method is called when the serial
* port is closed * port is closed.
* *
****************************************************************************/ ****************************************************************************/
@ -1015,14 +1021,15 @@ static void lpc54_shutdown(struct uart_dev_s *dev)
* Name: lpc54_attach * Name: lpc54_attach
* *
* Description: * Description:
* Configure the USART to operation in interrupt driven mode. This method is * Configure the USART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * 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 * 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.
* *
****************************************************************************/ ****************************************************************************/
@ -1048,9 +1055,9 @@ static int lpc54_attach(struct uart_dev_s *dev)
* Name: lpc54_detach * Name: lpc54_detach
* *
* Description: * Description:
* Detach USART interrupts. This method is called when the serial port is * Detach USART interrupts. This method is called when the serial port
* closed normally just before the shutdown method is called. The exception * is closed normally just before the shutdown method is called. The
* is the serial console which is never shutdown. * exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -1228,8 +1235,8 @@ static void lpc54_rxint(struct uart_dev_s *dev, bool enable)
if (enable) if (enable)
{ {
#ifndef CONFIG_SUPPRESS_SERIAL_INTS #ifndef CONFIG_SUPPRESS_SERIAL_INTS
/* Receive an interrupt when their is anything in the Rx data register (or an Rx /* Receive an interrupt when there is anything in the Rx data register
* timeout occurs). * (or an Rx timeout occurs).
*/ */
lpc54_fifoint_enable(priv, CCR_RX_EVENTS); lpc54_fifoint_enable(priv, CCR_RX_EVENTS);
@ -1360,17 +1367,15 @@ static bool lpc54_txempty(struct uart_dev_s *dev)
* Performs the low level USART initialization early in debug so that the * Performs the low level USART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before lpc54_serialinit. NOTE: This function depends on GPIO pin * before lpc54_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in xmc_lowsetup() and main clock iniialization * configuration performed in lpc54_lowsetup() and main clock
* performed in xmc_clock_configure(). * initialization performed in lpc54_clockconfig().
* *
****************************************************************************/ ****************************************************************************/
#ifdef USE_EARLYSERIALINIT #ifdef USE_EARLYSERIALINIT
void lpc54_earlyserialinit(void) void lpc54_earlyserialinit(void)
{ {
/* Disable interrupts from all USARTS. The console is enabled in /* Disable interrupts from all USARTS. */
* pic32mx_consoleinit()
*/
lpc54_fifoint_disableall(TTYS0_DEV.priv, NULL); lpc54_fifoint_disableall(TTYS0_DEV.priv, NULL);
#ifdef TTYS1_DEV #ifdef TTYS1_DEV
@ -1401,7 +1406,7 @@ void lpc54_earlyserialinit(void)
lpc54_fifoint_disableall(TTYS9_DEV.priv, NULL); lpc54_fifoint_disableall(TTYS9_DEV.priv, NULL);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef HAVE_USART_CONSOLE #ifdef HAVE_USART_CONSOLE
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;
@ -1469,7 +1474,7 @@ void arm_serialinit(void)
* Name: up_putc * Name: up_putc
* *
* Description: * Description:
* Provide priority, low-level access to support OS debug writes * Provide priority, low-level access to support OS debug writes.
* *
****************************************************************************/ ****************************************************************************/

View File

@ -44,7 +44,7 @@
#include "lpc54_config.h" #include "lpc54_config.h"
/**************************************************************************** /****************************************************************************
* Public Functions * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
@ -54,8 +54,8 @@
* Performs the low level USART initialization early in debug so that the * Performs the low level USART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before lpc54_serialinit. NOTE: This function depends on GPIO pin * before lpc54_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in xmc_lowsetup() and main clock iniialization * configuration performed in lpc54_lowsetup() and main clock
* performed in xmc_clock_configure(). * initialization performed in lpc54_clockconfig().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -70,6 +70,7 @@
****************************************************************************/ ****************************************************************************/
/* Some sanity checks *******************************************************/ /* Some sanity checks *******************************************************/
/* Is there at least one UART enabled and configured as a RS-232 device? */ /* Is there at least one UART enabled and configured as a RS-232 device? */
#ifndef HAVE_UART_DEVICE #ifndef HAVE_UART_DEVICE
@ -315,8 +316,9 @@ static inline void max326_serialout(struct max326_dev_s *priv,
* Name: max326_modifyreg * Name: max326_modifyreg
****************************************************************************/ ****************************************************************************/
static inline void max326_modifyreg(struct max326_dev_s *priv, unsigned int offset, static inline void max326_modifyreg(struct max326_dev_s *priv,
uint32_t setbits, uint32_t clrbits) unsigned int offset, uint32_t setbits,
uint32_t clrbits)
{ {
irqstate_t flags; irqstate_t flags;
uintptr_t regaddr = priv->uartbase + offset; uintptr_t regaddr = priv->uartbase + offset;
@ -436,14 +438,15 @@ static void max326_shutdown(struct uart_dev_s *dev)
* Name: max326_attach * Name: max326_attach
* *
* Description: * Description:
* Configure the UART to operation in interrupt driven mode. This method is * Configure the UART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * 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 * 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.
* *
****************************************************************************/ ****************************************************************************/
@ -469,9 +472,9 @@ static int max326_attach(struct uart_dev_s *dev)
* Name: max326_detach * Name: max326_detach
* *
* Description: * Description:
* Detach UART interrupts. This method is called when the serial port is * Detach UART interrupts. This method is called when the serial port
* closed normally just before the shutdown method is called. The exception * is closed normally just before the shutdown method is called. The
* is the serial console which is never shutdown. * exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -632,7 +635,7 @@ static int max326_receive(struct uart_dev_s *dev, uint32_t *status)
{ {
struct max326_dev_s *priv = (struct max326_dev_s *)dev->priv; struct max326_dev_s *priv = (struct max326_dev_s *)dev->priv;
/* Return receiver control information */ /* Return receiver control information. */
if (status) if (status)
{ {
@ -659,8 +662,8 @@ static void max326_rxint(struct uart_dev_s *dev, bool enable)
if (enable) if (enable)
{ {
#ifndef CONFIG_SUPPRESS_SERIAL_INTS #ifndef CONFIG_SUPPRESS_SERIAL_INTS
/* Receive an interrupt when their is anything in the Rx data register (or an Rx /* Receive an interrupt when there is anything in the Rx data register
* timeout occurs). * (or an Rx timeout occurs).
*/ */
#ifdef CONFIG_DEBUG_FEATURES #ifdef CONFIG_DEBUG_FEATURES
@ -795,24 +798,22 @@ static bool max326_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before max326_serialinit. NOTE: This function depends on GPIO pin * before max326_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in xmc_lowsetup() and main clock iniialization * configuration performed in max326_lowsetup() and main clock
* performed in xmc_clock_configure(). * initialization performed in max326_clockconfig().
* *
****************************************************************************/ ****************************************************************************/
#ifdef USE_EARLYSERIALINIT #ifdef USE_EARLYSERIALINIT
void max326_earlyserialinit(void) void max326_earlyserialinit(void)
{ {
/* Disable interrupts from all UARTS. The console is enabled in /* Disable interrupts from all UARTS. */
* pic32mx_consoleinit()
*/
max326_int_disableall(TTYS0_DEV.priv, NULL); max326_int_disableall(TTYS0_DEV.priv, NULL);
#ifdef TTYS1_DEV #ifdef TTYS1_DEV
max326_int_disableall(TTYS1_DEV.priv, NULL); max326_int_disableall(TTYS1_DEV.priv, NULL);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef HAVE_UART_CONSOLE #ifdef HAVE_UART_CONSOLE
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;

View File

@ -749,8 +749,8 @@ static bool nrf52_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before nrf52_serialinit. NOTE: This function depends on GPIO pin * before nrf52_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in nrf52_lowsetup() and main clock iniialization * configuration performed in nrf52_lowsetup() and main clock
* performed in nrf_clock_configure(). * initialization performed in nrf_clock_configure().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -86,8 +86,8 @@ void xmc4_lowsetup(void);
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before xmc4_serialinit. NOTE: This function depends on GPIO pin * before xmc4_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in xmc_lowsetup() and main clock iniialization * configuration performed in xmc4_lowsetup() and main clock initialization
* performed in xmc_clock_configure(). * performed in xmc4_clock_configure().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -1028,17 +1028,15 @@ static bool xmc4_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before xmc4_serialinit. NOTE: This function depends on GPIO pin * before xmc4_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in xmc_lowsetup() and main clock iniialization * configuration performed in xmc4_lowsetup() and main clock initialization
* performed in xmc_clock_configure(). * performed in xmc4_clock_configure().
* *
****************************************************************************/ ****************************************************************************/
#if defined(USE_EARLYSERIALINIT) #if defined(USE_EARLYSERIALINIT)
void xmc4_earlyserialinit(void) void xmc4_earlyserialinit(void)
{ {
/* Disable interrupts from all UARTS. The console is enabled in /* Disable interrupts from all UARTS. */
* pic32mx_consoleinit()
*/
xmc4_restoreuartint(TTYS0_DEV.priv, 0); xmc4_restoreuartint(TTYS0_DEV.priv, 0);
#ifdef TTYS1_DEV #ifdef TTYS1_DEV
@ -1057,7 +1055,7 @@ void xmc4_earlyserialinit(void)
xmc4_restoreuartint(TTYS5_DEV.priv, 0); xmc4_restoreuartint(TTYS5_DEV.priv, 0);
#endif #endif
/* Configuration whichever one is the console */ /* Configuration whichever one is the console. */
#ifdef HAVE_UART_CONSOLE #ifdef HAVE_UART_CONSOLE
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;
@ -1113,7 +1111,7 @@ void arm_serialinit(void)
* Name: up_putc * Name: up_putc
* *
* Description: * Description:
* Provide priority, low-level access to support OS debug writes * Provide priority, low-level access to support OS debug writes.
* *
****************************************************************************/ ****************************************************************************/

View File

@ -313,7 +313,8 @@ static inline uint32_t up_serialin(struct up_dev_s *priv, int offset)
* Name: up_serialout * Name: up_serialout
****************************************************************************/ ****************************************************************************/
static inline void up_serialout(struct up_dev_s *priv, int offset, uint32_t value) static inline void up_serialout(struct up_dev_s *priv, int offset,
uint32_t value)
{ {
putreg32(value, priv->usartbase + offset); putreg32(value, priv->usartbase + offset);
} }
@ -390,14 +391,15 @@ static void up_shutdown(struct uart_dev_s *dev)
* Name: up_attach * Name: up_attach
* *
* Description: * Description:
* Configure the USART to operation in interrupt driven mode. This method is * Configure the USART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * 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 * 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.
* *
****************************************************************************/ ****************************************************************************/
@ -415,8 +417,8 @@ static int up_attach(struct uart_dev_s *dev)
* *
* Description: * Description:
* Detach USART interrupts. This method is called when the serial port is * Detach USART interrupts. This method is called when the serial port is
* closed normally just before the shutdown method is called. The exception * closed normally just before the shutdown method is called. The
* is the serial console which is never shutdown. * exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -554,6 +556,7 @@ static int up_receive(struct uart_dev_s *dev, uint32_t *status)
{ {
*status = priv->csr; *status = priv->csr;
} }
priv->csr = 0; priv->csr = 0;
/* Then return the actual received byte */ /* Then return the actual received byte */
@ -575,8 +578,8 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
if (enable) if (enable)
{ {
/* Receive an interrupt when their is anything in the Rx data register (or an Rx /* Receive an interrupt when there is anything in the Rx data register
* timeout occurs). * (or an Rx timeout occurs).
*/ */
#ifndef CONFIG_SUPPRESS_SERIAL_INTS #ifndef CONFIG_SUPPRESS_SERIAL_INTS
@ -602,7 +605,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
* Name: up_rxavailable * Name: up_rxavailable
* *
* Description: * Description:
* Return true if the receive register is not empty * Return true if the receive register is not empty.
* *
****************************************************************************/ ****************************************************************************/
@ -649,7 +652,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
flags = enter_critical_section(); flags = enter_critical_section();
if (enable) if (enable)
{ {
/* Set to receive an interrupt when the TX data register is empty */ /* Set to receive an interrupt when the TX data register is empty. */
#ifndef CONFIG_SUPPRESS_SERIAL_INTS #ifndef CONFIG_SUPPRESS_SERIAL_INTS
up_serialout(priv, AVR32_USART_IER_OFFSET, USART_INT_TXRDY); up_serialout(priv, AVR32_USART_IER_OFFSET, USART_INT_TXRDY);
@ -663,10 +666,11 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
} }
else else
{ {
/* Disable the TX interrupt */ /* Disable the TX interrupt. */
up_serialout(priv, AVR32_USART_IDR_OFFSET, USART_INT_TXRDY); up_serialout(priv, AVR32_USART_IDR_OFFSET, USART_INT_TXRDY);
} }
leave_critical_section(flags); leave_critical_section(flags);
} }
@ -704,8 +708,8 @@ static bool up_txready(struct uart_dev_s *dev)
* Performs the low level USART initialization early in debug so that the * Performs the low level USART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -68,6 +68,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* If we are not using the serial driver for the console, then we still must /* If we are not using the serial driver for the console, then we still must
* provide some minimal implementation of up_putc. * provide some minimal implementation of up_putc.
*/ */
@ -316,7 +317,9 @@ static void up_restoreuartint(struct uart_dev_s *dev, uint8_t im)
{ {
irqstate_t flags; irqstate_t flags;
/* Re-enable/re-disable interrupts corresponding to the state of bits in im */ /* Re-enable/re-disable interrupts corresponding to the state
* of bits in im.
*/
flags = enter_critical_section(); flags = enter_critical_section();
up_rxint(dev, RX_ENABLED(im)); up_rxint(dev, RX_ENABLED(im));
@ -398,14 +401,14 @@ static void up_shutdown(struct uart_dev_s *dev)
* Name: up_attach * Name: up_attach
* *
* Description: * Description:
* Configure the UART to operation in interrupt driven mode. This method is * Configure the UART to operation in interrupt driven mode. This method
* called when the serial port is opened. Normally, this is just after the * 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 * 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 by the attach method (unless the * RX and TX interrupts are not enabled by the attach method (unless the
* hardware supports multiple levels of interrupt enabling). The RX and TX * hardware supports multiple levels of interrupt enabling). The RX and
* interrupts are not enabled until the txint() and rxint() methods are * TX interrupts are not enabled until the txint() and rxint() methods are
* called. * called.
* *
****************************************************************************/ ****************************************************************************/
@ -423,9 +426,9 @@ static int up_attach(struct uart_dev_s *dev)
* Name: up_detach * Name: up_detach
* *
* Description: * Description:
* Detach UART interrupts. This method is called when the serial port is * Detach UART interrupts. This method is called when the serial port
* closed normally just before the shutdown method is called. The exception * is closed normally just before the shutdown method is called. The
* is the serial console which is never shutdown. * exception is the serial console which is never shutdown.
* *
****************************************************************************/ ****************************************************************************/
@ -831,8 +834,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -1085,8 +1085,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -610,8 +610,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -598,8 +598,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -610,8 +610,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -627,8 +627,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/

View File

@ -747,8 +747,8 @@ static bool up_txempty(struct uart_dev_s *dev)
* Performs the low level UART initialization early in debug so that the * Performs the low level UART initialization early in debug so that the
* serial console will be available during bootup. This must be called * serial console will be available during bootup. This must be called
* before up_serialinit. NOTE: This function depends on GPIO pin * before up_serialinit. NOTE: This function depends on GPIO pin
* configuration performed in up_consoleinit() and main clock iniialization * configuration performed in up_consoleinit() and main clock
* performed in up_clkinitialize(). * initialization performed in up_clkinitialize().
* *
****************************************************************************/ ****************************************************************************/