summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-08 15:12:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-08 15:12:56 +0000
commitc8e4cbd63bba53290014a54d854286a14798580e (patch)
treed4ea40283619ebf269e6e854d52319b0b8b47c55 /nuttx/configs
parentb8dc1371efff31074dd636234544afc5d6996da6 (diff)
downloadpx4-nuttx-c8e4cbd63bba53290014a54d854286a14798580e.tar.gz
px4-nuttx-c8e4cbd63bba53290014a54d854286a14798580e.tar.bz2
px4-nuttx-c8e4cbd63bba53290014a54d854286a14798580e.zip
Initial vector handling logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1166 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/us7032evb1/include/board.h16
-rw-r--r--nuttx/configs/us7032evb1/ostest/ld.script1
-rw-r--r--nuttx/configs/us7032evb1/src/up_leds.c57
3 files changed, 57 insertions, 17 deletions
diff --git a/nuttx/configs/us7032evb1/include/board.h b/nuttx/configs/us7032evb1/include/board.h
index c481b14b6..e73022b62 100644
--- a/nuttx/configs/us7032evb1/include/board.h
+++ b/nuttx/configs/us7032evb1/include/board.h
@@ -55,18 +55,18 @@
/* LED definitions **********************************************************/
-/* The SH1_LPEVB has no user controllable LEDs. These are provided only
- * in the event that CONFIG_ARCH_LEDs is enabled.
+/* The SH1_LPEVB only a single LED controlled by either port A, pin 15, or
+ * port B, pin 15 (selectable via JP8).
*/
#define LED_STARTED 0
#define LED_HEAPALLOCATE 1
-#define LED_IRQSENABLED 2
-#define LED_STACKCREATED 3
-#define LED_INIRQ 4
-#define LED_SIGNAL 5
-#define LED_ASSERTION 6
-#define LED_PANIC 7
+#define LED_IRQSENABLED 1
+#define LED_STACKCREATED 1
+#define LED_INIRQ 0
+#define LED_SIGNAL 0
+#define LED_ASSERTION 0
+#define LED_PANIC 1
/* Button definitions *******************************************************/
diff --git a/nuttx/configs/us7032evb1/ostest/ld.script b/nuttx/configs/us7032evb1/ostest/ld.script
index 846fda4c6..60436cff1 100644
--- a/nuttx/configs/us7032evb1/ostest/ld.script
+++ b/nuttx/configs/us7032evb1/ostest/ld.script
@@ -54,6 +54,7 @@ SECTIONS
. = 0x0a002400;
.text : {
_stext = ABSOLUTE(.);
+ *(.reset) /* Reset/IRQ code */
*(.text) /* Code */
*(.fixup)
*(.gnu.warning)
diff --git a/nuttx/configs/us7032evb1/src/up_leds.c b/nuttx/configs/us7032evb1/src/up_leds.c
index 2e711471a..321299309 100644
--- a/nuttx/configs/us7032evb1/src/up_leds.c
+++ b/nuttx/configs/us7032evb1/src/up_leds.c
@@ -48,6 +48,15 @@
* Definitions
****************************************************************************/
+/* The SH1_LPEVB only a single LED controlled by either port A, pin 15, or
+ * port B, pin 15 (selectable via JP8). In this file, we assume the portB
+ * setup.
+ */
+
+#define SH1_PBDR_LED 0x8000
+#define SH1_PBIOR_LED 0x8000
+#define SH1_PBCR2_LED 0xc000
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -67,9 +76,25 @@
#ifdef CONFIG_ARCH_LEDS
void up_ledinit(void)
{
- /* The SH1_LPEVB has no user controllable LEDs. This is provided only
- * in the event that CONFIG_ARCH_LEDs is enabled.
- */
+ uint16 reg16;
+
+ /* Setup port B, pin 15 as an output */
+
+ reg16 = getreg(SH1_PFC_PBIOR);
+ reg16 |= SH1_PBIOR_LED;
+ putreg(reg16, SH1_PFC_PBIOR);
+
+ /* Setup port B, pin 15 as a normal I/O register */
+
+ reg16 = getreg(SH1_PFC_PBCR1);
+ reg16 &= ~SH1_PBCR2_LED;
+ putreg(reg16, SH1_PFC_PBCR1);
+
+ /* Turn the LED off */
+
+ reg16 = getreg(SH1_PORTB_DR);
+ reg16 &= ~SH1_PBDR_LED;
+ putreg(reg16, SH1_PORTB_DR);
}
/****************************************************************************
@@ -78,9 +103,16 @@ void up_ledinit(void)
void up_ledon(int led)
{
- /* The SH1_LPEVB has no user controllable LEDs. This is provided only
- * in the event that CONFIG_ARCH_LEDs is enabled.
- */
+ uint16 reg16;
+
+ if (led)
+ {
+ /* Turn the LED on */
+
+ reg16 = getreg(SH1_PORTB_DR);
+ reg16 |= SH1_PBDR_LED;
+ putreg(reg16, SH1_PORTB_DR);
+ }
}
/****************************************************************************
@@ -89,8 +121,15 @@ void up_ledon(int led)
void up_ledoff(int led)
{
- /* The SH1_LPEVB has no user controllable LEDs. This is provided only
- * in the event that CONFIG_ARCH_LEDs is enabled.
- */
+ uint16 reg16;
+
+ if (led)
+ {
+ /* Turn the LED off */
+
+ reg16 = getreg(SH1_PORTB_DR);
+ reg16 &= ~SH1_PBDR_LED;
+ putreg(reg16, SH1_PORTB_DR);
+ }
}
#endif /* CONFIG_ARCH_LEDS */