Changeset 41ef5b9 in mainline for uspace/drv/ohci/main.c


Ignore:
Timestamp:
2011-03-21T17:16:10Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4d0c40b
Parents:
fd9f6e4c (diff), 434ef65 (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 from usb/development

File:
1 edited

Legend:

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

    rfd9f6e4c r41ef5b9  
    4545#include "pci.h"
    4646#include "iface.h"
    47 #include "ohci_hc.h"
     47#include "hc.h"
    4848
    4949static int ohci_add_device(ddf_dev_t *device);
     50static int get_hc_handle(ddf_fun_t *fun, devman_handle_t *handle)
     51{
     52        assert(handle);
     53  assert(fun != NULL);
     54
     55  *handle = fun->handle;
     56  return EOK;
     57}
     58/*----------------------------------------------------------------------------*/
     59static int get_address(
     60    ddf_fun_t *fun, devman_handle_t handle, usb_address_t *address)
     61{
     62        assert(fun);
     63        usb_device_keeper_t *manager = &fun_to_hc(fun)->manager;
     64  usb_address_t addr = usb_device_keeper_find(manager, handle);
     65  if (addr < 0) {
     66    return addr;
     67  }
     68
     69  if (address != NULL) {
     70    *address = addr;
     71  }
     72
     73  return EOK;
     74}
    5075/*----------------------------------------------------------------------------*/
    5176/** IRQ handling callback, identifies device
     
    5883{
    5984        assert(dev);
    60         ohci_hc_t *hc = (ohci_hc_t*)dev->driver_data;
     85        hc_t *hc = (hc_t*)dev->driver_data;
    6186        assert(hc);
    62         ohci_hc_interrupt(hc, 0);
     87        hc_interrupt(hc, 0);
    6388}
    6489/*----------------------------------------------------------------------------*/
     
    7196        .driver_ops = &ohci_driver_ops
    7297};
     98/*----------------------------------------------------------------------------*/
     99static usb_iface_t hc_usb_iface = {
     100        .get_address = get_address,
     101        .get_hc_handle = get_hc_handle,
     102};
     103/*----------------------------------------------------------------------------*/
    73104static ddf_dev_ops_t hc_ops = {
    74         .interfaces[USBHC_DEV_IFACE] = &ohci_hc_iface,
    75 };
    76 
     105        .interfaces[USB_DEV_IFACE] = &hc_usb_iface,
     106        .interfaces[USBHC_DEV_IFACE] = &hc_iface,
     107};
    77108/*----------------------------------------------------------------------------*/
    78109/** Initializes a new ddf driver instance of OHCI hcd.
     
    105136            "Failed(%d) disable legacy USB: %s.\n", ret, str_error(ret));
    106137
    107         ohci_hc_t *hcd = malloc(sizeof(ohci_hc_t));
     138        hc_t *hcd = malloc(sizeof(hc_t));
    108139        if (hcd == NULL) {
    109140                usb_log_error("Failed to allocate OHCI driver.\n");
     
    129160        }
    130161
    131         ret = ohci_hc_init(hcd, hc_fun, mem_reg_base, mem_reg_size, interrupts);
     162        ret = hc_init(hcd, hc_fun, device, mem_reg_base, mem_reg_size, interrupts);
    132163        if (ret != EOK) {
    133164                usb_log_error("Failed to initialize OHCI driver.\n");
     
    148179        hc_fun->driver_data = hcd;
    149180
    150         /* TODO: register interrupt handler */
     181        fid_t later = fibril_create((int(*)(void*))hc_register_hub, hcd);
     182        fibril_add_ready(later);
    151183
    152184        usb_log_info("Controlling new OHCI device `%s' (handle %llu).\n",
Note: See TracChangeset for help on using the changeset viewer.