Changes in uspace/lib/usbhost/include/usb/host/endpoint.h [17873ac7:58563585] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/endpoint.h
r17873ac7 r58563585 32 32 /** @file 33 33 * 34 * Endpoint structure is tightly coupled to the bus. The bus controls the35 * life-cycle of endpoint. In order to keep endpoints lightweight, operations36 * on endpoints are part of the bus structure.37 *38 34 */ 39 35 #ifndef LIBUSBHOST_HOST_ENDPOINT_H … … 46 42 #include <atomic.h> 47 43 48 typedef struct bus bus_t;49 typedef struct device device_t;50 typedef struct usb_transfer_batch usb_transfer_batch_t;51 52 44 /** Host controller side endpoint structure. */ 53 45 typedef struct endpoint { 46 /** Reference count. */ 47 atomic_t refcnt; 54 48 /** Part of linked list. */ 55 49 link_t link; 56 /** Managing bus */ 57 bus_t *bus; 58 /** Reference count. */ 59 atomic_t refcnt; 60 /** USB device */ 61 device_t *device; 62 /** Enpoint number */ 50 /** USB address. */ 51 usb_address_t address; 52 /** USB endpoint number. */ 63 53 usb_endpoint_t endpoint; 64 54 /** Communication direction. */ … … 72 62 /** Additional opportunities per uframe */ 73 63 unsigned packets; 74 /** Reservedbandwidth. */64 /** Necessary bandwidth. */ 75 65 size_t bandwidth; 76 66 /** Value of the toggle bit. */ 77 67 unsigned toggle:1; 78 /** T he currently active transfer batch. Write using methods, read under guard. */79 usb_transfer_batch_t *active_batch;68 /** True if there is a batch using this scheduled for this endpoint. */ 69 volatile bool active; 80 70 /** Protects resources and active status changes. */ 81 71 fibril_mutex_t guard; 82 72 /** Signals change of active status. */ 83 73 fibril_condvar_t avail; 84 85 /* This structure is meant to be extended by overriding. */ 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; 86 88 } endpoint_t; 87 89 88 extern void endpoint_init(endpoint_t *, bus_t *); 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 *); 89 94 90 95 extern void endpoint_add_ref(endpoint_t *); 91 96 extern void endpoint_del_ref(endpoint_t *); 92 97 93 /* Pay atention to synchronization of batch access wrt to aborting & finishing from another fibril. */ 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 *); 94 101 95 /* Set currently active batch. The common case is to activate in the same 96 * critical section as scheduling to HW. 97 */ 98 extern void endpoint_activate_locked(endpoint_t *, usb_transfer_batch_t *); 99 100 /* Deactivate the endpoint, allowing others to activate it again. Batch shall 101 * already have an error set. */ 102 extern void endpoint_deactivate_locked(endpoint_t *); 103 104 /* Abort the currenty active batch. */ 105 void endpoint_abort(endpoint_t *); 102 extern void endpoint_use(endpoint_t *); 103 extern void endpoint_release(endpoint_t *); 106 104 107 105 extern int endpoint_toggle_get(endpoint_t *); 108 extern void endpoint_toggle_set(endpoint_t *, bool);106 extern void endpoint_toggle_set(endpoint_t *, int); 109 107 110 108 /** list_get_instance wrapper. … … 119 117 return item ? list_get_instance(item, endpoint_t, link) : NULL; 120 118 } 121 122 119 #endif 123 120
Note:
See TracChangeset
for help on using the changeset viewer.