Ignore:
File:
1 edited

Legend:

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

    r20eaa82 r8d2dd7f2  
    3838
    3939#include <usb/host/endpoint.h>
    40 #include <usb/host/bus.h>
     40#include <usb/host/usb_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 *);
     52typedef int (*ep_add_hook_t)(hcd_t *, endpoint_t *);
     53typedef void (*ep_remove_hook_t)(hcd_t *, endpoint_t *);
    5254typedef void (*interrupt_hook_t)(hcd_t *, uint32_t);
    5355typedef int (*status_hook_t)(hcd_t *, uint32_t *);
    54 typedef int (*address_device_hook_t)(hcd_t *, usb_speed_t, usb_tt_address_t, usb_address_t *);
    5556
    5657typedef struct {
    5758        /** Transfer scheduling, implement in device driver. */
    5859        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;
    5964        /** Hook to be called on device interrupt, passes ARG1 */
    6065        interrupt_hook_t irq_hook;
    6166        /** Periodic polling hook */
    6267        status_hook_t status_hook;
    63         /** Hook to setup device address */
    64         address_device_hook_t address_device;
    6568} hcd_ops_t;
    6669
     
    6871struct hcd {
    6972        /** Endpoint manager. */
    70         bus_t *bus;
     73        usb_bus_t bus;
    7174
    7275        /** Interrupt replacement fibril */
     
    7578        /** Driver implementation */
    7679        hcd_ops_t ops;
    77 
    7880        /** Device specific driver data. */
    7981        void * driver_data;
    8082};
    8183
    82 extern void hcd_init(hcd_t *);
     84extern void hcd_init(hcd_t *, usb_speed_t, size_t, bw_count_func_t);
    8385
    8486static inline void hcd_set_implementation(hcd_t *hcd, void *data,
    85     const hcd_ops_t *ops, bus_t *bus)
     87    const hcd_ops_t *ops)
    8688{
    8789        assert(hcd);
     
    8991                hcd->driver_data = data;
    9092                hcd->ops = *ops;
    91                 hcd->bus = bus;
    9293        } else {
    9394                memset(&hcd->ops, 0, sizeof(hcd->ops));
     
    103104extern usb_address_t hcd_request_address(hcd_t *, usb_speed_t);
    104105
     106extern int hcd_release_address(hcd_t *, usb_address_t);
     107
     108extern int hcd_reserve_default_address(hcd_t *, usb_speed_t);
     109
     110static inline int hcd_release_default_address(hcd_t *hcd)
     111{
     112        return hcd_release_address(hcd, USB_ADDRESS_DEFAULT);
     113}
     114
    105115extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
    106     usb_transfer_type_t, size_t, unsigned int, size_t, usb_tt_address_t);
     116    usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t,
     117    unsigned int);
    107118
    108119extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
Note: See TracChangeset for help on using the changeset viewer.