-
大小: 30KB文件類型: .rar金幣: 2下載: 0 次發布日期: 2021-06-26
- 語言: 其他
- 標簽: nandflash??磨損??均衡算法??translation??
資源簡介
1.扇區讀寫到NAND FLASH的轉換 2.壞塊管理 3.磨損平橫 nand flash 磨損均衡算法 Nand Flash Translation Layer (源碼包)

代碼片段和文件信息
#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(
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????14738??2006-08-10?10:23??NFTL\BadBlockManagement.c
?????文件???????1409??2006-08-10?10:23??NFTL\BadBlockManagement.h
?????文件???????5034??2006-08-10?10:23??NFTL\Common.h
?????文件???????1274??2006-08-10?10:23??NFTL\FalUserDirective.h
?????文件???????6823??2006-08-10?10:23??NFTL\GarbageCollector.c
?????文件????????333??2006-08-10?10:23??NFTL\GarbageCollector.h
?????文件???????1222??2006-08-10?10:23??NFTL\OSModule_MemoryManagement.c
?????文件????????348??2006-08-10?10:23??NFTL\OSModule_MemoryManagement.h
?????文件??????51374??2006-08-10?10:23??NFTL\StructureManager.c
?????文件???????3115??2006-08-10?10:23??NFTL\StructureManager.h
?????文件??????41023??2006-08-10?10:23??NFTL\TranslationModule.c
?????文件????????825??2006-08-10?10:23??NFTL\TranslationModule.h
?????文件??????21105??2006-08-10?10:23??NFTL\WearLeveling.c
?????文件???????1527??2006-08-10?10:23??NFTL\WearLeveling.h
?????目錄??????????0??2006-08-10?10:23??NFTL
-----------?---------??----------?-----??----
???????????????150150????????????????????15
- 上一篇:Labview 圖片顯示
- 下一篇:STM32 智能充電器原理圖
評論
共有 條評論