📄 power.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.
//
//-----------------------------------------------------------------------------
//
// Copyright (C) 2004-2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//-----------------------------------------------------------------------------
//
// 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
// Deactivate 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_DISABLE) |
CSP_BITFVAL(CCM_CCMR_WBEN, CCM_CCMR_WBEN_ENABLE) |
CSP_BITFVAL(CCM_CCMR_SBYCS, CCM_CCMR_SBYCS_DISABLED));
#if 0
// If 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();
}
#endif
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -