Changes in uspace/lib/usbhost/include/usb/host/endpoint.h [aa81adc:c59dbdd5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/endpoint.h
raa81adc rc59dbdd5 36 36 #define LIBUSBHOST_HOST_ENDPOINT_H 37 37 38 #include <assert.h>39 38 #include <bool.h> 40 39 #include <adt/list.h> 41 40 #include <fibril_synch.h> 42 43 41 #include <usb/usb.h> 44 42 43 /** Host controller side endpoint structure. */ 45 44 typedef struct endpoint { 45 /** Part of linked list. */ 46 link_t link; 47 /** USB address. */ 46 48 usb_address_t address; 49 /** USB endpoint number. */ 47 50 usb_endpoint_t endpoint; 51 /** Communication direction. */ 48 52 usb_direction_t direction; 53 /** USB transfer type. */ 49 54 usb_transfer_type_t transfer_type; 55 /** Communication speed. */ 50 56 usb_speed_t speed; 57 /** Maximum size of data packets. */ 51 58 size_t max_packet_size; 59 /** Necessary bandwidth. */ 60 size_t bandwidth; 61 /** Value of the toggle bit. */ 52 62 unsigned toggle:1; 63 /** True if there is a batch using this scheduled for this endpoint. */ 64 volatile bool active; 65 /** Protects resources and active status changes. */ 53 66 fibril_mutex_t guard; 67 /** Signals change of active status. */ 54 68 fibril_condvar_t avail; 55 volatile bool active;69 /** Optional device specific data. */ 56 70 struct { 71 /** Device specific data. */ 57 72 void *data; 73 /** Callback to get the value of toggle bit. */ 58 74 int (*toggle_get)(void *); 75 /** Callback to set the value of toggle bit. */ 59 76 void (*toggle_set)(void *, int); 60 77 } hc_data; 61 78 } endpoint_t; 62 79 63 endpoint_t * endpoint_ get(usb_address_t address, usb_endpoint_t endpoint,80 endpoint_t * endpoint_create(usb_address_t address, usb_endpoint_t endpoint, 64 81 usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed, 65 size_t max_packet_size); 66 82 size_t max_packet_size, size_t bw); 67 83 void endpoint_destroy(endpoint_t *instance); 68 84 69 85 void endpoint_set_hc_data(endpoint_t *instance, 70 86 void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int)); 71 72 87 void endpoint_clear_hc_data(endpoint_t *instance); 73 88 74 89 void endpoint_use(endpoint_t *instance); 75 76 90 void endpoint_release(endpoint_t *instance); 77 91 78 92 int endpoint_toggle_get(endpoint_t *instance); 79 80 93 void endpoint_toggle_set(endpoint_t *instance, int toggle); 81 94 82 void endpoint_toggle_reset_filtered(endpoint_t *instance, usb_target_t target); 95 /** list_get_instance wrapper. 96 * @param item Pointer to link member. 97 * @return Pointer to endpoint_t structure. 98 */ 99 static inline endpoint_t * endpoint_get_instance(link_t *item) 100 { 101 return item ? list_get_instance(item, endpoint_t, link) : NULL; 102 } 83 103 #endif 84 104 /**
Note:
See TracChangeset
for help on using the changeset viewer.