Changeset 72cf064 in mainline for uspace/drv/bus/usb/ohci/ohci_batch.c
- Timestamp:
- 2012-08-13T17:17:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 33fee91
- Parents:
- f4a8734 (diff), 4820360 (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/bus/usb/ohci/ohci_batch.c
rf4a8734 r72cf064 44 44 45 45 static void (*const batch_setup[])(ohci_transfer_batch_t*, usb_direction_t); 46 /*----------------------------------------------------------------------------*/ 46 47 47 /** Safely destructs ohci_transfer_batch_t structure 48 48 * … … 67 67 free(ohci_batch); 68 68 } 69 /*----------------------------------------------------------------------------*/ 69 70 70 /** Finishes usb_transfer_batch and destroys the structure. 71 71 * … … 80 80 ohci_transfer_batch_dispose(ohci_batch); 81 81 } 82 /*----------------------------------------------------------------------------*/ 82 83 83 /** Allocate memory and initialize internal data structure. 84 84 * … … 158 158 #undef CHECK_NULL_DISPOSE_RET 159 159 } 160 /*----------------------------------------------------------------------------*/ 160 161 161 /** Check batch TDs' status. 162 162 * … … 199 199 ohci_batch->tds[i]->next, ohci_batch->tds[i]->be); 200 200 201 /* If the TD got all its data through, it will report 0 bytes202 * remain, the sole exception is INPUT with data rounding flag203 * (short), i.e. every INPUT. Nice thing is that short packets204 * will correctly report remaining data, thus making205 * this computation correct (short packets need to be produced206 * by the last TD)207 * NOTE: This also works for CONTROL transfer as208 * the first TD will return 0 remain.209 * NOTE: Short packets don't break the assumption that210 * we leave the very last(unused) TD behind.211 */212 ohci_batch->usb_batch->transfered_size213 -= td_remain_size(ohci_batch->tds[i]);214 215 201 ohci_batch->usb_batch->error = td_error(ohci_batch->tds[i]); 216 if (ohci_batch->usb_batch->error != EOK) { 202 if (ohci_batch->usb_batch->error == EOK) { 203 /* If the TD got all its data through, it will report 204 * 0 bytes remain, the sole exception is INPUT with 205 * data rounding flag (short), i.e. every INPUT. 206 * Nice thing is that short packets will correctly 207 * report remaining data, thus making this computation 208 * correct (short packets need to be produced by the 209 * last TD) 210 * NOTE: This also works for CONTROL transfer as 211 * the first TD will return 0 remain. 212 * NOTE: Short packets don't break the assumption that 213 * we leave the very last(unused) TD behind. 214 */ 215 ohci_batch->usb_batch->transfered_size 216 -= td_remain_size(ohci_batch->tds[i]); 217 } else { 217 218 usb_log_debug("Batch %p found error TD(%zu):%08x.\n", 218 219 ohci_batch->usb_batch, i, … … 231 232 232 233 /* Check TD assumption */ 233 const uint32_t pa = 234 addr_to_phys(ohci_batch->tds[leave_td]); 235 assert((ohci_batch->ed->td_head & ED_TDHEAD_PTR_MASK) 236 == pa); 237 234 assert(ed_head_td(ohci_batch->ed) == 235 addr_to_phys(ohci_batch->tds[leave_td])); 236 237 /* Set tail to the same TD */ 238 238 ed_set_tail_td(ohci_batch->ed, 239 239 ohci_batch->tds[leave_td]); 240 240 241 241 /* Clear possible ED HALT */ 242 ohci_batch->ed->td_head &= ~ED_TDHEAD_HALTED_FLAG;242 ed_clear_halt(ohci_batch->ed); 243 243 break; 244 244 } … … 253 253 254 254 /* Make sure that we are leaving the right TD behind */ 255 const uint32_t pa = addr_to_phys(ohci_ep->td); 256 assert(pa == (ohci_batch->ed->td_head & ED_TDHEAD_PTR_MASK)); 257 assert(pa == (ohci_batch->ed->td_tail & ED_TDTAIL_PTR_MASK)); 255 assert(addr_to_phys(ohci_ep->td) == ed_head_td(ohci_batch->ed)); 256 assert(addr_to_phys(ohci_ep->td) == ed_tail_td(ohci_batch->ed)); 258 257 259 258 return true; 260 259 } 261 /*----------------------------------------------------------------------------*/ 260 262 261 /** Starts execution of the TD list 263 262 * … … 269 268 ed_set_tail_td(ohci_batch->ed, ohci_batch->tds[ohci_batch->td_count]); 270 269 } 271 /*----------------------------------------------------------------------------*/ 270 272 271 /** Prepare generic control transfer 273 272 * … … 345 344 USB_TRANSFER_BATCH_ARGS(*ohci_batch->usb_batch)); 346 345 } 347 /*----------------------------------------------------------------------------*/ 346 348 347 /** Prepare generic data transfer 349 348 * … … 392 391 USB_TRANSFER_BATCH_ARGS(*ohci_batch->usb_batch)); 393 392 } 394 /*----------------------------------------------------------------------------*/ 393 395 394 /** Transfer setup table. */ 396 395 static void (*const batch_setup[])(ohci_transfer_batch_t*, usb_direction_t) =
Note:
See TracChangeset
for help on using the changeset viewer.