⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2413test.cpp

📁 三星2413芯片的测试代码,对进行驱动开发很有帮助.
💻 CPP
字号:

#include <stdio.h>
#include <stdlib.h>

#include "2413addr.h"
#include "System.h"
#include "Exception.h"
#include "Console.h"

#include "ebi.h"		//ch.02 EBI
#include "nand.h"		//ch.05 Nand Flash Controller
#include "syscon.h"		//ch.06 System Controller
#include "dma.h"		//ch.07 DMA Controller
#include "timer.h"		//ch.09 PWM Timer
#include "uart.h"		//ch.10 UART
#include "interrupt.h"	//ch.13 Interrupt Controller
#include "lcd.h"		//ch.14 LCD Controller
#include "adcts.h"		//ch.15 ADC & Touch Screen Interface
#include "rtc.h"		//ch.16 Real Time Clock
#include "watchdog.h"	//ch.17 Watchdog Timer
#include "sdi.h"		//ch.18 MMC/SD/SDIO Controller
#include "iic.h"		//ch.19 IIC-BUS Interface
#include "iis.h",		//ch.20 IIS-BUS Interface
#include "spi.h",		//ch.21 SPI Interface
#include "camif.h"		//ch.22 Camera Interface
#include "ata.h"		//ch.23 ATA Controller

#include "MmuCache.h"
#include "PLL.h"
#include "DRAM.h"
#include "flash.h"




void *function[][2]=
{   //  								"123456789012345678901"

	(void *) Ch2_Ebi,					"[Ch.02] EBI               ",
	(void *) Ch5_Nand,					"[Ch.05] NAND Controller   ",
	(void *) Ch6_Syscon,				"[Ch.06] System Controller ",
	(void *) Ch7_Dma,					"[Ch.07] DMA Controller    ",	
	(void *) Ch9_PwmTimer,				"[Ch.09] PWM Timer         ",
	(void *) Ch10_Uart,					"[Ch.10] UART              ",
	(void *) Ch13_Interrupt,			"[Ch.13] Interrupt         ",
	(void *) Ch14_Lcd,					"[Ch.14] LCD Controller    ",	
	(void *) Ch15_Adcts,				"[Ch.15] ADC&Touch         ",
	(void *) Ch16_Rtc,					"[Ch.16] Real Time Clock   ",
	(void *) Ch17_Watchdog,				"[Ch.17] Watchdog Timer    ",
	(void *) Ch18_Sdmmc,				"[Ch.18] MMC/SD/SDIO       ",
	(void *) Ch19_Iic,					"[Ch.19] IIC-BUS Interface ",
//	(void *) Ch20_Iis,					"[Ch.20] IIS-BUS Interface ",
//	(void *) Ch21_Spi,					"[Ch.21] SPI Interface     ",
//	(void *) Ch22_Camera,				"[Ch.22] Camera Interface  ",
//	(void *) Ch23_Ata,					"[Ch.23] ATA Controller    ",
//	(void *) ProgramFlash,				"NOR Flash               ",	
	
	
    0,0
};


int main( void)
{
	int i;
	
	
	//*(volatile unsigned *)0x560000e0=0xf;

	//CPU is run in condition of 1:2:4=ARMCLK:HCLK:PCLK(200:100:50)
	
    //To measure characteristic of operating according to voltage and frequency.
    PreChangeSDRAMParameter();
	SetCLKDIV( Startup_ARMCLKdiv, Startup_HCLKdiv, Startup_PCLKdiv);
	SetMPLL(Startup_MDIV, Startup_PDIV, Startup_SDIV);
	//SetMPLL( 125,  4, 1); 
	//SetCLKDIV( 0, 0, 1); // 1:1:2
//	SetCLKDIV( 0, 1, 1); // 1:2:4
	//SetCLKDIV( 0, 2, 1); // 1:3:6
	//SetCLKDIV( 0, 3, 1); // 1:4:8
	//SetCLKDIV( 0, 0, 1); // 1:1:2
	//SetCLKDIV( 1, 0, 1); // 2:2:4
	//SetMPLL( 62,  2, 1); //210Mhz
//	SetMPLL( Startup_MDIV, Startup_PDIV, Startup_SDIV); //200Mhz
	//SetMPLL( 62,  2, 1); //210Mhz
	//SetMPLL( 47,  1, 1); //220Mhz
	//SetMPLL( 107, 4, 1); //230Mhz	
	//SetMPLL( 72,  2, 1); //240Mhz
	//SetMPLL( 117, 4, 1); //250Mhz
	//SetMPLL( 57,  1, 1); //260Mhz
	//SetMPLL( 125,  4, 1); //266Mhz
	//SetMPLL( 32,  1, 1); //280Mhz
	//SetMPLL( 67,  1, 1); //300Mhz
	//SetMPLL( 72,  4, 0); //320Mhz
	//SetMPLL( 63,  3, 0); //340.8Mhz
	//SetMPLL( 52,  2, 0); //360Mhz
	//SetMPLL( 87,  4, 0); //380Mhz
	//SetMPLL( 42,  1, 0); //400Mhz
	//SetMPLL( 125,  4, 1); //266Mhz
	
	// 133:133:66.5Mhz
	//SetCLKDIV( 1, 0, 1); // 2:2:4
	//SetMPLL( 125,  4, 1); 
	
	SystemCLK();	
	ChangeSDRAMParameter(HCLK);


    Isr_Init();
    MMU_Init();

    Delay(0); //calibrate Delay()

 	Console();
		
	Init_LED();
	Led_Display(0xf);//all on
	

	Test_Lcd_Tft_16Bit_240320_On();

    
//--------------------------------------------------------------------------------------------
    while(1)
    {

	   	printf("\n\nSMDK2413 Test Program Ver 1.01 (20061031)\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<sizeof(function)/8-1) ) 
		   ( (void (*)(void)) (function[i][0]) )();
    }	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -