]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for BUSC_I2C_RESERVE
authorLionel Sambuc <lionel@minix3.org>
Thu, 15 May 2014 14:14:21 +0000 (16:14 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:43 +0000 (17:05 +0200)
Change-Id: Iedc2615b41c65f826868a70448fb1143bd85670f

drivers/i2c/i2c.c
include/minix/com.h
include/minix/ipc.h
lib/libi2cdriver/i2cdriver.c

index 26e7b869f01ea49c2dbfe23b2205dd4987b89e6b..b53bcf6842686c0cfe44c14534e583b711d8f0e7 100644 (file)
@@ -323,7 +323,7 @@ i2c_other(message * m, int ipc_status)
        switch (m->m_type) {
        case BUSC_I2C_RESERVE:
                /* reserve a device on the bus for exclusive access */
-               r = do_reserve(m->m_source, m->BUSC_I2C_ADDR);
+               r = do_reserve(m->m_source, m->m_li2cdriver_i2c_busc_i2c_reserve.addr);
                break;
        case BUSC_I2C_EXEC:
                /* handle request from another driver */
index 8cf461ae56af5a98d43aa6b4fd8dab824bc94175..748ccc3aa3142757d6d79aabec3097c61d7d4033 100644 (file)
                                                         */
 
 #define BUSC_I2C_RESERVE       (BUSC_RQ_BASE + 64)     /* reserve i2c device */
-#define   BUSC_I2C_ADDR                m2_i1                   /* slave address */
 #define BUSC_I2C_EXEC          (BUSC_RQ_BASE + 65)     /* perform i2c action */
 #define   BUSC_I2C_GRANT       m2_i1                   /* grant for request */
 
index 86ce534d8ddf8371a0f4537d160712d229ee9377..e65be80207b2db6b0a0efdac7adabafdcb06cc09 100644 (file)
@@ -587,6 +587,21 @@ typedef struct {
 } mess_pm_lexec_exec_new;
 _ASSERT_MSG_SIZE(mess_pm_lexec_exec_new);
 
+typedef struct {
+       uint16_t addr; /* FIXME: strictly speaking this is an i2c_addr_t, but
+                         to get it I would need to include
+                         sys/dev/i2c/i2c_io.h, which I am not sure is a good
+                         idea to have everywhere. */
+
+       uint8_t padding[54];
+} mess_li2cdriver_i2c_busc_i2c_reserve;
+_ASSERT_MSG_SIZE(mess_li2cdriver_i2c_busc_i2c_reserve);
+
+typedef struct {
+       uint8_t padding[56];
+} mess_i2c_li2cdriver_busc_i2c_reserve;
+_ASSERT_MSG_SIZE(mess_i2c_li2cdriver_busc_i2c_reserve);
+
 typedef struct {
        uint32_t flags;
        endpoint_t endpoint;
@@ -1203,6 +1218,8 @@ typedef struct {
                mess_fs_vfs_readsuper   m_fs_vfs_readsuper;
                mess_fs_vfs_readwrite   m_fs_vfs_readwrite;
 
+               mess_i2c_li2cdriver_busc_i2c_reserve m_i2c_li2cdriver_busc_i2c_reserve;
+
                mess_lc_pm_exec         m_lc_pm_exec;
                mess_lc_pm_exit         m_lc_pm_exit;
                mess_lc_pm_getsid       m_lc_pm_getsid;
@@ -1247,6 +1264,8 @@ typedef struct {
 
                mess_lexec_pm_exec_new  m_lexec_pm_exec_new;
 
+               mess_li2cdriver_i2c_busc_i2c_reserve m_li2cdriver_i2c_busc_i2c_reserve;
+
                mess_lsys_krn_schedctl  m_lsys_krn_schedctl;
                mess_lsys_krn_schedule  m_lsys_krn_schedule;
 
index 57557896e770c523f6041cdada1fb477717e70fe..f4b6c3b58c7b6f31789f09478917811d7e407164 100644 (file)
@@ -159,7 +159,7 @@ i2cdriver_reserve_device(endpoint_t bus_endpoint, i2c_addr_t address)
        message m;
 
        m.m_type = BUSC_I2C_RESERVE;
-       m.BUSC_I2C_ADDR = address;
+       m.m_li2cdriver_i2c_busc_i2c_reserve.addr = address;
 
        r = ipc_sendrec(bus_endpoint, &m);
        if (r != OK) {