Changeset eb1a2f4 in mainline for uspace/drv/vhc/connhost.c
- Timestamp:
- 2011-02-22T23:30:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b5d1535, a9c674e0
- Parents:
- dbe25f1 (diff), 664af708 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/connhost.c
rdbe25f1 reb1a2f4 48 48 usbhc_iface_transfer_out_callback_t out_callback; 49 49 usbhc_iface_transfer_in_callback_t in_callback; 50 d evice_t *dev;50 ddf_fun_t *fun; 51 51 size_t reported_size; 52 52 void *arg; … … 58 58 usbhc_iface_transfer_out_callback_t out_callback; 59 59 usbhc_iface_transfer_in_callback_t in_callback; 60 d evice_t *dev;60 ddf_fun_t *fun; 61 61 void *arg; 62 62 void *data_buffer; … … 75 75 switch (transfer->direction) { 76 76 case USB_DIRECTION_IN: 77 transfer->in_callback(transfer-> dev,77 transfer->in_callback(transfer->fun, 78 78 outcome, size, 79 79 transfer->arg); 80 80 break; 81 81 case USB_DIRECTION_OUT: 82 transfer->out_callback(transfer-> dev,82 transfer->out_callback(transfer->fun, 83 83 outcome, 84 84 transfer->arg); … … 92 92 } 93 93 94 static transfer_info_t *create_transfer_info(d evice_t *dev,94 static transfer_info_t *create_transfer_info(ddf_fun_t *fun, 95 95 usb_direction_t direction, void *arg) 96 96 { … … 101 101 transfer->out_callback = NULL; 102 102 transfer->arg = arg; 103 transfer-> dev = dev;103 transfer->fun = fun; 104 104 transfer->reported_size = (size_t) -1; 105 105 … … 112 112 switch (transfer->direction) { 113 113 case USB_DIRECTION_IN: 114 transfer->in_callback(transfer-> dev,114 transfer->in_callback(transfer->fun, 115 115 outcome, size, 116 116 transfer->arg); 117 117 break; 118 118 case USB_DIRECTION_OUT: 119 transfer->out_callback(transfer-> dev,119 transfer->out_callback(transfer->fun, 120 120 outcome, 121 121 transfer->arg); … … 138 138 } 139 139 140 transfer_info_t *transfer = create_transfer_info(ctrl_transfer-> dev,140 transfer_info_t *transfer = create_transfer_info(ctrl_transfer->fun, 141 141 ctrl_transfer->direction, ctrl_transfer->arg); 142 142 transfer->out_callback = ctrl_transfer->out_callback; … … 195 195 } 196 196 197 static control_transfer_info_t *create_control_transfer_info(d evice_t *dev,197 static control_transfer_info_t *create_control_transfer_info(ddf_fun_t *fun, 198 198 usb_direction_t direction, usb_target_t target, 199 199 void *data_buffer, size_t data_buffer_size, … … 208 208 transfer->out_callback = NULL; 209 209 transfer->arg = arg; 210 transfer-> dev = dev;210 transfer->fun = fun; 211 211 transfer->data_buffer = data_buffer; 212 212 transfer->data_buffer_size = data_buffer_size; … … 215 215 } 216 216 217 static int enqueue_transfer_out(d evice_t *dev,217 static int enqueue_transfer_out(ddf_fun_t *fun, 218 218 usb_target_t target, usb_transfer_type_t transfer_type, 219 219 void *buffer, size_t size, … … 226 226 227 227 transfer_info_t *transfer 228 = create_transfer_info( dev, USB_DIRECTION_OUT, arg);228 = create_transfer_info(fun, USB_DIRECTION_OUT, arg); 229 229 transfer->out_callback = callback; 230 230 … … 235 235 } 236 236 237 static int enqueue_transfer_in(d evice_t *dev,237 static int enqueue_transfer_in(ddf_fun_t *fun, 238 238 usb_target_t target, usb_transfer_type_t transfer_type, 239 239 void *buffer, size_t size, … … 246 246 247 247 transfer_info_t *transfer 248 = create_transfer_info( dev, USB_DIRECTION_IN, arg);248 = create_transfer_info(fun, USB_DIRECTION_IN, arg); 249 249 transfer->in_callback = callback; 250 250 … … 256 256 257 257 258 static int interrupt_out(d evice_t *dev, usb_target_t target,258 static int interrupt_out(ddf_fun_t *fun, usb_target_t target, 259 259 size_t max_packet_size, 260 260 void *data, size_t size, 261 261 usbhc_iface_transfer_out_callback_t callback, void *arg) 262 262 { 263 return enqueue_transfer_out( dev, target, USB_TRANSFER_INTERRUPT,263 return enqueue_transfer_out(fun, target, USB_TRANSFER_INTERRUPT, 264 264 data, size, 265 265 callback, arg); 266 266 } 267 267 268 static int interrupt_in(d evice_t *dev, usb_target_t target,268 static int interrupt_in(ddf_fun_t *fun, usb_target_t target, 269 269 size_t max_packet_size, 270 270 void *data, size_t size, 271 271 usbhc_iface_transfer_in_callback_t callback, void *arg) 272 272 { 273 return enqueue_transfer_in( dev, target, USB_TRANSFER_INTERRUPT,273 return enqueue_transfer_in(fun, target, USB_TRANSFER_INTERRUPT, 274 274 data, size, 275 275 callback, arg); 276 276 } 277 277 278 static int control_write(d evice_t *dev, usb_target_t target,278 static int control_write(ddf_fun_t *fun, usb_target_t target, 279 279 size_t max_packet_size, 280 280 void *setup_packet, size_t setup_packet_size, … … 283 283 { 284 284 control_transfer_info_t *transfer 285 = create_control_transfer_info( dev, USB_DIRECTION_OUT, target,285 = create_control_transfer_info(fun, USB_DIRECTION_OUT, target, 286 286 data, data_size, arg); 287 287 transfer->out_callback = callback; … … 294 294 } 295 295 296 static int control_read(d evice_t *dev, usb_target_t target,296 static int control_read(ddf_fun_t *fun, usb_target_t target, 297 297 size_t max_packet_size, 298 298 void *setup_packet, size_t setup_packet_size, … … 301 301 { 302 302 control_transfer_info_t *transfer 303 = create_control_transfer_info( dev, USB_DIRECTION_IN, target,303 = create_control_transfer_info(fun, USB_DIRECTION_IN, target, 304 304 data, data_size, arg); 305 305 transfer->in_callback = callback; … … 314 314 static usb_address_keeping_t addresses; 315 315 316 static int tell_address(d evice_t *dev, devman_handle_t handle,316 static int tell_address(ddf_fun_t *fun, devman_handle_t handle, 317 317 usb_address_t *address) 318 318 { 319 usb_log_debug("tell_address(fun \"%s\", handle %zu)\n", 320 fun->name, (size_t) fun->handle); 319 321 usb_address_t addr = usb_address_keeping_find(&addresses, handle); 320 322 if (addr < 0) { … … 326 328 } 327 329 328 static int reserve_default_address(d evice_t *dev, usb_speed_t ignored)330 static int reserve_default_address(ddf_fun_t *fun, usb_speed_t ignored) 329 331 { 330 332 usb_address_keeping_reserve_default(&addresses); … … 332 334 } 333 335 334 static int release_default_address(d evice_t *dev)336 static int release_default_address(ddf_fun_t *fun) 335 337 { 336 338 usb_address_keeping_release_default(&addresses); … … 338 340 } 339 341 340 static int request_address(d evice_t *dev, usb_speed_t ignored,342 static int request_address(ddf_fun_t *fun, usb_speed_t ignored, 341 343 usb_address_t *address) 342 344 { … … 350 352 } 351 353 352 static int release_address(d evice_t *dev, usb_address_t address)354 static int release_address(ddf_fun_t *fun, usb_address_t address) 353 355 { 354 356 return usb_address_keeping_release(&addresses, address); 355 357 } 356 358 357 static int bind_address(d evice_t *dev, usb_address_t address,359 static int bind_address(ddf_fun_t *fun, usb_address_t address, 358 360 devman_handle_t handle) 359 361 { 360 362 usb_address_keeping_devman_bind(&addresses, address, handle); 361 363 return EOK; 364 } 365 366 static int usb_iface_get_hc_handle_rh_impl(ddf_fun_t *root_hub_fun, 367 devman_handle_t *handle) 368 { 369 ddf_fun_t *hc_fun = root_hub_fun->driver_data; 370 assert(hc_fun != NULL); 371 372 *handle = hc_fun->handle; 373 374 usb_log_debug("usb_iface_get_hc_handle_rh_impl returns %zu\n", *handle); 375 376 return EOK; 377 } 378 379 static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle, 380 usb_address_t *address) 381 { 382 ddf_fun_t *hc_fun = root_hub_fun->driver_data; 383 assert(hc_fun != NULL); 384 385 return tell_address(hc_fun, root_hub_fun->handle, address); 362 386 } 363 387 … … 386 410 }; 387 411 412 usb_iface_t rh_usb_iface = { 413 .get_hc_handle = usb_iface_get_hc_handle_rh_impl, 414 .get_address = tell_address_rh 415 }; 416 388 417 389 418 /**
Note:
See TracChangeset
for help on using the changeset viewer.