Changeset 00aece0 in mainline for uspace/drv/bus/usb/ohci/ohci_endpoint.c
- Timestamp:
- 2012-02-18T16:47:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4449c6c
- Parents:
- bd5f3b7 (diff), f943dd3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_endpoint.c
rbd5f3b7 r00aece0 33 33 */ 34 34 #include "utils/malloc32.h" 35 #include "hcd_endpoint.h" 35 #include "ohci_endpoint.h" 36 #include "hc.h" 36 37 37 38 /** Callback to set toggle on ED. … … 40 41 * @param[in] toggle new value of toggle bit 41 42 */ 42 static void hcd_ep_toggle_set(void *hcd_ep, int toggle)43 static void ohci_ep_toggle_set(void *ohci_ep, int toggle) 43 44 { 44 hcd_endpoint_t *instance = hcd_ep;45 ohci_endpoint_t *instance = ohci_ep; 45 46 assert(instance); 46 47 assert(instance->ed); … … 53 54 * @return Current value of toggle bit. 54 55 */ 55 static int hcd_ep_toggle_get(void *hcd_ep)56 static int ohci_ep_toggle_get(void *ohci_ep) 56 57 { 57 hcd_endpoint_t *instance = hcd_ep;58 ohci_endpoint_t *instance = ohci_ep; 58 59 assert(instance); 59 60 assert(instance->ed); … … 64 65 * 65 66 * @param[in] ep USBD endpoint structure 66 * @return pointer to a new hcd endpoint structure, NULL on failure.67 * @return Error code. 67 68 */ 68 hcd_endpoint_t * hcd_endpoint_assign(endpoint_t *ep)69 int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep) 69 70 { 70 71 assert(ep); 71 hcd_endpoint_t *hcd_ep = malloc(sizeof(hcd_endpoint_t));72 if ( hcd_ep == NULL)73 return NULL;72 ohci_endpoint_t *ohci_ep = malloc(sizeof(ohci_endpoint_t)); 73 if (ohci_ep == NULL) 74 return ENOMEM; 74 75 75 hcd_ep->ed = malloc32(sizeof(ed_t));76 if ( hcd_ep->ed == NULL) {77 free( hcd_ep);78 return NULL;76 ohci_ep->ed = malloc32(sizeof(ed_t)); 77 if (ohci_ep->ed == NULL) { 78 free(ohci_ep); 79 return ENOMEM; 79 80 } 80 81 81 hcd_ep->td = malloc32(sizeof(td_t));82 if ( hcd_ep->td == NULL) {83 free32( hcd_ep->ed);84 free( hcd_ep);85 return NULL;82 ohci_ep->td = malloc32(sizeof(td_t)); 83 if (ohci_ep->td == NULL) { 84 free32(ohci_ep->ed); 85 free(ohci_ep); 86 return ENOMEM; 86 87 } 87 88 88 ed_init( hcd_ep->ed, ep);89 e d_set_td(hcd_ep->ed, hcd_ep->td);90 endpoint_set_hc_data(ep, hcd_ep, hcd_ep_toggle_get, hcd_ep_toggle_set);91 92 return hcd_ep;89 ed_init(ohci_ep->ed, ep, ohci_ep->td); 90 endpoint_set_hc_data( 91 ep, ohci_ep, ohci_ep_toggle_get, ohci_ep_toggle_set); 92 hc_enqueue_endpoint(hcd->private_data, ep); 93 return EOK; 93 94 } 94 95 /*----------------------------------------------------------------------------*/ 95 /** Disposes assignedhcd endpoint structure96 /** Disposes hcd endpoint structure 96 97 * 97 * @param[in] ep USBD endpoint structure 98 * @param[in] hcd driver using this instance. 99 * @param[in] ep endpoint structure. 98 100 */ 99 void hcd_endpoint_clear(endpoint_t *ep)101 void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep) 100 102 { 103 assert(hcd); 101 104 assert(ep); 102 hcd_endpoint_t *hcd_ep = ep->hc_data.data; 103 assert(hcd_ep); 104 free32(hcd_ep->ed); 105 free32(hcd_ep->td); 106 free(hcd_ep); 105 ohci_endpoint_t *instance = ohci_endpoint_get(ep); 106 hc_dequeue_endpoint(hcd->private_data, ep); 107 if (instance) { 108 free32(instance->ed); 109 free32(instance->td); 110 free(instance); 111 } 112 endpoint_clear_hc_data(ep); 107 113 } 108 114 /**
Note:
See TracChangeset
for help on using the changeset viewer.