Changeset b77931d in mainline for uspace/lib/usbdev/src
- Timestamp:
- 2011-11-05T16:08:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d176b1d
- Parents:
- ab27e01
- Location:
- uspace/lib/usbdev/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devdrv.c
rab27e01 rb77931d 361 361 /* Now allocate and fully initialize. */ 362 362 for (i = 0; i < pipe_count; i++) { 363 pipes[i].pipe = malloc(sizeof(usb_pipe_t));364 if (pipes[i].pipe == NULL) {365 rc = ENOMEM;366 goto rollback_free_only;367 }368 363 pipes[i].description = endpoints[i]; 369 364 pipes[i].interface_no = interface_no; … … 392 387 for (i = 0; i < pipe_count; i++) { 393 388 if (pipes[i].present) { 394 rc = usb_pipe_register( pipes[i].pipe,389 rc = usb_pipe_register(&pipes[i].pipe, 395 390 pipes[i].descriptor->poll_interval, &hc_conn); 396 391 if (rc != EOK) { … … 420 415 for (i = 0; i < pipe_count; i++) { 421 416 if (pipes[i].present) { 422 usb_pipe_unregister( pipes[i].pipe, &hc_conn);417 usb_pipe_unregister(&pipes[i].pipe, &hc_conn); 423 418 } 424 419 } … … 434 429 */ 435 430 rollback_free_only: 436 for (i = 0; i < pipe_count; i++) {437 if (pipes[i].pipe != NULL) {438 free(pipes[i].pipe);439 }440 }441 431 free(pipes); 442 432 … … 480 470 i, pipes[i].present ? "" : "not "); 481 471 if (pipes[i].present) 482 usb_pipe_unregister(pipes[i].pipe, &hc_conn); 483 free(pipes[i].pipe); 472 usb_pipe_unregister(&pipes[i].pipe, &hc_conn); 484 473 } 485 474 -
uspace/lib/usbdev/src/devpoll.c
rab27e01 rb77931d 73 73 74 74 usb_pipe_t *pipe 75 = polling_data->dev->pipes[polling_data->pipe_index].pipe;75 = &polling_data->dev->pipes[polling_data->pipe_index].pipe; 76 76 77 77 if (polling_data->debug > 0) { … … 208 208 return EINVAL; 209 209 } 210 if ((dev->pipes[pipe_index].pipe ->transfer_type != USB_TRANSFER_INTERRUPT)211 || (dev->pipes[pipe_index].pipe ->direction != USB_DIRECTION_IN)) {210 if ((dev->pipes[pipe_index].pipe.transfer_type != USB_TRANSFER_INTERRUPT) 211 || (dev->pipes[pipe_index].pipe.direction != USB_DIRECTION_IN)) { 212 212 return EINVAL; 213 213 } … … 254 254 return EINVAL; 255 255 } 256 if ((dev->pipes[pipe_index].pipe ->transfer_type != USB_TRANSFER_INTERRUPT)257 || (dev->pipes[pipe_index].pipe ->direction != USB_DIRECTION_IN)) {256 if ((dev->pipes[pipe_index].pipe.transfer_type != USB_TRANSFER_INTERRUPT) 257 || (dev->pipes[pipe_index].pipe.direction != USB_DIRECTION_IN)) { 258 258 return EINVAL; 259 259 } -
uspace/lib/usbdev/src/pipesinit.c
rab27e01 rb77931d 192 192 } 193 193 194 if (ep_mapping->pipe == NULL) {195 return EBADMEM;196 }197 194 if (ep_mapping->present) { 198 195 return EEXISTS; 199 196 } 200 197 201 int rc = usb_pipe_initialize( ep_mapping->pipe, wire,198 int rc = usb_pipe_initialize(&ep_mapping->pipe, wire, 202 199 ep_no, description.transfer_type, endpoint->max_packet_size, 203 200 description.direction); … … 254 251 * 255 252 * The mapping array is expected to conform to following rules: 256 * - @c pipe must point to already allocated structure withuninitialized pipe253 * - @c pipe must be uninitialized pipe 257 254 * - @c description must point to prepared endpoint description 258 255 * - @c descriptor does not need to be initialized (will be overwritten) … … 297 294 } 298 295 299 /* 300 * Go through the mapping and set all endpoints to not present. 301 */ 302 size_t i; 303 for (i = 0; i < mapping_count; i++) { 296 /* Go through the mapping and set all endpoints to not present. */ 297 for (size_t i = 0; i < mapping_count; i++) { 304 298 mapping[i].present = false; 305 299 mapping[i].descriptor = NULL; … … 307 301 } 308 302 309 /* 310 * Prepare the descriptor parser. 311 */ 303 /* Prepare the descriptor parser. */ 312 304 const usb_dp_parser_t dp_parser = { 313 305 .nesting = descriptor_nesting
Note:
See TracChangeset
for help on using the changeset viewer.