aboutsummaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-09-14 00:21:24 -0700
committerpx4dev <px4@purgatory.org>2012-09-14 00:21:24 -0700
commit04b5856764639de7a595257bcbe22c6278319001 (patch)
tree2a5720c19139479f929b1c864fc415ee1921ef2b /nuttx
parentd7fb2175eb73fc7ec1616c3ad78fffd1bc1590ab (diff)
downloadpx4-firmware-04b5856764639de7a595257bcbe22c6278319001.tar.gz
px4-firmware-04b5856764639de7a595257bcbe22c6278319001.tar.bz2
px4-firmware-04b5856764639de7a595257bcbe22c6278319001.zip
Avoid a race where up_putc can leave the driver in an inconsistent state (though how is not clear). This manifests as the system hanging after printing "nsh_romfsetc: "
Avoid attempting to repeat low-level initialization for the console when enabling DMA.
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_serial.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c
index 83acc676b..80cf5d61e 100644
--- a/nuttx/arch/arm/src/stm32/stm32_serial.c
+++ b/nuttx/arch/arm/src/stm32/stm32_serial.c
@@ -956,7 +956,8 @@ static int up_setup(struct uart_dev_s *dev)
/* Set up the cached interrupt enables value */
- priv->ie = 0;
+ up_restoreusartint(priv, 0);
+
return OK;
}
@@ -976,12 +977,15 @@ static int up_dma_setup(struct uart_dev_s *dev)
int result;
uint32_t regval;
- /* Do the basic UART setup first */
+ /* Do the basic UART setup first, unless we are the console */
- result = up_setup(dev);
- if (result != OK)
- {
- return result;
+ if (!dev->isconsole)
+ {
+ result = up_setup(dev);
+ if (result != OK)
+ {
+ return result;
+ }
}
/* Acquire the DMA channel. This should always succeed. */
@@ -1941,10 +1945,10 @@ void stm32_serial_dma_poll(void)
int up_putc(int ch)
{
#if CONSOLE_UART > 0
- struct up_dev_s *priv = uart_devs[CONSOLE_UART - 1];
- uint16_t ie;
+// struct up_dev_s *priv = uart_devs[CONSOLE_UART - 1];
+// uint16_t ie;
- up_disableusartint(priv, &ie);
+// up_disableusartint(priv, &ie);
/* Check for LF */
@@ -1956,7 +1960,7 @@ int up_putc(int ch)
}
up_lowputc(ch);
- up_restoreusartint(priv, ie);
+// up_restoreusartint(priv, ie);
#endif
return ch;
}