Changeset f567bcf in mainline
- Timestamp:
- 2011-04-06T22:02:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4ca18ae
- Parents:
- 8dc762e0
- Location:
- uspace
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/batch.c
r8dc762e0 rf567bcf 73 73 CHECK_NULL_DISPOSE_RETURN(instance, 74 74 "Failed to allocate batch instance.\n"); 75 usb_transfer_batch_init(instance, target, transfer_type, speed, max_packet_size,76 buffer, NULL, buffer_size, NULL, setup_size, func_in,77 func_ out, arg, fun, NULL);75 usb_transfer_batch_init(instance, target, transfer_type, speed, 76 max_packet_size, buffer, NULL, buffer_size, NULL, setup_size, 77 func_in, func_out, arg, fun, NULL, NULL); 78 78 79 79 if (buffer_size > 0) { -
uspace/drv/ohci/iface.c
r8dc762e0 rf567bcf 164 164 // TODO use real endpoint here! 165 165 return usb_endpoint_manager_register_ep(&hc->ep_manager, 166 address, endpoint, direction, NULL, NULL,0);166 address, endpoint, direction, NULL, 0); 167 167 } 168 168 /*----------------------------------------------------------------------------*/ -
uspace/drv/uhci-hcd/batch.c
r8dc762e0 rf567bcf 49 49 td_t *tds; 50 50 size_t transfers; 51 usb_device_keeper_t *manager;51 // usb_device_keeper_t *manager; 52 52 } uhci_batch_t; 53 53 … … 87 87 usbhc_iface_transfer_in_callback_t func_in, 88 88 usbhc_iface_transfer_out_callback_t func_out, void *arg, 89 usb_device_keeper_t *manager 89 usb_device_keeper_t *manager, endpoint_t *ep 90 90 ) 91 91 { … … 105 105 CHECK_NULL_DISPOSE_RETURN(instance, 106 106 "Failed to allocate batch instance.\n"); 107 usb_transfer_batch_init(instance, target, transfer_type, speed, max_packet_size, 107 usb_transfer_batch_init(instance, target, 108 transfer_type, speed, max_packet_size, 108 109 buffer, NULL, buffer_size, NULL, setup_size, func_in, 109 func_out, arg, fun, NULL);110 func_out, arg, fun, ep, NULL); 110 111 111 112 … … 114 115 "Failed to allocate batch instance.\n"); 115 116 bzero(data, sizeof(uhci_batch_t)); 116 data->manager = manager;117 // data->manager = manager; 117 118 instance->private_data = data; 118 119 … … 180 181 instance, i, data->tds[i].status); 181 182 td_print_status(&data->tds[i]); 182 183 endpoint_toggle_set(instance->ep, 184 td_toggle(&data->tds[i])); 185 /* 183 186 usb_device_keeper_set_toggle(data->manager, 184 187 instance->target, instance->direction, 185 188 td_toggle(&data->tds[i])); 189 */ 186 190 if (i > 0) 187 191 goto substract_ret; … … 310 314 311 315 const bool low_speed = instance->speed == USB_SPEED_LOW; 312 int toggle = usb_device_keeper_get_toggle( 313 data->manager, instance->target, instance->direction); 316 int toggle = endpoint_toggle_get(instance->ep); 317 // usb_device_keeper_get_toggle( 318 // data->manager, instance->target, instance->direction); 314 319 assert(toggle == 0 || toggle == 1); 315 320 … … 342 347 } 343 348 td_set_ioc(&data->tds[transfer - 1]); 344 usb_device_keeper_set_toggle(data->manager, instance->target, 345 instance->direction, toggle); 349 endpoint_toggle_set(instance->ep, toggle); 350 // usb_device_keeper_set_toggle(data->manager, instance->target, 351 // instance->direction, toggle); 346 352 } 347 353 /*----------------------------------------------------------------------------*/ -
uspace/drv/uhci-hcd/batch.h
r8dc762e0 rf567bcf 56 56 usbhc_iface_transfer_out_callback_t func_out, 57 57 void *arg, 58 usb_device_keeper_t *manager 58 usb_device_keeper_t *manager, 59 endpoint_t *ep 59 60 ); 60 61 -
uspace/drv/uhci-hcd/iface.c
r8dc762e0 rf567bcf 183 183 endpoint_destroy(ep); 184 184 } else { 185 usb_device_keeper_add_ep(&hc->manager, address, &ep->same_device_eps);185 usb_device_keeper_add_ep(&hc->manager, address, ep); 186 186 } 187 187 return ret; … … 246 246 usb_transfer_batch_t *batch = 247 247 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 248 ep->speed, data, size, NULL, 0, NULL, callback, arg, &hc->manager); 248 ep->speed, data, size, NULL, 0, NULL, callback, arg, 249 &hc->manager, ep); 249 250 if (!batch) 250 251 return ENOMEM; … … 304 305 usb_transfer_batch_t *batch = 305 306 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 306 ep->speed, data, size, NULL, 0, callback, NULL, arg, &hc->manager); 307 ep->speed, data, size, NULL, 0, callback, NULL, arg, 308 &hc->manager, ep); 307 309 if (!batch) 308 310 return ENOMEM; … … 352 354 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 353 355 ep->speed, data, size, NULL, 0, NULL, callback, arg, 354 &hc->manager );356 &hc->manager, ep); 355 357 if (!batch) 356 358 return ENOMEM; … … 399 401 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 400 402 ep->speed, data, size, NULL, 0, callback, NULL, arg, 401 &hc->manager );403 &hc->manager, ep); 402 404 if (!batch) 403 405 return ENOMEM; … … 448 450 batch_get(fun, target, USB_TRANSFER_CONTROL, max_packet_size, speed, 449 451 data, size, setup_data, setup_size, NULL, callback, arg, 450 &hc->manager );452 &hc->manager, ep); 451 453 if (!batch) 452 454 return ENOMEM; … … 495 497 batch_get(fun, target, USB_TRANSFER_CONTROL, max_packet_size, speed, 496 498 data, size, setup_data, setup_size, callback, NULL, arg, 497 &hc->manager );499 &hc->manager, ep); 498 500 if (!batch) 499 501 return ENOMEM; -
uspace/lib/usb/include/usb/host/batch.h
r8dc762e0 rf567bcf 39 39 #include <usbhc_iface.h> 40 40 #include <usb/usb.h> 41 #include <usb/host/endpoint.h> 41 42 42 43 typedef struct usb_transfer_batch usb_transfer_batch_t; … … 60 61 ddf_fun_t *fun; 61 62 void *arg; 63 endpoint_t *ep; 62 64 void *private_data; 63 65 }; … … 78 80 void *arg, 79 81 ddf_fun_t *fun, 82 endpoint_t *ep, 80 83 void *private_data 81 84 ); -
uspace/lib/usb/include/usb/host/device_keeper.h
r8dc762e0 rf567bcf 45 45 #include <fibril_synch.h> 46 46 #include <usb/usb.h> 47 #include <usb/host/endpoint.h> 47 48 48 49 /** Number of USB address for array dimensions. */ … … 72 73 73 74 void usb_device_keeper_add_ep( 74 usb_device_keeper_t *instance, usb_address_t address, link_t *ep);75 usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep); 75 76 76 77 void usb_device_keeper_reserve_default_address( … … 82 83 usb_target_t target, 83 84 const uint8_t *setup_data); 84 85 /* 85 86 int usb_device_keeper_get_toggle(usb_device_keeper_t *instance, 86 87 usb_target_t target, usb_direction_t direction); … … 88 89 int usb_device_keeper_set_toggle(usb_device_keeper_t *instance, 89 90 usb_target_t target, usb_direction_t direction, bool toggle); 90 91 */ 91 92 usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance, 92 93 usb_speed_t speed); -
uspace/lib/usb/include/usb/host/endpoint.h
r8dc762e0 rf567bcf 47 47 size_t max_packet_size; 48 48 bool active; 49 inttoggle:1;49 unsigned toggle:1; 50 50 } endpoint_t; 51 51 … … 55 55 void endpoint_destroy(endpoint_t *instance); 56 56 57 int endpoint_toggle_get(endpoint_t *instance); 58 59 void endpoint_toggle_set(endpoint_t *instance, int toggle); 60 57 61 void endpoint_toggle_reset(link_t *ep); 62 58 63 59 64 #endif -
uspace/lib/usb/src/host/batch.c
r8dc762e0 rf567bcf 54 54 void *arg, 55 55 ddf_fun_t *fun, 56 endpoint_t *ep, 56 57 void *private_data 57 58 ) … … 77 78 instance->next_step = NULL; 78 79 instance->error = EOK; 79 80 instance->ep = ep; 80 81 } 81 82 /*----------------------------------------------------------------------------*/ -
uspace/lib/usb/src/host/device_keeper.c
r8dc762e0 rf567bcf 56 56 instance->devices[i].control_used = 0; 57 57 instance->devices[i].handle = 0; 58 instance->devices[i].toggle_status[0] = 0;59 instance->devices[i].toggle_status[1] = 0;58 // instance->devices[i].toggle_status[0] = 0; 59 // instance->devices[i].toggle_status[1] = 0; 60 60 list_initialize(&instance->devices[i].endpoints); 61 61 } … … 63 63 /*----------------------------------------------------------------------------*/ 64 64 void usb_device_keeper_add_ep( 65 usb_device_keeper_t *instance, usb_address_t address, link_t *ep)65 usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep) 66 66 { 67 67 assert(instance); 68 68 fibril_mutex_lock(&instance->guard); 69 69 assert(instance->devices[address].occupied); 70 list_append( ep, &instance->devices[address].endpoints);70 list_append(&ep->same_device_eps, &instance->devices[address].endpoints); 71 71 fibril_mutex_unlock(&instance->guard); 72 72 } … … 131 131 if (((data[0] & 0xf) == 1) && ((data[2] | data[3]) == 0)) { 132 132 /* endpoint number is < 16, thus first byte is enough */ 133 instance->devices[target.address].toggle_status[0] &= 134 ~(1 << data[4]); 135 instance->devices[target.address].toggle_status[1] &= 136 ~(1 << data[4]); 133 assert(!"NOT IMPLEMENTED!"); 134 // instance->devices[target.address].toggle_status[0] &= 135 // ~(1 << data[4]); 136 // instance->devices[target.address].toggle_status[1] &= 137 // ~(1 << data[4]); 137 138 } 138 139 break; … … 142 143 /* target must be device */ 143 144 if ((data[0] & 0xf) == 0) { 144 instance->devices[target.address].toggle_status[0] = 0; 145 instance->devices[target.address].toggle_status[1] = 0; 145 link_t *current = 146 instance->devices[target.address].endpoints.next; 147 while (current != 148 instance->devices[target.address].endpoints.prev) 149 { 150 endpoint_toggle_reset(current); 151 current = current->next; 152 } 153 // instance->devices[target.address].toggle_status[0] = 0; 154 // instance->devices[target.address].toggle_status[1] = 0; 146 155 } 147 156 break; … … 150 159 } 151 160 /*----------------------------------------------------------------------------*/ 161 #if 0 152 162 /** Get current value of endpoint toggle. 153 163 * … … 212 222 return ret; 213 223 } 224 #endif 214 225 /*----------------------------------------------------------------------------*/ 215 226 /** Get a free USB address -
uspace/lib/usb/src/host/endpoint.c
r8dc762e0 rf567bcf 35 35 36 36 #include <errno.h> 37 38 37 #include <usb/host/endpoint.h> 39 38 … … 57 56 } 58 57 /*----------------------------------------------------------------------------*/ 58 int endpoint_toggle_get(endpoint_t *instance) 59 { 60 assert(instance); 61 return (int)instance->toggle; 62 } 63 /*----------------------------------------------------------------------------*/ 64 void endpoint_toggle_set(endpoint_t *instance, int toggle) 65 { 66 assert(instance); 67 assert(toggle == 0 || toggle == 1); 68 instance->toggle = toggle; 69 } 70 /*----------------------------------------------------------------------------*/ 59 71 void endpoint_toggle_reset(link_t *ep) 60 72 {
Note:
See TracChangeset
for help on using the changeset viewer.