Changeset b5f813c in mainline for uspace/drv/bus/usb/ehci/main.c
- Timestamp:
- 2015-07-04T03:28:02Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 55346870
- Parents:
- 2dbfe44
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/main.c
r2dbfe44 rb5f813c 50 50 #define NAME "ehci" 51 51 52 static int ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 53 static void ehci_driver_fini(hcd_t *); 54 55 static const ddf_hc_driver_t ehci_hc_driver = { 56 .claim = disable_legacy, 57 .hc_speed = USB_SPEED_HIGH, 58 .irq_code_gen = ehci_hc_gen_irq_code, 59 .init = ehci_driver_init, 60 .fini = ehci_driver_fini, 61 .name = "EHCI-PCI", 62 .ops = { 63 .schedule = ehci_hc_schedule, 64 .ep_add_hook = ehci_endpoint_init, 65 .ep_remove_hook = ehci_endpoint_fini, 66 .irq_hook = ehci_hc_interrupt, 67 .status_hook = ehci_hc_status, 68 } 69 }; 70 71 52 72 static int ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 53 73 { 54 74 assert(hcd); 55 assert(hcd ->driver.data== NULL);75 assert(hcd_get_driver_data(hcd) == NULL); 56 76 57 77 hc_t *instance = malloc(sizeof(hc_t)); … … 61 81 const int ret = hc_init(instance, res, irq); 62 82 if (ret == EOK) 63 hcd_set_implementation(hcd, instance, ehci_hc_schedule, 64 ehci_endpoint_init, ehci_endpoint_fini, ehci_hc_interrupt, 65 ehci_hc_status); 83 hcd_set_implementation(hcd, instance, &ehci_hc_driver.ops); 66 84 return ret; 67 85 } … … 70 88 { 71 89 assert(hcd); 72 if (hcd->driver.data) 73 hc_fini(hcd->driver.data); 90 hc_t *hc = hcd_get_driver_data(hcd); 91 if (hc) 92 hc_fini(hc); 74 93 75 free(hc d->driver.data);76 hcd_set_implementation(hcd, NULL, NULL , NULL, NULL, NULL, NULL);94 free(hc); 95 hcd_set_implementation(hcd, NULL, NULL); 77 96 } 78 79 static int ehci_dev_add(ddf_dev_t *device);80 81 static const driver_ops_t ehci_driver_ops = {82 .dev_add = ehci_dev_add,83 };84 85 static const driver_t ehci_driver = {86 .name = NAME,87 .driver_ops = &ehci_driver_ops88 };89 90 91 static const ddf_hc_driver_t ehci_hc_driver = {92 .claim = disable_legacy,93 .hc_speed = USB_SPEED_HIGH,94 .irq_code_gen = ehci_hc_gen_irq_code,95 .init = ehci_driver_init,96 .fini = ehci_driver_fini,97 .name = "EHCI-PCI"98 };99 97 100 98 /** Initializes a new ddf driver instance of EHCI hcd. … … 111 109 112 110 } 111 112 113 static const driver_ops_t ehci_driver_ops = { 114 .dev_add = ehci_dev_add, 115 }; 116 117 static const driver_t ehci_driver = { 118 .name = NAME, 119 .driver_ops = &ehci_driver_ops 120 }; 121 113 122 114 123 /** Initializes global driver structures (NONE).
Note:
See TracChangeset
for help on using the changeset viewer.