Changeset 56fb3732 in mainline for uspace/lib/usb/src/usbdrv.c


Ignore:
Timestamp:
2010-12-28T10:28:16Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
de2c901
Parents:
6edd494
Message:

Add USB interface

Only boilerplate code for finding host controller device is physically
attached to is ready.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/usbdrv.c

    r6edd494 r56fb3732  
    3535#include <usb/usbdrv.h>
    3636#include <usbhc_iface.h>
     37#include <usb_iface.h>
    3738#include <errno.h>
    3839#include <str_error.h>
     
    5455} transfer_info_t;
    5556
     57/** Find handle of host controller the device is physically attached to.
     58 *
     59 * @param[in] dev Device looking for its host controller.
     60 * @param[out] handle Host controller devman handle.
     61 * @return Error code.
     62 */
     63int usb_drv_find_hc(device_t *dev, devman_handle_t *handle)
     64{
     65        if (dev == NULL) {
     66                return EBADMEM;
     67        }
     68        if (handle == NULL) {
     69                return EBADMEM;
     70        }
     71
     72        int parent_phone = devman_parent_device_connect(dev->handle, 0);
     73        if (parent_phone < 0) {
     74                return parent_phone;
     75        }
     76
     77        devman_handle_t h;
     78        int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
     79            IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);
     80        if (rc != EOK) {
     81                return rc;
     82        }
     83
     84        *handle = h;
     85
     86        return EOK;
     87}
     88
    5689/** Connect to host controller the device is physically attached to.
    5790 *
Note: See TracChangeset for help on using the changeset viewer.