tmchk.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:3k
- /**********************************************************************
- File name : tmchk.c
- Description : memory check
- COPYRIGHT (C) STMicroelectronics AP-HEG Competence Centre 2005.
- Name Date Modification
- ---- ---- ------------
- TM 20/05/05 Added for memory check
- **********************************************************************/
- /* Includes -------------------------------------------------------- */
- #include "stdio.h"
- #include "string.h"
- #include "assert.h"
- #include "stddefs.h"
- #include "stlite.h"
- #include "stdevice.h"
- #include "sttbx.h"
- //#include "sections.h"
- #include "avmem.h"
- extern ST_Partition_t *InternalPartition;
- extern ST_Partition_t *SystemPartition;
- extern ST_Partition_t *NcachePartition;
- extern ST_DeviceName_t AVMEM_DeviceName;
- static U32 SystemRecord=0;
- static U32 NcacheRecord=0;
- static U32 AvmemRecord=0;
- void SRCHK_RecordMemoryStatus(void)
- {
- partition_status_t partitionStatus;
- U32 TotalFreeSize;
- partition_status(SystemPartition,&partitionStatus,0);
- //STTBX_Print(("System Partition Size %d Used %d Free %dn", partitionStatus.partition_status_size,
- //partitionStatus.partition_status_used,partitionStatus.partition_status_free));
- if(SystemRecord < partitionStatus.partition_status_used)
- SystemRecord = partitionStatus.partition_status_used;
- printf("n============================================================");
- printf("ntt SIZE tt USED tt FREE");
- printf("n============================================================");
- printf("n** System ** ");
- printf("t %d t %d t %d", partitionStatus.partition_status_size, partitionStatus.partition_status_used,partitionStatus.partition_status_free);
-
- partition_status(NcachePartition,&partitionStatus,0);
- //STTBX_Print(("Ncache Partition Size %d Used %d Free %dn", partitionStatus.partition_status_size,
- //partitionStatus.partition_status_used,partitionStatus.partition_status_free));
- if(NcacheRecord < partitionStatus.partition_status_used)
- NcacheRecord = partitionStatus.partition_status_used;
- printf("n** NCache ** ");
- printf("t %d t %d tt %d", partitionStatus.partition_status_size, partitionStatus.partition_status_used,partitionStatus.partition_status_free);
- STAVMEM_GetFreeSize(AVMEM_DeviceName, &TotalFreeSize);
- //STTBX_Print(("AVMEM Partition Size %d Used %d Free %dn", AVMEM_SIZE,(AVMEM_SIZE-TotalFreeSize),TotalFreeSize));
- //workaround STAVMEM_GetFreeSize when full avmem size is available
- if(TotalFreeSize > AVMEM_SIZE)
- {
- AvmemRecord =0;
- }
- else {
- if(AvmemRecord < (AVMEM_SIZE-TotalFreeSize))
- AvmemRecord = AVMEM_SIZE-TotalFreeSize;
- }
- printf("n** AVMEM ** ");
- printf("t %d t %d t %d", AVMEM_SIZE, AvmemRecord, TotalFreeSize);
-
- }
- void SRCHK_ShowMemoryStatus(void)
- {
- printf("Record Sizes Sys=%d, Ncache=%d, AVmem=%dn", SystemRecord, NcacheRecord, AvmemRecord);
- }