Changeset 95120c3 in mainline


Ignore:
Timestamp:
2011-02-20T17:00:54Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
27a0012
Parents:
b68b279
Message:

Add get_interface to USB interface

The get_interface shall be used by MID interface drivers to get
interface number they ought to drive.

Location:
uspace/lib/drv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usb.c

    rb68b279 r95120c3  
    4040
    4141
     42static void remote_usb_get_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
     43static void remote_usb_get_interface(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4244static void remote_usb_get_hc_handle(device_t *, void *, ipc_callid_t, ipc_call_t *);
    43 static void remote_usb_get_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4445//static void remote_usb(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4546
     
    4748static remote_iface_func_ptr_t remote_usb_iface_ops [] = {
    4849        remote_usb_get_address,
     50        remote_usb_get_interface,
    4951        remote_usb_get_hc_handle
    5052};
     
    8082}
    8183
     84void remote_usb_get_interface(device_t *device, void *iface,
     85    ipc_callid_t callid, ipc_call_t *call)
     86{
     87        usb_iface_t *usb_iface = (usb_iface_t *) iface;
     88
     89        if (usb_iface->get_interface == NULL) {
     90                async_answer_0(callid, ENOTSUP);
     91                return;
     92        }
     93
     94        devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
     95
     96        int iface_no;
     97        int rc = usb_iface->get_interface(device, handle, &iface_no);
     98        if (rc != EOK) {
     99                async_answer_0(callid, rc);
     100        } else {
     101                async_answer_1(callid, EOK, iface_no);
     102        }
     103}
    82104
    83105void remote_usb_get_hc_handle(device_t *device, void *iface,
  • uspace/lib/drv/include/usb_iface.h

    rb68b279 r95120c3  
    5252        IPC_M_USB_GET_ADDRESS,
    5353
     54        /** Tell interface number given device can use.
     55         * Parameters
     56         * - devman handle id of the device
     57         * Answer:
     58         * - ENOTSUP - operation not supported (can also mean any interface)
     59         * - EOK - operation okay, first parameter contains interface number
     60         */
     61        IPC_M_USB_GET_INTERFACE,
     62
    5463        /** Tell devman handle of device host controller.
    5564         * Parameters:
     
    6776typedef struct {
    6877        int (*get_address)(device_t *, devman_handle_t, usb_address_t *);
     78        int (*get_interface)(device_t *, devman_handle_t, int *);
    6979        int (*get_hc_handle)(device_t *, devman_handle_t *);
    7080} usb_iface_t;
Note: See TracChangeset for help on using the changeset viewer.