Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 56fb3732 in mainline


Ignore:
Timestamp:
2010-12-28T10:28:16Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
de2c901
Parents:
6edd494
Message:

Add USB interface

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

Location:
uspace/lib
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/dev_iface.h

    r6edd494 r56fb3732  
    3939        CHAR_DEV_IFACE,
    4040
     41        /** Interface provided by any USB device. */
     42        USB_DEV_IFACE,
    4143        /** Interface provided by USB host controller. */
    4244        USBHC_DEV_IFACE,
  • uspace/lib/drv/Makefile

    r6edd494 r56fb3732  
    3636        generic/dev_iface.c \
    3737        generic/remote_res.c \
     38        generic/remote_usb.c \
    3839        generic/remote_usbhc.c \
    3940        generic/remote_char.c
  • uspace/lib/drv/generic/dev_iface.c

    r6edd494 r56fb3732  
    3939#include "remote_res.h"
    4040#include "remote_char.h"
     41#include "remote_usb.h"
    4142#include "remote_usbhc.h"
    4243
     
    4546                &remote_res_iface,
    4647                &remote_char_iface,
     48                &remote_usb_iface,
    4749                &remote_usbhc_iface
    4850        }
  • uspace/lib/usb/include/usb/usbdrv.h

    r6edd494 r56fb3732  
    4141#include <usb/descriptor.h>
    4242
     43int usb_drv_find_hc(device_t *, devman_handle_t *);
    4344int usb_drv_hc_connect(device_t *, unsigned int);
    4445
  • 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.