This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AT91 SPI driver fix


Hi 

This patch allows the AT91 SPI driver to compile on all platforms.
The old version had #ifdefs inside macros which the compiler did not
like. This compiles, but has not been tested, so please report any
problems.

      Andrew
Index: packages/devs/spi/arm/at91/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/spi/arm/at91/current/ChangeLog,v
retrieving revision 1.5
diff -u -r1.5 ChangeLog
--- packages/devs/spi/arm/at91/current/ChangeLog	7 Sep 2006 12:14:14 -0000	1.5
+++ packages/devs/spi/arm/at91/current/ChangeLog	21 Feb 2007 17:16:32 -0000
@@ -1,3 +1,8 @@
+2006-09-27  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/spi_at91.c (spi_at91_transaction_begin): Don't use #ifdef
+	inside a macro invocation. The compiler throws a wobbly.
+
 2006-09-07  John Eigelaar <jeigelaar@mweb.co.za>
 
 	* src/spi_at91.c: Fixed the chip select functions.
Index: packages/devs/spi/arm/at91/current/src/spi_at91.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/spi/arm/at91/current/src/spi_at91.c,v
retrieving revision 1.5
diff -u -r1.5 spi_at91.c
--- packages/devs/spi/arm/at91/current/src/spi_at91.c	7 Sep 2006 12:14:14 -0000	1.5
+++ packages/devs/spi/arm/at91/current/src/spi_at91.c	21 Feb 2007 17:16:33 -0000
@@ -342,7 +342,7 @@
    {
       if(spi_bus->cs_en[ctr])
       {
-         HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[ctr], (val & (1<<ctr)));
+        HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[ctr], (val & (1<<ctr)));
       }
    }
 }
@@ -545,19 +545,19 @@
        cause havoc with the driver */ 
 
     // Put SPI bus into master mode
-    if (1 == at91_spi_dev->cl_div32)
-        HAL_WRITE_UINT32(spi_bus->base+AT91_SPI_MR, AT91_SPI_MR_MSTR | 
-                                               AT91_SPI_MR_DIV32
+    if (1 == at91_spi_dev->cl_div32) {
+      val = AT91_SPI_MR_MSTR | AT91_SPI_MR_DIV32;
 #ifdef AT91_SPI_MR_MODFDIS
-                                               | AT91_SPI_MR_MODFDIS
+      val |= AT91_SPI_MR_MODFDIS;
 #endif
-                                               );
-    else
-        HAL_WRITE_UINT32(spi_bus->base+AT91_SPI_MR, AT91_SPI_MR_MSTR 
+      HAL_WRITE_UINT32(spi_bus->base+AT91_SPI_MR, val);
+    } else {
+      val = AT91_SPI_MR_MSTR;
 #ifdef AT91_SPI_MR_MODFDIS
-                                                    | AT91_SPI_MR_MODFDIS
+      val |= AT91_SPI_MR_MODFDIS;
 #endif
-                                                    );
+      HAL_WRITE_UINT32(spi_bus->base+AT91_SPI_MR, val);
+    }
 }
 
 static void 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]