Changeset aa9a53d in mainline


Ignore:
Timestamp:
2011-04-28T12:47:28Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e31b5c1
Parents:
6fd7062
Message:

Virtual USB: data out implemented

Stupid implementation, make everything interrupt type.

Will improve later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/src/ipc.c

    r6fd7062 raa9a53d  
    160160        usb_transfer_type_t transfer_type = IPC_GET_ARG2(*icall);
    161161
    162         usb_log_debug("ipc_interrupt_in(.%d, %s)\n",
    163             endpoint, usb_str_transfer_type_short(transfer_type));
    164 
    165162        int rc;
    166163
     
    198195    ipc_callid_t iid, ipc_call_t *icall)
    199196{
    200         printf("ipc_interrupt_out()\n");
    201         async_answer_0(iid, ENOTSUP);
     197        usb_endpoint_t endpoint = IPC_GET_ARG1(*icall);
     198        usb_transfer_type_t transfer_type = IPC_GET_ARG2(*icall);
     199
     200        void *data_buffer = NULL;
     201        size_t data_buffer_size = 0;
     202
     203        int rc = async_data_write_accept(&data_buffer, false,
     204            1, 1024, 0, &data_buffer_size);
     205        if (rc != EOK) {
     206                async_answer_0(iid, rc);
     207                return;
     208        }
     209
     210        rc = usbvirt_data_out(dev, transfer_type, endpoint,
     211            data_buffer, data_buffer_size);
     212
     213        async_answer_0(iid, rc);
     214
     215        free(data_buffer);
    202216}
    203217
     
    417431    usb_transfer_type_t tr_type, void *data, size_t data_size)
    418432{
    419         return ENOTSUP;
     433        aid_t opening_request = async_send_2(phone,
     434            IPC_M_USBVIRT_INTERRUPT_OUT, ep, tr_type, NULL);
     435        if (opening_request == 0) {
     436                return ENOMEM;
     437        }
     438
     439        int rc = async_data_write_start(phone,
     440            data, data_size);
     441        if (rc != EOK) {
     442                async_wait_for(opening_request, NULL);
     443                return rc;
     444        }
     445
     446        sysarg_t opening_request_rc;
     447        async_wait_for(opening_request, &opening_request_rc);
     448
     449        return (int) opening_request_rc;
    420450}
    421451
Note: See TracChangeset for help on using the changeset viewer.