Changeset 56257ba in mainline for uspace/drv/bus/usb/xhci/endpoint.c
- Timestamp:
- 2018-01-07T01:01:42Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63431db
- Parents:
- 9efad54
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-07 01:01:41)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-07 01:01:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/endpoint.c
r9efad54 r56257ba 469 469 } 470 470 471 /** Add a new XHCI endpoint to a device. The device must be online unless472 * the added endpoint is number 0.473 * @param[in] dev XHCI device, to which to add the endpoint474 * @param[in] ep XHCI endpoint to add.475 *476 * @return Error code.477 */478 int xhci_device_add_endpoint(xhci_device_t *dev, xhci_endpoint_t *ep)479 {480 assert(dev);481 assert(ep);482 483 /* Offline devices don't create new endpoints other than EP0. */484 if (!dev->base.online && ep->base.endpoint > 0) {485 return EAGAIN;486 }487 488 const usb_endpoint_t ep_num = ep->base.endpoint;489 490 if (dev->endpoints[ep_num])491 return EEXIST;492 493 /* Device reference */494 endpoint_add_ref(&ep->base);495 ep->base.device = &dev->base;496 dev->endpoints[ep_num] = ep;497 498 return EOK;499 }500 501 /** Remove XHCI endpoint from a device.502 * @param[in] ep XHCI endpoint to remove.503 */504 void xhci_device_remove_endpoint(xhci_endpoint_t *ep)505 {506 assert(ep);507 xhci_device_t *dev = xhci_device_get(ep->base.device);508 509 assert(dev->endpoints[ep->base.endpoint]);510 dev->endpoints[ep->base.endpoint] = NULL;511 ep->base.device = NULL;512 }513 514 471 /** Retrieve XHCI endpoint from a device by the endpoint number. 515 472 * @param[in] dev XHCI device to query. … … 520 477 xhci_endpoint_t *xhci_device_get_endpoint(xhci_device_t *dev, usb_endpoint_t ep) 521 478 { 522 return dev->endpoints[ep];479 return xhci_endpoint_get(dev->base.endpoints[ep]); 523 480 } 524 481
Note:
See TracChangeset
for help on using the changeset viewer.