当前位置: 首页>>代码示例>>C++>>正文


C++ IOPCIDevice::setMemoryEnable方法代码示例

本文整理汇总了C++中IOPCIDevice::setMemoryEnable方法的典型用法代码示例。如果您正苦于以下问题:C++ IOPCIDevice::setMemoryEnable方法的具体用法?C++ IOPCIDevice::setMemoryEnable怎么用?C++ IOPCIDevice::setMemoryEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOPCIDevice的用法示例。


在下文中一共展示了IOPCIDevice::setMemoryEnable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: start

bool AppleMacIO::start( IOService * provider )
{
    IOPCIDevice *pciNub = (IOPCIDevice *)provider;

    if( !super::start( provider))
	return( false);

    // Make sure memory space is on.
    pciNub->setMemoryEnable(true);

    fNub = provider;
    fMemory = provider->mapDeviceMemoryWithIndex( 0 );
    if( 0 == fMemory)
	IOLog("%s: unexpected ranges\n", getName());
    else if( !selfTest())
	IOLog("Warning: AppleMacIO self test fails\n");
    PMinit();		// initialize for power management
    temporaryPowerClampOn();	// hold power on till we get children
    return( true);
}
开发者ID:Algozjb,项目名称:xnu,代码行数:20,代码来源:AppleMacIO.cpp

示例2: DbgPrint

/**
 * at_probe - Device Initialization Routine
 * @pdev: PCI device information struct
 * @ent: entry in at_pci_tbl
 *
 * Returns 0 on success, negative on failure
 *
 * at_probe initializes an adapter identified by a pci_dev structure.
 * The OS initialization, configuring of the adapter private structure,
 * and a hardware reset occur.
 **/
bool AtherosL1Ethernet::atProbe()
{
    u16  vendorId, deviceId;
    at_adapter *adapter=&adapter_;
    
    IOPCIDevice *pdev = adapter_.pdev;
    pdev->setBusMasterEnable(true);
    pdev->setMemoryEnable(true);
    pdev->setIOEnable(true);
    vendorId = pdev->configRead16(kIOPCIConfigVendorID);
    deviceId = pdev->configRead16(kIOPCIConfigDeviceID);

    DbgPrint("Vendor ID %x, device ID %x\n", vendorId, deviceId);
    DbgPrint("MMR0 address %x\n", (u32)pdev->configRead32(kIOPCIConfigBaseAddress0));

    pdev->enablePCIPowerManagement();

    hw_addr_ = pdev->mapDeviceMemoryWithRegister(kIOPCIConfigBaseAddress0);
    if (hw_addr_ == NULL)
    {
        ErrPrint("Couldn't map io regs\n");
        return false;
    }

    DbgPrint("Memory mapped at bus address %x, virtual address %x, length %d\n", (u32)hw_addr_->getPhysicalAddress(),
                    (u32)hw_addr_->getVirtualAddress(), (u32)hw_addr_->getLength());
    
    
    hw_addr_->retain();

    adapter->hw.mmr_base = reinterpret_cast<char *>(hw_addr_->getVirtualAddress());

    DbgPrint("REG_VPD_CAP = %x\n", OSReadLittleInt32(adapter->hw.mmr_base, REG_VPD_CAP));
    DbgPrint("REG_PCIE_CAP_LIST = %x\n", OSReadLittleInt32(adapter->hw.mmr_base, REG_PCIE_CAP_LIST));
    DbgPrint("REG_MASTER_CTRL = %x\n", OSReadLittleInt32(adapter->hw.mmr_base, REG_MASTER_CTRL));
    
    at_setup_pcicmd(pdev);
    
    /* get user settings */
    at_check_options(adapter);
    
    /* setup the private structure */
    if(at_sw_init(adapter))
    {
        ErrPrint("Couldn't init software\n");
        return false;
    }

    /* Init GPHY as early as possible due to power saving issue  */
    at_phy_init(&adapter->hw);

    /* reset the controller to 
     * put the device in a known good starting state */
    if (at_reset_hw(&adapter->hw))
    {
        ErrPrint("Couldn't reset hardware\n");
        return false;           //TO-DO: Uncomment
    }

    /* copy the MAC address out of the EEPROM */
    at_read_mac_addr(&adapter->hw);

    return true;
}
开发者ID:aelam,项目名称:iats,代码行数:75,代码来源:AtherosL1Ethernet.cpp

示例3: start

/**
 * Start this service.
 */
bool org_virtualbox_VBoxGuest::start(IOService *pProvider)
{
    if (!IOService::start(pProvider))
        return false;

    /* Low level initialization should be performed only once */
    if (!ASMAtomicCmpXchgBool(&g_fInstantiated, true, false))
    {
        IOService::stop(pProvider);
        return false;
    }

    m_pIOPCIDevice = OSDynamicCast(IOPCIDevice, pProvider);
    if (m_pIOPCIDevice)
    {
        if (isVmmDev(m_pIOPCIDevice))
        {
            /* Enable memory response from VMM device */
            m_pIOPCIDevice->setMemoryEnable(true);
            m_pIOPCIDevice->setIOEnable(true);

            IOMemoryDescriptor *pMem = m_pIOPCIDevice->getDeviceMemoryWithIndex(0);
            if (pMem)
            {
                IOPhysicalAddress IOPortBasePhys = pMem->getPhysicalAddress();
                /* Check that returned value is from I/O port range (at least it is 16-bit lenght) */
                if((IOPortBasePhys >> 16) == 0)
                {

                    RTIOPORT IOPortBase = (RTIOPORT)IOPortBasePhys;
                    void    *pvMMIOBase = NULL;
                    uint32_t cbMMIO     = 0;
                    m_pMap = m_pIOPCIDevice->mapDeviceMemoryWithIndex(1);
                    if (m_pMap)
                    {
                        pvMMIOBase = (void *)m_pMap->getVirtualAddress();
                        cbMMIO     = m_pMap->getLength();
                    }

                    int rc = VBoxGuestInitDevExt(&g_DevExt,
                                                 IOPortBase,
                                                 pvMMIOBase,
                                                 cbMMIO,
#if ARCH_BITS == 64
                                                 VBOXOSTYPE_MacOS_x64,
#else
                                                 VBOXOSTYPE_MacOS,
#endif
                                                 0);
                    if (RT_SUCCESS(rc))
                    {
                        rc = VbgdDarwinCharDevInit();
                        if (rc == KMOD_RETURN_SUCCESS)
                        {
                            if (setupVmmDevInterrupts(pProvider))
                            {
                                /* register the service. */
                                registerService();
                                LogRel(("VBoxGuest: IOService started\n"));
                                return true;
                            }

                            LogRel(("VBoxGuest: Failed to set up interrupts\n"));
                            VbgdDarwinCharDevRemove();
                        }
                        else
                            LogRel(("VBoxGuest: Failed to initialize character device (rc=%d).\n", rc));

                        VBoxGuestDeleteDevExt(&g_DevExt);
                    }
                    else
                        LogRel(("VBoxGuest: Failed to initialize common code (rc=%d).\n", rc));

                    if (m_pMap)
                    {
                        m_pMap->release();
                        m_pMap = NULL;
                    }
                }
            }
            else
                LogRel(("VBoxGuest: The device missing is the I/O port range (#0).\n"));
        }
        else
开发者ID:tigranbs,项目名称:virtualbox,代码行数:87,代码来源:VBoxGuest-darwin.cpp


注:本文中的IOPCIDevice::setMemoryEnable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。