A few more NuTiny-SDK-NUC120 fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5668 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-02-24 00:31:45 +00:00
parent 2c9d402ad4
commit 8d9d416f76
5 changed files with 23 additions and 13 deletions

View File

@ -426,7 +426,7 @@
#define GPIO_PMD_OPENDRAIN 2 /* Open drain output */
#define GPIO_PMD_BIDI 3 /* Quasi bi-directional */
#define GPIO_PMD_SHIFT(n) ((n) << 1) /* Bits 2n-2n+_1: GPIOx Pin[n] mode control */
#define GPIO_PMD_SHIFT(n) ((n) << 1) /* Bits 2n-2n+1: GPIOx Pin[n] mode control */
#define GPIO_PMD_MASK(n) (3 << GPIO_PMD_SHIFT(n))
# define GPIO_PMD(n,v) ((v) << GPIO_PMD_SHIFT(n))

View File

@ -101,7 +101,7 @@ int nuc_configgpio(gpio_cfgset_t cfgset)
/* Set the the GPIO PMD register */
regaddr = base + NUC_GPIOA_PMD_OFFSET;
regaddr = base + NUC_GPIO_PMD_OFFSET;
regval = getreg32(regaddr);
regval &= ~GPIO_PMD_MASK(pin);
@ -131,7 +131,7 @@ int nuc_configgpio(gpio_cfgset_t cfgset)
/* Check if we need to disable the digital input path */
regaddr = base + NUC_GPIO_OFFD_OFFSET;
regval = getreg32(regaddr);
regval = getreg32(regaddr);
regval &= ~GPIO_OFFD(pin);
if ((cfgset & GPIO_ANALOG) != 0)
@ -144,7 +144,7 @@ int nuc_configgpio(gpio_cfgset_t cfgset)
/* Check if we need to enable debouncing */
regaddr = base + NUC_GPIO_DBEN_OFFSET;
regval = getreg32(regaddr);
regval = getreg32(regaddr);
regval &= ~GPIO_DBEN(pin);
if ((cfgset & GPIO_DEBOUNCE) != 0)
@ -174,24 +174,24 @@ int nuc_configgpio(gpio_cfgset_t cfgset)
case GPIO_INTERRUPT_FALLING_EDGE:
isrc |= GPIO_ISRC(pin);
ien |= GPIO_IF_EN(pin);
ien |= GPIO_IF_EN(pin);
break;
case GPIO_INTERRUPT_BOTH_EDGES:
isrc |= GPIO_ISRC(pin);
ien |= (GPIO_IF_EN(pin) | GPIO_IR_EN(pin));
ien |= (GPIO_IF_EN(pin) | GPIO_IR_EN(pin));
break;
case GPIO_INTERRUPT_HIGH_LEVEL:
isrc |= GPIO_ISRC(pin);
imd |= GPIO_IMD(pin);
ien |= GPIO_IR_EN(pin);
imd |= GPIO_IMD(pin);
ien |= GPIO_IR_EN(pin);
break;
case GPIO_INTERRUPT_LOW_LEVEL:
isrc |= GPIO_ISRC(pin);
imd |= GPIO_IMD(pin);
ien |= GPIO_IF_EN(pin);
imd |= GPIO_IMD(pin);
ien |= GPIO_IF_EN(pin);
break;
default:
@ -201,6 +201,14 @@ int nuc_configgpio(gpio_cfgset_t cfgset)
putreg32(ien, base + NUC_GPIO_IEN_OFFSET);
putreg32(imd, base + NUC_GPIO_IMD_OFFSET);
putreg32(isrc, base + NUC_GPIO_ISRC_OFFSET);
/* If the pin is an output, set the initial output value */
if ((cfgset & GPIO_MODE_MASK) == GPIO_OUTPUT)
{
nuc_gpiowrite(cfgset, (cfgset & GPIO_OUTPUT_SET) != 0);
}
return 0;
}

View File

@ -90,7 +90,7 @@ LEDs
LED_SIGNAL In a signal handler LED might glow
LED_ASSERTION An assertion failed LED ON while handling the assertion
LED_PANIC The system has crashed LED Blinking at 2Hz
LED_IDLE NUC1XX is is sleep mode (Optional, not used)
LED_IDLE NUC1XX is in sleep mode (Optional, not used)
Serial Console
==============

View File

@ -44,7 +44,9 @@ MEMORY
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {

View File

@ -68,10 +68,10 @@
* LED_SIGNAL In a signal handler LED might glow
* LED_ASSERTION An assertion failed LED ON while handling the assertion
* LED_PANIC The system has crashed LED Blinking at 2Hz
* LED_IDLE NUC1XX is is sleep mode (Optional, not used)
* LED_IDLE NUC1XX is in sleep mode (Optional, not used)
*/
#define GPIO_LED (GPIO_OUTPUT | GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN8)
#define GPIO_LED (GPIO_OUTPUT | GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN0)
/* Button definitions ***************************************************************/
/* The NuTiny has no buttons */