Changeset 4ca778b in mainline


Ignore:
Timestamp:
2013-01-27T15:39:10Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2745176
Parents:
0eb2a0f
Message:

usbmid: Use initialized parent to get address and hc handle.

Remove forwarding helpers from libusb.
Remove unused headers.

Location:
uspace
Files:
2 deleted
12 edited

Legend:

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

    r0eb2a0f r4ca778b  
    4141#include <usb/debug.h>
    4242#include <usb/usb.h>
    43 #include <usb/ddfiface.h>
    4443
    4544#include "hc.h"
  • uspace/drv/bus/usb/ohci/ohci.c

    r0eb2a0f r4ca778b  
    3838#include <ddf/interrupt.h>
    3939#include <usb/usb.h>
    40 #include <usb/ddfiface.h>
    4140#include <usb/debug.h>
    4241
  • uspace/drv/bus/usb/uhci/main.c

    r0eb2a0f r4ca778b  
    3636#include <str_error.h>
    3737
    38 #include <usb/ddfiface.h>
    3938#include <usb/debug.h>
    4039
  • uspace/drv/bus/usb/uhci/uhci.c

    r0eb2a0f r4ca778b  
    4040#include <str_error.h>
    4141#include <ddf/interrupt.h>
    42 #include <usb/ddfiface.h>
    4342#include <usb/debug.h>
    4443#include <usb/host/hcd.h>
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r0eb2a0f r4ca778b  
    4545#include <usb/dev/pipes.h>
    4646#include <usb/classes/classes.h>
    47 #include <usb/ddfiface.h>
    4847#include <usb/descriptor.h>
    4948#include <usb/dev/recognise.h>
  • uspace/drv/bus/usb/usbmid/explore.c

    r0eb2a0f r4ca778b  
    4040#include <usb/dev/request.h>
    4141#include <usb/dev/dp.h>
    42 #include <usb/ddfiface.h>
    4342#include "usbmid.h"
    44 
    45 /** Operations of the device itself. */
    46 static ddf_dev_ops_t mid_device_ops = {
    47         .interfaces[USB_DEV_IFACE] = &usb_iface_hub_impl
    48 };
    4943
    5044/** Tell whether given interface is already in the list.
     
    9387        /* Walk all descriptors nested in the current configuration decriptor;
    9488         * i.e. all interface descriptors. */
    95         for (;interface_ptr != NULL;
     89        for (; interface_ptr != NULL;
    9690            interface_ptr = usb_dp_get_sibling_descriptor(
    9791                &parser, &data, config_descriptor, interface_ptr))
     
    170164                return rc;
    171165        }
    172 
    173166       
    174 
    175167        /* Create driver soft-state. */
    176168        usb_mid_t *usb_mid = usb_device_data_alloc(dev, sizeof(usb_mid_t));
     
    186178                return ENOMEM;
    187179        }
    188         ddf_fun_set_ops(usb_mid->ctl_fun, &mid_device_ops);
    189180
    190181        /* Bind control function. */
     
    197188        }
    198189
    199 
    200190        /* Create interface children. */
    201191        list_initialize(&usb_mid->interface_list);
  • uspace/drv/bus/usb/usbmid/usbmid.c

    r0eb2a0f r4ca778b  
    3939#include <stdlib.h>
    4040#include <usb_iface.h>
    41 #include <usb/ddfiface.h>
    4241#include <usb/dev/pipes.h>
    4342#include <usb/classes/classes.h>
    4443#include <usb/dev/recognise.h>
    4544#include "usbmid.h"
     45/** Get host controller handle by calling the parent usb_device_t.
     46 *
     47 * @param[in] fun Device function the operation is running on.
     48 * @param[out] handle Storage for the host controller handle.
     49 * @return Error code.
     50 */
     51static int usb_iface_device_hc_handle(ddf_fun_t *fun, devman_handle_t *handle)
     52{
     53        assert(handle);
     54        assert(fun);
     55        usb_device_t *usb_dev = usb_device_get(ddf_fun_get_dev(fun));
     56        assert(usb_dev);
     57        *handle = usb_device_hc_handle(usb_dev);
     58        return EOK;
     59}
     60
     61/** Get USB device address by calling the parent usb_device_t.
     62 *
     63 * @param[in] fun Device function the operation is running on.
     64 * @param[in] handle Devman handle of USB device we want address of.
     65 * @param[out] address Storage for USB address of device with handle @p handle.
     66 * @return Error code.
     67 */
     68static int usb_iface_device_address(ddf_fun_t *fun, usb_address_t *address)
     69{
     70        assert(address);
     71        assert(fun);
     72        usb_device_t *usb_dev = usb_device_get(ddf_fun_get_dev(fun));
     73        assert(usb_dev);
     74        *address = usb_device_address(usb_dev);
     75        return EOK;
     76}
    4677
    4778/** Callback for DDF USB interface. */
    48 static int usb_iface_get_interface_impl(ddf_fun_t *fun, int *iface_no)
     79static int usb_iface_iface(ddf_fun_t *fun, int *iface_no)
    4980{
    5081        usbmid_interface_t *iface = ddf_fun_data_get(fun);
     
    6091/** DDF interface of the child - interface function. */
    6192static usb_iface_t child_usb_iface = {
    62         .get_hc_handle = usb_iface_get_hc_handle_device_impl,
    63         .get_my_address = usb_iface_get_my_address_forward_impl,
    64         .get_my_interface = usb_iface_get_interface_impl,
     93        .get_hc_handle = usb_iface_device_hc_handle,
     94        .get_my_address = usb_iface_device_address,
     95        .get_my_interface = usb_iface_iface,
    6596};
    6697
  • uspace/drv/bus/usb/vhc/main.c

    r0eb2a0f r4ca778b  
    4141#include <usb/host/ddf_helpers.h>
    4242
    43 #include <usb/ddfiface.h>
    4443#include <usb/debug.h>
    4544#include "vhcd.h"
  • uspace/lib/usb/Makefile

    r0eb2a0f r4ca778b  
    3636SOURCES = \
    3737        src/class.c \
    38         src/ddfiface.c \
    3938        src/dev.c \
    4039        src/debug.c \
  • uspace/lib/usbdev/include/usb/dev/device.h

    r0eb2a0f r4ca778b  
    5252typedef struct usb_device usb_device_t;
    5353
     54/* DDF parts */
    5455int usb_device_create_ddf(ddf_dev_t *, const usb_endpoint_description_t **, const char **);
    5556void usb_device_destroy_ddf(ddf_dev_t *);
     57
     58static inline usb_device_t *usb_device_get(ddf_dev_t *dev)
     59{
     60        assert(dev);
     61        return ddf_dev_data_get(dev);
     62}
     63
    5664
    5765usb_device_t * usb_device_create(devman_handle_t);
     
    8795void * usb_device_data_get(usb_device_t *);
    8896
     97/* Legacy support */
     98usb_address_t usb_device_address(usb_device_t *);
     99devman_handle_t usb_device_hc_handle(usb_device_t*);
     100
    89101#endif
    90102/**
  • uspace/lib/usbdev/src/devdrv.c

    r0eb2a0f r4ca778b  
    592592        return usb_dev->driver_data;
    593593}
     594
     595usb_address_t usb_device_address(usb_device_t *usb_dev)
     596{
     597        assert(usb_dev);
     598        return usb_dev->wire.address;
     599}
     600
     601devman_handle_t usb_device_hc_handle(usb_device_t *usb_dev)
     602{
     603        assert(usb_dev);
     604        return usb_dev->hc_conn.hc_handle;
     605}
    594606/**
    595607 * @}
  • uspace/lib/usbdev/src/recognise.c

    r0eb2a0f r4ca778b  
    3939#include <usb/dev/pipes.h>
    4040#include <usb/dev/recognise.h>
    41 #include <usb/ddfiface.h>
    4241#include <usb/dev/request.h>
    4342#include <usb/classes/classes.h>
Note: See TracChangeset for help on using the changeset viewer.