Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 1e647c7d in mainline


Ignore:
Timestamp:
2011-09-13T14:24:16Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
5d915b7
Parents:
e3f6304
Message:

usb: remove unused functions

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

    re3f6304 r1e647c7d  
    123123        IPC_M_USBHC_RELEASE_ADDRESS,
    124124
    125 
    126         /** Send interrupt data to device.
    127          * See explanation at usb_iface_funcs_t (OUT transaction).
    128          */
    129         IPC_M_USBHC_INTERRUPT_OUT,
    130 
    131         /** Get interrupt data from device.
    132          * See explanation at usb_iface_funcs_t (IN transaction).
    133          */
    134         IPC_M_USBHC_INTERRUPT_IN,
    135 
    136         /** Send bulk data to device.
    137          * See explanation at usb_iface_funcs_t (OUT transaction).
    138          */
    139         IPC_M_USBHC_BULK_OUT,
    140 
    141         /** Get bulk data from device.
    142          * See explanation at usb_iface_funcs_t (IN transaction).
    143          */
    144         IPC_M_USBHC_BULK_IN,
    145 
    146         /** Issue control WRITE transfer.
    147          * See explanation at usb_iface_funcs_t (OUT transaction) for
    148          * call parameters.
    149          * This call is immediately followed by two IPC data writes
    150          * from the caller (setup packet and actual data).
    151          */
    152         IPC_M_USBHC_CONTROL_WRITE,
    153 
    154         /** Issue control READ transfer.
    155          * See explanation at usb_iface_funcs_t (IN transaction) for
    156          * call parameters.
    157          * This call is immediately followed by IPC data write from the caller
    158          * (setup packet) and IPC data read (buffer that was read).
    159          */
    160         IPC_M_USBHC_CONTROL_READ,
    161 
    162125        /** Register endpoint attributes at host controller.
    163126         * This is used to reserve portion of USB bandwidth.
     
    187150        IPC_M_USBHC_UNREGISTER_ENDPOINT,
    188151
     152        /** Issue control WRITE transfer.
     153         * See explanation at usb_iface_funcs_t (OUT transaction) for
     154         * call parameters.
     155         * This call is immediately followed by two IPC data writes
     156         * from the caller (setup packet and actual data).
     157         */
     158        IPC_M_USBHC_CONTROL_WRITE,
     159
     160        /** Issue control READ transfer.
     161         * See explanation at usb_iface_funcs_t (IN transaction) for
     162         * call parameters.
     163         * This call is immediately followed by IPC data write from the caller
     164         * (setup packet) and IPC data read (buffer that was read).
     165         */
     166        IPC_M_USBHC_CONTROL_READ,
     167
     168        /** Get data from device.
     169         * See explanation at usb_iface_funcs_t (IN transaction).
     170         */
    189171        IPC_M_USBHC_DATA_READ,
    190172
     173        /** Send data to device.
     174         * See explanation at usb_iface_funcs_t (OUT transaction).
     175         */
    191176        IPC_M_USBHC_DATA_WRITE,
    192177} usbhc_iface_funcs_t;
     
    199184typedef void (*usbhc_iface_transfer_in_callback_t)(ddf_fun_t *,
    200185    int, size_t, void *);
    201 
    202 
    203 /** Out transfer processing function prototype. */
    204 typedef int (*usbhc_iface_transfer_out_t)(ddf_fun_t *, usb_target_t,
    205     void *, size_t,
    206     usbhc_iface_transfer_out_callback_t, void *);
    207 
    208 /** Setup transfer processing function prototype. @deprecated */
    209 typedef usbhc_iface_transfer_out_t usbhc_iface_transfer_setup_t;
    210 
    211 /** In transfer processing function prototype. */
    212 typedef int (*usbhc_iface_transfer_in_t)(ddf_fun_t *, usb_target_t,
    213     void *, size_t,
    214     usbhc_iface_transfer_in_callback_t, void *);
    215186
    216187/** USB host controller communication interface. */
     
    227198            usb_direction_t);
    228199
    229         usbhc_iface_transfer_out_t interrupt_out;
    230         usbhc_iface_transfer_in_t interrupt_in;
    231 
    232         usbhc_iface_transfer_out_t bulk_out;
    233         usbhc_iface_transfer_in_t bulk_in;
    234 
    235         int (*control_write)(ddf_fun_t *, usb_target_t,
    236             void *, size_t, void *, size_t,
    237             usbhc_iface_transfer_out_callback_t, void *);
    238 
    239         int (*control_read)(ddf_fun_t *, usb_target_t,
    240             void *, size_t, void *, size_t,
    241             usbhc_iface_transfer_in_callback_t, void *);
    242 
    243200        int (*read)(ddf_fun_t *, usb_target_t, uint64_t, uint8_t *, size_t,
    244201            usbhc_iface_transfer_in_callback_t, void *);
  • uspace/lib/usbhost/src/iface.c

    re3f6304 r1e647c7d  
    221221}
    222222/*----------------------------------------------------------------------------*/
    223 /** Interrupt out transaction interface function
    224  *
    225  * @param[in] fun DDF function that was called.
    226  * @param[in] target USB device to write to.
    227  * @param[in] data Source of data.
    228  * @param[in] size Size of data source.
    229  * @param[in] callback Function to call on transaction completion
    230  * @param[in] arg Additional for callback function.
    231  * @return Error code.
    232  */
    233 static int interrupt_out(
    234     ddf_fun_t *fun, usb_target_t target, void *data,
    235     size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg)
    236 {
    237         return send_batch(fun, target, USB_DIRECTION_OUT, data, size,
    238             0, NULL, callback, arg, "Interrupt OUT");
    239 }
    240 /*----------------------------------------------------------------------------*/
    241 /** Interrupt in transaction interface function
    242  *
    243  * @param[in] fun DDF function that was called.
    244  * @param[in] target USB device to write to.
    245  * @param[out] data Data destination.
    246  * @param[in] size Size of data source.
    247  * @param[in] callback Function to call on transaction completion
    248  * @param[in] arg Additional for callback function.
    249  * @return Error code.
    250  */
    251 static int interrupt_in(
    252     ddf_fun_t *fun, usb_target_t target, void *data,
    253     size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg)
    254 {
    255         return send_batch(fun, target, USB_DIRECTION_IN, data, size,
    256             0, callback, NULL, arg, "Interrupt IN");
    257 }
    258 /*----------------------------------------------------------------------------*/
    259 /** Bulk out transaction interface function
    260  *
    261  * @param[in] fun DDF function that was called.
    262  * @param[in] target USB device to write to.
    263  * @param[in] data Source of data.
    264  * @param[in] size Size of data source.
    265  * @param[in] callback Function to call on transaction completion
    266  * @param[in] arg Additional for callback function.
    267  * @return Error code.
    268  */
    269 static int bulk_out(
    270     ddf_fun_t *fun, usb_target_t target, void *data,
    271     size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg)
    272 {
    273         return send_batch(fun, target, USB_DIRECTION_OUT, data, size,
    274             0, NULL, callback, arg, "Bulk OUT");
    275 }
    276 /*----------------------------------------------------------------------------*/
    277 /** Bulk in transaction interface function
    278  *
    279  * @param[in] fun DDF function that was called.
    280  * @param[in] target USB device to write to.
    281  * @param[out] data Data destination.
    282  * @param[in] size Size of data source.
    283  * @param[in] callback Function to call on transaction completion
    284  * @param[in] arg Additional for callback function.
    285  * @return Error code.
    286  */
    287 static int bulk_in(
    288     ddf_fun_t *fun, usb_target_t target, void *data,
    289     size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg)
    290 {
    291         return send_batch(fun, target, USB_DIRECTION_IN, data, size,
    292             0, callback, NULL, arg, "Bulk IN");
    293 }
    294 /*----------------------------------------------------------------------------*/
    295 /** Control write transaction interface function
    296  *
    297  * @param[in] fun DDF function that was called.
    298  * @param[in] target USB device to write to.
    299  * @param[in] setup_data Data to send with SETUP transfer.
    300  * @param[in] setup_size Size of data to send with SETUP transfer (always 8B).
    301  * @param[in] data Source of data.
    302  * @param[in] size Size of data source.
    303  * @param[in] callback Function to call on transaction completion.
    304  * @param[in] arg Additional for callback function.
    305  * @return Error code.
    306  */
    307 static int control_write(
    308     ddf_fun_t *fun, usb_target_t target,
    309     void *setup_data, size_t setup_size, void *data, size_t size,
    310     usbhc_iface_transfer_out_callback_t callback, void *arg)
    311 {
    312         uint64_t setup_buffer;
    313         memcpy(&setup_buffer, setup_data, 8);
    314         return send_batch(fun, target, USB_DIRECTION_BOTH, data, size,
    315             setup_buffer, NULL, callback, arg, "Control WRITE");
    316 }
    317 /*----------------------------------------------------------------------------*/
    318 /** Control read transaction interface function
    319  *
    320  * @param[in] fun DDF function that was called.
    321  * @param[in] target USB device to write to.
    322  * @param[in] setup_data Data to send with SETUP packet.
    323  * @param[in] setup_size Size of data to send with SETUP packet (should be 8B).
    324  * @param[out] data Source of data.
    325  * @param[in] size Size of data source.
    326  * @param[in] callback Function to call on transaction completion.
    327  * @param[in] arg Additional for callback function.
    328  * @return Error code.
    329  */
    330 static int control_read(
    331     ddf_fun_t *fun, usb_target_t target,
    332     void *setup_data, size_t setup_size, void *data, size_t size,
    333     usbhc_iface_transfer_in_callback_t callback, void *arg)
    334 {
    335         uint64_t setup_buffer;
    336         memcpy(&setup_buffer, setup_data, 8);
    337         return send_batch(fun, target, USB_DIRECTION_BOTH, data, size,
    338             setup_buffer, callback, NULL, arg, "Control READ");
    339 }
    340 /*----------------------------------------------------------------------------*/
    341223static int usb_read(ddf_fun_t *fun, usb_target_t target, uint64_t setup_data,
    342224    uint8_t *data, size_t size, usbhc_iface_transfer_in_callback_t callback,
     
    364246        .unregister_endpoint = unregister_endpoint,
    365247
    366         .interrupt_out = interrupt_out,
    367         .interrupt_in = interrupt_in,
    368 
    369         .bulk_out = bulk_out,
    370         .bulk_in = bulk_in,
    371 
    372         .control_write = control_write,
    373         .control_read = control_read,
    374 
    375248        .read = usb_read,
    376249        .write = usb_write,
Note: See TracChangeset for help on using the changeset viewer.