aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/LPC214x
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-06 12:55:12 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-06 12:55:12 +0000
commit7e4202ae46606be697611dd6f5f867c4915dc046 (patch)
treeee0036f9ad934743d02dfe0e3b4cfe7a01e63d92 /os/hal/platforms/LPC214x
parentbc489e39a8036bd8cc70569ac8e31ec257d68747 (diff)
downloadChibiOS-7e4202ae46606be697611dd6f5f867c4915dc046.tar.gz
ChibiOS-7e4202ae46606be697611dd6f5f867c4915dc046.tar.bz2
ChibiOS-7e4202ae46606be697611dd6f5f867c4915dc046.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1506 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/LPC214x')
-rw-r--r--os/hal/platforms/LPC214x/serial_lld.c52
-rw-r--r--os/hal/platforms/LPC214x/serial_lld.h9
2 files changed, 22 insertions, 39 deletions
diff --git a/os/hal/platforms/LPC214x/serial_lld.c b/os/hal/platforms/LPC214x/serial_lld.c
index cfc742736..9c76d8e7f 100644
--- a/os/hal/platforms/LPC214x/serial_lld.c
+++ b/os/hal/platforms/LPC214x/serial_lld.c
@@ -152,7 +152,6 @@ static void serve_interrupt(SerialDriver *sdp) {
break;
case IIR_SRC_TX:
{
-#if LPC214x_UART_FIFO_PRELOAD > 0
int i = LPC214x_UART_FIFO_PRELOAD;
do {
msg_t b;
@@ -169,15 +168,6 @@ static void serve_interrupt(SerialDriver *sdp) {
}
u->UART_THR = b;
} while (--i);
-#else
- chSysLockFromIsr();
- msg_t b = sdRequestDataI(sdp);
- chSysUnlockFromIsr();
- if (b < Q_OK)
- u->UART_IER &= ~IER_THRE;
- else
- u->UART_THR = b;
-#endif
}
break;
default:
@@ -187,20 +177,18 @@ static void serve_interrupt(SerialDriver *sdp) {
}
}
-#if LPC214x_UART_FIFO_PRELOAD > 0
+/**
+ * @brief Attempts a TX FIFO preload.
+ */
static void preload(SerialDriver *sdp) {
UART *u = sdp->sd.uart;
if (u->UART_LSR & LSR_THRE) {
int i = LPC214x_UART_FIFO_PRELOAD;
do {
- chSysLockFromIsr();
msg_t b = chOQGetI(&sdp->sd.oqueue);
- chSysUnlockFromIsr();
if (b < Q_OK) {
- chSysLockFromIsr();
chEvtBroadcastI(&sdp->bac.oevent);
- chSysUnlockFromIsr();
return;
}
u->UART_THR = b;
@@ -208,38 +196,25 @@ static void preload(SerialDriver *sdp) {
}
u->UART_IER |= IER_THRE;
}
-#endif
+/**
+ * @brief Driver SD1 output notification.
+ */
#if USE_LPC214x_UART0 || defined(__DOXYGEN__)
static void notify1(void) {
-#if LPC214x_UART_FIFO_PRELOAD > 0
preload(&SD1);
-#else
- UART *u = U0Base;
-
- if (u->UART_LSR & LSR_THRE) {
- chSysLockFromIsr();
- u->UART_THR = chOQGetI(&SD1.sd.oqueue);
- chSysUnlockFromIsr();
- }
- u->UART_IER |= IER_THRE;
-#endif
}
#endif
+
+/**
+ * @brief Driver SD2 output notification.
+ */
#if USE_LPC214x_UART1 || defined(__DOXYGEN__)
static void notify2(void) {
-#if LPC214x_UART_FIFO_PRELOAD > 0
preload(&SD2);
-#else
- UART *u = U1Base;
-
- if (u->UART_LSR & LSR_THRE)
- u->UART_THR = chOQGetI(&SD2.sd.oqueue);
- u->UART_IER |= IER_THRE;
-#endif
}
#endif
@@ -247,6 +222,9 @@ static void notify2(void) {
/* Driver interrupt handlers. */
/*===========================================================================*/
+/**
+ * @brief UART0 IRQ handler.
+ */
#if USE_LPC214x_UART0 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(UART0IrqHandler) {
@@ -259,6 +237,10 @@ CH_IRQ_HANDLER(UART0IrqHandler) {
}
#endif
+
+/**
+ * @brief UART1 IRQ handler.
+ */
#if USE_LPC214x_UART1 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(UART1IrqHandler) {
diff --git a/os/hal/platforms/LPC214x/serial_lld.h b/os/hal/platforms/LPC214x/serial_lld.h
index 034a707fb..67e7e27d0 100644
--- a/os/hal/platforms/LPC214x/serial_lld.h
+++ b/os/hal/platforms/LPC214x/serial_lld.h
@@ -59,13 +59,10 @@
* @brief FIFO preload parameter.
* @details Configuration parameter, this values defines how many bytes are
* preloaded in the HW transmit FIFO for each interrupt, the maximum value is
- * 16 the minimum is 2, the value 0 disables the feature.
+ * 16 the minimum is 1.
* @note An high value reduces the number of interrupts generated but can
* also increase the worst case interrupt response time because the
* preload loops.
- * @note The value zero disables the feature and reverts to a simpler code
- * that will generate an interrupt for each output byte but is much
- * smaller and simpler.
*/
#if !defined(UART_FIFO_PRELOAD) || defined(__DOXYGEN__)
#define LPC214x_UART_FIFO_PRELOAD 16
@@ -89,6 +86,10 @@
/* Derived constants and error checks. */
/*===========================================================================*/
+#if (LPC214x_UART_FIFO_PRELOAD < 1) || (LPC214x_UART_FIFO_PRELOAD > 16)
+#error "invalid LPC214x_UART_FIFO_PRELOAD setting"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/