-
大小: 316KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2021-05-15
- 語(yǔ)言: 其他
- 標(biāo)簽: 嵌入式??NFTL??NANDFLASH??文件系統(tǒng)??
資源簡(jiǎn)介
鎂光最新的NFTL,支持壞塊管理,垃圾回收,寫平衡,掉電安全等

代碼片段和文件信息
#include?“OSModule_MemoryManagement.h“
#include?“HardwareAdaptationlayer.h“
#include?“LLD.h“
#include?“BadBlockManagement.h“
#include?“FalUserDirective.h“
/*number?of?bad?block?present?on?device*/
static?UINT8?BadBlocksNumber?=?0;
/*physical?block?number?of?block?containing?the?BBT*/
static?INT16?BootBlockNumber?=?-1;
/*head?of?bad?blocks?list*/
static?BadBlockElem?*BadBlockList?=?NULL;
/*pointer?to?the?last?elem?of?bad?block?list?in?ram*/
static?BadBlockElem?*last?=?NULL;
//static?UINT8?BadBlockBuff[528];
//static?UINT8?pageBuffer[528];
/*************************GetBadBlockTable?****************************
*?Retrieve?the?BBT?from?flash?(if?exists).?Return?a?concatenate?list??*
*?of?BadBlockElem ??*
*---------------------------------------------------------------------*
*???startBlock?:?physical?block?number?where?start?the?searching ??*
* ??*
*???bbt?:?the?head?of?bad?block?list?retrieved ??*
* ??*
***********************************************************************/
NFTL_Return?GetBadBlockTable(BadBlockElem?*bbt?UINT16?startBlock)
{
UINT16?i;
UINT32?k;
UINT8?searchRange;
UINT8?founded?=?0;
BootStruct?bootStruct;
UINT16?*bbtArray?=?NULL;
UINT8?*buffer?=?NULL;
UINT16?lenght;
//lenght?=?GetDeviceArchitecture().pageSize;
lenght?=?CHUNK_SIZE;
searchRange?=?10;
last?=?NULL;
BadBlocksNumber?=?0;
//buffer?=?OS_DRIVER_Malloc(GetDeviceArchitecture().pageSize);
buffer?=?(UINT8?*)OS_DRIVER_Malloc(CHUNK_SIZE);
if?(buffer?==?NULL)
{
return?FAILURE;
}
for?(i?=?startBlock;?i?<=?(startBlock?+?searchRange);?i++)
{
if?(!founded)
{
UINT32?targetAddress;??
CalculateAddress(i0&targetAddress);
//if?((NAND_PageRead(targetAddress(UINT8?*)(&BadBlockBuff[0])lenght)?!=?NAND_PASS))
if?((NAND_PageRead(targetAddressbufferlenght)?!=?NAND_PASS))
{
OS_DRIVER_Free(buffer);
return?FAILURE;
}
OS_MemCopy(&bootStructbuffersizeof(BootStruct));
//founded?bootStruct
if?(OS_SearchString((char?*)?bootStruct.bootStructId“NANDBOOT“)?!=?NULL)
{
UINT8?*pageBuffer?=?NULL;
int?c?=?0;
UINT8?noOfPage?=?0;
INT32?lastPageDim?=?0;
UINT8?totalPage?=?0;
founded?=?1;
//set?the?physical?block?number?of?the?block?containing?the?bootstruct
SetBBMBootBlockNumber(i);
//allocate?the?list?of?Bad?Blocks
if?(bootStruct.noOfBadBlocks?==?0)
{
bbt?=?NULL;
bbtArray?=?NULL;
OS_DRIVER_Free(buffer);
return?SUCCESS;
}
bbtArray?=?(UINT16?*)
OS_DRIVER_Malloc(sizeof(UINT16)?*?bootStruct.noOfBadBlocks);
if?(bbtArray?==?NULL)
{
SetBBMBootBlockNumber(-1);
OS_DRIVER_Free(buffer);
return?FAILURE;
}
#if?0
noOfPage?=?((bootStruct.noOfBadBlocks)?*?sizeof(UINT16))?/
GetDeviceArchitecture().mainSize;
lastPageDim?=?(bootStruct.noOfBadBlocks?*?sizeof(
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-08-11?11:08??mcrion_NFTL\
?????文件??????397814??2019-08-11?11:08??mcrion_NFTL\NAND?Flash?Translation?la
?????目錄???????????0??2019-08-09?20:05??mcrion_NFTL\NFTL--code\
?????文件???????14738??2006-08-10?10:23??mcrion_NFTL\NFTL--code\BadBlockManagement.c
?????文件????????1409??2006-08-10?10:23??mcrion_NFTL\NFTL--code\BadBlockManagement.h
?????文件????????5034??2006-08-10?10:23??mcrion_NFTL\NFTL--code\Common.h
?????文件????????1274??2006-08-10?10:23??mcrion_NFTL\NFTL--code\FalUserDirective.h
?????文件????????6823??2006-08-10?10:23??mcrion_NFTL\NFTL--code\GarbageCollector.c
?????文件?????????333??2006-08-10?10:23??mcrion_NFTL\NFTL--code\GarbageCollector.h
?????文件???????28672??2019-08-08?20:44??mcrion_NFTL\NFTL--code\NFTL.IAB
?????文件?????????608??2019-08-08?20:44??mcrion_NFTL\NFTL--code\NFTL.IAD
?????文件????????8192??2019-08-08?20:44??mcrion_NFTL\NFTL--code\NFTL.IMB
?????文件?????????408??2019-08-08?20:44??mcrion_NFTL\NFTL--code\NFTL.IMD
?????文件??????????60??2019-08-10?09:58??mcrion_NFTL\NFTL--code\NFTL.PFI
?????文件?????????776??2019-08-10?09:58??mcrion_NFTL\NFTL--code\NFTL.PO
?????文件????????5192??2019-08-08?20:44??mcrion_NFTL\NFTL--code\NFTL.PR
?????文件???????30872??2019-08-08?20:44??mcrion_NFTL\NFTL--code\NFTL.PRI
?????文件???????67592??2019-08-10?09:58??mcrion_NFTL\NFTL--code\NFTL.PS
?????文件???????19290??2019-08-10?09:58??mcrion_NFTL\NFTL--code\NFTL.WK3
?????文件????????1222??2006-08-10?10:23??mcrion_NFTL\NFTL--code\OSModule_MemoryManagement.c
?????文件?????????348??2006-08-10?10:23??mcrion_NFTL\NFTL--code\OSModule_MemoryManagement.h
?????文件???????51374??2006-08-10?10:23??mcrion_NFTL\NFTL--code\StructureManager.c
?????文件????????3115??2006-08-10?10:23??mcrion_NFTL\NFTL--code\StructureManager.h
?????文件???????41023??2006-08-10?10:23??mcrion_NFTL\NFTL--code\TranslationModule.c
?????文件?????????825??2006-08-10?10:23??mcrion_NFTL\NFTL--code\TranslationModule.h
?????文件???????21105??2006-08-10?10:23??mcrion_NFTL\NFTL--code\WearLeveling.c
?????文件????????1527??2006-08-10?10:23??mcrion_NFTL\NFTL--code\WearLeveling.h
評(píng)論
共有 條評(píng)論