www.pudn.com > s3c2443_test_code.zip > 2443test.cpp


 
#include "System.h" 
#include "Pll_test.h" 
#include "Power.h" 
 
#include "DRAM.h" 
#include "NOR_Flash.h" 
#include "OneNAND.h" 
#include "NAND.h" 
#include "DMA.h" 
 
#include "ADCts.h" 
#include "IIS.h" 
#include "AC97.h" 
#include "Eint.h" 
#include "CS8900.h" 
 
#include "HSPI.h" 
#include "SPI.h" 
#include "IIC.h" 
 
#include "SDI.h" 
#include "HS_mmc.h" 
#include "CF.h" 
 
#include "Watchdog.h" 
#include "RTC.h" 
#include "Timer.h" 
 
#include "Display.h" 
#include "CameraTest.h" 
 
#include "Dhrystone.h" 
 
 
void *function[][2]= 
{   //  							"123456789012345678901" 
	(void *) Test_PLL,				(char *)"PLL change Test      ", 
	(void *) Test_Power,			(char *)"Power mode Test      ", 
	(void *) Test_NOR,				(char *)"NOR Flash            ", 
	(void *) Test_OneNAND,			(char *)"OneNAND              ", 
	(void *) Test_NAND,				(char *)"NAND Flash           ", 
 
	(void *) Test_DMA,				(char *)"DMA Test             ", 
 
    (void *) Test_ADC,				(char *)"Test Adc & Touch     ", 
	(void *) Test_IIS,				(char *)"IIS Test             ", 
	(void *) Test_AC97,				(char *)"AC97 Test            ", 
	(void *) Test_Eint,				(char *)"External Interrupt   ", 
	(void *) Test_CS8900,			(char *)"CS8900 check         ", 
 
	(void *) Test_UART,				(char *)"Uart                 ", 
	(void *) Test_HSPI,				(char *)"HSPI Test            ", 
	(void *) Test_SPI,				(char *)"SPI Test             ", 
	(void *) Test_IIC,				(char *)"IIC Test             ", 
 
    (void *) Test_SDI,			    (char *)"SD / MMC             ", 
	(void *) Test_HS_MMC,			(char *)"High Speed MMC       ", 
	(void *) Test_ATA,				(char *)"CF True-IDE mode     ", 
	(void *) Test_PCCARD,			(char *)"CF PC card mode      ", 
 
    (void *) Test_Timer,			(char *)"Timer Test           ", 
	(void *) Test_Watchdog,			(char *)"Watchdog Test        ", 
	(void *) Test_RTC,				(char *)"RTC Test             ", 
 
	(void *) Test_LCD,				(char *)"LCD Test             ", 
	(void *) Test_Camera,			(char *)"Camera Test          ", 
 
	(void *) Dhrystone,				(char *)"Dhrystone Benchmark  ", 
	0,0 
}; 
 
 
 
int main( void) 
{ 
	int i; 
 
	rGPACDH = rdGPACDH & ~(1<<5) | (0<<5); // RDATA_OEN : enable 
 
	PreChangeSDRAMParameter(); 
	 
	rGPHCON=rGPHCON&~(0xf<<26)|(0xa<<26); 
	rMISCCR=rMISCCR&~((0x7<<8)|(0x7<<4))|(0x3<<8)|(0x2<<4); 
 
	// test code start setting in option.h 
	SetCLKDIV( Startup_ARMCLKdiv, Startup_PREdiv, Startup_HCLKdiv, Startup_PCLKdiv); 
	SetMPLL( Startup_MDIV, Startup_PDIV, Startup_SDIV); 
 
//	SetCLKDIV( 0, 3, 1, 1); // 1:8:16 
//	SetMPLL( 92, 3, 0);		// 800MHz 
 
	SystemCLK(0); 
	ChangeSDRAMParameter(HCLK); 
	 
	Max1718_Init(); 
//	Max1718_Set(0, 135); // pwr=0:ARM, pwr=1:INT 
//	Max1718_Set(1, 120); // pwr=0:ARM, pwr=1:INT 
	 
    Isr_Init(); 
    MMU_Init(); 
//    MMU_DisableDCache(); 
//    MMU_DisableICache(); 
 
    Delay(0); //calibrate Delay() 
     
//-------------------------------------------------------------------------------------------- 
 
    while(1) 
    { 
 		Console(); 
	 
		Init_LED(); 
	    Led_Display(0xf);//all on 
		 
	   	printf("\n\nSMDK2443 Test Program Ver 0.0 (20060525)\n"); 
	   	printf("MPLL=%.2fMHz, ARMCLK=%.2fMHz (%d:%d:%d), HCLK=%.2fMHz, PCLK=%.2fMHz\n\n", 
	   		(float)MPLL/1000000,(float)ARMCLK/1000000,ARMCLKdiv+1,(ARMCLKdiv+1)*(HCLKdiv+1),(ARMCLKdiv+1)*(HCLKdiv+1)*(PCLKdiv+1),(float)HCLK/1000000,(float)PCLK/1000000); 
 
		i = 0; 
		while(1) 
		{   //display menu 
	    	printf("%2d:%s",i,function[i][1]); 
	    	i++; 
	    	if((int)(function[i][0])==0) 
	    	{ 
				printf("\n"); 
				break; 
	    	} 
	    	if((i%4)==0) printf("\n"); 
		} 
 
		printf("\nSelect the function to test : "); 
		i = GetIntNum(); 
		printf("\n"); 
 
		if( i>=0 && (i