Changeset 374552ef in mainline for uspace/lib/drv


Ignore:
Timestamp:
2011-02-18T20:22:08Z (14 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

Location:
uspace/lib/drv
Files:
2 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,
  • uspace/lib/drv/include/usbhc_iface.h

    rb6c7da6 r374552ef  
    5353 *   - argument #1 is target address
    5454 *   - argument #2 is target endpoint
    55  *   - argument #3 is buffer size
     55 *   - argument #3 is max packet size of the endpoint
    5656 * - this call is immediately followed by IPC data write (from caller)
    5757 * - the initial call (and the whole transaction) is answer after the
     
    6666 *   - argument #1 is target address
    6767 *   - argument #2 is target endpoint
    68  *   - argument #3 is buffer size
     68 *   - argument #3 is max packet size of the endpoint
    6969 * - this call is immediately followed by IPC data read (async version)
    7070 * - the call is not answered until the device returns some data (or until
     
    153153        IPC_M_USBHC_INTERRUPT_IN,
    154154
    155 
    156         /** Start WRITE control transfer.
    157          * See explanation at usb_iface_funcs_t (OUT transaction).
    158          */
    159         IPC_M_USBHC_CONTROL_WRITE_SETUP,
    160 
    161         /** Send control-transfer data to device.
    162          * See explanation at usb_iface_funcs_t (OUT transaction).
    163          */
    164         IPC_M_USBHC_CONTROL_WRITE_DATA,
    165 
    166         /** Terminate WRITE control transfer.
    167          * See explanation at usb_iface_funcs_t (NO-DATA transaction).
    168          */
    169         IPC_M_USBHC_CONTROL_WRITE_STATUS,
    170 
    171 
    172 
    173         /** Start READ control transfer.
    174          * See explanation at usb_iface_funcs_t (OUT transaction).
    175          */
    176         IPC_M_USBHC_CONTROL_READ_SETUP,
    177 
    178         /** Get control-transfer data from device.
    179          * See explanation at usb_iface_funcs_t (IN transaction).
    180          */
    181         IPC_M_USBHC_CONTROL_READ_DATA,
    182 
    183         /** Terminate READ control transfer.
    184          * See explanation at usb_iface_funcs_t (NO-DATA transaction).
    185          */
    186         IPC_M_USBHC_CONTROL_READ_STATUS,
    187 
    188155        /** Issue control WRITE transfer.
    189156         * See explanation at usb_iface_funcs_t (OUT transaction) for
     
    194161        IPC_M_USBHC_CONTROL_WRITE,
    195162
    196         /** Issue control WRITE transfer.
     163        /** Issue control READ transfer.
    197164         * See explanation at usb_iface_funcs_t (IN transaction) for
    198165         * call parameters.
    199          * This call is immediately followed by IPC data read from the caller
    200          * (setup packet).
    201          * Actual data are retrieved through IPC_M_USBHC_GET_BUFFER.
     166         * This call is immediately followed by IPC data write from the caller
     167         * (setup packet) and IPC data read (buffer that was read).
    202168         */
    203169        IPC_M_USBHC_CONTROL_READ,
     
    241207        usbhc_iface_transfer_in_t interrupt_in;
    242208
    243         usbhc_iface_transfer_setup_t control_write_setup;
    244         usbhc_iface_transfer_out_t control_write_data;
    245         int (*control_write_status)(device_t *, usb_target_t,
    246             usbhc_iface_transfer_in_callback_t, void *);
    247 
    248         usbhc_iface_transfer_setup_t control_read_setup;
    249         usbhc_iface_transfer_in_t control_read_data;
    250         int (*control_read_status)(device_t *, usb_target_t,
    251             usbhc_iface_transfer_out_callback_t, void *);
    252 
    253209        int (*control_write)(device_t *, usb_target_t,
    254210            size_t,
Note: See TracChangeset for help on using the changeset viewer.