Changes in / [5d4eb2df:403bb26] in mainline
- Location:
- uspace/drv
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/main.c
r5d4eb2df r403bb26 29 29 #include <usb/debug.h> 30 30 #include <errno.h> 31 #include <driver.h>32 31 #include "uhci.h" 33 32 -
uspace/drv/vhc/connhost.c
r5d4eb2df r403bb26 93 93 usbhc_iface_transfer_out_callback_t callback, void *arg) 94 94 { 95 dprintf(3, "transfer OUT [%d.%d (%s); %zu]",95 printf(NAME ": transfer OUT [%d.%d (%s); %zu]\n", 96 96 target.address, target.endpoint, 97 97 usb_str_transfer_type(transfer_type), … … 113 113 usbhc_iface_transfer_out_callback_t callback, void *arg) 114 114 { 115 dprintf(3, "transfer SETUP [%d.%d (%s); %zu]",115 printf(NAME ": transfer SETUP [%d.%d (%s); %zu]\n", 116 116 target.address, target.endpoint, 117 117 usb_str_transfer_type(transfer_type), … … 133 133 usbhc_iface_transfer_in_callback_t callback, void *arg) 134 134 { 135 dprintf(3, "transfer IN [%d.%d (%s); %zu]",135 printf(NAME ": transfer IN [%d.%d (%s); %zu]\n", 136 136 target.address, target.endpoint, 137 137 usb_str_transfer_type(transfer_type), -
uspace/drv/vhc/hc.c
r5d4eb2df r403bb26 50 50 #include "hub.h" 51 51 52 #define USLEEP_BASE ( 0 *500 * 1000)52 #define USLEEP_BASE (500 * 1000) 53 53 54 54 #define USLEEP_VAR 5000 … … 116 116 char ports[HUB_PORT_COUNT + 2]; 117 117 hub_get_port_statuses(ports, HUB_PORT_COUNT + 1); 118 dprintf( 0, "virtual hub: addr=%d ports=%s",118 dprintf(3, "virtual hub: addr=%d ports=%s", 119 119 virthub_dev.address, ports); 120 120 … … 153 153 transaction->callback_arg = arg; 154 154 155 dprintf( 3, "creating transaction " TRANSACTION_FORMAT,155 dprintf(1, "creating transaction " TRANSACTION_FORMAT, 156 156 TRANSACTION_PRINTF(*transaction)); 157 157 -
uspace/drv/vhc/hcd.c
r5d4eb2df r403bb26 110 110 printf("%s: virtual USB host controller driver.\n", NAME); 111 111 112 usb_dprintf_enable(NAME, 2);112 usb_dprintf_enable(NAME, 10); 113 113 114 114 fid_t fid = fibril_create(hc_manager_fibril, NULL); -
uspace/drv/vhc/hub.c
r5d4eb2df r403bb26 144 144 .ops = &hub_ops, 145 145 .descriptors = &descriptors, 146 .lib_debug_level = 1,146 .lib_debug_level = 4, 147 147 .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL 148 148 }; … … 177 177 { 178 178 size_t i; 179 180 179 for (i = 0; i < HUB_PORT_COUNT; i++) { 181 180 hub_port_t *port = &hub_dev.ports[i]; 182 181 183 port->index = (int) i;184 182 port->device = NULL; 185 183 port->state = HUB_PORT_STATE_NOT_CONFIGURED; -
uspace/drv/vhc/hub.h
r5d4eb2df r403bb26 41 41 #include "devices.h" 42 42 43 #define HUB_PORT_COUNT 243 #define HUB_PORT_COUNT 6 44 44 45 45 #define BITS2BYTES(bits) \ -
uspace/drv/vhc/hubintern.h
r5d4eb2df r403bb26 121 121 typedef struct { 122 122 virtdev_connection_t *device; 123 int index;124 123 hub_port_state_t state; 125 124 uint16_t status_change; -
uspace/drv/vhc/hubops.c
r5d4eb2df r403bb26 59 59 static int on_get_descriptor(struct usbvirt_device *dev, 60 60 usb_device_request_setup_packet_t *request, uint8_t *data); 61 static int on_set_configuration(struct usbvirt_device *dev,62 usb_device_request_setup_packet_t *request, uint8_t *data);63 61 static int on_class_request(struct usbvirt_device *dev, 64 62 usb_device_request_setup_packet_t *request, uint8_t *data); … … 66 64 usb_endpoint_t endpoint, 67 65 void *buffer, size_t size, size_t *actual_size); 68 static void set_port_state(hub_port_t *, hub_port_state_t);69 66 70 67 /** Standard USB requests. */ … … 77 74 .on_set_descriptor = NULL, 78 75 .on_get_configuration = NULL, 79 .on_set_configuration = on_set_configuration,76 .on_set_configuration = NULL, 80 77 .on_get_interface = NULL, 81 78 .on_set_interface = NULL, … … 105 102 } 106 103 107 /** Callback for SET_CONFIGURATION request. */108 int on_set_configuration(struct usbvirt_device *dev,109 usb_device_request_setup_packet_t *request, uint8_t *data)110 {111 /* We must suspend power source to all ports. */112 size_t i;113 for (i = 0; i < HUB_PORT_COUNT; i++) {114 hub_port_t *port = &hub_dev.ports[i];115 116 set_port_state(port, HUB_PORT_STATE_POWERED_OFF);117 }118 119 /* Let the framework handle the rest of the job. */120 return EFORWARD;121 }122 123 struct delay_port_state_change {124 suseconds_t delay;125 hub_port_state_t old_state;126 hub_port_state_t new_state;127 hub_port_t *port;128 };129 130 static int set_port_state_delayed_fibril(void *arg)131 {132 struct delay_port_state_change *change133 = (struct delay_port_state_change *) arg;134 135 async_usleep(change->delay);136 137 if (change->port->state == change->old_state) {138 set_port_state(change->port, change->new_state);139 }140 141 free(change);142 143 return EOK;144 }145 146 static void set_port_state_delayed(hub_port_t *port,147 suseconds_t delay_time,148 hub_port_state_t old_state, hub_port_state_t new_state)149 {150 struct delay_port_state_change *change151 = malloc(sizeof(struct delay_port_state_change));152 change->port = port;153 change->delay = delay_time;154 change->old_state = old_state;155 change->new_state = new_state;156 fid_t fibril = fibril_create(set_port_state_delayed_fibril, change);157 if (fibril == 0) {158 printf("Failed to create fibril\n");159 return;160 }161 fibril_add_ready(fibril);162 }163 164 104 /** Change port status and updates status change status fields. 165 105 */ 166 void set_port_state(hub_port_t *port, hub_port_state_t state) 167 { 168 dprintf(1, "setting port %d state to %d (%c)", port->index, 169 state, hub_port_state_as_char(state)); 170 106 static void set_port_state(hub_port_t *port, hub_port_state_t state) 107 { 108 port->state = state; 171 109 if (state == HUB_PORT_STATE_POWERED_OFF) { 172 110 clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION); … … 175 113 } 176 114 if (state == HUB_PORT_STATE_RESUMING) { 177 set_port_state_delayed(port, 10*1000, 178 HUB_PORT_STATE_RESUMING, HUB_PORT_STATE_ENABLED); 115 async_usleep(10*1000); 116 if (port->state == state) { 117 set_port_state(port, HUB_PORT_STATE_ENABLED); 118 } 179 119 } 180 120 if (state == HUB_PORT_STATE_RESETTING) { 181 set_port_state_delayed(port, 10*1000, 182 HUB_PORT_STATE_RESETTING, HUB_PORT_STATE_ENABLED); 183 } 184 if ((port->state == HUB_PORT_STATE_RESETTING) 185 && (state == HUB_PORT_STATE_ENABLED)) { 186 set_port_status_change(port, HUB_STATUS_C_PORT_RESET); 187 } 188 189 port->state = state; 121 async_usleep(10*1000); 122 if (port->state == state) { 123 set_port_status_change(port, HUB_STATUS_C_PORT_RESET); 124 set_port_state(port, HUB_PORT_STATE_ENABLED); 125 } 126 } 190 127 } 191 128 … … 312 249 status |= (port->status_change << 16); 313 250 314 dprintf(2, "GetPortStatus(port=%d, status=%u)\n", (int)portindex,315 (unsigned int) status);316 251 return virthub_dev.control_transfer_reply(&virthub_dev, 0, &status, 4); 317 252 } … … 356 291 usb_device_request_setup_packet_t *request, uint8_t *data) 357 292 { 358 dprintf(2, "hub class request (%d) ", (int) request->request);293 dprintf(2, "hub class request (%d)\n", (int) request->request); 359 294 360 295 uint8_t recipient = request->request_type & 31; … … 405 340 406 341 default: 407 dprintf(0, "WARN: unknown request (%d)!\n",408 request->request);409 342 break; 410 343 }
Note:
See TracChangeset
for help on using the changeset viewer.