Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 1a0fa29c in mainline


Ignore:
Timestamp:
2014-01-02T20:28:50Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
da06e92
Parents:
7191992
Message:

uhci: Use the newly provided helper functions.

Location:
uspace/drv/bus/usb/uhci
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/Makefile

    r7191992 r1a0fa29c  
    4848        main.c \
    4949        transfer_list.c \
    50         uhci.c \
    5150        uhci_batch.c \
    5251        uhci_rh.c \
  • uspace/drv/bus/usb/uhci/main.c

    r7191992 r1a0fa29c  
    4242#include <str_error.h>
    4343#include <usb/debug.h>
     44#include <usb/host/ddf_helpers.h>
    4445
    45 #include "uhci.h"
     46#include "hc.h"
    4647
    4748#define NAME "uhci"
     49
     50// TODO: This should be merged to hc_interrupt
     51static void uhci_interrupt(hcd_t *hcd, uint32_t status)
     52{
     53        assert(hcd);
     54        if (hcd->driver.data)
     55                hc_interrupt(hcd->driver.data, status);
     56}
     57
     58static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
     59{
     60        assert(hcd);
     61        assert(hcd->driver.data == NULL);
     62
     63        hc_t *instance = malloc(sizeof(hc_t));
     64        if (!instance)
     65                return ENOMEM;
     66
     67        const int ret =  hc_init(instance, res, irq);
     68        if (ret == EOK)
     69                hcd_set_implementation(hcd, instance, hc_schedule, NULL, NULL,
     70                    uhci_interrupt);
     71        return ret;
     72}
     73
     74static void uhci_driver_fini(hcd_t *hcd)
     75{
     76        assert(hcd);
     77        if (hcd->driver.data)
     78                hc_fini(hcd->driver.data);
     79
     80        free(hcd->driver.data);
     81        hcd_set_implementation(hcd, NULL, NULL, NULL, NULL, NULL);
     82}
    4883
    4984static int uhci_dev_add(ddf_dev_t *device);
     
    98133
    99134
    100         ret = device_setup_uhci(device);
     135        ret = ddf_hcd_device_setup_all(device, USB_SPEED_FULL,
     136            BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11,
     137            ddf_hcd_gen_irq_handler, hc_gen_irq_code,
     138            uhci_driver_init, uhci_driver_fini);
    101139        if (ret != EOK) {
    102140                usb_log_error("Failed to initialize UHCI driver: %s.\n",
Note: See TracChangeset for help on using the changeset viewer.