memtest.c
上传用户:jankzhpno
上传日期:2022-08-03
资源大小:4763k
文件大小:1k
源码类别:

Windows CE

开发平台:

Visual C++

  1. /*********************************************
  2.   NAME: memtest.c
  3.   DESC: test SDRAM of SMDK2440 b/d
  4.   HISTORY:
  5.   03.27.2002:purnnamu: first release
  6.  *********************************************/
  7. #include "def.h"
  8. #include "option.h"
  9. #include "2440addr.h"
  10. #include "2440lib.h"
  11. #include "2440slib.h"
  12. #include "mmu.h"
  13. void MemoryTest(void)
  14. {
  15.     int i;
  16.     U32 data;
  17.     int memError=0;
  18.     U32 *pt;
  19.     
  20.     //
  21.     // memory test
  22.     //
  23.     //Uart_Printf("Memory Test(%xh-%xh):WR",_RAM_STARTADDRESS,(_ISR_STARTADDRESS&0xfff0000));
  24.     //test sdram from _RAM_STARTADDRESS+2M, hzh
  25. Uart_Printf("Memory Test(%xh-%xh):WR",_RAM_STARTADDRESS+0x00200000,(_ISR_STARTADDRESS&0xffff0000));
  26.     //pt=(U32 *)_RAM_STARTADDRESS;
  27.     pt=(U32 *)(_RAM_STARTADDRESS+0x00200000); //hzh
  28.     while((U32)pt<(_ISR_STARTADDRESS&0xffff0000))
  29.     {
  30. *pt=(U32)pt;
  31. pt++;
  32.     }
  33.     Uart_Printf("bbRD");
  34.     //pt=(U32 *)_RAM_STARTADDRESS;
  35.     pt=(U32 *)(_RAM_STARTADDRESS+0x00200000); //hzh
  36.     while((U32)pt<(_ISR_STARTADDRESS&0xffff0000))
  37.     {
  38. data=*pt;
  39. if(data!=(U32)pt)
  40. {
  41.     memError=1;
  42.     Uart_Printf("bbFAIL:0x%x=0x%xn",i,data);
  43.     break;
  44. }
  45. pt++;
  46.     }
  47.     if(memError==0)Uart_Printf("bbO.K.n");
  48. }