Changeset e9c5bd9 in mainline for uspace/drv/bus/usb/ehci/hc.c


Ignore:
Timestamp:
2014-01-25T07:10:04Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
44b9b44
Parents:
23e5471
Message:

ehci: plug in scheduling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hc.c

    r23e5471 re9c5bd9  
    4747
    4848//#include "ehci_endpoint.h"
    49 //#include "ehci_batch.h"
     49#include "ehci_batch.h"
    5050#include "utils/malloc32.h"
    5151
     
    280280        /* Check for root hub communication */
    281281        if (batch->ep->address == ehci_rh_get_address(&instance->rh)) {
    282                 usb_log_debug("EHCI root hub request.\n");
    283282                return ehci_rh_schedule(&instance->rh, batch);
    284283        }
    285         return ENOTSUP;
     284        ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch);
     285        if (!ehci_batch)
     286                return ENOMEM;
     287
     288        fibril_mutex_lock(&instance->guard);
     289        list_append(&ehci_batch->link, &instance->pending_batches);
     290        ehci_transfer_batch_commit(ehci_batch);
     291
     292        fibril_mutex_unlock(&instance->guard);
     293        return EOK;
    286294}
    287295
     
    303311                fibril_condvar_signal(&instance->async_doorbell);
    304312        }
     313        if (status & (USB_STS_IRQ_FLAG | USB_STS_ERR_IRQ_FLAG)) {
     314                fibril_mutex_lock(&instance->guard);
     315
     316                link_t *current = list_first(&instance->pending_batches);
     317                while (current && current != &instance->pending_batches.head) {
     318                        link_t *next = current->next;
     319                        ehci_transfer_batch_t *batch =
     320                            ehci_transfer_batch_from_link(current);
     321
     322                        if (ehci_transfer_batch_is_complete(batch)) {
     323                                list_remove(current);
     324                                ehci_transfer_batch_finish_dispose(batch);
     325                        }
     326                        current = next;
     327                }
     328                fibril_mutex_unlock(&instance->guard);
     329        }
     330
    305331}
    306332
Note: See TracChangeset for help on using the changeset viewer.