summaryrefslogtreecommitdiff
path: root/board/atmel/at91cap9adk/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/atmel/at91cap9adk/led.c')
-rw-r--r--board/atmel/at91cap9adk/led.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/board/atmel/at91cap9adk/led.c b/board/atmel/at91cap9adk/led.c
index 8588a91..04de139 100644
--- a/board/atmel/at91cap9adk/led.c
+++ b/board/atmel/at91cap9adk/led.c
@@ -23,58 +23,55 @@
*/
#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);
}