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