Ignore:
Timestamp:
2011-04-17T19:17:55Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63517c2, cfbbe1d3
Parents:
ef354b6 (diff), 8595577b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

new report structure fixes

File:
1 edited

Legend:

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

    ref354b6 re50cd7f  
    5050static void remote_usbhc_control_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5151static void remote_usbhc_control_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    52 static void remote_usbhc_reserve_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    53 static void remote_usbhc_release_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5452static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5553static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    6159/** Remote USB host controller interface operations. */
    6260static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = {
    63         remote_usbhc_reserve_default_address,
    64         remote_usbhc_release_default_address,
    65 
    6661        remote_usbhc_request_address,
    6762        remote_usbhc_bind_address,
     
    129124}
    130125
    131 void remote_usbhc_reserve_default_address(ddf_fun_t *fun, void *iface,
    132     ipc_callid_t callid, ipc_call_t *call)
    133 {
    134         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    135 
    136         if (!usb_iface->reserve_default_address) {
    137                 async_answer_0(callid, ENOTSUP);
    138                 return;
    139         }
    140        
    141         usb_speed_t speed = DEV_IPC_GET_ARG1(*call);
    142        
    143         int rc = usb_iface->reserve_default_address(fun, speed);
    144 
    145         async_answer_0(callid, rc);
    146 }
    147 
    148 void remote_usbhc_release_default_address(ddf_fun_t *fun, void *iface,
    149     ipc_callid_t callid, ipc_call_t *call)
    150 {
    151         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    152 
    153         if (!usb_iface->release_default_address) {
    154                 async_answer_0(callid, ENOTSUP);
    155                 return;
    156         }
    157 
    158         int rc = usb_iface->release_default_address(fun);
    159 
    160         async_answer_0(callid, rc);
    161 }
    162 
    163126void remote_usbhc_request_address(ddf_fun_t *fun, void *iface,
    164127    ipc_callid_t callid, ipc_call_t *call)
     
    270233        }
    271234
    272         size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    273235        usb_target_t target = {
    274236                .address = DEV_IPC_GET_ARG1(*call),
     
    300262        trans->size = len;
    301263
    302         rc = transfer_func(fun, target, max_packet_size,
     264        rc = transfer_func(fun, target,
    303265            buffer, len,
    304266            callback_out, trans);
     
    326288        }
    327289
    328         size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    329290        usb_target_t target = {
    330291                .address = DEV_IPC_GET_ARG1(*call),
     
    348309        trans->size = len;
    349310
    350         int rc = transfer_func(fun, target, max_packet_size,
     311        int rc = transfer_func(fun, target,
    351312            trans->buffer, len,
    352313            callback_in, trans);
     
    414375        };
    415376        size_t data_buffer_len = DEV_IPC_GET_ARG3(*call);
    416         size_t max_packet_size = DEV_IPC_GET_ARG4(*call);
    417377
    418378        int rc;
     
    450410        trans->size = data_buffer_len;
    451411
    452         rc = usb_iface->control_write(fun, target, max_packet_size,
     412        rc = usb_iface->control_write(fun, target,
    453413            setup_packet, setup_packet_len,
    454414            data_buffer, data_buffer_len,
     
    477437                .endpoint = DEV_IPC_GET_ARG2(*call)
    478438        };
    479         size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    480439
    481440        int rc;
     
    515474        }
    516475
    517         rc = usb_iface->control_read(fun, target, max_packet_size,
     476        rc = usb_iface->control_read(fun, target,
    518477            setup_packet, setup_packet_len,
    519478            trans->buffer, trans->size,
     
    537496        }
    538497
    539 #define INIT_FROM_HIGH_DATA(type, var, arg_no) \
    540         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / 256
    541 #define INIT_FROM_LOW_DATA(type, var, arg_no) \
    542         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % 256
    543 
    544         INIT_FROM_HIGH_DATA(usb_address_t, address, 1);
    545         INIT_FROM_LOW_DATA(usb_endpoint_t, endpoint, 1);
    546         INIT_FROM_HIGH_DATA(usb_transfer_type_t, transfer_type, 2);
    547         INIT_FROM_LOW_DATA(usb_direction_t, direction, 2);
    548 
    549 #undef INIT_FROM_HIGH_DATA
    550 #undef INIT_FROM_LOW_DATA
    551 
    552         size_t max_packet_size = (size_t) DEV_IPC_GET_ARG3(*call);
    553         unsigned int interval  = (unsigned int) DEV_IPC_GET_ARG4(*call);
    554 
    555         int rc = usb_iface->register_endpoint(fun, address, endpoint,
     498#define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \
     499        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
     500#define _INIT_FROM_LOW_DATA2(type, var, arg_no) \
     501        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16)
     502#define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \
     503        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
     504#define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \
     505        type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8)
     506#define _INIT_FROM_LOW_DATA3(type, var, arg_no) \
     507        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8)
     508
     509        _INIT_FROM_HIGH_DATA2(usb_address_t, address, 1);
     510        _INIT_FROM_LOW_DATA2(usb_endpoint_t, endpoint, 1);
     511
     512        _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2);
     513        _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2);
     514        _INIT_FROM_LOW_DATA3(usb_direction_t, direction, 2);
     515
     516        _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3);
     517        _INIT_FROM_LOW_DATA2(unsigned int, interval, 3);
     518
     519#undef _INIT_FROM_HIGH_DATA2
     520#undef _INIT_FROM_LOW_DATA2
     521#undef _INIT_FROM_HIGH_DATA3
     522#undef _INIT_FROM_MIDDLE_DATA3
     523#undef _INIT_FROM_LOW_DATA3
     524
     525        int rc = usb_iface->register_endpoint(fun, address, speed, endpoint,
    556526            transfer_type, direction, max_packet_size, interval);
    557527
Note: See TracChangeset for help on using the changeset viewer.