Set correct debug pins for AT91SAM7X.
[bertos.git] / cpu / arm / drv / ser_at91.c
index 14027e896604990fc3f07fc7277726c808d8fcd8..37a4f1b695470b281c1e61188d32159bd5928a3c 100644 (file)
         *
         * - Disable GPIO on USART0 tx/rx pins
         * - Reset USART0
-        * - Set serial param: mode Normal, 8bit data, 1bit stop
+        * - Set serial param: mode Normal, 8bit data, 1bit stop, parity none
         * - Enable both the receiver and the transmitter
         * - Enable only the RX complete interrupt
         */
-       #if !CPU_ARM_AT91SAM7S256
+       #if !CPU_ARM_AT91SAM7S256 && !CPU_ARM_AT91SAM7X256
                #warning Check USART0 pins!
        #endif
        #define SER_UART0_BUS_TXINIT do { \
                PIOA_PDR = BV(RXD0) | BV(TXD0); \
                US0_CR = BV(US_RSTRX) | BV(US_RSTTX); \
-               US0_MR = US_CHMODE_NORMAL | US_CHRL_8 | US_NBSTOP_1; \
+               US0_MR = US_CHMODE_NORMAL | US_CHRL_8 | US_NBSTOP_1 | US_PAR_NO; \
                US0_CR = BV(US_RXEN) | BV(US_TXEN); \
                US0_IER = BV(US_RXRDY); \
        } while (0)
 
 #ifndef SER_UART1_BUS_TXINIT
        /** \sa SER_UART1_BUS_TXINIT */
-       #if !CPU_ARM_AT91SAM7S256
+       #if !CPU_ARM_AT91SAM7S256 && !CPU_ARM_AT91SAM7X256
                #warning Check USART1 pins!
        #endif
        #define SER_UART1_BUS_TXINIT do { \
                PIOA_PDR = BV(RXD1) | BV(TXD1); \
                US1_CR = BV(US_RSTRX) | BV(US_RSTTX); \
-               US1_MR = US_CHMODE_NORMAL | US_CHRL_8 | US_NBSTOP_1; \
+               US1_MR = US_CHMODE_NORMAL | US_CHRL_8 | US_NBSTOP_1 | US_PAR_NO; \
                US1_CR = BV(US_RXEN) | BV(US_TXEN); \
                US1_IER = BV(US_RXRDY); \
        } while (0)
@@ -703,18 +703,17 @@ static void uart0_irq_rx(void)
 /**
  * Serial IRQ dispatcher for USART0.
  */
-static void uart0_irq_dispatcher(void) __attribute__ ((naked));
+static void uart0_irq_dispatcher(void) __attribute__ ((interrupt));
 static void uart0_irq_dispatcher(void)
 {
-       IRQ_ENTRY();
-
        if (US0_CSR & BV(US_RXRDY))
                uart0_irq_rx();
 
        if (US0_CSR & BV(US_TXRDY))
                uart0_irq_tx();
 
-       IRQ_EXIT();
+       /* Inform hw that we have served the IRQ */
+       AIC_EOICR = 0;
 }
 
 /**
@@ -764,16 +763,15 @@ static void uart1_irq_rx(void)
 /**
  * Serial IRQ dispatcher for USART1.
  */
-static void uart1_irq_dispatcher(void) __attribute__ ((naked));
+static void uart1_irq_dispatcher(void) __attribute__ ((interrupt));
 static void uart1_irq_dispatcher(void)
 {
-       IRQ_ENTRY();
-
        if (US1_CSR & BV(US_RXRDY))
                uart1_irq_rx();
 
        if (US1_CSR & BV(US_TXRDY))
                uart1_irq_tx();
 
-       IRQ_EXIT();
+       /* Inform hw that we have served the IRQ */
+       AIC_EOICR = 0;
 }