⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flashrom.c

📁 杭州立宇泰豪华型44B0开发板
💻 C
字号:
#include "flashrom.h"
#include "..\Target\def.h"

int SST39VF160_CheckBlank(INT32U addr,INT32U WordSize) 
{
	INT32U i,temp;
	for (i=addr;i<(addr+WordSize);i++)
	{
		temp=*((volatile INT16U *)(i<<1));
		if(temp!=0xffff)
			return 0;
	}
	return 1;	
}

int Waitfor_endofprg(void) //Check if the bit6 toggle ends.
{
	volatile INT16U flashStatus,old;
	old=*((volatile INT16U *)0x0);

	while(1)
	{
		flashStatus=*((volatile INT16U *)0x0);
		if( (old&0x40) == (flashStatus&0x40) )
			break;
		else
		old=flashStatus;
	}
	return 1;
}

int SST39VF160_WordProg (INT32U addr,INT16U dat)
{
	Writeflash (0x5555,0xAA);
	Writeflash (0x2AAA,0x55);
	Writeflash (0x5555,0xA0);
	Writeflash (addr,dat);
	return(Waitfor_endofprg());
	
}

void  SST39VF160_SectorErase(INT32U SAaddr)
{
	Writeflash(0x5555,0xAA);
	Writeflash(0x2AAA,0x55);
	Writeflash(0x5555,0x80);
	Writeflash(0x5555,0xAA);
	Writeflash(0x2AAA,0x55);
	Writeflash(SAaddr,0x30);
    Waitfor_endofprg();
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -