]> git.sur5r.net Git - u-boot/blobdiff - board/atmel/at91cap9adk/led.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[u-boot] / board / atmel / at91cap9adk / led.c
index 8588a91a13e0d51da7b163c3b7acd6f37888fd3d..a137c2a9525e72e5310d210a4501be7b0aa0a82d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2007-2008
- * Stelian Pop <stelian.pop <at> leadtechdesign.com>
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
  * Lead Tech Design <www.leadtechdesign.com>
  *
  * See file CREDITS for list of people who contributed to this
  */
 
 #include <common.h>
-#include <asm/arch/AT91CAP9.h>
+#include <asm/arch/at91cap9.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
 
-#define        RED_LED         AT91C_PIO_PC29  /* this is the power led */
-#define        GREEN_LED       AT91C_PIO_PA10  /* this is the user1 led */
-#define        YELLOW_LED      AT91C_PIO_PA11  /* this is the user1 led */
+#define        RED_LED         AT91_PIN_PC29   /* this is the power led */
+#define        GREEN_LED       AT91_PIN_PA10   /* this is the user1 led */
+#define        YELLOW_LED      AT91_PIN_PA11   /* this is the user1 led */
 
 void red_LED_on(void)
 {
-       AT91C_BASE_PIOC->PIO_SODR = RED_LED;
+       at91_set_gpio_value(RED_LED, 1);
 }
 
 void red_LED_off(void)
 {
-       AT91C_BASE_PIOC->PIO_CODR = RED_LED;
+       at91_set_gpio_value(RED_LED, 0);
 }
 
 void green_LED_on(void)
 {
-       AT91C_BASE_PIOA->PIO_CODR = GREEN_LED;
+       at91_set_gpio_value(GREEN_LED, 0);
 }
 
 void green_LED_off(void)
 {
-       AT91C_BASE_PIOA->PIO_SODR = GREEN_LED;
+       at91_set_gpio_value(GREEN_LED, 1);
 }
 
 void yellow_LED_on(void)
 {
-       AT91C_BASE_PIOA->PIO_CODR = YELLOW_LED;
+       at91_set_gpio_value(YELLOW_LED, 0);
 }
 
 void yellow_LED_off(void)
 {
-       AT91C_BASE_PIOA->PIO_SODR = YELLOW_LED;
+       at91_set_gpio_value(YELLOW_LED, 1);
 }
 
 void coloured_LED_init(void)
 {
        /* Enable clock */
-       AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOABCD;
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_PIOABCD);
 
-       /* Disable peripherals on LEDs */
-       AT91C_BASE_PIOA->PIO_PER = GREEN_LED | YELLOW_LED;
-       /* Enable pins as outputs */
-       AT91C_BASE_PIOA->PIO_OER = GREEN_LED | YELLOW_LED;
-       /* Turn all LEDs OFF */
-       AT91C_BASE_PIOA->PIO_SODR = GREEN_LED | YELLOW_LED;
+       at91_set_gpio_output(RED_LED, 1);
+       at91_set_gpio_output(GREEN_LED, 1);
+       at91_set_gpio_output(YELLOW_LED, 1);
 
-       /* Disable peripherals on LEDs */
-       AT91C_BASE_PIOC->PIO_PER = RED_LED;
-       /* Enable pins as outputs */
-       AT91C_BASE_PIOC->PIO_OER = RED_LED;
-       /* Turn all LEDs OFF */
-       AT91C_BASE_PIOC->PIO_CODR = RED_LED;
+       at91_set_gpio_output(RED_LED, 0);
+       at91_set_gpio_output(GREEN_LED, 1);
+       at91_set_gpio_output(YELLOW_LED, 1);
 }