Changeset efdfebc in mainline for uspace/drv/bus/usb/ohci/ohci.c


Ignore:
Timestamp:
2012-11-06T21:03:44Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
338810f
Parents:
de73242 (diff), 94795812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    rde73242 refdfebc  
    3333 * @brief OHCI driver
    3434 */
     35
     36/* XXX Fix this */
     37#define _DDF_DATA_IMPLANT
     38
    3539#include <errno.h>
    3640#include <str_error.h>
     
    5256} ohci_t;
    5357
    54 static inline ohci_t * dev_to_ohci(ddf_dev_t *dev)
    55 {
    56         assert(dev);
    57         return dev->driver_data;
     58static inline ohci_t *dev_to_ohci(ddf_dev_t *dev)
     59{
     60        return ddf_dev_data_get(dev);
    5861}
    5962/** IRQ handling callback, identifies device
     
    7578        hc_interrupt(&ohci->hc, status);
    7679}
    77 /*----------------------------------------------------------------------------*/
     80
    7881/** Get USB address assigned to root hub.
    7982 *
     
    8790
    8891        if (address != NULL) {
    89                 *address = dev_to_ohci(fun->dev)->hc.rh.address;
     92                *address = dev_to_ohci(ddf_fun_get_dev(fun))->hc.rh.address;
    9093        }
    9194
    9295        return EOK;
    9396}
    94 /*----------------------------------------------------------------------------*/
     97
    9598/** Gets handle of the respective hc (this device, hc function).
    9699 *
     
    103106{
    104107        assert(fun);
    105         ddf_fun_t *hc_fun = dev_to_ohci(fun->dev)->hc_fun;
     108        ddf_fun_t *hc_fun = dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun;
    106109        assert(hc_fun);
    107110
    108111        if (handle != NULL)
    109                 *handle = hc_fun->handle;
     112                *handle = ddf_fun_get_handle(hc_fun);
    110113        return EOK;
    111114}
    112 /*----------------------------------------------------------------------------*/
     115
    113116/** Root hub USB interface */
    114117static usb_iface_t usb_iface = {
     
    116119        .get_my_address = rh_get_my_address,
    117120};
    118 /*----------------------------------------------------------------------------*/
     121
    119122/** Standard USB HC options (HC interface) */
    120123static ddf_dev_ops_t hc_ops = {
    121124        .interfaces[USBHC_DEV_IFACE] = &hcd_iface,
    122125};
    123 /*----------------------------------------------------------------------------*/
     126
    124127/** Standard USB RH options (RH interface) */
    125128static ddf_dev_ops_t rh_ops = {
    126129        .interfaces[USB_DEV_IFACE] = &usb_iface,
    127130};
    128 /*----------------------------------------------------------------------------*/
     131
    129132/** Initialize hc and rh ddf structures and their respective drivers.
    130133 *
     
    152155if (ret != EOK) { \
    153156        if (instance->hc_fun) { \
    154                 instance->hc_fun->driver_data = NULL; \
    155157                ddf_fun_destroy(instance->hc_fun); \
    156158        } \
    157159        if (instance->rh_fun) { \
    158                 instance->rh_fun->driver_data = NULL; \
    159160                ddf_fun_destroy(instance->rh_fun); \
    160161        } \
     
    167168        CHECK_RET_DEST_FREE_RETURN(ret,
    168169            "Failed to create OHCI HC function: %s.\n", str_error(ret));
    169         instance->hc_fun->ops = &hc_ops;
    170         instance->hc_fun->driver_data = &instance->hc;
     170        ddf_fun_set_ops(instance->hc_fun, &hc_ops);
     171        ddf_fun_data_implant(instance->hc_fun, &instance->hc);
    171172
    172173        instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh");
     
    174175        CHECK_RET_DEST_FREE_RETURN(ret,
    175176            "Failed to create OHCI RH function: %s.\n", str_error(ret));
    176         instance->rh_fun->ops = &rh_ops;
     177        ddf_fun_set_ops(instance->rh_fun, &rh_ops);
    177178
    178179        uintptr_t reg_base = 0;
     
    183184        CHECK_RET_DEST_FREE_RETURN(ret,
    184185            "Failed to get register memory addresses for %" PRIun ": %s.\n",
    185             device->handle, str_error(ret));
     186            ddf_dev_get_handle(device), str_error(ret));
    186187        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
    187188            (void *) reg_base, reg_size, irq);
Note: See TracChangeset for help on using the changeset viewer.