]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/atmel/at91rm9200ek/led.c
9464952211baf5128b5dd21e3863cea3b86a0d7b
3 * Atmel Nordic AB <www.atmel.com>
4 * Ulf Samuelsson <ulf@atmel.com>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/arch/AT91RM9200.h>
29 #define GREEN_LED AT91C_PIO_PB0
30 #define YELLOW_LED AT91C_PIO_PB1
31 #define RED_LED AT91C_PIO_PB2
33 void green_LED_on(void)
35 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
37 writel(GREEN_LED
, PIOB
->PIO_CODR
);
40 void yellow_LED_on(void)
42 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
44 writel(YELLOW_LED
, PIOB
->PIO_CODR
);
49 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
51 writel(RED_LED
, PIOB
->PIO_CODR
);
54 void green_LED_off(void)
56 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
58 writel(GREEN_LED
, PIOB
->PIO_SODR
);
61 void yellow_LED_off(void)
63 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
65 writel(YELLOW_LED
, PIOB
->PIO_SODR
);
68 void red_LED_off(void)
70 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
72 writel(RED_LED
, PIOB
->PIO_SODR
);
76 void coloured_LED_init (void)
78 AT91PS_PIO PIOB
= AT91C_BASE_PIOB
;
79 AT91PS_PMC PMC
= AT91C_BASE_PMC
;
81 /* Enable PIOB clock */
82 writel((1 << AT91C_ID_PIOB
), PMC
->PMC_PCER
);
83 /* Disable peripherals on LEDs */
84 writel(AT91C_PIO_PB2
| AT91C_PIO_PB1
| AT91C_PIO_PB0
, PIOB
->PIO_PER
);
85 /* Enable pins as outputs */
86 writel(AT91C_PIO_PB2
| AT91C_PIO_PB1
| AT91C_PIO_PB0
, PIOB
->PIO_OER
);
87 /* Turn all LEDs OFF */
88 writel(AT91C_PIO_PB2
| AT91C_PIO_PB1
| AT91C_PIO_PB0
, PIOB
->PIO_SODR
);