*/
#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);
}