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/lib/usbhost/include/usb/host/bus.h

    r1ea0bbf r32fb6bce  
    4343#define LIBUSBHOST_HOST_BUS_H
    4444
    45 #include <usb/usb.h>
    46 #include <usb/request.h>
    47 #include <usb/host/hcd.h>
    48 
    4945#include <assert.h>
    5046#include <fibril_synch.h>
    5147#include <stdbool.h>
     48#include <usb/host/hcd.h>
     49#include <usb/request.h>
     50#include <usb/usb.h>
     51#include <usbhc_iface.h>
    5252
    5353typedef struct hcd hcd_t;
     
    9494
    9595        /* Global operations on the bus */
     96        void (*interrupt)(bus_t *, uint32_t);
     97        int (*status)(bus_t *, uint32_t *);
    9698        int (*reserve_default_address)(bus_t *, usb_speed_t);
    9799        int (*release_default_address)(bus_t *);
     
    116118
    117119        /* Operations on batch */
    118         void (*batch_destroy)(usb_transfer_batch_t *);  /**< Optional */
     120        void (*batch_destroy)(usb_transfer_batch_t *);          /**< Optional */
     121        int (*batch_schedule)(usb_transfer_batch_t *);
    119122};
    120123
     
    129132        fibril_mutex_t guard;
    130133
    131         /* TODO: get rid of this one. */
    132         hcd_t *hcd;
    133 
     134        /* Size of the device_t extended structure */
    134135        size_t device_size;
    135136
     
    140141} bus_t;
    141142
    142 void bus_init(bus_t *, hcd_t *, size_t);
     143void bus_init(bus_t *, size_t);
    143144int bus_device_init(device_t *, bus_t *);
    144145
     
    150151int bus_device_online(device_t *);
    151152int bus_device_offline(device_t *);
     153
     154int bus_device_send_batch(device_t *, usb_target_t,
     155    usb_direction_t direction, char *, size_t, uint64_t,
     156    usbhc_iface_transfer_callback_t, void *, const char *);
     157
     158ssize_t bus_device_send_batch_sync(device_t *, usb_target_t,
     159    usb_direction_t direction, char *, size_t, uint64_t,
     160    const char *);
    152161
    153162int bus_endpoint_add(device_t *, const usb_endpoint_desc_t *, endpoint_t **);
Note: See TracChangeset for help on using the changeset viewer.