Changeset 735236a in mainline
- Timestamp:
- 2011-07-11T17:55:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7372a9a0
- Parents:
- 14426a0
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_regs.h
r14426a0 r735236a 193 193 * specified in PPCM(RHDB), or all ports, 194 194 * if power is set globally */ 195 #define RHS_SET_ PORT_POWER RHS_LPSC_FLAG /* synonym for the above */195 #define RHS_SET_GLOBAL_POWER RHS_LPSC_FLAG /* synonym for the above */ 196 196 #define RHS_OCIC_FLAG (1 << 17)/* Over-current indicator change */ 197 197 #define RHS_CLEAR_DRWE (1 << 31) -
uspace/drv/bus/usb/ohci/root_hub.c
r14426a0 r735236a 490 490 assert(instance); 491 491 492 if (!((1 << feature) & port_set_feature_valid_mask))493 return EINVAL;494 492 if (port < 1 || port > instance->port_count) 495 493 return EINVAL; 496 494 497 instance->registers->rh_port_status[port - 1] = 498 (instance->registers->rh_port_status[port - 1] | (1 << feature)) 499 & (~port_clear_feature_valid_mask); 500 return EOK; 495 switch (feature) 496 { 497 case USB_HUB_FEATURE_PORT_POWER: //8 498 /* No power switching */ 499 if (instance->registers->rh_desc_a & RHDA_NPS_FLAG) 500 return EOK; 501 /* Ganged power switching */ 502 if (!(instance->registers->rh_desc_a & RHDA_PSM_FLAG)) { 503 instance->registers->rh_status = RHS_SET_GLOBAL_POWER; 504 return EOK; 505 } 506 case USB_HUB_FEATURE_PORT_ENABLE: //1 507 case USB_HUB_FEATURE_PORT_SUSPEND: //2 508 case USB_HUB_FEATURE_PORT_RESET: //4 509 /* Nice thing is that these shifts correspond to the position 510 * of control bits in register */ 511 instance->registers->rh_port_status[port - 1] = (1 << feature); 512 return EOK; 513 default: 514 return ENOTSUP; 515 } 501 516 } 502 517 /*----------------------------------------------------------------------------*/ … … 510 525 * @return error code 511 526 */ 512 int port_feature_clear_request( 513 rh_t *instance, uint16_t feature, uint16_t port) 514 { 515 assert(instance); 516 517 if (!((1 << feature) & port_clear_feature_valid_mask)) 518 return EINVAL; 527 int port_feature_clear_request(rh_t *instance, uint16_t feature, uint16_t port) 528 { 529 assert(instance); 530 519 531 if (port < 1 || port > instance->port_count) 520 532 return EINVAL; 521 533 522 /* Some weird stuff... */ 523 if (feature == USB_HUB_FEATURE_PORT_POWER) 524 feature = USB_HUB_FEATURE_PORT_LOW_SPEED; 525 if (feature == USB_HUB_FEATURE_PORT_SUSPEND) 526 feature = USB_HUB_FEATURE_PORT_OVER_CURRENT; 527 528 instance->registers->rh_port_status[port - 1] = 529 (instance->registers->rh_port_status[port - 1] 530 & (~port_clear_feature_valid_mask)) 531 | (1 << feature); 532 return EOK; 534 /* Enabled features to clear: see page 269 of USB specs */ 535 switch (feature) 536 { 537 case USB_HUB_FEATURE_PORT_POWER: //8 538 /* No power switching */ 539 if (instance->registers->rh_desc_a & RHDA_NPS_FLAG) 540 return ENOTSUP; 541 /* Ganged power switching */ 542 if (!(instance->registers->rh_desc_a & RHDA_PSM_FLAG)) { 543 instance->registers->rh_status = RHS_CLEAR_GLOBAL_POWER; 544 return EOK; 545 } 546 instance->registers->rh_port_status[port - 1] = 547 RHPS_CLEAR_PORT_POWER; 548 return EOK; 549 550 case USB_HUB_FEATURE_PORT_ENABLE: //1 551 instance->registers->rh_port_status[port - 1] = 552 RHPS_CLEAR_PORT_ENABLE; 553 return EOK; 554 555 case USB_HUB_FEATURE_PORT_SUSPEND: //2 556 instance->registers->rh_port_status[port - 1] = 557 RHPS_CLEAR_PORT_SUSPEND; 558 return EOK; 559 560 case USB_HUB_FEATURE_C_PORT_CONNECTION: //16 561 case USB_HUB_FEATURE_C_PORT_ENABLE: //17 562 case USB_HUB_FEATURE_C_PORT_SUSPEND: //18 563 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: //19 564 case USB_HUB_FEATURE_C_PORT_RESET: //20 565 /* Nice thing is that these shifts correspond to the position 566 * of control bits in register */ 567 instance->registers->rh_port_status[port - 1] = (1 << feature); 568 return EOK; 569 default: 570 return ENOTSUP; 571 } 533 572 } 534 573 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.