Changeset 82122f3 in mainline for uspace/drv
- Timestamp:
- 2010-12-17T14:51:41Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1f383dde
- Parents:
- 692f13e4 (diff), 11658b64 (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. - Location:
- uspace/drv
- Files:
-
- 4 added
- 1 deleted
- 22 edited
- 1 moved
-
ns8250/ns8250.c (modified) (1 diff)
-
uhci/main.c (modified) (1 diff)
-
usbhub/main.c (modified) (2 diffs)
-
usbhub/port_status.h (modified) (1 diff)
-
usbhub/usbhub.h (modified) (2 diffs)
-
usbhub/usbhub.ma (modified) (1 diff)
-
usbhub/usbhub_private.h (modified) (1 diff)
-
usbhub/utils.c (modified) (20 diffs)
-
usbkbd/main.c (modified) (3 diffs)
-
usbkbd/usbkbd.ma (modified) (1 diff)
-
vhc/Makefile (modified) (3 diffs)
-
vhc/conn.h (modified) (1 diff)
-
vhc/conndev.c (modified) (2 diffs)
-
vhc/connhost.c (modified) (6 diffs)
-
vhc/debug.c (modified) (1 diff)
-
vhc/devices.c (modified) (7 diffs)
-
vhc/hc.c (modified) (13 diffs)
-
vhc/hc.h (modified) (2 diffs)
-
vhc/hcd.c (modified) (2 diffs)
-
vhc/hub.c (modified) (1 diff)
-
vhc/hub.h (modified) (1 diff)
-
vhc/hub/hub.c (added)
-
vhc/hub/hub.h (added)
-
vhc/hub/virthub.c (added)
-
vhc/hub/virthub.h (moved) (moved from uspace/drv/vhc/hubintern.h ) (3 diffs)
-
vhc/hub/virthubops.c (added)
-
vhc/hubops.c (deleted)
-
vhc/vhcd.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ns8250/ns8250.c
r692f13e4 r82122f3 887 887 ipc_call_t *call) 888 888 { 889 ipcarg_t method = IPC_GET_METHOD(*call);889 sysarg_t method = IPC_GET_IMETHOD(*call); 890 890 int ret; 891 891 unsigned int baud_rate, parity, word_length, stop_bits; -
uspace/drv/uhci/main.c
r692f13e4 r82122f3 29 29 #include <usb/debug.h> 30 30 #include <errno.h> 31 #include <driver.h> 31 32 #include "uhci.h" 32 33 -
uspace/drv/usbhub/main.c
r692f13e4 r82122f3 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 #include <usb/usbdrv.h> 28 29 29 #include <driver.h> 30 30 #include <errno.h> 31 #include <async.h> 32 33 #include <usb/usbdrv.h> 31 34 #include "usbhub.h" 32 35 #include "usbhub_private.h" … … 44 47 }; 45 48 49 int usb_hub_control_loop(void * noparam){ 50 while(true){ 51 usb_hub_check_hub_changes(); 52 async_usleep(1000 * 1000); 53 } 54 return 0; 55 } 56 57 46 58 int main(int argc, char *argv[]) 47 59 { 48 60 usb_lst_init(&usb_hub_list); 61 fid_t fid = fibril_create(usb_hub_control_loop, NULL); 62 if (fid == 0) { 63 printf("%s: failed to start fibril for HUB devices\n", NAME); 64 return ENOMEM; 65 } 66 fibril_add_ready(fid); 67 49 68 return driver_main(&hub_driver); 50 69 } -
uspace/drv/usbhub/port_status.h
r692f13e4 r82122f3 55 55 request->index = port; 56 56 request->request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS; 57 request->request = USB_HUB_REQUEST_GET_STAT E;57 request->request = USB_HUB_REQUEST_GET_STATUS; 58 58 request->value = 0; 59 59 request->length = 4; -
uspace/drv/usbhub/usbhub.h
r692f13e4 r82122f3 40 40 #include "usb/hcdhubd.h" 41 41 42 42 /** basic information about device attached to hub */ 43 typedef struct{ 44 usb_address_t address; 45 devman_handle_t devman_handle; 46 }usb_hub_attached_device_t; 43 47 44 48 /** Information about attached hub. */ … … 46 50 /** Number of ports. */ 47 51 int port_count; 48 /** General device info. */ 49 usb_hcd_attached_device_info_t * device; 52 /** attached device handles */ 53 usb_hub_attached_device_t * attached_devs; 54 /** General usb device info. */ 55 usb_hcd_attached_device_info_t * usb_device; 56 /** General device info*/ 57 device_t * device; 58 50 59 } usb_hub_info_t; 51 60 52 int usb_add_hub_device(device_t *); 61 /** 62 * function running the hub-controlling loop. 63 * @param noparam fundtion does not need any parameters 64 */ 65 int usb_hub_control_loop(void * noparam); 66 67 /** Callback when new hub device is detected. 68 * 69 * @param dev New device. 70 * @return Error code. 71 */ 72 int usb_add_hub_device(device_t *dev); 73 74 /** 75 * check changes on all registered hubs 76 */ 77 void usb_hub_check_hub_changes(void); 78 79 80 //int usb_add_hub_device(device_t *); 81 82 53 83 54 84 #endif -
uspace/drv/usbhub/usbhub.ma
r692f13e4 r82122f3 1 1 10 usb&hub 2 10 usb&class=hub -
uspace/drv/usbhub/usbhub_private.h
r692f13e4 r82122f3 182 182 } 183 183 184 static inline int usb_hub_clear_port_feature(int hc, usb_address_t address, 185 int port_index, 186 usb_hub_class_feature_t feature) { 187 usb_target_t target = { 188 .address = address, 189 .endpoint = 0 190 }; 191 usb_device_request_setup_packet_t clear_request = { 192 .request_type = USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE, 193 .request = USB_DEVREQ_CLEAR_FEATURE, 194 .length = 0, 195 .index = port_index 196 }; 197 clear_request.value = feature; 198 return usb_drv_psync_control_write(hc, target, &clear_request, 199 sizeof(clear_request), NULL, 0); 200 } 201 184 202 185 203 -
uspace/drv/usbhub/utils.c
r692f13e4 r82122f3 34 34 */ 35 35 #include <driver.h> 36 #include <usb/devreq.h> 36 #include <bool.h> 37 #include <errno.h> 38 37 39 #include <usbhc_iface.h> 38 40 #include <usb/usbdrv.h> 39 41 #include <usb/descriptor.h> 40 #include <driver.h> 41 #include <bool.h> 42 #include <errno.h> 42 #include <usb/devreq.h> 43 43 #include <usb/classes/hub.h> 44 44 45 #include "usbhub.h" 45 46 #include "usbhub_private.h" 46 47 #include "port_status.h" 47 #include <usb/devreq.h> 48 49 static void check_hub_changes(void); 48 50 49 51 50 size_t USB_HUB_MAX_DESCRIPTOR_SIZE = 71; … … 302 301 //result->device = device; 303 302 result->port_count = -1; 303 /// \TODO is this correct? is the device stored? 304 result->device = device; 304 305 305 306 … … 316 317 }*/ 317 318 318 result-> device = usb_new(usb_hcd_attached_device_info_t);319 result-> device->address = addr;319 result->usb_device = usb_new(usb_hcd_attached_device_info_t); 320 result->usb_device->address = addr; 320 321 321 322 // get hub descriptor … … 350 351 //printf("[usb_hub] setting port count to %d\n",descriptor->ports_count); 351 352 result->port_count = descriptor->ports_count; 353 result->attached_devs = (usb_hub_attached_device_t*) 354 malloc((result->port_count+1) * sizeof(usb_hub_attached_device_t)); 355 int i; 356 for(i=0;i<result->port_count+1;++i){ 357 result->attached_devs[i].devman_handle=0; 358 result->attached_devs[i].address=0; 359 } 352 360 //printf("[usb_hub] freeing data\n"); 353 361 free(serialized_descriptor); … … 362 370 } 363 371 364 /** Callback when new hub device is detected.365 *366 * @param dev New device.367 * @return Error code.368 */369 372 int usb_add_hub_device(device_t *dev) { 370 373 printf(NAME ": add_hub_device(handle=%d)\n", (int) dev->handle); … … 387 390 usb_device_request_setup_packet_t request; 388 391 usb_target_t target; 389 target.address = hub_info-> device->address;392 target.address = hub_info->usb_device->address; 390 393 target.endpoint = 0; 391 for (port = 0; port < hub_info->port_count; ++port) { 394 395 //get configuration descriptor 396 // this is not fully correct - there are more configurations 397 // and all should be checked 398 usb_standard_device_descriptor_t std_descriptor; 399 opResult = usb_drv_req_get_device_descriptor(hc, target.address, 400 &std_descriptor); 401 if(opResult!=EOK){ 402 printf("[usb_hub] could not get device descriptor, %d\n",opResult); 403 return 1;///\TODO some proper error code needed 404 } 405 printf("[usb_hub] hub has %d configurations\n",std_descriptor.configuration_count); 406 if(std_descriptor.configuration_count<1){ 407 printf("[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE\n"); 408 } 409 usb_standard_configuration_descriptor_t config_descriptor; 410 opResult = usb_drv_req_get_bare_configuration_descriptor(hc, 411 target.address, 0, 412 &config_descriptor); 413 if(opResult!=EOK){ 414 printf("[usb_hub] could not get configuration descriptor, %d\n",opResult); 415 return 1;///\TODO some proper error code needed 416 } 417 //set configuration 418 request.request_type = 0; 419 request.request = USB_DEVREQ_SET_CONFIGURATION; 420 request.index=0; 421 request.length=0; 422 request.value_high=0; 423 request.value_low = config_descriptor.configuration_number; 424 opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0); 425 if (opResult != EOK) { 426 printf("[usb_hub]something went wrong when setting hub`s configuration, %d\n", opResult); 427 } 428 429 430 for (port = 1; port < hub_info->port_count+1; ++port) { 392 431 usb_hub_set_power_port_request(&request, port); 393 432 opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0); 433 printf("[usb_hub] powering port %d\n",port); 394 434 if (opResult != EOK) { 395 435 printf("[usb_hub]something went wrong when setting hub`s %dth port\n", port); … … 397 437 } 398 438 //ports powered, hub seems to be enabled 439 399 440 400 441 ipc_hangup(hc); … … 404 445 printf("[usb_hub] hub info added to list\n"); 405 446 //(void)hub_info; 406 check_hub_changes();447 usb_hub_check_hub_changes(); 407 448 408 449 /// \TODO start the check loop, if not already started... … … 412 453 413 454 printf("[usb_hub] hub dev added\n"); 455 printf("\taddress %d, has %d ports \n", 456 hub_info->usb_device->address, 457 hub_info->port_count); 458 printf("\tused configuration %d\n",config_descriptor.configuration_number); 414 459 415 460 return EOK; … … 429 474 * @param target 430 475 */ 431 432 476 static void usb_hub_init_add_device(int hc, uint16_t port, usb_target_t target) { 433 477 usb_device_request_setup_packet_t request; 434 478 int opResult; 435 479 printf("[usb_hub] some connection changed\n"); 436 480 //get default address 437 481 opResult = usb_drv_reserve_default_address(hc); 438 482 if (opResult != EOK) { … … 459 503 * @param target 460 504 */ 461 static void usb_hub_finalize_add_device( 505 static void usb_hub_finalize_add_device( usb_hub_info_t * hub, 462 506 int hc, uint16_t port, usb_target_t target) { 463 507 464 usb_device_request_setup_packet_t request;465 508 int opResult; 466 509 printf("[usb_hub] finalizing add device\n"); 467 usb_address_t new_device_address = 468 usb_drv_request_address(hc); 469 usb_hub_set_set_address_request 470 (&request, new_device_address); 510 opResult = usb_hub_clear_port_feature(hc, target.address, 511 port, USB_HUB_FEATURE_C_PORT_RESET); 512 if (opResult != EOK) { 513 goto release; 514 } 515 516 /* Request address at from host controller. */ 517 usb_address_t new_device_address = usb_drv_request_address(hc); 518 if (new_device_address < 0) { 519 printf("[usb_hub] failed to get free USB address\n"); 520 opResult = new_device_address; 521 goto release; 522 } 523 printf("[usb_hub] setting new address\n"); 524 opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, 525 new_device_address); 526 527 if (opResult != EOK) { 528 printf("[usb_hub] could not set address for new device\n"); 529 goto release; 530 } 531 532 release: 533 printf("[usb_hub] releasing default address\n"); 534 usb_drv_release_default_address(hc); 535 if (opResult != EOK) { 536 return; 537 } 538 539 devman_handle_t child_handle; 540 opResult = usb_drv_register_child_in_devman(hc, hub->device, 541 new_device_address, &child_handle); 542 if (opResult != EOK) { 543 printf("[usb_hub] could not start driver for new device \n"); 544 return; 545 } 546 hub->attached_devs[port].devman_handle = child_handle; 547 hub->attached_devs[port].address = new_device_address; 548 549 opResult = usb_drv_bind_address(hc, new_device_address, child_handle); 550 if (opResult != EOK) { 551 printf("[usb_hub] could not assign address of device in hcd \n"); 552 return; 553 } 554 printf("[usb_hub] new device address %d, handle %zu\n", 555 new_device_address, child_handle); 556 557 } 558 559 /** 560 * unregister device address in hc, close the port 561 * @param hc 562 * @param port 563 * @param target 564 */ 565 static void usb_hub_removed_device( 566 usb_hub_info_t * hub, int hc, uint16_t port, usb_target_t target) { 567 //usb_device_request_setup_packet_t request; 568 int opResult; 569 //disable port 570 /*usb_hub_set_disable_port_request(&request, port); 471 571 opResult = usb_drv_sync_control_write( 472 572 hc, target, … … 475 575 ); 476 576 if (opResult != EOK) { 477 printf("[usb_hub] could not set address for new device\n");478 //will retry later...479 return;480 }481 usb_drv_release_default_address(hc);482 483 484 /// \TODO driver work485 //add_child_device.....486 }487 488 /**489 * unregister device address in hc, close the port490 * @param hc491 * @param port492 * @param target493 */494 static void usb_hub_removed_device(int hc, uint16_t port, usb_target_t target) {495 usb_device_request_setup_packet_t request;496 int opResult;497 //disable port498 usb_hub_set_disable_port_request(&request, port);499 opResult = usb_drv_sync_control_write(500 hc, target,501 &request,502 NULL, 0503 );504 if (opResult != EOK) {505 577 //continue; 506 578 printf("[usb_hub] something went wrong when disabling a port\n"); 507 } 508 //remove device 579 }*/ 580 /// \TODO remove device 581 582 hub->attached_devs[port].devman_handle=0; 509 583 //close address 510 // 511 512 ///\TODO this code is not complete 584 if(hub->attached_devs[port].address!=0){ 585 opResult = usb_drv_release_address(hc,hub->attached_devs[port].address); 586 if(opResult != EOK) { 587 printf("[usb_hub] could not release address of removed device: %d\n",opResult); 588 } 589 hub->attached_devs[port].address = 0; 590 }else{ 591 printf("[usb_hub] this is strange, disconnected device had no address\n"); 592 //device was disconnected before it`s port was reset - return default address 593 usb_drv_release_default_address(hc); 594 } 513 595 } 514 596 … … 519 601 * @param target 520 602 */ 521 static void usb_hub_process_interrupt(int hc, uint16_t port, usb_target_t target) { 603 static void usb_hub_process_interrupt(usb_hub_info_t * hub, int hc, 604 uint16_t port, usb_address_t address) { 522 605 printf("[usb_hub] interrupt at port %d\n", port); 523 606 //determine type of change 607 usb_target_t target; 608 target.address=address; 609 target.endpoint=0; 524 610 usb_port_status_t status; 525 611 size_t rcvd_size; … … 527 613 int opResult; 528 614 usb_hub_set_port_status_request(&request, port); 615 //endpoint 0 529 616 530 617 opResult = usb_drv_sync_control_read( … … 543 630 //something connected/disconnected 544 631 if (usb_port_connect_change(&status)) { 632 opResult = usb_hub_clear_port_feature(hc, target.address, 633 port, USB_HUB_FEATURE_C_PORT_CONNECTION); 634 // TODO: check opResult 545 635 if (usb_port_dev_connected(&status)) { 546 636 printf("[usb_hub] some connection changed\n"); 547 637 usb_hub_init_add_device(hc, port, target); 548 638 } else { 549 usb_hub_removed_device(h c, port, target);639 usb_hub_removed_device(hub, hc, port, target); 550 640 } 551 641 } 552 642 //port reset 553 643 if (usb_port_reset_completed(&status)) { 554 printf("[usb_hub] finalizing add device\n");644 printf("[usb_hub] port reset complete\n"); 555 645 if (usb_port_enabled(&status)) { 556 usb_hub_finalize_add_device(h c, port, target);646 usb_hub_finalize_add_device(hub, hc, port, target); 557 647 } else { 558 648 printf("[usb_hub] ERROR: port reset, but port still not enabled\n"); … … 565 655 usb_port_set_dev_connected(&status, false); 566 656 if (status) { 567 printf("[usb_hub]there was some unsupported change on port \n");657 printf("[usb_hub]there was some unsupported change on port %d\n",port); 568 658 } 569 659 /// \TODO handle other changes … … 585 675 /** Check changes on all known hubs. 586 676 */ 587 static voidcheck_hub_changes(void) {677 void usb_hub_check_hub_changes(void) { 588 678 /* 589 679 * Iterate through all hubs. … … 593 683 lst_item != &usb_hub_list; 594 684 lst_item = lst_item->next) { 595 printf("[usb_hub] checking hub changes\n");685 usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data); 596 686 /* 597 687 * Check status change pipe of this hub. 598 688 */ 599 689 600 usb_target_t target = { 601 .address = 5, 602 .endpoint = 1 603 }; 604 /// \TODO uncomment once it works correctly 605 //target.address = usb_create_hub_info(lst_item)->device->address; 606 607 size_t port_count = 7; 690 usb_target_t target; 691 target.address = hub_info->usb_device->address; 692 target.endpoint = 1;/// \TODO get from endpoint descriptor 693 printf("[usb_hub] checking changes for hub at addr %d\n", 694 target.address); 695 696 size_t port_count = hub_info->port_count; 608 697 609 698 /* 610 699 * Connect to respective HC. 611 700 */ 612 /// \FIXME this is incorrect code: here 613 /// must be used particular device instead of NULL 614 //which one? 615 int hc = usb_drv_hc_connect(NULL, 0); 701 int hc = usb_drv_hc_connect(hub_info->device, 0); 616 702 if (hc < 0) { 617 703 continue; … … 619 705 620 706 // FIXME: count properly 621 size_t byte_length = ( port_count/ 8) + 1;707 size_t byte_length = ((port_count+1) / 8) + 1; 622 708 623 709 void *change_bitmap = malloc(byte_length); … … 639 725 } 640 726 unsigned int port; 641 for (port = 0; port < port_count; ++port) {727 for (port = 1; port < port_count+1; ++port) { 642 728 bool interrupt = (((uint8_t*) change_bitmap)[port / 8] >> (port % 8)) % 2; 643 729 if (interrupt) { 644 usb_hub_process_interrupt(hc, port, target); 730 usb_hub_process_interrupt( 731 hub_info, hc, port, hub_info->usb_device->address); 645 732 } 646 733 } -
uspace/drv/usbkbd/main.c
r692f13e4 r82122f3 40 40 #define NAME "usbkbd" 41 41 42 static const usb_endpoint_t CONTROL_EP = 0; 42 #define GUESSED_POLL_ENDPOINT 1 43 43 44 44 /* … … 130 130 131 131 // default endpoint 132 kbd_dev-> default_ep = CONTROL_EP;132 kbd_dev->poll_endpoint = GUESSED_POLL_ENDPOINT; 133 133 134 134 /* … … 178 178 usb_target_t poll_target = { 179 179 .address = kbd_dev->address, 180 .endpoint = kbd_dev-> default_ep180 .endpoint = kbd_dev->poll_endpoint 181 181 }; 182 182 183 183 while (true) { 184 async_usleep(1000 * 1000); 184 185 rc = usb_drv_async_interrupt_in(kbd_dev->device->parent_phone, 185 186 poll_target, buffer, BUFFER_SIZE, &actual_size, &handle); -
uspace/drv/usbkbd/usbkbd.ma
r692f13e4 r82122f3 1 1 10 usb&class=hid 2 10 usb&class=HID 3 10 usb&interface&class=HID 2 4 10 usb&hid -
uspace/drv/vhc/Makefile
r692f13e4 r82122f3 33 33 $(LIBDRV_PREFIX)/libdrv.a 34 34 EXTRA_CFLAGS += \ 35 -I$(LIB _PREFIX)\35 -I$(LIBUSBVIRT_PREFIX)/include \ 36 36 -I$(LIBUSB_PREFIX)/include \ 37 37 -I$(LIBDRV_PREFIX)/include … … 39 39 40 40 SOURCES = \ 41 hub/hub.c \ 42 hub/virthub.c \ 43 hub/virthubops.c \ 41 44 conndev.c \ 42 45 connhost.c \ … … 45 48 hc.c \ 46 49 hcd.c \ 47 hub.c \ 48 hubops.c 50 hub.c 49 51 50 52 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/vhc/conn.h
r692f13e4 r82122f3 42 42 #include "devices.h" 43 43 44 void connection_handler_host( ipcarg_t);44 void connection_handler_host(sysarg_t); 45 45 46 46 usb_hcd_transfer_ops_t vhc_transfer_ops; -
uspace/drv/vhc/conndev.c
r692f13e4 r82122f3 47 47 { 48 48 ipc_call_t answer_data; 49 ipcarg_t answer_rc;49 sysarg_t answer_rc; 50 50 aid_t req; 51 51 int rc; … … 83 83 ipc_callid_t icallid, ipc_call_t *icall) 84 84 { 85 ipcarg_t method = IPC_GET_METHOD(*icall);85 sysarg_t method = IPC_GET_IMETHOD(*icall); 86 86 87 87 if (method == IPC_M_CONNECT_TO_ME) { -
uspace/drv/vhc/connhost.c
r692f13e4 r82122f3 93 93 usbhc_iface_transfer_out_callback_t callback, void *arg) 94 94 { 95 printf(NAME ": transfer OUT [%d.%d (%s); %zu]\n",95 dprintf(3, "transfer OUT [%d.%d (%s); %zu]", 96 96 target.address, target.endpoint, 97 97 usb_str_transfer_type(transfer_type), … … 102 102 transfer->out_callback = callback; 103 103 104 hc_add_transaction_to_device(false, target, buffer, size,104 hc_add_transaction_to_device(false, target, transfer_type, buffer, size, 105 105 universal_callback, transfer); 106 106 … … 113 113 usbhc_iface_transfer_out_callback_t callback, void *arg) 114 114 { 115 printf(NAME ": transfer SETUP [%d.%d (%s); %zu]\n",115 dprintf(3, "transfer SETUP [%d.%d (%s); %zu]", 116 116 target.address, target.endpoint, 117 117 usb_str_transfer_type(transfer_type), … … 122 122 transfer->out_callback = callback; 123 123 124 hc_add_transaction_to_device(true, target, buffer, size,124 hc_add_transaction_to_device(true, target, transfer_type, buffer, size, 125 125 universal_callback, transfer); 126 126 … … 133 133 usbhc_iface_transfer_in_callback_t callback, void *arg) 134 134 { 135 printf(NAME ": transfer IN [%d.%d (%s); %zu]\n",135 dprintf(3, "transfer IN [%d.%d (%s); %zu]", 136 136 target.address, target.endpoint, 137 137 usb_str_transfer_type(transfer_type), … … 142 142 transfer->in_callback = callback; 143 143 144 hc_add_transaction_from_device(target, buffer, size,144 hc_add_transaction_from_device(target, transfer_type, buffer, size, 145 145 universal_callback, transfer); 146 146 -
uspace/drv/vhc/debug.c
r692f13e4 r82122f3 42 42 /** Debug print informing of invalid call. 43 43 */ 44 void dprintf_inval_call(int level, ipc_call_t call, ipcarg_t phone_hash)44 void dprintf_inval_call(int level, ipc_call_t call, sysarg_t phone_hash) 45 45 { 46 46 dprintf(level, "phone%#x: invalid call [%u (%u, %u, %u, %u, %u)]", 47 47 phone_hash, 48 IPC_GET_ METHOD(call),48 IPC_GET_IMETHOD(call), 49 49 IPC_GET_ARG1(call), IPC_GET_ARG2(call), IPC_GET_ARG3(call), 50 50 IPC_GET_ARG4(call), IPC_GET_ARG5(call)); -
uspace/drv/vhc/devices.c
r692f13e4 r82122f3 47 47 #include "devices.h" 48 48 #include "hub.h" 49 #include "hub/virthub.h" 49 50 #include "vhcd.h" 50 51 … … 69 70 list_append(&dev->link, &devices); 70 71 71 hub_add_device(dev);72 virthub_connect_device(&virtual_hub_device, dev); 72 73 73 74 return dev; … … 78 79 void virtdev_destroy_device(virtdev_connection_t *dev) 79 80 { 80 hub_remove_device(dev);81 virthub_disconnect_device(&virtual_hub_device, dev); 81 82 list_remove(&dev->link); 82 83 free(dev); … … 94 95 = list_get_instance(pos, virtdev_connection_t, link); 95 96 96 if (! hub_can_device_signal(dev)) {97 if (!virthub_is_device_enabled(&virtual_hub_device, dev)) { 97 98 continue; 98 99 } 99 100 100 101 ipc_call_t answer_data; 101 ipcarg_t answer_rc;102 sysarg_t answer_rc; 102 103 aid_t req; 103 104 int rc = EOK; … … 145 146 * (if the address matches). 146 147 */ 147 if (virt hub_dev.address == transaction->target.address) {148 if (virtual_hub_device.address == transaction->target.address) { 148 149 size_t tmp; 149 dprintf( 3, "sending `%s' transaction to hub",150 dprintf(1, "sending `%s' transaction to hub", 150 151 usbvirt_str_transaction_type(transaction->type)); 151 152 switch (transaction->type) { 152 153 case USBVIRT_TRANSACTION_SETUP: 153 virthub_dev.transaction_setup(&virthub_dev, 154 virtual_hub_device.transaction_setup( 155 &virtual_hub_device, 154 156 transaction->target.endpoint, 155 157 transaction->buffer, transaction->len); … … 157 159 158 160 case USBVIRT_TRANSACTION_IN: 159 virthub_dev.transaction_in(&virthub_dev, 161 virtual_hub_device.transaction_in( 162 &virtual_hub_device, 160 163 transaction->target.endpoint, 161 164 transaction->buffer, transaction->len, … … 167 170 168 171 case USBVIRT_TRANSACTION_OUT: 169 virthub_dev.transaction_out(&virthub_dev, 172 virtual_hub_device.transaction_out( 173 &virtual_hub_device, 170 174 transaction->target.endpoint, 171 175 transaction->buffer, transaction->len); -
uspace/drv/vhc/hc.c
r692f13e4 r82122f3 50 50 #include "hub.h" 51 51 52 #define USLEEP_BASE ( 500* 1000)53 54 #define USLEEP_VAR 50 0052 #define USLEEP_BASE (0 * 5 * 1000) 53 54 #define USLEEP_VAR 50 55 55 56 56 #define SHORTENING_VAR 15 … … 68 68 static link_t transaction_list; 69 69 70 #define TRANSACTION_FORMAT "T[%d :%d%s (%d)]"70 #define TRANSACTION_FORMAT "T[%d.%d %s/%s (%d)]" 71 71 #define TRANSACTION_PRINTF(t) \ 72 72 (t).target.address, (t).target.endpoint, \ 73 usb_str_transfer_type((t).transfer_type), \ 73 74 usbvirt_str_transaction_type((t).type), \ 74 75 (int)(t).len … … 77 78 list_get_instance(lnk, transaction_t, link) 78 79 80 #define HUB_STATUS_MAX_LEN (HUB_PORT_COUNT + 64) 81 79 82 static inline unsigned int pseudo_random(unsigned int *seed) 80 83 { … … 89 92 usb_transaction_outcome_t outcome) 90 93 { 91 dprintf(3, " processing transaction " TRANSACTION_FORMAT ", outcome: %s",94 dprintf(3, "transaction " TRANSACTION_FORMAT " done, outcome: %s", 92 95 TRANSACTION_PRINTF(*transaction), 93 96 usb_str_transaction_outcome(outcome)); … … 99 102 /** Host controller manager main function. 100 103 */ 101 void hc_manager(void)104 static int hc_manager_fibril(void *arg) 102 105 { 103 106 list_initialize(&transaction_list); … … 114 117 } 115 118 116 char ports[HUB_PORT_COUNT + 2]; 117 hub_get_port_statuses(ports, HUB_PORT_COUNT + 1); 118 dprintf(3, "virtual hub: addr=%d ports=%s", 119 virthub_dev.address, ports); 119 char ports[HUB_STATUS_MAX_LEN + 1]; 120 virthub_get_status(&virtual_hub_device, ports, HUB_STATUS_MAX_LEN); 120 121 121 122 link_t *first_transaction_link = transaction_list.next; … … 124 125 list_remove(first_transaction_link); 125 126 127 128 dprintf(0, "about to process " TRANSACTION_FORMAT " [%s]", 129 TRANSACTION_PRINTF(*transaction), ports); 130 126 131 dprintf(3, "processing transaction " TRANSACTION_FORMAT "", 127 132 TRANSACTION_PRINTF(*transaction)); … … 134 139 free(transaction); 135 140 } 141 142 assert(false && "unreachable"); 143 return EOK; 144 } 145 146 void hc_manager(void) 147 { 148 fid_t fid = fibril_create(hc_manager_fibril, NULL); 149 if (fid == 0) { 150 printf(NAME ": failed to start HC manager fibril\n"); 151 return; 152 } 153 fibril_add_ready(fid); 136 154 } 137 155 … … 139 157 */ 140 158 static transaction_t *transaction_create(usbvirt_transaction_type_t type, 141 usb_target_t target, 159 usb_target_t target, usb_transfer_type_t transfer_type, 142 160 void * buffer, size_t len, 143 161 hc_transaction_done_callback_t callback, void * arg) … … 147 165 list_initialize(&transaction->link); 148 166 transaction->type = type; 167 transaction->transfer_type = transfer_type; 149 168 transaction->target = target; 150 169 transaction->buffer = buffer; … … 153 172 transaction->callback_arg = arg; 154 173 155 dprintf( 1, "creating transaction " TRANSACTION_FORMAT,174 dprintf(3, "creating transaction " TRANSACTION_FORMAT, 156 175 TRANSACTION_PRINTF(*transaction)); 157 176 … … 162 181 */ 163 182 void hc_add_transaction_to_device(bool setup, usb_target_t target, 183 usb_transfer_type_t transfer_type, 164 184 void * buffer, size_t len, 165 185 hc_transaction_done_callback_t callback, void * arg) 166 186 { 167 187 transaction_t *transaction = transaction_create( 168 setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, target, 188 setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, 189 target, transfer_type, 169 190 buffer, len, callback, arg); 170 191 list_append(&transaction->link, &transaction_list); … … 174 195 */ 175 196 void hc_add_transaction_from_device(usb_target_t target, 197 usb_transfer_type_t transfer_type, 176 198 void * buffer, size_t len, 177 199 hc_transaction_done_callback_t callback, void * arg) 178 200 { 179 201 transaction_t *transaction = transaction_create(USBVIRT_TRANSACTION_IN, 180 target, buffer, len, callback, arg); 202 target, transfer_type, 203 buffer, len, callback, arg); 181 204 list_append(&transaction->link, &transaction_list); 182 205 } -
uspace/drv/vhc/hc.h
r692f13e4 r82122f3 55 55 /** Transaction type. */ 56 56 usbvirt_transaction_type_t type; 57 /** Transfer type. */ 58 usb_transfer_type_t transfer_type; 57 59 /** Device address. */ 58 60 usb_target_t target; … … 71 73 void hc_manager(void); 72 74 73 void hc_add_transaction_to_device(bool setup, usb_target_t target, 75 void hc_add_transaction_to_device(bool setup, 76 usb_target_t target, usb_transfer_type_t transfer_type, 74 77 void * buffer, size_t len, 75 78 hc_transaction_done_callback_t callback, void * arg); 76 79 77 void hc_add_transaction_from_device(usb_target_t target, 80 void hc_add_transaction_from_device( 81 usb_target_t target, usb_transfer_type_t transfer_type, 78 82 void * buffer, size_t len, 79 83 hc_transaction_done_callback_t callback, void * arg); -
uspace/drv/vhc/hcd.c
r692f13e4 r82122f3 79 79 * Initialize our hub and announce its presence. 80 80 */ 81 hub_init(dev);81 virtual_hub_device_init(dev); 82 82 83 83 printf("%s: virtual USB host controller ready.\n", NAME); … … 95 95 }; 96 96 97 /** Fibril wrapper for HC transaction manager.98 *99 * @param arg Not used.100 * @return Nothing, return argument is unreachable.101 */102 static int hc_manager_fibril(void *arg)103 {104 hc_manager();105 return EOK;106 }107 97 108 98 int main(int argc, char * argv[]) 109 99 { 110 printf("%s: virtual USB host controller driver.\n", NAME);111 112 usb_dprintf_enable(NAME, 10);113 114 fid_t fid = fibril_create(hc_manager_fibril, NULL);115 if (fid == 0) {116 printf("%s: failed to start HC manager fibril\n", NAME);117 return ENOMEM;118 }119 fibril_add_ready(fid);120 121 100 /* 122 101 * Temporary workaround. Wait a little bit to be the last driver 123 102 * in devman output. 124 103 */ 125 sleep(4); 104 sleep(5); 105 106 usb_dprintf_enable(NAME, 0); 107 108 printf(NAME ": virtual USB host controller driver.\n"); 109 110 hc_manager(); 126 111 127 112 return driver_main(&vhc_driver); -
uspace/drv/vhc/hub.c
r692f13e4 r82122f3 40 40 #include <stdlib.h> 41 41 #include <driver.h> 42 #include <usb/usbdrv.h> 42 43 44 #include "hub.h" 45 #include "hub/virthub.h" 43 46 #include "vhcd.h" 44 #include "hub.h"45 #include "hubintern.h"46 #include "conn.h"47 47 48 usbvirt_device_t virtual_hub_device; 48 49 49 /** Standard device descriptor. */ 50 usb_standard_device_descriptor_t std_device_descriptor = { 51 .length = sizeof(usb_standard_device_descriptor_t), 52 .descriptor_type = USB_DESCTYPE_DEVICE, 53 .usb_spec_version = 0x110, 54 .device_class = USB_CLASS_HUB, 55 .device_subclass = 0, 56 .device_protocol = 0, 57 .max_packet_size = 64, 58 .configuration_count = 1 59 }; 50 static int hub_register_in_devman_fibril(void *arg); 60 51 61 /** Standard interface descriptor. */ 62 usb_standard_interface_descriptor_t std_interface_descriptor = { 63 .length = sizeof(usb_standard_interface_descriptor_t), 64 .descriptor_type = USB_DESCTYPE_INTERFACE, 65 .interface_number = 0, 66 .alternate_setting = 0, 67 .endpoint_count = 1, 68 .interface_class = USB_CLASS_HUB, 69 .interface_subclass = 0, 70 .interface_protocol = 0, 71 .str_interface = 0 72 }; 52 void virtual_hub_device_init(device_t *hc_dev) 53 { 54 virthub_init(&virtual_hub_device); 73 55 74 hub_descriptor_t hub_descriptor = { 75 .length = sizeof(hub_descriptor_t), 76 .type = USB_DESCTYPE_HUB, 77 .port_count = HUB_PORT_COUNT, 78 .characteristics = 0, 79 .power_on_warm_up = 50, /* Huh? */ 80 .max_current = 100, /* Huh again. */ 81 .removable_device = { 0 }, 82 .port_power = { 0xFF } 83 }; 56 /* 57 * We need to register the root hub. 58 * This must be done in separate fibril because the device 59 * we are connecting to are ourselves and we cannot connect 60 * before leaving the add_device() function. 61 */ 62 fid_t root_hub_registration 63 = fibril_create(hub_register_in_devman_fibril, hc_dev); 64 if (root_hub_registration == 0) { 65 printf(NAME ": failed to register root hub\n"); 66 return; 67 } 84 68 85 /** Endpoint descriptor. */ 86 usb_standard_endpoint_descriptor_t endpoint_descriptor = { 87 .length = sizeof(usb_standard_endpoint_descriptor_t), 88 .descriptor_type = USB_DESCTYPE_ENDPOINT, 89 .endpoint_address = HUB_STATUS_CHANGE_PIPE | 128, 90 .attributes = USB_TRANSFER_INTERRUPT, 91 .max_packet_size = 8, 92 .poll_interval = 0xFF 93 }; 94 95 /** Standard configuration descriptor. */ 96 usb_standard_configuration_descriptor_t std_configuration_descriptor = { 97 .length = sizeof(usb_standard_configuration_descriptor_t), 98 .descriptor_type = USB_DESCTYPE_CONFIGURATION, 99 .total_length = 100 sizeof(usb_standard_configuration_descriptor_t) 101 + sizeof(std_interface_descriptor) 102 + sizeof(hub_descriptor) 103 + sizeof(endpoint_descriptor) 104 , 105 .interface_count = 1, 106 .configuration_number = HUB_CONFIGURATION_ID, 107 .str_configuration = 0, 108 .attributes = 128, /* denotes bus-powered device */ 109 .max_power = 50 110 }; 111 112 /** All hub configuration descriptors. */ 113 static usbvirt_device_configuration_extras_t extra_descriptors[] = { 114 { 115 .data = (uint8_t *) &std_interface_descriptor, 116 .length = sizeof(std_interface_descriptor) 117 }, 118 { 119 .data = (uint8_t *) &hub_descriptor, 120 .length = sizeof(hub_descriptor) 121 }, 122 { 123 .data = (uint8_t *) &endpoint_descriptor, 124 .length = sizeof(endpoint_descriptor) 125 } 126 }; 127 128 /** Hub configuration. */ 129 usbvirt_device_configuration_t configuration = { 130 .descriptor = &std_configuration_descriptor, 131 .extra = extra_descriptors, 132 .extra_count = sizeof(extra_descriptors)/sizeof(extra_descriptors[0]) 133 }; 134 135 /** Hub standard descriptors. */ 136 usbvirt_descriptors_t descriptors = { 137 .device = &std_device_descriptor, 138 .configuration = &configuration, 139 .configuration_count = 1, 140 }; 141 142 /** Hub as a virtual device. */ 143 usbvirt_device_t virthub_dev = { 144 .ops = &hub_ops, 145 .descriptors = &descriptors, 146 .lib_debug_level = 4, 147 .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL 148 }; 149 150 /** Hub device. */ 151 hub_device_t hub_dev; 152 153 static usb_address_t hub_set_address(usbvirt_device_t *hub) 154 { 155 usb_address_t new_address; 156 int rc = vhc_iface.request_address(NULL, &new_address); 157 if (rc != EOK) { 158 return rc; 159 } 160 161 usb_device_request_setup_packet_t setup_packet = { 162 .request_type = 0, 163 .request = USB_DEVREQ_SET_ADDRESS, 164 .index = 0, 165 .length = 0, 166 }; 167 setup_packet.value = new_address; 168 169 hub->transaction_setup(hub, 0, &setup_packet, sizeof(setup_packet)); 170 hub->transaction_in(hub, 0, NULL, 0, NULL); 171 172 return new_address; 69 fibril_add_ready(root_hub_registration); 173 70 } 174 71 175 /** Initialize virtual hub. */ 176 void hub_init(device_t *hc_dev) 72 /** Register root hub in devman. 73 * 74 * @param arg Host controller device (type <code>device_t *</code>). 75 * @return Error code. 76 */ 77 int hub_register_in_devman_fibril(void *arg) 177 78 { 178 size_t i; 179 for (i = 0; i < HUB_PORT_COUNT; i++) { 180 hub_port_t *port = &hub_dev.ports[i]; 181 182 port->device = NULL; 183 port->state = HUB_PORT_STATE_NOT_CONFIGURED; 184 port->status_change = 0; 185 } 186 187 usbvirt_connect_local(&virthub_dev); 188 189 dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT); 79 device_t *hc_dev = (device_t *) arg; 190 80 191 usb_address_t hub_address = hub_set_address(&virthub_dev);192 if (h ub_address< 0) {193 dprintf(1, "problem changing hub address (%s)",194 str_error(hub_address));81 int hc = usb_drv_hc_connect(hc_dev, IPC_FLAG_BLOCKING); 82 if (hc < 0) { 83 printf(NAME ": failed to register root hub\n"); 84 return hc; 195 85 } 196 86 197 dprintf(2, "virtual hub address changed to %d", hub_address);87 usb_drv_reserve_default_address(hc); 198 88 199 char *id;200 int rc = asprintf(&id, "usb&hub");201 if (rc <= 0) { 202 return;203 } 89 usb_address_t hub_address = usb_drv_request_address(hc); 90 usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, hub_address); 91 92 usb_drv_release_default_address(hc); 93 204 94 devman_handle_t hub_handle; 205 rc = child_device_register_wrapper(hc_dev, "hub", id, 10, &hub_handle); 206 if (rc != EOK) { 207 free(id); 208 } 95 usb_drv_register_child_in_devman(hc, hc_dev, hub_address, &hub_handle); 96 usb_drv_bind_address(hc, hub_address, hub_handle); 209 97 210 vhc_iface.bind_address(NULL, hub_address, hub_handle); 211 212 dprintf(2, "virtual hub has devman handle %d", (int) hub_handle); 98 return EOK; 213 99 } 214 215 /** Connect device to the hub.216 *217 * @param device Device to be connected.218 * @return Port where the device was connected to.219 */220 size_t hub_add_device(virtdev_connection_t *device)221 {222 size_t i;223 for (i = 0; i < HUB_PORT_COUNT; i++) {224 hub_port_t *port = &hub_dev.ports[i];225 226 if (port->device != NULL) {227 continue;228 }229 230 port->device = device;231 232 /*233 * TODO:234 * If the hub was configured, we can normally235 * announce the plug-in.236 * Otherwise, we will wait until hub is configured237 * and announce changes in single burst.238 */239 //if (port->state == HUB_PORT_STATE_DISCONNECTED) {240 port->state = HUB_PORT_STATE_DISABLED;241 set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);242 //}243 244 return i;245 }246 100 247 return (size_t)-1;248 }249 250 /** Disconnect device from the hub. */251 void hub_remove_device(virtdev_connection_t *device)252 {253 size_t i;254 for (i = 0; i < HUB_PORT_COUNT; i++) {255 hub_port_t *port = &hub_dev.ports[i];256 257 if (port->device != device) {258 continue;259 }260 261 port->device = NULL;262 port->state = HUB_PORT_STATE_DISCONNECTED;263 264 set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);265 }266 }267 268 /** Tell whether device port is open.269 *270 * @return Whether communication to and from the device can go through the hub.271 */272 bool hub_can_device_signal(virtdev_connection_t * device)273 {274 size_t i;275 for (i = 0; i < HUB_PORT_COUNT; i++) {276 if (hub_dev.ports[i].device == device) {277 return hub_dev.ports[i].state == HUB_PORT_STATE_ENABLED;278 }279 }280 281 return false;282 }283 284 /** Format hub port status.285 *286 * @param result Buffer where to store status string.287 * @param len Number of characters that is possible to store in @p result288 * (excluding trailing zero).289 */290 void hub_get_port_statuses(char *result, size_t len)291 {292 if (len > HUB_PORT_COUNT) {293 len = HUB_PORT_COUNT;294 }295 size_t i;296 for (i = 0; i < len; i++) {297 result[i] = hub_port_state_as_char(hub_dev.ports[i].state);298 }299 result[len] = 0;300 }301 101 302 102 /** -
uspace/drv/vhc/hub.h
r692f13e4 r82122f3 40 40 41 41 #include "devices.h" 42 #include "hub/hub.h" 43 #include "hub/virthub.h" 42 44 43 #define HUB_PORT_COUNT 6 45 extern usbvirt_device_t virtual_hub_device; 44 46 45 #define BITS2BYTES(bits) \ 46 (bits ? ((((bits)-1)>>3)+1) : 0) 47 48 extern usbvirt_device_t virthub_dev; 49 50 void hub_init(device_t *); 51 size_t hub_add_device(virtdev_connection_t *); 52 void hub_remove_device(virtdev_connection_t *); 53 bool hub_can_device_signal(virtdev_connection_t *); 54 void hub_get_port_statuses(char *result, size_t len); 47 void virtual_hub_device_init(device_t *); 55 48 56 49 #endif -
uspace/drv/vhc/hub/virthub.h
r692f13e4 r82122f3 31 31 */ 32 32 /** @file 33 * @brief 33 * @brief USB hub as a virtual USB device. 34 34 */ 35 #ifndef VHC D_HUBINTERN_H_36 #define VHC D_HUBINTERN_H_35 #ifndef VHC_HUB_VIRTHUB_H_ 36 #define VHC_HUB_VIRTHUB_H_ 37 37 38 #include <usbvirt/device.h> 39 #include "../devices.h" 38 40 #include "hub.h" 39 41 … … 42 44 /** Configuration value for hub configuration. */ 43 45 #define HUB_CONFIGURATION_ID 1 46 44 47 45 48 /** Hub descriptor. … … 68 71 } __attribute__ ((packed)) hub_descriptor_t; 69 72 70 /** Hub port internal state. 71 * Some states (e.g. port over current) are not covered as they are not 72 * simulated at all. 73 */ 74 typedef enum { 75 HUB_PORT_STATE_NOT_CONFIGURED, 76 HUB_PORT_STATE_POWERED_OFF, 77 HUB_PORT_STATE_DISCONNECTED, 78 HUB_PORT_STATE_DISABLED, 79 HUB_PORT_STATE_RESETTING, 80 HUB_PORT_STATE_ENABLED, 81 HUB_PORT_STATE_SUSPENDED, 82 HUB_PORT_STATE_RESUMING, 83 /* HUB_PORT_STATE_, */ 84 } hub_port_state_t; 85 86 /** Convert hub port state to a char. */ 87 static inline char hub_port_state_as_char(hub_port_state_t state) { 88 switch (state) { 89 case HUB_PORT_STATE_NOT_CONFIGURED: 90 return '-'; 91 case HUB_PORT_STATE_POWERED_OFF: 92 return 'O'; 93 case HUB_PORT_STATE_DISCONNECTED: 94 return 'X'; 95 case HUB_PORT_STATE_DISABLED: 96 return 'D'; 97 case HUB_PORT_STATE_RESETTING: 98 return 'R'; 99 case HUB_PORT_STATE_ENABLED: 100 return 'E'; 101 case HUB_PORT_STATE_SUSPENDED: 102 return 'S'; 103 case HUB_PORT_STATE_RESUMING: 104 return 'F'; 105 default: 106 return '?'; 107 } 108 } 109 110 /** Hub status change mask bits. */ 111 typedef enum { 112 HUB_STATUS_C_PORT_CONNECTION = (1 << 0), 113 HUB_STATUS_C_PORT_ENABLE = (1 << 1), 114 HUB_STATUS_C_PORT_SUSPEND = (1 << 2), 115 HUB_STATUS_C_PORT_OVER_CURRENT = (1 << 3), 116 HUB_STATUS_C_PORT_RESET = (1 << 4), 117 /* HUB_STATUS_C_ = (1 << ), */ 118 } hub_status_change_t; 119 120 /** Hub port information. */ 121 typedef struct { 122 virtdev_connection_t *device; 123 hub_port_state_t state; 124 uint16_t status_change; 125 } hub_port_t; 126 127 /** Hub device type. */ 128 typedef struct { 129 hub_port_t ports[HUB_PORT_COUNT]; 130 } hub_device_t; 131 132 extern hub_device_t hub_dev; 133 73 extern usbvirt_device_ops_t hub_ops; 134 74 extern hub_descriptor_t hub_descriptor; 135 75 136 extern usbvirt_device_ops_t hub_ops;137 138 void clear_port_status_change(hub_port_t *, uint16_t);139 void set_port_status_change(hub_port_t *, uint16_t);140 76 int virthub_init(usbvirt_device_t *); 77 int virthub_connect_device(usbvirt_device_t *, virtdev_connection_t *); 78 int virthub_disconnect_device(usbvirt_device_t *, virtdev_connection_t *); 79 bool virthub_is_device_enabled(usbvirt_device_t *, virtdev_connection_t *); 80 void virthub_get_status(usbvirt_device_t *, char *, size_t); 141 81 142 82 #endif -
uspace/drv/vhc/vhcd.h
r692f13e4 r82122f3 47 47 #define dprintf(level, format, ...) \ 48 48 usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__) 49 void dprintf_inval_call(int, ipc_call_t, ipcarg_t);49 void dprintf_inval_call(int, ipc_call_t, sysarg_t); 50 50 51 51 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
