Changes in uspace/lib/usb/src/host/endpoint.c [506d330:4fd3faf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/host/endpoint.c
r506d330 r4fd3faf 34 34 */ 35 35 36 #include <assert.h> 36 37 #include <errno.h> 37 38 #include <usb/host/endpoint.h> … … 49 50 instance->max_packet_size = max_packet_size; 50 51 instance->toggle = 0; 52 instance->active = false; 53 fibril_mutex_initialize(&instance->guard); 54 fibril_condvar_initialize(&instance->avail); 51 55 link_initialize(&instance->same_device_eps); 52 56 return EOK; … … 56 60 { 57 61 assert(instance); 62 assert(!instance->active); 58 63 list_remove(&instance->same_device_eps); 59 64 free(instance); 65 } 66 /*----------------------------------------------------------------------------*/ 67 void endpoint_use(endpoint_t *instance) 68 { 69 assert(instance); 70 fibril_mutex_lock(&instance->guard); 71 while (instance->active) 72 fibril_condvar_wait(&instance->avail, &instance->guard); 73 instance->active = true; 74 fibril_mutex_unlock(&instance->guard); 75 } 76 /*----------------------------------------------------------------------------*/ 77 void endpoint_release(endpoint_t *instance) 78 { 79 assert(instance); 80 fibril_mutex_lock(&instance->guard); 81 instance->active = false; 82 fibril_mutex_unlock(&instance->guard); 83 fibril_condvar_signal(&instance->avail); 60 84 } 61 85 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.