Changes in / [7102aa5:5971dd3] in mainline
- Location:
- uspace
- Files:
-
- 2 added
- 3 deleted
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/dev.c
r7102aa5 r5971dd3 59 59 } 60 60 61 rc = usb_ pipe_initialize_default_control(&dev->ctrl_pipe,61 rc = usb_endpoint_pipe_initialize_default_control(&dev->ctrl_pipe, 62 62 &dev->wire); 63 63 if (rc != EOK) { … … 68 68 } 69 69 70 rc = usb_ pipe_probe_default_control(&dev->ctrl_pipe);70 rc = usb_endpoint_pipe_probe_default_control(&dev->ctrl_pipe); 71 71 if (rc != EOK) { 72 72 fprintf(stderr, … … 76 76 } 77 77 78 rc = usb_ pipe_start_session(&dev->ctrl_pipe);78 rc = usb_endpoint_pipe_start_session(&dev->ctrl_pipe); 79 79 if (rc != EOK) { 80 80 fprintf(stderr, … … 107 107 108 108 leave: 109 if (usb_ pipe_is_session_started(&dev->ctrl_pipe)) {110 usb_ pipe_end_session(&dev->ctrl_pipe);109 if (usb_endpoint_pipe_is_session_started(&dev->ctrl_pipe)) { 110 usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 111 111 } 112 112 … … 118 118 void destroy_device(usbinfo_device_t *dev) 119 119 { 120 usb_ pipe_end_session(&dev->ctrl_pipe);120 usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 121 121 free(dev); 122 122 } -
uspace/app/usbinfo/usbinfo.h
r7102aa5 r5971dd3 44 44 45 45 typedef struct { 46 usb_ pipe_t ctrl_pipe;46 usb_endpoint_pipe_t ctrl_pipe; 47 47 usb_device_connection_t wire; 48 48 usb_standard_device_descriptor_t device_descriptor; -
uspace/drv/ohci/batch.c
r7102aa5 r5971dd3 41 41 #include "utils/malloc32.h" 42 42 43 static void batch_call_in_and_dispose( usb_transfer_batch_t *instance);44 static void batch_call_out_and_dispose( usb_transfer_batch_t *instance);43 static void batch_call_in_and_dispose(batch_t *instance); 44 static void batch_call_out_and_dispose(batch_t *instance); 45 45 46 46 #define DEFAULT_ERROR_COUNT 3 47 usb_transfer_batch_t * batch_get(47 batch_t * batch_get( 48 48 ddf_fun_t *fun, 49 49 usb_target_t target, … … 58 58 usbhc_iface_transfer_out_callback_t func_out, 59 59 void *arg, 60 usb_device_keeper_t *manager60 device_keeper_t *manager 61 61 ) 62 62 { … … 70 70 } else (void)0 71 71 72 usb_transfer_batch_t *instance = malloc(sizeof(usb_transfer_batch_t));72 batch_t *instance = malloc(sizeof(batch_t)); 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,75 batch_init(instance, target, transfer_type, speed, max_packet_size, 76 76 buffer, NULL, buffer_size, NULL, setup_size, func_in, 77 77 func_out, arg, fun, NULL); … … 94 94 } 95 95 /*----------------------------------------------------------------------------*/ 96 void batch_dispose( usb_transfer_batch_t *instance)96 void batch_dispose(batch_t *instance) 97 97 { 98 98 assert(instance); … … 102 102 } 103 103 /*----------------------------------------------------------------------------*/ 104 void batch_control_write( usb_transfer_batch_t *instance)104 void batch_control_write(batch_t *instance) 105 105 { 106 106 assert(instance); … … 113 113 } 114 114 /*----------------------------------------------------------------------------*/ 115 void batch_control_read( usb_transfer_batch_t *instance)115 void batch_control_read(batch_t *instance) 116 116 { 117 117 assert(instance); … … 121 121 } 122 122 /*----------------------------------------------------------------------------*/ 123 void batch_interrupt_in( usb_transfer_batch_t *instance)123 void batch_interrupt_in(batch_t *instance) 124 124 { 125 125 assert(instance); … … 130 130 } 131 131 /*----------------------------------------------------------------------------*/ 132 void batch_interrupt_out( usb_transfer_batch_t *instance)132 void batch_interrupt_out(batch_t *instance) 133 133 { 134 134 assert(instance); … … 142 142 } 143 143 /*----------------------------------------------------------------------------*/ 144 void batch_bulk_in( usb_transfer_batch_t *instance)144 void batch_bulk_in(batch_t *instance) 145 145 { 146 146 assert(instance); … … 151 151 } 152 152 /*----------------------------------------------------------------------------*/ 153 void batch_bulk_out( usb_transfer_batch_t *instance)153 void batch_bulk_out(batch_t *instance) 154 154 { 155 155 assert(instance); … … 164 164 * @param[in] instance Batch structure to use. 165 165 */ 166 void batch_call_in_and_dispose( usb_transfer_batch_t *instance)166 void batch_call_in_and_dispose(batch_t *instance) 167 167 { 168 168 assert(instance); 169 usb_transfer_batch_call_in(instance);169 batch_call_in(instance); 170 170 batch_dispose(instance); 171 171 } … … 175 175 * @param[in] instance Batch structure to use. 176 176 */ 177 void batch_call_out_and_dispose( usb_transfer_batch_t *instance)177 void batch_call_out_and_dispose(batch_t *instance) 178 178 { 179 179 assert(instance); 180 usb_transfer_batch_call_out(instance);180 batch_call_out(instance); 181 181 batch_dispose(instance); 182 182 } -
uspace/drv/ohci/batch.h
r7102aa5 r5971dd3 41 41 #include <usb/host/batch.h> 42 42 43 usb_transfer_batch_t * batch_get(43 batch_t * batch_get( 44 44 ddf_fun_t *fun, 45 45 usb_target_t target, … … 54 54 usbhc_iface_transfer_out_callback_t func_out, 55 55 void *arg, 56 usb_device_keeper_t *manager56 device_keeper_t *manager 57 57 ); 58 58 59 void batch_dispose( usb_transfer_batch_t *instance);59 void batch_dispose(batch_t *instance); 60 60 61 void batch_control_write( usb_transfer_batch_t *instance);61 void batch_control_write(batch_t *instance); 62 62 63 void batch_control_read( usb_transfer_batch_t *instance);63 void batch_control_read(batch_t *instance); 64 64 65 void batch_interrupt_in( usb_transfer_batch_t *instance);65 void batch_interrupt_in(batch_t *instance); 66 66 67 void batch_interrupt_out( usb_transfer_batch_t *instance);67 void batch_interrupt_out(batch_t *instance); 68 68 69 void batch_bulk_in( usb_transfer_batch_t *instance);69 void batch_bulk_in(batch_t *instance); 70 70 71 void batch_bulk_out( usb_transfer_batch_t *instance);71 void batch_bulk_out(batch_t *instance); 72 72 #endif 73 73 /** -
uspace/drv/ohci/hc.c
r7102aa5 r5971dd3 60 60 } 61 61 instance->ddf_instance = fun; 62 usb_device_keeper_init(&instance->manager);62 device_keeper_init(&instance->manager); 63 63 64 64 if (!interrupts) { … … 111 111 } 112 112 /*----------------------------------------------------------------------------*/ 113 int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch)113 int hc_schedule(hc_t *instance, batch_t *batch) 114 114 { 115 115 assert(instance); -
uspace/drv/ohci/hc.h
r7102aa5 r5971dd3 53 53 rh_t rh; 54 54 ddf_fun_t *ddf_instance; 55 usb_device_keeper_t manager;55 device_keeper_t manager; 56 56 fid_t interrupt_emulator; 57 57 } hc_t; … … 62 62 int hc_register_hub(hc_t *instance); 63 63 64 int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch);64 int hc_schedule(hc_t *instance, batch_t *batch); 65 65 66 66 void hc_interrupt(hc_t *instance, uint32_t status); -
uspace/drv/ohci/iface.c
r7102aa5 r5971dd3 64 64 assert(hc); 65 65 usb_log_debug("Default address request with speed %d.\n", speed); 66 usb_device_keeper_reserve_default_address(&hc->manager, speed);66 device_keeper_reserve_default(&hc->manager, speed); 67 67 return EOK; 68 68 } … … 79 79 assert(hc); 80 80 usb_log_debug("Default address release.\n"); 81 usb_device_keeper_release_default_address(&hc->manager);81 device_keeper_release_default(&hc->manager); 82 82 return EOK; 83 83 } … … 99 99 100 100 usb_log_debug("Address request with speed %d.\n", speed); 101 *address = device_keeper_ get_free_address(&hc->manager, speed);101 *address = device_keeper_request(&hc->manager, speed); 102 102 usb_log_debug("Address request with result: %d.\n", *address); 103 103 if (*address <= 0) … … 120 120 assert(hc); 121 121 usb_log_debug("Address bind %d-%d.\n", address, handle); 122 usb_device_keeper_bind(&hc->manager, address, handle);122 device_keeper_bind(&hc->manager, address, handle); 123 123 return EOK; 124 124 } … … 136 136 assert(hc); 137 137 usb_log_debug("Address release %d.\n", address); 138 usb_device_keeper_release(&hc->manager, address);138 device_keeper_release(&hc->manager, address); 139 139 return EOK; 140 140 } … … 200 200 hc_t *hc = fun_to_hc(fun); 201 201 assert(hc); 202 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, target.address);202 usb_speed_t speed = device_keeper_speed(&hc->manager, target.address); 203 203 204 204 usb_log_debug("Interrupt OUT %d:%d %zu(%zu).\n", 205 205 target.address, target.endpoint, size, max_packet_size); 206 206 207 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,207 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, 208 208 max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg, 209 209 &hc->manager); … … 243 243 hc_t *hc = fun_to_hc(fun); 244 244 assert(hc); 245 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, target.address);245 usb_speed_t speed = device_keeper_speed(&hc->manager, target.address); 246 246 usb_log_debug("Interrupt IN %d:%d %zu(%zu).\n", 247 247 target.address, target.endpoint, size, max_packet_size); 248 248 249 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,249 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, 250 250 max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg, 251 251 &hc->manager); … … 285 285 hc_t *hc = fun_to_hc(fun); 286 286 assert(hc); 287 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, target.address);287 usb_speed_t speed = device_keeper_speed(&hc->manager, target.address); 288 288 289 289 usb_log_debug("Bulk OUT %d:%d %zu(%zu).\n", 290 290 target.address, target.endpoint, size, max_packet_size); 291 291 292 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,292 batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK, 293 293 max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg, 294 294 &hc->manager); … … 329 329 hc_t *hc = fun_to_hc(fun); 330 330 assert(hc); 331 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, target.address);331 usb_speed_t speed = device_keeper_speed(&hc->manager, target.address); 332 332 usb_log_debug("Bulk IN %d:%d %zu(%zu).\n", 333 333 target.address, target.endpoint, size, max_packet_size); 334 334 335 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,335 batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK, 336 336 max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg, 337 337 &hc->manager); … … 376 376 hc_t *hc = fun_to_hc(fun); 377 377 assert(hc); 378 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, target.address);378 usb_speed_t speed = device_keeper_speed(&hc->manager, target.address); 379 379 usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n", 380 380 speed, target.address, target.endpoint, size, max_packet_size); … … 383 383 return EINVAL; 384 384 385 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,385 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, 386 386 max_packet_size, speed, data, size, setup_data, setup_size, 387 387 NULL, callback, arg, &hc->manager); 388 388 if (!batch) 389 389 return ENOMEM; 390 usb_device_keeper_reset_if_need(&hc->manager, target, setup_data);390 device_keeper_reset_if_need(&hc->manager, target, setup_data); 391 391 batch_control_write(batch); 392 392 const int ret = hc_schedule(hc, batch); … … 427 427 hc_t *hc = fun_to_hc(fun); 428 428 assert(hc); 429 usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, target.address);429 usb_speed_t speed = device_keeper_speed(&hc->manager, target.address); 430 430 431 431 usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n", 432 432 speed, target.address, target.endpoint, size, max_packet_size); 433 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,433 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, 434 434 max_packet_size, speed, data, size, setup_data, setup_size, callback, 435 435 NULL, arg, &hc->manager); -
uspace/drv/ohci/main.c
r7102aa5 r5971dd3 61 61 { 62 62 assert(fun); 63 usb_device_keeper_t *manager = &fun_to_hc(fun)->manager;64 usb_address_t addr = usb_device_keeper_find(manager, handle);63 device_keeper_t *manager = &fun_to_hc(fun)->manager; 64 usb_address_t addr = device_keeper_find(manager, handle); 65 65 if (addr < 0) { 66 66 return addr; -
uspace/drv/ohci/root_hub.c
r7102aa5 r5971dd3 56 56 } 57 57 /*----------------------------------------------------------------------------*/ 58 int rh_request(rh_t *instance, usb_transfer_batch_t *request)58 int rh_request(rh_t *instance, batch_t *request) 59 59 { 60 60 assert(instance); … … 66 66 } 67 67 usb_log_error("Root hub request processing not implemented.\n"); 68 usb_transfer_batch_finish(request, ENOTSUP);68 batch_finish(request, ENOTSUP); 69 69 return EOK; 70 70 } -
uspace/drv/ohci/root_hub.h
r7102aa5 r5971dd3 49 49 int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs); 50 50 51 int rh_request(rh_t *instance, usb_transfer_batch_t *request);51 int rh_request(rh_t *instance, batch_t *request); 52 52 53 53 void rh_interrupt(rh_t *instance); -
uspace/drv/uhci-hcd/batch.c
r7102aa5 r5971dd3 50 50 td_t *tds; 51 51 size_t packets; 52 usb_device_keeper_t *manager;52 device_keeper_t *manager; 53 53 } uhci_batch_t; 54 54 55 static void batch_control( usb_transfer_batch_t *instance,55 static void batch_control(batch_t *instance, 56 56 usb_packet_id data_stage, usb_packet_id status_stage); 57 static void batch_data( usb_transfer_batch_t *instance, usb_packet_id pid);58 static void batch_call_in_and_dispose( usb_transfer_batch_t *instance);59 static void batch_call_out_and_dispose( usb_transfer_batch_t *instance);57 static void batch_data(batch_t *instance, usb_packet_id pid); 58 static void batch_call_in_and_dispose(batch_t *instance); 59 static void batch_call_out_and_dispose(batch_t *instance); 60 60 61 61 … … 82 82 * transaction and callback. 83 83 */ 84 usb_transfer_batch_t * batch_get(ddf_fun_t *fun, usb_target_t target,84 batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, 85 85 usb_transfer_type_t transfer_type, size_t max_packet_size, 86 86 usb_speed_t speed, char *buffer, size_t buffer_size, … … 88 88 usbhc_iface_transfer_in_callback_t func_in, 89 89 usbhc_iface_transfer_out_callback_t func_out, void *arg, 90 usb_device_keeper_t *manager90 device_keeper_t *manager 91 91 ) 92 92 { … … 103 103 } else (void)0 104 104 105 usb_transfer_batch_t *instance = malloc(sizeof(usb_transfer_batch_t));105 batch_t *instance = malloc(sizeof(batch_t)); 106 106 CHECK_NULL_DISPOSE_RETURN(instance, 107 107 "Failed to allocate batch instance.\n"); 108 usb_transfer_batch_init(instance, target, transfer_type, speed, max_packet_size,108 batch_init(instance, target, transfer_type, speed, max_packet_size, 109 109 buffer, NULL, buffer_size, NULL, setup_size, func_in, 110 110 func_out, arg, fun, NULL); … … 161 161 * is reached. 162 162 */ 163 bool batch_is_complete( usb_transfer_batch_t *instance)163 bool batch_is_complete(batch_t *instance) 164 164 { 165 165 assert(instance); … … 182 182 td_print_status(&data->tds[i]); 183 183 184 usb_device_keeper_set_toggle(data->manager,184 device_keeper_set_toggle(data->manager, 185 185 instance->target, instance->direction, 186 186 td_toggle(&data->tds[i])); … … 205 205 * Uses genercir control function with pids OUT and IN. 206 206 */ 207 void batch_control_write( usb_transfer_batch_t *instance)207 void batch_control_write(batch_t *instance) 208 208 { 209 209 assert(instance); … … 222 222 * Uses generic control with pids IN and OUT. 223 223 */ 224 void batch_control_read( usb_transfer_batch_t *instance)224 void batch_control_read(batch_t *instance) 225 225 { 226 226 assert(instance); … … 236 236 * Data transaction with PID_IN. 237 237 */ 238 void batch_interrupt_in( usb_transfer_batch_t *instance)238 void batch_interrupt_in(batch_t *instance) 239 239 { 240 240 assert(instance); … … 251 251 * Data transaction with PID_OUT. 252 252 */ 253 void batch_interrupt_out( usb_transfer_batch_t *instance)253 void batch_interrupt_out(batch_t *instance) 254 254 { 255 255 assert(instance); … … 269 269 * Data transaction with PID_IN. 270 270 */ 271 void batch_bulk_in( usb_transfer_batch_t *instance)271 void batch_bulk_in(batch_t *instance) 272 272 { 273 273 assert(instance); … … 284 284 * Data transaction with PID_OUT. 285 285 */ 286 void batch_bulk_out( usb_transfer_batch_t *instance)286 void batch_bulk_out(batch_t *instance) 287 287 { 288 288 assert(instance); … … 304 304 * The last packet is marked with IOC flag. 305 305 */ 306 void batch_data( usb_transfer_batch_t *instance, usb_packet_id pid)306 void batch_data(batch_t *instance, usb_packet_id pid) 307 307 { 308 308 assert(instance); … … 311 311 312 312 const bool low_speed = instance->speed == USB_SPEED_LOW; 313 int toggle = usb_device_keeper_get_toggle(313 int toggle = device_keeper_get_toggle( 314 314 data->manager, instance->target, instance->direction); 315 315 assert(toggle == 0 || toggle == 1); … … 343 343 } 344 344 td_set_ioc(&data->tds[packet - 1]); 345 usb_device_keeper_set_toggle(data->manager, instance->target,345 device_keeper_set_toggle(data->manager, instance->target, 346 346 instance->direction, toggle); 347 347 } … … 358 358 * The last packet is marked with IOC. 359 359 */ 360 void batch_control( usb_transfer_batch_t *instance,360 void batch_control(batch_t *instance, 361 361 usb_packet_id data_stage, usb_packet_id status_stage) 362 362 { … … 411 411 } 412 412 /*----------------------------------------------------------------------------*/ 413 qh_t * batch_qh( usb_transfer_batch_t *instance)413 qh_t * batch_qh(batch_t *instance) 414 414 { 415 415 assert(instance); … … 423 423 * @param[in] instance Batch structure to use. 424 424 */ 425 void batch_call_in_and_dispose( usb_transfer_batch_t *instance)426 { 427 assert(instance); 428 usb_transfer_batch_call_in(instance);425 void batch_call_in_and_dispose(batch_t *instance) 426 { 427 assert(instance); 428 batch_call_in(instance); 429 429 batch_dispose(instance); 430 430 } … … 434 434 * @param[in] instance Batch structure to use. 435 435 */ 436 void batch_call_out_and_dispose( usb_transfer_batch_t *instance)437 { 438 assert(instance); 439 usb_transfer_batch_call_out(instance);436 void batch_call_out_and_dispose(batch_t *instance) 437 { 438 assert(instance); 439 batch_call_out(instance); 440 440 batch_dispose(instance); 441 441 } … … 445 445 * @param[in] instance Batch structure to use. 446 446 */ 447 void batch_dispose( usb_transfer_batch_t *instance)447 void batch_dispose(batch_t *instance) 448 448 { 449 449 assert(instance); -
uspace/drv/uhci-hcd/batch.h
r7102aa5 r5971dd3 44 44 #include "uhci_struct/queue_head.h" 45 45 46 usb_transfer_batch_t * batch_get(46 batch_t * batch_get( 47 47 ddf_fun_t *fun, 48 48 usb_target_t target, … … 57 57 usbhc_iface_transfer_out_callback_t func_out, 58 58 void *arg, 59 usb_device_keeper_t *manager59 device_keeper_t *manager 60 60 ); 61 61 62 void batch_dispose( usb_transfer_batch_t *instance);62 void batch_dispose(batch_t *instance); 63 63 64 bool batch_is_complete( usb_transfer_batch_t *instance);64 bool batch_is_complete(batch_t *instance); 65 65 66 void batch_control_write( usb_transfer_batch_t *instance);66 void batch_control_write(batch_t *instance); 67 67 68 void batch_control_read( usb_transfer_batch_t *instance);68 void batch_control_read(batch_t *instance); 69 69 70 void batch_interrupt_in( usb_transfer_batch_t *instance);70 void batch_interrupt_in(batch_t *instance); 71 71 72 void batch_interrupt_out( usb_transfer_batch_t *instance);72 void batch_interrupt_out(batch_t *instance); 73 73 74 void batch_bulk_in( usb_transfer_batch_t *instance);74 void batch_bulk_in(batch_t *instance); 75 75 76 void batch_bulk_out( usb_transfer_batch_t *instance);76 void batch_bulk_out(batch_t *instance); 77 77 78 qh_t * batch_qh( usb_transfer_batch_t *instance);78 qh_t * batch_qh(batch_t *instance); 79 79 #endif 80 80 /** -
uspace/drv/uhci-hcd/iface.c
r7102aa5 r5971dd3 55 55 assert(hc); 56 56 usb_log_debug("Default address request with speed %d.\n", speed); 57 usb_device_keeper_reserve_default_address(&hc->device_manager, speed);57 device_keeper_reserve_default(&hc->device_manager, speed); 58 58 return EOK; 59 59 } … … 70 70 assert(hc); 71 71 usb_log_debug("Default address release.\n"); 72 usb_device_keeper_release_default_address(&hc->device_manager);72 device_keeper_release_default(&hc->device_manager); 73 73 return EOK; 74 74 } … … 90 90 91 91 usb_log_debug("Address request with speed %d.\n", speed); 92 *address = device_keeper_ get_free_address(&hc->device_manager, speed);92 *address = device_keeper_request(&hc->device_manager, speed); 93 93 usb_log_debug("Address request with result: %d.\n", *address); 94 94 if (*address <= 0) … … 111 111 assert(hc); 112 112 usb_log_debug("Address bind %d-%d.\n", address, handle); 113 usb_device_keeper_bind(&hc->device_manager, address, handle);113 device_keeper_bind(&hc->device_manager, address, handle); 114 114 return EOK; 115 115 } … … 127 127 assert(hc); 128 128 usb_log_debug("Address release %d.\n", address); 129 usb_device_keeper_release(&hc->device_manager, address);129 device_keeper_release(&hc->device_manager, address); 130 130 return EOK; 131 131 } … … 149 149 uhci_hc_t *hc = fun_to_uhci_hc(fun); 150 150 assert(hc); 151 usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);151 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 152 152 153 153 usb_log_debug("Interrupt OUT %d:%d %zu(%zu).\n", 154 154 target.address, target.endpoint, size, max_packet_size); 155 155 156 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,156 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, 157 157 max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg, 158 158 &hc->device_manager); … … 186 186 uhci_hc_t *hc = fun_to_uhci_hc(fun); 187 187 assert(hc); 188 usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);188 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 189 189 usb_log_debug("Interrupt IN %d:%d %zu(%zu).\n", 190 190 target.address, target.endpoint, size, max_packet_size); 191 191 192 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,192 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, 193 193 max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg, 194 194 &hc->device_manager); … … 222 222 uhci_hc_t *hc = fun_to_uhci_hc(fun); 223 223 assert(hc); 224 usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);224 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 225 225 226 226 usb_log_debug("Bulk OUT %d:%d %zu(%zu).\n", 227 227 target.address, target.endpoint, size, max_packet_size); 228 228 229 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,229 batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK, 230 230 max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg, 231 231 &hc->device_manager); … … 259 259 uhci_hc_t *hc = fun_to_uhci_hc(fun); 260 260 assert(hc); 261 usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);261 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 262 262 usb_log_debug("Bulk IN %d:%d %zu(%zu).\n", 263 263 target.address, target.endpoint, size, max_packet_size); 264 264 265 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,265 batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK, 266 266 max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg, 267 267 &hc->device_manager); … … 298 298 uhci_hc_t *hc = fun_to_uhci_hc(fun); 299 299 assert(hc); 300 usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);300 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 301 301 usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n", 302 302 speed, target.address, target.endpoint, size, max_packet_size); … … 305 305 return EINVAL; 306 306 307 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,307 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, 308 308 max_packet_size, speed, data, size, setup_data, setup_size, 309 309 NULL, callback, arg, &hc->device_manager); 310 310 if (!batch) 311 311 return ENOMEM; 312 usb_device_keeper_reset_if_need(&hc->device_manager, target, setup_data);312 device_keeper_reset_if_need(&hc->device_manager, target, setup_data); 313 313 batch_control_write(batch); 314 314 const int ret = uhci_hc_schedule(hc, batch); … … 341 341 uhci_hc_t *hc = fun_to_uhci_hc(fun); 342 342 assert(hc); 343 usb_speed_t speed = usb_device_keeper_get_speed(&hc->device_manager, target.address);343 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 344 344 345 345 usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n", 346 346 speed, target.address, target.endpoint, size, max_packet_size); 347 usb_transfer_batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,347 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, 348 348 max_packet_size, speed, data, size, setup_data, setup_size, callback, 349 349 NULL, arg, &hc->device_manager); -
uspace/drv/uhci-hcd/transfer_list.c
r7102aa5 r5971dd3 38 38 39 39 static void transfer_list_remove_batch( 40 transfer_list_t *instance, usb_transfer_batch_t *batch);40 transfer_list_t *instance, batch_t *batch); 41 41 /*----------------------------------------------------------------------------*/ 42 42 /** Initialize transfer list structures. … … 92 92 * The batch is added to the end of the list and queue. 93 93 */ 94 void transfer_list_add_batch(transfer_list_t *instance, usb_transfer_batch_t *batch)94 void transfer_list_add_batch(transfer_list_t *instance, batch_t *batch) 95 95 { 96 96 assert(instance); … … 115 115 } else { 116 116 /* There is something scheduled */ 117 usb_transfer_batch_t *last = list_get_instance(118 instance->batch_list.prev, usb_transfer_batch_t, link);117 batch_t *last = list_get_instance( 118 instance->batch_list.prev, batch_t, link); 119 119 qh_set_next_qh(batch_qh(last), pa); 120 120 } … … 122 122 list_append(&batch->link, &instance->batch_list); 123 123 124 usb_transfer_batch_t *first = list_get_instance(125 instance->batch_list.next, usb_transfer_batch_t, link);124 batch_t *first = list_get_instance( 125 instance->batch_list.next, batch_t, link); 126 126 usb_log_debug("Batch(%p) added to queue %s, first is %p.\n", 127 127 batch, instance->name, first); … … 148 148 while (current != &instance->batch_list) { 149 149 link_t *next = current->next; 150 usb_transfer_batch_t *batch = list_get_instance(current, usb_transfer_batch_t, link);150 batch_t *batch = list_get_instance(current, batch_t, link); 151 151 152 152 if (batch_is_complete(batch)) { … … 162 162 link_t *item = done.next; 163 163 list_remove(item); 164 usb_transfer_batch_t *batch = list_get_instance(item, usb_transfer_batch_t, link);164 batch_t *batch = list_get_instance(item, batch_t, link); 165 165 batch->next_step(batch); 166 166 } … … 176 176 while (list_empty(&instance->batch_list)) { 177 177 link_t *current = instance->batch_list.next; 178 usb_transfer_batch_t *batch = list_get_instance(current, usb_transfer_batch_t, link);178 batch_t *batch = list_get_instance(current, batch_t, link); 179 179 transfer_list_remove_batch(instance, batch); 180 usb_transfer_batch_finish(batch, EIO);180 batch_finish(batch, EIO); 181 181 } 182 182 fibril_mutex_unlock(&instance->guard); … … 191 191 * Does not lock the transfer list, caller is responsible for that. 192 192 */ 193 void transfer_list_remove_batch(transfer_list_t *instance, usb_transfer_batch_t *batch)193 void transfer_list_remove_batch(transfer_list_t *instance, batch_t *batch) 194 194 { 195 195 assert(instance); … … 207 207 pos = "FIRST"; 208 208 } else { 209 usb_transfer_batch_t *prev =210 list_get_instance(batch->link.prev, usb_transfer_batch_t, link);209 batch_t *prev = 210 list_get_instance(batch->link.prev, batch_t, link); 211 211 qh_set_next_qh(batch_qh(prev), batch_qh(batch)->next); 212 212 pos = "NOT FIRST"; -
uspace/drv/uhci-hcd/transfer_list.h
r7102aa5 r5971dd3 66 66 void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next); 67 67 68 void transfer_list_add_batch(transfer_list_t *instance, usb_transfer_batch_t *batch);68 void transfer_list_add_batch(transfer_list_t *instance, batch_t *batch); 69 69 70 70 void transfer_list_remove_finished(transfer_list_t *instance); -
uspace/drv/uhci-hcd/uhci.c
r7102aa5 r5971dd3 70 70 { 71 71 assert(fun); 72 usb_device_keeper_t *manager = &((uhci_t*)fun->dev->driver_data)->hc.device_manager;73 74 usb_address_t addr = usb_device_keeper_find(manager, handle);72 device_keeper_t *manager = &((uhci_t*)fun->dev->driver_data)->hc.device_manager; 73 74 usb_address_t addr = device_keeper_find(manager, handle); 75 75 if (addr < 0) { 76 76 return addr; -
uspace/drv/uhci-hcd/uhci_hc.c
r7102aa5 r5971dd3 236 236 237 237 /* Init device keeper*/ 238 usb_device_keeper_init(&instance->device_manager);238 device_keeper_init(&instance->device_manager); 239 239 usb_log_debug("Initialized device manager.\n"); 240 240 … … 318 318 * Checks for bandwidth availability and appends the batch to the proper queue. 319 319 */ 320 int uhci_hc_schedule(uhci_hc_t *instance, usb_transfer_batch_t *batch)320 int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch) 321 321 { 322 322 assert(instance); -
uspace/drv/uhci-hcd/uhci_hc.h
r7102aa5 r5971dd3 83 83 84 84 typedef struct uhci_hc { 85 usb_device_keeper_t device_manager;85 device_keeper_t device_manager; 86 86 87 87 regs_t *registers; … … 109 109 void *regs, size_t reg_size, bool interupts); 110 110 111 int uhci_hc_schedule(uhci_hc_t *instance, usb_transfer_batch_t *batch);111 int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch); 112 112 113 113 void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status); -
uspace/drv/usbhid/hiddev.c
r7102aa5 r5971dd3 184 184 * successfuly initialize the structure. 185 185 * 186 * @sa usb_ pipe_initialize_from_configuration(),186 * @sa usb_endpoint_pipe_initialize_from_configuration(), 187 187 * usbhid_dev_get_report_descriptor() 188 188 */ … … 218 218 }; 219 219 220 rc = usb_ pipe_initialize_from_configuration(220 rc = usb_endpoint_pipe_initialize_from_configuration( 221 221 endpoint_mapping, 1, descriptors, descriptors_size, 222 222 &hid_dev->wire); … … 359 359 * @return Other value inherited from one of functions 360 360 * usb_device_connection_initialize_from_device(), 361 * usb_ pipe_initialize_default_control(),362 * usb_ pipe_start_session(), usb_pipe_end_session(),361 * usb_endpoint_pipe_initialize_default_control(), 362 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 363 363 * usbhid_dev_process_descriptors(). 364 364 * … … 404 404 * Initialize device pipes. 405 405 */ 406 rc = usb_ pipe_initialize_default_control(&hid_dev->ctrl_pipe,406 rc = usb_endpoint_pipe_initialize_default_control(&hid_dev->ctrl_pipe, 407 407 &hid_dev->wire); 408 408 if (rc != EOK) { … … 411 411 return rc; 412 412 } 413 rc = usb_ pipe_probe_default_control(&hid_dev->ctrl_pipe);413 rc = usb_endpoint_pipe_probe_default_control(&hid_dev->ctrl_pipe); 414 414 if (rc != EOK) { 415 415 usb_log_error("Probing default control pipe failed: %s.\n", … … 430 430 * Get descriptors, parse descriptors and save endpoints. 431 431 */ 432 rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);432 rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 433 433 if (rc != EOK) { 434 434 usb_log_error("Failed to start session on the control pipe: %s" … … 440 440 if (rc != EOK) { 441 441 /* TODO: end session?? */ 442 usb_ pipe_end_session(&hid_dev->ctrl_pipe);442 usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 443 443 usb_log_error("Failed to process descriptors: %s.\n", 444 444 str_error(rc)); … … 446 446 } 447 447 448 rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);448 rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 449 449 if (rc != EOK) { 450 450 usb_log_warning("Failed to start session on the control pipe: " -
uspace/drv/usbhid/hiddev.h
r7102aa5 r5971dd3 68 68 usb_device_connection_t wire; 69 69 /** USB pipe corresponding to the default Control endpoint. */ 70 usb_ pipe_t ctrl_pipe;70 usb_endpoint_pipe_t ctrl_pipe; 71 71 /** USB pipe corresponding to the Interrupt In (polling) pipe. */ 72 usb_ pipe_t poll_pipe;72 usb_endpoint_pipe_t poll_pipe; 73 73 74 74 /** Polling interval retreived from the Interface descriptor. */ -
uspace/drv/usbhid/hidreq.c
r7102aa5 r5971dd3 57 57 * @retval EINVAL if no HID device is given. 58 58 * @return Other value inherited from one of functions 59 * usb_ pipe_start_session(), usb_pipe_end_session(),59 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 60 60 * usb_control_request_set(). 61 61 */ … … 76 76 int rc, sess_rc; 77 77 78 sess_rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);78 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 79 79 if (sess_rc != EOK) { 80 80 usb_log_warning("Failed to start a session: %s.\n", … … 92 92 USB_HIDREQ_SET_REPORT, value, hid_dev->iface, buffer, buf_size); 93 93 94 sess_rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);94 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 95 95 96 96 if (rc != EOK) { … … 119 119 * @retval EINVAL if no HID device is given. 120 120 * @return Other value inherited from one of functions 121 * usb_ pipe_start_session(), usb_pipe_end_session(),121 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 122 122 * usb_control_request_set(). 123 123 */ … … 137 137 int rc, sess_rc; 138 138 139 sess_rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);139 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 140 140 if (sess_rc != EOK) { 141 141 usb_log_warning("Failed to start a session: %s.\n", … … 151 151 USB_HIDREQ_SET_PROTOCOL, protocol, hid_dev->iface, NULL, 0); 152 152 153 sess_rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);153 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 154 154 155 155 if (rc != EOK) { … … 179 179 * @retval EINVAL if no HID device is given. 180 180 * @return Other value inherited from one of functions 181 * usb_ pipe_start_session(), usb_pipe_end_session(),181 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 182 182 * usb_control_request_set(). 183 183 */ … … 197 197 int rc, sess_rc; 198 198 199 sess_rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);199 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 200 200 if (sess_rc != EOK) { 201 201 usb_log_warning("Failed to start a session: %s.\n", … … 213 213 USB_HIDREQ_SET_IDLE, value, hid_dev->iface, NULL, 0); 214 214 215 sess_rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);215 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 216 216 217 217 if (rc != EOK) { … … 244 244 * @retval EINVAL if no HID device is given. 245 245 * @return Other value inherited from one of functions 246 * usb_ pipe_start_session(), usb_pipe_end_session(),246 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 247 247 * usb_control_request_set(). 248 248 */ … … 263 263 int rc, sess_rc; 264 264 265 sess_rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);265 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 266 266 if (sess_rc != EOK) { 267 267 usb_log_warning("Failed to start a session: %s.\n", … … 280 280 actual_size); 281 281 282 sess_rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);282 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 283 283 284 284 if (rc != EOK) { … … 307 307 * @retval EINVAL if no HID device is given. 308 308 * @return Other value inherited from one of functions 309 * usb_ pipe_start_session(), usb_pipe_end_session(),309 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 310 310 * usb_control_request_set(). 311 311 */ … … 325 325 int rc, sess_rc; 326 326 327 sess_rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);327 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 328 328 if (sess_rc != EOK) { 329 329 usb_log_warning("Failed to start a session: %s.\n", … … 342 342 USB_HIDREQ_GET_PROTOCOL, 0, hid_dev->iface, buffer, 1, &actual_size); 343 343 344 sess_rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);344 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 345 345 346 346 if (rc != EOK) { … … 378 378 * @retval EINVAL if no HID device is given. 379 379 * @return Other value inherited from one of functions 380 * usb_ pipe_start_session(), usb_pipe_end_session(),380 * usb_endpoint_pipe_start_session(), usb_endpoint_pipe_end_session(), 381 381 * usb_control_request_set(). 382 382 */ … … 396 396 int rc, sess_rc; 397 397 398 sess_rc = usb_ pipe_start_session(&hid_dev->ctrl_pipe);398 sess_rc = usb_endpoint_pipe_start_session(&hid_dev->ctrl_pipe); 399 399 if (sess_rc != EOK) { 400 400 usb_log_warning("Failed to start a session: %s.\n", … … 415 415 &actual_size); 416 416 417 sess_rc = usb_ pipe_end_session(&hid_dev->ctrl_pipe);417 sess_rc = usb_endpoint_pipe_end_session(&hid_dev->ctrl_pipe); 418 418 419 419 if (rc != EOK) { -
uspace/drv/usbhid/kbddev.c
r7102aa5 r5971dd3 780 780 781 781 while (true) { 782 sess_rc = usb_ pipe_start_session(782 sess_rc = usb_endpoint_pipe_start_session( 783 783 &kbd_dev->hid_dev->poll_pipe); 784 784 if (sess_rc != EOK) { … … 788 788 } 789 789 790 rc = usb_ pipe_read(&kbd_dev->hid_dev->poll_pipe,790 rc = usb_endpoint_pipe_read(&kbd_dev->hid_dev->poll_pipe, 791 791 buffer, BOOTP_BUFFER_SIZE, &actual_size); 792 792 793 sess_rc = usb_ pipe_end_session(793 sess_rc = usb_endpoint_pipe_end_session( 794 794 &kbd_dev->hid_dev->poll_pipe); 795 795 -
uspace/drv/usbhub/usbhub.c
r7102aa5 r5971dd3 224 224 } 225 225 226 usb_ pipe_start_session(hub_info->control_pipe);226 usb_endpoint_pipe_start_session(hub_info->control_pipe); 227 227 //set hub configuration 228 228 opResult = usb_hub_set_configuration(hub_info); … … 239 239 return opResult; 240 240 } 241 usb_ pipe_end_session(hub_info->control_pipe);241 usb_endpoint_pipe_end_session(hub_info->control_pipe); 242 242 243 243 … … 321 321 //reset port 322 322 usb_hub_set_reset_port_request(&request, port); 323 opResult = usb_ pipe_control_write(323 opResult = usb_endpoint_pipe_control_write( 324 324 hub->control_pipe, 325 325 &request,sizeof(usb_device_request_setup_packet_t), … … 354 354 } 355 355 //create connection to device 356 usb_ pipe_t new_device_pipe;356 usb_endpoint_pipe_t new_device_pipe; 357 357 usb_device_connection_t new_device_connection; 358 358 usb_device_connection_initialize_on_default_address( … … 360 360 &hub->connection 361 361 ); 362 usb_ pipe_initialize_default_control(362 usb_endpoint_pipe_initialize_default_control( 363 363 &new_device_pipe, 364 364 &new_device_connection); 365 usb_ pipe_probe_default_control(&new_device_pipe);365 usb_endpoint_pipe_probe_default_control(&new_device_pipe); 366 366 367 367 /* Request address from host controller. */ … … 379 379 //opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, 380 380 // new_device_address); 381 usb_ pipe_start_session(&new_device_pipe);381 usb_endpoint_pipe_start_session(&new_device_pipe); 382 382 opResult = usb_request_set_address(&new_device_pipe,new_device_address); 383 usb_ pipe_end_session(&new_device_pipe);383 usb_endpoint_pipe_end_session(&new_device_pipe); 384 384 if (opResult != EOK) { 385 385 usb_log_error("could not set address for new device %d\n",opResult); … … 488 488 usb_log_debug("interrupt at port %d\n", port); 489 489 //determine type of change 490 usb_ pipe_t *pipe = hub->control_pipe;490 usb_endpoint_pipe_t *pipe = hub->control_pipe; 491 491 492 492 int opResult; … … 499 499 //endpoint 0 500 500 501 opResult = usb_ pipe_control_read(501 opResult = usb_endpoint_pipe_control_read( 502 502 pipe, 503 503 &request, sizeof(usb_device_request_setup_packet_t), … … 560 560 int usb_hub_check_hub_changes(usb_hub_info_t * hub_info){ 561 561 int opResult; 562 opResult = usb_ pipe_start_session(562 opResult = usb_endpoint_pipe_start_session( 563 563 hub_info->status_change_pipe); 564 564 if(opResult != EOK){ … … 578 578 * Send the request. 579 579 */ 580 opResult = usb_ pipe_read(580 opResult = usb_endpoint_pipe_read( 581 581 hub_info->status_change_pipe, 582 582 change_bitmap, byte_length, &actual_size … … 586 586 free(change_bitmap); 587 587 usb_log_warning("something went wrong while getting status of hub\n"); 588 usb_ pipe_end_session(hub_info->status_change_pipe);588 usb_endpoint_pipe_end_session(hub_info->status_change_pipe); 589 589 return opResult; 590 590 } 591 591 unsigned int port; 592 opResult = usb_ pipe_start_session(hub_info->control_pipe);592 opResult = usb_endpoint_pipe_start_session(hub_info->control_pipe); 593 593 if(opResult!=EOK){ 594 594 usb_log_error("could not start control pipe session %d\n", opResult); 595 usb_ pipe_end_session(hub_info->status_change_pipe);595 usb_endpoint_pipe_end_session(hub_info->status_change_pipe); 596 596 return opResult; 597 597 } … … 600 600 usb_log_error("could not start host controller session %d\n", 601 601 opResult); 602 usb_ pipe_end_session(hub_info->control_pipe);603 usb_ pipe_end_session(hub_info->status_change_pipe);602 usb_endpoint_pipe_end_session(hub_info->control_pipe); 603 usb_endpoint_pipe_end_session(hub_info->status_change_pipe); 604 604 return opResult; 605 605 } … … 615 615 } 616 616 usb_hc_connection_close(&hub_info->connection); 617 usb_ pipe_end_session(hub_info->control_pipe);618 usb_ pipe_end_session(hub_info->status_change_pipe);617 usb_endpoint_pipe_end_session(hub_info->control_pipe); 618 usb_endpoint_pipe_end_session(hub_info->status_change_pipe); 619 619 free(change_bitmap); 620 620 return EOK; -
uspace/drv/usbhub/usbhub.h
r7102aa5 r5971dd3 58 58 /* Hub endpoints. */ 59 59 /*typedef struct { 60 usb_ pipe_t control;61 usb_ pipe_t status_change;60 usb_endpoint_pipe_t control; 61 usb_endpoint_pipe_t status_change; 62 62 } usb_hub_endpoints_t; 63 63 */ … … 88 88 * searched again and again for the 'right pipe'. 89 89 */ 90 usb_ pipe_t * status_change_pipe;90 usb_endpoint_pipe_t * status_change_pipe; 91 91 92 92 /** convenience pointer to control pipe … … 96 96 * searched again and again for the 'right pipe'. 97 97 */ 98 usb_ pipe_t * control_pipe;98 usb_endpoint_pipe_t * control_pipe; 99 99 100 100 /** generic usb device data*/ -
uspace/drv/usbhub/usbhub_private.h
r7102aa5 r5971dd3 95 95 * @return Operation result 96 96 */ 97 static inline int usb_hub_clear_port_feature(usb_ pipe_t *pipe,97 static inline int usb_hub_clear_port_feature(usb_endpoint_pipe_t *pipe, 98 98 int port_index, 99 99 usb_hub_class_feature_t feature) { … … 106 106 }; 107 107 clear_request.value = feature; 108 return usb_ pipe_control_write(pipe, &clear_request,108 return usb_endpoint_pipe_control_write(pipe, &clear_request, 109 109 sizeof(clear_request), NULL, 0); 110 110 } -
uspace/drv/usbmid/main.c
r7102aa5 r5971dd3 61 61 int rc; 62 62 63 rc = usb_ pipe_start_session(&dev->ctrl_pipe);63 rc = usb_endpoint_pipe_start_session(&dev->ctrl_pipe); 64 64 if (rc != EOK) { 65 65 usb_log_error("Failed to start session on control pipe: %s.\n", … … 70 70 bool accept = usbmid_explore_device(dev); 71 71 72 rc = usb_ pipe_end_session(&dev->ctrl_pipe);72 rc = usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 73 73 if (rc != EOK) { 74 74 usb_log_warning("Failed to end session on control pipe: %s.\n", -
uspace/drv/usbmid/usbmid.c
r7102aa5 r5971dd3 108 108 } 109 109 110 rc = usb_ pipe_initialize_default_control(&mid->ctrl_pipe,110 rc = usb_endpoint_pipe_initialize_default_control(&mid->ctrl_pipe, 111 111 &mid->wire); 112 112 if (rc != EOK) { … … 116 116 return NULL; 117 117 } 118 rc = usb_ pipe_probe_default_control(&mid->ctrl_pipe);118 rc = usb_endpoint_pipe_probe_default_control(&mid->ctrl_pipe); 119 119 if (rc != EOK) { 120 120 usb_log_error("Probing default control pipe failed: %s.\n", -
uspace/drv/usbmid/usbmid.h
r7102aa5 r5971dd3 52 52 usb_device_connection_t wire; 53 53 /** Default control pipe. */ 54 usb_ pipe_t ctrl_pipe;54 usb_endpoint_pipe_t ctrl_pipe; 55 55 } usbmid_device_t; 56 56 -
uspace/drv/usbmouse/init.c
r7102aa5 r5971dd3 126 126 127 127 /* Open the control pipe. */ 128 rc = usb_ pipe_start_session(&dev->ctrl_pipe);128 rc = usb_endpoint_pipe_start_session(&dev->ctrl_pipe); 129 129 if (rc != EOK) { 130 130 goto leave; … … 141 141 142 142 /* Close the control pipe (ignore errors). */ 143 usb_ pipe_end_session(&dev->ctrl_pipe);143 usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 144 144 145 145 -
uspace/lib/usb/include/usb/devdrv.h
r7102aa5 r5971dd3 41 41 typedef struct { 42 42 /** The default control pipe. */ 43 usb_ pipe_t ctrl_pipe;43 usb_endpoint_pipe_t ctrl_pipe; 44 44 /** Other endpoint pipes. 45 45 * This is an array of other endpoint pipes in the same order as -
uspace/lib/usb/include/usb/host/batch.h
r7102aa5 r5971dd3 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup libusb28 /** @addtogroup drvusbuhcihc 29 29 * @{ 30 30 */ 31 31 /** @file 32 * USB transfer transaction structures.32 * @brief UHCI driver USB transaction structure 33 33 */ 34 34 #ifndef LIBUSB_HOST_BATCH_H … … 40 40 #include <usb/usb.h> 41 41 42 typedef struct usb_transfer_batch usb_transfer_batch_t;43 struct usb_transfer_batch{42 typedef struct batch 43 { 44 44 link_t link; 45 45 usb_target_t target; … … 56 56 size_t max_packet_size; 57 57 size_t transfered_size; 58 void (*next_step)( usb_transfer_batch_t*);58 void (*next_step)(struct batch*); 59 59 int error; 60 60 ddf_fun_t *fun; 61 61 void *arg; 62 62 void *private_data; 63 } ;63 } batch_t; 64 64 65 void usb_transfer_batch_init(66 usb_transfer_batch_t *instance,65 void batch_init( 66 batch_t *instance, 67 67 usb_target_t target, 68 68 usb_transfer_type_t transfer_type, … … 81 81 ); 82 82 83 static inline usb_transfer_batch_t *usb_transfer_batch_from_link(link_t *l)83 static inline batch_t *batch_from_link(link_t *link_ptr) 84 84 { 85 assert(l );86 return list_get_instance(l , usb_transfer_batch_t, link);85 assert(link_ptr); 86 return list_get_instance(link_ptr, batch_t, link); 87 87 } 88 88 89 void usb_transfer_batch_call_in(usb_transfer_batch_t *instance); 90 void usb_transfer_batch_call_out(usb_transfer_batch_t *instance); 91 void usb_transfer_batch_finish(usb_transfer_batch_t *instance, int error); 92 89 void batch_call_in(batch_t *instance); 90 void batch_call_out(batch_t *instance); 91 void batch_finish(batch_t *instance, int error); 93 92 #endif 94 93 /** -
uspace/lib/usb/include/usb/host/device_keeper.h
r7102aa5 r5971dd3 31 31 */ 32 32 /** @file 33 * Device keeper structure and functions. 34 * 35 * Typical USB host controller needs to keep track of various settings for 36 * each device that is connected to it. 37 * State of toggle bit, device speed etc. etc. 38 * This structure shall simplify the management. 33 * @brief UHCI driver 39 34 */ 40 35 #ifndef LIBUSB_HOST_DEVICE_KEEPER_H … … 44 39 #include <usb/usb.h> 45 40 46 /** Number of USB address for array dimensions. */47 41 #define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1) 48 42 49 /** Information about attached USB device. */50 43 struct usb_device_info { 51 44 usb_speed_t speed; … … 55 48 }; 56 49 57 /** Host controller device keeper. 58 * You shall not access members directly but only using functions below. 59 */ 60 typedef struct { 50 typedef struct device_keeper { 61 51 struct usb_device_info devices[USB_ADDRESS_COUNT]; 62 52 fibril_mutex_t guard; 63 53 fibril_condvar_t default_address_occupied; 64 54 usb_address_t last_address; 65 } usb_device_keeper_t;55 } device_keeper_t; 66 56 67 void usb_device_keeper_init(usb_device_keeper_t *instance);57 void device_keeper_init(device_keeper_t *instance); 68 58 69 void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance,70 usb_speed_t speed);59 void device_keeper_reserve_default( 60 device_keeper_t *instance, usb_speed_t speed); 71 61 72 void usb_device_keeper_release_default_address(usb_device_keeper_t *instance);62 void device_keeper_release_default(device_keeper_t *instance); 73 63 74 void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance,75 usb_target_t target,76 const u int8_t*setup_data);64 void device_keeper_reset_if_need( 65 device_keeper_t *instance, usb_target_t target, 66 const unsigned char *setup_data); 77 67 78 int usb_device_keeper_get_toggle(usb_device_keeper_t *instance,79 usb_target_t target, usb_direction_t direction);68 int device_keeper_get_toggle( 69 device_keeper_t *instance, usb_target_t target, usb_direction_t direction); 80 70 81 int usb_device_keeper_set_toggle(usb_device_keeper_t *instance,71 int device_keeper_set_toggle(device_keeper_t *instance, 82 72 usb_target_t target, usb_direction_t direction, bool toggle); 83 73 84 usb_address_t device_keeper_ get_free_address(usb_device_keeper_t *instance,85 usb_speed_t speed);74 usb_address_t device_keeper_request( 75 device_keeper_t *instance, usb_speed_t speed); 86 76 87 void usb_device_keeper_bind(usb_device_keeper_t *instance,88 usb_address_t address, devman_handle_t handle);77 void device_keeper_bind( 78 device_keeper_t *instance, usb_address_t address, devman_handle_t handle); 89 79 90 void usb_device_keeper_release(usb_device_keeper_t *instance, 91 usb_address_t address); 80 void device_keeper_release(device_keeper_t *instance, usb_address_t address); 92 81 93 usb_address_t usb_device_keeper_find(usb_device_keeper_t *instance,94 dev man_handle_t handle);82 usb_address_t device_keeper_find( 83 device_keeper_t *instance, devman_handle_t handle); 95 84 96 usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance, 97 usb_address_t address); 98 85 usb_speed_t device_keeper_speed( 86 device_keeper_t *instance, usb_address_t address); 99 87 #endif 100 88 /** -
uspace/lib/usb/include/usb/pipes.h
r7102aa5 r5971dd3 80 80 */ 81 81 int hc_phone; 82 } usb_ pipe_t;82 } usb_endpoint_pipe_t; 83 83 84 84 … … 102 102 typedef struct { 103 103 /** Endpoint pipe. */ 104 usb_ pipe_t *pipe;104 usb_endpoint_pipe_t *pipe; 105 105 /** Endpoint description. */ 106 106 const usb_endpoint_description_t *description; … … 125 125 usb_address_t usb_device_get_assigned_address(devman_handle_t); 126 126 127 int usb_pipe_initialize(usb_pipe_t *, usb_device_connection_t *, 127 int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *, 128 usb_device_connection_t *, 128 129 usb_endpoint_t, usb_transfer_type_t, size_t, usb_direction_t); 129 int usb_ pipe_initialize_default_control(usb_pipe_t *,130 int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *, 130 131 usb_device_connection_t *); 131 int usb_ pipe_probe_default_control(usb_pipe_t *);132 int usb_ pipe_initialize_from_configuration(usb_endpoint_mapping_t *,132 int usb_endpoint_pipe_probe_default_control(usb_endpoint_pipe_t *); 133 int usb_endpoint_pipe_initialize_from_configuration(usb_endpoint_mapping_t *, 133 134 size_t, uint8_t *, size_t, usb_device_connection_t *); 134 int usb_pipe_register(usb_pipe_t *, unsigned int, usb_hc_connection_t *); 135 int usb_pipe_unregister(usb_pipe_t *, usb_hc_connection_t *); 135 int usb_endpoint_pipe_register(usb_endpoint_pipe_t *, unsigned int, 136 usb_hc_connection_t *); 137 int usb_endpoint_pipe_unregister(usb_endpoint_pipe_t *, usb_hc_connection_t *); 136 138 137 int usb_ pipe_start_session(usb_pipe_t *);138 int usb_ pipe_end_session(usb_pipe_t *);139 bool usb_ pipe_is_session_started(usb_pipe_t *);139 int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *); 140 int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *); 141 bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *); 140 142 141 int usb_ pipe_read(usb_pipe_t *, void *, size_t, size_t *);142 int usb_ pipe_write(usb_pipe_t *, void *, size_t);143 int usb_endpoint_pipe_read(usb_endpoint_pipe_t *, void *, size_t, size_t *); 144 int usb_endpoint_pipe_write(usb_endpoint_pipe_t *, void *, size_t); 143 145 144 int usb_ pipe_control_read(usb_pipe_t *, void *, size_t,146 int usb_endpoint_pipe_control_read(usb_endpoint_pipe_t *, void *, size_t, 145 147 void *, size_t, size_t *); 146 int usb_ pipe_control_write(usb_pipe_t *, void *, size_t,148 int usb_endpoint_pipe_control_write(usb_endpoint_pipe_t *, void *, size_t, 147 149 void *, size_t); 148 150 -
uspace/lib/usb/include/usb/recognise.h
r7102aa5 r5971dd3 48 48 const usb_standard_interface_descriptor_t *, match_id_list_t *); 49 49 50 int usb_device_create_match_ids(usb_ pipe_t *, match_id_list_t *);50 int usb_device_create_match_ids(usb_endpoint_pipe_t *, match_id_list_t *); 51 51 52 52 int usb_device_register_child_in_devman(usb_address_t, devman_handle_t, -
uspace/lib/usb/include/usb/request.h
r7102aa5 r5971dd3 86 86 } __attribute__ ((packed)) usb_device_request_setup_packet_t; 87 87 88 int usb_control_request_set(usb_ pipe_t *,88 int usb_control_request_set(usb_endpoint_pipe_t *, 89 89 usb_request_type_t, usb_request_recipient_t, uint8_t, 90 90 uint16_t, uint16_t, void *, size_t); 91 91 92 int usb_control_request_get(usb_ pipe_t *,92 int usb_control_request_get(usb_endpoint_pipe_t *, 93 93 usb_request_type_t, usb_request_recipient_t, uint8_t, 94 94 uint16_t, uint16_t, void *, size_t, size_t *); 95 95 96 int usb_request_get_status(usb_ pipe_t *, usb_request_recipient_t,96 int usb_request_get_status(usb_endpoint_pipe_t *, usb_request_recipient_t, 97 97 uint16_t, uint16_t *); 98 int usb_request_clear_feature(usb_ pipe_t *, usb_request_type_t,98 int usb_request_clear_feature(usb_endpoint_pipe_t *, usb_request_type_t, 99 99 usb_request_recipient_t, uint16_t, uint16_t); 100 int usb_request_set_feature(usb_ pipe_t *, usb_request_type_t,100 int usb_request_set_feature(usb_endpoint_pipe_t *, usb_request_type_t, 101 101 usb_request_recipient_t, uint16_t, uint16_t); 102 int usb_request_set_address(usb_ pipe_t *, usb_address_t);103 int usb_request_get_descriptor(usb_ pipe_t *, usb_request_type_t,102 int usb_request_set_address(usb_endpoint_pipe_t *, usb_address_t); 103 int usb_request_get_descriptor(usb_endpoint_pipe_t *, usb_request_type_t, 104 104 usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t, 105 105 size_t *); 106 int usb_request_get_descriptor_alloc(usb_ pipe_t *, usb_request_type_t,106 int usb_request_get_descriptor_alloc(usb_endpoint_pipe_t *, usb_request_type_t, 107 107 usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void **, size_t *); 108 int usb_request_get_device_descriptor(usb_ pipe_t *,108 int usb_request_get_device_descriptor(usb_endpoint_pipe_t *, 109 109 usb_standard_device_descriptor_t *); 110 int usb_request_get_bare_configuration_descriptor(usb_ pipe_t *, int,110 int usb_request_get_bare_configuration_descriptor(usb_endpoint_pipe_t *, int, 111 111 usb_standard_configuration_descriptor_t *); 112 int usb_request_get_full_configuration_descriptor(usb_ pipe_t *, int,112 int usb_request_get_full_configuration_descriptor(usb_endpoint_pipe_t *, int, 113 113 void *, size_t, size_t *); 114 int usb_request_get_full_configuration_descriptor_alloc(usb_ pipe_t *,114 int usb_request_get_full_configuration_descriptor_alloc(usb_endpoint_pipe_t *, 115 115 int, void **, size_t *); 116 int usb_request_set_descriptor(usb_ pipe_t *, usb_request_type_t,116 int usb_request_set_descriptor(usb_endpoint_pipe_t *, usb_request_type_t, 117 117 usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t); 118 int usb_request_get_configuration(usb_ pipe_t *, uint8_t *);119 int usb_request_set_configuration(usb_ pipe_t *, uint8_t);120 int usb_request_get_interface(usb_ pipe_t *, uint8_t, uint8_t *);121 int usb_request_set_interface(usb_ pipe_t *, uint8_t, uint8_t);118 int usb_request_get_configuration(usb_endpoint_pipe_t *, uint8_t *); 119 int usb_request_set_configuration(usb_endpoint_pipe_t *, uint8_t); 120 int usb_request_get_interface(usb_endpoint_pipe_t *, uint8_t, uint8_t *); 121 int usb_request_set_interface(usb_endpoint_pipe_t *, uint8_t, uint8_t); 122 122 123 int usb_request_get_supported_languages(usb_ pipe_t *,123 int usb_request_get_supported_languages(usb_endpoint_pipe_t *, 124 124 l18_win_locales_t **, size_t *); 125 int usb_request_get_string(usb_ pipe_t *, size_t, l18_win_locales_t,125 int usb_request_get_string(usb_endpoint_pipe_t *, size_t, l18_win_locales_t, 126 126 char **); 127 127 -
uspace/lib/usb/src/devdrv.c
r7102aa5 r5971dd3 126 126 127 127 for (i = 0; i < pipe_count; i++) { 128 dev->pipes[i].pipe = malloc(sizeof(usb_ pipe_t));128 dev->pipes[i].pipe = malloc(sizeof(usb_endpoint_pipe_t)); 129 129 if (dev->pipes[i].pipe == NULL) { 130 130 usb_log_oom(dev->ddf_dev); … … 147 147 } 148 148 149 rc = usb_ pipe_initialize_from_configuration(dev->pipes,149 rc = usb_endpoint_pipe_initialize_from_configuration(dev->pipes, 150 150 pipe_count, config_descriptor, config_descriptor_size, &dev->wire); 151 151 if (rc != EOK) { … … 172 172 for (i = 0; i < pipe_count; i++) { 173 173 if (dev->pipes[i].present) { 174 rc = usb_ pipe_register(dev->pipes[i].pipe,174 rc = usb_endpoint_pipe_register(dev->pipes[i].pipe, 175 175 dev->pipes[i].descriptor->poll_interval, 176 176 &hc_conn); … … 219 219 } 220 220 221 rc = usb_ pipe_initialize_default_control(&dev->ctrl_pipe,221 rc = usb_endpoint_pipe_initialize_default_control(&dev->ctrl_pipe, 222 222 &dev->wire); 223 223 if (rc != EOK) { … … 228 228 } 229 229 230 rc = usb_ pipe_probe_default_control(&dev->ctrl_pipe);230 rc = usb_endpoint_pipe_probe_default_control(&dev->ctrl_pipe); 231 231 if (rc != EOK) { 232 232 usb_log_error( … … 240 240 * default control pipe. 241 241 */ 242 rc = usb_ pipe_start_session(&dev->ctrl_pipe);242 rc = usb_endpoint_pipe_start_session(&dev->ctrl_pipe); 243 243 if (rc != EOK) { 244 244 usb_log_error("Failed to start an IPC session: %s.\n", … … 252 252 253 253 /* No checking here. */ 254 usb_ pipe_end_session(&dev->ctrl_pipe);254 usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 255 255 256 256 return rc; -
uspace/lib/usb/src/devpoll.c
r7102aa5 r5971dd3 64 64 assert(polling_data); 65 65 66 usb_ pipe_t *pipe66 usb_endpoint_pipe_t *pipe 67 67 = polling_data->dev->pipes[polling_data->pipe_index].pipe; 68 68 … … 71 71 int rc; 72 72 73 rc = usb_ pipe_start_session(pipe);73 rc = usb_endpoint_pipe_start_session(pipe); 74 74 if (rc != EOK) { 75 75 failed_attempts++; … … 78 78 79 79 size_t actual_size; 80 rc = usb_ pipe_read(pipe, polling_data->buffer,80 rc = usb_endpoint_pipe_read(pipe, polling_data->buffer, 81 81 polling_data->request_size, &actual_size); 82 82 83 83 /* Quit the session regardless of errors. */ 84 usb_ pipe_end_session(pipe);84 usb_endpoint_pipe_end_session(pipe); 85 85 86 86 if (rc != EOK) { -
uspace/lib/usb/src/host/batch.c
r7102aa5 r5971dd3 30 30 */ 31 31 /** @file 32 * USB transfer transaction structures (implementation).32 * @brief OHCI driver USB transaction structure 33 33 */ 34 34 #include <errno.h> … … 39 39 #include <usb/host/batch.h> 40 40 41 void usb_transfer_batch_init(42 usb_transfer_batch_t *instance,41 void batch_init( 42 batch_t *instance, 43 43 usb_target_t target, 44 44 usb_transfer_type_t transfer_type, … … 85 85 * 86 86 */ 87 void usb_transfer_batch_finish(usb_transfer_batch_t *instance, int error)87 void batch_finish(batch_t *instance, int error) 88 88 { 89 89 assert(instance); … … 98 98 * parameters. 99 99 */ 100 void usb_transfer_batch_call_in(usb_transfer_batch_t *instance)100 void batch_call_in(batch_t *instance) 101 101 { 102 102 assert(instance); … … 120 120 * @param[in] instance Batch structure to use. 121 121 */ 122 void usb_transfer_batch_call_out(usb_transfer_batch_t *instance)122 void batch_call_out(batch_t *instance) 123 123 { 124 124 assert(instance); -
uspace/lib/usb/src/host/device_keeper.c
r7102aa5 r5971dd3 31 31 */ 32 32 /** @file 33 * Device keeper structure and functions (implementation).33 * @brief UHCI driver 34 34 */ 35 35 #include <assert.h> … … 45 45 * Set all values to false/0. 46 46 */ 47 void usb_device_keeper_init(usb_device_keeper_t *instance)47 void device_keeper_init(device_keeper_t *instance) 48 48 { 49 49 assert(instance); … … 65 65 * @param[in] speed Speed of the device requesting default address. 66 66 */ 67 void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance, 68 usb_speed_t speed) 67 void device_keeper_reserve_default(device_keeper_t *instance, usb_speed_t speed) 69 68 { 70 69 assert(instance); … … 84 83 * @param[in] speed Speed of the device requesting default address. 85 84 */ 86 void usb_device_keeper_release_default_address(usb_device_keeper_t *instance)85 void device_keeper_release_default(device_keeper_t *instance) 87 86 { 88 87 assert(instance); … … 101 100 * Really ugly one. 102 101 */ 103 void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance,104 usb_target_t target, const uint8_t*data)102 void device_keeper_reset_if_need( 103 device_keeper_t *instance, usb_target_t target, const unsigned char *data) 105 104 { 106 105 assert(instance); … … 145 144 * @return Error code 146 145 */ 147 int usb_device_keeper_get_toggle(usb_device_keeper_t *instance,148 usb_target_t target, usb_direction_t direction)146 int device_keeper_get_toggle( 147 device_keeper_t *instance, usb_target_t target, usb_direction_t direction) 149 148 { 150 149 assert(instance); … … 174 173 * @return Error code. 175 174 */ 176 int usb_device_keeper_set_toggle(usb_device_keeper_t *instance,175 int device_keeper_set_toggle(device_keeper_t *instance, 177 176 usb_target_t target, usb_direction_t direction, bool toggle) 178 177 { … … 208 207 * @return Free address, or error code. 209 208 */ 210 usb_address_t device_keeper_ get_free_address(usb_device_keeper_t *instance,211 usb_speed_t speed)209 usb_address_t device_keeper_request( 210 device_keeper_t *instance, usb_speed_t speed) 212 211 { 213 212 assert(instance); … … 242 241 * @param[in] handle Devman handle of the device. 243 242 */ 244 void usb_device_keeper_bind(usb_device_keeper_t *instance,245 usb_address_t address, devman_handle_t handle)243 void device_keeper_bind( 244 device_keeper_t *instance, usb_address_t address, devman_handle_t handle) 246 245 { 247 246 assert(instance); … … 259 258 * @param[in] address Device address 260 259 */ 261 void usb_device_keeper_release(usb_device_keeper_t *instance, 262 usb_address_t address) 260 void device_keeper_release(device_keeper_t *instance, usb_address_t address) 263 261 { 264 262 assert(instance); … … 278 276 * @return USB Address, or error code. 279 277 */ 280 usb_address_t usb_device_keeper_find(usb_device_keeper_t *instance,281 dev man_handle_t handle)278 usb_address_t device_keeper_find( 279 device_keeper_t *instance, devman_handle_t handle) 282 280 { 283 281 assert(instance); … … 301 299 * @return USB speed. 302 300 */ 303 usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance,304 usb_address_t address)301 usb_speed_t device_keeper_speed( 302 device_keeper_t *instance, usb_address_t address) 305 303 { 306 304 assert(instance); … … 309 307 return instance->devices[address].speed; 310 308 } 311 312 309 /** 313 310 * @} -
uspace/lib/usb/src/hub.c
r7102aa5 r5971dd3 228 228 } 229 229 230 usb_ pipe_t ctrl_pipe;231 rc = usb_ pipe_initialize_default_control(&ctrl_pipe,230 usb_endpoint_pipe_t ctrl_pipe; 231 rc = usb_endpoint_pipe_initialize_default_control(&ctrl_pipe, 232 232 &dev_conn); 233 233 if (rc != EOK) { … … 235 235 goto leave_release_default_address; 236 236 } 237 rc = usb_ pipe_probe_default_control(&ctrl_pipe);237 rc = usb_endpoint_pipe_probe_default_control(&ctrl_pipe); 238 238 if (rc != EOK) { 239 239 rc = ENOTCONN; … … 241 241 } 242 242 243 rc = usb_ pipe_start_session(&ctrl_pipe);243 rc = usb_endpoint_pipe_start_session(&ctrl_pipe); 244 244 if (rc != EOK) { 245 245 rc = ENOTCONN; … … 253 253 } 254 254 255 usb_ pipe_end_session(&ctrl_pipe);255 usb_endpoint_pipe_end_session(&ctrl_pipe); 256 256 257 257 /* … … 306 306 307 307 leave_stop_session: 308 usb_ pipe_end_session(&ctrl_pipe);308 usb_endpoint_pipe_end_session(&ctrl_pipe); 309 309 310 310 leave_release_default_address: -
uspace/lib/usb/src/pipes.c
r7102aa5 r5971dd3 233 233 * A session is something inside what any communication occurs. 234 234 * It is expected that sessions would be started right before the transfer 235 * and ended - see usb_ pipe_end_session() - after the last235 * and ended - see usb_endpoint_pipe_end_session() - after the last 236 236 * transfer. 237 237 * The reason for this is that session actually opens some communication … … 244 244 * @return Error code. 245 245 */ 246 int usb_ pipe_start_session(usb_pipe_t *pipe)246 int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *pipe) 247 247 { 248 248 assert(pipe); 249 249 250 if (usb_ pipe_is_session_started(pipe)) {250 if (usb_endpoint_pipe_is_session_started(pipe)) { 251 251 return EBUSY; 252 252 } … … 265 265 /** Ends a session on the endpoint pipe. 266 266 * 267 * @see usb_ pipe_start_session267 * @see usb_endpoint_pipe_start_session 268 268 * 269 269 * @param pipe Endpoint pipe to end the session on. 270 270 * @return Error code. 271 271 */ 272 int usb_ pipe_end_session(usb_pipe_t *pipe)272 int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *pipe) 273 273 { 274 274 assert(pipe); 275 275 276 if (!usb_ pipe_is_session_started(pipe)) {276 if (!usb_endpoint_pipe_is_session_started(pipe)) { 277 277 return ENOENT; 278 278 } … … 296 296 * @return Whether @p pipe has opened a session. 297 297 */ 298 bool usb_ pipe_is_session_started(usb_pipe_t *pipe)298 bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *pipe) 299 299 { 300 300 return (pipe->hc_phone >= 0); -
uspace/lib/usb/src/pipesinit.c
r7102aa5 r5971dd3 193 193 } 194 194 195 int rc = usb_ pipe_initialize(ep_mapping->pipe, wire,195 int rc = usb_endpoint_pipe_initialize(ep_mapping->pipe, wire, 196 196 ep_no, description.transfer_type, endpoint->max_packet_size, 197 197 description.direction); … … 276 276 * @return Error code. 277 277 */ 278 int usb_ pipe_initialize_from_configuration(278 int usb_endpoint_pipe_initialize_from_configuration( 279 279 usb_endpoint_mapping_t *mapping, size_t mapping_count, 280 280 uint8_t *configuration_descriptor, size_t configuration_descriptor_size, … … 342 342 * @return Error code. 343 343 */ 344 int usb_ pipe_initialize(usb_pipe_t *pipe,344 int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *pipe, 345 345 usb_device_connection_t *connection, usb_endpoint_t endpoint_no, 346 346 usb_transfer_type_t transfer_type, size_t max_packet_size, … … 367 367 * @return Error code. 368 368 */ 369 int usb_ pipe_initialize_default_control(usb_pipe_t *pipe,369 int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *pipe, 370 370 usb_device_connection_t *connection) 371 371 { … … 373 373 assert(connection); 374 374 375 int rc = usb_ pipe_initialize(pipe, connection,375 int rc = usb_endpoint_pipe_initialize(pipe, connection, 376 376 0, USB_TRANSFER_CONTROL, CTRL_PIPE_MIN_PACKET_SIZE, 377 377 USB_DIRECTION_BOTH); … … 390 390 * @return Error code. 391 391 */ 392 int usb_ pipe_probe_default_control(usb_pipe_t *pipe)392 int usb_endpoint_pipe_probe_default_control(usb_endpoint_pipe_t *pipe) 393 393 { 394 394 assert(pipe); … … 408 408 409 409 TRY_LOOP(failed_attempts) { 410 rc = usb_ pipe_start_session(pipe);410 rc = usb_endpoint_pipe_start_session(pipe); 411 411 if (rc == EOK) { 412 412 break; … … 433 433 } 434 434 } 435 usb_ pipe_end_session(pipe);435 usb_endpoint_pipe_end_session(pipe); 436 436 if (rc != EOK) { 437 437 return rc; … … 451 451 * @return Error code. 452 452 */ 453 int usb_ pipe_register(usb_pipe_t *pipe,453 int usb_endpoint_pipe_register(usb_endpoint_pipe_t *pipe, 454 454 unsigned int interval, 455 455 usb_hc_connection_t *hc_connection) … … 479 479 * @return Error code. 480 480 */ 481 int usb_ pipe_unregister(usb_pipe_t *pipe,481 int usb_endpoint_pipe_unregister(usb_endpoint_pipe_t *pipe, 482 482 usb_hc_connection_t *hc_connection) 483 483 { -
uspace/lib/usb/src/pipesio.c
r7102aa5 r5971dd3 58 58 * @return Error code. 59 59 */ 60 static int usb_ pipe_read_no_checks(usb_pipe_t *pipe,60 static int usb_endpoint_pipe_read_no_checks(usb_endpoint_pipe_t *pipe, 61 61 void *buffer, size_t size, size_t *size_transfered) 62 62 { … … 140 140 * @return Error code. 141 141 */ 142 int usb_ pipe_read(usb_pipe_t *pipe,142 int usb_endpoint_pipe_read(usb_endpoint_pipe_t *pipe, 143 143 void *buffer, size_t size, size_t *size_transfered) 144 144 { … … 153 153 } 154 154 155 if (!usb_ pipe_is_session_started(pipe)) {155 if (!usb_endpoint_pipe_is_session_started(pipe)) { 156 156 return EBADF; 157 157 } … … 168 168 int rc; 169 169 170 rc = usb_ pipe_read_no_checks(pipe, buffer, size, &act_size);170 rc = usb_endpoint_pipe_read_no_checks(pipe, buffer, size, &act_size); 171 171 if (rc != EOK) { 172 172 return rc; … … 190 190 * @return Error code. 191 191 */ 192 static int usb_ pipe_write_no_check(usb_pipe_t *pipe,192 static int usb_endpoint_pipe_write_no_check(usb_endpoint_pipe_t *pipe, 193 193 void *buffer, size_t size) 194 194 { … … 247 247 * @return Error code. 248 248 */ 249 int usb_ pipe_write(usb_pipe_t *pipe,249 int usb_endpoint_pipe_write(usb_endpoint_pipe_t *pipe, 250 250 void *buffer, size_t size) 251 251 { … … 260 260 } 261 261 262 if (!usb_ pipe_is_session_started(pipe)) {262 if (!usb_endpoint_pipe_is_session_started(pipe)) { 263 263 return EBADF; 264 264 } … … 272 272 } 273 273 274 int rc = usb_ pipe_write_no_check(pipe, buffer, size);274 int rc = usb_endpoint_pipe_write_no_check(pipe, buffer, size); 275 275 276 276 return rc; … … 289 289 * @return Error code. 290 290 */ 291 static int usb_ pipe_control_read_no_check(usb_pipe_t *pipe,291 static int usb_endpoint_pipe_control_read_no_check(usb_endpoint_pipe_t *pipe, 292 292 void *setup_buffer, size_t setup_buffer_size, 293 293 void *data_buffer, size_t data_buffer_size, size_t *data_transfered_size) … … 365 365 * @return Error code. 366 366 */ 367 int usb_ pipe_control_read(usb_pipe_t *pipe,367 int usb_endpoint_pipe_control_read(usb_endpoint_pipe_t *pipe, 368 368 void *setup_buffer, size_t setup_buffer_size, 369 369 void *data_buffer, size_t data_buffer_size, size_t *data_transfered_size) … … 379 379 } 380 380 381 if (!usb_ pipe_is_session_started(pipe)) {381 if (!usb_endpoint_pipe_is_session_started(pipe)) { 382 382 return EBADF; 383 383 } … … 389 389 390 390 size_t act_size = 0; 391 int rc = usb_ pipe_control_read_no_check(pipe,391 int rc = usb_endpoint_pipe_control_read_no_check(pipe, 392 392 setup_buffer, setup_buffer_size, 393 393 data_buffer, data_buffer_size, &act_size); … … 414 414 * @return Error code. 415 415 */ 416 static int usb_ pipe_control_write_no_check(usb_pipe_t *pipe,416 static int usb_endpoint_pipe_control_write_no_check(usb_endpoint_pipe_t *pipe, 417 417 void *setup_buffer, size_t setup_buffer_size, 418 418 void *data_buffer, size_t data_buffer_size) … … 473 473 * @return Error code. 474 474 */ 475 int usb_ pipe_control_write(usb_pipe_t *pipe,475 int usb_endpoint_pipe_control_write(usb_endpoint_pipe_t *pipe, 476 476 void *setup_buffer, size_t setup_buffer_size, 477 477 void *data_buffer, size_t data_buffer_size) … … 491 491 } 492 492 493 if (!usb_ pipe_is_session_started(pipe)) {493 if (!usb_endpoint_pipe_is_session_started(pipe)) { 494 494 return EBADF; 495 495 } … … 500 500 } 501 501 502 int rc = usb_ pipe_control_write_no_check(pipe,502 int rc = usb_endpoint_pipe_control_write_no_check(pipe, 503 503 setup_buffer, setup_buffer_size, data_buffer, data_buffer_size); 504 504 -
uspace/lib/usb/src/recognise.c
r7102aa5 r5971dd3 311 311 * @return Error code. 312 312 */ 313 int usb_device_create_match_ids(usb_ pipe_t *ctrl_pipe,313 int usb_device_create_match_ids(usb_endpoint_pipe_t *ctrl_pipe, 314 314 match_id_list_t *matches) 315 315 { … … 363 363 int rc; 364 364 usb_device_connection_t dev_connection; 365 usb_ pipe_t ctrl_pipe;365 usb_endpoint_pipe_t ctrl_pipe; 366 366 367 367 rc = usb_device_connection_initialize(&dev_connection, hc_handle, address); … … 370 370 } 371 371 372 rc = usb_ pipe_initialize_default_control(&ctrl_pipe,372 rc = usb_endpoint_pipe_initialize_default_control(&ctrl_pipe, 373 373 &dev_connection); 374 374 if (rc != EOK) { 375 375 goto failure; 376 376 } 377 rc = usb_ pipe_probe_default_control(&ctrl_pipe);377 rc = usb_endpoint_pipe_probe_default_control(&ctrl_pipe); 378 378 if (rc != EOK) { 379 379 goto failure; … … 404 404 child->driver_data = dev_data; 405 405 406 rc = usb_ pipe_start_session(&ctrl_pipe);406 rc = usb_endpoint_pipe_start_session(&ctrl_pipe); 407 407 if (rc != EOK) { 408 408 goto failure; … … 414 414 } 415 415 416 rc = usb_ pipe_end_session(&ctrl_pipe);416 rc = usb_endpoint_pipe_end_session(&ctrl_pipe); 417 417 if (rc != EOK) { 418 418 goto failure; -
uspace/lib/usb/src/request.c
r7102aa5 r5971dd3 42 42 /** Generic wrapper for SET requests using standard control request format. 43 43 * 44 * @see usb_ pipe_control_write44 * @see usb_endpoint_pipe_control_write 45 45 * 46 46 * @param pipe Pipe used for the communication. … … 60 60 * @retval ERANGE Data buffer too large. 61 61 */ 62 int usb_control_request_set(usb_ pipe_t *pipe,62 int usb_control_request_set(usb_endpoint_pipe_t *pipe, 63 63 usb_request_type_t request_type, usb_request_recipient_t recipient, 64 64 uint8_t request, … … 90 90 setup_packet.length = (uint16_t) data_size; 91 91 92 int rc = usb_ pipe_control_write(pipe,92 int rc = usb_endpoint_pipe_control_write(pipe, 93 93 &setup_packet, sizeof(setup_packet), 94 94 data, data_size); … … 99 99 /** Generic wrapper for GET requests using standard control request format. 100 100 * 101 * @see usb_ pipe_control_read101 * @see usb_endpoint_pipe_control_read 102 102 * 103 103 * @param pipe Pipe used for the communication. … … 120 120 * @retval ERANGE Data buffer too large. 121 121 */ 122 int usb_control_request_get(usb_ pipe_t *pipe,122 int usb_control_request_get(usb_endpoint_pipe_t *pipe, 123 123 usb_request_type_t request_type, usb_request_recipient_t recipient, 124 124 uint8_t request, … … 150 150 setup_packet.length = (uint16_t) data_size; 151 151 152 int rc = usb_ pipe_control_read(pipe,152 int rc = usb_endpoint_pipe_control_read(pipe, 153 153 &setup_packet, sizeof(setup_packet), 154 154 data, data_size, actual_data_size); … … 165 165 * @return Error code. 166 166 */ 167 int usb_request_get_status(usb_ pipe_t *pipe,167 int usb_request_get_status(usb_endpoint_pipe_t *pipe, 168 168 usb_request_recipient_t recipient, uint16_t index, 169 169 uint16_t *status) … … 203 203 * @return Error code. 204 204 */ 205 int usb_request_clear_feature(usb_ pipe_t *pipe,205 int usb_request_clear_feature(usb_endpoint_pipe_t *pipe, 206 206 usb_request_type_t request_type, usb_request_recipient_t recipient, 207 207 uint16_t feature_selector, uint16_t index) … … 231 231 * @return Error code. 232 232 */ 233 int usb_request_set_feature(usb_ pipe_t *pipe,233 int usb_request_set_feature(usb_endpoint_pipe_t *pipe, 234 234 usb_request_type_t request_type, usb_request_recipient_t recipient, 235 235 uint16_t feature_selector, uint16_t index) … … 258 258 * @return Error code. 259 259 */ 260 int usb_request_set_address(usb_ pipe_t *pipe,260 int usb_request_set_address(usb_endpoint_pipe_t *pipe, 261 261 usb_address_t new_address) 262 262 { … … 297 297 * @return Error code. 298 298 */ 299 int usb_request_get_descriptor(usb_ pipe_t *pipe,299 int usb_request_get_descriptor(usb_endpoint_pipe_t *pipe, 300 300 usb_request_type_t request_type, usb_request_recipient_t recipient, 301 301 uint8_t descriptor_type, uint8_t descriptor_index, … … 331 331 * @return 332 332 */ 333 int usb_request_get_descriptor_alloc(usb_ pipe_t * pipe,333 int usb_request_get_descriptor_alloc(usb_endpoint_pipe_t * pipe, 334 334 usb_request_type_t request_type, usb_request_recipient_t recipient, 335 335 uint8_t descriptor_type, uint8_t descriptor_index, … … 400 400 * @return Error code. 401 401 */ 402 int usb_request_get_device_descriptor(usb_ pipe_t *pipe,402 int usb_request_get_device_descriptor(usb_endpoint_pipe_t *pipe, 403 403 usb_standard_device_descriptor_t *descriptor) 404 404 { … … 442 442 * @return Error code. 443 443 */ 444 int usb_request_get_bare_configuration_descriptor(usb_ pipe_t *pipe,444 int usb_request_get_bare_configuration_descriptor(usb_endpoint_pipe_t *pipe, 445 445 int index, usb_standard_configuration_descriptor_t *descriptor) 446 446 { … … 488 488 * @return Error code. 489 489 */ 490 int usb_request_get_full_configuration_descriptor(usb_ pipe_t *pipe,490 int usb_request_get_full_configuration_descriptor(usb_endpoint_pipe_t *pipe, 491 491 int index, void *descriptor, size_t descriptor_size, size_t *actual_size) 492 492 { … … 514 514 */ 515 515 int usb_request_get_full_configuration_descriptor_alloc( 516 usb_ pipe_t *pipe, int index,516 usb_endpoint_pipe_t *pipe, int index, 517 517 void **descriptor_ptr, size_t *descriptor_size) 518 518 { … … 578 578 * @return Error code. 579 579 */ 580 int usb_request_set_descriptor(usb_ pipe_t *pipe,580 int usb_request_set_descriptor(usb_endpoint_pipe_t *pipe, 581 581 usb_request_type_t request_type, usb_request_recipient_t recipient, 582 582 uint8_t descriptor_type, uint8_t descriptor_index, … … 607 607 * @return Error code. 608 608 */ 609 int usb_request_get_configuration(usb_ pipe_t *pipe,609 int usb_request_get_configuration(usb_endpoint_pipe_t *pipe, 610 610 uint8_t *configuration_value) 611 611 { … … 639 639 * @return Error code. 640 640 */ 641 int usb_request_set_configuration(usb_ pipe_t *pipe,641 int usb_request_set_configuration(usb_endpoint_pipe_t *pipe, 642 642 uint8_t configuration_value) 643 643 { … … 658 658 * @return Error code. 659 659 */ 660 int usb_request_get_interface(usb_ pipe_t *pipe,660 int usb_request_get_interface(usb_endpoint_pipe_t *pipe, 661 661 uint8_t interface_index, uint8_t *alternate_setting) 662 662 { … … 691 691 * @return Error code. 692 692 */ 693 int usb_request_set_interface(usb_ pipe_t *pipe,693 int usb_request_set_interface(usb_endpoint_pipe_t *pipe, 694 694 uint8_t interface_index, uint8_t alternate_setting) 695 695 { … … 710 710 * @return Error code. 711 711 */ 712 int usb_request_get_supported_languages(usb_ pipe_t *pipe,712 int usb_request_get_supported_languages(usb_endpoint_pipe_t *pipe, 713 713 l18_win_locales_t **languages_ptr, size_t *languages_count) 714 714 { … … 782 782 * @return Error code. 783 783 */ 784 int usb_request_get_string(usb_ pipe_t *pipe,784 int usb_request_get_string(usb_endpoint_pipe_t *pipe, 785 785 size_t index, l18_win_locales_t lang, char **string_ptr) 786 786 {
Note:
See TracChangeset
for help on using the changeset viewer.