135 lines
3.4 KiB
C
135 lines
3.4 KiB
C
/*
|
|
------------------------------------------------------------------------------------------
|
|
IMPLEMENTATION FILE FOR :
|
|
Main file for mathematical module
|
|
------------------------------------------------------------------------------------------
|
|
File Name :
|
|
MthMain.c
|
|
------------------------------------------------------------------------------------------
|
|
Creation Date :
|
|
February 18,1997
|
|
Author :
|
|
Albert PAIS
|
|
------------------------------------------------------------------------------------------
|
|
Contents :
|
|
This file contains main implementation for mathematical module
|
|
------------------------------------------------------------------------------------------
|
|
Remarks :
|
|
At the creation date, it is used to implemant mathematical error and memory management
|
|
module only.
|
|
------------------------------------------------------------------------------------------
|
|
See Also :
|
|
ErrMth.h for error management definition
|
|
MemMth.h for memory management definition
|
|
------------------------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
------------------------------------------------------------------------------------------
|
|
INCLUDE FILES :
|
|
------------------------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "AIUseCPA.h"
|
|
#include "specif/AIOption.h"
|
|
|
|
/*
|
|
----------------------------------------
|
|
File Name :
|
|
Mth_Opt.h
|
|
----------------------------------------
|
|
Required for :
|
|
Definition of MTH module option
|
|
----------------------------------------
|
|
*/
|
|
#include "Mth_Opt.h"
|
|
/*
|
|
----------------------------------------
|
|
File Name :
|
|
Mth_Erm.h
|
|
----------------------------------------
|
|
Required for :
|
|
Error file definition
|
|
----------------------------------------
|
|
*/
|
|
#define __DeclareGlobalVariableErrMth_h__
|
|
#include "Mth_Erm.h"
|
|
#undef __DeclareGlobalVariableErrMth_h__
|
|
|
|
/*
|
|
----------------------------------------
|
|
File Name :
|
|
Mth_Mmg.h
|
|
----------------------------------------
|
|
Required for :
|
|
Memory file definition
|
|
----------------------------------------
|
|
*/
|
|
#define __DeclareGlobalVariableMemMth_h__
|
|
#include "Mth_Mmg.h"
|
|
#undef __DeclareGlobalVariableMemMth_h__
|
|
|
|
/*
|
|
----------------------------------------
|
|
File Name :
|
|
Mth_Misc.h
|
|
----------------------------------------
|
|
Required for :
|
|
Miscellaneous definition.
|
|
----------------------------------------
|
|
*/
|
|
#define MTH_MISC_GLOBALS
|
|
#include "Mth_Misc.h"
|
|
#undef MTH_MISC_GLOBALS
|
|
|
|
|
|
|
|
void MTH_fnv_InitModule(unsigned long _ulMemorySizePerBlock)
|
|
{
|
|
#ifdef MODE_STATIC_MEM_FOR_MTH
|
|
unsigned char c_ucCurrentBlock;
|
|
#else
|
|
_ulMemorySizePerBlock=_ulMemorySizePerBlock;
|
|
#endif /* MODE_STATIC_MEM_FOR_MTH */
|
|
|
|
/* Init error module :*/
|
|
Erm_M_InitErrMsg(MTH);
|
|
/* init memory module */
|
|
Mmg_M_InitMmg(MTH);
|
|
#ifdef MODE_STATIC_MEM_FOR_MTH
|
|
/* initialise blocks :*/
|
|
for
|
|
(
|
|
c_ucCurrentBlock = 0;
|
|
c_ucCurrentBlock<E_ucMTHMaxBlocksNb;
|
|
c_ucCurrentBlock++
|
|
)
|
|
{
|
|
Mmg_M_InitBlock(MTH,c_ucCurrentBlock,_ulMemorySizePerBlock*1024);
|
|
}
|
|
#endif /* MODE_STATIC_MEM_FOR_MTH */
|
|
}
|
|
|
|
void MTH_fnv_DesinitModule(void)
|
|
{
|
|
#ifdef MODE_STATIC_MEM_FOR_MTH
|
|
unsigned char c_ucCurrentBlock;
|
|
#endif /* MODE_STATIC_MEM_FOR_MTH */
|
|
/* desinit previous allocated blocks !*/
|
|
|
|
#ifdef MODE_STATIC_MEM_FOR_MTH
|
|
for(c_ucCurrentBlock=0;c_ucCurrentBlock;c_ucCurrentBlock++)
|
|
{
|
|
MTH_M_FreeBlock(MTH,c_ucCurrentBlock);
|
|
}
|
|
#endif /* MODE_STATIC_MEM_FOR_MTH */
|
|
}
|
|
|
|
#ifndef FINAL_VERSION
|
|
void MTH_PrintUsedStaticMemory()
|
|
{
|
|
Mmg_M_PrintUsedStaticMemoryInModule(MTH);
|
|
}
|
|
#endif /* FINAL_VERSION */
|
|
|