Changeset 32fb6bce in mainline for uspace/drv/bus/usb/vhc/vhcd.h


Ignore:
Timestamp:
2017-12-18T22:50:21Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f70d1c
Parents:
1ea0bbf
git-author:
Ondřej Hlavatý <aearsis@…> (2017-12-18 22:04:50)
git-committer:
Ondřej Hlavatý <aearsis@…> (2017-12-18 22:50:21)
Message:

usbhost: refactoring

This commit moves interrupt, status and schedule to bus
operations. Then the purpose of hcd_t is better defined, and split into
hc_driver_t and hc_device_t. hc_driver_t is used to wrap driver
implementation by the library (similar to how usb_driver_t is used to
wrap usb device drivers). hc_device_t is used as a parent for hc_t
inside drivers, and is allocated inside the DDF device node.

To support these changes, some local identifiers were renamed, some
functions were moved and/or renamed and their arguments changed. The
most notable one being hcd_send_batch → bus_device_send_batch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/vhc/vhcd.h

    r1ea0bbf r32fb6bce  
    3939#include <usbvirt/device.h>
    4040#include <async.h>
     41#include <macros.h>
    4142
    4243#include <usb/host/hcd.h>
    4344#include <usb/host/usb2_bus.h>
     45#include <usb/host/usb_transfer_batch.h>
    4446
    4547#define NAME "vhc"
     
    5658
    5759typedef struct {
    58         uint32_t magic;
     60        hc_device_t base;
     61
     62        usb2_bus_t bus;
     63        ddf_fun_t *virtual_fun;
    5964        list_t devices;
    6065        fibril_mutex_t guard;
    6166        usbvirt_device_t hub;
    62         usb2_bus_t bus;
    6367} vhc_data_t;
    6468
    6569typedef struct {
     70        usb_transfer_batch_t batch;
    6671        link_t link;
    67         usb_transfer_batch_t *batch;
    6872} vhc_transfer_t;
     73
     74static inline vhc_data_t *hcd_to_vhc(hc_device_t *hcd)
     75{
     76        assert(hcd);
     77        return (vhc_data_t *) hcd;
     78}
     79
     80static inline vhc_data_t *bus_to_vhc(bus_t *bus)
     81{
     82        assert(bus);
     83        return member_to_inst(bus, vhc_data_t, bus);
     84}
    6985
    7086void on_client_close(ddf_fun_t *fun);
     
    7793void vhc_virtdev_unplug(vhc_data_t *, uintptr_t);
    7894
    79 int vhc_init(vhc_data_t *instance, hcd_t *);
    80 int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
     95int vhc_init(vhc_data_t *);
     96int vhc_schedule(usb_transfer_batch_t *);
    8197int vhc_transfer_queue_processor(void *arg);
    8298
Note: See TracChangeset for help on using the changeset viewer.