summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-02-26 16:55:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-02-26 16:55:39 +0000
commitaebc66f8e146b28148f5e5755f6b3252774441f8 (patch)
tree92a85e68ccfe7771cb3684247ac04c4877fbe4e8 /nuttx/configs
parent11cdbe3e35d80775ba9887a995a1e3c124c7a063 (diff)
downloadpx4-nuttx-aebc66f8e146b28148f5e5755f6b3252774441f8.tar.gz
px4-nuttx-aebc66f8e146b28148f5e5755f6b3252774441f8.tar.bz2
px4-nuttx-aebc66f8e146b28148f5e5755f6b3252774441f8.zip
Finish m9s12 GPIO support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3318 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs')
-rwxr-xr-xnuttx/configs/demo9s12ne64/README.txt7
-rwxr-xr-xnuttx/configs/ne64badge/README.txt7
-rwxr-xr-xnuttx/configs/ne64badge/include/board.h24
-rwxr-xr-xnuttx/configs/ne64badge/ostest/defconfig11
-rwxr-xr-xnuttx/configs/ne64badge/src/ne64badge_internal.h24
-rwxr-xr-xnuttx/configs/ne64badge/src/up_buttons.c52
-rwxr-xr-xnuttx/configs/ne64badge/src/up_leds.c56
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_buttons.c4
8 files changed, 164 insertions, 21 deletions
diff --git a/nuttx/configs/demo9s12ne64/README.txt b/nuttx/configs/demo9s12ne64/README.txt
index b10c7bf00..58fb44434 100755
--- a/nuttx/configs/demo9s12ne64/README.txt
+++ b/nuttx/configs/demo9s12ne64/README.txt
@@ -315,6 +315,13 @@ HCS12/DEMO9S12NEC64-specific Configuration Options
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
the delay actually is 100 seconds.
+ GPIO Interrupts
+
+ CONFIG_GPIO_IRQ - Enable general support for GPIO IRQs
+ CONFIG_HCS12_PORTG_INTS - Enable PortG IRQs
+ CONFIG_HCS12_PORTH_INTS - Enable PortH IRQs
+ CONFIG_HCS12_PORTJ_INTS - Enable PortJ IRQs
+
HCS12 build options:
CONFIG_HCS12_SERIALMON - Indicates that the target systems uses
diff --git a/nuttx/configs/ne64badge/README.txt b/nuttx/configs/ne64badge/README.txt
index 3a7aac67b..d1a5a904c 100755
--- a/nuttx/configs/ne64badge/README.txt
+++ b/nuttx/configs/ne64badge/README.txt
@@ -422,6 +422,13 @@ HCS12/NE64BADGE-specific Configuration Options
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
the delay actually is 100 seconds.
+ GPIO Interrupts
+
+ CONFIG_GPIO_IRQ - Enable general support for GPIO IRQs
+ CONFIG_HCS12_PORTG_INTS - Enable PortG IRQs
+ CONFIG_HCS12_PORTH_INTS - Enable PortH IRQs
+ CONFIG_HCS12_PORTJ_INTS - Enable PortJ IRQs
+
HCS12 build options:
CONFIG_HCS12_SERIALMON - Indicates that the target systems uses
diff --git a/nuttx/configs/ne64badge/include/board.h b/nuttx/configs/ne64badge/include/board.h
index 81ee1af16..aea9358b1 100755
--- a/nuttx/configs/ne64badge/include/board.h
+++ b/nuttx/configs/ne64badge/include/board.h
@@ -79,17 +79,25 @@
/* The NE64 Badge board has 2 red LEDs that we will encode as: */
-#define LED_STARTED 1 /* LED1 */
-#define LED_HEAPALLOCATE 1 /* LED1 */
-#define LED_IRQSENABLED 1 /* LED1 */
-#define LED_STACKCREATED 1 /* LED1 */
-#define LED_INIRQ 2 /* LED1 + LED2 */
-#define LED_SIGNAL 2 /* LED1 + LED2 */
-#define LED_ASSERTION 2 /* LED1 + LED2 */
-#define LED_PANIC 7 /* LED2 + N/C */
+ /* LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF = Still initializing */
+#define LED_HEAPALLOCATE 0 /* OFF OFF = Still initializing */
+#define LED_IRQSENABLED 0 /* OFF OFF = Still initializing */
+#define LED_STACKCREATED 1 /* ON OFF = Initialization complete */
+#define LED_INIRQ 2 /* NC ON = In an interrupt handler */
+#define LED_SIGNAL 2 /* NC ON = In a signal handler */
+#define LED_ASSERTION 2 /* NC ON = In an assertion */
+#define LED_PANIC 2 /* NC ON = Oops! We crashed. (flashing) */
/* Button definitions ***************************************************************/
+/* The NE64 badge has 2 switches, one labed SW1 and the other SW2 on the board (but
+ * referred to as button1 and button2 in some documentation)
+ */
+
+#define BUTTON1 1 /* Bit 0: SW1 button is depressed */
+#define BUTTON2 2 /* Bit 1: SW2 button is depressed */
+
/************************************************************************************
* Public Data
************************************************************************************/
diff --git a/nuttx/configs/ne64badge/ostest/defconfig b/nuttx/configs/ne64badge/ostest/defconfig
index a9af46bfb..fa9dbc58e 100755
--- a/nuttx/configs/ne64badge/ostest/defconfig
+++ b/nuttx/configs/ne64badge/ostest/defconfig
@@ -93,6 +93,17 @@ CONFIG_ARCH_BUTTONS=n
CONFIG_ARCH_CALIBRATION=n
CONFIG_ARCH_DMA=n
+#
+# CONFIG_GPIO_IRQ - Enable general support for GPIO IRQs
+# CONFIG_HCS12_PORTG_INTS - Enable PortG IRQs
+# CONFIG_HCS12_PORTH_INTS - Enable PortH IRQs
+# CONFIG_HCS12_PORTJ_INTS - Enable PortJ IRQs
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_HCS12_PORTG_INTS=n
+CONFIG_HCS12_PORTH_INTS=n
+CONFIG_HCS12_PORTJ_INTS=n
+
#
# HCS12 build options:
#
diff --git a/nuttx/configs/ne64badge/src/ne64badge_internal.h b/nuttx/configs/ne64badge/src/ne64badge_internal.h
index c1ba3145b..7cba3a91c 100755
--- a/nuttx/configs/ne64badge/src/ne64badge_internal.h
+++ b/nuttx/configs/ne64badge/src/ne64badge_internal.h
@@ -44,6 +44,8 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
+#include "m9s12_internal.h"
+
/************************************************************************************
* Definitions
************************************************************************************/
@@ -93,8 +95,11 @@
* 40 PE5/IPIPE0/MODA J3 MODA " " " " "" " "
* 39 PE6/IPIPE1/MODB J3 MODB " " " " "" " "
* 38 PE7/NOACC/XCLKS_B pulled low pulled low
- *
- * 97 PK0/XADR14 N/C N/C
+ */
+
+#define NE64BADGE_BUTTON1 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT_E | GPIO_PIN_0)
+
+/* 97 PK0/XADR14 N/C N/C
* 98 PK1/XADR15 N/C N/C
* 99 PK2/XADR16 N/C N/C
* 100 PK3/XADR17 N/C N/C
@@ -135,15 +140,22 @@
* 3 PH4/TXCLK/KWH4 BUTTON2 SW2
* 2 PH5/TXDV/KWH5 J5 XBEE_LOAD_H Not used on board
* 1 PH6/TXER/KWH6 J4 XBEE_LOAD_L Not used on board
- *
- * 8 PJ0/MDC/KWJ0 LED1 D21, red
+ */
+
+#define NE64BADGE_BUTTON2 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT_H | GPIO_PIN_4)
+
+/* 8 PJ0/MDC/KWJ0 LED1 D21, red
* 9 PJ1/MDIO/KWJ1 LED2 D22, red
* 20 PJ2/CRS/KWJ2 J3 SPI_CS Not used on board
* 21 PJ3/COL/KWJ3 N/C
* 112 PJ6/SDA/KWJ6 J3 I2C_DATA Not used on board
* 111 PJ7/SCL/KWJ7 J3 I2C_CLOCK " " " " "" " "
- *
- * 51 PL6/TXER/KWL6 N/C N/C
+ */
+
+#define NE64BADGE_LED1 (GPIO_OUTPUT | GPIO_OUTPUT_HIGH | GPIO_PORT_J | GPIO_PIN_0)
+#define NE64BADGE_LED2 (GPIO_OUTPUT | GPIO_OUTPUT_HIGH | GPIO_PORT_J | GPIO_PIN_1)
+
+/* 51 PL6/TXER/KWL6 N/C N/C
* 52 PL5/TXDV/KWL5 N/C N/C
* 58 PL4/COLLED Collision LED red
* 59 PL3/DUPLED Full Duplex LED yellow
diff --git a/nuttx/configs/ne64badge/src/up_buttons.c b/nuttx/configs/ne64badge/src/up_buttons.c
index 2472b6694..ec43c3bed 100755
--- a/nuttx/configs/ne64badge/src/up_buttons.c
+++ b/nuttx/configs/ne64badge/src/up_buttons.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * configs/ne64badge/src/up_leds.c
+ * configs/ne64badge/src/up_buttons.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -50,6 +50,34 @@
* Definitions
****************************************************************************/
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef BUTTON_DEBUG /* Define to enable debug */
+#undef BUTTON_VERBOSE /* Define to enable verbose debug */
+
+#ifdef BUTTON_DEBUG
+# define btndbg lldbg
+# ifdef BUTTON_VERBOSE
+# define btnvdbg lldbg
+# else
+# define btnvdbg(x...)
+# endif
+#else
+# undef BUTTON_VERBOSE
+# define btndbg(x...)
+# define btnvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef BUTTON_VERBOSE
+# define btn_dumpgpio(m) m9s12_dumpgpio(m)
+#else
+# define btn_dumpgpio(m)
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -68,6 +96,14 @@
void up_buttoninit(void)
{
+ /* Configure all button GPIO lines */
+
+ btn_dumpgpio("up_buttoninit() Entry)");
+
+ hcs12_configgpio(NE64BADGE_BUTTON1);
+ hcs12_configgpio(NE64BADGE_BUTTON2);
+
+ btn_dumpgpio("up_buttoninit() Exit");
}
/****************************************************************************
@@ -76,7 +112,19 @@ void up_buttoninit(void)
uint8_t up_buttons(void)
{
- return 0;
+ uint8_t ret = 0;
+
+ if (hcs12_gpioread(NE64BADGE_BUTTON1))
+ {
+ ret |= BUTTON1;
+ }
+
+ if (hcs12_gpioread(NE64BADGE_BUTTON2))
+ {
+ ret |= BUTTON2;
+ }
+
+ return ret;
}
#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/ne64badge/src/up_leds.c b/nuttx/configs/ne64badge/src/up_leds.c
index 3a0bda836..e6660b0c0 100755
--- a/nuttx/configs/ne64badge/src/up_leds.c
+++ b/nuttx/configs/ne64badge/src/up_leds.c
@@ -46,6 +46,8 @@
#include "ne64badge_internal.h"
+#ifdef CONFIG_ARCH_LEDS
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -54,16 +56,30 @@
* CONFIG_DEBUG_VERBOSE too)
*/
-#undef LED_DEBUG /* Define to enable debug */
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
#ifdef LED_DEBUG
# define leddbg lldbg
-# define ledvdbg llvdbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
#else
+# undef LED_VERBOSE
# define leddbg(x...)
# define ledvdbg(x...)
#endif
+/* Dump GPIO registers */
+
+#ifdef LED_VERBOSE
+# define led_dumpgpio(m) m9s12_dumpgpio(m)
+#else
+# define led_dumpgpio(m)
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -84,9 +100,16 @@
*
****************************************************************************/
-#ifdef CONFIG_ARCH_LEDS
void up_ledinit(void)
{
+ /* Configure all LED GPIO lines */
+
+ led_dumpgpio("up_ledinit() Entry)");
+
+ hcs12_configgpio(NE64BADGE_LED1);
+ hcs12_configgpio(NE64BADGE_LED2);
+
+ led_dumpgpio("up_ledinit() Exit");
}
/****************************************************************************
@@ -95,6 +118,23 @@ void up_ledinit(void)
void up_ledon(int led)
{
+ switch (led)
+ {
+ default:
+ case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
+ hcs12_gpiowrite(NE64BADGE_LED1, true);
+ hcs12_gpiowrite(NE64BADGE_LED2, true);
+ break;
+
+ case 1 : /* STACKCREATED */
+ hcs12_gpiowrite(NE64BADGE_LED1, false);
+ hcs12_gpiowrite(NE64BADGE_LED2, true);
+ break;
+
+ case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
+ hcs12_gpiowrite(NE64BADGE_LED2, false);
+ break;
+ }
}
/****************************************************************************
@@ -103,6 +143,16 @@ void up_ledon(int led)
void up_ledoff(int led)
{
+ switch (led)
+ {
+ default:
+ case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
+ case 1 : /* STACKCREATED */
+ hcs12_gpiowrite(NE64BADGE_LED1, true);
+ case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
+ hcs12_gpiowrite(NE64BADGE_LED2, true);
+ break;
+ }
}
#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3210e-eval/src/up_buttons.c b/nuttx/configs/stm3210e-eval/src/up_buttons.c
index 99feacec5..d2f68de80 100644
--- a/nuttx/configs/stm3210e-eval/src/up_buttons.c
+++ b/nuttx/configs/stm3210e-eval/src/up_buttons.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * configs/stm3210e-eval/src/up_leds.c
+ * configs/stm3210e-eval/src/up_buttons.c
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without