Changeset d369b3b in mainline for uspace/drv/bus/usb/vhc


Ignore:
Timestamp:
2018-01-25T02:05:57Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
296d22fc
Parents:
b357377
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-25 01:52:13)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-25 02:05:57)
Message:

usb2_bus: no longer be a bus

As the number of implemented functions got to 3, it's not so beneficial
to inherit usb2 bus to get the functionality. Overall, four trampolines
needed to be added, which is an acceptable number.

Now, the usb2_bus has become a usb2_bus_helper, to be used as
a companion to the common bus.

This is mostly a preparation to remove the runtime binding of the bus
methods.

Location:
uspace/drv/bus/usb/vhc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/vhc/transfer.c

    rb357377 rd369b3b  
    163163}
    164164
     165static int device_enumerate(device_t *device)
     166{
     167        vhc_data_t *vhc = bus_to_vhc(device->bus);
     168        return usb2_bus_device_enumerate(&vhc->bus_helper, device);
     169}
     170
     171static int endpoint_register(endpoint_t *endpoint)
     172{
     173        vhc_data_t *vhc = bus_to_vhc(endpoint->device->bus);
     174        return usb2_bus_endpoint_register(&vhc->bus_helper, endpoint);
     175}
     176
     177static void endpoint_unregister(endpoint_t *endpoint)
     178{
     179        vhc_data_t *vhc = bus_to_vhc(endpoint->device->bus);
     180        usb2_bus_endpoint_unregister(&vhc->bus_helper, endpoint);
     181
     182        // TODO: abort transfer?
     183}
     184
    165185static const bus_ops_t vhc_bus_ops = {
    166         .parent = &usb2_bus_ops,
    167 
    168186        .batch_create = batch_create,
    169187        .batch_schedule = vhc_schedule,
     188
     189        .device_enumerate = device_enumerate,
     190        .endpoint_register = endpoint_register,
     191        .endpoint_unregister = endpoint_unregister,
    170192};
    171193
     
    175197        list_initialize(&instance->devices);
    176198        fibril_mutex_initialize(&instance->guard);
    177         usb2_bus_init(&instance->bus, &bandwidth_accounting_usb11);
    178         instance->bus.base.ops = &vhc_bus_ops;
     199        bus_init(&instance->bus, sizeof(device_t));
     200        usb2_bus_helper_init(&instance->bus_helper, &bandwidth_accounting_usb11);
     201        instance->bus.ops = &vhc_bus_ops;
    179202        return virthub_init(&instance->hub, "root hub");
    180203}
  • uspace/drv/bus/usb/vhc/vhcd.h

    rb357377 rd369b3b  
    6060        hc_device_t base;
    6161
    62         usb2_bus_t bus;
     62        bus_t bus;
     63        usb2_bus_helper_t bus_helper;
     64
    6365        ddf_fun_t *virtual_fun;
    6466        list_t devices;
Note: See TracChangeset for help on using the changeset viewer.