reman3/Rayman_X/cpa/public/MMG/CpaMmg.h

1119 lines
56 KiB
C

/* ##H_FILE#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : CpaMmg.h
DESCRIPTION : this file contain all functions and macros used to allocate memory
and export the necessary structures :
Initialisation of the module
Initialisation of a static bloc
switch between dynamic and static mode
Allocate/ReAllocate/Free Memory
Check function for debugging
Destroy a static bloc
Destroy the module
VERSION : 5.1.0/Pierrick Crepy/Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef __CpaMmg_H__
#define __CpaMmg_H__
/* For DLLs who are using this module : */
#undef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
/* for emlulate the U64 on Pc*/
/*#define U64*/
/*#define u64 __int64*/
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#ifndef __ERRMMG_H__
#include "errMmg.h"
#endif /*__ERRMMG_H__*/
/*#include <stdio.h> /*because lint ==> repeated iclude file */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*/////////////////////////*/
/* Compilation directive // */
/*/////////////////////////*/
#define Modif4Ch /* __MULTI_THREAD_MEMORY_MANAGEMENT__*/
#define ModifMmgV5_1_0
#ifdef U64
#ifndef FINAL_VERSION
#define __DYNAMIC_MALLOC_ALLOWED__
#endif /* FINAL_VERSION*/
#else /* U64 */
#define __DYNAMIC_MALLOC_ALLOWED__
#endif /* U64 */
/* ##CONSTANTE#--------------------------------------------------------------------------
Constantes declaration
---------------------------------------------------------------------------------------*/
/*multi thread management*/
#define C_ucMmgDefaultChannel (0)
#define C_MaxNbPossibleChannel (255)
#define C_ucMmgDefaultGroup (0)
/* for __DEBUG_MALLOC_MODE__ information*/
#define C_ulDefaultMaxNbStaticMalloc (100000) /* maximum number of mallocs in a static block*/
#define C_ulDefaultMaxNbDynamicMalloc (100000) /* maximum number of dynamic malloc*/
#ifdef U64
/*OSMesgQueue *mq, OSMesg *msg*/
#else
#define TypeCriticalSection CRITICAL_SECTION
#endif /* U64 */
/* General*/
#define C_ucTrue (0xFF)
#define C_ucFalse (0)
/* alignment 32 bits:*/
#ifdef U64
#define C_uwAllocSize (8) /* for example here we are a 64 bits alignment*/
#define C_uwShiftAllocSize (3) /* 2^3=8*/
#define unitAlloc u64
#else /*U64*/
#define C_uwAllocSize (4) /* for example here we are a 32 bits alignment*/
#define C_uwShiftAllocSize (2) /* 2^2=4*/
#define unitAlloc unsigned long
#endif /*U64*/
/*XB*/
#ifdef U64
#include "ultra.h"
#endif /* U64 */
/*End XB*/
#define C_p_cBlockNotValidKey ((char *)(0XFFFFFFFF))
#define E_ucDynamic (0xFF)
/*mode parameter of Mmg_fn_vInitSpecificBlock*/
#define C_NoAlignement 1
/*mode parameter of Mmg_fn_vInitSpecificBlock*/
#define C_BlockWithFreeFlag 0
#define C_BlockWithoutFreeFlag 1
#define C_FillTheBlockWithCleanKeyFlag 2
#define C_Check_AlignementFlag 4
#define C_Check_OverflowFlag 8
/* ##TYPEDEF#----------------------------------------------------------------------------
Types definition
---------------------------------------------------------------------------------------*/
/* ##-########################### */
/* tdstChannelInfo */
/* ############################## */
typedef struct tdstChannelInfo_{
unsigned long ulThreadId;
unsigned char ucGroupId;
}tdstChannelInfo;
/* ##-########################### */
/* tdstGeneralChannelInfo */
/* ############################## */
typedef struct tdstGeneralChannelsInfo_{
unsigned char ucNbchannelUsed;
unsigned char ucMAxNbChannel;
tdstChannelInfo * d_stTabChannelInfo;
}tdstGeneralChannelInfo;
/* ##-########################### */
/* tdstCurrentModeInfo */
/* ############################## */
typedef struct tdstCurrentModeInfo_{
unsigned char ucModuleId;
unsigned char ucMode;
void *p_vTdstBlockInfoOrTdstDynInfo;
}tdstCurrentModeInfo;
/* ##-########################### */
/* tdstBlockInfo */
/* ############################## */
typedef struct tdstBlockInfo_{
char * p_cBeginBlock;
char * p_cEndBlock;
char * p_cFirstFree;
char * p_cMaxMem;
}tdstBlockInfo;
/* ##GLOBVAR#----------------------------------------------------------------------------
Globale variable declaration
---------------------------------------------------------------------------------------*/
#undef __CPAMMG_EXTERN
#ifdef __DeclareGlobalVariableInCpaMmg_h__
#define __CPAMMG_EXTERN /*nothing*/
#else
#define __CPAMMG_EXTERN extern
#endif /*__DeclareGlobalVariableInCpaMmg_h__*/
#ifdef _DEBUG
__CPAMMG_EXTERN CPA_EXPORT unsigned char g_ucBLockedAllocation
#if defined(__DeclareGlobalVariableInCpaMmg_h__) && !defined(CPA_WANTS_IMPORT)
= C_ucFalse
#endif /*__DeclareGlobalVariableInCpaMmg_h__ && CPA_WANTS_IMPORT*/
;
#endif /*_DEBUG*/
/* General table in order to access to informations about each allocation of all the module for debug mode*/
__CPAMMG_EXTERN CPA_EXPORT struct tdstBlockInfoPriv_ *g_a_p_stMmgModuleBlocksInfo[C_ucNbOfMaxModule];
__CPAMMG_EXTERN CPA_EXPORT unsigned char g_a_ucBlocksNbInModule[C_ucNbOfMaxModule];
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifndef _FIRE_DEADCODE_U64_
__CPAMMG_EXTERN CPA_EXPORT struct tdstDynInfo_ ** g_d_p_stMmgModuleDynInfo;
#endif /* _FIRE_DEADCODE_U64_ */
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
/* information about the current mode of allocation*/
__CPAMMG_EXTERN CPA_EXPORT struct tdstCurrentModeInfo_ * g_d_stCurrentModeInfo;
/*information about channel */
#if (!defined(U64) && !defined(PSX))
__CPAMMG_EXTERN CPA_EXPORT TypeCriticalSection g_MmgCriticalSection;
#endif /*U64 || PSX*/
__CPAMMG_EXTERN CPA_EXPORT tdstGeneralChannelInfo g_stGeneralChannelInfo;
/*//////////*/
/* Macros //*/
/*//////////*/
/* ##M#===================================================================================
NAME : Mmg_M_BigBoundSize
DESCRIPTION : boundering of the size. the size must be a the biggest nearly
multiple of C_uwAllocSizeRound
INPUT : Size & the alignement
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_BigBoundSize(ulSize, ucAlignment) \
/* ---------------- */\
\
/*lint -save -e774*/\
if ( (ulSize) & (unsigned long)(ucAlignment-1)) {\
/*lint -restore*/\
/*ulSize is not a multiple of ucAlignment. */ \
/* We round the ulSize at the next upper ucAlignment multiple. */ \
(ulSize) = ((ulSize) & (~((unsigned long)(ucAlignment-1)))) + ucAlignment;\
}
/* not used not tested*/
/* ##M#===================================================================================
NAME : Mmg_M_ulSmallBoundSize
DESCRIPTION : boundering of the size. the size must be a the Smallest nearly multiple of C_uwAllocSize
INPUT : Size
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_ulSmallBoundSize(ulSize) \
/* ------------------ */\
\
(ulSize) = ((ulSize) & (~((unsigned long)(C_uwAllocSize-1))));
/* ##M#===================================================================================
NAME : M_Max
DESCRIPTION : return the max between 2 values
INPUT : Value A
Value B
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define M_Max(a,b) ((a)>(b) ? (a) : (b))
/* ----------*/
/* macro use to test */
/* ##M#===================================================================================
NAME : Mmg_M_UpdateFatalDebugError
DESCRIPTION : Raise an error displaying window message for debugging
or do nothing
INPUT : Error Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef __FATAL_DEBUG_ERR_MMG__
#define Mmg_M_UpdateFatalDebugError(uwMyErrorId) Erm_M_UpdateLastError(Mmg, C_ucErmDefaultChannel, uwMyErrorId, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL)
/* ---------------------------*/
#else /*__FATAL_DEBUG_ERR_MMG__*/
#define Mmg_M_UpdateFatalDebugError(uwMyErrorId) ;/*Nothing to do*/
#endif /*__FATAL_DEBUG_ERR_MMG__*/
/* ##M#===================================================================================
NAME : Mmg_M_UpdateLastError
DESCRIPTION : Raise an error displaying window message for debugging
INPUT : Error Id
Error String
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_UpdateLastError(uwMyErr, szPersonalTxt) Erm_M_UpdateLastError (Mmg, C_ucErmDefaultChannel, uwMyErr, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, szPersonalTxt);
/* ##M#===================================================================================
NAME : Mmg_MulGetThreadId
DESCRIPTION : Return thread Id of a channel
INPUT : Channel Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_MulGetThreadId(ucChannel) (((g_stGeneralChannelInfo.d_stTabChannelInfo)[ucChannel]).ulThreadId)
/* ##M#===================================================================================
NAME : Mmg_MulGetThreadId
DESCRIPTION : Return group Id of a channel
INPUT : Channel Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_MucGetucGroupId(ucChannel) (((g_stGeneralChannelInfo.d_stTabChannelInfo)[ucChannel]).ucGroupId)
/* ##M#===================================================================================
NAME : Mmg_M_szAddChannelInfoToSzInitTxt
DESCRIPTION : Add channel info in a string
INPUT : String
Channel Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_szAddChannelInfoToSzInitTxt(szInitTxt, ucChannel)\
{\
if (ucChannel == C_ucMmgDefaultChannel){\
sprintf (szInitTxt, "%sMemory Channel=Default\n", szInitTxt);\
}\
else{\
sprintf (szInitTxt, "%s{Memory Channel=%d [0X%X, %d]\n", szInitTxt, ucChannel, Mmg_MulGetThreadId(ucChannel), Mmg_MucGetucGroupId(ucChannel));\
}\
}
#ifdef __ERROR_STRINGS__
/* ##M#===================================================================================
NAME : Mmg_M_UpdateLastErrorWithModuleId
DESCRIPTION : Raise an error using module Id
INPUT : Module Id
Error Id
Error text
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_UpdateLastErrorWithModuleId(ucModuleId, uwMyErr, szPersonalTxt) Mmg_fn_v_UpdateLastErrorWithModuleId(ucModuleId, uwMyErr, szPersonalTxt)
#else /*__ERROR_STRINGS__*/
/* ##M#===================================================================================
NAME : Mmg_M_UpdateLastErrorWithModuleIdAnducModeReference
DESCRIPTION : Raise an error using module Id and allocation mode
INPUT : Module Id
Allocation Mode
Error Id
Error text
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_UpdateLastErrorWithModuleIdAnducModeReference(ucModuleId, ucMode, uwMyErr, szPersonalTxt) Erm_M_UpdateLastError (Mmg, C_ucErmDefaultChannel, uwMyErr, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, szPersonalTxt);
#endif /*__ERROR_STRINGS__*/
/* ##M#===================================================================================
NAME : Mmg_M_UpdateLastErrorWithCurrentModeInfo
DESCRIPTION : Raise an error using current mode info
INPUT : Error Id
Error string
Channel Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef __ERROR_STRINGS__
#define Mmg_M_UpdateLastErrorWithCurrentModeInfo(uwMyErr, szPersonalTxt, ucChannel) Mmg_fn_v_UpdateLastErrorWithCurrentModeInfo(uwMyErr, szPersonalTxt, ucChannel)
#else /*__ERROR_STRINGS__*/
#define Mmg_M_UpdateLastErrorWithCurrentModeInfo(uwMyErr, szPersonalTxt, ucChannel) Erm_M_UpdateLastError (Mmg, C_ucErmDefaultChannel, uwMyErr, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, szPersonalTxt);
#endif /*__ERROR_STRINGS__*/
/* ##M#===================================================================================
NAME : Mmg_M_UpdateLastErrorWithModuleIdAnducModeReference
DESCRIPTION : Raise an error using module Id and allocation mode
INPUT : Module Id
Allocation Mode
Error Id
Error string
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef __ERROR_STRINGS__
#define Mmg_M_UpdateLastErrorWithModuleIdAnducModeReference(ucModuleId, ucMode, uwMyErr, szPersonalTxt) Mmg_fn_v_UpdateLastErrorWithModuleIdAnducModeReference(ucModuleId, ucMode, uwMyErr, szPersonalTxt)
#else /*__ERROR_STRINGS__*/
#define Mmg_M_UpdateLastErrorWithModuleIdAnducModeReference(ucModuleId, ucMode, uwMyErr, szPersonalTxt) Erm_M_UpdateLastError (Mmg, C_ucErmDefaultChannel, uwMyErr, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, szPersonalTxt);
#endif /*__ERROR_STRINGS__*/
/* ##M#===================================================================================
NAME : Mmg_M_ucIsStaticMode
DESCRIPTION : Return true if channel is in static mode
INPUT : Channel Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_ucIsStaticMode(ucChannel) ((g_d_stCurrentModeInfo[ucChannel]).ucMode!= E_ucDynamic)
/* --------------------*/
/* ##M#===================================================================================
NAME : Mmg_M_SetModeAlloc
DESCRIPTION : Compatibility maccro using default channel
INPUT : Module abbreviation
New Mode
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef Modif4Ch
#define Mmg_M_SetModeAlloc(ModuleAbreviation, ucNewMode) Mmg_M_SetModeAlloc4Ch(ModuleAbreviation, ucNewMode, C_ucMmgDefaultChannel)
#endif /*Modif4Ch*/
/* ##M#===================================================================================
NAME : Mmg_M_SetModeAlloc4Ch
DESCRIPTION : Set a new allocation mode in a channel
INPUT : Module abbreviation
New Mode
Channel Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_SetModeAlloc4Ch(ModuleAbreviation, ucNewMode, C_ucMmgDefaultChannel) Mmg_fn_v_SetModeAlloc(g_uc##ModuleAbreviation##ModuleId, ucNewMode, C_ucMmgDefaultChannel)
/* ##M#===================================================================================
NAME : Mmg_M_InitMmg
DESCRIPTION : Compatibility maccro using default max dynamic malloc
INPUT : Module abbreviation
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef ModifMmgV5_1_0
#define Mmg_M_InitMmg(ModuleName) Mmg_M_InitMmgV5_1_0(ModuleName, C_ulDefaultMaxNbDynamicMalloc)
#endif /*ModifMmgV5_1_0*/
/* ##M#===================================================================================
NAME : Mmg_M_InitMmgV5_1_0
DESCRIPTION : Initialization of a module to use memory
INPUT : Module abbreviation
Nb max dynamic malloc
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_InitMmgV5_1_0(ModuleName, ulMaxNbDynamicMalloc) Mmg_fn_v_InitMmg(g_uc##ModuleName##ModuleId, E_uc##ModuleName##MaxBlocksNb, ulMaxNbDynamicMalloc)
/* ##M#===================================================================================
NAME : Mmg_MCreateCriticalSection
Mmg_MEnterCriticalSection
Mmg_MLeaveCriticalSection
Mmg_MDeleteCriticalSection
DESCRIPTION : Maccros to create, lock, unlock and destroy a critical section
Do nothing on Ultra 64
INPUT : Module abbreviation
Nb max dynamic malloc
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#if (defined(U64) || defined(PSX) )
#define Mmg_MCreateCriticalSection() /*Nothing to do*/
#define Mmg_MEnterCriticalSection() /*Nothing to do*/
#define Mmg_MLeaveCriticalSection() /*Nothing to do*/
#define Mmg_MDeleteCriticalSection() /*Nothing to do*/
#else /*not U64 and not PSX*/
#define Mmg_MCreateCriticalSection() InitializeCriticalSection (&g_MmgCriticalSection)
#define Mmg_MEnterCriticalSection() EnterCriticalSection (&g_MmgCriticalSection)
#define Mmg_MLeaveCriticalSection() LeaveCriticalSection (&g_MmgCriticalSection)
#define Mmg_MDeleteCriticalSection() DeleteCriticalSection (&g_MmgCriticalSection)
#endif /*u64*/
/* ##M#===================================================================================
NAME : Mmg_M_InitBlock
DESCRIPTION : Compatibility maccro using default max static malloc
INPUT : Module abbreviation
Block Id
Size of the block
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef ModifMmgV5_1_0
#define Mmg_M_InitBlock(ModuleAbreviation, ucBlockId, ulSize) Mmg_M_InitBlockV5_1_0(ModuleAbreviation, ucBlockId, ulSize, C_ulDefaultMaxNbStaticMalloc)
#endif /* ModifMmgV5_1_0 */
/* ##M#===================================================================================
NAME : Mmg_M_InitBlockV5_1_0
DESCRIPTION : Initialization of a static block
INPUT : Module abbreviation
Block Id
Size of the block
Max static allocation
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_InitBlockV5_1_0(ModuleAbreviation, ucBlockId, ulSize, ulMaxNbStaticMalloc) Mmg_fn_vInitSpecificBlock (ucBlockId, g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId], ulSize, ulMaxNbStaticMalloc, C_NoAlignement, C_BlockWithFreeFlag)
#define Mmg_M_InitSpecificBlock(ModuleAbreviation, ucBlockId, ulSize, ulMaxNbStaticMalloc, ucAlignment, ucMode) Mmg_fn_vInitSpecificBlock (ucBlockId, g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId], ulSize, ulMaxNbStaticMalloc, ucAlignment, ucMode)
/* ##M#===================================================================================
NAME : Mmg_M_FreeBlock
DESCRIPTION : Free all allocation in a block
INPUT : Module abbreviation
Block Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_FreeBlock(ModuleAbreviation, ucBlockId) Mmg_fn_vFreeBlock (ucBlockId, g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId])
/* ##M#===================================================================================
NAME : Mmg_M_DeleteBlock
DESCRIPTION : Destroy all resource allocate for the management of a block
INPUT : Module abbreviation
Block Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_DeleteBlock(ModuleAbreviation, ucBlockId) Mmg_fn_vDeleteBlock (ucBlockId, g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId])
/* ##M#===================================================================================
NAME : Mmg_M_PrintAllDynamicMalloc
DESCRIPTION : Print all dynamic allocation done by a module
INPUT : Module abbreviation
Sort before print
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintAllDynamicMalloc(ModuleAbreviation, ucSorted)\
Mmg_fn_vPrintAllDynamicMalloc (g_uc##ModuleAbreviation##ModuleId, g_d_p_stMmgModuleDynInfo+g_uc##ModuleAbreviation##ModuleId, ucSorted);
/* ##M#===================================================================================
NAME : Mmg_M_PrintMapOfBlock
DESCRIPTION : Print map of static allocation done in a block
INPUT : Module abbreviation
Block Id
Sort before print
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintMapOfBlock(ModuleAbreviation, ucBlockId, ucSorted)\
Mmg_fn_vPrintMapOfBlock (g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId], ucBlockId, ucSorted);
/* ##M#===================================================================================
NAME : Mmg_M_PrintDebugMapOfblock
DESCRIPTION : Print map of static allocation done in a block
INPUT : Module abbreviation
Block Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintDebugMapOfblock(ModuleAbreviation, ucBlockId)\
Mmg_fn_vPrintDebugMapOfBlock (g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId], ucBlockId);
/* ##M#===================================================================================
NAME : Mmg_M_PrintBlockStatisticWithModuleId
DESCRIPTION : Print statistics on a block
INPUT : Module Id
Block Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintBlockStatisticWithModuleId(ucModuleId, ucBlockId) \
Mmg_fn_vPrintBlockStatistic (ucModuleId, g_a_p_stMmgModuleBlocksInfo[ucModuleId], ucBlockId);
/* ##M#===================================================================================
NAME : Mmg_M_PrintBlockStatistic
DESCRIPTION : Print statistics on a block
INPUT : Module abbreviation
Block Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintBlockStatistic(ModuleAbreviation, ucBlockId) \
Mmg_fn_vPrintBlockStatistic (g_uc##ModuleAbreviation##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleAbreviation##ModuleId], ucBlockId);
/* ##M#===================================================================================
NAME : Mmg_M_PrintDynamicMallocStatistic
DESCRIPTION : Print statistics on dynamic allocation of a module
INPUT : Module abbreviation
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintDynamicMallocStatistic(ModuleAbreviation)\
Mmg_fn_vPrintDynamicMallocStatistic (g_uc##ModuleAbreviation##ModuleId, g_d_p_stMmgModuleDynInfo+g_uc##ModuleAbreviation##ModuleId);
/* ##M#===================================================================================
NAME : Mmg_M_PrintUsedStaticMemoryInModule
DESCRIPTION : Print static memory used by a module
INPUT : Module abbreviation
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_PrintUsedStaticMemoryInModule(ModuleName)\
Mmg_fn_vPrintUsedStaticMemory (g_uc##ModuleName##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleName##ModuleId], E_uc##ModuleName##MaxBlocksNb);
/*XB*/
#ifdef CHECK_MEMORY
#define Mmg_M_CheckMemory(ModuleName)\
Mmg_fn_vCheckMemory(g_uc##ModuleName##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleName##ModuleId], E_uc##ModuleName##MaxBlocksNb)
#endif /* CHECK_MEMORY */
/*End XB*/
/* XB 02/06/99 */
#ifdef U64
#ifndef FINAL_VERSION
#define Mmg_M_GetUsedStaticMemory(ModuleName)\
Mmg_fn_ulGetUsedStaticMemory(g_uc##ModuleName##ModuleId, g_a_p_stMmgModuleBlocksInfo[g_uc##ModuleName##ModuleId], E_uc##ModuleName##MaxBlocksNb)
#endif /* !FINAL_VERSION */
/* End XB 02/06/99 */
#else /* pas u64 */
#define Mmg_M_GetUsedStaticMemory(ModuleName) 0
#endif /* u64 */
/*Macros in order to acces to static block information*/
/* ##M#===================================================================================
NAME : Mmg_M_b_ucTheModuleUseStaticMemory
DESCRIPTION : return true if a module use static memory
INPUT : Module Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_b_ucTheModuleUseStaticMemory(ucModuleId) (g_a_p_stMmgModuleBlocksInfo[ucModuleId]!= NULL)
/* ##M#===================================================================================
NAME : Mmg_M_ucGetNbOfBlocksUsedInModule
DESCRIPTION : return the number of sttic block used in a module
INPUT : Module Id
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#define Mmg_M_ucGetNbOfBlocksUsedInModule(ucModuleId) g_a_ucBlocksNbInModule[ucModuleId]
/* ##FUNCDEF#----------------------------------------------------------------------------
Functions definition
---------------------------------------------------------------------------------------*/
/* ##F#===================================================================================
NAME : Mmg_fn_cCheckAlignmentValidity
DESCRIPTION : check if alignement constant are valide
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_cCheckAlignmentValidity (void);
/* ##F#===================================================================================
NAME : Mmg_fn_vTestMalloc
DESCRIPTION : Check integrity for all allocation (only in debug mode)
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vTestMalloc(void);
/* ##F#===================================================================================
NAME : Mmg_fn_vTestMallocIntegrityAt
DESCRIPTION : Check the integrity of an allocated zone (only in debug mode)
INPUT : Pointer on the block structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vTestMallocIntegrityAt(void *p_vMemBlock);
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintUsedStaticMemory
DESCRIPTION : this function print the state of the statsic memory in
the file C_szErrorLogFileName
INPUT : Module Id
poniter on a block structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vPrintUsedStaticMemory(unsigned char ucModuleId, struct tdstBlockInfoPriv_ * a_stMyBlockInfo, unsigned char ucModuleMaxBlocksNb);
/*XB*/
#ifdef CHECK_MEMORY
extern CPA_EXPORT void Mmg_fn_vCheckMemory(unsigned char ucModuleId, struct tdstBlockInfoPriv_ * a_stMyBlockInfo, unsigned char ucModuleMaxBlocksNb);
#endif /* CHECK_MEMORY */
/*End XB*/
/* XB 02/06/99 */
#ifndef FINAL_VERSION
extern CPA_EXPORT unsigned long Mmg_fn_ulGetUsedStaticMemory(unsigned char ucModuleId, struct tdstBlockInfoPriv_ * a_stMyBlockInfo, unsigned char ucModuleMaxBlocksNb);
#endif /* !FINAL_VERSION */
/* End XB 02/06/99 */
/* ##F#===================================================================================
NAME : Mmg_fn_vInitBlock
DESCRIPTION : Make the real allocation and init variables for block managing
INPUT : Block Id
Module Id
Block Structure
Size of the block
Max number of allocation in the block (only used for debugging)
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vInitSpecificBlock (unsigned char ucBlockId, unsigned char ucModuleId, struct tdstBlockInfoPriv_ *p_stMyBlocksInfo, unsigned long ulSize, unsigned long ulMaxNbStaticMalloc, unsigned char ucAlignment, unsigned char ucMode);
/* ##F#===================================================================================
NAME : Mmg_fn_vFreeBlock
DESCRIPTION : Re-init bloc variables to free all allocation in the block
INPUT : Block Id
Module Id
Block Structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vFreeBlock (unsigned char ucBlockId, unsigned char ucModuleId, struct tdstBlockInfoPriv_ *p_stMyBlocksInfo);
/* ##F#===================================================================================
NAME : Mmg_fn_vDeleteBlock
DESCRIPTION : Free Memory and invalidate the block
INPUT : Block Id
Module Id
Block Structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vDeleteBlock (unsigned char ucBlockId, unsigned char ucModuleId, struct tdstBlockInfoPriv_ *p_stMyBlocksInfo);
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintAllDynamicMalloc
DESCRIPTION : Print the map of dynamic allocation for a module (only in debug mode)
INPUT : Module Id
Pointer on dynamic malloc info structure
Flag to indicate that info must be sorted
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
extern CPA_EXPORT void Mmg_fn_vPrintAllDynamicMalloc (unsigned char ucModuleId, struct tdstDynInfo_ *p_stMyDynInfo, unsigned char ucSorted);
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
#endif /*__DEBUG_MALLOC_MODE__*/
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintMapOfBlock
DESCRIPTION : Print the map of static allocation for a block (only in debug mode)
INPUT : Module Id
Pointer on block info structure
Block Id
Flag to indicate that info must be sorted
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vPrintMapOfBlock (unsigned char ucModuleId, struct tdstBlockInfoPriv_ *p_stMyBlocksInfo, unsigned char ucBlockId, unsigned char ucSorted);
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintDebugMapOfBlock
DESCRIPTION : Print the map of static allocation for a block (only in debug mode)
INPUT : Module Id
Pointer on block info structure
Block Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vPrintDebugMapOfBlock (unsigned char ucModuleId, struct tdstBlockInfoPriv_ *p_stMyBlocksInfo, unsigned char ucBlockId);
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintBlockStatistic
DESCRIPTION : Print statistic on a block (only in debug mode)
INPUT : Module Id
Pointer on block info structure
Block Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vPrintBlockStatistic (unsigned char ucModuleId, struct tdstBlockInfoPriv_ *p_stMyBlocksInfo, unsigned char ucBlockId);
/* ##F#===================================================================================
NAME : Mmg_fn_vPrintDynamicMallocStatistic
DESCRIPTION : Print statistic on a dynamic allocation of a module (only in debug mode)
INPUT : Module Id
Pointer on block info structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
#ifdef __DEBUG_MALLOC_MODE__
#ifdef __DYNAMIC_MALLOC_ALLOWED__
extern CPA_EXPORT void Mmg_fn_vPrintDynamicMallocStatistic (unsigned char ucModuleId, struct tdstDynInfo_ *p_stMyDynInfo);
#endif/* __DYNAMIC_MALLOC_ALLOWED__*/
#endif /*__DEBUG_MALLOC_MODE__*/
#ifdef __DYNAMIC_MALLOC_ALLOWED__
/* ##M#===================================================================================
NAME : Mmg_fn_p_vAlloc Mmg_fn_vFree Mmg_fn_p_vRealloc
DESCRIPTION : Compatibility maccro using default channel
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef Modif4Ch
#define Mmg_fn_p_vAlloc(ulSize) fn_p_vGenAlloc (ulSize, C_ucMmgDefaultChannel)
#define Mmg_fn_vFree(p_vMmgBlock) fn_vGenFree (p_vMmgBlock, C_ucMmgDefaultChannel)
#define Mmg_fn_p_vRealloc(p_vMmgBlock, ulSize) fn_p_vGenRealloc (p_vMmgBlock, ulSize, C_ucMmgDefaultChannel)
#endif /*Modif4Ch*/
/* ##M#===================================================================================
NAME : Mmg_fn_p_vAlloc4Ch
DESCRIPTION : Allocate a memory zone in the channel using the corresponding Mode
INPUT : Size
Channel Id
OUTPUT : Pointeur on the zone allocated
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
#define Mmg_fn_p_vAlloc4Ch(ulSize, ucChannel) fn_p_vGenAlloc (ulSize, ucChannel)
/* ##M#===================================================================================
NAME : Mmg_fn_vFree4Ch
DESCRIPTION : Free a memory zone in the channel using the corresponding Mode
INPUT : Pointer on the zone allocated
Channel Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
#define Mmg_fn_vFree4Ch(p_vMmgBlock, ucChannel) fn_vGenFree (p_vMmgBlock, ucChannel)
/* ##M#===================================================================================
NAME : Mmg_fn_p_vRealloc4Ch
DESCRIPTION : Reallocate a memory zone in the channel using the corresponding Mode
INPUT : Pointer on the zone allocated
Size
Channel Id
OUTPUT : Pointeur on the new zone allocated
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
#define Mmg_fn_p_vRealloc4Ch(p_vMmgBlock, ulSize, ucChannel) fn_p_vGenRealloc (p_vMmgBlock, ulSize, ucChannel)
#else /* __DYNAMIC_MALLOC_ALLOWED__ not defined*/
#ifdef Modif4Ch
#define Mmg_fn_p_vAlloc(ulSize) fn_p_vStaAlloc (ulSize, C_ucMmgDefaultChannel)
#endif /*Modif4Ch*/
#define Mmg_fn_p_vAlloc4Ch(ulSize, ucChannel) fn_p_vStaAlloc (ulSize, ucChannel)
extern CPA_EXPORT void * fn_p_vStaAlloc (unsigned long ulSize, unsigned char ucChannel);
#ifdef Modif4Ch
#define Mmg_fn_vFree(p_vMmgBlock) fn_vStaFree (p_vMmgBlock, C_ucMmgDefaultChannel)
#endif /*Modif4Ch*/
#define Mmg_fn_vFree4Ch(p_vMmgBlock, ucChannel) fn_vStaFree (p_vMmgBlock, ucChannel)
extern CPA_EXPORT void fn_vStaFree (void *p_vMmgBlock, unsigned char ucChannel);
#ifdef Modif4Ch
#define Mmg_fn_p_vRealloc(p_vMmgBlock, ulSize) fn_p_vStaRealloc (p_vMmgBlock, ulSize, C_ucMmgDefaultChannel)
#endif /*Modif4Ch*/
#define Mmg_fn_p_vRealloc4Ch(p_vMmgBlock, ulSize, ucChannel) fn_p_vStaRealloc (p_vMmgBlock, ulSize, ucChannel)
extern CPA_EXPORT void * fn_p_vStaRealloc (void *p_vMmgBlock, unsigned long ulSize, unsigned char ucChannel);
#endif /* __DYNAMIC_MALLOC_ALLOWED__*/
#ifdef __DYNAMIC_MALLOC_ALLOWED__
extern CPA_EXPORT void * fn_p_vGenAlloc (unsigned long ulSize, unsigned char ucChannel);
extern CPA_EXPORT void fn_vGenFree (void *p_vMmgBlock, unsigned char ucChannel);
extern CPA_EXPORT void * fn_p_vGenRealloc (void *p_vMmgBlock, unsigned long ulSize, unsigned char ucChannel);
#endif /* __DYNAMIC_MALLOC_ALLOWED__*/
/* ##F#===================================================================================
NAME : Mmg_fn_v_ClearLogFile
DESCRIPTION : Clear the log file C_szMmgLogFileName
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_ClearLogFile(void);
/* ##F#===================================================================================
NAME : Mmg_fn_v_PrintInfoMalloc
DESCRIPTION : Add a string in the log file C_szMmgLogFileName
INPUT : String to print
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_PrintInfoMalloc(char *p_cTxt);
/* ##F#===================================================================================
NAME : Mmg_fn_vTestNbFreeIntheCurentMode
DESCRIPTION : Check the validity of nb frre on a channel(only in debug mode)
INPUT : Channel Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
void Mmg_fn_vTestNbFreeIntheCurentMode(unsigned char ucChannel);
/* ##F#===================================================================================
NAME : Mmg_fn_vTestNbFree
DESCRIPTION : Check the validity of nb free in a static bloc (only in debug mode)
INPUT : Module Id
Block Id
Pointer on a block info structure
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
void Mmg_fn_vTestNbFree(unsigned char ucModuleId, unsigned char ucBlockId, struct tdstBlockInfoPriv_ *p_stBlockInfo);
/* ##M#===================================================================================
NAME : Mmg_fn_vBlockGarbageCollector
DESCRIPTION : Compatibility maccro using default channel
=========================================================================================
CREATION : 06-11-97/Crepy Pierrick
=======================================================================================*/
#ifdef Modif4Ch
#define Mmg_fn_vBlockGarbageCollector(a, b) Mmg_fn_vBlockGarbageCollector4Ch(a, b, C_ucMmgDefaultChannel)
#endif /* Modif4Ch */
/* ##F#===================================================================================
NAME : Mmg_fn_vBlockGarbageCollector4Ch
DESCRIPTION : Do a garbage collector on a block, beware all pointer that point into
the bloc must be pass in parameter (even local pointer in the block)
INPUT : Table of pointer (point into the block)
Max Malloc in the block
Channel Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vBlockGarbageCollector4Ch(void** a_pp_vTab[], unsigned short uwMaxNbMallocInBlock, unsigned char ucChannel);
/* ##F#===================================================================================
NAME : Mmg_fn_vBlockGarbageCollector4Ch
DESCRIPTION : return Block Id & beginning address if found
INPUT : Pointer on a zone
pointer to stock the block Id
pointer to stock the beginning address of the block
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vWhereIs (void * p_vPtr, unsigned short *p_uwModuleBlockId, void ** pp_vBeginAdr);
/* ##F#===================================================================================
NAME : Mmg_fn_p_vGiveTheBeginingAddress
DESCRIPTION : return the beginning address of a block
INPUT : Block Id
OUTPUT : address of the block beginning
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void * Mmg_fn_p_vGiveTheBeginingAddress (unsigned short uwModuleBlockId);
#ifdef _DEBUG
/* ##F#===================================================================================
NAME : Mmg_fn_vLockAlloaction
DESCRIPTION : Allow blocking of all alloc operation
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vLockAlloaction();
/* ##F#===================================================================================
NAME : Mmg_fn_vUnLockAlloaction
DESCRIPTION : Allow unblocking of all alloc operation
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vUnLockAlloaction();
#endif /*_DEBUG*/
/* ##F#===================================================================================
NAME : Mmg_fn_ucGiveChannelId
DESCRIPTION : Provide a unique channel identificator for a couple (Thraed,group)
BEWARE : always use the default group
INPUT : Thraed Id
Group Id
OUTPUT : Channel Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT unsigned char Mmg_fn_ucGiveChannelId(unsigned long ulThreadId, unsigned char ucGroupId);
/* ##F#===================================================================================
NAME : Mmg_fn_vReleaseChannelId
DESCRIPTION : release a channel previuosly return by Mmg_fn_ucGiveChannelId
to re-use this channel later
INPUT : Channel Id
=========================================================================================
CREATION : 25-11-97/Carlos Torres
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vReleaseChannelId(unsigned char ucChannelId);
/* ##F#===================================================================================
NAME : Mmg_fn_vFirstInitMmgModule
DESCRIPTION : Initialization of the Mmg module MUST be use before using MMG functions
INPUT : Max number of channel authorized
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vFirstInitMmgModule (unsigned char ucMAxNbChannel);
/* ##F#===================================================================================
NAME : Mmg_fn_v_InitMmg
DESCRIPTION : Initialization of Mmg for another module. MUST be done before the module
can use MMG functions.
INPUT : Module Id
Max static block
Max dynamic allocation allowed
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_InitMmg(unsigned char ucModuleId, unsigned char ucMaxBlocksNb, unsigned long ulMaxNbDynamicMalloc);
/* ##F#===================================================================================
NAME : Mmg_fn_vStopMmgModule
DESCRIPTION : Destroy all ressource allocated by MMG. MUST be use before the end of the program
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vStopMmgModule();
/* ##F#===================================================================================
NAME : Mmg_fn_v_SetModeAlloc
DESCRIPTION : Set the mode dynamic or static (choosing a block) for a channel
INPUT : Module Id
New Mode
Channel Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_SetModeAlloc(unsigned char ucModuleId, unsigned char ucNewMode, unsigned char ucChannel);
/* ##F#===================================================================================
NAME : Mmg_fn_v_InitMmg
DESCRIPTION : Destroy all ressource allocated for the management of memory for a module
INPUT : Module Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_StopMmg(unsigned char ucModuleId);
/* ##F#===================================================================================
NAME : Mmg_fn_v_PrintAllocationsUsedForMmg
DESCRIPTION : Print statistic concerning the memory used to manage allocation
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_PrintAllocationsUsedForMmg();
/* ##F#===================================================================================
NAME : Mmg_fn_vGiveInformationBlock
DESCRIPTION : Give information data on a block
-> address of block beginning
-> address of block end
-> address of the first free
-> the maximum address reached (different of the last address used)
INPUT : Module Id
Block ID
pointer on structure of block info
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vGiveInformationBlock(unsigned char ucModuleId, unsigned char ucBlockId, struct tdstBlockInfo_ *p_stMyBlockInfo);
/* ##F#===================================================================================
NAME : Mmg_fn_vSaveInformationBlock
DESCRIPTION : Init a block with the following info structure
-> address of block beginning
-> address of block end
-> address of the first free
-> the maximum address reached (different of the last address used)
INPUT : Module Id
Block ID
pointer on structure of block info
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_vSaveInformationBlock(unsigned char ucModuleId, unsigned char ucBlockId, struct tdstBlockInfo_ *p_stMyBlockInfo);
/* ##F#===================================================================================
NAME : Mmg_fn_ulSizeOfUsefullMemory
DESCRIPTION : return the size of the usefull memory in a block
INPUT : Module Id
Block ID
OUTPUT : size of usefull memory
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT unsigned long Mmg_fn_ulSizeOfUsefullMemory (unsigned char ucModuleId, unsigned char ucBlockId);
/* ##F#===================================================================================
NAME : Mmg_fn_ulmsize
DESCRIPTION : return the size in byte used for the allocation of a zone
INPUT : Pointer on the allocated zone
OUTPUT : Real size of the zone (including the management data)
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT unsigned long Mmg_fn_ulmsize(void *p_vMemBlock);
#ifdef __ERROR_STRINGS__
/* ##F#===================================================================================
NAME : Mmg_fn_v_UpdateLastErrorWithModuleId
DESCRIPTION : raise an error using module Id
INPUT : Module Id
Error to raise
Message to display
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_UpdateLastErrorWithModuleId(unsigned char ucModuleId,unsigned short uwMyErr, char *szPersonalTxt);
/* ##F#===================================================================================
NAME : Mmg_fn_v_UpdateLastErrorWithCurrentModeInfo
DESCRIPTION : raise an error using channel
INPUT : Error to raise
Message to display
Channel Id
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_UpdateLastErrorWithCurrentModeInfo(unsigned short uwMyErr,char * szPersonalTxt,unsigned char ucChannel);
/* ##F#===================================================================================
NAME : Mmg_fn_v_UpdateLastErrorWithModuleIdAnducModeReference
DESCRIPTION : raise an error using module id and allocation mode
INPUT : Module Id
Allocation Mode
Error to raise
Message to display
=========================================================================================
CREATION : 06-11-97/Pierrick Crepy
=======================================================================================*/
extern CPA_EXPORT void Mmg_fn_v_UpdateLastErrorWithModuleIdAnducModeReference(unsigned char ucModuleId, unsigned char ucMode, unsigned short uwMyErr, char *szPersonalTxt);
extern CPA_EXPORT void Mmg_fn_v_UpdateLastErrorWithCallingRefAndCurrentModeInfo(unsigned short uwMyErr, char *szThePersonalTxt, unsigned char ucChannel);
#endif /*__ERROR_STRINGS__*/
/*/////////////////////////////////////////////////////////*/
/* FQ OVR*/
/*/////////////////////////////////////////////////////////*/
/**/
/* Using unused code to malloc in :-)*/
/**/
/*/////////////////////////////////////////////////////////*/
#ifdef U64
#ifndef _FIRE_DEADCODE_U64_ /* Added by XB */
void MMG_fn_vReinit_FreeMemoryBlocks(void);
void MMG_fn_vAddFreeMemoryBlock(void *StartingAddress, unsigned int uiSize);
void *MMG_fn_p_vMallocInHoles(unsigned int uiSize); /* YOU MUST TEST FOR NULL RETURN !!*/
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by XB */
#endif /* U64*/
/* END FQ OVR*/
/*/////////////////////////////////////////////////////////*/
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /*__CpaMmg_H__*/