Fixe LM3S GPIO output settings; fix Eagle-100 LEDs

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1823 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-05-24 16:03:08 +00:00
parent ad228723c0
commit da61e40634
4 changed files with 40 additions and 9 deletions
+2 -1
View File
@@ -114,7 +114,8 @@
/* GPIO for microSD card chip select */ /* GPIO for microSD card chip select */
#define SDC_CS (GPIO_PORTG | 2) #define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | GPIO_VALUE_ONE | GPIO_PORTG | 2)
#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | 1)
/************************************************************************************ /************************************************************************************
* Public Function Prototypes * Public Function Prototypes
+3 -1
View File
@@ -41,6 +41,8 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <debug.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -70,7 +72,7 @@ void lm3s_boardinitialize(void)
{ {
/* Configure the SPI-based microSD CS GPIO */ /* Configure the SPI-based microSD CS GPIO */
lm3s_configgpio(SDC_CS | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | GPIO_VALUE_ONE); lm3s_configgpio(SDCCS_GPIO);
/* Configure on-board LEDs */ /* Configure on-board LEDs */
+34 -6
View File
@@ -41,6 +41,8 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <debug.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "chip.h" #include "chip.h"
@@ -52,6 +54,28 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
/* Enables debug output from this file (needs CONFIG_DEBUG with
* CONFIG_DEBUG_VERBOSE too)
*/
#undef LED_DEBUG /* Define to enable debug */
#ifdef LED_DEBUG
# define leddbg lldbg
# define ledvdbg llvdbg
#else
# define leddbg(x...)
# define ledvdbg(x...)
#endif
/* Dump GPIO registers */
#ifdef LED_DEBUG
# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
#else
# define led_dumpgpio(m)
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@@ -73,13 +97,13 @@ static boolean g_nest;
#ifdef CONFIG_ARCH_LEDS #ifdef CONFIG_ARCH_LEDS
void up_ledinit(void) void up_ledinit(void)
{ {
/* Make sure that the GPIOE peripheral is enabled */ leddbg("Initializing\n");
modifyreg32(LM3S_SYSCON_RCGC2_OFFSET, 0, SYSCON_RCGC2_GPIOE);
/* Configure Port E, Bit 1 as an output, initial value=OFF */ /* Configure Port E, Bit 1 as an output, initial value=OFF */
lm3s_configgpio(GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | 1); led_dumpgpio("up_ledinit before lm3s_configgpio()");
lm3s_configgpio(LED_GPIO);
led_dumpgpio("up_ledinit after lm3s_configgpio()");
g_nest = 0; g_nest = 0;
} }
@@ -103,7 +127,9 @@ void up_ledon(int led)
g_nest++; g_nest++;
case LED_IRQSENABLED: case LED_IRQSENABLED:
case LED_STACKCREATED: case LED_STACKCREATED:
modifyreg32(LM3S_GPIOE_DATA, 0, (1 << 1)); led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
lm3s_gpiowrite(LED_GPIO, FALSE);
led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
break; break;
} }
} }
@@ -129,7 +155,9 @@ void up_ledoff(int led)
case LED_PANIC: case LED_PANIC:
if (--g_nest <= 0) if (--g_nest <= 0)
{ {
modifyreg32(LM3S_GPIOE_DATA, (1 << 1), 0); led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
lm3s_gpiowrite(LED_GPIO, TRUE);
led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
} }
break; break;
} }
+1 -1
View File
@@ -84,7 +84,7 @@ void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean sel
{ {
/* Assert the CS pin to the card */ /* Assert the CS pin to the card */
lm3s_gpiowrite(SDC_CS, selected ? 0 : 1); lm3s_gpiowrite(SDCCS_GPIO, !selected);
} }
} }