Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 58d4880 in mainline


Ignore:
Timestamp:
2015-07-05T04:02:22Z (7 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
b74ec299
Parents:
51cc6cef
Message:

uhci/rh: Poll the port status locally and in specified intervals

Significantly reduces uhci driver cpu usage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/uhci_rh.c

    r51cc6cef r58d4880  
    107107                .endpoint = batch->ep->endpoint
    108108        }};
    109         batch->error = virthub_base_request(&instance->base, target,
    110             usb_transfer_batch_direction(batch), (void*)batch->setup_buffer,
    111             batch->buffer, batch->buffer_size, &batch->transfered_size);
     109        do {
     110                batch->error = virthub_base_request(&instance->base, target,
     111                    usb_transfer_batch_direction(batch), (void*)batch->setup_buffer,
     112                    batch->buffer, batch->buffer_size, &batch->transfered_size);
     113                if (batch->error == ENAK)
     114                        async_usleep(instance->base.endpoint_descriptor.poll_interval * 1000);
     115                //TODO This is flimsy, but we can't exit early because
     116                //ENAK is technically an error condition
     117        } while (batch->error == ENAK);
    112118        usb_transfer_batch_finish(batch, NULL);
    113119        usb_transfer_batch_destroy(batch);
     
    421427        ((uint8_t *)buffer)[0] = status;
    422428        *actual_size = 1;
    423         return EOK;
     429        return (status != 0 ? EOK : ENAK);
    424430}
    425431
Note: See TracChangeset for help on using the changeset viewer.