#include #include #include "def.h" #include "option.h" #include "2440addr.h" #include "2440lib.h" #include "2440slib.h" //void (*restart)(void)=(void (*)(void))0x0; volatile unsigned int err=0; int main(void) { int i,j; int memError=0; //GPIO Port Init. Port_Init(); pISR_SWI=(_ISR_STARTADDRESS+0xf0); //for pSOS //Isr_Init(); Uart_Init(0,115200); Uart_Select(0); // FCLK,HCLK output rMISCCR = (rMISCCR & ~(7<<8) & ~(7<<4)) | (3<<8) | (2<<4); // CLKSEL0=FCLK, CLKSEL1=HCLK rGPHCON = (rGPHCON & ~(0xf<<18)) | (2<<20) | (2<<18); // CLKOUT1, CLKOUT0 /*******************************/ /* Message */ /*******************************/ Uart_Printf("\n\n+-----------------------------------------------------+\n"); Uart_Printf("| S3C2440 Memory Test ver R0.08 2008 August. |\n"); Uart_Printf("First : Write the data to the Memory\n"); Uart_Printf("Second : Read the data from the Memory\n"); Uart_Printf("if the data which is written and read\njust now is same, Memory is ok,else is error\n"); Uart_Printf("+-----------------------------------------------------+\n"); /*******************************/ /* Memory test */ /*******************************/ Uart_Printf("\nMemory Test(%xh-%xh):WR\n",_RAM_STARTADDRESS,(_ISR_STARTADDRESS&0xfff0000)); for(i=_RAM_STARTADDRESS;i<(_ISR_STARTADDRESS&0xfff0000);i+=4) //Write the data to the Memory { *((volatile unsigned *)i)=i; } Uart_Printf("\nMemory Test(%xh-%xh):RD\n",_RAM_STARTADDRESS,(_ISR_STARTADDRESS&0xfff0000)); for(i=_RAM_STARTADDRESS;i<(_ISR_STARTADDRESS&0xfff0000);i+=4)//Read the data from the Memory { j=*((volatile unsigned *)i); if(j!=i) { memError=1; //error occur } } if(memError==0) Uart_Printf("\nThe Memory is O.K.\n"); else Uart_Printf("\nThe Memory is error\n"); }