Changeset a8ac368 in mainline for uspace/drv/uhci-hcd/hc.c


Ignore:
Timestamp:
2011-03-29T20:08:53Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fc883bb
Parents:
0d92638 (diff), 51e5608 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

development changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/hc.c

    r0d92638 ra8ac368  
    6767static int hc_debug_checker(void *arg);
    6868
    69 static bool allowed_usb_packet(
     69static bool usb_is_allowed(
    7070    bool low_speed, usb_transfer_type_t transfer, size_t size);
    7171/*----------------------------------------------------------------------------*/
     
    223223        ret = instance ? EOK : ENOMEM;
    224224        CHECK_RET_DEST_CMDS_RETURN(ret, "Failed to get frame list page.\n");
    225         usb_log_debug("Initialized frame list.\n");
     225        usb_log_debug("Initialized frame list at %p.\n", instance->frame_list);
    226226
    227227        /* Set all frames to point to the first queue head */
     
    323323        assert(batch);
    324324        const int low_speed = (batch->speed == USB_SPEED_LOW);
    325         if (!allowed_usb_packet(
     325        if (!usb_is_allowed(
    326326            low_speed, batch->transfer_type, batch->max_packet_size)) {
    327327                usb_log_warning(
    328                     "Invalid USB packet specified %s SPEED %d %zu.\n",
     328                    "Invalid USB transfer specified %s SPEED %d %zu.\n",
    329329                    low_speed ? "LOW" : "FULL" , batch->transfer_type,
    330330                    batch->max_packet_size);
     
    336336            instance->transfers[batch->speed][batch->transfer_type];
    337337        assert(list);
     338        if (batch->transfer_type == USB_TRANSFER_CONTROL) {
     339                usb_device_keeper_use_control(
     340                    &instance->manager, batch->target.address);
     341        }
    338342        transfer_list_add_batch(list, batch);
    339343
     
    357361        /* Lower 2 bits are transaction error and transaction complete */
    358362        if (status & 0x3) {
    359                 transfer_list_remove_finished(&instance->transfers_interrupt);
    360                 transfer_list_remove_finished(&instance->transfers_control_slow);
    361                 transfer_list_remove_finished(&instance->transfers_control_full);
    362                 transfer_list_remove_finished(&instance->transfers_bulk_full);
     363                LIST_INITIALIZE(done);
     364                transfer_list_remove_finished(
     365                    &instance->transfers_interrupt, &done);
     366                transfer_list_remove_finished(
     367                    &instance->transfers_control_slow, &done);
     368                transfer_list_remove_finished(
     369                    &instance->transfers_control_full, &done);
     370                transfer_list_remove_finished(
     371                    &instance->transfers_bulk_full, &done);
     372
     373                while (!list_empty(&done)) {
     374                        link_t *item = done.next;
     375                        list_remove(item);
     376                        usb_transfer_batch_t *batch =
     377                            list_get_instance(item, usb_transfer_batch_t, link);
     378                        if (batch->transfer_type == USB_TRANSFER_CONTROL) {
     379                                usb_device_keeper_release_control(
     380                                    &instance->manager, batch->target.address);
     381                        }
     382                        batch->next_step(batch);
     383                }
    363384        }
    364385        /* bits 4 and 5 indicate hc error */
     
    471492}
    472493/*----------------------------------------------------------------------------*/
    473 /** Check transfer packets, for USB validity
     494/** Check transfers for USB validity
    474495 *
    475496 * @param[in] low_speed Transfer speed.
    476497 * @param[in] transfer Transer type
    477  * @param[in] size Maximum size of used packets
     498 * @param[in] size Size of data packets
    478499 * @return True if transaction is allowed by USB specs, false otherwise
    479500 */
    480 bool allowed_usb_packet(
     501bool usb_is_allowed(
    481502    bool low_speed, usb_transfer_type_t transfer, size_t size)
    482503{
Note: See TracChangeset for help on using the changeset viewer.