Changes in uspace/drv/bus/usb/ehci/main.c [b7fd2a0:e0a5d4c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/main.c
rb7fd2a0 re0a5d4c 2 2 * Copyright (c) 2011 Jan Vesely 3 3 * Copyright (c) 2011 Vojtech Horky 4 * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek 4 5 * All rights reserved. 5 6 * … … 35 36 */ 36 37 37 #include <ddf/driver.h>38 #include <ddf/interrupt.h>39 #include <device/hw_res.h>40 #include <errno.h>41 #include <str_error.h>42 38 #include <io/logctl.h> 43 44 #include <usb_iface.h> 45 #include <usb/debug.h> 46 #include <usb/host/ddf_helpers.h> 39 #include <usb/host/hcd.h> 47 40 48 41 #include "res.h" 49 42 #include "hc.h" 50 #include "ehci_endpoint.h"51 43 52 44 #define NAME "ehci" 53 45 54 static errno_t ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 55 static void ehci_driver_fini(hcd_t *); 46 static const hc_driver_t ehci_driver = { 47 .name = NAME, 48 .hc_device_size = sizeof(hc_t), 56 49 57 static const ddf_hc_driver_t ehci_hc_driver = { 50 .hc_add = hc_add, 51 .irq_code_gen = hc_gen_irq_code, 58 52 .claim = disable_legacy, 59 .hc_speed = USB_SPEED_HIGH, 60 .irq_code_gen = ehci_hc_gen_irq_code, 61 .init = ehci_driver_init, 62 .fini = ehci_driver_fini, 63 .name = "EHCI-PCI", 64 .ops = { 65 .schedule = ehci_hc_schedule, 66 .ep_add_hook = ehci_endpoint_init, 67 .ep_remove_hook = ehci_endpoint_fini, 68 .irq_hook = ehci_hc_interrupt, 69 .status_hook = ehci_hc_status, 70 } 53 .start = hc_start, 54 .setup_root_hub = hc_setup_roothub, 55 .hc_gone = hc_gone, 71 56 }; 72 73 74 static errno_t ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res,75 bool irq)76 {77 assert(hcd);78 assert(hcd_get_driver_data(hcd) == NULL);79 80 hc_t *instance = malloc(sizeof(hc_t));81 if (!instance)82 return ENOMEM;83 84 const errno_t ret = hc_init(instance, res, irq);85 if (ret == EOK) {86 hcd_set_implementation(hcd, instance, &ehci_hc_driver.ops);87 } else {88 free(instance);89 }90 return ret;91 }92 93 static void ehci_driver_fini(hcd_t *hcd)94 {95 assert(hcd);96 hc_t *hc = hcd_get_driver_data(hcd);97 if (hc)98 hc_fini(hc);99 100 free(hc);101 hcd_set_implementation(hcd, NULL, NULL);102 }103 104 /** Initializes a new ddf driver instance of EHCI hcd.105 *106 * @param[in] device DDF instance of the device to initialize.107 * @return Error code.108 */109 static errno_t ehci_dev_add(ddf_dev_t *device)110 {111 usb_log_debug("ehci_dev_add() called\n");112 assert(device);113 114 return hcd_ddf_add_hc(device, &ehci_hc_driver);115 116 }117 118 119 static const driver_ops_t ehci_driver_ops = {120 .dev_add = ehci_dev_add,121 };122 123 static const driver_t ehci_driver = {124 .name = NAME,125 .driver_ops = &ehci_driver_ops126 };127 128 57 129 58 /** Initializes global driver structures (NONE). … … 139 68 log_init(NAME); 140 69 logctl_set_log_level(NAME, LVL_NOTE); 141 return ddf_driver_main(&ehci_driver);70 return hc_driver_main(&ehci_driver); 142 71 } 143 72
Note:
See TracChangeset
for help on using the changeset viewer.