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

📄 main.c

📁 这个是在windows下用ADS开发的s3c44b0的硬件测试程序
💻 C
字号:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "..\target\option.h"
#include "..\target\44b.h"
#include "..\target\44blib.h"
#include "..\target\def.h"

#include "..\inc\uart.h"
#include "..\inc\adc.h"
#include "..\inc\ps2key.h"
#include "..\inc\rtc.h"
#include "..\inc\timer.h"
#include "..\inc\IIC.h"
#include "..\inc\eint.h"
#include "..\inc\cache.h"
#include "..\inc\power.h"
#include "..\inc\uda1341.h"
#include "..\nandflash\nandflash.h"
#include "..\nandflash\nandflib.h"
#include "..\lcdtest\lcd.h"
#include "..\lcdtest\touch.h"
#include "..\inc\zdma.h"

void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
extern void Ping_test(void);
extern void SL811Main(void);
extern void sdmmc_test(void);

/****************************************************************
 *		  S3C44B0X developer's notes							*  
 ****************************************************************

 1. 
 
 ***************************************************************/


void * function[][2]=
{
	(void *)Test_Uart0, 	  	"UART0 TEST       ",
	(void *)Test_Uart1,	 		"UART1 TEST       ",
	(void *)Disp_KeyDat,		"PS2_Key TEST     ",
	(void *)Test_Adc,	 		"ADC TEST       ",
	(void *)Display_Rtc,	 	"RTC TEST         ",
	(void *)Test_Iic,	 		"IIC(24Cxx) W/R   ",
	(void *)Test_Eint,	 		"Ext.Int TEST     ",
	(void *)Test_Cache, 	 	"Cache TEST     ",
	(void *)Test_PLL,        	"Change PLL Val   ",
	(void *)Test_SlowMode,	 	"SLOW Mode TEST   ",
	(void *)Test_HoldMode,	 	"HOLD Mode TEST   ",
	(void *)Test1341,			"Play PCM Music ",
	(void *)Ping_test,	        "Ping TEST (8019) ",
	(void *)Read_ID,			"R Nandflash ID   ",
	(void *)Test_LCD,		  	"Color LCD TEST   ",
	(void *)Test_grayLCD,	  	"Gray LCD TEST  ",
	(void *)Test_Touch,		  	"TouchScreen TEST ",
	(void *)Test_Zdma0,	 		"Zdma0 TEST       ",
    (void *)Test_Zdma1,	 		"Zdma1 TEST       ",
	(void *)SL811Main,			"USB TEST(sl811)",
	(void *)sdmmc_test,         "SD/MMC R/W TEST  ",
	(void *)Test_TimerInt,		"PWM Timer TEST   ",
	(void *)Test_WDTimer,		"WDTimer TEST  	  ",
		
	0,0
};

/*******************main function*************************/
void Main(void)
{
    int i;

    rSYSCFG=CACHECFG;
    
    //__rt_lib_init(); 	//for ADS 1.0

    Port_Init();
    Isr_Init();

    Uart_Init(0,115200);
	
    //rSBUSCON=(1<<31)|(3<<6)|(2<<4)|(1<<2)|(0);  //nBREQ>BDMA>ZDMA>LCD_DMA

    Uart_Select(0);
    Delay(0);  //calibrate Delay()
	Beep(0x01);
	Led_Display(0xf);
	Uart_Printf("\n---------------------------------------------------------------");
	Beep(0x00);
	Uart_Printf("\nOEM name   :     LiYuTai Elec.Co.,Ltd.			               ");
	Uart_Printf("\nWebsite    :     www.hzlitai.com.cn                             ");
	Uart_Printf("\nEmail      :     lyt_tech@yahoo.com.cn                          ");
	Uart_Printf("\nFunction   :     ARMSYS44b0's S3C44b0 for Test Program          ");
	Uart_Printf("\nUART config:     115.2kbps,8Bit,NP,UART0                        ");
	Uart_Printf("\n---------------------------------------------------------------");
	Uart_Printf("\nS3C44B0X Test Program Ver 2.0 rSYSCFG=0x%x MCLK=%dHz\n",rSYSCFG,MCLK);
    while(1)
    {
		i=0;
      	Uart_Printf("\nThe function list to test :\n");
		while(1)
		{   //display menu
			
		    Uart_Printf("%2d:%s",i+1,function[i][1]);
		    i++;
		    if((int)(function[i][0])==0)
		    {
				Uart_Printf("\n");
				break;
		    }
		    if((i%4)==0)
				Uart_Printf("\n");
		}
		Led_Display(0x0);
		Uart_Printf("\nSelect the function to test?");
		
		i=Uart_GetIntNum();
		i--;
		Uart_Printf("\n");
		if(i>=0 && (i<(sizeof(function)/8)) ) 
		    ( (void (*)(void)) (function[i][0]) )();
    }
}



void Isr_Init(void)
{
    pISR_UNDEF=(unsigned)HaltUndef;
    pISR_SWI  =(unsigned)HaltSwi;
    pISR_PABORT=(unsigned)HaltPabort;
    pISR_DABORT=(unsigned)HaltDabort;

    //rINTCON=0x1;	  		// Vectored Int. IRQ enable,FIQ disable    
    rINTCON=0x5;	  		// Non-vectored,IRQ enable,FIQ disable    
	
    rINTMOD=0x0;	  		// All=IRQ mode
    rINTMSK=BIT_GLOBAL;	  	// All interrupt is masked.
}


void HaltUndef(void)
{
   Uart_Printf("Undefined instruction exception!!!\n");
    while(1);
}

void HaltSwi(void)
{
    Uart_Printf("SWI exception!!!\n");
    while(1);
}

void HaltPabort(void)
{
    Uart_Printf("Pabort exception!!!\n");
    while(1);
}

void HaltDabort(void)
{
   Uart_Printf("Dabort exception!!!\n");
    while(1);
}

⌨️ 快捷键说明

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