Trivial updates to files modified in last PR based on results of tools/nxstyle.

This commit is contained in:
Gregory Nutt 2019-12-16 13:13:04 -06:00
parent a0429bcb20
commit e7c9c89985
3 changed files with 12 additions and 9 deletions

View File

@ -50,6 +50,7 @@
************************************************************************************/ ************************************************************************************/
/* Configuration *********************************************************************/ /* Configuration *********************************************************************/
/* Make sure that no unsupported UART, I2C master, or SPI master peripherals are /* Make sure that no unsupported UART, I2C master, or SPI master peripherals are
* enabled. * enabled.
*/ */

View File

@ -84,7 +84,7 @@
/* UART console configuration */ /* UART console configuration */
static const struct uart_config_s g_console_config= static const struct uart_config_s g_console_config =
{ {
.baud = CONSOLE_BAUD, .baud = CONSOLE_BAUD,
.parity = CONSOLE_PARITY, .parity = CONSOLE_PARITY,
@ -116,11 +116,11 @@ static const struct uart_config_s g_console_config=
#ifdef HAVE_UART_DEVICE #ifdef HAVE_UART_DEVICE
static void nrf52_setbaud(uintptr_t base, const struct uart_config_s *config) 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) if (config->baud == 115200)
{ {
br = 0x01D7E000; br = 0x01d7e000;
} }
putreg32(br, base + NRF52_UART_BAUDRATE_OFFSET); putreg32(br, base + NRF52_UART_BAUDRATE_OFFSET);
@ -204,14 +204,15 @@ void nrf52_usart_configure(uintptr_t base, const struct uart_config_s *config)
void nrf52_usart_disable(uintptr_t base) void nrf52_usart_disable(uintptr_t base)
{ {
/* Disable interrupts */ /* Disable interrupts */
/* Disable the UART */ /* Disable the UART */
putreg32(1, base + NRF52_UART_TASKS_STOPRX_OFFSET); putreg32(1, base + NRF52_UART_TASKS_STOPRX_OFFSET);
putreg32(1, base + NRF52_UART_TASKS_STOPTX_OFFSET); putreg32(1, base + NRF52_UART_TASKS_STOPTX_OFFSET);
putreg32(NRF52_UART_ENABLE_DISABLE, base + NRF52_UART_ENABLE_OFFSET); putreg32(NRF52_UART_ENABLE_DISABLE, base + NRF52_UART_ENABLE_OFFSET);
putreg32(0xFFFFFFFF, base + NRF52_UART_PSELTXD_OFFSET); putreg32(0xffffffff, base + NRF52_UART_PSELTXD_OFFSET);
putreg32(0xFFFFFFFF, base + NRF52_UART_PSELRXD_OFFSET); putreg32(0xffffffff, base + NRF52_UART_PSELRXD_OFFSET);
} }
#endif #endif
@ -229,7 +230,7 @@ void up_lowputc(char ch)
putreg32(1, CONSOLE_BASE + NRF52_UART_TASKS_STARTTX_OFFSET); putreg32(1, CONSOLE_BASE + NRF52_UART_TASKS_STARTTX_OFFSET);
putreg32(0, CONSOLE_BASE + NRF52_UART_EVENTS_TXDRDY_OFFSET); putreg32(0, CONSOLE_BASE + NRF52_UART_EVENTS_TXDRDY_OFFSET);
putreg32(ch, CONSOLE_BASE + NRF52_UART_TXD_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)
{ {
} }

View File

@ -71,6 +71,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
@ -193,7 +194,7 @@ static uart_dev_t g_uart0port =
{ {
.size = CONFIG_UART0_TXBUFSIZE, .size = CONFIG_UART0_TXBUFSIZE,
.buffer = g_uart0txbuffer, .buffer = g_uart0txbuffer,
}, },
.ops = &g_uart_ops, .ops = &g_uart_ops,
.priv = &g_uart0priv, .priv = &g_uart0priv,
}; };
@ -301,6 +302,7 @@ static void nrf52_shutdown(struct uart_dev_s *dev)
/* TODO: release uart pins */ /* TODO: release uart pins */
/* Disable interrupts */ /* Disable interrupts */
/* Reset hardware and disable Rx and Tx */ /* Reset hardware and disable Rx and Tx */
nrf52_usart_disable(priv->uartbase); nrf52_usart_disable(priv->uartbase);
@ -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(1, priv->uartbase + NRF52_UART_TASKS_STARTTX_OFFSET);
putreg32(ch, priv->uartbase + NRF52_UART_TXD_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); putreg32(1, priv->uartbase + NRF52_UART_TASKS_STOPTX_OFFSET);
} }
/**************************************************************************** /****************************************************************************