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 f4b3fe4a13
commit a588a32556
2 changed files with 18 additions and 10 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);
@ -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;
}