Changeset f241b05b in mainline for uspace/drv/uhci-hcd/tracker.c
- Timestamp:
- 2011-02-07T22:09:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f82cc1a8
- Parents:
- a72620d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/tracker.c
ra72620d rf241b05b 109 109 } 110 110 /*----------------------------------------------------------------------------*/ 111 void tracker_control_write(tracker_t *instance) 111 void tracker_control_write( 112 tracker_t *instance, char* setup_buffer, size_t setup_size) 112 113 { 113 114 assert(instance); 114 115 assert(instance->buffer_offset == 0); 115 116 instance->packet_size = SETUP_PACKET_DATA_SIZE; 117 memcpy(instance->packet, instance->buffer, SETUP_PACKET_DATA_SIZE); 118 119 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, 120 SETUP_PACKET_DATA_SIZE, instance->toggle++, false, instance->target, 116 assert(setup_size == 8); 117 118 instance->packet_size = 0; 119 memcpy(instance->packet, setup_buffer, setup_size); 120 121 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, 122 setup_size, instance->toggle++, false, instance->target, 121 123 USB_PID_SETUP, instance->packet); 122 124 123 instance->buffer_offset += SETUP_PACKET_DATA_SIZE;124 125 instance->next_step = tracker_control_write_data; 125 126 … … 127 128 } 128 129 /*----------------------------------------------------------------------------*/ 129 void tracker_control_read(tracker_t *instance) 130 void tracker_control_read( 131 tracker_t *instance, char* setup_buffer, size_t setup_size) 130 132 { 131 133 assert(instance); 132 134 assert(instance->buffer_offset == 0); 133 134 instance->packet_size = SETUP_PACKET_DATA_SIZE; 135 memcpy(instance->packet, instance->buffer, SETUP_PACKET_DATA_SIZE);136 137 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, 138 SETUP_PACKET_DATA_SIZE, instance->toggle++, false, instance->target,135 assert(setup_size == 8); 136 137 memcpy(instance->packet, setup_buffer, setup_size); 138 139 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, 140 setup_size, instance->toggle++, false, instance->target, 139 141 USB_PID_SETUP, instance->packet); 140 142 … … 157 159 158 160 /* we are data in, we want data from our device */ 159 memcpy(instance->buffer + instance->buffer_offset, instance->packet, 160 instance->packet_size); 161 if (instance->packet_size) { 162 memcpy(instance->buffer + instance->buffer_offset, instance->packet, 163 instance->packet_size); 164 } 161 165 instance->buffer_offset += instance->packet_size; 162 166 … … 190 194 } 191 195 192 /* we are data out, we do wn't want data from our device */196 /* we are data out, we don't want data from our device */ 193 197 instance->buffer_offset += instance->packet_size; 194 198 … … 233 237 instance->packet_size = 0; 234 238 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, 235 0, 1, false, instance->target, USB_PID_OUT, NULL);239 instance->packet_size, 1, false, instance->target, USB_PID_OUT, NULL); 236 240 237 241 tracker_schedule(instance); … … 253 257 254 258 /* we are data in, we want data from our device */ 259 assert( 260 instance->buffer_offset + instance->packet_size <= instance->buffer_size); 255 261 memcpy(instance->buffer + instance->buffer_offset, instance->packet, 256 262 instance->packet_size); … … 261 267 instance->packet_size = 0; 262 268 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, 263 0, 1, false, instance->target, USB_PID_OUT, NULL);269 instance->packet_size, 1, false, instance->target, USB_PID_IN, NULL); 264 270 265 271 tracker_schedule(instance); … … 290 296 instance->packet_size = MIN(instance->max_packet_size, 291 297 instance->buffer_size - instance->buffer_offset); 298 assert(instance->packet_size <= instance->max_packet_size); 292 299 293 300 transfer_descriptor_init(instance->td, DEFAULT_ERROR_COUNT, … … 351 358 } 352 359 instance->buffer_offset += instance->packet_size; 353 usb_log_debug("Callback IN: %d, %zu.\n", err, instance->buffer_offset); 360 usb_log_debug("Callback IN(%d): %d, %zu.\n", instance->transfer_type, 361 err, instance->buffer_offset); 354 362 instance->callback_in(instance->dev, 355 363 err ? USB_OUTCOME_CRCERROR : USB_OUTCOME_OK, instance->buffer_offset, … … 364 372 /* check for errors */ 365 373 int err = transfer_descriptor_status(instance->td); 366 usb_log_debug("Callback OUT: %d, %zu.\n", err, instance->buffer_offset); 374 usb_log_debug("Callback OUT(%d): %d, %zu.\n", instance->transfer_type, 375 err, instance->buffer_offset); 367 376 instance->callback_out(instance->dev, 368 377 err ? USB_OUTCOME_CRCERROR : USB_OUTCOME_OK, instance->arg);
Note:
See TracChangeset
for help on using the changeset viewer.