aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/i2c_lld.h
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-01-02 19:04:50 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-01-02 19:04:50 +0000
commit86b3f07923ebbcff11950efc4d5b9a76f5b33710 (patch)
tree882ce914d5e6fb8769b031257eabf9a766f8e0a0 /os/hal/platforms/STM32/i2c_lld.h
parentfc44d8dbc601e9fa20c8c32402944faf11fe67c2 (diff)
downloadChibiOS-86b3f07923ebbcff11950efc4d5b9a76f5b33710.tar.gz
ChibiOS-86b3f07923ebbcff11950efc4d5b9a76f5b33710.tar.bz2
ChibiOS-86b3f07923ebbcff11950efc4d5b9a76f5b33710.zip
I2C. Reorganized locks.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3711 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/i2c_lld.h')
-rw-r--r--os/hal/platforms/STM32/i2c_lld.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/os/hal/platforms/STM32/i2c_lld.h b/os/hal/platforms/STM32/i2c_lld.h
index 5a3757d88..f770be615 100644
--- a/os/hal/platforms/STM32/i2c_lld.h
+++ b/os/hal/platforms/STM32/i2c_lld.h
@@ -328,13 +328,6 @@ struct I2CDriver{
/*===========================================================================*/
/**
- * Wait until BUSY flag is reset.
- */
-#define i2c_lld_wait_bus_free(i2cp) { \
- while(i2cp->i2c->SR2 & I2C_SR2_BUSY) \
- ; \
-}
-/**
* @brief Waits for operation completion.
* @details This function waits for the driver to complete the current
* operation.
@@ -349,7 +342,6 @@ struct I2CDriver{
#define i2c_lld_wait_s(i2cp, timeout, rdymsg) { \
chDbgAssert((i2cp)->thread == NULL, \
"_i2c_wait(), #1", "already waiting"); \
- chSysLock(); /* this lock will be disarmed in high level part */ \
(i2cp)->thread = chThdSelf(); \
rdymsg = chSchGoSleepTimeoutS(THD_STATE_SUSPENDED, timeout); \
}
@@ -362,13 +354,13 @@ struct I2CDriver{
* @notapi
*/
#define i2c_lld_wakeup_isr(i2cp) { \
+ chSysLockFromIsr(); \
if ((i2cp)->thread != NULL) { \
Thread *tp = (i2cp)->thread; \
(i2cp)->thread = NULL; \
- chSysLockFromIsr(); \
chSchReadyI(tp); \
- chSysUnlockFromIsr(); \
} \
+ chSysUnlockFromIsr(); \
}
/**
@@ -379,14 +371,14 @@ struct I2CDriver{
* @notapi
*/
#define i2c_lld_error_wakeup_isr(i2cp) { \
+ chSysLockFromIsr(); \
if ((i2cp)->thread != NULL) { \
Thread *tp = (i2cp)->thread; \
(i2cp)->thread = NULL; \
- chSysLockFromIsr(); \
tp->p_u.rdymsg = RDY_RESET; \
chSchReadyI(tp); \
- chSysUnlockFromIsr(); \
} \
+ chSysUnlockFromIsr(); \
}
/**