本帖最后由 756902942 于 2013-7-11 14:13 编辑
void FMC_Init(void)
{
DrvFMC_EnableISP();
DrvFMC_EnableConfigUpdate();
DrvFMC_WriteConfig(0xFFFFFFFE,0x10FFF);
DrvFMC_DisableConfigUpdate();
dataaddress=DrvFMC_ReadDataFlashBaseAddr();
}
int Write_Own(unsigned long Store_Address,unsigned long storagenumber)
{
unsigned long i,u32Data;
unsigned long P_Address=Store_Address;
unsigned long For_Flash_Buffer[128];
DrvFMC_Read(Store_Address,&i);
if(i&storagenumber==storagenumber){DrvFMC_Write(Store_Address,storagenumber);return 0;}
for(i=0;i<128;i++){
DrvFMC_Read(P_Address,&For_Flash_Buffer); P_Address+=4;
}
DrvFMC_Erase(Store_Address);
For_Flash_Buffer[0]=storagenumber;
for(i=0;i<128;i++){DrvFMC_Write(Store_Address, For_Flash_Buffer);Store_Address+=4;}
return 0;
}
|