Ignore:
Timestamp:
2011-02-18T20:22:08Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
423e8c81, 6edc69a, fbf0589
Parents:
b6c7da6 (diff), b36e5de2 (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.
Message:

Merged removals of old API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    rb6c7da6 r374552ef  
    4646static void remote_usbhc_interrupt_out(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4747static void remote_usbhc_interrupt_in(device_t *, void *, ipc_callid_t, ipc_call_t *);
    48 static void remote_usbhc_control_write_setup(device_t *, void *, ipc_callid_t, ipc_call_t *);
    49 static void remote_usbhc_control_write_data(device_t *, void *, ipc_callid_t, ipc_call_t *);
    50 static void remote_usbhc_control_write_status(device_t *, void *, ipc_callid_t, ipc_call_t *);
    51 static void remote_usbhc_control_read_setup(device_t *, void *, ipc_callid_t, ipc_call_t *);
    52 static void remote_usbhc_control_read_data(device_t *, void *, ipc_callid_t, ipc_call_t *);
    53 static void remote_usbhc_control_read_status(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5448static void remote_usbhc_control_write(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5549static void remote_usbhc_control_read(device_t *, void *, ipc_callid_t, ipc_call_t *);
     
    7569        remote_usbhc_interrupt_in,
    7670
    77         remote_usbhc_control_write_setup,
    78         remote_usbhc_control_write_data,
    79         remote_usbhc_control_write_status,
    80 
    81         remote_usbhc_control_read_setup,
    82         remote_usbhc_control_read_data,
    83         remote_usbhc_control_read_status,
    84 
    8571        remote_usbhc_control_write,
    8672        remote_usbhc_control_read
     
    297283        }
    298284
    299         size_t expected_len = DEV_IPC_GET_ARG3(*call);
     285        size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    300286        usb_target_t target = {
    301287                .address = DEV_IPC_GET_ARG1(*call),
     
    305291        size_t len = 0;
    306292        void *buffer = NULL;
    307         if (expected_len > 0) {
    308                 int rc = async_data_write_accept(&buffer, false,
    309                     1, USB_MAX_PAYLOAD_SIZE,
    310                     0, &len);
    311 
    312                 if (rc != EOK) {
    313                         async_answer_0(callid, rc);
    314                         return;
    315                 }
     293
     294        int rc = async_data_write_accept(&buffer, false,
     295            1, USB_MAX_PAYLOAD_SIZE,
     296            0, &len);
     297
     298        if (rc != EOK) {
     299                async_answer_0(callid, rc);
     300                return;
    316301        }
    317302
     
    328313        trans->size = len;
    329314
    330         int rc = transfer_func(device, target, HACK_MAX_PACKET_SIZE,
     315        rc = transfer_func(device, target, max_packet_size,
    331316            buffer, len,
    332317            callback_out, trans);
     
    354339        }
    355340
    356         size_t len = DEV_IPC_GET_ARG3(*call);
     341        size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    357342        usb_target_t target = {
    358343                .address = DEV_IPC_GET_ARG1(*call),
     
    360345        };
    361346
     347        size_t len;
    362348        ipc_callid_t data_callid;
    363349        if (!async_data_read_receive(&data_callid, &len)) {
     
    375361        trans->size = len;
    376362
    377         int rc = transfer_func(device, target, HACK_MAX_PACKET_SIZE_INTERRUPT_IN,
     363        int rc = transfer_func(device, target, max_packet_size,
    378364            trans->buffer, len,
    379365            callback_in, trans);
     
    385371}
    386372
    387 /** Process status part of control transfer.
    388  *
    389  * @param device Target device.
    390  * @param callid Initiating caller.
    391  * @param call Initiating call.
    392  * @param direction Transfer direction (read ~ in, write ~ out).
    393  * @param transfer_in_func Transfer function for control read (might be NULL).
    394  * @param transfer_out_func Transfer function for control write (might be NULL).
    395  */
    396 static void remote_usbhc_status_transfer(device_t *device,
    397     ipc_callid_t callid, ipc_call_t *call,
    398     usb_direction_t direction,
    399     int (*transfer_in_func)(device_t *, usb_target_t,
    400         usbhc_iface_transfer_in_callback_t, void *),
    401     int (*transfer_out_func)(device_t *, usb_target_t,
    402         usbhc_iface_transfer_out_callback_t, void *))
    403 {
    404         switch (direction) {
    405                 case USB_DIRECTION_IN:
    406                         if (!transfer_in_func) {
    407                                 async_answer_0(callid, ENOTSUP);
    408                                 return;
    409                         }
    410                         break;
    411                 case USB_DIRECTION_OUT:
    412                         if (!transfer_out_func) {
    413                                 async_answer_0(callid, ENOTSUP);
    414                                 return;
    415                         }
    416                         break;
    417                 default:
    418                         assert(false && "unreachable code");
    419                         break;
    420         }
    421 
    422         usb_target_t target = {
    423                 .address = DEV_IPC_GET_ARG1(*call),
    424                 .endpoint = DEV_IPC_GET_ARG2(*call)
    425         };
    426 
    427         async_transaction_t *trans = async_transaction_create(callid);
    428         if (trans == NULL) {
    429                 async_answer_0(callid, ENOMEM);
    430                 return;
    431         }
    432 
    433         int rc;
    434         switch (direction) {
    435                 case USB_DIRECTION_IN:
    436                         rc = transfer_in_func(device, target,
    437                             callback_in, trans);
    438                         break;
    439                 case USB_DIRECTION_OUT:
    440                         rc = transfer_out_func(device, target,
    441                             callback_out, trans);
    442                         break;
    443                 default:
    444                         assert(false && "unreachable code");
    445                         break;
    446         }
    447 
    448         if (rc != EOK) {
    449                 async_answer_0(callid, rc);
    450                 async_transaction_destroy(trans);
    451         }
    452 }
    453 
    454 
    455373void remote_usbhc_interrupt_out(device_t *device, void *iface,
    456374    ipc_callid_t callid, ipc_call_t *call)
     
    471389        return remote_usbhc_in_transfer(device, callid, call,
    472390            usb_iface->interrupt_in);
    473 }
    474 
    475 void remote_usbhc_control_write_setup(device_t *device, void *iface,
    476     ipc_callid_t callid, ipc_call_t *call)
    477 {
    478         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    479         assert(usb_iface != NULL);
    480 
    481         return remote_usbhc_out_transfer(device, callid, call,
    482             usb_iface->control_write_setup);
    483 }
    484 
    485 void remote_usbhc_control_write_data(device_t *device, void *iface,
    486     ipc_callid_t callid, ipc_call_t *call)
    487 {
    488         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    489         assert(usb_iface != NULL);
    490 
    491         return remote_usbhc_out_transfer(device, callid, call,
    492             usb_iface->control_write_data);
    493 }
    494 
    495 void remote_usbhc_control_write_status(device_t *device, void *iface,
    496     ipc_callid_t callid, ipc_call_t *call)
    497 {
    498         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    499         assert(usb_iface != NULL);
    500 
    501         return remote_usbhc_status_transfer(device, callid, call,
    502             USB_DIRECTION_IN, usb_iface->control_write_status, NULL);
    503 }
    504 
    505 void remote_usbhc_control_read_setup(device_t *device, void *iface,
    506     ipc_callid_t callid, ipc_call_t *call)
    507 {
    508         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    509         assert(usb_iface != NULL);
    510 
    511         return remote_usbhc_out_transfer(device, callid, call,
    512             usb_iface->control_read_setup);
    513 }
    514 
    515 void remote_usbhc_control_read_data(device_t *device, void *iface,
    516             ipc_callid_t callid, ipc_call_t *call)
    517 {
    518         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    519         assert(usb_iface != NULL);
    520 
    521         return remote_usbhc_in_transfer(device, callid, call,
    522             usb_iface->control_read_data);
    523 }
    524 
    525 void remote_usbhc_control_read_status(device_t *device, void *iface,
    526             ipc_callid_t callid, ipc_call_t *call)
    527 {
    528         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    529         assert(usb_iface != NULL);
    530 
    531         return remote_usbhc_status_transfer(device, callid, call,
    532             USB_DIRECTION_OUT, NULL, usb_iface->control_read_status);
    533391}
    534392
     
    549407        };
    550408        size_t data_buffer_len = DEV_IPC_GET_ARG3(*call);
     409        size_t max_packet_size = DEV_IPC_GET_ARG4(*call);
    551410
    552411        int rc;
     
    584443        trans->size = data_buffer_len;
    585444
    586         rc = usb_iface->control_write(device, target, HACK_MAX_PACKET_SIZE,
     445        rc = usb_iface->control_write(device, target, max_packet_size,
    587446            setup_packet, setup_packet_len,
    588447            data_buffer, data_buffer_len,
     
    611470                .endpoint = DEV_IPC_GET_ARG2(*call)
    612471        };
     472        size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    613473
    614474        int rc;
     
    648508        }
    649509
    650         rc = usb_iface->control_read(device, target, HACK_MAX_PACKET_SIZE,
     510        rc = usb_iface->control_read(device, target, max_packet_size,
    651511            setup_packet, setup_packet_len,
    652512            trans->buffer, trans->size,
Note: See TracChangeset for help on using the changeset viewer.