📄 bspprp.cpp
字号:
//
// 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: bspprp.c
//
// Provides BSP-specific configuration routines for the pre-processing.
//
//------------------------------------------------------------------------------
#include "bsp.h"
//------------------------------------------------------------------------------
// External Functions
//------------------------------------------------------------------------------
// External Variables
//------------------------------------------------------------------------------
// Defines
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
// Global Variables
//------------------------------------------------------------------------------
// Local Variables
static PBSP_ARGS g_pDriverGlobal;
//------------------------------------------------------------------------------
// Local Functions
//------------------------------------------------------------------------------
//
// Function: BSPPrpAlloc
//
// This function is for BSP-specific allocation.
//
// Parameters:
// None.
//
// Returns:
// TRUE if successful; FALSE if failed.
//
//------------------------------------------------------------------------------
BOOL BSPPrpAlloc()
{
PHYSICAL_ADDRESS phyAddr;
phyAddr.QuadPart = IMAGE_SHARE_ARGS_RAM_PA_START;
g_pDriverGlobal = (PBSP_ARGS)MmMapIoSpace(phyAddr,
sizeof(BSP_ARGS), FALSE);
if (g_pDriverGlobal == NULL) {
// Error messages will be printed in CSP
return FALSE;
}
return TRUE;
}
//------------------------------------------------------------------------------
//
// Function: BSPPrpDealloc
//
// This function is for BSP-specific deallocation.
//
// Parameters:
// None.
//
// Returns:
// None.
//
//------------------------------------------------------------------------------
void BSPPrpDealloc()
{
if (g_pDriverGlobal != NULL) {
MmUnmapIoSpace(g_pDriverGlobal, sizeof(BSP_ARGS));
g_pDriverGlobal = NULL;
}
}
//------------------------------------------------------------------------------
//
// Function: BSPPrpSetClockGatingMode
//
// This function enable or disable eMMA clock.
//
// Parameters:
// bEnable
// [in] Boolean indicates enable or disable.
//
// Returns:
// TRUE if successful; FALSE if failed.
//
//------------------------------------------------------------------------------
BOOL BSPPrpSetClockGatingMode(BOOL bEnable)
{
if (bEnable)
{
if (g_pDriverGlobal->emma.usingStatus == 0)
{
// Enable eMMA clock
DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_EMMA,
DDK_CLOCK_GATE_MODE_ENABLE);
DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_HCLK_EMMA,
DDK_CLOCK_GATE_MODE_ENABLE);
}
else
{
if (g_pDriverGlobal->emma.usingStatus & EMMA_PRP_USING_FLAG)
{
// Probably already used by someone
return FALSE;
}
}
// Set PrP using status
g_pDriverGlobal->emma.usingStatus |= EMMA_PRP_USING_FLAG;
}
else
{
if ((g_pDriverGlobal->emma.usingStatus & (~EMMA_PRP_USING_FLAG)) == 0)
{
// Disable eMMA clock
DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_EMMA,
DDK_CLOCK_GATE_MODE_DISABLE);
DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_HCLK_EMMA,
DDK_CLOCK_GATE_MODE_DISABLE);
}
// Clear PrP using status
g_pDriverGlobal->emma.usingStatus &= ~EMMA_PRP_USING_FLAG;
}
return TRUE;
}
//------------------------------------------------------------------------------
//
// Function: BSPSetPrpIntrThreadPriority
//
// This function sets the thread priority for the pre-processor.
//
// Parameters:
// None.
//
// Returns:
// None.
//
//------------------------------------------------------------------------------
void BSPSetPrpIntrThreadPriority()
{
CeSetThreadPriority(GetCurrentThread(), 100);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -