Changeset 5d4193c in mainline for uspace/drv/uhci-hcd/transfer_list.c


Ignore:
Timestamp:
2011-02-11T12:06:05Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
03197ffc, fe1776c2
Parents:
960ff451 (diff), f96aefc (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:

UHCI internals rework, add support for ew control transfer API

File:
1 edited

Legend:

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

    r960ff451 r5d4193c  
    4141{
    4242        assert(instance);
    43         instance->first = NULL;
    44         instance->last = NULL;
    4543        instance->next = NULL;
    4644        instance->name = name;
     
    6664}
    6765/*----------------------------------------------------------------------------*/
    68 int transfer_list_append(
    69   transfer_list_t *instance, transfer_descriptor_t *transfer)
     66void transfer_list_add_tracker(transfer_list_t *instance, tracker_t *tracker)
    7067{
    7168        assert(instance);
    72         assert(transfer);
     69        assert(tracker);
    7370
    74         uint32_t pa = (uintptr_t)addr_to_phys(transfer);
     71        uint32_t pa = (uintptr_t)addr_to_phys(tracker->td);
    7572        assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
    7673
    77         /* empty list */
    78         if (instance->first == NULL) {
    79                 assert(instance->last == NULL);
    80                 instance->first = instance->last = transfer;
    81         } else {
    82                 assert(instance->last);
    83                 instance->last->next_va = transfer;
    8474
    85                 assert(instance->last->next & LINK_POINTER_TERMINATE_FLAG);
    86                 instance->last->next = (pa & LINK_POINTER_ADDRESS_MASK);
    87                 instance->last = transfer;
     75        if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) {
     76                usb_log_debug2("Adding td(%X:%X) to queue %s first.\n",
     77                        tracker->td->status, tracker->td->device, instance->name);
     78                /* there is nothing scheduled */
     79                instance->last_tracker = tracker;
     80                instance->queue_head->element = pa;
     81                usb_log_debug2("Added td(%X:%X) to queue %s first.\n",
     82                        tracker->td->status, tracker->td->device, instance->name);
     83                return;
    8884        }
     85        usb_log_debug2("Adding td(%X:%X) to queue %s last.%p\n",
     86            tracker->td->status, tracker->td->device, instance->name,
     87            instance->last_tracker);
     88        /* now we can be sure that last_tracker is a valid pointer */
     89        instance->last_tracker->td->next = pa;
     90        instance->last_tracker = tracker;
    8991
    90         assert(instance->queue_head);
     92        usb_log_debug2("Added td(%X:%X) to queue %s last.\n",
     93                tracker->td->status, tracker->td->device, instance->name);
     94
     95        /* check again, may be use atomic compare and swap */
    9196        if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) {
    92                 instance->queue_head->element = (pa & LINK_POINTER_ADDRESS_MASK);
     97                instance->queue_head->element = pa;
     98                usb_log_debug2("Added td(%X:%X) to queue first2 %s.\n",
     99                        tracker->td->status, tracker->td->device, instance->name);
    93100        }
    94         usb_log_debug("Successfully added transfer to the hc queue %s.\n",
    95           instance->name);
    96         return EOK;
    97101}
    98102/**
Note: See TracChangeset for help on using the changeset viewer.