📄 24a0test.cpp
字号:
//===================================================================
// NAME : 24a0test.cpp
// DESC : Definitions
// History : 02.14.2003 ver 0.0 ky.shim
//===================================================================
#include <stdlib.h>
#include <string.h>
#include "24a0addr.h"
#include "24a0slib.h"
#include "24a0lib.h"
#include "24a0slib.h"
#include "mmu.h"
#include "power.h"
#include "sleep.h"
#include "iic.h"
// ows
#include "fimvlib.h"
#include "dctq_test.h"
#include "vlx_test.h"
#include "memc_test.h"
#include "mobile_demo.h"
#include "timer.h"
#include "watchdog.h"
#include "rtc_test.h"
//Baik seung woo
#include "keypad_soft.h"
#include "flash.h"
#include "strata16.h"
#include "am29f800.h"
#include "dma.h"
#include "dma2.h"
#include "eint.h"
#include "int.h"
#include "IrDA.h"
#include "uart0.h"
#include "uart1.h"
#include "mstick.h"
#include "extdmam.h"
#include "extdmas.h"
#include "memtest.h"
#include "spi01.h"
//Boaz Sekwang Kim
#include "lcd.h"
#include "lcdlib.h"
#include "glib.h"
#include "camif.h"
#include "camproset.h"
//#include "camdata.h"
#include "adc.h"
#include "post.h"
//#include "imagedef.h"
//ky.shim
#include "nand.h"
#include "sdi.h"
#include "iis.h"
#include "ac97.h"
#include "modemif.h"
#include "cs8900.h"
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
void * function[][2]=
{ // "123456789012345678901"
(void *)Ch2_SROM_CONTROLLER, "NOR flash write ",
(void *)Ch3_SRAM_CONTROLLER, "SDRAM test ",
(void *)Ch4_NAND_FLASH_CONTROLLER, "NAND flash Con. ",
(void *)Ch6_INTERRUPT_CONTROLLER, "Interrupt Con. ",
(void *)Ch7_PwmTimer_test, "PWM Timer Test ",
(void *)Ch8_WDT_Test, "Watchdog Test ",
(void *)Ch9_DMA, "DMA ",
(void *)Ch10_RTC, "RTC test ",
(void *)Ch11_UART, "UART ",
(void *)Ch12_IrDA, "IrDA ",
(void *)Ch13_Iic_Test, "IIC test ",
(void *)Ch14_IIS, "IIS test ",
(void *)Ch15_SPI, "SPI test ",
(void *)Ch16_AC97, "AC97 test ",
(void *)Ch19_MODEM, "MODEM test ",
(void *)Ch21_CAMERA, "CAMERA TEST ",
(void *)Ch22_mpeg4_test, "MPEG4 TEST ",
(void *)Ch27_POST, "Post Proc. Test ",
(void *)Ch28_LCD, "LCD TEST ",
(void *)Ch29_KEYPAD, "KEYPAD ",
(void *)Ch30_ADC, "ADC & TOUCH ",
(void *)Ch31_SD_MMC, "SD & MMC ",
(void *)Ch32_MEMORY_STICK, "MEMORY STICK ",
(void *)Ch33_Power_Test, "Clock & Power ",
(void *)Ch34_CS8900_Test, "CS8900 Test ",
0,0
};
///// 2004. 12.10 //////
#if (ADS10 && !USE_MAIN)
extern "C" int __rt_lib_init(void); //for ADS 1.0
#endif
extern char Image$$RW$$Limit[];
#if USE_MAIN
// Ensure no functions that use semihosting SWIs are linked in from the C library
#if !SEMIHOSTING
#pragma import(__use_no_semihosting_swi)
#endif //!SEMIHOSTING
int main(void)
#else
#ifdef __cplusplus
extern "C" void CEntry(void) //To retain the C naming method
#else
void CEntry(void)
#endif //__cplusplus
#endif //(ADS10 && USE_MAIN)
{ //main start
int i;
MMU_Init();
#if (ADS10 && !USE_MAIN)
__rt_lib_init(); //for ADS 1.0
#endif
rPRIORITY1 = 0x01; //Bus priority: rotating
//To make margin
PreChangeSdramParameter();
PreChangeSromParameter(3);//0:bank0, 1:bank1, 2:bank2, 3:all banks
//(0,0)=1:1:1, (0,1)=1:1:2, (1,0)=1:2:2 (1,1)=1:2:4, (2,0)=1:4:5, (2,1)=1:4:8
ChangeClockDivider(1,1);
//(76,4,1)=84Mhz, (93,4,1)=101Mhz, (54,1,1)=124Mhz, (68,4,0)=152Mhz
//(93,4,0)=202Mhz, (47,1,0)=220Mhz, (72,2,0)=240Mhz, (79,2,0)=261Mhz
ChangeMPllValue(60,2,0);// FCLK=204MHz
//ChangeMPllValue(76,4,1);// FCLK=84MHz
ChangeSdramParameter(HCLK);
//if hclk 50mhz, then hclk=50000000,
//port => 1:SDRAM Xp Port, 2:SDRAM Xd Port, 3: both ports
ChangeSromParameter(HCLK, 3);//0:bank0, 1:bank1, 2:bank2, 3:all banks
Port_Init();
Led_Display(0xf);//all on
Isr_Init();
Uart_Init(0,115200);
Uart_Select(0);
Delay(1); //calibrate Delay()
// Alive key check
if( (SRAMKey_Sleep0==0xaaaa5555) && (SRAMKey_Sleep1==0x5555aaaa) )//Sleep mode wake-up
Test_SleepMode();
if( rALIVECON & ~0x3 )
{
if( rALIVECON & 1<<4 )
Test_WarmReset();
else if( rALIVECON & 1<<5 )
Test_WDTReset();
else if( rALIVECON & 1<<6 )
Test_SoftReset();
else if( rALIVECON & 1<<7 )
Test_BattFault();
}
//Turn on LCD. All test will be done while the LCD is turned on.
Test_Lcd_8Bit_240320_On();
//SetCAMClockDivider(1);
//Init_Sccb_Port();
//Init_Camera_Module_YCbCr_VGA();
//Uart_Printf("configuration : %x\n", rP1BANKCFG);
while(1)
{
i = 0;
Uart_Printf("\n\nSMDK24A0 Test Program Ver 0.1(20040201) FCLK = %d Hz\n\n", FCLK);
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();
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;
rINTMOD = 0x0; //All=IRQ mode
rINTMSK = BIT_ALLMSK; //All interrupt is masked.
rINTSUBMSK = BIT_SUB_ALLMSK; //All sub-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("IFSR=0x%x\n",MMU_ReadIFSR());
Uart_Printf("FAR=0x%x\n",MMU_ReadFAR());
Uart_Printf("Pabort exception.\n");
while(1);
}
//===================================================================
void HaltDabort(void)
{
Uart_Printf("DFSR=0x%x\n",MMU_ReadDFSR());
Uart_Printf("FAR=0x%x\n",MMU_ReadFAR());
Uart_Printf("Dabort exception.\n");
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -