偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.
全部博文(1748)
分类: LINUX
2012-03-19 11:27:16
具体实现的算法程序如下:
Flag=TRUE;
while(TRUE==Flag)
{
Erase_K9F1G08U_Block(K9F1G08U.HighAddress,K9F1G08U.LowAddress); Flag=Check_K9F1G08U_Block(K9F1G08U.HighAddress/64); if(TRUE==Flag)//is invalid block
{
BadBlockTable[K9F1G08U.HighAddress/512]|=
(1<<(K9F1G08U.HighAddress%8));
K9F1G08U.HighAddress+=64;//Point to Next Block
}
else// is valid block ,record to BadBlockTable
{
BadBlockTable[K9F1G08U.HighAddress/512]&=
~(1<<(K9F1G08U.HighAddress%8));
}
}
for(i=0;i<sizeof(BadBlockTable);i++)
Write_RAM(RAM_BANK_0,K9F1G08U_BAD_BLOCK+i,BadBlockTable[i]);