Changeset 79d2987 in mainline for uspace/lib/drv/generic/remote_usbhc.c
- Timestamp:
- 2011-02-11T17:16:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4e8e1f5
- Parents:
- 25971d2 (diff), 608afb9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r25971d2 r79d2987 42 42 43 43 static void remote_usbhc_get_address(device_t *, void *, ipc_callid_t, ipc_call_t *); 44 static void remote_usbhc_get_buffer(device_t *, void *, ipc_callid_t, ipc_call_t *);45 44 static void remote_usbhc_interrupt_out(device_t *, void *, ipc_callid_t, ipc_call_t *); 46 45 static void remote_usbhc_interrupt_in(device_t *, void *, ipc_callid_t, ipc_call_t *); … … 64 63 remote_usbhc_get_address, 65 64 66 remote_usbhc_get_buffer,67 68 65 remote_usbhc_reserve_default_address, 69 66 remote_usbhc_release_default_address, … … 98 95 typedef struct { 99 96 ipc_callid_t caller; 97 ipc_callid_t data_caller; 100 98 void *buffer; 101 99 void *setup_packet; … … 127 125 128 126 trans->caller = caller; 127 trans->data_caller = 0; 129 128 trans->buffer = NULL; 130 129 trans->setup_packet = NULL; … … 155 154 } 156 155 157 void remote_usbhc_get_buffer(device_t *device, void *iface,158 ipc_callid_t callid, ipc_call_t *call)159 {160 sysarg_t buffer_hash = DEV_IPC_GET_ARG1(*call);161 async_transaction_t * trans = (async_transaction_t *)buffer_hash;162 if (trans == NULL) {163 async_answer_0(callid, ENOENT);164 return;165 }166 if (trans->buffer == NULL) {167 async_answer_0(callid, EINVAL);168 async_transaction_destroy(trans);169 return;170 }171 172 ipc_callid_t cid;173 size_t accepted_size;174 if (!async_data_read_receive(&cid, &accepted_size)) {175 async_answer_0(callid, EINVAL);176 async_transaction_destroy(trans);177 return;178 }179 180 if (accepted_size > trans->size) {181 accepted_size = trans->size;182 }183 async_data_read_finalize(cid, trans->buffer, accepted_size);184 185 async_answer_1(callid, EOK, accepted_size);186 187 async_transaction_destroy(trans);188 }189 190 156 void remote_usbhc_reserve_default_address(device_t *device, void *iface, 191 157 ipc_callid_t callid, ipc_call_t *call) … … 290 256 if (outcome != USB_OUTCOME_OK) { 291 257 async_answer_0(trans->caller, outcome); 258 if (trans->data_caller) { 259 async_answer_0(trans->data_caller, EINTR); 260 } 292 261 async_transaction_destroy(trans); 293 262 return; … … 295 264 296 265 trans->size = actual_size; 297 async_answer_1(trans->caller, USB_OUTCOME_OK, (sysarg_t)trans); 266 267 if (trans->data_caller) { 268 async_data_read_finalize(trans->data_caller, 269 trans->buffer, actual_size); 270 } 271 272 async_answer_0(trans->caller, USB_OUTCOME_OK); 273 274 async_transaction_destroy(trans); 298 275 } 299 276 … … 376 353 }; 377 354 355 ipc_callid_t data_callid; 356 if (!async_data_read_receive(&data_callid, &len)) { 357 async_answer_0(callid, EPARTY); 358 return; 359 } 360 378 361 async_transaction_t *trans = async_transaction_create(callid); 379 362 if (trans == NULL) { … … 381 364 return; 382 365 } 366 trans->data_caller = data_callid; 383 367 trans->buffer = malloc(len); 384 368 trans->size = len; … … 630 614 } 631 615 616 ipc_callid_t data_callid; 617 if (!async_data_read_receive(&data_callid, &data_len)) { 618 async_answer_0(callid, EPARTY); 619 free(setup_packet); 620 return; 621 } 622 632 623 async_transaction_t *trans = async_transaction_create(callid); 633 624 if (trans == NULL) { … … 636 627 return; 637 628 } 629 trans->data_caller = data_callid; 638 630 trans->setup_packet = setup_packet; 639 631 trans->size = data_len;
Note:
See TracChangeset
for help on using the changeset viewer.