Changes in uspace/lib/usbhost/src/hcd.c [f527f58:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/hcd.c
rf527f58 rb7fd2a0 49 49 * @return Error code. 50 50 */ 51 static int register_helper(endpoint_t *ep, void *arg)51 static errno_t register_helper(endpoint_t *ep, void *arg) 52 52 { 53 53 hcd_t *hcd = arg; … … 102 102 } 103 103 104 usb_address_t hcd_request_address(hcd_t *hcd, usb_speed_t speed) 105 { 106 assert(hcd); 107 usb_address_t address = 0; 108 const int ret = usb_bus_request_address( 109 &hcd->bus, &address, false, speed); 110 if (ret != EOK) 111 return ret; 112 return address; 113 } 114 115 int hcd_release_address(hcd_t *hcd, usb_address_t address) 104 errno_t hcd_request_address(hcd_t *hcd, usb_speed_t speed, usb_address_t *address) 105 { 106 assert(hcd); 107 return usb_bus_request_address(&hcd->bus, address, false, speed); 108 } 109 110 errno_t hcd_release_address(hcd_t *hcd, usb_address_t address) 116 111 { 117 112 assert(hcd); … … 120 115 } 121 116 122 int hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed)117 errno_t hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed) 123 118 { 124 119 assert(hcd); … … 127 122 } 128 123 129 int hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir,124 errno_t hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir, 130 125 usb_transfer_type_t type, size_t max_packet_size, unsigned packets, 131 126 size_t size, usb_address_t tt_address, unsigned tt_port) … … 137 132 } 138 133 139 int hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir)134 errno_t hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir) 140 135 { 141 136 assert(hcd); … … 152 147 } toggle_t; 153 148 154 static void toggle_reset_callback( int retval, void *arg)149 static void toggle_reset_callback(errno_t retval, void *arg) 155 150 { 156 151 assert(arg); … … 177 172 * @return Error code. 178 173 */ 179 int hcd_send_batch(174 errno_t hcd_send_batch( 180 175 hcd_t *hcd, usb_target_t target, usb_direction_t direction, 181 176 void *data, size_t size, uint64_t setup_data, … … 237 232 } 238 233 239 const int ret = hcd->ops.schedule(hcd, batch);234 const errno_t ret = hcd->ops.schedule(hcd, batch); 240 235 if (ret != EOK) 241 236 usb_transfer_batch_destroy(batch); … … 249 244 typedef struct { 250 245 volatile unsigned done; 251 int ret;246 errno_t ret; 252 247 size_t size; 253 248 } sync_data_t; 254 249 255 static void transfer_in_cb( int ret, size_t size, void* data)250 static void transfer_in_cb(errno_t ret, size_t size, void* data) 256 251 { 257 252 sync_data_t *d = data; … … 262 257 } 263 258 264 static void transfer_out_cb( int ret, void* data)259 static void transfer_out_cb(errno_t ret, void* data) 265 260 { 266 261 sync_data_t *d = data; … … 271 266 272 267 /** this is really ugly version of sync usb communication */ 273 ssize_t hcd_send_batch_sync(268 errno_t hcd_send_batch_sync( 274 269 hcd_t *hcd, usb_target_t target, usb_direction_t dir, 275 void *data, size_t size, uint64_t setup_data, const char* name )270 void *data, size_t size, uint64_t setup_data, const char* name, size_t *out_size) 276 271 { 277 272 assert(hcd); 278 273 sync_data_t sd = { .done = 0, .ret = EBUSY, .size = size }; 279 274 280 const int ret = hcd_send_batch(hcd, target, dir, data, size, setup_data,275 const errno_t ret = hcd_send_batch(hcd, target, dir, data, size, setup_data, 281 276 dir == USB_DIRECTION_IN ? transfer_in_cb : NULL, 282 277 dir == USB_DIRECTION_OUT ? transfer_out_cb : NULL, &sd, name); … … 289 284 290 285 if (sd.ret == EOK) 291 returnsd.size;286 *out_size = sd.size; 292 287 return sd.ret; 293 288 }
Note:
See TracChangeset
for help on using the changeset viewer.