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

Changeset bbce2c2 in mainline


Ignore:
Timestamp:
2011-09-14T20:27:33Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
f58ef61
Parents:
bdd8ad2f
Message:

usb: Remove unused iface functions, rename DATA_READ/DATA_WRITE ⇒ READ/WRITE

Location:
uspace/lib
Files:
3 edited

Legend:

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

    rbdd8ad2f rbbce2c2  
    4848static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    4949static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    50 static void remote_usbhc_control_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    51 static void remote_usbhc_control_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    52 static void remote_usbhc_data_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    53 static void remote_usbhc_data_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     50static void remote_usbhc_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     51static void remote_usbhc_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5452//static void remote_usbhc(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5553
     
    6462        [IPC_M_USBHC_UNREGISTER_ENDPOINT] = remote_usbhc_unregister_endpoint,
    6563
    66         [IPC_M_USBHC_CONTROL_WRITE] = remote_usbhc_control_write,
    67         [IPC_M_USBHC_CONTROL_READ] = remote_usbhc_control_read,
    68 
    69         [IPC_M_USBHC_DATA_READ] = remote_usbhc_data_read,
    70         [IPC_M_USBHC_DATA_WRITE] = remote_usbhc_data_write,
     64        [IPC_M_USBHC_READ] = remote_usbhc_read,
     65        [IPC_M_USBHC_WRITE] = remote_usbhc_write,
    7166};
    7267
     
    226221        async_transaction_destroy(trans);
    227222}
    228 
    229 void remote_usbhc_control_write(ddf_fun_t *fun, void *iface,
    230 ipc_callid_t callid, ipc_call_t *call)
    231 {
    232         assert(false);
    233         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    234         assert(usb_iface != NULL);
    235 
    236         if (!usb_iface->write) {
    237                 async_answer_0(callid, ENOTSUP);
    238                 return;
    239         }
    240 
    241         const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) };
    242         size_t data_buffer_len = DEV_IPC_GET_ARG2(*call);
    243 
    244         int rc;
    245 
    246         void *setup_packet = NULL;
    247         void *data_buffer = NULL;
    248         size_t setup_packet_len = 0;
    249 
    250         rc = async_data_write_accept(&setup_packet, false,
    251             1, USB_MAX_PAYLOAD_SIZE, 0, &setup_packet_len);
    252         if (rc != EOK) {
    253                 async_answer_0(callid, rc);
    254                 return;
    255         }
    256 
    257         if (data_buffer_len > 0) {
    258                 rc = async_data_write_accept(&data_buffer, false,
    259                     1, USB_MAX_PAYLOAD_SIZE, 0, &data_buffer_len);
    260                 if (rc != EOK) {
    261                         async_answer_0(callid, rc);
    262                         free(setup_packet);
    263                         return;
    264                 }
    265         }
    266 
    267         async_transaction_t *trans = async_transaction_create(callid);
    268         if (trans == NULL) {
    269                 async_answer_0(callid, ENOMEM);
    270                 free(setup_packet);
    271                 free(data_buffer);
    272                 return;
    273         }
    274         trans->buffer = data_buffer;
    275         trans->size = data_buffer_len;
    276 
    277         assert(setup_packet_len == 8);
    278         uint64_t setup_buffer;
    279         memcpy(&setup_buffer, setup_packet, 8);
    280         free(setup_packet);
    281         rc = usb_iface->write(fun, target, setup_buffer, trans->buffer,
    282             trans->size, callback_out, trans);
    283 
    284         if (rc != EOK) {
    285                 async_answer_0(callid, rc);
    286                 async_transaction_destroy(trans);
    287         }
    288 }
    289 
    290 
    291 void remote_usbhc_control_read(ddf_fun_t *fun, void *iface,
    292 ipc_callid_t callid, ipc_call_t *call)
    293 {
    294         assert(false);
    295         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    296         assert(usb_iface != NULL);
    297 
    298         if (!usb_iface->read) {
    299                 async_answer_0(callid, ENOTSUP);
    300                 return;
    301         }
    302 
    303         const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) };
    304 
    305         int rc;
    306 
    307         void *setup_packet = NULL;
    308         size_t setup_packet_len = 0;
    309         size_t data_len = 0;
    310 
    311         rc = async_data_write_accept(&setup_packet, false,
    312             1, USB_MAX_PAYLOAD_SIZE, 0, &setup_packet_len);
    313         if (rc != EOK) {
    314                 async_answer_0(callid, rc);
    315                 return;
    316         }
    317 
    318         ipc_callid_t data_callid;
    319         if (!async_data_read_receive(&data_callid, &data_len)) {
    320                 async_answer_0(callid, EPARTY);
    321                 free(setup_packet);
    322                 return;
    323         }
    324 
    325         async_transaction_t *trans = async_transaction_create(callid);
    326         if (trans == NULL) {
    327                 async_answer_0(data_callid, ENOMEM);
    328                 async_answer_0(callid, ENOMEM);
    329                 free(setup_packet);
    330                 return;
    331         }
    332         trans->data_caller = data_callid;
    333         trans->size = data_len;
    334         trans->buffer = malloc(data_len);
    335         if (trans->buffer == NULL) {
    336                 async_answer_0(data_callid, ENOMEM);
    337                 async_answer_0(callid, ENOMEM);
    338                 async_transaction_destroy(trans);
    339                 return;
    340         }
    341 
    342         assert(setup_packet_len == 8);
    343         uint64_t setup_buffer;
    344         memcpy(&setup_buffer, setup_packet, 8);
    345         free(setup_packet);
    346         rc = usb_iface->read(fun, target, setup_buffer, trans->buffer,
    347             trans->size, callback_in, trans);
    348         if (rc != EOK) {
    349                 async_answer_0(data_callid, rc);
    350                 async_answer_0(callid, rc);
    351                 async_transaction_destroy(trans);
    352         }
    353 }
    354 
    355223
    356224void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
     
    396264}
    397265
    398 
    399266void remote_usbhc_unregister_endpoint(ddf_fun_t *fun, void *iface,
    400267    ipc_callid_t callid, ipc_call_t *call)
     
    417284}
    418285
    419 static void remote_usbhc_data_read(
     286void remote_usbhc_read(
    420287    ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
    421288{
     
    464331}
    465332
    466 static void remote_usbhc_data_write(
     333void remote_usbhc_write(
    467334    ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
    468335{
  • uspace/lib/drv/include/usbhc_iface.h

    rbdd8ad2f rbbce2c2  
    150150        IPC_M_USBHC_UNREGISTER_ENDPOINT,
    151151
    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 
    168152        /** Get data from device.
    169153         * See explanation at usb_iface_funcs_t (IN transaction).
    170154         */
    171         IPC_M_USBHC_DATA_READ,
     155        IPC_M_USBHC_READ,
    172156
    173157        /** Send data to device.
    174158         * See explanation at usb_iface_funcs_t (OUT transaction).
    175159         */
    176         IPC_M_USBHC_DATA_WRITE,
     160        IPC_M_USBHC_WRITE,
    177161} usbhc_iface_funcs_t;
    178162
    179163/** Callback for outgoing transfer. */
    180 typedef void (*usbhc_iface_transfer_out_callback_t)(ddf_fun_t *,
    181     int, void *);
     164typedef void (*usbhc_iface_transfer_out_callback_t)(ddf_fun_t *, int, void *);
    182165
    183166/** Callback for incoming transfer. */
  • uspace/lib/usbdev/src/pipesio.c

    rbdd8ad2f rbbce2c2  
    8181         */
    8282        aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    83             IPC_M_USBHC_DATA_READ, target.packed, NULL);
     83            IPC_M_USBHC_READ, target.packed, NULL);
    8484       
    8585        if (opening_request == 0) {
     
    220220         */
    221221        aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    222             IPC_M_USBHC_DATA_WRITE, target.packed, size, NULL);
     222            IPC_M_USBHC_WRITE, target.packed, size, NULL);
    223223       
    224224        if (opening_request == 0) {
     
    345345        async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
    346346        aid_t opening_request = async_send_4(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    347             IPC_M_USBHC_DATA_READ, target.packed,
     347            IPC_M_USBHC_READ, target.packed,
    348348            (setup_packet & UINT32_MAX), (setup_packet >> 32), NULL);
    349349
     
    486486        async_exch_t *exch = async_exchange_begin(pipe->hc_sess);
    487487        aid_t opening_request = async_send_5(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    488             IPC_M_USBHC_DATA_WRITE, target.packed, data_buffer_size,
     488            IPC_M_USBHC_WRITE, target.packed, data_buffer_size,
    489489            (setup_packet & UINT32_MAX), (setup_packet >> 32), NULL);
    490490       
Note: See TracChangeset for help on using the changeset viewer.