📄 main.c.bak
字号:
//******************************************************
//Chinese Academy of Sciences, Institute of Automation
//File Name: main.c
//Description: Write flash,32bits model
//Author: JuGuang,Li
//Date: 2003-3-20
//******************************************************
#include "Def.h"
#include "s3c4510b_add.h"
#define AM_WORD_COUNT (700*1024)/2
#define AM_START_ADDR 0x0000000 //0x1100000
#define AM_ADDR_UNLOCK1 0x555
#define AM_ADDR_UNLOCK2 0x2aa
#define AM_DATA_UNLOCK1 0xaaaa
#define AM_DATA_UNLOCK2 0x5555
#define AM_SETUP_WRITE 0xa0a0
#define AM_SETUP_ERASE 0x8080
#define AM_CHIP_ERASE 0x1010
#define AM_SECTOR_ERASE 0x3030
#define AM_RESET 0xf0f0
void Delay(unsigned int);
void InitUART(int Port,int Baudrate);
void PrintUART0(char *s);
int Main()
{
volatile UINT16 *from_add,*to_add;
int i;
InitUART(0,0x500);
PrintUART0("ARM Starting...\n");
to_add= (UINT16 *)0x0;
from_add=(UINT16 *)0x500000;
for(i=0;i<AM_WORD_COUNT;i++)
{*((volatile UINT16 *)AM_START_ADDR + AM_ADDR_UNLOCK1) = AM_DATA_UNLOCK1;
*((volatile UINT16 *)AM_START_ADDR + AM_ADDR_UNLOCK2) = AM_DATA_UNLOCK2;
*((volatile UINT16 *)AM_START_ADDR + AM_ADDR_UNLOCK1) = AM_SETUP_WRITE;
*to_add++ =*from_add++ ;
PrintUART0("P");}
PrintUART0("Flash Programe Sucessfully!!!\n");
return 0;
}
void PrintUART0(char *s)
{
for(;*s!='\0';s++)
{while(!(USTAT0&0x40));
UTXBUF0=*s;}
}
void InitUART(int Port,int Baudrate)
{
if(Port==0)
{ULCON0=0x03;
UCON0=0x09;
UBRDIV0=Baudrate;
}
}
void Delay(unsigned int x)
{
unsigned int i,j,k;
for(i=0;i<=x;i++)
for(j=0;j<0xff;j++)
for(k=0;k<0xff;k++);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -