Skip to content

Commit

Permalink
Trivial updates to files modified in last PR based on results of tool…
Browse files Browse the repository at this point in the history
…s/nxstyle.
  • Loading branch information
gregory-nutt committed Dec 16, 2019
1 parent a0429bc commit e7c9c89
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions arch/arm/src/nrf52/nrf52_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
************************************************************************************/

/* Configuration *********************************************************************/

/* Make sure that no unsupported UART, I2C master, or SPI master peripherals are
* enabled.
*/
Expand Down
13 changes: 7 additions & 6 deletions arch/arm/src/nrf52/nrf52_lowputc.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

/* UART console configuration */

static const struct uart_config_s g_console_config=
static const struct uart_config_s g_console_config =
{
.baud = CONSOLE_BAUD,
.parity = CONSOLE_PARITY,
Expand Down Expand Up @@ -116,11 +116,11 @@ static const struct uart_config_s g_console_config=
#ifdef HAVE_UART_DEVICE
static void nrf52_setbaud(uintptr_t base, const struct uart_config_s *config)
{
uint32_t br = 0x01D7E000; /* 268.444444 */
uint32_t br = 0x01d7e000; /* 268.444444 */

if (config->baud == 115200)
{
br = 0x01D7E000;
br = 0x01d7e000;
}

putreg32(br, base + NRF52_UART_BAUDRATE_OFFSET);
Expand Down Expand Up @@ -204,14 +204,15 @@ void nrf52_usart_configure(uintptr_t base, const struct uart_config_s *config)
void nrf52_usart_disable(uintptr_t base)
{
/* Disable interrupts */

/* Disable the UART */

putreg32(1, base + NRF52_UART_TASKS_STOPRX_OFFSET);
putreg32(1, base + NRF52_UART_TASKS_STOPTX_OFFSET);
putreg32(NRF52_UART_ENABLE_DISABLE, base + NRF52_UART_ENABLE_OFFSET);

putreg32(0xFFFFFFFF, base + NRF52_UART_PSELTXD_OFFSET);
putreg32(0xFFFFFFFF, base + NRF52_UART_PSELRXD_OFFSET);
putreg32(0xffffffff, base + NRF52_UART_PSELTXD_OFFSET);
putreg32(0xffffffff, base + NRF52_UART_PSELRXD_OFFSET);
}
#endif

Expand All @@ -229,7 +230,7 @@ void up_lowputc(char ch)
putreg32(1, CONSOLE_BASE + NRF52_UART_TASKS_STARTTX_OFFSET);
putreg32(0, CONSOLE_BASE + NRF52_UART_EVENTS_TXDRDY_OFFSET);
putreg32(ch, CONSOLE_BASE + NRF52_UART_TXD_OFFSET);
while (getreg32(CONSOLE_BASE + NRF52_UART_EVENTS_TXDRDY_OFFSET) == 0 )
while (getreg32(CONSOLE_BASE + NRF52_UART_EVENTS_TXDRDY_OFFSET) == 0)
{
}

Expand Down
7 changes: 4 additions & 3 deletions arch/arm/src/nrf52/nrf52_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
****************************************************************************/

/* Some sanity checks *******************************************************/

/* Is there at least one UART enabled and configured as a RS-232 device? */

#ifndef HAVE_UART_DEVICE
Expand Down Expand Up @@ -193,7 +194,7 @@ static uart_dev_t g_uart0port =
{
.size = CONFIG_UART0_TXBUFSIZE,
.buffer = g_uart0txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart0priv,
};
Expand Down Expand Up @@ -301,6 +302,7 @@ static void nrf52_shutdown(struct uart_dev_s *dev)
/* TODO: release uart pins */

/* Disable interrupts */

/* Reset hardware and disable Rx and Tx */

nrf52_usart_disable(priv->uartbase);
Expand Down Expand Up @@ -513,12 +515,11 @@ static void nrf52_send(struct uart_dev_s *dev, int ch)
putreg32(1, priv->uartbase + NRF52_UART_TASKS_STARTTX_OFFSET);

putreg32(ch, priv->uartbase + NRF52_UART_TXD_OFFSET);
while (getreg32(priv->uartbase + NRF52_UART_EVENTS_TXDRDY_OFFSET) == 0 )
while (getreg32(priv->uartbase + NRF52_UART_EVENTS_TXDRDY_OFFSET) == 0)
{
}

putreg32(1, priv->uartbase + NRF52_UART_TASKS_STOPTX_OFFSET);

}

/****************************************************************************
Expand Down

0 comments on commit e7c9c89

Please sign in to comment.