mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 06:04:28 +08:00
clear i2c ints before the transfer starts
If transfer is restarted in irq handler the interrupts shall be cleared before the start bit is set in control register. This is to avoid ints being accidentally cleared before they are handled leading to timeout error.
This commit is contained in:
@@ -396,6 +396,11 @@ static int mpfs_i2c_irq(int cpuint, void *context, void *arg)
|
||||
break;
|
||||
|
||||
case MPFS_I2C_ST_LOST_ARB:
|
||||
|
||||
/* Clear interrupt. */
|
||||
|
||||
modifyreg32(MPFS_I2C_CTRL, MPFS_I2C_CTRL_SI_MASK, 0);
|
||||
clear_irq = 0u;
|
||||
modifyreg32(MPFS_I2C_CTRL, MPFS_I2C_CTRL_STA_MASK,
|
||||
MPFS_I2C_CTRL_STA_MASK);
|
||||
break;
|
||||
@@ -416,6 +421,10 @@ static int mpfs_i2c_irq(int cpuint, void *context, void *arg)
|
||||
}
|
||||
else if (msg->flags & I2C_M_NOSTOP)
|
||||
{
|
||||
/* Clear interrupt. */
|
||||
|
||||
modifyreg32(MPFS_I2C_CTRL, MPFS_I2C_CTRL_SI_MASK, 0);
|
||||
clear_irq = 0u;
|
||||
modifyreg32(MPFS_I2C_CTRL, MPFS_I2C_CTRL_STA_MASK,
|
||||
MPFS_I2C_CTRL_STA_MASK);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user