Changeset fe1776c2 in mainline for uspace/lib/drv/generic/remote_usbhc.c
- Timestamp:
- 2011-02-11T12:41:11Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d81ef61c
- Parents:
- 78d1525 (diff), 5d4193c (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
r78d1525 rfe1776c2 33 33 */ 34 34 35 #include <ipc/ipc.h>36 35 #include <async.h> 37 36 #include <errno.h> … … 141 140 142 141 if (!usb_iface->tell_address) { 143 ipc_answer_0(callid, ENOTSUP);142 async_answer_0(callid, ENOTSUP); 144 143 return; 145 144 } … … 150 149 int rc = usb_iface->tell_address(device, handle, &address); 151 150 if (rc != EOK) { 152 ipc_answer_0(callid, rc);151 async_answer_0(callid, rc); 153 152 } else { 154 ipc_answer_1(callid, EOK, address);153 async_answer_1(callid, EOK, address); 155 154 } 156 155 } … … 162 161 async_transaction_t * trans = (async_transaction_t *)buffer_hash; 163 162 if (trans == NULL) { 164 ipc_answer_0(callid, ENOENT);163 async_answer_0(callid, ENOENT); 165 164 return; 166 165 } 167 166 if (trans->buffer == NULL) { 168 ipc_answer_0(callid, EINVAL);167 async_answer_0(callid, EINVAL); 169 168 async_transaction_destroy(trans); 170 169 return; … … 174 173 size_t accepted_size; 175 174 if (!async_data_read_receive(&cid, &accepted_size)) { 176 ipc_answer_0(callid, EINVAL);175 async_answer_0(callid, EINVAL); 177 176 async_transaction_destroy(trans); 178 177 return; … … 184 183 async_data_read_finalize(cid, trans->buffer, accepted_size); 185 184 186 ipc_answer_1(callid, EOK, accepted_size);185 async_answer_1(callid, EOK, accepted_size); 187 186 188 187 async_transaction_destroy(trans); … … 195 194 196 195 if (!usb_iface->reserve_default_address) { 197 ipc_answer_0(callid, ENOTSUP);196 async_answer_0(callid, ENOTSUP); 198 197 return; 199 198 } … … 201 200 int rc = usb_iface->reserve_default_address(device); 202 201 203 ipc_answer_0(callid, rc);202 async_answer_0(callid, rc); 204 203 } 205 204 … … 210 209 211 210 if (!usb_iface->release_default_address) { 212 ipc_answer_0(callid, ENOTSUP);211 async_answer_0(callid, ENOTSUP); 213 212 return; 214 213 } … … 216 215 int rc = usb_iface->release_default_address(device); 217 216 218 ipc_answer_0(callid, rc);217 async_answer_0(callid, rc); 219 218 } 220 219 … … 225 224 226 225 if (!usb_iface->request_address) { 227 ipc_answer_0(callid, ENOTSUP);226 async_answer_0(callid, ENOTSUP); 228 227 return; 229 228 } … … 232 231 int rc = usb_iface->request_address(device, &address); 233 232 if (rc != EOK) { 234 ipc_answer_0(callid, rc);233 async_answer_0(callid, rc); 235 234 } else { 236 ipc_answer_1(callid, EOK, (sysarg_t) address);235 async_answer_1(callid, EOK, (sysarg_t) address); 237 236 } 238 237 } … … 244 243 245 244 if (!usb_iface->bind_address) { 246 ipc_answer_0(callid, ENOTSUP);245 async_answer_0(callid, ENOTSUP); 247 246 return; 248 247 } … … 253 252 int rc = usb_iface->bind_address(device, address, handle); 254 253 255 ipc_answer_0(callid, rc);254 async_answer_0(callid, rc); 256 255 } 257 256 … … 262 261 263 262 if (!usb_iface->release_address) { 264 ipc_answer_0(callid, ENOTSUP);263 async_answer_0(callid, ENOTSUP); 265 264 return; 266 265 } … … 270 269 int rc = usb_iface->release_address(device, address); 271 270 272 ipc_answer_0(callid, rc);271 async_answer_0(callid, rc); 273 272 } 274 273 … … 279 278 async_transaction_t *trans = (async_transaction_t *)arg; 280 279 281 ipc_answer_0(trans->caller, outcome);280 async_answer_0(trans->caller, outcome); 282 281 283 282 async_transaction_destroy(trans); … … 290 289 291 290 if (outcome != USB_OUTCOME_OK) { 292 ipc_answer_0(trans->caller, outcome);291 async_answer_0(trans->caller, outcome); 293 292 async_transaction_destroy(trans); 294 293 return; … … 296 295 297 296 trans->size = actual_size; 298 ipc_answer_1(trans->caller, USB_OUTCOME_OK, (sysarg_t)trans);297 async_answer_1(trans->caller, USB_OUTCOME_OK, (sysarg_t)trans); 299 298 } 300 299 … … 311 310 { 312 311 if (!transfer_func) { 313 ipc_answer_0(callid, ENOTSUP);312 async_answer_0(callid, ENOTSUP); 314 313 return; 315 314 } … … 329 328 330 329 if (rc != EOK) { 331 ipc_answer_0(callid, rc);330 async_answer_0(callid, rc); 332 331 return; 333 332 } … … 339 338 free(buffer); 340 339 } 341 ipc_answer_0(callid, ENOMEM);340 async_answer_0(callid, ENOMEM); 342 341 return; 343 342 } … … 350 349 351 350 if (rc != EOK) { 352 ipc_answer_0(callid, rc);351 async_answer_0(callid, rc); 353 352 async_transaction_destroy(trans); 354 353 } … … 367 366 { 368 367 if (!transfer_func) { 369 ipc_answer_0(callid, ENOTSUP);368 async_answer_0(callid, ENOTSUP); 370 369 return; 371 370 } … … 379 378 async_transaction_t *trans = async_transaction_create(callid); 380 379 if (trans == NULL) { 381 ipc_answer_0(callid, ENOMEM);380 async_answer_0(callid, ENOMEM); 382 381 return; 383 382 } … … 389 388 390 389 if (rc != EOK) { 391 ipc_answer_0(callid, rc);390 async_answer_0(callid, rc); 392 391 async_transaction_destroy(trans); 393 392 } … … 414 413 case USB_DIRECTION_IN: 415 414 if (!transfer_in_func) { 416 ipc_answer_0(callid, ENOTSUP);415 async_answer_0(callid, ENOTSUP); 417 416 return; 418 417 } … … 420 419 case USB_DIRECTION_OUT: 421 420 if (!transfer_out_func) { 422 ipc_answer_0(callid, ENOTSUP);421 async_answer_0(callid, ENOTSUP); 423 422 return; 424 423 } … … 436 435 async_transaction_t *trans = async_transaction_create(callid); 437 436 if (trans == NULL) { 438 ipc_answer_0(callid, ENOMEM);437 async_answer_0(callid, ENOMEM); 439 438 return; 440 439 } … … 456 455 457 456 if (rc != EOK) { 458 ipc_answer_0(callid, rc);457 async_answer_0(callid, rc); 459 458 async_transaction_destroy(trans); 460 459 } … … 549 548 550 549 if (!usb_iface->control_write) { 551 ipc_answer_0(callid, ENOTSUP);550 async_answer_0(callid, ENOTSUP); 552 551 return; 553 552 } … … 568 567 1, USB_MAX_PAYLOAD_SIZE, 0, &setup_packet_len); 569 568 if (rc != EOK) { 570 ipc_answer_0(callid, rc);569 async_answer_0(callid, rc); 571 570 return; 572 571 } … … 574 573 1, USB_MAX_PAYLOAD_SIZE, 0, &data_buffer_len); 575 574 if (rc != EOK) { 576 ipc_answer_0(callid, rc);575 async_answer_0(callid, rc); 577 576 free(setup_packet); 578 577 return; … … 581 580 async_transaction_t *trans = async_transaction_create(callid); 582 581 if (trans == NULL) { 583 ipc_answer_0(callid, ENOMEM);582 async_answer_0(callid, ENOMEM); 584 583 free(setup_packet); 585 584 free(data_buffer); … … 596 595 597 596 if (rc != EOK) { 598 ipc_answer_0(callid, rc);597 async_answer_0(callid, rc); 599 598 async_transaction_destroy(trans); 600 599 } … … 609 608 610 609 if (!usb_iface->control_read) { 611 ipc_answer_0(callid, ENOTSUP);610 async_answer_0(callid, ENOTSUP); 612 611 return; 613 612 } … … 627 626 1, USB_MAX_PAYLOAD_SIZE, 0, &setup_packet_len); 628 627 if (rc != EOK) { 629 ipc_answer_0(callid, rc);628 async_answer_0(callid, rc); 630 629 return; 631 630 } … … 633 632 async_transaction_t *trans = async_transaction_create(callid); 634 633 if (trans == NULL) { 635 ipc_answer_0(callid, ENOMEM);634 async_answer_0(callid, ENOMEM); 636 635 free(setup_packet); 637 636 return; … … 641 640 trans->buffer = malloc(data_len); 642 641 if (trans->buffer == NULL) { 643 ipc_answer_0(callid, ENOMEM);642 async_answer_0(callid, ENOMEM); 644 643 async_transaction_destroy(trans); 645 644 return; … … 652 651 653 652 if (rc != EOK) { 654 ipc_answer_0(callid, rc);653 async_answer_0(callid, rc); 655 654 async_transaction_destroy(trans); 656 655 }
Note:
See TracChangeset
for help on using the changeset viewer.