Changeset 5da7199 in mainline for uspace/srv/hw/bus/cuda_adb/cuda_adb.c
- Timestamp:
- 2011-09-09T17:18:06Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3781092, b7c33b0
- Parents:
- c69646f8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
rc69646f8 r5da7199 48 48 #include <ipc/adb.h> 49 49 #include <async.h> 50 #include <async_obsolete.h>51 50 #include <assert.h> 52 51 #include "cuda_adb.h" 53 52 54 // FIXME: remove this header 55 #include <abi/ipc/methods.h> 56 57 #define NAME "cuda_adb" 53 #define NAME "cuda_adb" 58 54 59 55 static void cuda_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 154 150 155 151 for (i = 0; i < ADB_MAX_ADDR; ++i) { 156 adb_dev[i].client_ phone = -1;152 adb_dev[i].client_sess = NULL; 157 153 adb_dev[i].service_id = 0; 158 154 } … … 199 195 sysarg_t method; 200 196 service_id_t dsid; 201 int retval;202 197 int dev_addr, i; 203 198 … … 220 215 async_answer_0(iid, EOK); 221 216 222 while ( 1) {217 while (true) { 223 218 callid = async_get_call(&call); 224 219 method = IPC_GET_IMETHOD(call); … … 230 225 } 231 226 232 switch (method) { 233 case IPC_M_CONNECT_TO_ME: 234 if (adb_dev[dev_addr].client_phone != -1) { 235 retval = ELIMIT; 236 break; 237 } 238 adb_dev[dev_addr].client_phone = IPC_GET_ARG5(call); 239 /* 240 * A hack so that we send the data to the phone 241 * regardless of which address the device is on. 242 */ 243 for (i = 0; i < ADB_MAX_ADDR; ++i) { 244 if (adb_dev[i].service_id == dsid) { 245 adb_dev[i].client_phone = IPC_GET_ARG5(call); 227 async_sess_t *sess = 228 async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 229 if (sess != NULL) { 230 if (adb_dev[dev_addr].client_sess == NULL) { 231 adb_dev[dev_addr].client_sess = sess; 232 233 /* 234 * A hack so that we send the data to the session 235 * regardless of which address the device is on. 236 */ 237 for (i = 0; i < ADB_MAX_ADDR; ++i) { 238 if (adb_dev[i].service_id == dsid) 239 adb_dev[i].client_sess = sess; 246 240 } 247 } 248 retval = 0; 249 break; 250 default: 251 retval = EINVAL; 252 break; 253 } 254 async_answer_0(callid, retval); 241 242 async_answer_0(callid, EOK); 243 } else 244 async_answer_0(callid, ELIMIT); 245 } else 246 async_answer_0(callid, EINVAL); 255 247 } 256 248 } … … 483 475 reg_val = ((uint16_t) data[1] << 8) | (uint16_t) data[2]; 484 476 485 if (adb_dev[dev_addr].client_phone == -1) 486 return; 487 488 async_obsolete_msg_1(adb_dev[dev_addr].client_phone, ADB_REG_NOTIF, reg_val); 477 if (adb_dev[dev_addr].client_sess == NULL) 478 return; 479 480 async_exch_t *exch = 481 async_exchange_begin(adb_dev[dev_addr].client_sess); 482 async_msg_1(exch, ADB_REG_NOTIF, reg_val); 483 async_exchange_end(exch); 489 484 } 490 485
Note:
See TracChangeset
for help on using the changeset viewer.