Changeset d8b275d in mainline for uspace/drv/ohci/iface.c
- Timestamp:
- 2011-04-14T08:24:29Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5e07e2b5
- Parents:
- 3f2af64 (diff), 34e8bab (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/iface.c
r3f2af64 rd8b275d 55 55 56 56 size_t res_bw; 57 endpoint_t *ep = usb_endpoint_manager_get_ep(&(*hc)->ep_manager,57 endpoint_t *ep = hc_get_endpoint(*hc, 58 58 target.address, target.endpoint, direction, &res_bw); 59 59 if (ep == NULL) { … … 63 63 } 64 64 65 usb_log_debug("%s %d:%d %zu(%zu).\n", 66 name, target.address, target.endpoint, size, ep->max_packet_size); 67 65 68 const size_t bw = bandwidth_count_usb11( 66 69 ep->speed, ep->transfer_type, size, ep->max_packet_size); … … 68 71 usb_log_error("Endpoint(%d:%d) %s needs %zu bw " 69 72 "but only %zu is reserved.\n", 70 name, target.address, target.endpoint, bw, res_bw);73 target.address, target.endpoint, name, bw, res_bw); 71 74 return ENOSPC; 72 75 } 73 usb_log_debug("%s %d:%d %zu(%zu).\n",74 name, target.address, target.endpoint, size, ep->max_packet_size);75 76 76 77 *batch = batch_get( … … 157 158 hc_t *hc = fun_to_hc(fun); 158 159 assert(hc); 159 if (address == hc->rh.address) 160 return EOK; 160 161 161 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, address); 162 162 if (speed >= USB_SPEED_MAX) { 163 163 speed = ep_speed; 164 164 } 165 const size_t size = 166 (transfer_type == USB_TRANSFER_INTERRUPT 167 || transfer_type == USB_TRANSFER_ISOCHRONOUS) ? 168 max_packet_size : 0; 169 int ret; 170 171 endpoint_t *ep = malloc(sizeof(endpoint_t)); 172 if (ep == NULL) 173 return ENOMEM; 174 ret = endpoint_init(ep, address, endpoint, direction, 175 transfer_type, speed, max_packet_size); 176 if (ret != EOK) { 177 free(ep); 178 return ret; 179 } 165 const size_t size = max_packet_size; 180 166 181 167 usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n", … … 183 169 usb_str_speed(speed), direction, size, max_packet_size, interval); 184 170 185 ret = usb_endpoint_manager_register_ep(&hc->ep_manager, ep, size); 186 if (ret != EOK) { 187 endpoint_destroy(ep); 188 } 189 return ret; 171 return hc_add_endpoint(hc, address, endpoint, speed, transfer_type, 172 direction, max_packet_size, size, interval); 190 173 } 191 174 /*----------------------------------------------------------------------------*/ … … 198 181 usb_log_debug("Unregister endpoint %d:%d %d.\n", 199 182 address, endpoint, direction); 200 return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address, 201 endpoint, direction); 183 return hc_remove_endpoint(hc, address, endpoint, direction); 202 184 } 203 185 /*----------------------------------------------------------------------------*/ … … 231 213 ret = hc_schedule(hc, batch); 232 214 if (ret != EOK) { 233 batch_dispose(batch);215 usb_transfer_batch_dispose(batch); 234 216 } 235 217 return ret; … … 265 247 ret = hc_schedule(hc, batch); 266 248 if (ret != EOK) { 267 batch_dispose(batch);249 usb_transfer_batch_dispose(batch); 268 250 } 269 251 return ret; … … 299 281 ret = hc_schedule(hc, batch); 300 282 if (ret != EOK) { 301 batch_dispose(batch);283 usb_transfer_batch_dispose(batch); 302 284 } 303 285 return ret; … … 333 315 ret = hc_schedule(hc, batch); 334 316 if (ret != EOK) { 335 batch_dispose(batch);317 usb_transfer_batch_dispose(batch); 336 318 } 337 319 return ret; … … 349 331 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated 350 332 * and deallocated by the caller). 351 * @param[in] setup_ packet_size Size of @p setup_packet buffer in bytes.333 * @param[in] setup_size Size of @p setup_packet buffer in bytes. 352 334 * @param[in] data_buffer Data buffer (in USB endianess, allocated and 353 335 * deallocated by the caller). 354 * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes.336 * @param[in] size Size of @p data_buffer buffer in bytes. 355 337 * @param[in] callback Callback to be issued once the transfer is complete. 356 338 * @param[in] arg Pass-through argument to the callback. … … 373 355 ret = hc_schedule(hc, batch); 374 356 if (ret != EOK) { 375 batch_dispose(batch);357 usb_transfer_batch_dispose(batch); 376 358 } 377 359 return ret; … … 389 371 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated 390 372 * and deallocated by the caller). 391 * @param[in] setup_ packet_size Size of @p setup_packet buffer in bytes.373 * @param[in] setup_size Size of @p setup_packet buffer in bytes. 392 374 * @param[in] data_buffer Buffer where to store the data (in USB endianess, 393 375 * allocated and deallocated by the caller). 394 * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes.376 * @param[in] size Size of @p data_buffer buffer in bytes. 395 377 * @param[in] callback Callback to be issued once the transfer is complete. 396 378 * @param[in] arg Pass-through argument to the callback. … … 412 394 ret = hc_schedule(hc, batch); 413 395 if (ret != EOK) { 414 batch_dispose(batch);396 usb_transfer_batch_dispose(batch); 415 397 } 416 398 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.