X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fcpu%2Farm%2Fdrv%2Fser_at91.c;h=ffa5a4402c634f532a8e549bfb1009e227462d26;hb=9c54009acbfe8c4b27d5cfd00fd69410caa312c7;hp=bc5551602f0f7a2941e7ca2545e9350d870af429;hpb=32eebaf8bf80d1ffd417bfe6d2c34e6cd3684f87;p=bertos.git diff --git a/bertos/cpu/arm/drv/ser_at91.c b/bertos/cpu/arm/drv/ser_at91.c index bc555160..ffa5a440 100644 --- a/bertos/cpu/arm/drv/ser_at91.c +++ b/bertos/cpu/arm/drv/ser_at91.c @@ -202,21 +202,6 @@ /*\}*/ -/** - * \def CONFIG_SER_STROBE - * - * This is a debug facility that can be used to - * monitor SER interrupt activity on an external pin. - * - * To use strobes, redefine the macros SER_STROBE_ON, - * SER_STROBE_OFF and SER_STROBE_INIT and set - * CONFIG_SER_STROBE to 1. - */ -#if !defined(CONFIG_SER_STROBE) || !CONFIG_SER_STROBE - #define SER_STROBE_ON do {/*nop*/} while(0) - #define SER_STROBE_OFF do {/*nop*/} while(0) - #define SER_STROBE_INIT do {/*nop*/} while(0) -#endif /* From the high-level serial driver */ @@ -258,11 +243,11 @@ struct ArmSerial volatile bool sending; }; -static void uart0_irq_dispatcher(void); -static void uart1_irq_dispatcher(void); -static void spi0_irq_handler(void); +static ISR_PROTO(uart0_irq_dispatcher); +static ISR_PROTO(uart1_irq_dispatcher); +static ISR_PROTO(spi0_irq_handler); #if CPU_ARM_SAM7X -static void spi1_irq_handler(void); +static ISR_PROTO(spi1_irq_handler); #endif /* * Callbacks for USART0 @@ -545,10 +530,13 @@ static void spi1_init(UNUSED_ARG(struct SerialHardware *, _hw), UNUSED_ARG(struc /* Disable PIO on SPI pins */ PIOA_PDR = BV(SPI1_SPCK) | BV(SPI1_MOSI) | BV(SPI1_MISO); + /* SPI1 pins are on B peripheral function! */ + PIOA_BSR = BV(SPI1_SPCK) | BV(SPI1_MOSI) | BV(SPI1_MISO); + /* Reset device */ SPI1_CR = BV(SPI_SWRST); -/* + /* * Set SPI to master mode, fixed peripheral select, chip select directly connected to a peripheral device, * SPI clock set to MCK, mode fault detection disabled, loopback disable, NPCS0 active, Delay between CS = 0 */ @@ -746,7 +734,7 @@ struct SerialHardware *ser_hw_getdesc(int unit) /** * Serial 0 TX interrupt handler */ -static void uart0_irq_tx(void) +INLINE void uart0_irq_tx(void) { SER_STROBE_ON; @@ -755,7 +743,7 @@ static void uart0_irq_tx(void) if (fifo_isempty(txfifo)) { /* - * - Disable the TX empty interrupts + * - Disable the TX empty interrupts */ US0_IDR = BV(US_TXEMPTY); SER_UART0_BUS_TXEND; @@ -773,7 +761,7 @@ static void uart0_irq_tx(void) /** * Serial 0 RX complete interrupt handler. */ -static void uart0_irq_rx(void) +INLINE void uart0_irq_rx(void) { SER_STROBE_ON; @@ -795,8 +783,7 @@ static void uart0_irq_rx(void) /** * Serial IRQ dispatcher for USART0. */ -static void uart0_irq_dispatcher(void) __attribute__ ((interrupt)); -static void uart0_irq_dispatcher(void) +static DECLARE_ISR(uart0_irq_dispatcher) { if (US0_CSR & BV(US_RXRDY)) uart0_irq_rx(); @@ -811,7 +798,7 @@ static void uart0_irq_dispatcher(void) /** * Serial 1 TX interrupt handler */ -static void uart1_irq_tx(void) +INLINE void uart1_irq_tx(void) { SER_STROBE_ON; @@ -820,7 +807,7 @@ static void uart1_irq_tx(void) if (fifo_isempty(txfifo)) { /* - * - Disable the TX empty interrupts + * - Disable the TX empty interrupts */ US1_IDR = BV(US_TXEMPTY); SER_UART1_BUS_TXEND; @@ -838,7 +825,7 @@ static void uart1_irq_tx(void) /** * Serial 1 RX complete interrupt handler. */ -static void uart1_irq_rx(void) +INLINE void uart1_irq_rx(void) { SER_STROBE_ON; @@ -860,8 +847,7 @@ static void uart1_irq_rx(void) /** * Serial IRQ dispatcher for USART1. */ -static void uart1_irq_dispatcher(void) __attribute__ ((interrupt)); -static void uart1_irq_dispatcher(void) +static DECLARE_ISR(uart1_irq_dispatcher) { if (US1_CSR & BV(US_RXRDY)) uart1_irq_rx(); @@ -876,8 +862,7 @@ static void uart1_irq_dispatcher(void) /** * SPI0 interrupt handler */ -static void spi0_irq_handler(void) __attribute__ ((interrupt)); -static void spi0_irq_handler(void) +static DECLARE_ISR(spi0_irq_handler) { SER_STROBE_ON; @@ -907,8 +892,7 @@ static void spi0_irq_handler(void) /** * SPI1 interrupt handler */ -static void spi1_irq_handler(void) __attribute__ ((interrupt)); -static void spi1_irq_handler(void) +static DECLARE_ISR(spi1_irq_handler) { SER_STROBE_ON;