Changeset b02308e in mainline for uspace/drv/bus/usb/ohci/hcd_endpoint.c
- Timestamp:
- 2011-08-25T10:40:37Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 27873be
- Parents:
- 32e093e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hcd_endpoint.c
r32e093e rb02308e 61 61 } 62 62 /*----------------------------------------------------------------------------*/ 63 /** Disposes hcd endpoint structure 64 * 65 * @param[in] hcd_ep endpoint structure 66 */ 67 static void hcd_ep_destroy(void *hcd_ep) 68 { 69 if (hcd_ep) { 70 hcd_endpoint_t *instance = hcd_ep; 71 free32(instance->ed); 72 free32(instance->td); 73 free(instance); 74 } 75 } 76 /*----------------------------------------------------------------------------*/ 63 77 /** Creates new hcd endpoint representation. 64 78 * … … 66 80 * @return pointer to a new hcd endpoint structure, NULL on failure. 67 81 */ 68 hcd_endpoint_t *hcd_endpoint_assign(endpoint_t *ep)82 int hcd_endpoint_assign(endpoint_t *ep) 69 83 { 70 84 assert(ep); 71 85 hcd_endpoint_t *hcd_ep = malloc(sizeof(hcd_endpoint_t)); 72 86 if (hcd_ep == NULL) 73 return NULL;87 return ENOMEM; 74 88 75 89 hcd_ep->ed = malloc32(sizeof(ed_t)); 76 90 if (hcd_ep->ed == NULL) { 77 91 free(hcd_ep); 78 return NULL;92 return ENOMEM; 79 93 } 80 94 … … 83 97 free32(hcd_ep->ed); 84 98 free(hcd_ep); 85 return NULL;99 return ENOMEM; 86 100 } 87 101 … … 89 103 ed_set_td(hcd_ep->ed, hcd_ep->td); 90 104 endpoint_set_hc_data( 91 ep, hcd_ep, NULL, hcd_ep_toggle_get, hcd_ep_toggle_set);105 ep, hcd_ep, hcd_ep_destroy, hcd_ep_toggle_get, hcd_ep_toggle_set); 92 106 93 return hcd_ep; 94 } 95 /*----------------------------------------------------------------------------*/ 96 /** Disposes assigned hcd endpoint structure 97 * 98 * @param[in] ep USBD endpoint structure 99 */ 100 void hcd_endpoint_clear(endpoint_t *ep) 101 { 102 assert(ep); 103 hcd_endpoint_t *hcd_ep = ep->hc_data.data; 104 assert(hcd_ep); 105 free32(hcd_ep->ed); 106 free32(hcd_ep->td); 107 free(hcd_ep); 107 return EOK; 108 108 } 109 109 /**
Note:
See TracChangeset
for help on using the changeset viewer.