Changeset 6bb0f43 in mainline for uspace/drv/ohci/hc.c


Ignore:
Timestamp:
2011-04-13T10:36:09Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2759c52
Parents:
3d932af6
Message:

Move endpoint registration to hc.c

File:
1 edited

Legend:

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

    r3d932af6 r6bb0f43  
    130130                fibril_add_ready(instance->interrupt_emulator);
    131131        }
    132 
     132#undef CHECK_RET_RETURN
    133133        return EOK;
     134}
     135/*----------------------------------------------------------------------------*/
     136int hc_add_endpoint(
     137    hc_t *instance, usb_address_t address, usb_endpoint_t endpoint,
     138    usb_speed_t speed, usb_transfer_type_t type, usb_direction_t direction,
     139    size_t mps, size_t size, unsigned interval)
     140{
     141        endpoint_t *ep = malloc(sizeof(endpoint_t));
     142        if (ep == NULL)
     143                return ENOMEM;
     144        int ret =
     145            endpoint_init(ep, address, endpoint, direction, type, speed, mps);
     146        if (ret != EOK) {
     147                free(ep);
     148                return ret;
     149        }
     150
     151        ret = usb_endpoint_manager_register_ep(&instance->ep_manager, ep, size);
     152        if (ret != EOK) {
     153                endpoint_destroy(ep);
     154        }
     155        return ret;
     156}
     157/*----------------------------------------------------------------------------*/
     158int hc_remove_endpoint(hc_t *instance, usb_address_t address,
     159    usb_endpoint_t endpoint, usb_direction_t direction)
     160{
     161        return usb_endpoint_manager_unregister_ep(&instance->ep_manager,
     162            address, endpoint, direction);
    134163}
    135164/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.