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

Changeset 763dbcb in mainline


Ignore:
Timestamp:
2014-01-24T20:21:28Z (8 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
0a751aa
Parents:
5f5321ee
Message:

ehci: Implement dequeue.

Includes async list doorbell interrupt handling

Location:
uspace/drv/bus/usb/ehci
Files:
3 edited

Legend:

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

    r5f5321ee r763dbcb  
    107107        ehci_endpoint_t *instance = ehci_endpoint_get(ep);
    108108        hc_dequeue_endpoint(hcd->driver.data, ep);
     109        endpoint_clear_hc_data(ep);
    109110        if (instance) {
    110111                free32(instance->qh);
    111112                free(instance);
    112113        }
    113         endpoint_clear_hc_data(ep);
    114114}
    115115/**
  • uspace/drv/bus/usb/ehci/hc.c

    r5f5321ee r763dbcb  
    176176        list_initialize(&instance->pending_batches);
    177177        fibril_mutex_initialize(&instance->guard);
     178        fibril_condvar_initialize(&instance->async_doorbell);
    178179
    179180        ret = hc_init_memory(instance);
     
    230231void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep)
    231232{
     233        assert(instance);
     234        assert(ep);
     235        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
     236        switch (ep->transfer_type)
     237        {
     238        case USB_TRANSFER_INTERRUPT:
     239                endpoint_list_append_ep(&instance->int_list, ehci_ep);
     240                /* Fall through */
     241        case USB_TRANSFER_ISOCHRONOUS:
     242                /* NOT SUPPORTED */
     243                return;
     244        case USB_TRANSFER_CONTROL:
     245        case USB_TRANSFER_BULK:
     246                endpoint_list_remove_ep(&instance->async_list, ehci_ep);
     247                break;
     248        }
     249        fibril_mutex_lock(&instance->guard);
     250        EHCI_SET(instance->registers->usbcmd, USB_CMD_ASYNC_SCHEDULE_FLAG);
     251        fibril_condvar_wait(&instance->async_doorbell, &instance->guard);
     252        fibril_mutex_unlock(&instance->guard);
    232253}
    233254
     
    279300        if (status & USB_STS_PORT_CHANGE_FLAG) {
    280301                ehci_rh_interrupt(&instance->rh);
     302        }
     303        if (status & USB_STS_ASYNC_SCHED_FLAG) {
     304                fibril_condvar_signal(&instance->async_doorbell);
    281305        }
    282306}
     
    313337        }
    314338        /* Enable interrupts */
    315         EHCI_WR(instance->registers->usbintr, USB_INTR_PORT_CHANGE_FLAG | USB_INTR_IRQ_FLAG);
    316         /* Use lower 4G segment */
     339        EHCI_WR(instance->registers->usbintr, USB_INTR_PORT_CHANGE_FLAG | USB_INTR_IRQ_FLAG | USB_INTR_ASYNC_ADVANCE_FLAG);
     340        /* Use the lowest 4G segment */
    317341        EHCI_WR(instance->registers->ctrldssegment, 0);
    318342        /* Set periodic list */
     
    326350        EHCI_SET(instance->registers->usbcmd, USB_CMD_RUN_FLAG);
    327351        EHCI_SET(instance->registers->configflag, USB_CONFIG_FLAG_FLAG);
     352
    328353#if 0
    329354        /*
  • uspace/drv/bus/usb/ehci/hc.h

    r5f5321ee r763dbcb  
    7575        fibril_mutex_t guard;
    7676
     77        /** Wait for hc to restart async chedule */
     78        fibril_condvar_t async_doorbell;
     79
    7780        /** USB hub emulation structure */
    7881        ehci_rh_t rh;
Note: See TracChangeset for help on using the changeset viewer.