Changeset 501e5df in mainline for uspace/drv/ohci/iface.c
- Timestamp:
- 2011-04-09T20:56:50Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba038f4
- Parents:
- 8790650 (diff), 709e868 (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
r8790650 r501e5df 197 197 } 198 198 /*----------------------------------------------------------------------------*/ 199 static int register_endpoint( 200 ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint, 199 /** Register endpoint for bandwidth reservation. 200 * 201 * @param[in] fun Device function the action was invoked on. 202 * @param[in] address USB address of the device. 203 * @param[in] ep_speed Endpoint speed (invalid means to use device one). 204 * @param[in] endpoint Endpoint number. 205 * @param[in] transfer_type USB transfer type. 206 * @param[in] direction Endpoint data direction. 207 * @param[in] max_packet_size Max packet size of the endpoint. 208 * @param[in] interval Polling interval. 209 * @return Error code. 210 */ 211 static int register_endpoint(ddf_fun_t *fun, 212 usb_address_t address, usb_speed_t ep_speed, usb_endpoint_t endpoint, 201 213 usb_transfer_type_t transfer_type, usb_direction_t direction, 202 214 size_t max_packet_size, unsigned int interval) … … 204 216 hc_t *hc = fun_to_hc(fun); 205 217 assert(hc); 206 const usb_speed_t speed = 207 usb_device_keeper_get_speed(&hc->manager, address); 218 if (address == hc->rh.address) 219 return EOK; 220 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, address); 221 if (speed >= USB_SPEED_MAX) { 222 speed = ep_speed; 223 } 208 224 const size_t size = 209 225 (transfer_type == USB_TRANSFER_INTERRUPT … … 243 259 usb_log_debug("Unregister endpoint %d:%d %d.\n", 244 260 address, endpoint, direction); 261 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 262 address, endpoint, direction, NULL); 263 if (ep != NULL) { 264 usb_device_keeper_del_ep(&hc->manager, address, ep); 265 } 245 266 return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address, 246 267 endpoint, direction); 247 268 } 248 269 /*----------------------------------------------------------------------------*/ 249 /** Interrupt out transaction interface function 250 * 251 * @param[in] fun DDF function that was called. 252 * @param[in] target USB device to write to. 253 * @param[in] max_packet_size maximum size of data packet the device accepts 254 * @param[in] data Source of data. 255 * @param[in] size Size of data source. 256 * @param[in] callback Function to call on transaction completion 257 * @param[in] arg Additional for callback function. 270 /** Schedule interrupt out transfer. 271 * 272 * The callback is supposed to be called once the transfer (on the wire) is 273 * complete regardless of the outcome. 274 * However, the callback could be called only when this function returns 275 * with success status (i.e. returns EOK). 276 * 277 * @param[in] fun Device function the action was invoked on. 278 * @param[in] target Target pipe (address and endpoint number) specification. 279 * @param[in] data Data to be sent (in USB endianess, allocated and deallocated 280 * by the caller). 281 * @param[in] size Size of the @p data buffer in bytes. 282 * @param[in] callback Callback to be issued once the transfer is complete. 283 * @param[in] arg Pass-through argument to the callback. 258 284 * @return Error code. 259 285 */ 260 286 static int interrupt_out( 261 ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,void *data,287 ddf_fun_t *fun, usb_target_t target, void *data, 262 288 size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) 263 289 { … … 276 302 } 277 303 /*----------------------------------------------------------------------------*/ 278 /** Interrupt in transaction interface function 279 * 280 * @param[in] fun DDF function that was called. 281 * @param[in] target USB device to write to. 282 * @param[in] max_packet_size maximum size of data packet the device accepts 283 * @param[out] data Data destination. 284 * @param[in] size Size of data source. 285 * @param[in] callback Function to call on transaction completion 286 * @param[in] arg Additional for callback function. 304 /** Schedule interrupt in transfer. 305 * 306 * The callback is supposed to be called once the transfer (on the wire) is 307 * complete regardless of the outcome. 308 * However, the callback could be called only when this function returns 309 * with success status (i.e. returns EOK). 310 * 311 * @param[in] fun Device function the action was invoked on. 312 * @param[in] target Target pipe (address and endpoint number) specification. 313 * @param[in] data Buffer where to store the data (in USB endianess, 314 * allocated and deallocated by the caller). 315 * @param[in] size Size of the @p data buffer in bytes. 316 * @param[in] callback Callback to be issued once the transfer is complete. 317 * @param[in] arg Pass-through argument to the callback. 287 318 * @return Error code. 288 319 */ 289 320 static int interrupt_in( 290 ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,void *data,321 ddf_fun_t *fun, usb_target_t target, void *data, 291 322 size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) 292 323 { … … 305 336 } 306 337 /*----------------------------------------------------------------------------*/ 307 /** Bulk out transaction interface function 308 * 309 * @param[in] fun DDF function that was called. 310 * @param[in] target USB device to write to. 311 * @param[in] max_packet_size maximum size of data packet the device accepts 312 * @param[in] data Source of data. 313 * @param[in] size Size of data source. 314 * @param[in] callback Function to call on transaction completion 315 * @param[in] arg Additional for callback function. 338 /** Schedule bulk out transfer. 339 * 340 * The callback is supposed to be called once the transfer (on the wire) is 341 * complete regardless of the outcome. 342 * However, the callback could be called only when this function returns 343 * with success status (i.e. returns EOK). 344 * 345 * @param[in] fun Device function the action was invoked on. 346 * @param[in] target Target pipe (address and endpoint number) specification. 347 * @param[in] data Data to be sent (in USB endianess, allocated and deallocated 348 * by the caller). 349 * @param[in] size Size of the @p data buffer in bytes. 350 * @param[in] callback Callback to be issued once the transfer is complete. 351 * @param[in] arg Pass-through argument to the callback. 316 352 * @return Error code. 317 353 */ 318 354 static int bulk_out( 319 ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,void *data,355 ddf_fun_t *fun, usb_target_t target, void *data, 320 356 size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) 321 357 { … … 334 370 } 335 371 /*----------------------------------------------------------------------------*/ 336 /** Bulk in transaction interface function 337 * 338 * @param[in] fun DDF function that was called. 339 * @param[in] target USB device to write to. 340 * @param[in] max_packet_size maximum size of data packet the device accepts 341 * @param[out] data Data destination. 342 * @param[in] size Size of data source. 343 * @param[in] callback Function to call on transaction completion 344 * @param[in] arg Additional for callback function. 372 /** Schedule bulk in transfer. 373 * 374 * The callback is supposed to be called once the transfer (on the wire) is 375 * complete regardless of the outcome. 376 * However, the callback could be called only when this function returns 377 * with success status (i.e. returns EOK). 378 * 379 * @param[in] fun Device function the action was invoked on. 380 * @param[in] target Target pipe (address and endpoint number) specification. 381 * @param[in] data Buffer where to store the data (in USB endianess, 382 * allocated and deallocated by the caller). 383 * @param[in] size Size of the @p data buffer in bytes. 384 * @param[in] callback Callback to be issued once the transfer is complete. 385 * @param[in] arg Pass-through argument to the callback. 345 386 * @return Error code. 346 387 */ 347 388 static int bulk_in( 348 ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,void *data,389 ddf_fun_t *fun, usb_target_t target, void *data, 349 390 size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) 350 391 { … … 363 404 } 364 405 /*----------------------------------------------------------------------------*/ 365 /** Control write transaction interface function 366 * 367 * @param[in] fun DDF function that was called. 368 * @param[in] target USB device to write to. 369 * @param[in] max_packet_size maximum size of data packet the device accepts. 370 * @param[in] setup_data Data to send with SETUP transfer. 371 * @param[in] setup_size Size of data to send with SETUP transfer (always 8B). 372 * @param[in] data Source of data. 373 * @param[in] size Size of data source. 374 * @param[in] callback Function to call on transaction completion. 375 * @param[in] arg Additional for callback function. 406 /** Schedule control write transfer. 407 * 408 * The callback is supposed to be called once the transfer (on the wire) is 409 * complete regardless of the outcome. 410 * However, the callback could be called only when this function returns 411 * with success status (i.e. returns EOK). 412 * 413 * @param[in] fun Device function the action was invoked on. 414 * @param[in] target Target pipe (address and endpoint number) specification. 415 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated 416 * and deallocated by the caller). 417 * @param[in] setup_packet_size Size of @p setup_packet buffer in bytes. 418 * @param[in] data_buffer Data buffer (in USB endianess, allocated and 419 * deallocated by the caller). 420 * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes. 421 * @param[in] callback Callback to be issued once the transfer is complete. 422 * @param[in] arg Pass-through argument to the callback. 376 423 * @return Error code. 377 424 */ 378 425 static int control_write( 379 ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,426 ddf_fun_t *fun, usb_target_t target, 380 427 void *setup_data, size_t setup_size, void *data, size_t size, 381 428 usbhc_iface_transfer_out_callback_t callback, void *arg) … … 397 444 } 398 445 /*----------------------------------------------------------------------------*/ 399 /** Control read transaction interface function 400 * 401 * @param[in] fun DDF function that was called. 402 * @param[in] target USB device to write to. 403 * @param[in] max_packet_size maximum size of data packet the device accepts. 404 * @param[in] setup_data Data to send with SETUP packet. 405 * @param[in] setup_size Size of data to send with SETUP packet (should be 8B). 406 * @param[out] data Source of data. 407 * @param[in] size Size of data source. 408 * @param[in] callback Function to call on transaction completion. 409 * @param[in] arg Additional for callback function. 446 /** Schedule control read transfer. 447 * 448 * The callback is supposed to be called once the transfer (on the wire) is 449 * complete regardless of the outcome. 450 * However, the callback could be called only when this function returns 451 * with success status (i.e. returns EOK). 452 * 453 * @param[in] fun Device function the action was invoked on. 454 * @param[in] target Target pipe (address and endpoint number) specification. 455 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated 456 * and deallocated by the caller). 457 * @param[in] setup_packet_size Size of @p setup_packet buffer in bytes. 458 * @param[in] data_buffer Buffer where to store the data (in USB endianess, 459 * allocated and deallocated by the caller). 460 * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes. 461 * @param[in] callback Callback to be issued once the transfer is complete. 462 * @param[in] arg Pass-through argument to the callback. 410 463 * @return Error code. 411 464 */ 412 465 static int control_read( 413 ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,466 ddf_fun_t *fun, usb_target_t target, 414 467 void *setup_data, size_t setup_size, void *data, size_t size, 415 468 usbhc_iface_transfer_in_callback_t callback, void *arg)
Note:
See TracChangeset
for help on using the changeset viewer.