diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-06 20:34:05 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-06 20:34:05 +0000 |
commit | 77df449498effbd6083e82920bb2705fdee16343 (patch) | |
tree | 989b117217773a3c6eceb6210db2c3dd63edc595 /ports | |
parent | 724de0c330e40a599896bf5bca119ab121c24382 (diff) | |
download | ChibiOS-77df449498effbd6083e82920bb2705fdee16343.tar.gz ChibiOS-77df449498effbd6083e82920bb2705fdee16343.tar.bz2 ChibiOS-77df449498effbd6083e82920bb2705fdee16343.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@728 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r-- | ports/ARM7-AT91SAM7X/port.dox | 2 | ||||
-rw-r--r-- | ports/ARM7-AT91SAM7X/sam7x_serial.c | 49 | ||||
-rw-r--r-- | ports/ARM7-AT91SAM7X/sam7x_serial.h | 18 | ||||
-rw-r--r-- | ports/ARM7-LPC214x/lpc214x_serial.c | 12 | ||||
-rw-r--r-- | ports/ARMCM3-STM32F103/stm32_serial.c | 18 | ||||
-rw-r--r-- | ports/MSP430/msp430_serial.c | 8 |
6 files changed, 43 insertions, 64 deletions
diff --git a/ports/ARM7-AT91SAM7X/port.dox b/ports/ARM7-AT91SAM7X/port.dox index b8b2c624f..a44820e10 100644 --- a/ports/ARM7-AT91SAM7X/port.dox +++ b/ports/ARM7-AT91SAM7X/port.dox @@ -13,7 +13,7 @@ /** @} */
/**
- * @defgroup AT91SAM7X_SERIAL UART Support
+ * @defgroup AT91SAM7X_SERIAL USART Support
* @{
* @brief USART peripherals support.
* @details The serial driver supports the AT91SAM7X USART peripherals.
diff --git a/ports/ARM7-AT91SAM7X/sam7x_serial.c b/ports/ARM7-AT91SAM7X/sam7x_serial.c index 7aa57f126..9c34e75ba 100644 --- a/ports/ARM7-AT91SAM7X/sam7x_serial.c +++ b/ports/ARM7-AT91SAM7X/sam7x_serial.c @@ -17,19 +17,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * @file ports/ARM7-AT91SAM7X/sam7x_serial.h
+ * @brief AT91SAM7X Serial driver macros and structures.
+ * @addtogroup AT91SAM7X_SERIAL
+ * @{
+ */
+
#include <ch.h>
#include "board.h"
#include "sam7x_serial.h"
#include "at91lib/aic.h"
+#if USE_SAM7X_USART0 || defined(__DOXYGEN__)
+/** @brief USART0 serial driver identifier.*/
FullDuplexDriver COM1;
+
static uint8_t ib1[SERIAL_BUFFERS_SIZE];
static uint8_t ob1[SERIAL_BUFFERS_SIZE];
+#endif
+#if USE_SAM7X_USART1 || defined(__DOXYGEN__)
+/** @brief USART1 serial driver identifier.*/
FullDuplexDriver COM2;
+
static uint8_t ib2[SERIAL_BUFFERS_SIZE];
static uint8_t ob2[SERIAL_BUFFERS_SIZE];
+#endif
static void SetError(AT91_REG csr, FullDuplexDriver *com) {
dflags_t sts = 0;
@@ -47,10 +62,14 @@ static void SetError(AT91_REG csr, FullDuplexDriver *com) { chSysUnlockFromIsr();
}
-/*
- * Serves the pending sources on the USART.
- */
+/** @cond never*/
__attribute__((noinline))
+/** @endcond*/
+/**
+ * @brief Common IRQ handler.
+ * @param[in] u pointer to an USART I/O block
+ * @param[in] com communication channel associated to the USART
+ */
static void ServeInterrupt(AT91PS_USART u, FullDuplexDriver *com) {
if (u->US_CSR & AT91C_US_RXRDY) {
@@ -74,6 +93,7 @@ static void ServeInterrupt(AT91PS_USART u, FullDuplexDriver *com) { AT91C_BASE_AIC->AIC_EOICR = 0;
}
+#if USE_SAM7X_USART0 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(USART0IrqHandler) {
CH_IRQ_PROLOGUE();
@@ -83,6 +103,13 @@ CH_IRQ_HANDLER(USART0IrqHandler) { CH_IRQ_EPILOGUE();
}
+static void OutNotify1(void) {
+
+ AT91C_BASE_US0->US_IER = AT91C_US_TXRDY;
+}
+#endif
+
+#if USE_SAM7X_USART1 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(USART1IrqHandler) {
CH_IRQ_PROLOGUE();
@@ -92,23 +119,11 @@ CH_IRQ_HANDLER(USART1IrqHandler) { CH_IRQ_EPILOGUE();
}
-/*
- * Invoked by the high driver when one or more bytes are inserted in the
- * output queue.
- */
-static void OutNotify1(void) {
-
- AT91C_BASE_US0->US_IER = AT91C_US_TXRDY;
-}
-
-/*
- * Invoked by the high driver when one or more bytes are inserted in the
- * output queue.
- */
static void OutNotify2(void) {
AT91C_BASE_US1->US_IER = AT91C_US_TXRDY;
}
+#endif
/*
* USART setup, must be invoked with interrupts disabled.
@@ -180,3 +195,5 @@ void InitSerial(int prio0, int prio1) { AT91C_US_PAR_NONE |
AT91C_US_NBSTOP_1_BIT);
}
+
+/** @} */
diff --git a/ports/ARM7-AT91SAM7X/sam7x_serial.h b/ports/ARM7-AT91SAM7X/sam7x_serial.h index 236f29e5a..93ff762e8 100644 --- a/ports/ARM7-AT91SAM7X/sam7x_serial.h +++ b/ports/ARM7-AT91SAM7X/sam7x_serial.h @@ -44,26 +44,26 @@ * @note It is possible to use @p SetUART() in order to change the working
* parameters at runtime.
*/
-#if !defined(AT91SAM7X_UART_BITRATE) || defined(__DOXYGEN__)
+#if !defined(SAM7X_UART_BITRATE) || defined(__DOXYGEN__)
#define SAM7X_UART_BITRATE 38400
#endif
/**
* @brief UART0 driver enable switch.
- * @details If set to 1 the support for USART1 is included.
- * @note The default is 1.
+ * @details If set to @p TRUE the support for USART1 is included.
+ * @note The default is @p TRUE.
*/
-#if !defined(USE_LPC214x_UART0) || defined(__DOXYGEN__)
-#define USE_SAM7X_USART0 1
+#if !defined(USE_SAM7X_USART0) || defined(__DOXYGEN__)
+#define USE_SAM7X_USART0 TRUE
#endif
/**
* @brief UART1 driver enable switch.
- * @details If set to 1 the support for USART2 is included.
- * @note The default is 1.
+ * @details If set to @p TRUE the support for USART2 is included.
+ * @note The default is @p TRUE.
*/
-#if !defined(USE_LPC214x_UART1) || defined(__DOXYGEN__)
-#define USE_SAM7X_USART1 1
+#if !defined(USE_SAM7X_USART1) || defined(__DOXYGEN__)
+#define USE_SAM7X_USART1 TRUE
#endif
#ifdef __cplusplus
diff --git a/ports/ARM7-LPC214x/lpc214x_serial.c b/ports/ARM7-LPC214x/lpc214x_serial.c index e36512049..1f38f3940 100644 --- a/ports/ARM7-LPC214x/lpc214x_serial.c +++ b/ports/ARM7-LPC214x/lpc214x_serial.c @@ -157,9 +157,6 @@ static void preload(UART *u, FullDuplexDriver *com) { #endif
#if USE_LPC214x_UART0 || defined(__DOXYGEN__)
-/**
- * @brief UART0 IRQ service routine.
- */
CH_IRQ_HANDLER(UART0IrqHandler) {
CH_IRQ_PROLOGUE();
@@ -170,9 +167,6 @@ CH_IRQ_HANDLER(UART0IrqHandler) { CH_IRQ_EPILOGUE();
}
-/**
- * @brief Output queue insertion notification from the high driver.
- */
static void OutNotify1(void) {
#if LPC214x_UART_FIFO_PRELOAD > 0
@@ -191,9 +185,6 @@ static void OutNotify1(void) { #endif
#if USE_LPC214x_UART1 || defined(__DOXYGEN__)
-/**
- * @brief UART1 IRQ service routine.
- */
CH_IRQ_HANDLER(UART1IrqHandler) {
CH_IRQ_PROLOGUE();
@@ -204,9 +195,6 @@ CH_IRQ_HANDLER(UART1IrqHandler) { CH_IRQ_EPILOGUE();
}
-/**
- * @brief Output queue insertion notification from the high driver.
- */
static void OutNotify2(void) {
#if LPC214x_UART_FIFO_PRELOAD > 0
diff --git a/ports/ARMCM3-STM32F103/stm32_serial.c b/ports/ARMCM3-STM32F103/stm32_serial.c index 9d0534b04..3fbf8abfc 100644 --- a/ports/ARMCM3-STM32F103/stm32_serial.c +++ b/ports/ARMCM3-STM32F103/stm32_serial.c @@ -103,9 +103,6 @@ static void ServeInterrupt(USART_TypeDef *u, FullDuplexDriver *com) { } #if USE_STM32_USART1 || defined(__DOXYGEN__) -/** - * @brief USART1 IRQ service routine. - */ CH_IRQ_HANDLER(VectorD4) { CH_IRQ_PROLOGUE(); @@ -115,9 +112,6 @@ CH_IRQ_HANDLER(VectorD4) { CH_IRQ_EPILOGUE(); } -/** - * @brief Output queue insertion notification from the high driver. - */ static void OutNotify1(void) { USART1->CR1 |= CR1_TXEIE; @@ -125,9 +119,6 @@ static void OutNotify1(void) { #endif #if USE_STM32_USART2 || defined(__DOXYGEN__) -/** - * @brief USART2 IRQ service routine. - */ CH_IRQ_HANDLER(VectorD8) { CH_IRQ_PROLOGUE(); @@ -137,9 +128,6 @@ CH_IRQ_HANDLER(VectorD8) { CH_IRQ_EPILOGUE(); } -/** - * @brief Output queue insertion notification from the high driver. - */ static void OutNotify2(void) { USART2->CR1 |= CR1_TXEIE; @@ -147,9 +135,6 @@ static void OutNotify2(void) { #endif #if USE_STM32_USART3 || defined(__DOXYGEN__) -/** - * @brief USART3 IRQ service routine. - */ CH_IRQ_HANDLER(VectorDC) { CH_IRQ_PROLOGUE(); @@ -159,9 +144,6 @@ CH_IRQ_HANDLER(VectorDC) { CH_IRQ_EPILOGUE(); } -/** - * @brief Output queue insertion notification from the high driver. - */ static void OutNotify3(void) { USART3->CR1 |= CR1_TXEIE; diff --git a/ports/MSP430/msp430_serial.c b/ports/MSP430/msp430_serial.c index 81e09a195..c126b2239 100644 --- a/ports/MSP430/msp430_serial.c +++ b/ports/MSP430/msp430_serial.c @@ -84,10 +84,6 @@ CH_IRQ_HANDLER(USART0RX_VECTOR) { CH_IRQ_EPILOGUE();
}
-/*
- * Invoked by the high driver when one or more bytes are inserted in the
- * output queue.
- */
static void OutNotify1(void) {
if (!(U0IE & UTXIE0)) {
@@ -163,10 +159,6 @@ CH_IRQ_HANDLER(USART1RX_VECTOR) { CH_IRQ_EPILOGUE();
}
-/*
- * Invoked by the high driver when one or more bytes are inserted in the
- * output queue.
- */
static void OutNotify2(void) {
if (!(U1IE & UTXIE1)) {
|