diff options
author | px4dev <px4@purgatory.org> | 2012-09-14 00:22:07 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-09-14 00:22:07 -0700 |
commit | adad44a3a99dae529cc979bd4deb68bba8e9c61c (patch) | |
tree | e86c75d717fd6cbf698cae9783d24ab60ca332fb /nuttx | |
parent | 04b5856764639de7a595257bcbe22c6278319001 (diff) | |
download | px4-firmware-adad44a3a99dae529cc979bd4deb68bba8e9c61c.tar.gz px4-firmware-adad44a3a99dae529cc979bd4deb68bba8e9c61c.tar.bz2 px4-firmware-adad44a3a99dae529cc979bd4deb68bba8e9c61c.zip |
Avoid a possible issue where an interrupt can intervene at a critical point, possibly leading to excess bytes being transferred on the bus.
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_i2c.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_i2c.c b/nuttx/arch/arm/src/stm32/stm32_i2c.c index cca7a24aa..2d1a7142c 100644 --- a/nuttx/arch/arm/src/stm32/stm32_i2c.c +++ b/nuttx/arch/arm/src/stm32/stm32_i2c.c @@ -1198,6 +1198,10 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) { stm32_i2c_traceevent(priv, I2CEVENT_RCVBYTE, priv->dcnt); +#ifdef CONFIG_I2C_POLLED + //irqstate_t state = irqsave(); +#endif + /* Receive a byte */ *priv->ptr++ = stm32_i2c_getreg(priv, STM32_I2C_DR_OFFSET); @@ -1209,6 +1213,11 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) stm32_i2c_modifyreg(priv, STM32_I2C_CR1_OFFSET, I2C_CR1_ACK, 0); } priv->dcnt--; + +#ifdef CONFIG_I2C_POLLED + //irqrestore(state); +#endif + } } |