diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-06-22 12:27:29 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-06-22 12:27:29 +0000 |
commit | ab90572c6ebe1df4258518bcf505e39851143eb4 (patch) | |
tree | bc04d5569868cd879389270792c07a4dbcb5e38d /os/hal/platforms/STM32 | |
parent | 952b62113daeca8161311011004be5c59474fbc8 (diff) | |
download | ChibiOS-ab90572c6ebe1df4258518bcf505e39851143eb4.tar.gz ChibiOS-ab90572c6ebe1df4258518bcf505e39851143eb4.tar.bz2 ChibiOS-ab90572c6ebe1df4258518bcf505e39851143eb4.zip |
Fixed timeout.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4325 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r-- | os/hal/platforms/STM32/I2Cv1/i2c_lld.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/os/hal/platforms/STM32/I2Cv1/i2c_lld.c b/os/hal/platforms/STM32/I2Cv1/i2c_lld.c index 229520a91..bf6ef05cc 100644 --- a/os/hal/platforms/STM32/I2Cv1/i2c_lld.c +++ b/os/hal/platforms/STM32/I2Cv1/i2c_lld.c @@ -792,7 +792,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, is completed, alternatively for a timeout condition.*/
while ((dp->SR2 & I2C_SR2_BUSY) || (dp->CR1 & I2C_CR1_STOP)) {
chSysLock();
- if (!chVTIsArmedI(&vt))
+ if ((timeout != TIME_INFINITE) && !chVTIsArmedI(&vt))
return RDY_TIMEOUT;
chSysUnlock();
}
@@ -802,7 +802,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Atomic check on the timer in order to make sure that a timeout didn't
happen outside the critical zone.*/
- if (!chVTIsArmedI(&vt))
+ if ((timeout != TIME_INFINITE) && !chVTIsArmedI(&vt))
return RDY_TIMEOUT;
/* Starts the operation.*/
@@ -812,7 +812,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Waits for the operation completion or a timeout.*/
i2cp->thread = chThdSelf();
chSchGoSleepS(THD_STATE_SUSPENDED);
- if (chVTIsArmedI(&vt))
+ if ((timeout != TIME_INFINITE) && chVTIsArmedI(&vt))
chVTResetI(&vt);
return chThdSelf()->p_u.rdymsg;
@@ -876,7 +876,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, is completed, alternatively for a timeout condition.*/
while ((dp->SR2 & I2C_SR2_BUSY) || (dp->CR1 & I2C_CR1_STOP)) {
chSysLock();
- if (!chVTIsArmedI(&vt))
+ if ((timeout != TIME_INFINITE) && !chVTIsArmedI(&vt))
return RDY_TIMEOUT;
chSysUnlock();
}
@@ -886,7 +886,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Atomic check on the timer in order to make sure that a timeout didn't
happen outside the critical zone.*/
- if (!chVTIsArmedI(&vt))
+ if ((timeout != TIME_INFINITE) && !chVTIsArmedI(&vt))
return RDY_TIMEOUT;
/* Starts the operation.*/
@@ -896,7 +896,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Waits for the operation completion or a timeout.*/
i2cp->thread = chThdSelf();
chSchGoSleepS(THD_STATE_SUSPENDED);
- if (chVTIsArmedI(&vt))
+ if ((timeout != TIME_INFINITE) && chVTIsArmedI(&vt))
chVTResetI(&vt);
return chThdSelf()->p_u.rdymsg;
|