Changes in uspace/lib/usbhost/include/usb/host/endpoint.h [17412546:620c710] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/endpoint.h
r17412546 r620c710 36 36 #define LIBUSBHOST_HOST_ENDPOINT_H 37 37 38 #include <assert.h> 38 39 #include <bool.h> 39 40 #include <adt/list.h> 40 41 #include <fibril_synch.h> 42 41 43 #include <usb/usb.h> 42 44 43 /** Host controller side endpoint structure. */44 45 typedef struct endpoint { 45 /** Part of linked list. */46 link_t link;47 /** USB address. */48 46 usb_address_t address; 49 /** USB endpoint number. */50 47 usb_endpoint_t endpoint; 51 /** Communication direction. */52 48 usb_direction_t direction; 53 /** USB transfer type. */54 49 usb_transfer_type_t transfer_type; 55 /** Communication speed. */56 50 usb_speed_t speed; 57 /** Maximum size of data packets. */58 51 size_t max_packet_size; 59 /** Necessary bandwidth. */60 size_t bandwidth;61 /** Value of the toggle bit. */62 52 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; 64 55 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 *); 70 57 struct { 71 /** Device specific data. */72 58 void *data; 73 /** Callback to get the value of toggle bit. */74 59 int (*toggle_get)(void *); 75 /** Callback to set the value of toggle bit. */76 60 void (*toggle_set)(void *, int); 77 61 } hc_data; 78 62 } endpoint_t; 79 63 80 endpoint_t * endpoint_ create(usb_address_t address, usb_endpoint_t endpoint,64 endpoint_t * endpoint_get(usb_address_t address, usb_endpoint_t endpoint, 81 65 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 83 68 void endpoint_destroy(endpoint_t *instance); 84 69 85 70 void 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 87 74 void endpoint_clear_hc_data(endpoint_t *instance); 88 75 89 76 void endpoint_use(endpoint_t *instance); 77 90 78 void endpoint_release(endpoint_t *instance); 91 79 92 80 int endpoint_toggle_get(endpoint_t *instance); 81 93 82 void endpoint_toggle_set(endpoint_t *instance, int toggle); 94 83 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 } 84 void endpoint_toggle_reset_filtered(endpoint_t *instance, usb_target_t target); 103 85 #endif 104 86 /**
Note:
See TracChangeset
for help on using the changeset viewer.