Changeset 075c1eb in mainline for uspace/drv/ohci/hc.c


Ignore:
Timestamp:
2011-05-06T13:09:39Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c6a95d2, 9350e837
Parents:
310c4df (diff), 3d4aa055 (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:

OHCI interrupts

Kernel support for accessing memory mapped registers in irq handler(AS switch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.c

    r310c4df r075c1eb  
    4545#include "hcd_endpoint.h"
    4646
     47#define OHCI_USED_INTERRUPTS \
     48    (I_SO | I_WDH | I_UE | I_RHSC)
    4749static int interrupt_emulator(hc_t *instance);
    4850static void hc_gain_control(hc_t *instance);
     
    285287{
    286288        assert(instance);
    287         if ((status & ~IS_SF) == 0) /* ignore sof status */
     289        usb_log_debug("OHCI interrupt: %x.\n", status);
     290        if ((status & ~I_SF) == 0) /* ignore sof status */
    288291                return;
    289         if (status & IS_RHSC)
     292        if (status & I_RHSC)
    290293                rh_interrupt(&instance->rh);
    291294
    292         usb_log_debug("OHCI interrupt: %x.\n", status);
    293 
    294         if (status & IS_WDH) {
     295
     296        if (status & I_WDH) {
    295297                fibril_mutex_lock(&instance->guard);
    296298                usb_log_debug2("HCCA: %p-%#" PRIx32 " (%p).\n", instance->hcca,
     
    421423            instance->registers->control);
    422424
    423         /* Disable interrupts */
    424         instance->registers->interrupt_disable = I_SF | I_OC;
    425         usb_log_debug2("Disabling interrupts: %x.\n",
    426             instance->registers->interrupt_disable);
    427         instance->registers->interrupt_disable = I_MI;
     425        /* Enable interrupts */
     426        instance->registers->interrupt_enable = OHCI_USED_INTERRUPTS;
    428427        usb_log_debug2("Enabled interrupts: %x.\n",
    429428            instance->registers->interrupt_enable);
     429        instance->registers->interrupt_enable = I_MI;
    430430
    431431        /* Set periodic start to 90% */
     
    492492            instance->lists[USB_TRANSFER_INTERRUPT].list_head_pa);
    493493
     494        /* Init interrupt code */
     495        instance->interrupt_code.cmds = instance->interrupt_commands;
     496        {
     497                /* Read status register */
     498                instance->interrupt_commands[0].cmd = CMD_MEM_READ_32;
     499                instance->interrupt_commands[0].dstarg = 1;
     500                instance->interrupt_commands[0].addr =
     501                    (void*)&instance->registers->interrupt_status;
     502
     503                /* Test whether we are the interrupt cause */
     504                instance->interrupt_commands[1].cmd = CMD_BTEST;
     505                instance->interrupt_commands[1].value =
     506                    OHCI_USED_INTERRUPTS;
     507                instance->interrupt_commands[1].srcarg = 1;
     508                instance->interrupt_commands[1].dstarg = 2;
     509
     510                /* Predicate cleaning and accepting */
     511                instance->interrupt_commands[2].cmd = CMD_PREDICATE;
     512                instance->interrupt_commands[2].value = 2;
     513                instance->interrupt_commands[2].srcarg = 2;
     514
     515                /* Write clean status register */
     516                instance->interrupt_commands[3].cmd = CMD_MEM_WRITE_A_32;
     517                instance->interrupt_commands[3].srcarg = 1;
     518                instance->interrupt_commands[3].addr =
     519                    (void*)&instance->registers->interrupt_status;
     520
     521                /* Accept interrupt */
     522                instance->interrupt_commands[4].cmd = CMD_ACCEPT;
     523
     524                instance->interrupt_code.cmdcount = OHCI_NEEDED_IRQ_COMMANDS;
     525        }
     526
    494527        return EOK;
    495528}
Note: See TracChangeset for help on using the changeset viewer.