power.c

来自「freescale i.mx31 BSP CE5.0全部源码」· C语言 代码 · 共 82 行

C
82
字号
//
// 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.
//
//-----------------------------------------------------------------------------
//
//  Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved
//  THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
//  BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
//  FREESCALE SEMICONDUCTOR, INC.
//
//-----------------------------------------------------------------------------
//
//  File:  power.c
//
//  Power BSP callback functions implementation. This function are called as
//  last function before OALCPUPowerOff. The KITL was already disabled by
//  OALKitlPowerOff.
//
//-----------------------------------------------------------------------------
#include <bsp.h>

//-----------------------------------------------------------------------------
// External Functions
extern VOID OALCleanL2Cache();
extern VOID OALFlushL2Cache();
extern void OALCPUEnterWFI(void);

//-----------------------------------------------------------------------------
// External Variables
extern PCSP_CCM_REGS g_pCCM;
extern UINT32 *g_pL2CC;

//-----------------------------------------------------------------------------
VOID BSPPowerOff()
{
    // Request state retention low-power mode
    // Activate well bias
    // Activate L2 power gating
    // Request standby supply voltage
    INSREG32(&g_pCCM->CCMR, 
        CSP_BITFMASK(CCM_CCMR_VSTBY) | 
        CSP_BITFMASK(CCM_CCMR_LPM) |
        CSP_BITFMASK(CCM_CCMR_L2PG) | 
        CSP_BITFMASK(CCM_CCMR_WBEN) |
        CSP_BITFMASK(CCM_CCMR_SBYCS),
        CSP_BITFVAL(CCM_CCMR_VSTBY, CCM_CCMR_VSTBY_ENABLE) | 
        CSP_BITFVAL(CCM_CCMR_LPM, CCM_CCMR_LPM_STATE_RETENTION) | 
        CSP_BITFVAL(CCM_CCMR_L2PG, CCM_CCMR_L2PG_ENABLE) | 
        CSP_BITFVAL(CCM_CCMR_WBEN, CCM_CCMR_WBEN_ENABLE) |
        CSP_BITFVAL(CCM_CCMR_SBYCS, CCM_CCMR_SBYCS_DISABLED));

    // L2 will be power gated in state retention mode. Request L2 flush
    // to push out incoherent entries into memory and invalidate the
    // cache
    if (g_pL2CC)
    {
        OALFlushL2Cache();
    }

    // Enter wait-for-interrupt mode and the system will transition
    // to the low-power mode configured in the CCMR above.
    OALCPUEnterWFI();
    
}    

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

VOID BSPPowerOn()
{

}       

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

⌨️ 快捷键说明

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