Changeset a7e2f0d in mainline for uspace/drv/uhci-hcd/batch.c
- Timestamp:
- 2011-03-07T18:57:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 18e9eeb
- Parents:
- 0d3167e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.c
r0d3167e ra7e2f0d 57 57 58 58 59 /** Allocates memory and initializes internal data structures. 60 * 61 * @param[in] fun DDF function to pass to callback. 62 * @param[in] target Device and endpoint target of the transaction. 63 * @param[in] transfer_type Interrupt, Control or Bulk. 64 * @param[in] max_packet_size maximum allowed size of data packets. 65 * @param[in] speed Speed of the transaction. 66 * @param[in] buffer Data source/destination. 67 * @param[in] size Size of the buffer. 68 * @param[in] setup_buffer Setup data source (if not NULL) 69 * @param[in] setup_size Size of setup_buffer (should be always 8) 70 * @param[in] func_in function to call on inbound transaction completion 71 * @param[in] func_out function to call on outbound transaction completion 72 * @param[in] arg additional parameter to func_in or func_out 73 * @param[in] manager Pointer to toggle management structure. 74 * @return False, if there is an active TD, true otherwise. 75 */ 59 76 batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, 60 77 usb_transfer_type_t transfer_type, size_t max_packet_size, … … 139 156 } 140 157 /*----------------------------------------------------------------------------*/ 158 /** Checks batch TDs for activity. 159 * 160 * @param[in] instance Batch structure to use. 161 * @return False, if there is an active TD, true otherwise. 162 */ 141 163 bool batch_is_complete(batch_t *instance) 142 164 { … … 172 194 } 173 195 /*----------------------------------------------------------------------------*/ 196 /** Prepares control write transaction. 197 * 198 * @param[in] instance Batch structure to use. 199 */ 174 200 void batch_control_write(batch_t *instance) 175 201 { 176 202 assert(instance); 177 203 /* we are data out, we are supposed to provide data */ 178 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 204 memcpy(instance->transport_buffer, instance->buffer, 205 instance->buffer_size); 179 206 batch_control(instance, USB_PID_OUT, USB_PID_IN); 180 207 instance->next_step = batch_call_out_and_dispose; … … 183 210 } 184 211 /*----------------------------------------------------------------------------*/ 212 /** Prepares control read transaction. 213 * 214 * @param[in] instance Batch structure to use. 215 */ 185 216 void batch_control_read(batch_t *instance) 186 217 { … … 192 223 } 193 224 /*----------------------------------------------------------------------------*/ 225 /** Prepares interrupt in transaction. 226 * 227 * @param[in] instance Batch structure to use. 228 */ 194 229 void batch_interrupt_in(batch_t *instance) 195 230 { … … 201 236 } 202 237 /*----------------------------------------------------------------------------*/ 238 /** Prepares interrupt out transaction. 239 * 240 * @param[in] instance Batch structure to use. 241 */ 203 242 void batch_interrupt_out(batch_t *instance) 204 243 { … … 212 251 } 213 252 /*----------------------------------------------------------------------------*/ 253 /** Prepares bulk in transaction. 254 * 255 * @param[in] instance Batch structure to use. 256 */ 214 257 void batch_bulk_in(batch_t *instance) 215 258 { … … 221 264 } 222 265 /*----------------------------------------------------------------------------*/ 266 /** Prepares bulk out transaction. 267 * 268 * @param[in] instance Batch structure to use. 269 */ 223 270 void batch_bulk_out(batch_t *instance) 224 271 { … … 231 278 } 232 279 /*----------------------------------------------------------------------------*/ 280 /** Prepares generic data transaction 281 * 282 * @param[in] instance Batch structure to use. 283 * @param[in] pid to use for data packets. 284 */ 233 285 void batch_data(batch_t *instance, usb_packet_id pid) 234 286 { … … 269 321 } 270 322 /*----------------------------------------------------------------------------*/ 323 /** Prepares generic control transaction 324 * 325 * @param[in] instance Batch structure to use. 326 * @param[in] data_stage to use for data packets. 327 * @param[in] status_stage to use for data packets. 328 */ 271 329 void batch_control(batch_t *instance, 272 330 usb_packet_id data_stage, usb_packet_id status_stage) … … 317 375 } 318 376 /*----------------------------------------------------------------------------*/ 377 /** Prepares data, gets error status and calls callback in. 378 * 379 * @param[in] instance Batch structure to use. 380 */ 319 381 void batch_call_in(batch_t *instance) 320 382 { … … 323 385 324 386 /* we are data in, we need data */ 325 memcpy(instance->buffer, instance->transport_buffer, instance->buffer_size); 387 memcpy(instance->buffer, instance->transport_buffer, 388 instance->buffer_size); 326 389 327 390 int err = instance->error; … … 334 397 } 335 398 /*----------------------------------------------------------------------------*/ 399 /** Gets error status and calls callback out. 400 * 401 * @param[in] instance Batch structure to use. 402 */ 336 403 void batch_call_out(batch_t *instance) 337 404 { … … 346 413 } 347 414 /*----------------------------------------------------------------------------*/ 415 /** Prepares data, gets error status, calls callback in and dispose. 416 * 417 * @param[in] instance Batch structure to use. 418 */ 348 419 void batch_call_in_and_dispose(batch_t *instance) 349 420 { … … 353 424 } 354 425 /*----------------------------------------------------------------------------*/ 426 /** Gets error status, calls callback out and dispose. 427 * 428 * @param[in] instance Batch structure to use. 429 */ 355 430 void batch_call_out_and_dispose(batch_t *instance) 356 431 { … … 360 435 } 361 436 /*----------------------------------------------------------------------------*/ 437 /** Correctly disposes all used data structures. 438 * 439 * @param[in] instance Batch structure to use. 440 */ 362 441 void batch_dispose(batch_t *instance) 363 442 {
Note:
See TracChangeset
for help on using the changeset viewer.