Changeset 3b5d1535 in mainline for uspace/drv/uhci-hcd/main.c


Ignore:
Timestamp:
2011-02-23T10:28:21Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eb48f61
Parents:
e936e8e (diff), eb1a2f4 (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/uhci-hcd/main.c

    re936e8e r3b5d1535  
    3232 * @brief UHCI driver
    3333 */
    34 #include <driver.h>
     34#include <ddf/driver.h>
     35#include <ddf/interrupt.h>
    3536#include <usb_iface.h>
    3637#include <usb/ddfiface.h>
     
    4849#define NAME "uhci-hcd"
    4950
    50 static int uhci_add_device(device_t *device);
     51static int uhci_add_device(ddf_dev_t *device);
    5152
    52 static int usb_iface_get_address(device_t *dev, devman_handle_t handle,
    53     usb_address_t *address)
    54 {
    55         assert(dev);
    56         uhci_t *hc = dev_to_uhci(dev);
    57         assert(hc);
    58 
    59         usb_address_t addr = usb_address_keeping_find(&hc->address_manager,
    60             handle);
    61         if (addr < 0) {
    62                 return addr;
    63         }
    64 
    65         if (address != NULL) {
    66                 *address = addr;
    67         }
    68 
    69         return EOK;
    70 }
    71 
    72 
    73 static usb_iface_t hc_usb_iface = {
    74         .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
    75         .get_address = usb_iface_get_address
    76 };
    77 /*----------------------------------------------------------------------------*/
    78 static device_ops_t uhci_ops = {
    79         .interfaces[USB_DEV_IFACE] = &hc_usb_iface,
    80         .interfaces[USBHC_DEV_IFACE] = &uhci_iface
    81 };
    8253/*----------------------------------------------------------------------------*/
    8354static driver_ops_t uhci_driver_ops = {
     
    9061};
    9162/*----------------------------------------------------------------------------*/
    92 static void irq_handler(device_t *device, ipc_callid_t iid, ipc_call_t *call)
     63static void irq_handler(ddf_dev_t *dev, ipc_callid_t iid, ipc_call_t *call)
    9364{
    94         assert(device);
    95         uhci_t *hc = dev_to_uhci(device);
     65        assert(dev);
     66        uhci_t *hc = dev_to_uhci(dev);
    9667        uint16_t status = IPC_GET_ARG1(*call);
    9768        assert(hc);
     
    10576}
    10677
    107 static int uhci_add_device(device_t *device)
     78static int uhci_add_device(ddf_dev_t *device)
    10879{
    10980        assert(device);
    11081
    11182        usb_log_info("uhci_add_device() called\n");
    112         device->ops = &uhci_ops;
     83
    11384
    11485        uintptr_t io_reg_base;
     
    131102        CHECK_RET_RETURN(ret, "Failed to allocate memory for uhci hcd driver.\n");
    132103
    133         ret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size);
     104        ret = uhci_init(uhci_hc, device, (void*)io_reg_base, io_reg_size);
    134105        if (ret != EOK) {
    135106                usb_log_error("Failed to init uhci-hcd.\n");
     
    137108                return ret;
    138109        }
     110
     111        /*
     112         * We might free uhci_hc, but that does not matter since no one
     113         * else would access driver_data anyway.
     114         */
     115        device->driver_data = uhci_hc;
    139116
    140117        ret = register_interrupt_handler(device, irq, irq_handler,
     
    147124        }
    148125
    149         device_t *rh;
     126        ddf_fun_t *rh;
    150127        ret = setup_root_hub(&rh, device);
    151128        if (ret != EOK) {
     
    155132                return ret;
    156133        }
     134        rh->driver_data = uhci_hc->ddf_instance;
    157135
    158         ret = child_device_register(rh, device);
     136        ret = ddf_fun_bind(rh);
    159137        if (ret != EOK) {
    160138                usb_log_error("Failed to register root hub.\n");
     
    165143        }
    166144
    167         device->driver_data = uhci_hc;
    168145        return EOK;
    169146}
     
    172149{
    173150        sleep(3);
    174         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     151        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    175152
    176         return driver_main(&uhci_driver);
     153        return ddf_driver_main(&uhci_driver);
    177154}
    178155/**
Note: See TracChangeset for help on using the changeset viewer.