Changeset 41924f30 in mainline for uspace/drv/bus/usb/xhci/endpoint.c
- Timestamp:
- 2017-10-12T14:07:27Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a5976973
- Parents:
- 7e74911
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/endpoint.c
r7e74911 r41924f30 34 34 */ 35 35 36 #include <usb/host/endpoint.h> 37 36 38 #include <errno.h> 37 39 40 #include "bus.h" 38 41 #include "endpoint.h" 39 42 40 int endpoint_init(hcd_t *hcd, endpoint_t *ep)43 int xhci_endpoint_init(xhci_endpoint_t *xhci_ep, xhci_bus_t *xhci_bus) 41 44 { 42 assert(ep); 43 xhci_endpoint_t *xhci_ep = malloc(sizeof(xhci_endpoint_t)); 44 if (xhci_ep == NULL) 45 return ENOMEM; 45 assert(xhci_ep); 46 assert(xhci_bus); 47 48 bus_t *bus = &xhci_bus->base; 49 endpoint_t *ep = &xhci_ep->base; 50 51 endpoint_init(ep, bus); 46 52 47 53 /* FIXME: Set xhci_ep->slot_id */ 48 54 49 fibril_mutex_lock(&ep->guard); 50 ep->hc_data.data = xhci_ep; 51 /* FIXME: The two handlers below should be implemented. */ 52 ep->hc_data.toggle_get = NULL; 53 ep->hc_data.toggle_set = NULL; 54 fibril_mutex_unlock(&ep->guard); 55 56 usb_log_debug("Endpoint %d:%d initialized.", ep->address, ep->endpoint); 55 usb_log_debug("XHCI Endpoint %d:%d initialized.", ep->target.address, ep->target.endpoint); 57 56 58 57 return EOK; 59 58 } 60 59 61 void endpoint_fini(hcd_t *hcd, endpoint_t *ep)60 void xhci_endpoint_fini(xhci_endpoint_t *xhci_ep) 62 61 { 63 assert(hcd); 64 assert(ep); 65 xhci_endpoint_t *xhci_ep = endpoint_get(ep); 62 assert(xhci_ep); 63 66 64 /* FIXME: Tear down TR's? */ 67 if (xhci_ep) {68 free(xhci_ep);69 }70 65 71 fibril_mutex_lock(&ep->guard); 72 ep->hc_data.data = NULL; 73 ep->hc_data.toggle_get = NULL; 74 ep->hc_data.toggle_set = NULL; 75 fibril_mutex_unlock(&ep->guard); 66 endpoint_t *ep = &xhci_ep->base; 76 67 77 usb_log_debug(" Endpoint %d:%d destroyed.", ep->address, ep->endpoint);68 usb_log_debug("XHCI Endpoint %d:%d destroyed.", ep->target.address, ep->target.endpoint); 78 69 } 79 70
Note:
See TracChangeset
for help on using the changeset viewer.