Changeset 365e29e2 in mainline for uspace/lib/usbdev/src/pipesio.c


Ignore:
Timestamp:
2011-09-14T19:25:06Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bdd8ad2f
Parents:
56e9fb0
Message:

usb: Use new target packing scheme for IPC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/pipesio.c

    r56e9fb0 r365e29e2  
    6565    void *buffer, size_t size, size_t *size_transfered)
    6666{
    67         /*
    68          * Get corresponding IPC method.
    69          * In future, replace with static array of mappings
    70          * transfer type -> method.
    71          */
    72         usbhc_iface_funcs_t ipc_method;
    73         switch (pipe->transfer_type) {
    74                 case USB_TRANSFER_INTERRUPT:
    75                 case USB_TRANSFER_BULK:
    76                         ipc_method = IPC_M_USBHC_DATA_READ;
    77                         break;
    78                 default:
    79                         return ENOTSUP;
    80         }
     67        /* Only interrupt and bulk transfers are supported */
     68        if (pipe->transfer_type != USB_TRANSFER_INTERRUPT &&
     69            pipe->transfer_type != USB_TRANSFER_BULK)
     70            return ENOTSUP;
     71
     72        const usb_target_t target =
     73            {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
    8174       
    8275        /* Ensure serialization over the phone. */
     
    8780         * Make call identifying target USB device and type of transfer.
    8881         */
    89         aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    90             ipc_method, pipe->wire->address, pipe->endpoint_no, NULL);
     82        aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     83            IPC_M_USBHC_DATA_READ, target.packed, NULL);
    9184       
    9285        if (opening_request == 0) {
     
    211204    void *buffer, size_t size)
    212205{
    213         /*
    214          * Get corresponding IPC method.
    215          * In future, replace with static array of mappings
    216          * transfer type -> method.
    217          */
    218         usbhc_iface_funcs_t ipc_method;
    219         switch (pipe->transfer_type) {
    220                 case USB_TRANSFER_INTERRUPT:
    221                 case USB_TRANSFER_BULK:
    222                         ipc_method = IPC_M_USBHC_DATA_WRITE;
    223                         break;
    224                 default:
    225                         return ENOTSUP;
    226         }
     206        /* Only interrupt and bulk transfers are supported */
     207        if (pipe->transfer_type != USB_TRANSFER_INTERRUPT &&
     208            pipe->transfer_type != USB_TRANSFER_BULK)
     209            return ENOTSUP;
     210
     211        const usb_target_t target =
     212            {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
    227213
    228214        /* Ensure serialization over the phone. */
     
    233219         * Make call identifying target USB device and type of transfer.
    234220         */
    235         aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    236             ipc_method, pipe->wire->address, pipe->endpoint_no, NULL);
     221        aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     222            IPC_M_USBHC_DATA_WRITE, target.packed, NULL);
    237223       
    238224        if (opening_request == 0) {
     
    348334        pipe_start_transaction(pipe);
    349335
     336        const usb_target_t target =
     337            {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
     338
    350339        /*
    351340         * Make call identifying target USB device and control transfer type.
    352341         */
    353342        async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
    354         aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    355             IPC_M_USBHC_CONTROL_READ, pipe->wire->address, pipe->endpoint_no,
    356             NULL);
     343        aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     344            IPC_M_USBHC_CONTROL_READ, target.packed, NULL);
    357345       
    358346        if (opening_request == 0) {
     
    494482        pipe_start_transaction(pipe);
    495483
     484        const usb_target_t target =
     485            {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
     486
    496487        /*
    497488         * Make call identifying target USB device and control transfer type.
    498489         */
    499490        async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
    500         aid_t opening_request = async_send_4(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    501             IPC_M_USBHC_CONTROL_WRITE, pipe->wire->address, pipe->endpoint_no,
     491        aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     492            IPC_M_USBHC_CONTROL_WRITE, target.packed,
    502493            data_buffer_size, NULL);
    503494       
Note: See TracChangeset for help on using the changeset viewer.