Ignore:
File:
1 edited

Legend:

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

    r58563585 r20eaa82  
    3232/** @file
    3333 *
     34 * Endpoint structure is tightly coupled to the bus. The bus controls the
     35 * life-cycle of endpoint. In order to keep endpoints lightweight, operations
     36 * on endpoints are part of the bus structure.
     37 *
    3438 */
    3539#ifndef LIBUSBHOST_HOST_ENDPOINT_H
     
    4246#include <atomic.h>
    4347
     48typedef struct bus bus_t;
     49typedef struct device device_t;
     50
    4451/** Host controller side endpoint structure. */
    4552typedef struct endpoint {
     53        /** Managing bus */
     54        bus_t *bus;
    4655        /** Reference count. */
    47         atomic_t refcnt;       
     56        atomic_t refcnt;
    4857        /** Part of linked list. */
    4958        link_t link;
     59        /** USB device */
     60        device_t *device;
    5061        /** USB address. */
    51         usb_address_t address;
    52         /** USB endpoint number. */
    53         usb_endpoint_t endpoint;
     62        usb_target_t target;
    5463        /** Communication direction. */
    5564        usb_direction_t direction;
     
    6271        /** Additional opportunities per uframe */
    6372        unsigned packets;
    64         /** Necessary bandwidth. */
     73        /** Reserved bandwidth. */
    6574        size_t bandwidth;
    6675        /** Value of the toggle bit. */
    6776        unsigned toggle:1;
    6877        /** True if there is a batch using this scheduled for this endpoint. */
    69         volatile bool active;
     78        bool active;
    7079        /** Protects resources and active status changes. */
    7180        fibril_mutex_t guard;
    7281        /** Signals change of active status. */
    7382        fibril_condvar_t avail;
    74         /** High speed TT data */
    75         struct {
    76                 usb_address_t address;
    77                 unsigned port;
    78         } tt;
    79         /** Optional device specific data. */
    80         struct {
    81                 /** Device specific data. */
    82                 void *data;
    83                 /** Callback to get the value of toggle bit. */
    84                 int (*toggle_get)(void *);
    85                 /** Callback to set the value of toggle bit. */
    86                 void (*toggle_set)(void *, int);
    87         } hc_data;
     83
     84        /* This structure is meant to be extended by overriding. */
    8885} endpoint_t;
    8986
    90 extern endpoint_t *endpoint_create(usb_address_t, usb_endpoint_t,
    91     usb_direction_t, usb_transfer_type_t, usb_speed_t, size_t, unsigned int,
    92     size_t, usb_address_t, unsigned int);
    93 extern void endpoint_destroy(endpoint_t *);
     87extern void endpoint_init(endpoint_t *, bus_t *);
    9488
    9589extern void endpoint_add_ref(endpoint_t *);
    9690extern void endpoint_del_ref(endpoint_t *);
    97 
    98 extern void endpoint_set_hc_data(endpoint_t *, void *, int (*)(void *),
    99     void (*)(void *, int));
    100 extern void endpoint_clear_hc_data(endpoint_t *);
    10191
    10292extern void endpoint_use(endpoint_t *);
     
    10494
    10595extern int endpoint_toggle_get(endpoint_t *);
    106 extern void endpoint_toggle_set(endpoint_t *, int);
     96extern void endpoint_toggle_set(endpoint_t *, unsigned);
    10797
    10898/** list_get_instance wrapper.
Note: See TracChangeset for help on using the changeset viewer.