diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-24 00:31:45 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-24 00:31:45 +0000 |
commit | d64e8a37f973d1b0394cb582fb6f5e94fd057c1b (patch) | |
tree | 23161fb3380e109a419efda8f9ab87e84094d4d9 /nuttx | |
parent | f2354e6bf2bf123f996fe741b1fcea0ea9c6a4ec (diff) | |
download | px4-nuttx-d64e8a37f973d1b0394cb582fb6f5e94fd057c1b.tar.gz px4-nuttx-d64e8a37f973d1b0394cb582fb6f5e94fd057c1b.tar.bz2 px4-nuttx-d64e8a37f973d1b0394cb582fb6f5e94fd057c1b.zip |
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
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/nuc1xx/chip/nuc_gpio.h | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/nuc1xx/nuc_gpio.c | 26 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/README.txt | 2 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/scripts/ld.script | 2 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h | 4 |
5 files changed, 23 insertions, 13 deletions
diff --git a/nuttx/arch/arm/src/nuc1xx/chip/nuc_gpio.h b/nuttx/arch/arm/src/nuc1xx/chip/nuc_gpio.h index 5ad806ea1..4e2f2d7f7 100644 --- a/nuttx/arch/arm/src/nuc1xx/chip/nuc_gpio.h +++ b/nuttx/arch/arm/src/nuc1xx/chip/nuc_gpio.h @@ -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)) diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_gpio.c b/nuttx/arch/arm/src/nuc1xx/nuc_gpio.c index be5919157..1ba92a801 100644 --- a/nuttx/arch/arm/src/nuc1xx/nuc_gpio.c +++ b/nuttx/arch/arm/src/nuc1xx/nuc_gpio.c @@ -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; } diff --git a/nuttx/configs/nutiny-nuc120/README.txt b/nuttx/configs/nutiny-nuc120/README.txt index 69cf3c2e0..3333866db 100644 --- a/nuttx/configs/nutiny-nuc120/README.txt +++ b/nuttx/configs/nutiny-nuc120/README.txt @@ -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 ============== diff --git a/nuttx/configs/nutiny-nuc120/scripts/ld.script b/nuttx/configs/nutiny-nuc120/scripts/ld.script index aed7e1b68..a380ba623 100644 --- a/nuttx/configs/nutiny-nuc120/scripts/ld.script +++ b/nuttx/configs/nutiny-nuc120/scripts/ld.script @@ -44,7 +44,9 @@ MEMORY } OUTPUT_ARCH(arm) +EXTERN(_vectors) ENTRY(_stext) + SECTIONS { .text : { diff --git a/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h b/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h index 55744fb61..dcc2a9590 100644 --- a/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h +++ b/nuttx/configs/nutiny-nuc120/src/nutiny-nuc120.h @@ -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 */ |