📄 44btest.c
字号:
/****************************************************
公司: 三扬科技
作者: SUNYUNGCO
日期: 2004年8月17日
****************************************************/
#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 "..\inc\contrast.h"
#include "..\inc\touch.h"
void AutoTest(void);
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
void Delay1uS(void);
//***************************************************************************
extern char Image$$RO$$Limit[];
extern char Image$$RO$$Base[];
extern char Image$$RW$$Limit[];
extern char Image$$RW$$Base[];
extern char Image$$ZI$$Limit[];
extern char Image$$ZI$$Base[];
//***************************************************************************
/****************************************************************************
【功能说明】
****************************************************************************/
void About( void )
{
Uart_Printf( "\n\n" );
Uart_Printf( "******************************************************************\n" ) ;
Uart_Printf( "\t★★★==========44b0开发板测试程序,by kevin=========★★★\n" );
Uart_Printf( "\t ★★★★★★★★★★★★★★★★★★★★★★★\n" );
Uart_Printf( "\t 系统主频: 40000000Hz\n" ) ;
Uart_Printf( "\t 串口波特率:115200bps\n" ) ;
Uart_Printf( "\t MPU: SAMSUNG S3C44B0X\n" ) ;
Uart_Printf( "\t NOR FLASH: 4M bytes\n" ) ;
Uart_Printf( "\t NAND FLASH: 16M bytes\n" ) ;
Uart_Printf( "\t SDRAM: 32M bytes\n" ) ;
Uart_Printf( "\t 本项目编译时间:" );
Uart_Printf(__DATE__);
Uart_SendByte('-');
Uart_Printf(__TIME__);
Uart_Printf("\n\n");
Uart_Printf( "\t Image$$RO$$Base = %x\n", Image$$RO$$Base );
Uart_Printf( "\t Image$$RO$$Limit = %x\n", Image$$RO$$Limit );
Uart_Printf( "\t Image$$RW$$Base = %x\n", Image$$RW$$Base );
Uart_Printf( "\t Image$$RW$$Limit = %x\n", Image$$RW$$Limit );
Uart_Printf( "\t Image$$ZI$$Base = %x\n", Image$$ZI$$Base );
Uart_Printf( "\t Image$$ZI$$Limit = %x\n", Image$$ZI$$Limit );
Uart_Printf( "******************************************************************\n" ) ;
Uart_Printf( "\n" );
}
//***************************************************************************
void * function[][2]=
{
(void *)About, "Introducing ",
/*
#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_LcdMono, "Lcd Mono ",
(void *)Test_LcdG4, "Lcd G4 ",
(void *)Test_LcdG16, "Lcd G16 ",
(void *)Test_LcdColor, "Lcd Color ",
(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(24C01A) ",
(void *)Iis_test, "IIS(uda1341) ",//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 ",
(void *)Test_Con, "Change Constrast",
0,0
};
void Main(void)
{
int i;
rSYSCFG = CACHECFG;
//8K字节cache,写缓冲使能,data abort使能
rNCACHBE0 = ((Non_Cache_End>>12)<<16)|(Non_Cache_Start>>12);
//在上面的数据区域不使用高速缓存
Port_Init();
//Led_Disp() ; //
//Beep( 800 ); //
Timer_PWM_Led() ; //LED输出PWM信号
ChangePllValue( PLL_M, PLL_P, PLL_S);
//系统晶振为12MHz,8倍频系统运行在64MHz
Isr_Init();
Uart_Init(0,115200); //根据系统运行在32MHz来设置波特率为115200
Uart_Select(0); //选择串口COM0
Delay(5); //
About() ; //输出测试程序相关信息
//LCD ADJUST
LCD_Bias_Reset();
SetLCD_Bias(9); //LCD对比度调节
rPDATC=rPDATC|0x0008; //开LCD显示开关
//END LCD ADJUST
/*
while (1)
{
AdTouchStart(0xd1);
j=AdTouchRead12();
AdTouchStart(0x91);
k=AdTouchRead12();
}
*/
//WriteRtc(); //RTC校准
while(1)
{
i=0;
Uart_Printf( "\t★★★44B0 开发板测试程序==by kevin== ★★★\n" );
Uart_Printf( "******************************************************************\n" ) ;
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("\n\t请输入以上选择项,进行相应功能测试:");
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)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
void HaltSwi(void)
{
Uart_Printf("SWI exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
void HaltPabort(void)
{
Uart_Printf("Pabort exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
void HaltDabort(void)
{
Uart_Printf("Dabort exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
/*************************************************
函数名:Delay1uS
功能:延迟1US
*************************************************/
void Delay1uS(void)
{
unsigned int i;
for(i=0;i<=10;i++);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -