X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Farm%2Fdrv%2Fser_at91.c;h=dfc429d36098d7a1b550bb4ca42feff9b46d1221;hb=8391f9676abafaa16a986b77b346f33ceb75dd6d;hp=c3c897cd1ec7e4100c66c5781f7b8b8ab35fd035;hpb=2325bd9b0caad4f1ef2a277a7c568dae53c3f7f3;p=bertos.git diff --git a/bertos/cpu/arm/drv/ser_at91.c b/bertos/cpu/arm/drv/ser_at91.c index c3c897cd..dfc429d3 100644 --- a/bertos/cpu/arm/drv/ser_at91.c +++ b/bertos/cpu/arm/drv/ser_at91.c @@ -34,12 +34,12 @@ * \brief ARM UART and SPI I/O driver * * - * \version $Id: ser_at91.c 20881 2008-03-04 14:07:02Z batt $ + * \version $Id$ * \author Daniele Basile */ #include "hw/hw_ser.h" /* Required for bus macros overrides */ -#include "hw/hw_cpu.h" /* CLOCK_FREQ */ +#include /* CPU_FREQ */ #include "cfg/cfg_ser.h" #include @@ -84,7 +84,7 @@ * * - Disable GPIO on USART0 tx/rx pins */ - #if !CPU_ARM_AT91SAM7S256 && !CPU_ARM_AT91SAM7X256 && !CPU_ARM_AT91SAM7X128 + #if !CPU_ARM_SAM7S_LARGE && !CPU_ARM_SAM7X #warning Check USART0 pins! #endif #define SER_UART0_BUS_TXINIT do { \ @@ -124,7 +124,7 @@ * * - Disable GPIO on USART1 tx/rx pins */ - #if !CPU_ARM_AT91SAM7S256 && !CPU_ARM_AT91SAM7X256 && !CPU_ARM_AT91SAM7X128 + #if !CPU_ARM_SAM7S_LARGE && !CPU_ARM_SAM7X #warning Check USART1 pins! #endif #define SER_UART1_BUS_TXINIT do { \ @@ -181,7 +181,7 @@ #define SER_SPI0_BUS_TXCLOSE #endif -#if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 +#if CPU_ARM_SAM7X #ifndef SER_SPI1_BUS_TXINIT /** @@ -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 */ @@ -231,7 +216,7 @@ static unsigned char uart1_rxbuffer[CONFIG_UART1_RXBUFSIZE]; static unsigned char spi0_txbuffer[CONFIG_SPI0_TXBUFSIZE]; static unsigned char spi0_rxbuffer[CONFIG_SPI0_RXBUFSIZE]; -#if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 +#if CPU_ARM_SAM7X static unsigned char spi1_txbuffer[CONFIG_SPI1_TXBUFSIZE]; static unsigned char spi1_rxbuffer[CONFIG_SPI1_RXBUFSIZE]; #endif @@ -261,7 +246,7 @@ struct ArmSerial static void uart0_irq_dispatcher(void); static void uart1_irq_dispatcher(void); static void spi0_irq_handler(void); -#if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 +#if CPU_ARM_SAM7X static void spi1_irq_handler(void); #endif /* @@ -326,7 +311,7 @@ static void uart0_enabletxirq(struct SerialHardware *_hw) static void uart0_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned long rate) { /* Compute baud-rate period */ - US0_BRGR = CLOCK_FREQ / (16 * rate); + US0_BRGR = CPU_FREQ / (16 * rate); //DB(kprintf("uart0_setbaudrate(rate=%lu): period=%d\n", rate, period);) } @@ -421,7 +406,7 @@ static void uart1_enabletxirq(struct SerialHardware *_hw) static void uart1_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned long rate) { /* Compute baud-rate period */ - US1_BRGR = CLOCK_FREQ / (16 * rate); + US1_BRGR = CPU_FREQ / (16 * rate); //DB(kprintf("uart0_setbaudrate(rate=%lu): period=%d\n", rate, period);) } @@ -534,11 +519,11 @@ static void spi0_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned { SPI0_CSR0 &= ~SPI_SCBR; - ASSERT((uint8_t)DIV_ROUND(CLOCK_FREQ, rate)); - SPI0_CSR0 |= DIV_ROUND(CLOCK_FREQ, rate) << SPI_SCBR_SHIFT; + ASSERT((uint8_t)DIV_ROUND(CPU_FREQ, rate)); + SPI0_CSR0 |= DIV_ROUND(CPU_FREQ, rate) << SPI_SCBR_SHIFT; } -#if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 +#if CPU_ARM_SAM7X /* SPI driver */ static void spi1_init(UNUSED_ARG(struct SerialHardware *, _hw), UNUSED_ARG(struct Serial *, ser)) { @@ -618,8 +603,8 @@ static void spi1_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned { SPI1_CSR0 &= ~SPI_SCBR; - ASSERT((uint8_t)DIV_ROUND(CLOCK_FREQ, rate)); - SPI1_CSR0 |= DIV_ROUND(CLOCK_FREQ, rate) << SPI_SCBR_SHIFT; + ASSERT((uint8_t)DIV_ROUND(CPU_FREQ, rate)); + SPI1_CSR0 |= DIV_ROUND(CPU_FREQ, rate) << SPI_SCBR_SHIFT; } #endif @@ -677,7 +662,7 @@ static const struct SerialHardwareVT SPI0_VT = C99INIT(txStart, spi0_starttx), C99INIT(txSending, tx_sending), }; -#if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 +#if CPU_ARM_SAM7X static const struct SerialHardwareVT SPI1_VT = { C99INIT(init, spi1_init), @@ -722,7 +707,7 @@ static struct ArmSerial UARTDescs[SER_CNT] = }, C99INIT(sending, false), }, - #if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 + #if CPU_ARM_SAM7X { C99INIT(hw, /**/) { C99INIT(table, &SPI1_VT), @@ -903,7 +888,7 @@ static void spi0_irq_handler(void) } -#if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 +#if CPU_ARM_SAM7X /** * SPI1 interrupt handler */