Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r8d2dd7f2 r20eaa82  
    3838
    3939#include <usb/host/endpoint.h>
    40 #include <usb/host/usb_bus.h>
     40#include <usb/host/bus.h>
    4141#include <usb/host/usb_transfer_batch.h>
    4242#include <usb/usb.h>
     
    5050
    5151typedef int (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
    52 typedef int (*ep_add_hook_t)(hcd_t *, endpoint_t *);
    53 typedef void (*ep_remove_hook_t)(hcd_t *, endpoint_t *);
    5452typedef void (*interrupt_hook_t)(hcd_t *, uint32_t);
    5553typedef int (*status_hook_t)(hcd_t *, uint32_t *);
     54typedef int (*address_device_hook_t)(hcd_t *, usb_speed_t, usb_tt_address_t, usb_address_t *);
    5655
    5756typedef struct {
    5857        /** Transfer scheduling, implement in device driver. */
    5958        schedule_hook_t schedule;
    60         /** Hook called upon registering new endpoint. */
    61         ep_add_hook_t ep_add_hook;
    62         /** Hook called upon removing of an endpoint. */
    63         ep_remove_hook_t ep_remove_hook;
    6459        /** Hook to be called on device interrupt, passes ARG1 */
    6560        interrupt_hook_t irq_hook;
    6661        /** Periodic polling hook */
    6762        status_hook_t status_hook;
     63        /** Hook to setup device address */
     64        address_device_hook_t address_device;
    6865} hcd_ops_t;
    6966
     
    7168struct hcd {
    7269        /** Endpoint manager. */
    73         usb_bus_t bus;
     70        bus_t *bus;
    7471
    7572        /** Interrupt replacement fibril */
     
    7875        /** Driver implementation */
    7976        hcd_ops_t ops;
     77
    8078        /** Device specific driver data. */
    8179        void * driver_data;
    8280};
    8381
    84 extern void hcd_init(hcd_t *, usb_speed_t, size_t, bw_count_func_t);
     82extern void hcd_init(hcd_t *);
    8583
    8684static inline void hcd_set_implementation(hcd_t *hcd, void *data,
    87     const hcd_ops_t *ops)
     85    const hcd_ops_t *ops, bus_t *bus)
    8886{
    8987        assert(hcd);
     
    9189                hcd->driver_data = data;
    9290                hcd->ops = *ops;
     91                hcd->bus = bus;
    9392        } else {
    9493                memset(&hcd->ops, 0, sizeof(hcd->ops));
     
    104103extern usb_address_t hcd_request_address(hcd_t *, usb_speed_t);
    105104
    106 extern int hcd_release_address(hcd_t *, usb_address_t);
    107 
    108 extern int hcd_reserve_default_address(hcd_t *, usb_speed_t);
    109 
    110 static inline int hcd_release_default_address(hcd_t *hcd)
    111 {
    112         return hcd_release_address(hcd, USB_ADDRESS_DEFAULT);
    113 }
    114 
    115105extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
    116     usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t,
    117     unsigned int);
     106    usb_transfer_type_t, size_t, unsigned int, size_t, usb_tt_address_t);
    118107
    119108extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
Note: See TracChangeset for help on using the changeset viewer.