Changeset 82a639cd in mainline
- Timestamp:
- 2014-01-22T19:10:49Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 486f479
- Parents:
- 95d5dca
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_rh.c
r95d5dca r82a639cd 244 244 } 245 245 246 #define BIT_VAL(val, bit) ((val & bit) ? 1 : 0) 247 #define EHCI2USB(val, bit, feat) (BIT_VAL(val, bit) << feat) 248 246 249 /** Port status request handler. 247 250 * @param device Virtual hub device … … 263 266 264 267 const uint32_t reg = EHCI_RD(hub->registers->portsc[port]); 265 const uint32_t status = uint32_host2usb( 0 |266 (reg & USB_PORTSC_CONNECT_FLAG) ? (1 << 0) : 0|267 (reg & USB_PORTSC_ENABLED_FLAG) ? (1 << 1) : 0|268 (reg & USB_PORTSC_SUSPEND_FLAG) ? (1 << 2) : 0|269 (reg & USB_PORTSC_OC_ACTIVE_FLAG) ? (1 << 3) : 0|270 (reg & USB_PORTSC_PORT_RESET_FLAG) ? (1 << 4) : 0|271 (reg & USB_PORTSC_PORT_POWER_FLAG) ? (1 << 8) : 0|272 (( reg & USB_PORTSC_LINE_STATUS_MASK) == USB_PORTSC_LINE_STATUS_K) ?273 (1 << 9) : 0|274 (reg & USB_PORTSC_PORT_OWNER_FLAG) ? (1 << 10) : 0|275 (reg & USB_PORTSC_PORT_TEST_MASK) ? (1 << 11) : 0|276 (reg & USB_PORTSC_INDICATOR_MASK) ? (1 << 12) : 0|277 (reg & USB_PORTSC_CONNECT_CH_FLAG) ? (1 << 16) : 0|278 (reg & USB_PORTSC_EN_CHANGE_FLAG) ? (1 << 17) : 0|279 hub->resume_flag[port] ? (1 << 18) : 0|280 (reg & USB_PORTSC_OC_CHANGE_FLAG) ? (1 << 19) : 0|281 hub->reset_flag[port] ? (1 << 20): 0268 const uint32_t status = uint32_host2usb( 269 EHCI2USB(reg, USB_PORTSC_CONNECT_FLAG, USB_HUB_FEATURE_PORT_CONNECTION) | 270 EHCI2USB(reg, USB_PORTSC_ENABLED_FLAG, USB_HUB_FEATURE_PORT_ENABLE) | 271 EHCI2USB(reg, USB_PORTSC_SUSPEND_FLAG, USB_HUB_FEATURE_PORT_SUSPEND) | 272 EHCI2USB(reg, USB_PORTSC_OC_ACTIVE_FLAG, USB_HUB_FEATURE_PORT_OVER_CURRENT) | 273 EHCI2USB(reg, USB_PORTSC_PORT_RESET_FLAG, USB_HUB_FEATURE_PORT_RESET) | 274 EHCI2USB(reg, USB_PORTSC_PORT_POWER_FLAG, USB_HUB_FEATURE_PORT_POWER) | 275 (((reg & USB_PORTSC_LINE_STATUS_MASK) == USB_PORTSC_LINE_STATUS_K) ? 276 (1 << USB_HUB_FEATURE_PORT_LOW_SPEED) : 0) | 277 EHCI2USB(reg, USB_PORTSC_PORT_OWNER_FLAG, USB_HUB_FEATURE_PORT_HIGH_SPEED) | 278 EHCI2USB(reg, USB_PORTSC_PORT_TEST_MASK, 11) | 279 EHCI2USB(reg, USB_PORTSC_INDICATOR_MASK, 12) | 280 EHCI2USB(reg, USB_PORTSC_CONNECT_CH_FLAG, USB_HUB_FEATURE_C_PORT_CONNECTION) | 281 EHCI2USB(reg, USB_PORTSC_EN_CHANGE_FLAG, USB_HUB_FEATURE_C_PORT_ENABLE) | 282 (hub->resume_flag[port] ? (1 << USB_HUB_FEATURE_C_PORT_SUSPEND) : 0) | 283 EHCI2USB(reg, USB_PORTSC_OC_CHANGE_FLAG, USB_HUB_FEATURE_C_PORT_OVER_CURRENT) | 284 (hub->reset_flag[port] ? (1 << USB_HUB_FEATURE_C_PORT_RESET): 0) 282 285 ); 283 //TODO: use hub status flags here 286 /* Note feature numbers for test and indicator feature do not 287 * corespond to the port status bit locations */ 284 288 memcpy(data, &status, sizeof(status)); 285 289 *act_size = sizeof(status); -
uspace/lib/usb/include/usb/classes/hub.h
r95d5dca r82a639cd 54 54 USB_HUB_FEATURE_PORT_POWER = 8, 55 55 USB_HUB_FEATURE_PORT_LOW_SPEED = 9, 56 USB_HUB_FEATURE_PORT_HIGH_SPEED = 10, 56 57 USB_HUB_FEATURE_C_PORT_CONNECTION = 16, 57 58 USB_HUB_FEATURE_C_PORT_ENABLE = 17,
Note:
See TracChangeset
for help on using the changeset viewer.