Changeset 1273b86c in mainline


Ignore:
Timestamp:
2011-04-02T15:15:12Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d773285
Parents:
a1313b8c
Message:

Check bandwidth in hc scheduler

Use warnings for now.

File:
1 edited

Legend:

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

    ra1313b8c r1273b86c  
    329329        if (!usb_is_allowed(
    330330            low_speed, batch->transfer_type, batch->max_packet_size)) {
    331                 usb_log_warning(
    332                     "Invalid USB transfer specified %s SPEED %d %zu.\n",
    333                     low_speed ? "LOW" : "FULL" , batch->transfer_type,
     331                usb_log_error("Invalid USB transfer specified %s %d %zu.\n",
     332                    usb_str_speed(batch->speed), batch->transfer_type,
    334333                    batch->max_packet_size);
    335334                return ENOTSUP;
    336335        }
    337         /* TODO: check available bandwidth here */
     336        /* Check available bandwidth */
     337        if (batch->transfer_type == USB_TRANSFER_INTERRUPT ||
     338            batch->transfer_type == USB_TRANSFER_ISOCHRONOUS) {
     339                int ret =
     340                    bandwidth_use(&instance->bandwidth, batch->target.address,
     341                    batch->target.endpoint, batch->direction);
     342                if (ret != EOK) {
     343                        usb_log_warning("Failed(%d) to use reserved bw: %s.\n",
     344                            ret, str_error(ret));
     345                }
     346        }
    338347
    339348        transfer_list_t *list =
     
    362371{
    363372        assert(instance);
     373//      status |= 1; //Uncomment to work around qemu hang
    364374        /* TODO: Resume interrupts are not supported */
    365375        /* Lower 2 bits are transaction error and transaction complete */
     
    380390                        usb_transfer_batch_t *batch =
    381391                            list_get_instance(item, usb_transfer_batch_t, link);
    382                         if (batch->transfer_type == USB_TRANSFER_CONTROL) {
     392                        switch (batch->transfer_type)
     393                        {
     394                        case USB_TRANSFER_CONTROL:
    383395                                usb_device_keeper_release_control(
    384396                                    &instance->manager, batch->target.address);
     397                                break;
     398                        case USB_TRANSFER_INTERRUPT:
     399                        case USB_TRANSFER_ISOCHRONOUS: {
     400                                int ret = bandwidth_free(&instance->bandwidth,
     401                                    batch->target.address,
     402                                    batch->target.endpoint,
     403                                    batch->direction);
     404                                if (ret != EOK)
     405                                        usb_log_warning("Failed(%d) to free "
     406                                            "reserved bw: %s.\n", ret,
     407                                            str_error(ret));
     408                                }
     409                        default:
     410                                break;
    385411                        }
    386412                        batch->next_step(batch);
Note: See TracChangeset for help on using the changeset viewer.