diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-10-05 01:22:49 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-10-05 01:22:49 +0000 |
commit | 20f03203b8c699bc97b1ba4c0661a125ac4182e4 (patch) | |
tree | ba64d9ca9997fed83842398a4f4b889e9bb8f52a | |
parent | 3a98bf08829c7e986161db7968b6e98fbabdac16 (diff) | |
download | px4-nuttx-20f03203b8c699bc97b1ba4c0661a125ac4182e4.tar.gz px4-nuttx-20f03203b8c699bc97b1ba4c0661a125ac4182e4.tar.bz2 px4-nuttx-20f03203b8c699bc97b1ba4c0661a125ac4182e4.zip |
Fix bugs in STM32 SDHC and I2C drivers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4020 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/ChangeLog | 9 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_i2c.c | 10 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_sdio.c | 2 | ||||
-rw-r--r-- | nuttx/drivers/input/tsc2007.c | 1 |
4 files changed, 17 insertions, 5 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 2579eb948..d5980f37f 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2134,3 +2134,12 @@ * arch/arm/src/sam3u/sam3u_spi.c: Add an SPI driver for the AT91SAM3U. * drivers/input/ads7843e.c and include/nuttx/input/ads7843e.h: Add a driver for the TI ADS7843E touchscreen controller. + * fs/nxffs/nxffs_open.c: Fix an error when a file is open for writing; since + the file will get deleted it is already exists, there must be a check if + there are other open references to the file. + * arch/arm/src/stm32/stm32_sdio.c: Fixed an error where during SDHC + initialization interrupts were not being re-enabled. Caused more subtle + errors than you would think. + * arch/arm/src/stm32/stm32_i2c.c: Fixed an error where I2C timeouts appeared + to be successful transfers. + diff --git a/nuttx/arch/arm/src/stm32/stm32_i2c.c b/nuttx/arch/arm/src/stm32/stm32_i2c.c index 74d403648..1737850ee 100644 --- a/nuttx/arch/arm/src/stm32/stm32_i2c.c +++ b/nuttx/arch/arm/src/stm32/stm32_i2c.c @@ -1212,12 +1212,12 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) /* Configure pins */ - if (stm32_configgpio(GPIO_I2C1_SCL)==ERROR) + if (stm32_configgpio(GPIO_I2C1_SCL) < 0) { return ERROR; } - if (stm32_configgpio(GPIO_I2C1_SDA)==ERROR) + if (stm32_configgpio(GPIO_I2C1_SDA) < 0) { stm32_unconfiggpio(GPIO_I2C1_SCL); return ERROR; @@ -1246,12 +1246,12 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) /* Configure pins */ - if (stm32_configgpio(GPIO_I2C2_SCL)==ERROR) + if (stm32_configgpio(GPIO_I2C2_SCL) < 0) { return ERROR; } - if (stm32_configgpio(GPIO_I2C2_SDA)==ERROR) + if (stm32_configgpio(GPIO_I2C2_SDA) < 0) { stm32_unconfiggpio(GPIO_I2C2_SCL); return ERROR; @@ -1451,7 +1451,7 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms * the BUSY flag. */ - if (stm32_i2c_sem_waitdone(priv) == ERROR) + if (stm32_i2c_sem_waitdone(priv) < 0) { status = stm32_i2c_getstatus(priv); errval = ETIMEDOUT; diff --git a/nuttx/arch/arm/src/stm32/stm32_sdio.c b/nuttx/arch/arm/src/stm32/stm32_sdio.c index 7e6c60868..0830afb4f 100644 --- a/nuttx/arch/arm/src/stm32/stm32_sdio.c +++ b/nuttx/arch/arm/src/stm32/stm32_sdio.c @@ -1411,6 +1411,8 @@ static void stm32_reset(FAR struct sdio_dev_s *dev) /* (Re-)enable clocking */ putreg32(1, SDIO_CLKCR_CLKEN_BB); + irqrestore(flags); + fvdbg("CLCKR: %08x POWER: %08x\n", getreg32(STM32_SDIO_CLKCR), getreg32(STM32_SDIO_POWER)); } diff --git a/nuttx/drivers/input/tsc2007.c b/nuttx/drivers/input/tsc2007.c index e6e570d62..61b48fbd4 100644 --- a/nuttx/drivers/input/tsc2007.c +++ b/nuttx/drivers/input/tsc2007.c @@ -1187,6 +1187,7 @@ int tsc2007_register(FAR struct i2c_dev_s *dev, */ #ifdef CONFIG_TSC2007_MULTIPLE + flags = irqsave(); priv->flink = g_tsc2007list; g_tsc2007list = priv; irqrestore(flags); |