Changeset 92574f4 in mainline for uspace/drv/vhc/hub.c
- Timestamp:
- 2011-02-24T12:03:27Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e7b7ebd5
- Parents:
- 4837092 (diff), a80849c (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/hub.c
r4837092 r92574f4 39 39 #include <str_error.h> 40 40 #include <stdlib.h> 41 #include <driver.h> 42 #include <usb/usbdrv.h> 41 #include <ddf/driver.h> 42 #include <devman.h> 43 #include <usb/hub.h> 44 #include <usb/recognise.h> 43 45 44 46 #include "hub.h" 45 47 #include "hub/virthub.h" 46 48 #include "vhcd.h" 49 #include "conn.h" 47 50 48 51 usbvirt_device_t virtual_hub_device; 52 static ddf_dev_ops_t rh_ops = { 53 .interfaces[USB_DEV_IFACE] = &rh_usb_iface, 54 }; 49 55 50 56 static int hub_register_in_devman_fibril(void *arg); 51 57 52 void virtual_hub_device_init(d evice_t *hc_dev)58 void virtual_hub_device_init(ddf_fun_t *hc_dev) 53 59 { 54 60 virthub_init(&virtual_hub_device); … … 70 76 } 71 77 78 static int pretend_port_rest(int unused, void *unused2) 79 { 80 return EOK; 81 } 82 72 83 /** Register root hub in devman. 73 84 * … … 77 88 int hub_register_in_devman_fibril(void *arg) 78 89 { 79 d evice_t *hc_dev = (device_t *) arg;90 ddf_fun_t *hc_dev = (ddf_fun_t *) arg; 80 91 81 int hc; 92 /* 93 * Wait until parent device is properly initialized. 94 */ 95 int phone; 82 96 do { 83 hc = usb_drv_hc_connect(hc_dev, hc_dev->handle,84 IPC_FLAG_BLOCKING);85 } while (hc < 0);97 phone = devman_device_connect(hc_dev->handle, 0); 98 } while (phone < 0); 99 async_hangup(phone); 86 100 87 usb_drv_reserve_default_address(hc);101 int rc; 88 102 89 usb_address_t hub_address = usb_drv_request_address(hc); 90 usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, hub_address); 103 usb_hc_connection_t hc_conn; 104 rc = usb_hc_connection_initialize(&hc_conn, hc_dev->handle); 105 assert(rc == EOK); 91 106 92 usb_drv_release_default_address(hc); 107 rc = usb_hc_connection_open(&hc_conn); 108 assert(rc == EOK); 93 109 94 devman_handle_t hub_handle; 95 usb_drv_register_child_in_devman(hc, hc_dev, hub_address, &hub_handle); 96 usb_drv_bind_address(hc, hub_address, hub_handle); 110 ddf_fun_t *hub_dev; 111 rc = usb_hc_new_device_wrapper(hc_dev->dev, &hc_conn, 112 USB_SPEED_FULL, 113 pretend_port_rest, 0, NULL, 114 NULL, NULL, &rh_ops, hc_dev, &hub_dev); 115 if (rc != EOK) { 116 usb_log_fatal("Failed to create root hub: %s.\n", 117 str_error(rc)); 118 } 97 119 98 return EOK; 120 usb_hc_connection_close(&hc_conn); 121 122 usb_log_info("Created root hub function (handle %zu).\n", 123 (size_t) hub_dev->handle); 124 125 return 0; 99 126 } 100 127
Note:
See TracChangeset
for help on using the changeset viewer.