Changeset d4beec3 in mainline for uspace/drv/uhci-hcd/batch.c
- Timestamp:
- 2011-03-06T19:01:09Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 960bee9, c867a216
- Parents:
- 24d5432 (diff), 8a20380 (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/uhci-hcd/batch.c
r24d5432 rd4beec3 54 54 static void batch_call_in_and_dispose(batch_t *instance); 55 55 static void batch_call_out_and_dispose(batch_t *instance); 56 static void batch_dispose(batch_t *instance); 56 57 57 58 … … 61 62 char* setup_buffer, size_t setup_size, 62 63 usbhc_iface_transfer_in_callback_t func_in, 63 usbhc_iface_transfer_out_callback_t func_out, void *arg) 64 usbhc_iface_transfer_out_callback_t func_out, void *arg, 65 device_keeper_t *manager 66 ) 64 67 { 65 68 assert(func_in == NULL || func_out == NULL); … … 137 140 instance->arg = arg; 138 141 instance->speed = speed; 142 instance->manager = manager; 139 143 140 144 queue_head_element_td(instance->qh, addr_to_phys(instance->tds)); … … 160 164 usb_log_debug("Batch(%p) found error TD(%d):%x.\n", 161 165 instance, i, instance->tds[i].status); 166 167 device_keeper_set_toggle(instance->manager, instance->target, 168 td_toggle(&instance->tds[i])); 162 169 if (i > 0) 163 170 goto substract_ret; … … 232 239 } 233 240 /*----------------------------------------------------------------------------*/ 234 staticvoid batch_data(batch_t *instance, usb_packet_id pid)241 void batch_data(batch_t *instance, usb_packet_id pid) 235 242 { 236 243 assert(instance); 237 244 const bool low_speed = instance->speed == USB_SPEED_LOW; 238 int toggle = 1; 245 int toggle = device_keeper_get_toggle(instance->manager, instance->target); 246 assert(toggle == 0 || toggle == 1); 239 247 240 248 size_t packet = 0; … … 245 253 - remain_size; 246 254 247 toggle = 1 - toggle;248 255 249 256 const size_t packet_size = … … 256 263 &instance->tds[packet + 1]); 257 264 265 toggle = 1 - toggle; 258 266 ++packet; 259 267 assert(packet <= instance->packets); … … 261 269 remain_size -= packet_size; 262 270 } 271 device_keeper_set_toggle(instance->manager, instance->target, toggle); 263 272 264 273 instance->tds[packet - 1].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG; … … 266 275 } 267 276 /*----------------------------------------------------------------------------*/ 268 staticvoid batch_control(batch_t *instance,277 void batch_control(batch_t *instance, 269 278 usb_packet_id data_stage, usb_packet_id status_stage) 270 279 { … … 347 356 assert(instance); 348 357 batch_call_in(instance); 358 batch_dispose(instance); 359 } 360 /*----------------------------------------------------------------------------*/ 361 void batch_call_out_and_dispose(batch_t *instance) 362 { 363 assert(instance); 364 batch_call_out(instance); 365 batch_dispose(instance); 366 } 367 /*----------------------------------------------------------------------------*/ 368 void batch_dispose(batch_t *instance) 369 { 370 assert(instance); 349 371 usb_log_debug("Batch(%p) disposing.\n", instance); 350 372 free32(instance->tds); … … 355 377 } 356 378 /*----------------------------------------------------------------------------*/ 357 void batch_call_out_and_dispose(batch_t *instance)358 {359 assert(instance);360 batch_call_out(instance);361 usb_log_debug("Batch(%p) disposing.\n", instance);362 free32(instance->tds);363 free32(instance->qh);364 free32(instance->setup_buffer);365 free32(instance->transport_buffer);366 free(instance);367 }368 /*----------------------------------------------------------------------------*/369 379 int batch_schedule(batch_t *instance) 370 380 {
Note:
See TracChangeset
for help on using the changeset viewer.