📄 erase6455flash.c
字号:
//------------------------------------------------
/*
Description:
name :Erase6455flash
function :as its name.when the program starts, there will
be 2 leds on;when the program ends,all 4 leds off.
author :WeiZhiheng
company :Institute of Acoustic,CAS.Beijing,China
Date :2008-04-09 shanghai
Version :WR0.1
*/
//------------------------------------------------
#include <stdio.h>
#include "M05D11_17-15-50.h"
#include "weihengdefine.h"
#define FlashMap1BaseAddr 0xb0000000
#define Uint32 unsigned int
void C6455_wait(Uint32 delay)
{
volatile Uint32 i, n;
n = 0;
for (i = 0; i < delay; i++)
{
n = n + 1;
}
}
void C6455_waitusec(Uint32 delay)
{
C6455_wait(delay * 100);
}
#define waittime 1000
//volatile char * dataadd=(volatile char *)0x0900000;
volatile char heng;
void main (void)
{ //int numr;
int iiflash;
//unlock-----------
*((volatile Uint32 *)0x02AC0004)=0x0f0a0b00;
*((volatile Uint32 *)0x02AC0004)=0x0f0a0b00;
//------------------
//*((volatile Uint32 *)0x02AC0008)=0x00000440;
//*((volatile Uint32 *)0x02AC0008)=0x00000440;
//--打开EMIF--------
*((volatile Uint32 *)0x02AC002C)=1;
*((volatile Uint32 *)0x02AC002C)=1;
//--配置时钟为 720M,EMIFCLK=120M
//pllbypass();
*((volatile unsigned int *)0x29a0110)=0x00000003;//160M
*((volatile unsigned int *)0x29a0114)=0x00008000;
*((volatile unsigned int *)0x29a0160)=0x00008007;//eclk=10M
*((volatile unsigned int *)0x29a0164)=0x00008007;
*((volatile unsigned int *)0x29a0100)=0x00000040;
*((volatile unsigned int *)0x29a0138)=0x00000001;
*((volatile unsigned int *)0x70000080)=0x0ffffffe;
*((volatile unsigned int *)0x70000084)=0x0ffffffc;
ledoff_4;
ledon_3;
ledoff_2;
ledon_1;
EraseChip();
ledoff_4;
ledoff_3;
ledoff_2;
ledoff_1;
ledon_2;
for(iiflash=0;iiflash<31*32;iiflash++)
{
//codedataw[iiflash]=0;
//C6455_wait(100);
WriteByte(iiflash,CodeToWrite[iiflash]);
heng=ReadByte(iiflash);
if(CodeToWrite[iiflash]!=heng)
printf("Error %d\n",iiflash);
}
ledon_4;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -