Changeset 6832245 in mainline for uspace/drv/bus/usb/ohci/ohci_bus.c
- Timestamp:
- 2017-12-14T23:01:57Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 837d53d
- Parents:
- bd05140
- git-author:
- Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:54)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_bus.c
rbd05140 r6832245 72 72 /** Creates new hcd endpoint representation. 73 73 */ 74 static endpoint_t *ohci_endpoint_create( bus_t *bus)74 static endpoint_t *ohci_endpoint_create(device_t *dev, const usb_endpoint_desc_t *desc) 75 75 { 76 assert( bus);76 assert(dev); 77 77 78 78 ohci_endpoint_t *ohci_ep = malloc(sizeof(ohci_endpoint_t)); … … 80 80 return NULL; 81 81 82 endpoint_init(&ohci_ep->base, bus);82 endpoint_init(&ohci_ep->base, dev, desc); 83 83 84 84 ohci_ep->ed = malloc32(sizeof(ed_t)); … … 115 115 116 116 117 static int ohci_register_ep( bus_t *bus_base, device_t *dev, endpoint_t *ep, const usb_endpoint_desc_t *desc)117 static int ohci_register_ep(endpoint_t *ep) 118 118 { 119 bus_t *bus_base = endpoint_get_bus(ep); 119 120 ohci_bus_t *bus = (ohci_bus_t *) bus_base; 120 121 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep); 121 122 122 const int err = bus->parent_ops.register_endpoint(bus_base, dev, ep, desc);123 const int err = usb2_bus_ops.endpoint_register(ep); 123 124 if (err) 124 125 return err; … … 130 131 } 131 132 132 static int ohci_unregister_ep( bus_t *bus_base,endpoint_t *ep)133 static int ohci_unregister_ep(endpoint_t *ep) 133 134 { 134 ohci_bus_t *bus = (ohci_bus_t *) bus_base; 135 assert(bus); 135 ohci_bus_t *bus = (ohci_bus_t *) endpoint_get_bus(ep); 136 136 assert(ep); 137 137 138 const int err = bus->parent_ops.unregister_endpoint(bus_base,ep);138 const int err = usb2_bus_ops.endpoint_unregister(ep); 139 139 if (err) 140 140 return err; … … 144 144 } 145 145 146 static usb_transfer_batch_t *ohci_ bus_create_batch(bus_t *bus,endpoint_t *ep)146 static usb_transfer_batch_t *ohci_create_batch(endpoint_t *ep) 147 147 { 148 148 ohci_transfer_batch_t *batch = ohci_transfer_batch_create(ep); … … 150 150 } 151 151 152 static void ohci_ bus_destroy_batch(usb_transfer_batch_t *batch)152 static void ohci_destroy_batch(usb_transfer_batch_t *batch) 153 153 { 154 154 ohci_transfer_batch_destroy(ohci_transfer_batch_get(batch)); 155 155 } 156 156 157 int ohci_bus_init(ohci_bus_t *bus, hc_t *hc) 157 static const bus_ops_t ohci_bus_ops = { 158 .parent = &usb2_bus_ops, 159 160 .endpoint_destroy = ohci_endpoint_destroy, 161 .endpoint_create = ohci_endpoint_create, 162 .endpoint_register = ohci_register_ep, 163 .endpoint_unregister = ohci_unregister_ep, 164 .endpoint_count_bw = bandwidth_count_usb11, 165 .endpoint_set_toggle = ohci_ep_toggle_set, 166 .endpoint_get_toggle = ohci_ep_toggle_get, 167 .batch_create = ohci_create_batch, 168 .batch_destroy = ohci_destroy_batch, 169 }; 170 171 172 int ohci_bus_init(ohci_bus_t *bus, hcd_t *hcd, hc_t *hc) 158 173 { 159 174 assert(hc); 160 175 assert(bus); 161 176 162 usb2_bus_init(&bus->base, BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);163 177 164 bus_ops_t *ops = &bus->base.base.ops; 165 bus->parent_ops = *ops; 166 ops->create_endpoint = ohci_endpoint_create; 167 ops->destroy_endpoint = ohci_endpoint_destroy; 168 ops->endpoint_set_toggle = ohci_ep_toggle_set; 169 ops->endpoint_get_toggle = ohci_ep_toggle_get; 178 usb2_bus_t *usb2_bus = (usb2_bus_t *) bus; 179 bus_t *bus_base = (bus_t *) bus; 170 180 171 ops->register_endpoint = ohci_register_ep; 172 ops->unregister_endpoint = ohci_unregister_ep; 173 174 ops->create_batch = ohci_bus_create_batch; 175 ops->destroy_batch = ohci_bus_destroy_batch; 181 usb2_bus_init(usb2_bus, hcd, BANDWIDTH_AVAILABLE_USB11); 182 bus_base->ops = &ohci_bus_ops; 176 183 177 184 bus->hc = hc;
Note:
See TracChangeset
for help on using the changeset viewer.