diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-06-13 16:18:25 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-06-13 16:18:25 -0600 |
commit | f89052fa018e2b4e3ae7aeea2f36aa3d08927956 (patch) | |
tree | 8803293b855c7a9f6fa848692dc945aff581e21f | |
parent | 59868bc1000ec7173ac4b18fa239a5d662ed72c4 (diff) | |
download | px4-nuttx-f89052fa018e2b4e3ae7aeea2f36aa3d08927956.tar.gz px4-nuttx-f89052fa018e2b4e3ae7aeea2f36aa3d08927956.tar.bz2 px4-nuttx-f89052fa018e2b4e3ae7aeea2f36aa3d08927956.zip |
SAM3/4: Loop counter for PLL delay must be volatile or it may get optimized away
-rw-r--r-- | nuttx/arch/arm/src/sam34/sam3u_clockconfig.c | 3 | ||||
-rw-r--r-- | nuttx/configs/sam3u-ek/src/up_touchscreen.c | 1 | ||||
-rw-r--r-- | nuttx/drivers/serial/serialirq.c | 7 |
3 files changed, 9 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/sam34/sam3u_clockconfig.c b/nuttx/arch/arm/src/sam34/sam3u_clockconfig.c index 71d918b8c..500ed2839 100644 --- a/nuttx/arch/arm/src/sam34/sam3u_clockconfig.c +++ b/nuttx/arch/arm/src/sam34/sam3u_clockconfig.c @@ -151,7 +151,8 @@ static inline void sam_supcsetup(void) static void sam_pmcwait(uint32_t bit) { - uint32_t delay; + volatile uint32_t delay; + for (delay = 0; (getreg32(SAM_PMC_SR) & bit) == 0 && delay < UINT32_MAX; delay++); diff --git a/nuttx/configs/sam3u-ek/src/up_touchscreen.c b/nuttx/configs/sam3u-ek/src/up_touchscreen.c index f8b465748..ea2ad3d0a 100644 --- a/nuttx/configs/sam3u-ek/src/up_touchscreen.c +++ b/nuttx/configs/sam3u-ek/src/up_touchscreen.c @@ -195,6 +195,7 @@ static bool tsc_busy(FAR struct ads7843e_config_s *state) last = busy; } #endif + return busy; } diff --git a/nuttx/drivers/serial/serialirq.c b/nuttx/drivers/serial/serialirq.c index fda5b4afb..8e3f80ead 100644 --- a/nuttx/drivers/serial/serialirq.c +++ b/nuttx/drivers/serial/serialirq.c @@ -84,7 +84,7 @@ void uart_xmitchars(FAR uart_dev_t *dev) { uint16_t nbytes = 0; - /* Send while we still have data & room in the fifo */ + /* Send while we still have data in the TX buffer & room in the fifo */ while (dev->xmit.head != dev->xmit.tail && uart_txready(dev)) { @@ -103,6 +103,11 @@ void uart_xmitchars(FAR uart_dev_t *dev) /* When all of the characters have been sent from the buffer disable the TX * interrupt. + * + * Potential bug? If nbytes == 0 && (dev->xmit.head == dev->xmit.tail) && + * dev->xmitwaiting == true, then disabling the TX interrupt will leave + * the uart_write() logic waiting to TX to complete with no TX interrupts. + * Can that happen? */ if (dev->xmit.head == dev->xmit.tail) |