Changeset 51b46f2 in mainline for uspace/drv/uhci-hcd/batch.c
- Timestamp:
- 2011-03-01T15:39:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e135751
- Parents:
- 0e3505a (diff), cc44f7e (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
r0e3505a r51b46f2 33 33 */ 34 34 #include <errno.h> 35 #include <str_error.h> 35 36 36 37 #include <usb/debug.h> … … 53 54 batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, 54 55 usb_transfer_type_t transfer_type, size_t max_packet_size, 55 dev_speed_t speed, char *buffer, size_t size,56 usb_speed_t speed, char *buffer, size_t size, 56 57 char* setup_buffer, size_t setup_size, 57 58 usbhc_iface_transfer_in_callback_t func_in, … … 133 134 134 135 queue_head_element_td(instance->qh, addr_to_phys(instance->tds)); 136 usb_log_debug("Batch(%p) %d:%d memory structures ready.\n", 137 instance, target.address, target.endpoint); 135 138 return instance; 136 139 } … … 139 142 { 140 143 assert(instance); 141 usb_log_debug ("Checking(%p) %d packetfor completion.\n",144 usb_log_debug2("Batch(%p) checking %d packet(s) for completion.\n", 142 145 instance, instance->packets); 143 146 instance->transfered_size = 0; … … 151 154 if (i > 0) 152 155 instance->transfered_size -= instance->setup_size; 156 usb_log_debug("Batch(%p) found error TD(%d):%x.\n", 157 instance, i, instance->tds[i].status); 153 158 return true; 154 159 } … … 156 161 transfer_descriptor_actual_size(&instance->tds[i]); 157 162 } 158 /* This is just an ugly trick to support the old API */159 163 instance->transfered_size -= instance->setup_size; 160 164 return true; … … 168 172 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 169 173 174 const bool low_speed = instance->speed == USB_SPEED_LOW; 170 175 int toggle = 0; 171 176 /* setup stage */ 172 177 transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT, 173 instance->setup_size, toggle, false, instance->target, 174 USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]); 178 instance->setup_size, toggle, false, low_speed, 179 instance->target, USB_PID_SETUP, instance->setup_buffer, 180 &instance->tds[1]); 175 181 176 182 /* data stage */ … … 182 188 183 189 transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT, 184 instance->max_packet_size, toggle++, false, instance->target,185 USB_PID_OUT, data, &instance->tds[i + 1]);190 instance->max_packet_size, toggle++, false, low_speed, 191 instance->target, USB_PID_OUT, data, &instance->tds[i + 1]); 186 192 } 187 193 … … 189 195 i = instance->packets - 1; 190 196 transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT, 191 0, 1, false, instance->target, USB_PID_IN, NULL, NULL);197 0, 1, false, low_speed, instance->target, USB_PID_IN, NULL, NULL); 192 198 193 199 instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG; 200 usb_log_debug2("Control write last TD status: %x.\n", 201 instance->tds[i].status); 194 202 195 203 instance->next_step = batch_call_out_and_dispose; 204 usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance); 196 205 batch_schedule(instance); 197 206 } … … 201 210 assert(instance); 202 211 212 const bool low_speed = instance->speed == USB_SPEED_LOW; 203 213 int toggle = 0; 204 214 /* setup stage */ 205 215 transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT, 206 instance->setup_size, toggle, false, instance->target,216 instance->setup_size, toggle, false, low_speed, instance->target, 207 217 USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]); 208 218 … … 215 225 216 226 transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT, 217 instance->max_packet_size, toggle, false, instance->target,218 227 instance->max_packet_size, toggle, false, low_speed, 228 instance->target, USB_PID_IN, data, &instance->tds[i + 1]); 219 229 } 220 230 … … 222 232 i = instance->packets - 1; 223 233 transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT, 224 0, 1, false, instance->target, USB_PID_OUT, NULL, NULL);234 0, 1, false, low_speed, instance->target, USB_PID_OUT, NULL, NULL); 225 235 226 236 instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG; 237 usb_log_debug2("Control read last TD status: %x.\n", 238 instance->tds[i].status); 227 239 228 240 instance->next_step = batch_call_in_and_dispose; 241 usb_log_debug("Batch(%p) CONTROL READ initialized.\n", instance); 229 242 batch_schedule(instance); 230 243 } … … 234 247 assert(instance); 235 248 249 const bool low_speed = instance->speed == USB_SPEED_LOW; 236 250 int toggle = 1; 237 251 size_t i = 0; … … 244 258 245 259 transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT, 246 instance->max_packet_size, toggle, false, instance->target,247 USB_PID_IN, data, next);260 instance->max_packet_size, toggle, false, low_speed, 261 instance->target, USB_PID_IN, data, next); 248 262 } 249 263 … … 251 265 252 266 instance->next_step = batch_call_in_and_dispose; 267 usb_log_debug("Batch(%p) INTERRUPT IN initialized.\n", instance); 253 268 batch_schedule(instance); 254 269 } … … 260 275 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 261 276 277 const bool low_speed = instance->speed == USB_SPEED_LOW; 262 278 int toggle = 1; 263 279 size_t i = 0; … … 270 286 271 287 transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT, 272 instance->max_packet_size, toggle++, false, instance->target,273 USB_PID_OUT, data, next);288 instance->max_packet_size, toggle++, false, low_speed, 289 instance->target, USB_PID_OUT, data, next); 274 290 } 275 291 … … 277 293 278 294 instance->next_step = batch_call_out_and_dispose; 295 usb_log_debug("Batch(%p) INTERRUPT OUT initialized.\n", instance); 279 296 batch_schedule(instance); 280 297 } … … 288 305 289 306 int err = instance->error; 290 usb_log_info("Callback IN(%d): %d, %zu.\n", instance->transfer_type, 291 err, instance->transfered_size); 307 usb_log_debug("Batch(%p) callback IN(type:%d): %s(%d), %zu.\n", 308 instance, instance->transfer_type, str_error(err), err, 309 instance->transfered_size); 292 310 293 311 instance->callback_in(instance->fun, … … 302 320 303 321 int err = instance->error; 304 usb_log_info("Callback OUT(%d): %d.\n", instance->transfer_type, err); 322 usb_log_debug("Batch(%p) callback OUT(type:%d): %s(%d).\n", 323 instance, instance->transfer_type, str_error(err), err); 305 324 instance->callback_out(instance->fun, 306 325 err, instance->arg); … … 311 330 assert(instance); 312 331 batch_call_in(instance); 313 usb_log_debug(" Disposing batch: %p.\n", instance);332 usb_log_debug("Batch(%p) disposing.\n", instance); 314 333 free32(instance->tds); 315 334 free32(instance->qh); … … 323 342 assert(instance); 324 343 batch_call_out(instance); 325 usb_log_debug(" Disposing batch: %p.\n", instance);344 usb_log_debug("Batch(%p) disposing.\n", instance); 326 345 free32(instance->tds); 327 346 free32(instance->qh); … … 338 357 return uhci_schedule(hc, instance); 339 358 } 340 /*----------------------------------------------------------------------------*/341 /* DEPRECATED FUNCTIONS NEEDED BY THE OLD API */342 void batch_control_setup_old(batch_t *instance)343 {344 assert(instance);345 instance->packets = 1;346 347 /* setup stage */348 transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,349 instance->setup_size, 0, false, instance->target,350 USB_PID_SETUP, instance->setup_buffer, NULL);351 352 instance->next_step = batch_call_out_and_dispose;353 batch_schedule(instance);354 }355 /*----------------------------------------------------------------------------*/356 void batch_control_write_data_old(batch_t *instance)357 {358 assert(instance);359 instance->packets -= 2;360 batch_interrupt_out(instance);361 }362 /*----------------------------------------------------------------------------*/363 void batch_control_read_data_old(batch_t *instance)364 {365 assert(instance);366 instance->packets -= 2;367 batch_interrupt_in(instance);368 }369 /*----------------------------------------------------------------------------*/370 void batch_control_write_status_old(batch_t *instance)371 {372 assert(instance);373 instance->packets = 1;374 transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,375 0, 1, false, instance->target, USB_PID_IN, NULL, NULL);376 instance->next_step = batch_call_in_and_dispose;377 batch_schedule(instance);378 }379 /*----------------------------------------------------------------------------*/380 void batch_control_read_status_old(batch_t *instance)381 {382 assert(instance);383 instance->packets = 1;384 transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,385 0, 1, false, instance->target, USB_PID_OUT, NULL, NULL);386 instance->next_step = batch_call_out_and_dispose;387 batch_schedule(instance);388 }389 359 /** 390 360 * @}
Note:
See TracChangeset
for help on using the changeset viewer.