This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
EB40a evaluation LEDs
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: <ecos-patches at sources dot redhat dot com>
- Date: Wed, 11 Jun 2003 13:47:38 +0200
- Subject: EB40a evaluation LEDs
I've been toying with LEDs and made the following fixes
to LEDs. Checking th EB40a manual, the circuit diagram is correct
and the documentation is incorrect on LEDs.
Added pushbutton defines while I was at it.
Also, this is my second attempt at submitting a well-formed
patch :-)
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/ChangeLog,v
retrieving revision 1.1
diff -u -w -r1.1 ChangeLog
--- ChangeLog 13 May 2003 18:27:55 -0000 1.1
+++ ChangeLog 11 Jun 2003 10:27:51 -0000
@@ -1,3 +1,12 @@
+2003-06-11 Oyvind Harboe <oyvind.harboe@zylin.com>
+
+ * src/eb40a_misc.c:
+ LED routines was using the wrong bits.
+
+ * include/plf_io.h
+ LED defines was using the wrong bits
+ Added defines for EB40a board push buttons
+
2003-05-12 Nick Garnett <nickg@balti.calivar.com>
* src/eb40a_misc.c:
Index: eb40a_misc.c
===================================================================
RCS file:
/cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/src/eb40a_misc.c,v
retrieving revision 1.1
diff -u -r1.1 eb40a_misc.c
--- eb40a_misc.c 13 May 2003 18:27:56 -0000 1.1
+++ eb40a_misc.c 11 Jun 2003 11:45:16 -0000
@@ -62,23 +62,23 @@
void
hal_at91_set_leds(int val)
{
- HAL_WRITE_UINT32(AT91_PIO+AT91_PIO_SODR, 0x000F0078); // turn all
LEDs off
+ HAL_WRITE_UINT32(AT91_PIO+AT91_PIO_SODR, EB40A_LED_ALL); // turn
all LEDs off
HAL_WRITE_UINT32(AT91_PIO+AT91_PIO_CODR,
- ((val&0xf)<<3)|((val&0xf0)<<12)); // turn
desired LEDs on
+ ((val&0xf)<<16)|(((val&0xf0)>>4)<<3)); //
turn desired LEDs on
}
void
hal_at91_led_on(int val)
{
HAL_WRITE_UINT32(AT91_PIO+AT91_PIO_CODR,
- ((val&0xf)<<3)|((val&0xf0)<<12));
+ ((val&0xf)<<16)|(((val&0xf0)>>4)<<3));
+
}
-
void
hal_at91_led_off(int val)
{
HAL_WRITE_UINT32(AT91_PIO+AT91_PIO_SODR,
- ((val&0xf)<<3)|((val&0xf0)<<12));
+ ((val&0xf)<<16)|(((val&0xf0)>>4)<<3));
}
int
@@ -86,7 +86,7 @@
{
int leds = 0;
HAL_READ_UINT32(AT91_PIO+AT91_PIO_PDSR, leds);
- return ((leds>>3)&0xf)|((leds>>12)&0xf0);
+ return (((leds>>3)&0xf)<<4)|((leds>>16)&0xf);
}
//----------------------------------------------------------------------
----
Index: plf_io.h
===================================================================
RCS file:
/cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/include/plf_io.h,v
retrieving revision 1.1
diff -u -r1.1 plf_io.h
--- plf_io.h 13 May 2003 18:27:55 -0000 1.1
+++ plf_io.h 11 Jun 2003 11:45:35 -0000
@@ -54,14 +54,27 @@
//======================================================================
=======
// EB40A onboard LEDs mapped to PIO pins
-#define EB40A_LED1 0x00010000
-#define EB40A_LED2 0x00020000
-#define EB40A_LED3 0x00040000
-#define EB40A_LED4 0x00080000
-#define EB40A_LED5 0x00000008
-#define EB40A_LED6 0x00000010
-#define EB40A_LED7 0x00000020
-#define EB40A_LED8 0x00000040
+
+// these PIOs double as TCLK1, TIOA1, TIOB1, TCLK2 respectively.
+#define EB40A_LED5 0x00010000
+#define EB40A_LED6 0x00020000
+#define EB40A_LED7 0x00040000
+#define EB40A_LED8 0x00080000
+// these io pins are for the LEDs.
+#define EB40A_LED1 0x00000008
+#define EB40A_LED2 0x00000010
+#define EB40A_LED3 0x00000020
+#define EB40A_LED4 0x00000040
+
+#define EB40A_LED_ALL 0x00f00078
+
+
+// Push buttons. Note that these are connected to interrupt lines.
+#define EB40A_SW1 0x00001000
+#define EB40A_SW2 0x00000100
+#define EB40A_SW3 0x00000002
+#define EB40A_SW4 0x00000004
+
//----------------------------------------------------------------------
-------
// end of plf_io.h