Changeset d369b3b in mainline for uspace/drv/bus/usb/uhci/hc.c


Ignore:
Timestamp:
2018-01-25T02:05:57Z (7 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.c

    rb357377 rd369b3b  
    329329        hc_t * const hc = bus_to_hc(endpoint_get_bus(ep));
    330330
    331         const int err = usb2_bus_ops.endpoint_register(ep);
     331        const int err = usb2_bus_endpoint_register(&hc->bus_helper, ep);
    332332        if (err)
    333333                return err;
     
    350350{
    351351        hc_t * const hc = bus_to_hc(endpoint_get_bus(ep));
    352         usb2_bus_ops.endpoint_unregister(ep);
     352        usb2_bus_endpoint_unregister(&hc->bus_helper, ep);
    353353
    354354        // Check for the roothub, as it does not schedule into lists
     
    406406}
    407407
     408static int device_enumerate(device_t *dev)
     409{
     410        hc_t * const hc = bus_to_hc(dev->bus);
     411        return usb2_bus_device_enumerate(&hc->bus_helper, dev);
     412}
     413
    408414static int hc_status(bus_t *, uint32_t *);
    409415static int hc_schedule(usb_transfer_batch_t *);
    410416
    411417static const bus_ops_t uhci_bus_ops = {
    412         .parent = &usb2_bus_ops,
    413 
    414418        .interrupt = hc_interrupt,
    415419        .status = hc_status,
     420
     421        .device_enumerate = device_enumerate,
    416422
    417423        .endpoint_create = endpoint_create,
     
    438444        assert(instance);
    439445
    440         usb2_bus_init(&instance->bus, &bandwidth_accounting_usb11);
    441 
    442         bus_t *bus = (bus_t *) &instance->bus;
    443         bus->ops = &uhci_bus_ops;
    444 
    445         hc_device_setup(&instance->base, bus);
     446        usb2_bus_helper_init(&instance->bus_helper, &bandwidth_accounting_usb11);
     447
     448        bus_init(&instance->bus, sizeof(device_t));
     449        instance->bus.ops = &uhci_bus_ops;
     450
     451        hc_device_setup(&instance->base, &instance->bus);
    446452
    447453        /* Init USB frame list page */
Note: See TracChangeset for help on using the changeset viewer.