diff options
author | Daniel Jarai <daniel.jarai@bartec-pixavi.com> | 2018-12-17 15:45:11 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-12-17 15:45:11 -0800 |
commit | 5341c49b73f07d6cc6b206d77f9c69edd84d17fa (patch) | |
tree | 1b20ab27cf799c4928f2de49b53fbfda6029b256 | |
parent | e04cfef49f8ceda5f577afc5f71853729d751bf0 (diff) | |
parent | 202ee11a1820303f5b02ded09bb50d11cce32d60 (diff) | |
download | contexthub-5341c49b73f07d6cc6b206d77f9c69edd84d17fa.tar.gz |
nanohub: stm32: i2c: always wait for the BTF event in the DmaTxDone ISR am: 5ef209c863 am: aae766a0aa
am: 202ee11a18
Change-Id: Ibc2c3ad62d039a960ddc7b8d97301c00069e4375
-rw-r--r-- | firmware/os/platform/stm32/i2c.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/firmware/os/platform/stm32/i2c.c b/firmware/os/platform/stm32/i2c.c index 7ba7b7ce..8ae35cf7 100644 --- a/firmware/os/platform/stm32/i2c.c +++ b/firmware/os/platform/stm32/i2c.c @@ -543,14 +543,16 @@ static void stmI2cMasterDmaTxDone(void *cookie, uint16_t bytesLeft, int err) state->tx.offset = state->tx.size - bytesLeft; state->tx.size = 0; + stmI2cDmaDisable(pdev); + + while (!(regs->SR1 & I2C_SR1_BTF)) + ; + if (err == 0 && state->rx.size > 0) { atomicWriteByte(&state->masterState, STM_I2C_MASTER_START); stmI2cStartEnable(pdev); } else { - while (!(regs->SR1 & I2C_SR1_BTF)) - ; - stmI2cStopEnable(pdev); stmI2cMasterTxRxDone(pdev, err); } |