Ignore:
Timestamp:
2011-09-13T14:24:16Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d915b7
Parents:
e3f6304
Message:

usb: remove unused functions

File:
1 edited

Legend:

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

    re3f6304 r1e647c7d  
    4242#define USB_MAX_PAYLOAD_SIZE 1020
    4343
    44 static void remote_usbhc_interrupt_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    45 static void remote_usbhc_interrupt_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    46 static void remote_usbhc_bulk_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    47 static void remote_usbhc_bulk_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    48 static void remote_usbhc_control_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    49 static void remote_usbhc_control_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5044static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5145static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    5448static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5549static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     50static void remote_usbhc_control_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     51static void remote_usbhc_control_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5652static void remote_usbhc_data_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5753static void remote_usbhc_data_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    6561        [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,
    6662
    67         [IPC_M_USBHC_INTERRUPT_OUT] = remote_usbhc_interrupt_out,
    68         [IPC_M_USBHC_INTERRUPT_IN] = remote_usbhc_interrupt_in,
    69 
    70         [IPC_M_USBHC_BULK_OUT] = remote_usbhc_bulk_out,
    71         [IPC_M_USBHC_BULK_IN] = remote_usbhc_bulk_in,
     63        [IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint,
     64        [IPC_M_USBHC_UNREGISTER_ENDPOINT] = remote_usbhc_unregister_endpoint,
    7265
    7366        [IPC_M_USBHC_CONTROL_WRITE] = remote_usbhc_control_write,
    7467        [IPC_M_USBHC_CONTROL_READ] = remote_usbhc_control_read,
    75 
    76         [IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint,
    77         [IPC_M_USBHC_UNREGISTER_ENDPOINT] = remote_usbhc_unregister_endpoint,
    7868
    7969        [IPC_M_USBHC_DATA_READ] = remote_usbhc_data_read,
     
    9383        ipc_callid_t data_caller;
    9484        void *buffer;
    95         void *setup_packet;
    9685        size_t size;
    9786} async_transaction_t;
     
    10190        if (trans == NULL) {
    10291                return;
    103         }
    104 
    105         if (trans->setup_packet != NULL) {
    106                 free(trans->setup_packet);
    10792        }
    10893        if (trans->buffer != NULL) {
     
    123108        trans->data_caller = 0;
    124109        trans->buffer = NULL;
    125         trans->setup_packet = NULL;
    126110        trans->size = 0;
    127111
     
    241225
    242226        async_transaction_destroy(trans);
    243 }
    244 
    245 /** Process an outgoing transfer (both OUT and SETUP).
    246  *
    247  * @param device Target device.
    248  * @param callid Initiating caller.
    249  * @param call Initiating call.
    250  * @param transfer_func Transfer function (might be NULL).
    251  */
    252 static void remote_usbhc_out_transfer(ddf_fun_t *fun,
    253     ipc_callid_t callid, ipc_call_t *call,
    254     usbhc_iface_transfer_out_t transfer_func)
    255 {
    256         if (!transfer_func) {
    257                 async_answer_0(callid, ENOTSUP);
    258                 return;
    259         }
    260 
    261         usb_target_t target = {
    262                 .address = DEV_IPC_GET_ARG1(*call),
    263                 .endpoint = DEV_IPC_GET_ARG2(*call)
    264         };
    265 
    266         size_t len = 0;
    267         void *buffer = NULL;
    268 
    269         int rc = async_data_write_accept(&buffer, false,
    270             1, USB_MAX_PAYLOAD_SIZE,
    271             0, &len);
    272 
    273         if (rc != EOK) {
    274                 async_answer_0(callid, rc);
    275                 return;
    276         }
    277 
    278         async_transaction_t *trans = async_transaction_create(callid);
    279         if (trans == NULL) {
    280                 if (buffer != NULL) {
    281                         free(buffer);
    282                 }
    283                 async_answer_0(callid, ENOMEM);
    284                 return;
    285         }
    286 
    287         trans->buffer = buffer;
    288         trans->size = len;
    289 
    290         rc = transfer_func(fun, target,
    291             buffer, len,
    292             callback_out, trans);
    293 
    294         if (rc != EOK) {
    295                 async_answer_0(callid, rc);
    296                 async_transaction_destroy(trans);
    297         }
    298 }
    299 
    300 /** Process an incoming transfer.
    301  *
    302  * @param device Target device.
    303  * @param callid Initiating caller.
    304  * @param call Initiating call.
    305  * @param transfer_func Transfer function (might be NULL).
    306  */
    307 static void remote_usbhc_in_transfer(ddf_fun_t *fun,
    308     ipc_callid_t callid, ipc_call_t *call,
    309     usbhc_iface_transfer_in_t transfer_func)
    310 {
    311         if (!transfer_func) {
    312                 async_answer_0(callid, ENOTSUP);
    313                 return;
    314         }
    315 
    316         usb_target_t target = {
    317                 .address = DEV_IPC_GET_ARG1(*call),
    318                 .endpoint = DEV_IPC_GET_ARG2(*call)
    319         };
    320 
    321         size_t len;
    322         ipc_callid_t data_callid;
    323         if (!async_data_read_receive(&data_callid, &len)) {
    324                 async_answer_0(callid, EPARTY);
    325                 return;
    326         }
    327 
    328         async_transaction_t *trans = async_transaction_create(callid);
    329         if (trans == NULL) {
    330                 async_answer_0(data_callid, ENOMEM);
    331                 async_answer_0(callid, ENOMEM);
    332                 return;
    333         }
    334         trans->data_caller = data_callid;
    335         trans->buffer = malloc(len);
    336         trans->size = len;
    337 
    338         int rc = transfer_func(fun, target,
    339             trans->buffer, len,
    340             callback_in, trans);
    341 
    342         if (rc != EOK) {
    343                 async_answer_0(data_callid, rc);
    344                 async_answer_0(callid, rc);
    345                 async_transaction_destroy(trans);
    346         }
    347 }
    348 
    349 void remote_usbhc_interrupt_out(ddf_fun_t *fun, void *iface,
    350     ipc_callid_t callid, ipc_call_t *call)
    351 {
    352         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    353         assert(usb_iface != NULL);
    354 
    355         return remote_usbhc_out_transfer(fun, callid, call,
    356             usb_iface->interrupt_out);
    357 }
    358 
    359 void remote_usbhc_interrupt_in(ddf_fun_t *fun, void *iface,
    360     ipc_callid_t callid, ipc_call_t *call)
    361 {
    362         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    363         assert(usb_iface != NULL);
    364 
    365         return remote_usbhc_in_transfer(fun, callid, call,
    366             usb_iface->interrupt_in);
    367 }
    368 
    369 void remote_usbhc_bulk_out(ddf_fun_t *fun, void *iface,
    370     ipc_callid_t callid, ipc_call_t *call)
    371 {
    372         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    373         assert(usb_iface != NULL);
    374 
    375         return remote_usbhc_out_transfer(fun, callid, call,
    376             usb_iface->bulk_out);
    377 }
    378 
    379 void remote_usbhc_bulk_in(ddf_fun_t *fun, void *iface,
    380     ipc_callid_t callid, ipc_call_t *call)
    381 {
    382         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    383         assert(usb_iface != NULL);
    384 
    385         return remote_usbhc_in_transfer(fun, callid, call,
    386             usb_iface->bulk_in);
    387227}
    388228
Note: See TracChangeset for help on using the changeset viewer.