Changeset e4d7363 in mainline for uspace/drv/bus/usb/xhci/main.c
- Timestamp:
- 2017-06-22T21:34:39Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91ca111
- Parents:
- cb89430
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/main.c
rcb89430 re4d7363 45 45 #define NAME "xhci" 46 46 47 static int hc_driver_init(hcd_t *, const hw_res_list_parsed_t *); 48 static int hcd_irq_code_gen(irq_code_t *, hcd_t *, const hw_res_list_parsed_t *); 49 static int hcd_claim(hcd_t *, ddf_dev_t *); 50 static int hcd_start(hcd_t *, bool); 51 static int hcd_status(hcd_t *, uint32_t *); 52 static void hcd_interrupt(hcd_t *, uint32_t); 53 static int hcd_schedule(hcd_t *, usb_transfer_batch_t *); 54 static void hc_driver_fini(hcd_t *); 55 56 static const ddf_hc_driver_t xhci_ddf_hc_driver = { 57 .hc_speed = USB_SPEED_SUPER, 58 .name = "XHCI-PCI", 59 .init = hc_driver_init, 60 .irq_code_gen = hcd_irq_code_gen, 61 .claim = hcd_claim, 62 .start = hcd_start, 63 .fini = hc_driver_fini, 64 .ops = { 65 .schedule = hcd_schedule, 66 .irq_hook = hcd_interrupt, 67 .status_hook = hcd_status, 68 } 69 }; 70 71 static int hc_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *hw_res) 72 { 73 int err; 74 75 xhci_hc_t *hc = malloc(sizeof(xhci_hc_t)); 76 if (!hc) 77 return ENOMEM; 78 79 if ((err = hc_init_mmio(hc, hw_res))) 80 goto err; 81 82 if ((err = hc_init_memory(hc))) 83 goto err; 84 85 hcd_set_implementation(hcd, hc, &xhci_ddf_hc_driver.ops); 86 87 return EOK; 88 err: 89 free(hc); 90 return err; 91 } 92 93 static int hcd_irq_code_gen(irq_code_t *code, hcd_t *hcd, const hw_res_list_parsed_t *hw_res) 94 { 95 xhci_hc_t *hc = hcd_get_driver_data(hcd); 96 assert(hc); 97 98 return hc_irq_code_gen(code, hc, hw_res); 99 } 100 101 static int hcd_claim(hcd_t *hcd, ddf_dev_t *dev) 102 { 103 xhci_hc_t *hc = hcd_get_driver_data(hcd); 104 assert(hc); 105 106 return hc_claim(hc, dev); 107 } 108 109 static int hcd_start(hcd_t *hcd, bool irq) 110 { 111 xhci_hc_t *hc = hcd_get_driver_data(hcd); 112 assert(hc); 113 114 return hc_start(hc, irq); 115 } 116 117 static int hcd_schedule(hcd_t *hcd, usb_transfer_batch_t *batch) 118 { 119 xhci_hc_t *hc = hcd_get_driver_data(hcd); 120 assert(hc); 121 122 return hc_schedule(hc, batch); 123 } 124 125 static int hcd_status(hcd_t *hcd, uint32_t *status) 126 { 127 xhci_hc_t *hc = hcd_get_driver_data(hcd); 128 assert(hc); 129 assert(status); 130 131 return hc_status(hc, status); 132 } 133 134 static void hcd_interrupt(hcd_t *hcd, uint32_t status) 135 { 136 xhci_hc_t *hc = hcd_get_driver_data(hcd); 137 assert(hc); 138 139 hc_interrupt(hc, status); 140 } 141 142 static void hc_driver_fini(hcd_t *hcd) 143 { 144 xhci_hc_t *hc = hcd_get_driver_data(hcd); 145 assert(hc); 146 147 hc_fini(hc); 148 free(hc); 149 } 150 47 151 /** Initializes a new ddf driver instance of XHCI hcd. 48 152 *
Note:
See TracChangeset
for help on using the changeset viewer.