Changeset fb78ae72 in mainline for uspace/drv/uhci-hcd


Ignore:
Timestamp:
2011-02-19T23:34:48Z (15 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
423e8c81, deece2f
Parents:
b9d910f
Message:

Move interrupt enabling code to pciintel driver

Location:
uspace/drv/uhci-hcd
Files:
4 edited

Legend:

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

    rb9d910f rfb78ae72  
    3434#include <driver.h>
    3535#include <usb_iface.h>
    36 #include <ipc/irc.h>
    37 #include <ipc/ns.h>
    38 #include <ipc/services.h>
    39 #include <sysinfo.h>
     36#include <device/hw_res.h>
    4037
    4138#include <errno.h>
     
    8481        assert(device);
    8582        uhci_t *hc = dev_to_uhci(device);
    86         usb_log_info("LOL HARDWARE INTERRUPT: %p.\n", hc);
    8783        uint16_t status = IPC_GET_ARG1(*call);
    8884        assert(hc);
     
    111107
    112108        CHECK_RET_RETURN(ret,
    113             "Failed(%d) to get I/O registers addresses for device:.\n",
    114             ret, device->handle);
     109            "Failed(%d) to get I/O addresses:.\n", ret, device->handle);
    115110        usb_log_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",
    116111            io_reg_base, io_reg_size, irq);
    117112
    118 
    119   sysarg_t apic;
    120   sysarg_t i8259;
    121         int irc_phone = -1;
    122         int irc_service = 0;
    123 
    124   if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) {
    125     irc_service = SERVICE_APIC;
    126                 usb_log_debug("SERVICE_APIC\n");
    127         } else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) {
    128     irc_service = SERVICE_I8259;
    129                 usb_log_debug("SERVICE_I8259\n");
    130         }
    131 
    132   if (irc_service) {
    133     while (irc_phone < 0)
    134       irc_phone = service_connect_blocking(irc_service, 0, 0);
    135   }
    136         usb_log_debug("Interrupt conttroller phone: %d\n", irc_phone);
    137 
    138         async_msg_1(irc_phone, IRC_ENABLE_INTERRUPT, irq);
    139         async_hangup(irc_phone);
    140 
     113        ret = pci_enable_interrupts(device);
     114        CHECK_RET_RETURN(ret, "Failed(%d) to get enable interrupts:\n", ret);
    141115
    142116        uhci_t *uhci_hc = malloc(sizeof(uhci_t));
  • uspace/drv/uhci-hcd/pci.c

    rb9d910f rfb78ae72  
    121121        return rc;
    122122}
    123 
     123/*----------------------------------------------------------------------------*/
     124int pci_enable_interrupts(device_t *device)
     125{
     126        int parent_phone = devman_parent_device_connect(device->handle,
     127            IPC_FLAG_BLOCKING);
     128        bool enabled = hw_res_enable_interrupt(parent_phone);
     129        return enabled ? EOK : EIO;
     130}
    124131/**
    125132 * @}
  • uspace/drv/uhci-hcd/pci.h

    rb9d910f rfb78ae72  
    3939
    4040int pci_get_my_registers(device_t *, uintptr_t *, size_t *, int *);
     41int pci_enable_interrupts(device_t *device);
    4142
    4243#endif
  • uspace/drv/uhci-hcd/uhci.h

    rb9d910f rfb78ae72  
    104104static inline void uhci_fini(uhci_t *instance) {};
    105105
    106 int uhci_transfer(
    107   uhci_t *instance,
    108   device_t *dev,
    109   usb_target_t target,
    110   usb_transfer_type_t transfer_type,
    111         bool toggle,
    112   usb_packet_id pid,
    113         bool low_speed,
    114   void *buffer, size_t size,
    115   usbhc_iface_transfer_out_callback_t callback_out,
    116   usbhc_iface_transfer_in_callback_t callback_in,
    117   void *arg );
    118 
    119106int uhci_schedule(uhci_t *instance, batch_t *batch);
    120107
Note: See TracChangeset for help on using the changeset viewer.