1
2
3
4
5
6
7
8
9
10
11
12#include <common.h>
13#include <asm/io.h>
14#include <asm/arch/hardware.h>
15#include <asm/arch/at91_pmc.h>
16#include <asm/arch/at91_pio.h>
17#include <status_led.h>
18
19
20#define GREEN_LED (1<<0)
21#define YELLOW_LED (1<<1)
22#define RED_LED (1<<2)
23
24void green_led_on(void)
25{
26 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
27 writel(GREEN_LED, &pio->piob.codr);
28}
29
30void yellow_led_on(void)
31{
32 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
33 writel(YELLOW_LED, &pio->piob.codr);
34}
35
36void red_led_on(void)
37{
38 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
39 writel(RED_LED, &pio->piob.codr);
40}
41
42void green_led_off(void)
43{
44 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
45 writel(GREEN_LED, &pio->piob.sodr);
46}
47
48void yellow_led_off(void)
49{
50 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
51 writel(YELLOW_LED, &pio->piob.sodr);
52}
53
54void red_led_off(void)
55{
56 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
57 writel(RED_LED, &pio->piob.sodr);
58}
59
60void coloured_LED_init (void)
61{
62 at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
63 at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
64
65
66 writel(1 << ATMEL_ID_PIOB, &pmc->pcer);
67
68
69 writel(GREEN_LED | YELLOW_LED | RED_LED, &pio->piob.per);
70
71 writel(GREEN_LED | YELLOW_LED | RED_LED, &pio->piob.oer);
72
73 writel(GREEN_LED | YELLOW_LED | RED_LED, &pio->piob.sodr);
74}
75