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


Ignore:
Timestamp:
2011-02-14T10:14:31Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
962ce100
Parents:
0d36c20 (diff), 45c01a1 (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:

Merge development/ changes

File:
1 edited

Legend:

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

    r0d36c20 rd15809b4  
    8989        pio_write_32(&instance->registers->flbaseadd, (uint32_t)pa);
    9090
    91         list_initialize(&instance->tracker_list);
    92         fibril_mutex_initialize(&instance->tracker_list_mutex);
     91        list_initialize(&instance->batch_list);
     92        fibril_mutex_initialize(&instance->batch_list_mutex);
    9393
    9494        instance->cleaner = fibril_create(uhci_clean_finished, instance);
     
    152152}
    153153/*----------------------------------------------------------------------------*/
    154 int uhci_schedule(uhci_t *instance, tracker_t *tracker)
    155 {
    156         assert(instance);
    157         assert(tracker);
    158         const int low_speed = (tracker->speed == LOW_SPEED);
     154int uhci_schedule(uhci_t *instance, batch_t *batch)
     155{
     156        assert(instance);
     157        assert(batch);
     158        const int low_speed = (batch->speed == LOW_SPEED);
    159159        if (!allowed_usb_packet(
    160             low_speed, tracker->transfer_type, tracker->packet_size)) {
     160            low_speed, batch->transfer_type, batch->max_packet_size)) {
    161161                usb_log_warning("Invalid USB packet specified %s SPEED %d %zu.\n",
    162                           low_speed ? "LOW" : "FULL" , tracker->transfer_type,
    163                     tracker->packet_size);
     162                          low_speed ? "LOW" : "FULL" , batch->transfer_type,
     163                    batch->max_packet_size);
    164164                return ENOTSUP;
    165165        }
    166166        /* TODO: check available bandwith here */
    167167
    168         usb_log_debug2("Scheduler(%d) acquiring tracker list mutex.\n",
    169             fibril_get_id());
    170         fibril_mutex_lock(&instance->tracker_list_mutex);
    171         usb_log_debug2("Scheduler(%d) acquired tracker list mutex.\n",
    172             fibril_get_id());
    173 
    174168        transfer_list_t *list =
    175             instance->transfers[low_speed][tracker->transfer_type];
     169            instance->transfers[low_speed][batch->transfer_type];
    176170        assert(list);
    177         transfer_list_add_tracker(list, tracker);
    178         list_append(&tracker->link, &instance->tracker_list);
    179 
    180         usb_log_debug2("Scheduler(%d) releasing tracker list mutex.\n",
    181             fibril_get_id());
    182         fibril_mutex_unlock(&instance->tracker_list_mutex);
    183         usb_log_debug2("Scheduler(%d) released tracker list mutex.\n",
    184             fibril_get_id());
     171        transfer_list_add_batch(list, batch);
    185172
    186173        return EOK;
     
    194181
    195182        while(1) {
    196                 LIST_INITIALIZE(done_trackers);
    197                 /* tracker iteration */
    198 
    199                 usb_log_debug2("Cleaner(%d) acquiring tracker list mutex.\n",
    200                     fibril_get_id());
    201                 fibril_mutex_lock(&instance->tracker_list_mutex);
    202                 usb_log_debug2("Cleaner(%d) acquired tracker list mutex.\n",
    203                     fibril_get_id());
    204 
    205                 link_t *current = instance->tracker_list.next;
    206                 while (current != &instance->tracker_list)
    207                 {
    208 
    209                         link_t *next = current->next;
    210                         tracker_t *tracker = list_get_instance(current, tracker_t, link);
    211 
    212                         assert(current == &tracker->link);
    213                         assert(tracker);
    214                         assert(tracker->next_step);
    215                         assert(tracker->td);
    216 
    217                         if (!transfer_descriptor_is_active(tracker->td)) {
    218                                 usb_log_info("Found inactive tracker with status: %x:%x.\n",
    219                                     tracker->td->status, tracker->td->device);
    220                                 list_remove(current);
    221                                 list_append(current, &done_trackers);
    222                         }
    223                         current = next;
    224                 }
    225 
    226                 usb_log_debug2("Cleaner(%d) releasing tracker list mutex.\n",
    227                     fibril_get_id());
    228                 fibril_mutex_unlock(&instance->tracker_list_mutex);
    229                 usb_log_debug2("Cleaner(%d) released tracker list mutex.\n",
    230                     fibril_get_id());
    231 
    232                 while (!list_empty(&done_trackers)) {
    233                         tracker_t *tracker = list_get_instance(
    234                           done_trackers.next, tracker_t, link);
    235                         list_remove(&tracker->link);
    236                         tracker->next_step(tracker);
    237                 }
     183                transfer_list_check(&instance->transfers_interrupt);
     184                transfer_list_check(&instance->transfers_control_slow);
     185                transfer_list_check(&instance->transfers_control_full);
     186                transfer_list_check(&instance->transfers_bulk_full);
    238187                async_usleep(UHCI_CLEANER_TIMEOUT);
    239188        }
Note: See TracChangeset for help on using the changeset viewer.