Changeset 17ceb72 in mainline for uspace/drv/uhci-hcd/batch.c
- Timestamp:
- 2011-03-14T01:39:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6298d80
- Parents:
- 3bd96bb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.c
r3bd96bb r17ceb72 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup usb28 /** @addtogroup drvusbuhcihc 29 29 * @{ 30 30 */ 31 31 /** @file 32 * @brief UHCI driver 32 * @brief UHCI driver USB transaction structure 33 33 */ 34 34 #include <errno.h> … … 54 54 55 55 56 /** Allocate s memory and initializes internal data structures.56 /** Allocate memory and initialize internal data structure. 57 57 * 58 58 * @param[in] fun DDF function to pass to callback. … … 69 69 * @param[in] arg additional parameter to func_in or func_out 70 70 * @param[in] manager Pointer to toggle management structure. 71 * @return False, if there is an active TD, true otherwise. 71 * @return Valid pointer if all substructures were successfully created, 72 * NULL otherwise. 73 * 74 * Determines the number of needed packets (TDs). Prepares a transport buffer 75 * (that is accessible by the hardware). Initializes parameters needed for the 76 * transaction and callback. 72 77 */ 73 78 batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, … … 148 153 } 149 154 /*----------------------------------------------------------------------------*/ 150 /** Check sbatch TDs for activity.155 /** Check batch TDs for activity. 151 156 * 152 157 * @param[in] instance Batch structure to use. 153 158 * @return False, if there is an active TD, true otherwise. 159 * 160 * Walk all TDs. Stop with false if there is an active one (it is to be 161 * processed). Stop with true if an error is found. Return true if the last TS 162 * is reached. 154 163 */ 155 164 bool batch_is_complete(batch_t *instance) … … 190 199 * 191 200 * @param[in] instance Batch structure to use. 201 * 202 * Uses genercir control function with pids OUT and IN. 192 203 */ 193 204 void batch_control_write(batch_t *instance) 194 205 { 195 206 assert(instance); 196 /* we are data out, we are supposed to provide data */207 /* We are data out, we are supposed to provide data */ 197 208 memcpy(instance->transport_buffer, instance->buffer, 198 209 instance->buffer_size); … … 205 216 * 206 217 * @param[in] instance Batch structure to use. 218 * 219 * Uses generic control with pids IN and OUT. 207 220 */ 208 221 void batch_control_read(batch_t *instance) … … 214 227 } 215 228 /*----------------------------------------------------------------------------*/ 216 /** Prepares interrupt in transaction. 217 * 218 * @param[in] instance Batch structure to use. 229 /** Prepare interrupt in transaction. 230 * 231 * @param[in] instance Batch structure to use. 232 * 233 * Data transaction with PID_IN. 219 234 */ 220 235 void batch_interrupt_in(batch_t *instance) … … 226 241 } 227 242 /*----------------------------------------------------------------------------*/ 228 /** Prepares interrupt out transaction. 229 * 230 * @param[in] instance Batch structure to use. 243 /** Prepare interrupt out transaction. 244 * 245 * @param[in] instance Batch structure to use. 246 * 247 * Data transaction with PID_OUT. 231 248 */ 232 249 void batch_interrupt_out(batch_t *instance) 233 250 { 234 251 assert(instance); 235 /* we are data out, we are supposed to provide data */252 /* We are data out, we are supposed to provide data */ 236 253 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 237 254 batch_data(instance, USB_PID_OUT); … … 240 257 } 241 258 /*----------------------------------------------------------------------------*/ 242 /** Prepares bulk in transaction. 243 * 244 * @param[in] instance Batch structure to use. 259 /** Prepare bulk in transaction. 260 * 261 * @param[in] instance Batch structure to use. 262 * 263 * Data transaction with PID_IN. 245 264 */ 246 265 void batch_bulk_in(batch_t *instance) … … 252 271 } 253 272 /*----------------------------------------------------------------------------*/ 254 /** Prepares bulk out transaction. 255 * 256 * @param[in] instance Batch structure to use. 273 /** Prepare bulk out transaction. 274 * 275 * @param[in] instance Batch structure to use. 276 * 277 * Data transaction with PID_OUT. 257 278 */ 258 279 void batch_bulk_out(batch_t *instance) 259 280 { 260 281 assert(instance); 282 /* We are data out, we are supposed to provide data */ 261 283 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 262 284 batch_data(instance, USB_PID_OUT); … … 265 287 } 266 288 /*----------------------------------------------------------------------------*/ 267 /** Prepare sgeneric data transaction289 /** Prepare generic data transaction 268 290 * 269 291 * @param[in] instance Batch structure to use. 270 292 * @param[in] pid to use for data packets. 293 * 294 * Packets with alternating toggle bit and supplied pid value. 295 * The last packet is marked with IOC flag. 271 296 */ 272 297 void batch_data(batch_t *instance, usb_packet_id pid) … … 309 334 } 310 335 /*----------------------------------------------------------------------------*/ 311 /** Prepare sgeneric control transaction336 /** Prepare generic control transaction 312 337 * 313 338 * @param[in] instance Batch structure to use. 314 339 * @param[in] data_stage to use for data packets. 315 340 * @param[in] status_stage to use for data packets. 341 * 342 * Setup stage with toggle 0 and USB_PID_SETUP. 343 * Data stage with alternating toggle and pid supplied by parameter. 344 * Status stage with toggle 1 and pid supplied by parameter. 345 * The last packet is marked with IOC. 316 346 */ 317 347 void batch_control(batch_t *instance, … … 362 392 } 363 393 /*----------------------------------------------------------------------------*/ 364 /** Prepares data, gets error status and calls callback in. 365 * 366 * @param[in] instance Batch structure to use. 394 /** Prepare data, get error status and call callback in. 395 * 396 * @param[in] instance Batch structure to use. 397 * Copies data from transport buffer, and calls callback with appropriate 398 * parameters. 367 399 */ 368 400 void batch_call_in(batch_t *instance) … … 371 403 assert(instance->callback_in); 372 404 373 /* we are data in, we need data */405 /* We are data in, we need data */ 374 406 memcpy(instance->buffer, instance->transport_buffer, 375 407 instance->buffer_size); … … 384 416 } 385 417 /*----------------------------------------------------------------------------*/ 386 /** Get s error status and callscallback out.418 /** Get error status and call callback out. 387 419 * 388 420 * @param[in] instance Batch structure to use. … … 400 432 } 401 433 /*----------------------------------------------------------------------------*/ 402 /** Prepares data, gets error status, calls callback in and dispose.434 /** Helper function calls callback and correctly disposes of batch structure. 403 435 * 404 436 * @param[in] instance Batch structure to use. … … 411 443 } 412 444 /*----------------------------------------------------------------------------*/ 413 /** Gets error status, calls callback out and dispose.445 /** Helper function calls callback and correctly disposes of batch structure. 414 446 * 415 447 * @param[in] instance Batch structure to use. … … 422 454 } 423 455 /*----------------------------------------------------------------------------*/ 424 /** Correctly dispose sall used data structures.456 /** Correctly dispose all used data structures. 425 457 * 426 458 * @param[in] instance Batch structure to use.
Note:
See TracChangeset
for help on using the changeset viewer.