Changeset 11cb0565 in mainline
- Timestamp:
- 2011-12-06T14:03:34Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 890a3454
- Parents:
- 5ca08d4
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_batch.c
r5ca08d4 r11cb0565 54 54 return; 55 55 if (ohci_batch->tds) { 56 const ohci_endpoint_t *ohci_ep = 57 ohci_endpoint_get(ohci_batch->usb_batch->ep); 58 assert(ohci_ep); 56 59 for (unsigned i = 0; i < ohci_batch->td_count; ++i) { 57 if ( i != ohci_batch->leave_td)60 if (ohci_batch->tds[i] != ohci_ep->td) 58 61 free32(ohci_batch->tds[i]); 59 62 } … … 119 122 ohci_batch->ed = ohci_endpoint_get(usb_batch->ep)->ed; 120 123 ohci_batch->tds[0] = ohci_endpoint_get(usb_batch->ep)->td; 121 ohci_batch->leave_td = 0;122 124 123 125 for (unsigned i = 1; i <= ohci_batch->td_count; ++i) { … … 166 168 * completes with the last TD. 167 169 */ 168 bool ohci_transfer_batch_is_complete( ohci_transfer_batch_t *ohci_batch)170 bool ohci_transfer_batch_is_complete(const ohci_transfer_batch_t *ohci_batch) 169 171 { 170 172 assert(ohci_batch); … … 188 190 189 191 /* Assume we will leave the last(unused) TD behind */ 190 ohci_batch->leave_td = ohci_batch->td_count;192 unsigned leave_td = ohci_batch->td_count; 191 193 192 194 /* Check all TDs */ … … 226 228 * It will be the one TD we leave behind. 227 229 */ 228 ohci_batch->leave_td = i + 1;230 leave_td = i + 1; 229 231 230 232 /* Check TD assumption */ 231 const uint32_t pa = addr_to_phys(232 ohci_batch->tds[ohci_batch->leave_td]);233 assert((ohci_batch->ed->td_head & ED_TD TAIL_PTR_MASK)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) 234 236 == pa); 235 237 236 238 ed_set_tail_td(ohci_batch->ed, 237 ohci_batch->tds[ ohci_batch->leave_td]);239 ohci_batch->tds[leave_td]); 238 240 239 241 /* Clear possible ED HALT */ … … 248 250 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ohci_batch->usb_batch->ep); 249 251 assert(ohci_ep); 250 ohci_ep->td = ohci_batch->tds[ ohci_batch->leave_td];252 ohci_ep->td = ohci_batch->tds[leave_td]; 251 253 252 254 /* Make sure that we are leaving the right TD behind */ … … 262 264 * @param[in] ohci_batch Batch structure to use 263 265 */ 264 void ohci_transfer_batch_commit( ohci_transfer_batch_t *ohci_batch)266 void ohci_transfer_batch_commit(const ohci_transfer_batch_t *ohci_batch) 265 267 { 266 268 assert(ohci_batch); -
uspace/drv/bus/usb/ohci/ohci_batch.h
r5ca08d4 r11cb0565 53 53 /** Number of TDs used by the transfer */ 54 54 size_t td_count; 55 /** Dummy TD to be left at the ED and used by the next transfer */56 size_t leave_td;57 55 /** Data buffer, must be accessible by the OHCI hw. */ 58 56 char *device_buffer; … … 62 60 63 61 ohci_transfer_batch_t * ohci_transfer_batch_get(usb_transfer_batch_t *batch); 64 bool ohci_transfer_batch_is_complete( ohci_transfer_batch_t *batch);65 void ohci_transfer_batch_commit( ohci_transfer_batch_t *batch);62 bool ohci_transfer_batch_is_complete(const ohci_transfer_batch_t *batch); 63 void ohci_transfer_batch_commit(const ohci_transfer_batch_t *batch); 66 64 void ohci_transfer_batch_finish_dispose(ohci_transfer_batch_t *batch); 67 65 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.