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

📄 44btest.c

📁 s3c44b0测试代码
💻 C
字号:
#include <stdlib.h>
#include <string.h>
#include "..\inc\option.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\def.h"
#include "..\inc\cache.h"
#include "..\inc\lcd.h"
#include "..\inc\lcdlib.h"
#include "..\inc\glib.h"
#include "..\inc\clcd.h"
#include "..\inc\adc.h"
#include "..\inc\uart.h"
#include "..\inc\power.h"
#include "..\inc\dma.h"
#include "..\inc\timer.h"
#include "..\inc\sio.h"
#include "..\inc\rtc.h"
#include "..\inc\etc.h"
#include "..\inc\iic.h"
#include "..\inc\eint.h"
#include "..\inc\flash.h"
#include "..\inc\iis.h"
#include "..\inc\stop.h"
#include "..\inc\idle.h"
#include "..\inc\extdma.h"
#include "..\inc\nwait.h"
#include "..\inc\Am29f800.h"

#include "ads7843.h"

void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);

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

 1. 99.6.6:KIW: For H/W vectored interrupt test, add the codes in Isr_Init()
 2. 99.8.27:    Stop,SL_IDLE mode is modified.
 3. 99.10.13:   check KS32C41000 date:A937 or after.
 4. 99.10.19:   AM29LV800 flash writing routine is added
 5. 00.4.25:KWT: Modify for S3C44B0X
 ***************************************************************/
void Temp_Function( void )	{ ; }

void * function[][2]=
{
	(void *)Temp_Function,   "                ",
	(void *)ADS7843_Test,    "ADS7843 Test    ",
	
#if (LCD_TYPE==MLCD_320_240)
	(void *)Test_LcdMono,	 "Lcd Mono        ",
	(void *)Test_LcdG4,	 "Lcd G4          ",
	(void *)Test_LcdG16,	 "Lcd G16         ",
#elif (LCD_TYPE==CLCD_240_320)
        (void *)Test_LcdColor,   "Lcd Color       ",
#endif	
	(void *)Test_SLIdleMode, "SL_IDLE Mode    ",
	(void *)Test_SLIdleMode20, 
	            		 "SL_IDLE Mode20  ",
	(void *)Test_IdleMode,	 "IDLE Mode       ",
	(void *)Test_IdleModeHard,"IDLE(hard)      ",
	(void *)Test_WaitPin,	 "nWAIT pin       ",
	(void *)Test_ZDma0Xdreq, "nXDREQ0         ",
	(void *)Test_Cache, 	 "Cache           ",
	(void *)Test_Adc,	 "Adc 0,1,2,3     ",
	(void *)Test_DMA_Adc,	 "Adc with DMA    ",
	(void *)Test_Uart0, 	 "UART 0          ",
	(void *)Test_Uart0Fifo,	 "UART 0 FIFO     ",
	(void *)Test_Uart1,	 "UART 1          ",
	(void *)Test_Uart1Fifo,	 "UART 1 FIFO     ",
	(void *)Test_SlowMode,	 "SLOW Mode       ",
	(void *)Test_HoldMode,	 "HOLD Mode       ",
	(void *)Test_StopMode,	 "STOP Mode       ", 
	(void *)Test_Zdma0,	 "Zdma0           ",
	(void *)Test_Zdma1,	 "Zdma1           ",
	(void *)Test_Sio,	 "SIO Tx/Rx       ",	
	(void *)Test_SIOTX_BDMA0,"SIO Tx BDMA0    ",
	(void *)Test_SIORX_BDMA1,"SIO Rx BDMA1    ",
	(void *)Test_WDTimer,	 "WDTimer         ",
	(void *)Display_Rtc,	 "RTC(display)    ",
	(void *)Test_Rtc_Alarm,	 "RTC(Test)       ",
	(void *)Test_Rtc_Tick,	 "RTC Tick        ",
	(void *)Test_Iic,	 "IIC(KS24C080)   ",
	(void *)Test_Iis,        "IIS(uda1341)    ",
	(void *)Iis_Tx,		 "IIS Tx(Slave)   ",
	(void *)Iis_Rx,		 "IIS Rx(Master)  ",
	(void *)Test_TimerInt,	 "Timer Int       ",
    (void *)Test_Timer,      "Tout test       ",
	(void *)Test_Eint,	 "Ext. Int        ",
	(void *)Etc,		 "Etc...          ",
	(void *)Test_PLL,        "Change PLL      ",
	(void *)Test_UartAFC_Tx, "Test AFC(Tx)    ",
	(void *)Test_UartAFC_Rx, "Test AFC(Rx)    ",
	//(void *)ProgramFlash, "Write flash     ",
	0,0
};


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()

    Uart_Printf("\n\n注意由于本程序部分测试使用了中断,所以必须将本项目的目标代码烧写入Flash的0地址\n");
    Uart_Printf("这样Flash中才有中断向量,不过只需要烧入一次就行了,以后JTAG调试或网口下载运行本程序就没有问题了\n");
    Uart_Printf("可以使用netload或者是comload下载本目标代码到SDRAM,然后用Prog 0烧写代码到Flash(不覆盖0地址跳转指令)\n\n");

    while(1)
    {
		i = 0 ;
        Uart_Printf("\n\nS3C44B0X Test Program Ver 1.00\nrSYSCFG=0x%x MCLK=%d\n\n",rSYSCFG,MCLK);
	
		while(1)
		{   //display menu
		    Uart_Printf("%2d:%s",i,function[i][1]);
		    i++;
		    if((int)(function[i][0])==0)
		    {
			Uart_Printf("\n");
			break;
		    }
		    if((i%4)==0)
			Uart_Printf("\n");
		}
		
		Uart_Printf("\nSelect the function to test?");
		
		i = Uart_GetIntNum_GJ() ;
		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 + -