📄 memory.cpp
字号:
/***************************************************************************
* Name : memory.cpp
* Title : MBX WinCE driver GPE class
* Author(s) : Imagination Technologies
* Created : 6th January 2003
*
* Copyright : 2003 by Imagination Technologies. All rights reserved.
* : No part of this software, either material or conceptual
* : may be copied or distributed, transmitted, transcribed,
* : stored in a retrieval system or translated into any
* : human or computer language in any form by any means,
* : electronic, mechanical, manual or other-wise, or
* : disclosed to third parties without the express written
* : permission of Imagination Technologies Limited, Unit 8,
* : HomePark Industrial Estate, King's Langley, Hertfordshire,
* : WD4 8LZ, U.K.
*
* Description : MBX WinCE driver GPE class.
*
* Platform : WinCE
*
* Modifications:-
* $Log: memory.cpp $
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
****************************************************************************/
#include "precomp.h"
/*****************************************************************************
FUNCTION : VideoAlloc
PURPOSE : This function allocates video memory. It does so by locating
a free node of the appropriate size and turning it into an
allocated node. It will split the remaining piece of the free
node into a new free node.
PARAMETERS :
RETURNS :
*****************************************************************************/
LPVOID MBX::VideoAlloc( ULONG ulBytes, ULONG ulAlignment, ULONG *pui32PhysAddr )
{
//////////DPFENTER((L"->VideoAlloc"));
if (ulAlignment == 0)
{
ulAlignment = 1;
}
// Attempt to allocate from FB memory, internal or external
MemNode *pclNode = new MemNode (ulBytes,
&m_sDevData,
ulAlignment,
FBALLOC_STRATEGY_INTN | FBALLOC_STRATEGY_EXTN);
if (pclNode)
{
m_cl2DMemNodes.AddToDevMemList(pclNode);
/////DPFEXIT((L"<-VideoAlloc, success"));
*pui32PhysAddr = pclNode->m_psDevMemHandle->uiDevAddr.uiAddr;
return (pclNode->m_psDevMemHandle->pvLinAddr);
}
/////DPFEXIT((L"<-VideoAlloc, failure"));
return (NULL);
}
/*****************************************************************************
FUNCTION : VideoFree
PURPOSE : This function frees video memory allocations made with VideoAlloc.
PARAMETERS :
RETURNS :
*****************************************************************************/
VOID MBX::VideoFree( LPVOID pMem )
{
MemNode *pclNode;
//////////DPFENTER((L"->VideoFree"));
pclNode = m_cl2DMemNodes.FindInDevMemList (pMem);
if (pclNode)
{
delete pclNode;
}
else
{
DPFX(PVR_ZONE_MEMORY, (L"VideoFree: already freed\n"));
}
/////DPFEXIT((L"<-VideoFree"));
}
/********************************** end of file ******************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -