📄 main.c
字号:
#include "..\common\option.h"
#include "..\common\def.h"
#include "..\common\2410addr.h"
#include "..\common\2410slib.h"
#include "..\common\2410lib.h"
#include "..\common\2410addr.h"
//#include "..\common\k9s1208.h"
#include "..\common\register.h"
#include "..\common\LCD.h"
#include "..\common\LCDlib.h"
#define DOWNLOAD_ADDRESS _RAM_STARTADDRESS
#define BOOT_IMAGE_SIZE 5
#define MEM_OFFSET 0x01000000
void (*run)(void)=(void (*)(void))(DOWNLOAD_ADDRESS+MEM_OFFSET);
void Port_Init(void);
void Led_Display(int);
void Delay(int);
void _Link(void);
void MemoryTest(void);
volatile unsigned char *downPt;
void Main(int argc,char **argv)
{
int i,j;
char status=0;
char *p;
downPt=(unsigned char *)(DOWNLOAD_ADDRESS+MEM_OFFSET);
//MMU_EnableICache();
//MMU_EnableDCache();
MMU_DisableICache();
MMU_DisableDCache();
ChangeClockDivider(1,1); // 1:2:4
ChangeMPllValue(M_MDIV,M_PDIV,M_SDIV); //Fin=12MHz FCLK=200MHz
Port_Init();
Uart_Select(0);
Uart_Init(PCLK, 115200);
//_Link();
MemoryTest();
/*********************************************************
* on(led1) -> on(led2) -> on(led3) -> on(led4)
********************************************************/
Embest();
Uart_SendString("\n\n S3C2410 Test in Embest IDE for ARM toolkets. \n");
Uart_SendString( " UART Send OK! \n ");
while(1)
{
if(status<5) status +=1;
else status =1;
Led_Display(status);
for(i=0;i<55500;i++)
{;}
for(i=0;i<55500;i++)
{;}
}
}
void MemoryTest(void)
{
int i;
U32 data;
int memError=0;
U32 *pt;
//
// memory test
//
Uart_Printf("Memory Test(%xh-%xh):WR",_RAM_STARTADDRESS,(_ISR_STARTADDRESS&0xfff0000));
pt=(U32 *)_RAM_STARTADDRESS;
while((U32)pt<(_ISR_STARTADDRESS&0xffff0000))
{
*pt=(U32)pt;
pt++;
}
Uart_Printf("\b\bRD");
pt=(U32 *)_RAM_STARTADDRESS;
while((U32)pt<(_ISR_STARTADDRESS&0xffff0000))
{
data=*pt;
if(data!=(U32)pt)
{
memError=1;
Uart_Printf("\b\bFAIL:0x%x=0x%x\n",i,data);
break;
}
pt++;
}
if(memError==0)Uart_Printf("\b\bO.K.\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -