Changeset b36e5de2 in mainline
- Timestamp:
- 2011-02-18T20:14:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 374552ef
- Parents:
- 228f251
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/drv/uhci-hcd/iface.c ¶
r228f251 rb36e5de2 164 164 return EOK; 165 165 } 166 /*----------------------------------------------------------------------------*/167 static int control_write_setup(device_t *dev, usb_target_t target,168 size_t max_packet_size,169 void *data, size_t size,170 usbhc_iface_transfer_out_callback_t callback, void *arg)171 {172 dev_speed_t speed = FULL_SPEED;173 166 174 usb_log_warning("Using deprecated API %s.\n", __FUNCTION__);175 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL,176 max_packet_size, speed, NULL, 0, data, size, NULL, callback, arg);177 if (!batch)178 return ENOMEM;179 batch_control_setup_old(batch);180 return EOK;181 }182 /*----------------------------------------------------------------------------*/183 static int control_write_data(device_t *dev, usb_target_t target,184 size_t max_packet_size,185 void *data, size_t size,186 usbhc_iface_transfer_out_callback_t callback, void *arg)187 {188 dev_speed_t speed = FULL_SPEED;189 167 190 usb_log_warning("Using deprecated API %s.\n", __FUNCTION__);191 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL,192 max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg);193 if (!batch)194 return ENOMEM;195 batch_control_write_data_old(batch);196 return EOK;197 }198 /*----------------------------------------------------------------------------*/199 static int control_write_status(device_t *dev, usb_target_t target,200 usbhc_iface_transfer_in_callback_t callback, void *arg)201 {202 size_t max_packet_size = 8;203 dev_speed_t speed = FULL_SPEED;204 205 usb_log_warning("Using deprecated API %s.\n", __FUNCTION__);206 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL,207 max_packet_size, speed, NULL, 0, NULL, 0, callback, NULL, arg);208 if (!batch)209 return ENOMEM;210 batch_control_write_status_old(batch);211 return EOK;212 }213 /*----------------------------------------------------------------------------*/214 static int control_read_setup(device_t *dev, usb_target_t target,215 size_t max_packet_size,216 void *data, size_t size,217 usbhc_iface_transfer_out_callback_t callback, void *arg)218 {219 dev_speed_t speed = FULL_SPEED;220 221 usb_log_warning("Using deprecated API %s.\n", __FUNCTION__);222 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL,223 max_packet_size, speed, NULL, 0, data, size, NULL, callback, arg);224 if (!batch)225 return ENOMEM;226 batch_control_setup_old(batch);227 return EOK;228 }229 /*----------------------------------------------------------------------------*/230 static int control_read_data(device_t *dev, usb_target_t target,231 size_t max_packet_size,232 void *data, size_t size,233 usbhc_iface_transfer_in_callback_t callback, void *arg)234 {235 dev_speed_t speed = FULL_SPEED;236 237 usb_log_warning("Using deprecated API %s.\n", __FUNCTION__);238 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL,239 max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg);240 if (!batch)241 return ENOMEM;242 batch_control_read_data_old(batch);243 return EOK;244 }245 /*----------------------------------------------------------------------------*/246 static int control_read_status(device_t *dev, usb_target_t target,247 usbhc_iface_transfer_out_callback_t callback, void *arg)248 {249 size_t max_packet_size = 8;250 dev_speed_t speed = FULL_SPEED;251 252 usb_log_warning("Using deprecated API %s.\n", __FUNCTION__);253 batch_t *batch = batch_get(dev, target, USB_TRANSFER_CONTROL,254 max_packet_size, speed, NULL, 0, NULL, 0, NULL, callback, arg);255 if (!batch)256 return ENOMEM;257 batch_control_read_status_old(batch);258 return EOK;259 }260 168 /*----------------------------------------------------------------------------*/ 261 169 usbhc_iface_t uhci_iface = { … … 273 181 .control_read = control_read, 274 182 .control_write = control_write, 275 276 .control_write_setup = control_write_setup,277 .control_write_data = control_write_data,278 .control_write_status = control_write_status,279 280 .control_read_setup = control_read_setup,281 .control_read_data = control_read_data,282 .control_read_status = control_read_status283 183 }; 284 184 /** -
TabularUnified uspace/drv/vhc/connhost.c ¶
r228f251 rb36e5de2 234 234 } 235 235 236 static int enqueue_transfer_setup(device_t *dev,237 usb_target_t target, usb_transfer_type_t transfer_type,238 void *buffer, size_t size,239 usbhc_iface_transfer_out_callback_t callback, void *arg)240 {241 usb_log_debug2("Transfer SETUP [%d.%d (%s); %zu].\n",242 target.address, target.endpoint,243 usb_str_transfer_type(transfer_type),244 size);245 246 transfer_info_t *transfer247 = create_transfer_info(dev, USB_DIRECTION_OUT, arg);248 transfer->out_callback = callback;249 250 hc_add_transaction_to_device(true, target, transfer_type, buffer, size,251 universal_callback, transfer);252 253 return EOK;254 }255 256 236 static int enqueue_transfer_in(device_t *dev, 257 237 usb_target_t target, usb_transfer_type_t transfer_type, … … 292 272 return enqueue_transfer_in(dev, target, USB_TRANSFER_INTERRUPT, 293 273 data, size, 294 callback, arg);295 }296 297 static int control_write_setup(device_t *dev, usb_target_t target,298 size_t max_packet_size,299 void *data, size_t size,300 usbhc_iface_transfer_out_callback_t callback, void *arg)301 {302 return enqueue_transfer_setup(dev, target, USB_TRANSFER_CONTROL,303 data, size,304 callback, arg);305 }306 307 static int control_write_data(device_t *dev, usb_target_t target,308 size_t max_packet_size,309 void *data, size_t size,310 usbhc_iface_transfer_out_callback_t callback, void *arg)311 {312 return enqueue_transfer_out(dev, target, USB_TRANSFER_CONTROL,313 data, size,314 callback, arg);315 }316 317 static int control_write_status(device_t *dev, usb_target_t target,318 usbhc_iface_transfer_in_callback_t callback, void *arg)319 {320 return enqueue_transfer_in(dev, target, USB_TRANSFER_CONTROL,321 NULL, 0,322 274 callback, arg); 323 275 } … … 341 293 } 342 294 343 static int control_read_setup(device_t *dev, usb_target_t target,344 size_t max_packet_size,345 void *data, size_t size,346 usbhc_iface_transfer_out_callback_t callback, void *arg)347 {348 return enqueue_transfer_setup(dev, target, USB_TRANSFER_CONTROL,349 data, size,350 callback, arg);351 }352 353 static int control_read_data(device_t *dev, usb_target_t target,354 size_t max_packet_size,355 void *data, size_t size,356 usbhc_iface_transfer_in_callback_t callback, void *arg)357 {358 return enqueue_transfer_in(dev, target, USB_TRANSFER_CONTROL,359 data, size,360 callback, arg);361 }362 363 static int control_read_status(device_t *dev, usb_target_t target,364 usbhc_iface_transfer_out_callback_t callback, void *arg)365 {366 return enqueue_transfer_out(dev, target, USB_TRANSFER_CONTROL,367 NULL, 0,368 callback, arg);369 }370 371 295 static int control_read(device_t *dev, usb_target_t target, 372 296 size_t max_packet_size, … … 455 379 .interrupt_in = interrupt_in, 456 380 457 .control_write_setup = control_write_setup,458 .control_write_data = control_write_data,459 .control_write_status = control_write_status,460 461 381 .control_write = control_write, 462 463 .control_read_setup = control_read_setup,464 .control_read_data = control_read_data,465 .control_read_status = control_read_status,466 467 382 .control_read = control_read 468 383 }; -
TabularUnified uspace/lib/drv/generic/remote_usbhc.c ¶
r228f251 rb36e5de2 46 46 static void remote_usbhc_interrupt_out(device_t *, void *, ipc_callid_t, ipc_call_t *); 47 47 static void remote_usbhc_interrupt_in(device_t *, void *, ipc_callid_t, ipc_call_t *); 48 static void remote_usbhc_control_write_setup(device_t *, void *, ipc_callid_t, ipc_call_t *);49 static void remote_usbhc_control_write_data(device_t *, void *, ipc_callid_t, ipc_call_t *);50 static void remote_usbhc_control_write_status(device_t *, void *, ipc_callid_t, ipc_call_t *);51 static void remote_usbhc_control_read_setup(device_t *, void *, ipc_callid_t, ipc_call_t *);52 static void remote_usbhc_control_read_data(device_t *, void *, ipc_callid_t, ipc_call_t *);53 static void remote_usbhc_control_read_status(device_t *, void *, ipc_callid_t, ipc_call_t *);54 48 static void remote_usbhc_control_write(device_t *, void *, ipc_callid_t, ipc_call_t *); 55 49 static void remote_usbhc_control_read(device_t *, void *, ipc_callid_t, ipc_call_t *); … … 75 69 remote_usbhc_interrupt_in, 76 70 77 remote_usbhc_control_write_setup,78 remote_usbhc_control_write_data,79 remote_usbhc_control_write_status,80 81 remote_usbhc_control_read_setup,82 remote_usbhc_control_read_data,83 remote_usbhc_control_read_status,84 85 71 remote_usbhc_control_write, 86 72 remote_usbhc_control_read … … 385 371 } 386 372 387 /** Process status part of control transfer.388 *389 * @param device Target device.390 * @param callid Initiating caller.391 * @param call Initiating call.392 * @param direction Transfer direction (read ~ in, write ~ out).393 * @param transfer_in_func Transfer function for control read (might be NULL).394 * @param transfer_out_func Transfer function for control write (might be NULL).395 */396 static void remote_usbhc_status_transfer(device_t *device,397 ipc_callid_t callid, ipc_call_t *call,398 usb_direction_t direction,399 int (*transfer_in_func)(device_t *, usb_target_t,400 usbhc_iface_transfer_in_callback_t, void *),401 int (*transfer_out_func)(device_t *, usb_target_t,402 usbhc_iface_transfer_out_callback_t, void *))403 {404 switch (direction) {405 case USB_DIRECTION_IN:406 if (!transfer_in_func) {407 async_answer_0(callid, ENOTSUP);408 return;409 }410 break;411 case USB_DIRECTION_OUT:412 if (!transfer_out_func) {413 async_answer_0(callid, ENOTSUP);414 return;415 }416 break;417 default:418 assert(false && "unreachable code");419 break;420 }421 422 usb_target_t target = {423 .address = DEV_IPC_GET_ARG1(*call),424 .endpoint = DEV_IPC_GET_ARG2(*call)425 };426 427 async_transaction_t *trans = async_transaction_create(callid);428 if (trans == NULL) {429 async_answer_0(callid, ENOMEM);430 return;431 }432 433 int rc;434 switch (direction) {435 case USB_DIRECTION_IN:436 rc = transfer_in_func(device, target,437 callback_in, trans);438 break;439 case USB_DIRECTION_OUT:440 rc = transfer_out_func(device, target,441 callback_out, trans);442 break;443 default:444 assert(false && "unreachable code");445 break;446 }447 448 if (rc != EOK) {449 async_answer_0(callid, rc);450 async_transaction_destroy(trans);451 }452 }453 454 455 373 void remote_usbhc_interrupt_out(device_t *device, void *iface, 456 374 ipc_callid_t callid, ipc_call_t *call) … … 471 389 return remote_usbhc_in_transfer(device, callid, call, 472 390 usb_iface->interrupt_in); 473 }474 475 void remote_usbhc_control_write_setup(device_t *device, void *iface,476 ipc_callid_t callid, ipc_call_t *call)477 {478 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;479 assert(usb_iface != NULL);480 481 return remote_usbhc_out_transfer(device, callid, call,482 usb_iface->control_write_setup);483 }484 485 void remote_usbhc_control_write_data(device_t *device, void *iface,486 ipc_callid_t callid, ipc_call_t *call)487 {488 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;489 assert(usb_iface != NULL);490 491 return remote_usbhc_out_transfer(device, callid, call,492 usb_iface->control_write_data);493 }494 495 void remote_usbhc_control_write_status(device_t *device, void *iface,496 ipc_callid_t callid, ipc_call_t *call)497 {498 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;499 assert(usb_iface != NULL);500 501 return remote_usbhc_status_transfer(device, callid, call,502 USB_DIRECTION_IN, usb_iface->control_write_status, NULL);503 }504 505 void remote_usbhc_control_read_setup(device_t *device, void *iface,506 ipc_callid_t callid, ipc_call_t *call)507 {508 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;509 assert(usb_iface != NULL);510 511 return remote_usbhc_out_transfer(device, callid, call,512 usb_iface->control_read_setup);513 }514 515 void remote_usbhc_control_read_data(device_t *device, void *iface,516 ipc_callid_t callid, ipc_call_t *call)517 {518 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;519 assert(usb_iface != NULL);520 521 return remote_usbhc_in_transfer(device, callid, call,522 usb_iface->control_read_data);523 }524 525 void remote_usbhc_control_read_status(device_t *device, void *iface,526 ipc_callid_t callid, ipc_call_t *call)527 {528 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;529 assert(usb_iface != NULL);530 531 return remote_usbhc_status_transfer(device, callid, call,532 USB_DIRECTION_OUT, NULL, usb_iface->control_read_status);533 391 } 534 392 -
TabularUnified uspace/lib/drv/include/usbhc_iface.h ¶
r228f251 rb36e5de2 153 153 IPC_M_USBHC_INTERRUPT_IN, 154 154 155 156 /** Start WRITE control transfer.157 * See explanation at usb_iface_funcs_t (OUT transaction).158 */159 IPC_M_USBHC_CONTROL_WRITE_SETUP,160 161 /** Send control-transfer data to device.162 * See explanation at usb_iface_funcs_t (OUT transaction).163 */164 IPC_M_USBHC_CONTROL_WRITE_DATA,165 166 /** Terminate WRITE control transfer.167 * See explanation at usb_iface_funcs_t (NO-DATA transaction).168 */169 IPC_M_USBHC_CONTROL_WRITE_STATUS,170 171 172 173 /** Start READ control transfer.174 * See explanation at usb_iface_funcs_t (OUT transaction).175 */176 IPC_M_USBHC_CONTROL_READ_SETUP,177 178 /** Get control-transfer data from device.179 * See explanation at usb_iface_funcs_t (IN transaction).180 */181 IPC_M_USBHC_CONTROL_READ_DATA,182 183 /** Terminate READ control transfer.184 * See explanation at usb_iface_funcs_t (NO-DATA transaction).185 */186 IPC_M_USBHC_CONTROL_READ_STATUS,187 188 155 /** Issue control WRITE transfer. 189 156 * See explanation at usb_iface_funcs_t (OUT transaction) for … … 240 207 usbhc_iface_transfer_in_t interrupt_in; 241 208 242 usbhc_iface_transfer_setup_t control_write_setup;243 usbhc_iface_transfer_out_t control_write_data;244 int (*control_write_status)(device_t *, usb_target_t,245 usbhc_iface_transfer_in_callback_t, void *);246 247 usbhc_iface_transfer_setup_t control_read_setup;248 usbhc_iface_transfer_in_t control_read_data;249 int (*control_read_status)(device_t *, usb_target_t,250 usbhc_iface_transfer_out_callback_t, void *);251 252 209 int (*control_write)(device_t *, usb_target_t, 253 210 size_t,
Note:
See TracChangeset
for help on using the changeset viewer.