summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-28 21:29:51 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-28 21:29:51 +0100
commitf05f4323f4ee4b85877ed86b01fdb93022dd9645 (patch)
treedfbb45ca66afa93a67709deff2d2b17675b49300 /arch/arm
parentabc1e9ef644658f44700761a263f5bb5aad22bbd (diff)
Having the mbed showing debug status while booting by using the LEDs.
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/lpc17xx/mbed/BoardInit.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/lpc17xx/mbed/BoardInit.c b/arch/arm/lpc17xx/mbed/BoardInit.c
index 968e723..67e0732 100644
--- a/arch/arm/lpc17xx/mbed/BoardInit.c
+++ b/arch/arm/lpc17xx/mbed/BoardInit.c
@@ -1,13 +1,47 @@
+#include "lpc17xx_gpio.h"
#include "lpc17xx_nvic.h"
#include "lpc17xx_clkpwr.h"
+#define LED1_wire 18
+#define LED2_wire 20
+#define LED3_wire 21
+#define LED4_wire 23
+
+static void setupLEDs() {
+ GPIO_SetDir(1, (1 << LED1_wire) | (1 << LED2_wire) | (1 << LED3_wire) | (1 << LED4_wire), 1);
+}
+
+static void litLED(int led, int value) {
+ if ((led > 4) || (led < 0))
+ return;
+
+ switch (led) {
+ case 1: led = 1 << LED1_wire; break;
+ case 2: led = 1 << LED2_wire; break;
+ case 3: led = 1 << LED3_wire; break;
+ case 4: led = 1 << LED4_wire; break;
+ }
+
+ if (value) {
+ GPIO_SetValue(1, led);
+ } else {
+ GPIO_ClearValue(1, led);
+ }
+}
+
+
+
extern uintptr_t __cs3_interrupt_vector_mutable[];
void BoardEarlyInit() {
+ setupLEDs();
+ litLED(1, 1);
NVIC_SetVTOR((uintptr_t) __cs3_interrupt_vector_mutable);
+ litLED(2, 1);
}
void BoardLateInit() {
+ litLED(3, 1);
}
void BoardShutdown() {