⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 power.c

📁 Windows CE 6.0 BSP for VOIPAC Board (PXA270) Version 2b.
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
//  File:  power.c
//
#include <windows.h>
#include <ceddk.h>
#include <nkintr.h>
#include <oal.h>
#include <vr4131.h>

//------------------------------------------------------------------------------

VOID OEMPowerOff()
{
    VR4131_ICU_REGS *pICURegs;
    UINT32 sysIntr;
    UINT16 msysint1, msysint2, mgiuintl, mgiuinth;

    OALMSG(TRUE, (L"+OEMPowerOff\r\n"));

    OALKitlPowerOff();

    BSPPowerOff();

    OALPCIPowerOff(0);
    
    // Get ICU virtual address 
    pICURegs = OALPAtoUA(VR4131_REG_PA_ICU);
    
    // Save current interrupt masks
    msysint1 = INREG16(&pICURegs->MSYSINT1);
    msysint2 = INREG16(&pICURegs->MSYSINT2);
    mgiuintl = INREG16(&pICURegs->MGIUINTL);
    mgiuinth = INREG16(&pICURegs->MGIUINTH);

    // Disable all interrupts
    OUTREG16(&pICURegs->MSYSINT1, 0);
    OUTREG16(&pICURegs->MSYSINT2, 0);
    OUTREG16(&pICURegs->MGIUINTL, 0);
    OUTREG16(&pICURegs->MGIUINTH, 0);
    
    for (sysIntr = SYSINTR_FIRMWARE; sysIntr < SYSINTR_MAXIMUM; sysIntr++) {
        // Skip if sysIntr isn't allowed as wake source
        if (!OALPowerWakeSource(sysIntr)) continue;
        // Enable it as interrupt
        OEMInterruptEnable(sysIntr, NULL, 0);
    }

    // Move CPU do power off state
    OALCPUPowerOff();

    // Set pre power off interrupt mask
    OUTREG16(&pICURegs->MSYSINT1, msysint1);
    OUTREG16(&pICURegs->MSYSINT2, msysint2);
    OUTREG16(&pICURegs->MGIUINTL, mgiuintl);
    OUTREG16(&pICURegs->MGIUINTH, mgiuinth);

    OALPCIPowerOn(0);
    
    BSPPowerOn();
    
    OALKitlPowerOn();
    
    OALMSG(TRUE, (L"-OEMPowerOff\r\n"));
}       

//------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -