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


Ignore:
Timestamp:
2017-10-21T20:52:56Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
766043c
Parents:
74b852b
Message:

usbhost refactoring: let transfer_batch be initialized by bus

Currently makes older HCs fail, work in progress.

File:
1 edited

Legend:

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

    r74b852b r5fd9c30  
    177177                        uhci_transfer_batch_t *batch =
    178178                            uhci_transfer_batch_from_link(current);
    179                         uhci_transfer_batch_finish_dispose(batch);
     179                        usb_transfer_batch_finish(&batch->base);
    180180                }
    181181        }
     
    309309}
    310310
     311static usb_transfer_batch_t *create_transfer_batch(bus_t *bus, endpoint_t *ep)
     312{
     313        uhci_transfer_batch_t *batch = uhci_transfer_batch_create(ep);
     314        return &batch->base;
     315}
     316
     317static void destroy_transfer_batch(usb_transfer_batch_t *batch)
     318{
     319        uhci_transfer_batch_destroy(uhci_transfer_batch_get(batch));
     320}
     321
    311322/** Initialize UHCI hc memory structures.
    312323 *
     
    326337        if ((err = usb2_bus_init(&instance->bus, BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11)))
    327338                return err;
     339
     340        instance->bus.base.ops.create_batch = create_transfer_batch;
     341        instance->bus.base.ops.destroy_batch = destroy_transfer_batch;
    328342
    329343        /* Init USB frame list page */
     
    450464                return uhci_rh_schedule(&instance->rh, batch);
    451465
    452         uhci_transfer_batch_t *uhci_batch = uhci_transfer_batch_get(batch);
     466        uhci_transfer_batch_t *uhci_batch = (uhci_transfer_batch_t *) batch;
    453467        if (!uhci_batch) {
    454468                usb_log_error("Failed to create UHCI transfer structures.\n");
    455469                return ENOMEM;
    456470        }
     471
     472        const int err = uhci_transfer_batch_prepare(uhci_batch);
     473        if (err)
     474                return err;
    457475
    458476        transfer_list_t *list =
Note: See TracChangeset for help on using the changeset viewer.