arch/arm/src/nrf52/nrf52_i2c.c: protect the I2C transfer with a semaphore

This commit is contained in:
raiden00pl 2020-03-27 16:25:33 +01:00 committed by patacongo
parent 4f130d4274
commit fef7abb598

View File

@ -223,6 +223,12 @@ static int nrf52_i2c_transfer(FAR struct i2c_master_s *dev,
uint32_t regval = 0;
int ret = OK;
ret = nxsem_wait(&priv->sem_excl);
if (ret < 0)
{
return ret;
}
/* Reset ptr and dcnt */
priv->dcnt = 0;
@ -397,7 +403,8 @@ static int nrf52_i2c_transfer(FAR struct i2c_master_s *dev,
#endif
errout:
return ret;
nxsem_post(&priv->sem_excl);
return ret;
}
/****************************************************************************