Ignore:
File:
1 edited

Legend:

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

    r17412546 r620c710  
    3636#define LIBUSBHOST_HOST_ENDPOINT_H
    3737
     38#include <assert.h>
    3839#include <bool.h>
    3940#include <adt/list.h>
    4041#include <fibril_synch.h>
     42
    4143#include <usb/usb.h>
    4244
    43 /** Host controller side endpoint structure. */
    4445typedef struct endpoint {
    45         /** Part of linked list. */
    46         link_t link;
    47         /** USB address. */
    4846        usb_address_t address;
    49         /** USB endpoint number. */
    5047        usb_endpoint_t endpoint;
    51         /** Communication direction. */
    5248        usb_direction_t direction;
    53         /** USB transfer type. */
    5449        usb_transfer_type_t transfer_type;
    55         /** Communication speed. */
    5650        usb_speed_t speed;
    57         /** Maximum size of data packets. */
    5851        size_t max_packet_size;
    59         /** Necessary bandwidth. */
    60         size_t bandwidth;
    61         /** Value of the toggle bit. */
    6252        unsigned toggle:1;
    63         /** True if there is a batch using this scheduled for this endpoint. */
     53        fibril_mutex_t guard;
     54        fibril_condvar_t avail;
    6455        volatile bool active;
    65         /** Protects resources and active status changes. */
    66         fibril_mutex_t guard;
    67         /** Signals change of active status. */
    68         fibril_condvar_t avail;
    69         /** Optional device specific data. */
     56        void (*destroy_hook)(struct endpoint *);
    7057        struct {
    71                 /** Device specific data. */
    7258                void *data;
    73                 /** Callback to get the value of toggle bit. */
    7459                int (*toggle_get)(void *);
    75                 /** Callback to set the value of toggle bit. */
    7660                void (*toggle_set)(void *, int);
    7761        } hc_data;
    7862} endpoint_t;
    7963
    80 endpoint_t * endpoint_create(usb_address_t address, usb_endpoint_t endpoint,
     64endpoint_t * endpoint_get(usb_address_t address, usb_endpoint_t endpoint,
    8165    usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed,
    82     size_t max_packet_size, size_t bw);
     66    size_t max_packet_size);
     67
    8368void endpoint_destroy(endpoint_t *instance);
    8469
    8570void endpoint_set_hc_data(endpoint_t *instance,
    86     void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int));
     71    void *data, void (*destroy_hook)(endpoint_t *),
     72    int (*toggle_get)(void *), void (*toggle_set)(void *, int));
     73
    8774void endpoint_clear_hc_data(endpoint_t *instance);
    8875
    8976void endpoint_use(endpoint_t *instance);
     77
    9078void endpoint_release(endpoint_t *instance);
    9179
    9280int endpoint_toggle_get(endpoint_t *instance);
     81
    9382void endpoint_toggle_set(endpoint_t *instance, int toggle);
    9483
    95 /** list_get_instance wrapper.
    96  * @param item Pointer to link member.
    97  * @return Pointer to enpoint_t structure.
    98  */
    99 static inline endpoint_t * endpoint_get_instance(link_t *item)
    100 {
    101         return list_get_instance(item, endpoint_t, link);
    102 }
     84void endpoint_toggle_reset_filtered(endpoint_t *instance, usb_target_t target);
    10385#endif
    10486/**
Note: See TracChangeset for help on using the changeset viewer.