Changeset a5c2eb5 in mainline
- Timestamp:
- 2013-02-08T22:30:45Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c91db2a
- Parents:
- 86a01cc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/uhci_rh.c
r86a01cc ra5c2eb5 100 100 }}; 101 101 batch->error = virthub_base_request(&instance->base, target, 102 usb_transfer_batch_direction(batch), 103 (void*)batch->setup_buffer, batch->buffer, 104 batch->buffer_size, &batch->transfered_size); 102 usb_transfer_batch_direction(batch), (void*)batch->setup_buffer, 103 batch->buffer, batch->buffer_size, &batch->transfered_size); 105 104 usb_transfer_batch_finish(batch, NULL); 106 105 usb_transfer_batch_destroy(batch); … … 375 374 } 376 375 377 /** UHCI root hub request handlers */378 static const usbvirt_control_request_handler_t control_transfer_handlers[] = {379 {380 STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),381 .name = "GetDescriptor",382 .callback = virthub_base_get_hub_descriptor,383 },384 {385 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),386 .name = "GetDescriptor",387 .callback = virthub_base_get_hub_descriptor,388 },389 {390 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),391 .name = "GetHubDescriptor",392 .callback = virthub_base_get_hub_descriptor,393 },394 {395 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATE),396 .name = "GetBusState",397 .callback = req_get_port_state,398 },399 {400 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),401 .name = "GetPortStatus",402 .callback = req_get_port_status403 },404 {405 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),406 .name = "ClearHubFeature",407 /* Hub features are overcurrent and supply good,408 * this request may only clear changes that we never report*/409 .callback = req_nop,410 },411 {412 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),413 .name = "ClearPortFeature",414 .callback = req_clear_port_feature415 },416 {417 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS),418 .name = "GetHubStatus",419 /* UHCI can't report OC condition or,420 * lose power source */421 .callback = virthub_base_get_null_status,422 },423 {424 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),425 .name = "GetPortStatus",426 .callback = req_get_port_status427 },428 {429 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE),430 .name = "SetHubFeature",431 /* Hub features are overcurrent and supply good,432 * this request may only set changes that we never report*/433 .callback = req_nop,434 },435 {436 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE),437 .name = "SetPortFeature",438 .callback = req_set_port_feature439 },440 {441 .callback = NULL442 }443 };444 445 static int req_status_change_handler(usbvirt_device_t *dev,446 usb_endpoint_t endpoint, usb_transfer_type_t tr_type,447 void *buffer, size_t buffer_size, size_t *actual_size);448 449 static usbvirt_device_ops_t ops = {450 .control = control_transfer_handlers,451 .data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler,452 };453 454 376 /** Status change handler. 455 377 * @param device Virtual hub device 456 * @param endpoint En point number378 * @param endpoint Endpoint number 457 379 * @param tr_type Transfer type 458 380 * @param buffer Response destination 459 * @param buffer_size B Ytes available in buffer381 * @param buffer_size Bytes available in buffer 460 382 * @param actual_size Size us the used part of the dest buffer. 461 383 * 462 384 * Produces status mask. Bit 0 indicates hub status change the other bits 463 * repres net port status change. Endian does not matter as UHCI root hubs385 * represent port status change. Endian does not matter as UHCI root hubs 464 386 * only need 1 byte. 465 387 */ … … 470 392 uhci_rh_t *hub = virthub_get_data(device); 471 393 assert(hub); 472 394 473 395 if (buffer_size < 1) 474 396 return ESTALL; … … 491 413 return EOK; 492 414 } 415 416 /** UHCI root hub request handlers */ 417 static const usbvirt_control_request_handler_t control_transfer_handlers[] = { 418 { 419 STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR), 420 .name = "GetDescriptor", 421 .callback = virthub_base_get_hub_descriptor, 422 }, 423 { 424 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR), 425 .name = "GetDescriptor", 426 .callback = virthub_base_get_hub_descriptor, 427 }, 428 { 429 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR), 430 .name = "GetHubDescriptor", 431 .callback = virthub_base_get_hub_descriptor, 432 }, 433 { 434 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATE), 435 .name = "GetBusState", 436 .callback = req_get_port_state, 437 }, 438 { 439 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS), 440 .name = "GetPortStatus", 441 .callback = req_get_port_status 442 }, 443 { 444 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE), 445 .name = "ClearHubFeature", 446 /* Hub features are overcurrent and supply good, 447 * this request may only clear changes that we never report*/ 448 .callback = req_nop, 449 }, 450 { 451 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE), 452 .name = "ClearPortFeature", 453 .callback = req_clear_port_feature 454 }, 455 { 456 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS), 457 .name = "GetHubStatus", 458 /* UHCI can't report OC condition or, 459 * lose power source */ 460 .callback = virthub_base_get_null_status, 461 }, 462 { 463 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS), 464 .name = "GetPortStatus", 465 .callback = req_get_port_status 466 }, 467 { 468 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE), 469 .name = "SetHubFeature", 470 /* Hub features are overcurrent and supply good, 471 * this request may only set changes that we never report*/ 472 .callback = req_nop, 473 }, 474 { 475 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE), 476 .name = "SetPortFeature", 477 .callback = req_set_port_feature 478 }, 479 { 480 .callback = NULL 481 } 482 }; 483 484 static usbvirt_device_ops_t ops = { 485 .control = control_transfer_handlers, 486 .data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler, 487 };
Note:
See TracChangeset
for help on using the changeset viewer.