tmchk.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:3k
源码类别:

DVD

开发平台:

C/C++

  1. /**********************************************************************
  2. File name   : tmchk.c
  3. Description : memory check
  4. COPYRIGHT (C) STMicroelectronics AP-HEG Competence Centre 2005.
  5. Name  Date             Modification
  6. ----  ----             ------------
  7. TM    20/05/05         Added for memory check
  8. **********************************************************************/
  9. /* Includes -------------------------------------------------------- */
  10. #include "stdio.h"
  11. #include "string.h"
  12. #include "assert.h"
  13. #include "stddefs.h"
  14. #include "stlite.h"
  15. #include "stdevice.h"
  16. #include "sttbx.h"
  17. //#include "sections.h"
  18. #include "avmem.h"
  19. extern ST_Partition_t  *InternalPartition;
  20. extern ST_Partition_t  *SystemPartition;
  21. extern ST_Partition_t  *NcachePartition;
  22. extern ST_DeviceName_t           AVMEM_DeviceName;
  23. static U32 SystemRecord=0;
  24. static U32 NcacheRecord=0;
  25. static U32 AvmemRecord=0;
  26. void SRCHK_RecordMemoryStatus(void)
  27. {
  28.     partition_status_t  partitionStatus;
  29.     U32                 TotalFreeSize;
  30.     partition_status(SystemPartition,&partitionStatus,0);
  31.     //STTBX_Print(("System Partition Size %d Used %d Free %dn", partitionStatus.partition_status_size,
  32.     //partitionStatus.partition_status_used,partitionStatus.partition_status_free));
  33. if(SystemRecord < partitionStatus.partition_status_used)
  34. SystemRecord = partitionStatus.partition_status_used;
  35. printf("n============================================================");
  36. printf("ntt SIZE tt USED tt FREE");
  37. printf("n============================================================");
  38. printf("n** System ** ");
  39. printf("t %d t %d t %d", partitionStatus.partition_status_size, partitionStatus.partition_status_used,partitionStatus.partition_status_free);
  40.     partition_status(NcachePartition,&partitionStatus,0);
  41.     //STTBX_Print(("Ncache Partition Size %d Used %d Free %dn", partitionStatus.partition_status_size,
  42.     //partitionStatus.partition_status_used,partitionStatus.partition_status_free));
  43. if(NcacheRecord < partitionStatus.partition_status_used)
  44. NcacheRecord = partitionStatus.partition_status_used;
  45. printf("n** NCache ** ");
  46. printf("t %d t %d tt %d", partitionStatus.partition_status_size, partitionStatus.partition_status_used,partitionStatus.partition_status_free);
  47.     STAVMEM_GetFreeSize(AVMEM_DeviceName, &TotalFreeSize);
  48.     //STTBX_Print(("AVMEM  Partition Size %d Used %d Free %dn", AVMEM_SIZE,(AVMEM_SIZE-TotalFreeSize),TotalFreeSize));
  49.     //workaround STAVMEM_GetFreeSize when full avmem size is available
  50.     if(TotalFreeSize > AVMEM_SIZE)
  51.      {
  52. AvmemRecord =0;
  53.      }
  54. else {
  55. if(AvmemRecord < (AVMEM_SIZE-TotalFreeSize))
  56. AvmemRecord = AVMEM_SIZE-TotalFreeSize;
  57. }
  58. printf("n** AVMEM ** ");
  59. printf("t %d t %d t %d", AVMEM_SIZE, AvmemRecord, TotalFreeSize);
  60. }
  61. void SRCHK_ShowMemoryStatus(void)
  62. {
  63.     printf("Record Sizes Sys=%d,  Ncache=%d, AVmem=%dn", SystemRecord, NcacheRecord, AvmemRecord);
  64. }