Changeset 48ae3ef in mainline for uspace/drv/bus/usb/ohci


Ignore:
Timestamp:
2011-10-28T21:52:15Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
57e06ef
Parents:
7265558
Message:

libusbhost: Make interfaces more symmetric.

Make usb_endpoint_manager interface easier to use and understand.
Move ep removal hook pointer from endpoint_t to hcd_t.

Location:
uspace/drv/bus/usb/ohci
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hc.c

    r7265558 r48ae3ef  
    142142if (ret != EOK) { \
    143143        usb_log_error(message); \
    144         usb_endpoint_manager_unregister_ep( \
    145             &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH);\
     144        usb_endpoint_manager_remove_ep( \
     145            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH, \
     146            NULL, NULL);\
    146147        usb_device_manager_release( \
    147148            &instance->generic.dev_manager, hub_address); \
     
    150151        int ret = usb_endpoint_manager_add_ep(
    151152            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH,
    152             USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64, 0);
     153            USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64, 0, NULL, NULL);
    153154        CHECK_RET_UNREG_RETURN(ret,
    154155            "Failed to register root hub control endpoint: %s.\n",
     
    197198        instance->generic.schedule = hc_schedule;
    198199        instance->generic.ep_add_hook = ohci_endpoint_init;
     200        instance->generic.ep_remove_hook = ohci_endpoint_fini;
    199201
    200202        ret = hc_init_memory(instance);
  • uspace/drv/bus/usb/ohci/ohci_endpoint.c

    r7265558 r48ae3ef  
    6262}
    6363/*----------------------------------------------------------------------------*/
    64 /** Disposes hcd endpoint structure
    65  *
    66  * @param[in] hcd_ep endpoint structure
    67  */
    68 static void ohci_endpoint_fini(endpoint_t *ep)
    69 {
    70         ohci_endpoint_t *instance = ep->hc_data.data;
    71         hc_dequeue_endpoint(instance->hcd->private_data, ep);
    72         if (instance) {
    73                 free32(instance->ed);
    74                 free32(instance->td);
    75                 free(instance);
    76         }
    77 }
    78 /*----------------------------------------------------------------------------*/
    7964/** Creates new hcd endpoint representation.
    8065 *
     
    10489        ed_init(ohci_ep->ed, ep, ohci_ep->td);
    10590        endpoint_set_hc_data(
    106             ep, ohci_ep, ohci_endpoint_fini, ohci_ep_toggle_get, ohci_ep_toggle_set);
     91            ep, ohci_ep, ohci_ep_toggle_get, ohci_ep_toggle_set);
    10792        ohci_ep->hcd = hcd;
    10893        hc_enqueue_endpoint(hcd->private_data, ep);
    10994        return EOK;
    11095}
     96/*----------------------------------------------------------------------------*/
     97/** Disposes hcd endpoint structure
     98 *
     99 * @param[in] hcd_ep endpoint structure
     100 */
     101void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep)
     102{
     103        assert(hcd);
     104        assert(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);
     113}
    111114/**
    112115 * @}
  • uspace/drv/bus/usb/ohci/ohci_endpoint.h

    r7265558 r48ae3ef  
    5656
    5757int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
     58void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep);
    5859
    5960/** Get and convert assigned ohci_endpoint_t structure
Note: See TracChangeset for help on using the changeset viewer.