Changes in / [0f191a2:ae1f70e] in mainline


Ignore:
Location:
uspace
Files:
3 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/main.c

    r0f191a2 rae1f70e  
    2727 */
    2828#include <usb/hcdhubd.h>
    29 #include <usb_iface.h>
    3029#include <usb/debug.h>
    3130#include <errno.h>
     
    3332#include "uhci.h"
    3433
    35 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
    36 {
    37         /* This shall be called only for the UHCI itself. */
    38         assert(dev->parent == NULL);
    39 
    40         *handle = dev->handle;
    41         return EOK;
    42 }
    43 
    44 static usb_iface_t hc_usb_iface = {
    45         .get_hc_handle = usb_iface_get_hc_handle
    46 };
    47 
    4834static device_ops_t uhci_ops = {
    49         .interfaces[USB_DEV_IFACE] = &hc_usb_iface,
    50         .interfaces[USBHC_DEV_IFACE] = &uhci_iface
     35        .interfaces[USBHC_DEV_IFACE] = &uhci_iface,
    5136};
    5237
  • uspace/drv/usbhub/usbhub.c

    r0f191a2 rae1f70e  
    3737#include <errno.h>
    3838
    39 #include <usb_iface.h>
     39#include <usbhc_iface.h>
    4040#include <usb/usbdrv.h>
    4141#include <usb/descriptor.h>
     
    4646#include "usbhub_private.h"
    4747#include "port_status.h"
    48 
    49 static usb_iface_t hub_usb_iface = {
    50         .get_hc_handle = usb_drv_find_hc
    51 };
    52 
    53 static device_ops_t hub_device_ops = {
    54         .interfaces[USB_DEV_IFACE] = &hub_usb_iface
    55 };
    5648
    5749//*********************************************
     
    143135         * connected devices.
    144136         */
    145         dev->ops = &hub_device_ops;
    146137
    147138        //create the hub structure
    148139        //get hc connection
    149         int hc = usb_drv_hc_connect_auto(dev, 0);
    150         if (hc < 0) {
    151                 return hc;
    152         }
     140        int hc = usb_drv_hc_connect(dev, 0);
    153141
    154142        usb_hub_info_t * hub_info = usb_create_hub_info(dev, hc);
     
    476464                 * Connect to respective HC.
    477465                 */
    478                 int hc = usb_drv_hc_connect_auto(hub_info->device, 0);
     466                int hc = usb_drv_hc_connect(hub_info->device, 0);
    479467                if (hc < 0) {
    480468                        continue;
  • uspace/drv/usbkbd/main.c

    r0f191a2 rae1f70e  
    190190        // get phone to my HC and save it as my parent's phone
    191191        // TODO: maybe not a good idea if DDF will use parent_phone
    192         kbd_dev->device->parent_phone = usb_drv_hc_connect_auto(dev, 0);
     192        kbd_dev->device->parent_phone = usb_drv_hc_connect(dev, 0);
    193193
    194194        kbd_dev->address = usb_drv_get_my_address(dev->parent_phone,
     
    325325         * Not supported yet, skip..
    326326         */
    327 //      int phone = usb_drv_hc_connect_auto(dev, 0);
     327//      int phone = usb_drv_hc_connect(dev, 0);
    328328//      if (phone < 0) {
    329329//              /*
  • uspace/drv/vhc/hcd.c

    r0f191a2 rae1f70e  
    4646
    4747#include <usb/usb.h>
    48 #include <usb_iface.h>
    4948#include "vhcd.h"
    5049#include "hc.h"
     
    5352#include "conn.h"
    5453
    55 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
    56 {
    57         /* This shall be called only for VHC device. */
    58         assert(dev->parent == NULL);
    59 
    60         *handle = dev->handle;
    61         return EOK;
    62 }
    63 
    64 static usb_iface_t hc_usb_iface = {
    65         .get_hc_handle = usb_iface_get_hc_handle
    66 };
    67 
    6854static device_ops_t vhc_ops = {
    6955        .interfaces[USBHC_DEV_IFACE] = &vhc_iface,
    70         .interfaces[USB_DEV_IFACE] = &hc_usb_iface,
    7156        .default_handler = default_connection_handler
    7257};
  • uspace/drv/vhc/hub.c

    r0f191a2 rae1f70e  
    7979        device_t *hc_dev = (device_t *) arg;
    8080
    81         int hc = usb_drv_hc_connect(hc_dev, hc_dev->handle, IPC_FLAG_BLOCKING);
     81        int hc = usb_drv_hc_connect(hc_dev, IPC_FLAG_BLOCKING);
    8282        if (hc < 0) {
    8383                printf(NAME ": failed to register root hub\n");
  • uspace/lib/c/include/ipc/dev_iface.h

    r0f191a2 rae1f70e  
    3939        CHAR_DEV_IFACE,
    4040
    41         /** Interface provided by any USB device. */
    42         USB_DEV_IFACE,
    4341        /** Interface provided by USB host controller. */
    4442        USBHC_DEV_IFACE,
  • uspace/lib/drv/Makefile

    r0f191a2 rae1f70e  
    3636        generic/dev_iface.c \
    3737        generic/remote_res.c \
    38         generic/remote_usb.c \
    3938        generic/remote_usbhc.c \
    4039        generic/remote_char.c
  • uspace/lib/drv/generic/dev_iface.c

    r0f191a2 rae1f70e  
    3939#include "remote_res.h"
    4040#include "remote_char.h"
    41 #include "remote_usb.h"
    4241#include "remote_usbhc.h"
    4342
     
    4645                &remote_res_iface,
    4746                &remote_char_iface,
    48                 &remote_usb_iface,
    4947                &remote_usbhc_iface
    5048        }
  • uspace/lib/drv/generic/remote_usbhc.c

    r0f191a2 rae1f70e  
    5959//static void remote_usbhc(device_t *, void *, ipc_callid_t, ipc_call_t *);
    6060
    61 /** Remote USB host controller interface operations. */
     61/** Remote USB interface operations. */
    6262static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = {
    6363        remote_usbhc_get_address,
     
    8484};
    8585
    86 /** Remote USB host controller interface structure.
     86/** Remote USB interface structure.
    8787 */
    8888remote_iface_t remote_usbhc_iface = {
  • uspace/lib/drv/include/usbhc_iface.h

    r0f191a2 rae1f70e  
    3131 */
    3232/** @file
    33  * @brief USB host controller interface definition.
     33 * @brief USB interface definition.
    3434 */
    3535
     
    226226    usbhc_iface_transfer_in_callback_t, void *);
    227227
    228 /** USB host controller communication interface. */
     228/** USB devices communication interface. */
    229229typedef struct {
    230230        int (*tell_address)(device_t *, devman_handle_t, usb_address_t *);
  • uspace/lib/usb/include/usb/usbdrv.h

    r0f191a2 rae1f70e  
    4141#include <usb/descriptor.h>
    4242
    43 int usb_drv_find_hc(device_t *, devman_handle_t *);
    44 int usb_drv_hc_connect(device_t *, devman_handle_t, unsigned int);
    45 int usb_drv_hc_connect_auto(device_t *, unsigned int);
     43int usb_drv_hc_connect(device_t *, unsigned int);
    4644
    4745int usb_drv_reserve_default_address(int);
  • uspace/lib/usb/src/hcdhubd.c

    r0f191a2 rae1f70e  
    3636#include <usb/devreq.h>
    3737#include <usbhc_iface.h>
    38 #include <usb_iface.h>
    3938#include <usb/descriptor.h>
    4039#include <driver.h>
     
    4645#include "hcdhubd_private.h"
    4746
    48 
    49 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
    50 {
    51         assert(dev);
    52         assert(dev->parent != NULL);
    53 
    54         device_t *parent = dev->parent;
    55 
    56         if (parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) {
    57                 usb_iface_t *usb_iface
    58                     = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE];
    59                 assert(usb_iface != NULL);
    60                 if (usb_iface->get_hc_handle) {
    61                         int rc = usb_iface->get_hc_handle(parent, handle);
    62                         return rc;
    63                 }
    64         }
    65 
    66         return ENOTSUP;
    67 }
    68 
    69 static usb_iface_t usb_iface = {
    70         .get_hc_handle = usb_iface_get_hc_handle
    71 };
    72 
    73 static device_ops_t child_ops = {
    74         .interfaces[USB_DEV_IFACE] = &usb_iface
    75 };
    76 
    7747/** Callback when new device is detected and must be handled by this driver.
    7848 *
     
    159129        }
    160130        child->name = child_info->name;
    161         child->parent = child_info->parent;
    162         child->ops = &child_ops;
    163131
    164132        match_id = create_match_id();
  • uspace/lib/usb/src/recognise.c

    r0f191a2 rae1f70e  
    3333 * @brief Functions for recognising kind of attached devices.
    3434 */
    35 #include <usb_iface.h>
    3635#include <usb/usbdrv.h>
    3736#include <usb/classes/classes.h>
     
    3938#include <errno.h>
    4039
    41 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
    42 {
    43         assert(dev);
    44         assert(dev->parent != NULL);
    45 
    46         device_t *parent = dev->parent;
    47 
    48         if (parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) {
    49                 usb_iface_t *usb_iface
    50                     = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE];
    51                 assert(usb_iface != NULL);
    52                 if (usb_iface->get_hc_handle) {
    53                         int rc = usb_iface->get_hc_handle(parent, handle);
    54                         return rc;
    55                 }
    56         }
    57 
    58         return ENOTSUP;
    59 }
    60 
    61 static usb_iface_t usb_iface = {
    62         .get_hc_handle = usb_iface_get_hc_handle
    63 };
    64 
    65 static device_ops_t child_ops = {
    66         .interfaces[USB_DEV_IFACE] = &usb_iface
    67 };
    6840
    6941#define BCD_INT(a) (((unsigned int)(a)) / 256)
     
    313285                goto failure;
    314286        }
    315         child->parent = parent;
    316287        child->name = child_name;
    317         child->ops = &child_ops;
    318288       
    319289        rc = usb_drv_create_device_match_ids(hc, &child->match_ids, address);
  • uspace/lib/usb/src/usbdrv.c

    r0f191a2 rae1f70e  
    3535#include <usb/usbdrv.h>
    3636#include <usbhc_iface.h>
    37 #include <usb_iface.h>
    3837#include <errno.h>
    3938#include <str_error.h>
     
    5554} transfer_info_t;
    5655
    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  */
    63 int 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,
    73             IPC_FLAG_BLOCKING);
    74         if (parent_phone < 0) {
    75                 return parent_phone;
    76         }
    77 
    78         devman_handle_t h;
    79         int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
    80             IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);
    81 
    82         ipc_hangup(parent_phone);
    83 
    84         if (rc != EOK) {
    85                 return rc;
    86         }
    87 
    88         *handle = h;
    89 
    90         return EOK;
    91 }
    92 
    93 /** Connect to host controller the device is physically attached to.
    94  *
    95  * @param dev Device asking for connection.
    96  * @param hc_handle Devman handle of the host controller.
    97  * @param flags Connection flags (blocking connection).
    98  * @return Phone to the HC or error code.
    99  */
    100 int usb_drv_hc_connect(device_t *dev, devman_handle_t hc_handle,
    101     unsigned int flags)
    102 {
    103         return devman_device_connect(hc_handle, flags);
    104 }
    105 
    10656/** Connect to host controller the device is physically attached to.
    10757 *
     
    11060 * @return Phone to corresponding HC or error code.
    11161 */
    112 int usb_drv_hc_connect_auto(device_t *dev, unsigned int flags)
    113 {
    114         int rc;
    115         devman_handle_t hc_handle;
    116 
     62int usb_drv_hc_connect(device_t *dev, unsigned int flags)
     63{
    11764        /*
    11865         * Call parent hub to obtain device handle of respective HC.
    11966         */
    120         rc = usb_drv_find_hc(dev, &hc_handle);
     67
     68        /*
     69         * FIXME: currently we connect always to virtual host controller.
     70         */
     71        int rc;
     72        devman_handle_t handle;
     73
     74        rc = devman_device_get_handle("/virt/usbhc", &handle, flags);
    12175        if (rc != EOK) {
    12276                return rc;
    12377        }
    12478       
    125         return usb_drv_hc_connect(dev, hc_handle, flags);
     79        int phone = devman_device_connect(handle, flags);
     80
     81        return phone;
    12682}
    12783
  • uspace/srv/devman/main.c

    r0f191a2 rae1f70e  
    458458       
    459459        if (driver == NULL) {
    460                 printf(NAME ": devman_forward error - the device %" PRIun \
    461                     " (%s) is not in usable state.\n",
    462                     handle, dev->pathname);
     460                printf(NAME ": devman_forward error - the device is not in %" PRIun
     461                    " usable state.\n", handle);
    463462                ipc_answer_0(iid, ENOENT);
    464463                return;
Note: See TracChangeset for help on using the changeset viewer.