Changeset 96e2d01 in mainline
- Timestamp:
- 2011-08-31T15:31:42Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b991d37
- Parents:
- af2b806
- Location:
- uspace/lib/usbhost
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/batch.h
raf2b806 r96e2d01 91 91 ); 92 92 93 void usb_transfer_batch_call_in_and_dispose(usb_transfer_batch_t *instance);94 void usb_transfer_batch_call_out_and_dispose(usb_transfer_batch_t *instance);95 93 void usb_transfer_batch_finish(usb_transfer_batch_t *instance); 94 void usb_transfer_batch_call_in(usb_transfer_batch_t *instance); 95 void usb_transfer_batch_call_out(usb_transfer_batch_t *instance); 96 96 void usb_transfer_batch_dispose(usb_transfer_batch_t *instance); 97 97 98 /** Helper function, calls callback and correctly destroys batch structure. 99 * 100 * @param[in] instance Batch structure to use. 101 */ 102 static inline void usb_transfer_batch_call_in_and_dispose( 103 usb_transfer_batch_t *instance) 104 { 105 assert(instance); 106 usb_transfer_batch_call_in(instance); 107 usb_transfer_batch_dispose(instance); 108 } 109 /*----------------------------------------------------------------------------*/ 110 /** Helper function calls callback and correctly destroys batch structure. 111 * 112 * @param[in] instance Batch structure to use. 113 */ 114 static inline void usb_transfer_batch_call_out_and_dispose( 115 usb_transfer_batch_t *instance) 116 { 117 assert(instance); 118 usb_transfer_batch_call_out(instance); 119 usb_transfer_batch_dispose(instance); 120 } 121 /*----------------------------------------------------------------------------*/ 98 122 static inline void usb_transfer_batch_finish_error( 99 123 usb_transfer_batch_t *instance, int error) … … 103 127 usb_transfer_batch_finish(instance); 104 128 } 105 129 /*----------------------------------------------------------------------------*/ 106 130 static inline usb_transfer_batch_t *usb_transfer_batch_from_link(link_t *l) 107 131 { -
uspace/lib/usbhost/src/batch.c
raf2b806 r96e2d01 40 40 #include <usb/host/hcd.h> 41 41 42 void usb_transfer_batch_call_in(usb_transfer_batch_t *instance);43 void usb_transfer_batch_call_out(usb_transfer_batch_t *instance);44 45 42 void usb_transfer_batch_init( 46 43 usb_transfer_batch_t *instance, … … 76 73 instance->next_step = NULL; 77 74 instance->error = EOK; 78 endpoint_use(instance->ep); 79 } 80 /*----------------------------------------------------------------------------*/ 81 /** Helper function, calls callback and correctly destroys batch structure. 82 * 83 * @param[in] instance Batch structure to use. 84 */ 85 void usb_transfer_batch_call_in_and_dispose(usb_transfer_batch_t *instance) 86 { 87 assert(instance); 88 usb_transfer_batch_call_in(instance); 89 usb_transfer_batch_dispose(instance); 90 } 91 /*----------------------------------------------------------------------------*/ 92 /** Helper function calls callback and correctly destroys batch structure. 93 * 94 * @param[in] instance Batch structure to use. 95 */ 96 void usb_transfer_batch_call_out_and_dispose(usb_transfer_batch_t *instance) 97 { 98 assert(instance); 99 usb_transfer_batch_call_out(instance); 100 usb_transfer_batch_dispose(instance); 75 if (instance->ep) 76 endpoint_use(instance->ep); 101 77 } 102 78 /*----------------------------------------------------------------------------*/ … … 109 85 { 110 86 assert(instance); 111 assert(instance->ep);112 assert(instance->next_step);113 endpoint_release(instance->ep);114 instance->next_step(instance);87 if (instance->ep) 88 endpoint_release(instance->ep); 89 if (instance->next_step) 90 instance->next_step(instance); 115 91 } 116 92 /*----------------------------------------------------------------------------*/ … … 125 101 assert(instance); 126 102 assert(instance->callback_in); 127 assert(instance->ep);128 103 129 104 /* We are data in, we need data */ … … 171 146 void usb_transfer_batch_dispose(usb_transfer_batch_t *instance) 172 147 { 173 assert(instance); 148 if (!instance) 149 return; 174 150 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " disposing.\n", 175 151 instance, USB_TRANSFER_BATCH_ARGS(*instance));
Note:
See TracChangeset
for help on using the changeset viewer.