Changeset 3b5d1535 in mainline for uspace/drv/vhc/connhost.c


Ignore:
Timestamp:
2011-02-23T10:28:21Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eb48f61
Parents:
e936e8e (diff), eb1a2f4 (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:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/connhost.c

    re936e8e r3b5d1535  
    4848        usbhc_iface_transfer_out_callback_t out_callback;
    4949        usbhc_iface_transfer_in_callback_t in_callback;
    50         device_t *dev;
     50        ddf_fun_t *fun;
    5151        size_t reported_size;
    5252        void *arg;
     
    5858        usbhc_iface_transfer_out_callback_t out_callback;
    5959        usbhc_iface_transfer_in_callback_t in_callback;
    60         device_t *dev;
     60        ddf_fun_t *fun;
    6161        void *arg;
    6262        void *data_buffer;
     
    7575        switch (transfer->direction) {
    7676                case USB_DIRECTION_IN:
    77                         transfer->in_callback(transfer->dev,
     77                        transfer->in_callback(transfer->fun,
    7878                            outcome, size,
    7979                            transfer->arg);
    8080                        break;
    8181                case USB_DIRECTION_OUT:
    82                         transfer->out_callback(transfer->dev,
     82                        transfer->out_callback(transfer->fun,
    8383                            outcome,
    8484                            transfer->arg);
     
    9292}
    9393
    94 static transfer_info_t *create_transfer_info(device_t *dev,
     94static transfer_info_t *create_transfer_info(ddf_fun_t *fun,
    9595    usb_direction_t direction, void *arg)
    9696{
     
    101101        transfer->out_callback = NULL;
    102102        transfer->arg = arg;
    103         transfer->dev = dev;
     103        transfer->fun = fun;
    104104        transfer->reported_size = (size_t) -1;
    105105
     
    112112        switch (transfer->direction) {
    113113                case USB_DIRECTION_IN:
    114                         transfer->in_callback(transfer->dev,
     114                        transfer->in_callback(transfer->fun,
    115115                            outcome, size,
    116116                            transfer->arg);
    117117                        break;
    118118                case USB_DIRECTION_OUT:
    119                         transfer->out_callback(transfer->dev,
     119                        transfer->out_callback(transfer->fun,
    120120                            outcome,
    121121                            transfer->arg);
     
    138138        }
    139139
    140         transfer_info_t *transfer  = create_transfer_info(ctrl_transfer->dev,
     140        transfer_info_t *transfer  = create_transfer_info(ctrl_transfer->fun,
    141141            ctrl_transfer->direction, ctrl_transfer->arg);
    142142        transfer->out_callback = ctrl_transfer->out_callback;
     
    195195}
    196196
    197 static control_transfer_info_t *create_control_transfer_info(device_t *dev,
     197static control_transfer_info_t *create_control_transfer_info(ddf_fun_t *fun,
    198198    usb_direction_t direction, usb_target_t target,
    199199    void *data_buffer, size_t data_buffer_size,
     
    208208        transfer->out_callback = NULL;
    209209        transfer->arg = arg;
    210         transfer->dev = dev;
     210        transfer->fun = fun;
    211211        transfer->data_buffer = data_buffer;
    212212        transfer->data_buffer_size = data_buffer_size;
     
    215215}
    216216
    217 static int enqueue_transfer_out(device_t *dev,
     217static int enqueue_transfer_out(ddf_fun_t *fun,
    218218    usb_target_t target, usb_transfer_type_t transfer_type,
    219219    void *buffer, size_t size,
     
    226226
    227227        transfer_info_t *transfer
    228             = create_transfer_info(dev, USB_DIRECTION_OUT, arg);
     228            = create_transfer_info(fun, USB_DIRECTION_OUT, arg);
    229229        transfer->out_callback = callback;
    230230
     
    235235}
    236236
    237 static int enqueue_transfer_in(device_t *dev,
     237static int enqueue_transfer_in(ddf_fun_t *fun,
    238238    usb_target_t target, usb_transfer_type_t transfer_type,
    239239    void *buffer, size_t size,
     
    246246
    247247        transfer_info_t *transfer
    248             = create_transfer_info(dev, USB_DIRECTION_IN, arg);
     248            = create_transfer_info(fun, USB_DIRECTION_IN, arg);
    249249        transfer->in_callback = callback;
    250250
     
    256256
    257257
    258 static int interrupt_out(device_t *dev, usb_target_t target,
     258static int interrupt_out(ddf_fun_t *fun, usb_target_t target,
    259259    size_t max_packet_size,
    260260    void *data, size_t size,
    261261    usbhc_iface_transfer_out_callback_t callback, void *arg)
    262262{
    263         return enqueue_transfer_out(dev, target, USB_TRANSFER_INTERRUPT,
     263        return enqueue_transfer_out(fun, target, USB_TRANSFER_INTERRUPT,
    264264            data, size,
    265265            callback, arg);
    266266}
    267267
    268 static int interrupt_in(device_t *dev, usb_target_t target,
     268static int interrupt_in(ddf_fun_t *fun, usb_target_t target,
    269269    size_t max_packet_size,
    270270    void *data, size_t size,
    271271    usbhc_iface_transfer_in_callback_t callback, void *arg)
    272272{
    273         return enqueue_transfer_in(dev, target, USB_TRANSFER_INTERRUPT,
     273        return enqueue_transfer_in(fun, target, USB_TRANSFER_INTERRUPT,
    274274            data, size,
    275275            callback, arg);
    276276}
    277277
    278 static int control_write(device_t *dev, usb_target_t target,
     278static int control_write(ddf_fun_t *fun, usb_target_t target,
    279279    size_t max_packet_size,
    280280    void *setup_packet, size_t setup_packet_size,
     
    283283{
    284284        control_transfer_info_t *transfer
    285             = create_control_transfer_info(dev, USB_DIRECTION_OUT, target,
     285            = create_control_transfer_info(fun, USB_DIRECTION_OUT, target,
    286286            data, data_size, arg);
    287287        transfer->out_callback = callback;
     
    294294}
    295295
    296 static int control_read(device_t *dev, usb_target_t target,
     296static int control_read(ddf_fun_t *fun, usb_target_t target,
    297297    size_t max_packet_size,
    298298    void *setup_packet, size_t setup_packet_size,
     
    301301{
    302302        control_transfer_info_t *transfer
    303             = create_control_transfer_info(dev, USB_DIRECTION_IN, target,
     303            = create_control_transfer_info(fun, USB_DIRECTION_IN, target,
    304304            data, data_size, arg);
    305305        transfer->in_callback = callback;
     
    314314static usb_address_keeping_t addresses;
    315315
    316 static int tell_address(device_t *dev, devman_handle_t handle,
     316static int tell_address(ddf_fun_t *fun, devman_handle_t handle,
    317317    usb_address_t *address)
    318318{
     319        usb_log_debug("tell_address(fun \"%s\", handle %zu)\n",
     320            fun->name, (size_t) fun->handle);
    319321        usb_address_t addr = usb_address_keeping_find(&addresses, handle);
    320322        if (addr < 0) {
     
    326328}
    327329
    328 static int reserve_default_address(device_t *dev, usb_speed_t ignored)
     330static int reserve_default_address(ddf_fun_t *fun, usb_speed_t ignored)
    329331{
    330332        usb_address_keeping_reserve_default(&addresses);
     
    332334}
    333335
    334 static int release_default_address(device_t *dev)
     336static int release_default_address(ddf_fun_t *fun)
    335337{
    336338        usb_address_keeping_release_default(&addresses);
     
    338340}
    339341
    340 static int request_address(device_t *dev, usb_speed_t ignored,
     342static int request_address(ddf_fun_t *fun, usb_speed_t ignored,
    341343    usb_address_t *address)
    342344{
     
    350352}
    351353
    352 static int release_address(device_t *dev, usb_address_t address)
     354static int release_address(ddf_fun_t *fun, usb_address_t address)
    353355{
    354356        return usb_address_keeping_release(&addresses, address);
    355357}
    356358
    357 static int bind_address(device_t *dev, usb_address_t address,
     359static int bind_address(ddf_fun_t *fun, usb_address_t address,
    358360    devman_handle_t handle)
    359361{
    360362        usb_address_keeping_devman_bind(&addresses, address, handle);
    361363        return EOK;
     364}
     365
     366static int usb_iface_get_hc_handle_rh_impl(ddf_fun_t *root_hub_fun,
     367    devman_handle_t *handle)
     368{
     369        ddf_fun_t *hc_fun = root_hub_fun->driver_data;
     370        assert(hc_fun != NULL);
     371
     372        *handle = hc_fun->handle;
     373
     374        usb_log_debug("usb_iface_get_hc_handle_rh_impl returns %zu\n", *handle);
     375
     376        return EOK;
     377}
     378
     379static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle,
     380    usb_address_t *address)
     381{
     382        ddf_fun_t *hc_fun = root_hub_fun->driver_data;
     383        assert(hc_fun != NULL);
     384
     385        return tell_address(hc_fun, root_hub_fun->handle, address);
    362386}
    363387
     
    386410};
    387411
     412usb_iface_t rh_usb_iface = {
     413        .get_hc_handle = usb_iface_get_hc_handle_rh_impl,
     414        .get_address = tell_address_rh
     415};
     416
    388417
    389418/**
Note: See TracChangeset for help on using the changeset viewer.