Browse Source

Avoid a possible issue where an interrupt can intervene at a critical point, possibly leading to excess bytes being transferred on the bus.

sbg
px4dev 13 years ago
parent
commit
adad44a3a9
  1. 9
      nuttx/arch/arm/src/stm32/stm32_i2c.c

9
nuttx/arch/arm/src/stm32/stm32_i2c.c

@ -1198,6 +1198,10 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) @@ -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) @@ -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
}
}

Loading…
Cancel
Save