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


Ignore:
Timestamp:
2018-02-28T16:37:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b20da0
Parents:
f5e5f73 (diff), b2dca8de (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.
git-author:
Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
git-committer:
Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
Message:

Merge github.com:helenos-xhci-team/helenos

This commit merges support for USB 3 and generally refactors, fixes,
extends and cleans up the existing USB framework.

Notable additions and features:

  • new host controller driver has been implemented to control various xHC models (among others, NEC Renesas uPD720200)
  • isochronous data transfer mode
  • support for explicit USB device removal
  • USB tablet driver
File:
1 edited

Legend:

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

    rf5e5f73 rdf6ded8  
    22 * Copyright (c) 2011 Jan Vesely
    33 * Copyright (c) 2011 Vojtech Horky
     4 * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
    45 * All rights reserved.
    56 *
     
    3940#include <errno.h>
    4041#include <io/log.h>
     42#include <io/logctl.h>
    4143#include <str_error.h>
    4244
    4345#include <usb/debug.h>
    44 #include <usb/host/ddf_helpers.h>
    4546
    4647#include "hc.h"
     48#include "ohci_bus.h"
    4749
    4850#define NAME "ohci"
    49 static errno_t ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
    50 static void ohci_driver_fini(hcd_t *);
    5151
    52 static const ddf_hc_driver_t ohci_hc_driver = {
    53         .hc_speed = USB_SPEED_FULL,
    54         .irq_code_gen = ohci_hc_gen_irq_code,
    55         .init = ohci_driver_init,
    56         .fini = ohci_driver_fini,
    57         .name = "OHCI",
    58         .ops = {
    59                 .schedule       = ohci_hc_schedule,
    60                 .ep_add_hook    = ohci_endpoint_init,
    61                 .ep_remove_hook = ohci_endpoint_fini,
    62                 .irq_hook       = ohci_hc_interrupt,
    63                 .status_hook    = ohci_hc_status,
    64         },
    65 };
     52static const hc_driver_t ohci_driver = {
     53        .name = NAME,
     54        .hc_device_size = sizeof(hc_t),
    6655
    67 
    68 static errno_t ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
    69 {
    70         assert(hcd);
    71         assert(hcd_get_driver_data(hcd) == NULL);
    72 
    73         hc_t *instance = malloc(sizeof(hc_t));
    74         if (!instance)
    75                 return ENOMEM;
    76 
    77         const errno_t ret = hc_init(instance, res, irq);
    78         if (ret == EOK) {
    79                 hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops);
    80         } else {
    81                 free(instance);
    82         }
    83         return ret;
    84 }
    85 
    86 static void ohci_driver_fini(hcd_t *hcd)
    87 {
    88         assert(hcd);
    89         hc_t *hc = hcd_get_driver_data(hcd);
    90         if (hc)
    91                 hc_fini(hc);
    92 
    93         hcd_set_implementation(hcd, NULL, NULL);
    94         free(hc);
    95 }
    96 
    97 /** Initializes a new ddf driver instance of OHCI hcd.
    98  *
    99  * @param[in] device DDF instance of the device to initialize.
    100  * @return Error code.
    101  */
    102 static errno_t ohci_dev_add(ddf_dev_t *device)
    103 {
    104         usb_log_debug("ohci_dev_add() called\n");
    105         assert(device);
    106         return hcd_ddf_add_hc(device, &ohci_hc_driver);
    107 }
    108 
    109 static const driver_ops_t ohci_driver_ops = {
    110         .dev_add = ohci_dev_add,
    111 };
    112 
    113 static const driver_t ohci_driver = {
    114         .name = NAME,
    115         .driver_ops = &ohci_driver_ops
     56        .hc_add = hc_add,
     57        .irq_code_gen = hc_gen_irq_code,
     58        .claim = hc_gain_control,
     59        .start = hc_start,
     60        .setup_root_hub = hc_setup_roothub,
     61        .hc_gone = hc_gone,
    11662};
    11763
     
    12773{
    12874        log_init(NAME);
    129         return ddf_driver_main(&ohci_driver);
     75        logctl_set_log_level(NAME, LVL_NOTE);
     76        return hc_driver_main(&ohci_driver);
    13077}
    13178
Note: See TracChangeset for help on using the changeset viewer.