diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-03-27 21:12:43 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-03-27 21:12:43 +0000 |
commit | 7a694b4402e8d47ef0fdc651492ee09084ebcad0 (patch) | |
tree | c10332a976e388c29843fa1594cb86f869a4e14b /os/hal/src | |
parent | 1ab46c6fb9e7a6f8283886b0d9de5357a08b3740 (diff) | |
download | ChibiOS-7a694b4402e8d47ef0fdc651492ee09084ebcad0.tar.gz ChibiOS-7a694b4402e8d47ef0fdc651492ee09084ebcad0.tar.bz2 ChibiOS-7a694b4402e8d47ef0fdc651492ee09084ebcad0.zip |
I2C. Mutual exclusion support added. Need testing.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@2847 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/i2c.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 7dede9f86..11d4fccfa 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -69,6 +69,19 @@ void i2cObjectInit(I2CDriver *i2cp) { i2cp->id_state = I2C_STOP;
i2cp->id_config = NULL;
i2cp->id_slave_config = NULL;
+
+#if I2C_USE_WAIT
+ i2cp->id_thread = NULL;
+#endif /* I2C_USE_WAIT */
+
+#if I2C_USE_MUTUAL_EXCLUSION
+#if CH_USE_MUTEXES
+ chMtxInit(&i2cp->id_mutex);
+#else
+ chSemInit(&i2cp->id_semaphore, 1);
+#endif /* CH_USE_MUTEXES */
+#endif /* I2C_USE_MUTUAL_EXCLUSION */
+
#if defined(I2C_DRIVER_EXT_INIT_HOOK)
I2C_DRIVER_EXT_INIT_HOOK(i2cp);
#endif
|