Changeset 7ce0fe3 in mainline for uspace/drv/uhci-rhd/main.c


Ignore:
Timestamp:
2011-02-01T22:02:23Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
afcd86e
Parents:
993a1e1
Message:

Root ub driver uses unified debug logging and some other polishing.

File:
1 edited

Legend:

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

    r993a1e1 r7ce0fe3  
    2828#include <driver.h>
    2929#include <errno.h>
    30 #include <str_error.h>
     30
    3131#include <usb_iface.h>
     32#include <usb/debug.h>
    3233
    33 #include "debug.h"
    34 //#include "iface.h"
    3534#include "root_hub.h"
     35
     36#define NAME "uhci-rhd"
    3637
    3738static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
    3839{
    39         /* This shall be called only for the UHCI itself. */
    4040        assert(dev);
    4141        assert(dev->driver_data);
     42        assert(handle);
     43
    4244        *handle = ((uhci_root_hub_t*)dev->driver_data)->hc_handle;
     45        usb_log_debug("Answering HC handle: %d.\n", *handle);
    4346
    4447        return EOK;
     
    5861                return ENOTSUP;
    5962
    60         uhci_print_info("%s called device %d\n", __FUNCTION__, device->handle);
     63        usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle);
    6164        device->ops = &uhci_rh_ops;
    6265
    6366        uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t));
    6467        if (!rh) {
     68                usb_log_error("Failed to allocate memory for driver instance.\n");
    6569                return ENOMEM;
    6670        }
     71
     72        /* TODO: get register values from hc */
    6773        int ret = uhci_root_hub_init(rh, (void*)0xc030, 4, device);
    6874        if (ret != EOK) {
     75                usb_log_error("Failed(%d) to initialize driver instance.\n", ret);
    6976                free(rh);
    7077                return ret;
    7178        }
     79
    7280        device->driver_data = rh;
     81        usb_log_info("Sucessfully initialized driver isntance for device:%d.\n",
     82            device->handle);
    7383        return EOK;
    7484}
     
    8595int main(int argc, char *argv[])
    8696{
    87         /*
    88          * Do some global initializations.
    89          */
    90         usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
    91 
     97        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    9298        return driver_main(&uhci_rh_driver);
    9399}
Note: See TracChangeset for help on using the changeset viewer.