summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/str71x/str71x_serial.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-06 01:54:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-06 01:54:11 +0000
commit81597afb0f0c3ea5912387db506f86d2989b2ad2 (patch)
tree2f194e11c1167456abc1c7779009b800eebab1ee /nuttx/arch/arm/src/str71x/str71x_serial.c
parent3f38e3b45ef0d6f4290b9ad7166481e31a73269c (diff)
downloadpx4-nuttx-81597afb0f0c3ea5912387db506f86d2989b2ad2.tar.gz
px4-nuttx-81597afb0f0c3ea5912387db506f86d2989b2ad2.tar.bz2
px4-nuttx-81597afb0f0c3ea5912387db506f86d2989b2ad2.zip
Need to set UART interrupt priority
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1854 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/str71x/str71x_serial.c')
-rw-r--r--nuttx/arch/arm/src/str71x/str71x_serial.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/str71x/str71x_serial.c b/nuttx/arch/arm/src/str71x/str71x_serial.c
index 5617edab0..c803a7277 100644
--- a/nuttx/arch/arm/src/str71x/str71x_serial.c
+++ b/nuttx/arch/arm/src/str71x/str71x_serial.c
@@ -77,6 +77,12 @@
# undef HAVE_CONSOLE
#endif
+#ifndef CONFIG_UART_PRI
+# define CONFIG_UART_PRI 1
+#elif CONFIG_UART_PRI <= 1 && CONFIG_UART_PRI >15
+# error "CONFIG_UART_PRI is out of range"
+#endif
+
/* If we are not using the serial driver for the console, then we
* still must provide some minimal implementation of up_putc().
*/
@@ -580,6 +586,10 @@ static int up_attach(struct uart_dev_s *dev)
*/
up_enable_irq(priv->irq);
+
+ /* Set the uart interrupt priority (the default value is one) */
+
+ up_prioritize_irq(priv->irq, CONFIG_UART_PRI);
}
return ret;
}
@@ -668,7 +678,8 @@ static int up_interrupt(int irq, void *context)
/* Handle incoming, receive bytes (with or without timeout) */
- if ((priv->sr & STR71X_UARTSR_RNE) != 0)
+ if ((priv->sr & STR71X_UARTSR_RNE) != 0 && /* Rx FIFO not empty */
+ (priv->ier & STR71X_UARTIER_RHF) != 0) /* Rx FIFO half full int enabled */
{
/* Rx buffer not empty ... process incoming bytes */
@@ -678,7 +689,8 @@ static int up_interrupt(int irq, void *context)
/* Handle outgoing, transmit bytes */
- if ((priv->sr & STR71X_UARTSR_TF) == 0)
+ if ((priv->sr & STR71X_UARTSR_TF) == 0 && /* Tx FIFO not full */
+ (priv->ier & STR71X_UARTIER_THE) != 0) /* Tx Half empty interrupt enabled */
{
/* Tx FIFO not full ... process outgoing bytes */
@@ -686,7 +698,8 @@ static int up_interrupt(int irq, void *context)
handled = TRUE;
}
}
- return OK;
+
+ return OK;
}
/****************************************************************************