Changes in uspace/drv/bus/usb/ehci/main.c [4287578:58563585] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/main.c
r4287578 r58563585 35 35 */ 36 36 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> 37 42 #include <io/logctl.h> 38 #include <usb/host/hcd.h> 43 44 #include <usb_iface.h> 45 #include <usb/debug.h> 46 #include <usb/host/ddf_helpers.h> 39 47 40 48 #include "res.h" 41 49 #include "hc.h" 50 #include "ehci_endpoint.h" 42 51 43 52 #define NAME "ehci" 44 53 45 static const hc_driver_t ehci_driver = { 54 static int ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 55 static void ehci_driver_fini(hcd_t *); 56 57 static const ddf_hc_driver_t ehci_hc_driver = { 58 .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 } 71 }; 72 73 74 static int 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 int 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 int 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 = { 46 124 .name = NAME, 47 .hc_device_size = sizeof(hc_t), 125 .driver_ops = &ehci_driver_ops 126 }; 48 127 49 .hc_add = hc_add,50 .irq_code_gen = hc_gen_irq_code,51 .claim = disable_legacy,52 .start = hc_start,53 .setup_root_hub = hc_setup_roothub,54 .hc_gone = hc_gone,55 };56 128 57 129 /** Initializes global driver structures (NONE). … … 67 139 log_init(NAME); 68 140 logctl_set_log_level(NAME, LVL_NOTE); 69 return hc_driver_main(&ehci_driver);141 return ddf_driver_main(&ehci_driver); 70 142 } 71 143
Note:
See TracChangeset
for help on using the changeset viewer.