Remove duplicate define. Put all phy chip specific defines in its
[bertos.git] / bertos / cpu / cortex-m3 / drv / ser_sam3.c
index e7835bc314fb38b0c8251558c8702eb3f4664f79..c330ca80acc382b9c335c82c782e4658166dbe27 100644 (file)
@@ -91,6 +91,7 @@
        #endif
        #define SER_UART0_BUS_TXINIT do { \
                PIOA_PDR = BV(RXD0) | BV(TXD0); \
+               PIO_PERIPH_SEL(PIOA_BASE, BV(RXD0) | BV(TXD0), USART0_PERIPH); \
        } while (0)
 #endif
 
                #endif
                #define SER_UART1_BUS_TXINIT do { \
                        PIOA_PDR = BV(RXD1) | BV(TXD1); \
+                       PIO_PERIPH_SEL(PIOA_BASE, BV(RXD1) | BV(TXD1), USART1_PERIPH); \
                } while (0)
        #endif
 
                #define SER_SPI0_BUS_TXINIT do { \
                        /* Disable PIO on SPI pins */ \
                        PIOA_PDR = BV(SPI0_SPCK) | BV(SPI0_MOSI) | BV(SPI0_MISO); \
-                       /* PIO is peripheral A */ \
-                       PIOA_ABCDSR1 &= ~(BV(SPI0_SPCK) | BV(SPI0_MOSI) | BV(SPI0_MISO)); \
-                       PIOA_ABCDSR2 &= ~(BV(SPI0_SPCK) | BV(SPI0_MOSI) | BV(SPI0_MISO)); \
+                       /* SPI is peripheral A on SAM3X,A,N,S,U */ \
+                       PIO_PERIPH_SEL(PIOA_BASE, BV(SPI0_SPCK) | BV(SPI0_MOSI) | BV(SPI0_MISO), PIO_PERIPH_A); \
                } while (0)
        #else
                #define SER_SPI0_BUS_TXINIT do { \
@@ -337,7 +338,7 @@ static void uart0_init(
        UNUSED_ARG(struct Serial *, ser))
 {
        US0_IDR = 0xFFFFFFFF;
-       PMC_PCER = BV(US0_ID);
+       pmc_periphEnable(US0_ID);
 
        /*
         * - Reset USART0
@@ -430,7 +431,7 @@ static void uart1_init(
        UNUSED_ARG(struct Serial *, ser))
 {
        US1_IDR = 0xFFFFFFFF;
-       PMC_PCER = BV(US1_ID);
+       pmc_periphEnable(US1_ID);
 
        /*
         * - Reset USART1
@@ -546,7 +547,7 @@ static void spi0_init(UNUSED_ARG(struct SerialHardware *, _hw), UNUSED_ARG(struc
 
        //sysirq_setPriority(INT_SPI0, SERIRQ_PRIORITY);
        sysirq_setHandler(INT_SPI0, spi0_irq_handler);
-       PMC_PCER = BV(SPI0_ID);
+       pmc_periphEnable(SPI0_ID);
 
        /* Enable SPI */
        SPI0_CR = BV(SPI_SPIEN);
@@ -624,7 +625,7 @@ static void spi1_init(UNUSED_ARG(struct SerialHardware *, _hw), UNUSED_ARG(struc
 
        sysirq_setPriority(INT_SPI1, SERIRQ_PRIORITY);
        sysirq_setHandler(INT_SPI1, spi1_irq_dispatcher);
-       PMC_PCER = BV(SPI1_ID);
+       pmc_periphEnable(SPI1_ID);
 
        /* Enable SPI */
        SPI1_CR = BV(SPI_SPIEN);