Changeset f974519 in mainline for uspace/drv/bus/usb/ohci/batch.c
- Timestamp:
- 2011-08-25T16:14:58Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0815000
- Parents:
- 09ace19
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/batch.c
r09ace19 rf974519 61 61 batch_control_write(batch); 62 62 } 63 63 /*----------------------------------------------------------------------------*/ 64 64 void (*batch_setup[4][3])(usb_transfer_batch_t*) = 65 65 { … … 98 98 if (!instance) 99 99 return; 100 free32(instance->device_buffer);101 100 unsigned i = 0; 102 101 if (instance->tds) { … … 107 106 free(instance->tds); 108 107 } 108 free32(instance->device_buffer); 109 109 free(instance); 110 110 } … … 122 122 } else (void)0 123 123 124 const ohci_endpoint_t *ohci_ep = ohci_endpoint_get(batch->ep);125 assert(ohci_ep);126 127 124 ohci_transfer_batch_t *data = calloc(sizeof(ohci_transfer_batch_t), 1); 128 125 CHECK_NULL_DISPOSE_RETURN(data, "Failed to allocate batch data.\n"); … … 135 132 } 136 133 137 /* We need an extra place for TD that is assigned to ohci_ep*/134 /* We need an extra place for TD that was left at ED */ 138 135 data->tds = calloc(sizeof(td_t*), data->td_count + 1); 139 136 CHECK_NULL_DISPOSE_RETURN(data->tds, … … 141 138 142 139 /* Add TD left over by the previous transfer */ 143 data->tds[0] = ohci_ep->td; 140 data->ed = ohci_endpoint_get(batch->ep)->ed; 141 data->tds[0] = ohci_endpoint_get(batch->ep)->td; 144 142 data->leave_td = 0; 145 143 unsigned i = 1; … … 150 148 } 151 149 152 data->ed = ohci_ep->ed;153 batch->private_data = data;154 batch->private_data_dtor = ohci_batch_dispose;155 150 156 151 /* NOTE: OHCI is capable of handling buffer that crosses page boundaries … … 163 158 CHECK_NULL_DISPOSE_RETURN(data->device_buffer, 164 159 "Failed to allocate device accessible buffer.\n"); 160 /* Copy setup data */ 165 161 memcpy(data->device_buffer, batch->setup_buffer, 166 162 batch->setup_size); 167 163 batch->data_buffer = data->device_buffer + batch->setup_size; 168 164 } 165 166 batch->private_data = data; 167 batch->private_data_dtor = ohci_batch_dispose; 169 168 170 169 assert(batch_setup[batch->ep->transfer_type][batch->ep->direction]); … … 221 220 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(instance->ep); 222 221 assert(ohci_ep); 223 ohci_ep->td = data->tds[ i];222 ohci_ep->td = data->tds[data->leave_td]; 224 223 assert(i > 0); 225 224 for (--i;i < data->td_count; ++i) … … 363 362 instance->setup_size, toggle); 364 363 td_set_next(data->tds[0], data->tds[1]); 365 usb_log_debug("Created SETUP TD: %x:%x:%x:%x.\n", data->tds[0]->status, 366 data->tds[0]->cbp, data->tds[0]->next, data->tds[0]->be); 364 usb_log_debug("Created CONTROL SETUP TD: %x:%x:%x:%x.\n", 365 data->tds[0]->status, data->tds[0]->cbp, data->tds[0]->next, 366 data->tds[0]->be); 367 367 368 368 /* data stage */ … … 378 378 transfer_size, toggle); 379 379 td_set_next(data->tds[td_current], data->tds[td_current + 1]); 380 usb_log_debug("Created DATA TD: %x:%x:%x:%x.\n",380 usb_log_debug("Created CONTROL DATA TD: %x:%x:%x:%x.\n", 381 381 data->tds[td_current]->status, data->tds[td_current]->cbp, 382 382 data->tds[td_current]->next, data->tds[td_current]->be); … … 392 392 td_init(data->tds[td_current], status_dir, NULL, 0, 1); 393 393 td_set_next(data->tds[td_current], data->tds[td_current + 1]); 394 usb_log_debug("Created STATUS TD: %x:%x:%x:%x.\n",394 usb_log_debug("Created CONTROL STATUS TD: %x:%x:%x:%x.\n", 395 395 data->tds[td_current]->status, data->tds[td_current]->cbp, 396 396 data->tds[td_current]->next, data->tds[td_current]->be);
Note:
See TracChangeset
for help on using the changeset viewer.