Changeset f241b05b in mainline
- 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
- Location:
- uspace/drv/uhci-hcd
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/iface.c
ra72620d rf241b05b 136 136 usbhc_iface_transfer_out_callback_t callback, void *arg) 137 137 { 138 return ENOTSUP; 138 size_t max_packet_size = size; 139 dev_speed_t speed = FULL_SPEED; 140 141 tracker_t *tracker = tracker_get(dev, target, USB_TRANSFER_CONTROL, 142 max_packet_size, speed, data, size, NULL, callback, arg); 143 if (!tracker) 144 return ENOMEM; 145 tracker_control_write(tracker, setup_data, setup_size); 146 return EOK; 139 147 } 140 148 /*----------------------------------------------------------------------------*/ … … 143 151 usbhc_iface_transfer_in_callback_t callback, void *arg) 144 152 { 145 return ENOTSUP; 153 size_t max_packet_size = size; 154 dev_speed_t speed = FULL_SPEED; 155 156 tracker_t *tracker = tracker_get(dev, target, USB_TRANSFER_CONTROL, 157 max_packet_size, speed, data, size, callback, NULL, arg); 158 if (!tracker) 159 return ENOMEM; 160 tracker_control_read(tracker, setup_data, setup_size); 161 return EOK; 146 162 } 147 163 /*----------------------------------------------------------------------------*/ -
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); -
uspace/drv/uhci-hcd/tracker.h
ra72620d rf241b05b 77 77 usbhc_iface_transfer_out_callback_t func_out, void *arg); 78 78 79 void tracker_control_write(tracker_t *instance); 79 void tracker_control_write( 80 tracker_t *instance, char* setup_buffer, size_t setup_size); 80 81 81 void tracker_control_read(tracker_t *instance); 82 void tracker_control_read( 83 tracker_t *instance, char* setup_buffer, size_t setup_size); 82 84 83 85 void tracker_interrupt_in(tracker_t *instance); -
uspace/drv/uhci-hcd/transfer_list.c
ra72620d rf241b05b 83 83 84 84 /* check again, may be use atomic compare and swap */ 85 if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) {86 instance->queue_head->element = pa;87 }85 // if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) { 86 // instance->queue_head->element = pa; 87 // } 88 88 } 89 89 /** -
uspace/drv/uhci-hcd/uhci.c
ra72620d rf241b05b 186 186 link_t *next = current->next; 187 187 tracker_t *tracker = list_get_instance(current, tracker_t, link); 188 188 189 assert(current == &tracker->link); 190 assert(tracker); 191 assert(tracker->next_step); 192 assert(tracker->td); 193 189 194 if (!transfer_descriptor_is_active(tracker->td)) { 190 195 usb_log_info("Found inactive tracker with status: %x.\n",
Note:
See TracChangeset
for help on using the changeset viewer.