亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? garbagecollector.c

?? Nand Flash Translation Layer 用于nandflash的操作。 bad block memory map garbage collection average er
?? C
字號:



 
#include "OSModule_MemoryManagement.h"
#include "Common.h"
#include "GarbageCollector.h"
#include "HardwareAdaptationlayer.h"
#include "FalUserDirective.h"
#include "BadBlockManagement.h"
#include "WearLeveling.h"
#include "StructureManager.h"

//static UINT8 pageInBlock;
static UINT16 NumPageWritten;

/******************************************************************************
*			MinimizeStructure   											  *
*******************************************************************************
*	Perform the erase of the block contained in a structure 				  *
*******************************************************************************
*	PARAMETERS  															  *
*		blockNumbers: containt the list of blocks that compose the sector     *
*   				  history data structure								  * 	 
*		len: indicate the size of blockNumbers  							  *
*   	mainElem: is the pointer to sector history data structure to defrag   *
*   	physicalBlockNumber: indicate the new phisical block number where     *
*   						 the valid data will be saved   				  *
*		newSector:indicate the sector that has caused the defrag operation*
*					  It is setted -1 if there is not   					  *
*   																		  *
*	RETURN VALUES   														  *
*		SUCCESS: the defrag has been executed   							  *
*		FAILURE : an error is occured   									  *
*   																		  *
*******************************************************************************/

NFTL_Return MinimizeStructure(UINT16 *blockNumbers, UINT8 len, void *mainElem,
	UINT16 physicalBlockNumber, INT8 newSector)
{
	int i;
	UINT8 Buffer[SECTOR_SIZE + BUFFER_SPARE_SIZE]; 
	UINT8 tempBuffer[BUFFER_SPARE_SIZE];
	//NFTL_Return result = FAILURE;
	SectorMap SectorMRoot;
	SectorMap SectorMLeaf;
	SectorMap NewSectorMap;

	UINT16 SourceBlock;
	UINT8 SourcePage;
	UINT8 SourceSector;
	UINT8 NumPageWritten = 0;
	UINT8 RootCounter = 0; 
	UINT8 NoSectorLeaf, NoSectorRoot;  	
	UINT8 isInCache = 0;
	UINT8 SectorNumber = 0;


	//initialize SectorMap

	SectorMLeaf.PhysicalBlockNumber = 0;
	SectorMLeaf.OffsetValidation = -1;

	SectorMRoot.PhysicalBlockNumber = 0;
	SectorMRoot.OffsetValidation = -1;

	NewSectorMap.PhysicalBlockNumber = physicalBlockNumber;
	NewSectorMap.OffsetValidation = -1;


	for (i = 0; i < MAX_SECTOR_NUMBER; i++)
	{
		SectorMRoot.Sector[i] = 0;
		SectorMLeaf.Sector[i] = 0;
		NewSectorMap.Sector[i] = 0;
	}	

#ifdef NFTL_DEBUG
	if (physicalBlockNumber > UD_END_PARTITION)
		return FAILURE;

	if (blockNumbers == NULL)
		return FAILURE;


	if (pageInBlock == 0)
	{
		pageInBlock = 32;
	}
#endif
	if (FindSectorMap(blockNumbers[0],&SectorMRoot) != SUCCESS)
	{
		return FAILURE;
	}



	//the garbage involving two blocks, Root and Leaf
	if (len > 1)
	{
		if (FindSectorMap(blockNumbers[1],&SectorMLeaf) != SUCCESS)
		{
			return FAILURE;
		}
	}    


	for (i = 0; i < MAX_SECTOR_NUMBER; i++)
	{
		SourceBlock = 0;
		SourcePage = 0;
		SourceSector = 0;  

		NoSectorLeaf = 1;
		NoSectorRoot = 1;

		if (i == newSector)
		{
			continue;
		}
		else
		{
			if ((SectorMLeaf.Sector[i] != 0) ||
				((SectorMLeaf.OffsetValidation == i) && (SectorMLeaf.Sector[i] == 0)))
			{
				SourceBlock = SectorMLeaf.PhysicalBlockNumber;
				SourcePage = SectorMLeaf.Sector[i];
				SourceSector = i;
				NoSectorLeaf = 0;
			}
			else
			{
				if ((SectorMRoot.Sector[i] != 0) ||
					((SectorMRoot.OffsetValidation == i) && (SectorMRoot.Sector[i] == 0)))
				{
					SourceBlock = SectorMRoot.PhysicalBlockNumber;
					SourcePage = SectorMRoot.Sector[i];
					SourceSector = i;    
					NoSectorRoot = 0;
				}
			}//end else
		}//end else (i == newSector) 

		if ((NoSectorRoot == 0) || (NoSectorLeaf == 0))
		{
			//if (ReadPage(SourceBlock,SourcePage,Buffer) != NAND_PASS)
				if (Read(SourceBlock,SourcePage,Buffer) != NAND_PASS)
				return FAILURE;

			RootCounter = (Buffer[SECTOR_SIZE + ROOT_COUNTER_BYTE]);


			//Set spare data of page 
			Buffer[SECTOR_SIZE + TREE_POSITION_BYTE] = ROOT_POSITION;
			Buffer[SECTOR_SIZE + COPY_TREE_POSITION_BYTE] = ROOT_POSITION;

			if (RootCounter == 255)
			{
				Buffer[SECTOR_SIZE + ROOT_COUNTER_BYTE] = 0;
			}
			else
			{
				RootCounter++;
				Buffer[SECTOR_SIZE + ROOT_COUNTER_BYTE] = RootCounter;
			}


			//if (WritePage(physicalBlockNumber,NumPageWritten,Buffer) != SUCCESS)
			if (Write528(physicalBlockNumber,NumPageWritten,Buffer) != SUCCESS)
			{
				return FAILURE;
			}


			SectorNumber = Buffer[SECTOR_SIZE + SECTOR_NUMBER] |
				Buffer[SECTOR_SIZE + COPY_SECTOR_NUMBER]; //sudeep::Bug

			if (NumPageWritten == 0)
			{
				NewSectorMap.OffsetValidation = SectorNumber;
			}

			NewSectorMap.Sector[SectorNumber] = NumPageWritten;
			NumPageWritten++;
		}
	}


	if (NumPageWritten != 0)
	{
		SetGCNumPageWritten(NumPageWritten - 1);
	}
	else
	{
		SetGCNumPageWritten(0);

		//if (ReadPage(SectorMLeaf.PhysicalBlockNumber,0,Buffer)!= NAND_PASS)
			if (Read(SectorMLeaf.PhysicalBlockNumber,0,Buffer)!= NAND_PASS)
			return FAILURE ;

		RootCounter = (Buffer[SECTOR_SIZE + ROOT_COUNTER_BYTE]);


		//Set spare data of page 
		Buffer[SECTOR_SIZE + TREE_POSITION_BYTE] = ROOT_POSITION;
		Buffer[SECTOR_SIZE + COPY_TREE_POSITION_BYTE] = ROOT_POSITION;

		if (RootCounter == 255)
		{
			Buffer[SECTOR_SIZE + ROOT_COUNTER_BYTE] = 0;
		}
		else
		{
			RootCounter++;
			Buffer[SECTOR_SIZE + ROOT_COUNTER_BYTE] = RootCounter;
		}


		//if (WritePage(physicalBlockNumber,NumPageWritten,Buffer) != SUCCESS)
			if (Write528(physicalBlockNumber,NumPageWritten,Buffer) != SUCCESS)
		{
			return FAILURE;
		}


		SectorNumber = Buffer[SECTOR_SIZE + SECTOR_NUMBER] |
			Buffer[SECTOR_SIZE + COPY_SECTOR_NUMBER]; //sudeep::Bug

		if (NumPageWritten == 0)
		{
			NewSectorMap.OffsetValidation = SectorNumber;
		}

		NewSectorMap.Sector[SectorNumber] = NumPageWritten;
		NumPageWritten++;
	}



	//angelo bug
	for (i = 0; i < len; i++)
	{
		if (CopyAndEraseSectorMapToCache(blockNumbers[i],&NewSectorMap) == SUCCESS)
		{
			isInCache = 1;
		}
	}

	OS_MemSet(tempBuffer,0xFF,BUFFER_SPARE_SIZE);

	tempBuffer[INVALID_BLOCK_BYTE] = 0x00;

	for (i = 0; i < len; i++)
	{
		if (SetPageStatus(blockNumbers[i],1,tempBuffer) != SUCCESS)
		{
			return FAILURE;
		}
		AddInvalidBlock(blockNumbers[i]);
	}

	if (isInCache == 0)
	{
		IncrementIndexCache();
		SetSMFreeCache(GetSMIndexCache(),1); 
		CopySectorMap(NewSectorMap,GetSMIndexCache());
	}

	SetSMUsedBlocks(GetSMUsedBlocks() + 1);

	return SUCCESS;
}



UINT16 GetGCNumPageWritten()
{
	return NumPageWritten;
}

void SetGCNumPageWritten(UINT16 value)
{
	NumPageWritten = value;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线精品国自产拍免费| 国产欧美日韩综合| 波多野结衣91| 成人激情电影免费在线观看| 国产精品66部| 成人黄页毛片网站| 成人h精品动漫一区二区三区| 国产一本一道久久香蕉| 美女爽到高潮91| 国精产品一区一区三区mba桃花| 免费xxxx性欧美18vr| 麻豆一区二区三| 国产精品一二三四| aa级大片欧美| 91成人网在线| 欧美精品成人一区二区三区四区| 欧美猛男超大videosgay| 欧美日韩www| 亚洲精品在线三区| 国产色91在线| 亚洲主播在线播放| 免费久久精品视频| 成人久久视频在线观看| 一本大道久久a久久综合| 555www色欧美视频| 久久夜色精品一区| 亚洲免费观看高清在线观看| 亚洲国产精品久久一线不卡| 紧缚捆绑精品一区二区| www.成人在线| 日韩写真欧美这视频| 国产欧美精品在线观看| 亚洲大片精品永久免费| 国产一区二区电影| 欧美在线观看视频一区二区| 精品国产乱码久久久久久蜜臀| 国产精品第一页第二页第三页| 午夜私人影院久久久久| 国内精品视频666| 91在线云播放| 久久久久一区二区三区四区| 亚洲欧美日韩国产一区二区三区 | 狠狠色丁香婷婷综合| 成人免费看片app下载| 欧美日韩不卡视频| 国产精品国产精品国产专区不蜜 | 裸体一区二区三区| 91蜜桃婷婷狠狠久久综合9色| 在线播放中文字幕一区| ㊣最新国产の精品bt伙计久久| 午夜精品久久久久久久久久| 国产福利一区二区| 91精品国产一区二区| 亚洲欧洲www| 成人免费观看男女羞羞视频| 欧美日韩一区在线观看| 国产精品私人自拍| 韩国v欧美v日本v亚洲v| 精品1区2区3区| 亚洲天堂久久久久久久| 国产老肥熟一区二区三区| 日韩视频一区二区三区在线播放| 亚洲精品第一国产综合野| 国产河南妇女毛片精品久久久| 欧美精品亚洲一区二区在线播放| 亚洲三级理论片| 成人福利视频在线| 国产三级三级三级精品8ⅰ区| 亚洲成人自拍偷拍| 91成人国产精品| 亚洲精品乱码久久久久久 | 中文字幕在线观看不卡视频| 狠狠色狠狠色综合系列| 日韩欧美综合在线| 久久av中文字幕片| 欧美一级在线视频| 日本欧美一区二区在线观看| 欧美色图一区二区三区| 亚洲综合一区二区| 欧美色精品在线视频| 亚洲黄一区二区三区| 日本高清无吗v一区| 亚洲综合清纯丝袜自拍| 欧美日韩一二区| 亚洲va欧美va国产va天堂影院| 在线精品视频免费播放| 肉色丝袜一区二区| 欧美一区二区观看视频| 奇米影视一区二区三区| 精品国产亚洲在线| 国产成人免费网站| 中文字幕一区二区三| 欧美一级在线视频| 另类小说视频一区二区| 久久久久久久久久电影| 国产超碰在线一区| 亚洲欧美另类久久久精品 | 蜜臀av亚洲一区中文字幕| 欧美一区二区三区视频在线观看| 日本在线播放一区二区三区| 精品乱人伦一区二区三区| 国产精品一区二区黑丝| 国产精品久99| 91精品麻豆日日躁夜夜躁| 国产一区二区视频在线播放| 国产精品女同互慰在线看| 欧美天堂一区二区三区| 蜜桃精品在线观看| 亚洲国产成人在线| 欧美日韩日日骚| 国产麻豆午夜三级精品| 亚洲女与黑人做爰| 日韩精品中文字幕在线不卡尤物| 国产v综合v亚洲欧| 亚洲成人你懂的| 国产日韩三级在线| 91精品综合久久久久久| 成人精品视频一区二区三区| 午夜欧美电影在线观看| 国产日产欧美一区二区视频| 欧美偷拍一区二区| 成人免费视频视频| 免费人成精品欧美精品| 亚洲欧美电影院| 国产欧美一区在线| 欧美一区二区在线观看| 91啪九色porn原创视频在线观看| 免费的国产精品| 亚洲精品亚洲人成人网在线播放| 精品免费日韩av| 91精品国产综合久久久蜜臀图片| www.在线成人| 国产精品白丝av| 久久av老司机精品网站导航| 亚洲午夜免费电影| 亚洲欧美自拍偷拍| 久久精品视频网| 精品国产髙清在线看国产毛片| 色哟哟精品一区| 99久久精品免费看国产免费软件| 精品制服美女久久| 日韩黄色小视频| 亚洲v日本v欧美v久久精品| 一级女性全黄久久生活片免费| 欧美国产一区在线| 久久综合九色综合97_久久久 | 久久尤物电影视频在线观看| 欧美日韩精品一区二区天天拍小说 | 亚洲成人久久影院| 亚洲特黄一级片| 亚洲欧洲日产国码二区| 亚洲国产精品传媒在线观看| 26uuu亚洲| 国产视频一区不卡| 国产欧美一区二区精品久导航| 精品国产欧美一区二区| 日韩欧美激情四射| 久久亚洲一区二区三区明星换脸| 日韩欧美一级片| 精品久久久久久久人人人人传媒 | 国产成人综合亚洲网站| 韩国女主播成人在线观看| 国产一区久久久| 国产成人综合自拍| 99精品视频一区二区三区| 成人黄色综合网站| 欧美午夜精品免费| 欧美日韩国产高清一区二区三区| 欧美精品成人一区二区三区四区| 日韩欧美一区在线| 国产欧美综合色| 亚洲视频中文字幕| 亚洲成年人网站在线观看| 免费视频一区二区| 国产jizzjizz一区二区| 色综合久久久久久久久| 精品视频免费看| 久久久精品tv| 亚洲女人****多毛耸耸8| 日韩电影一区二区三区四区| 国内精品国产三级国产a久久| 成人av小说网| 欧美一区日韩一区| 一级日本不卡的影视| 久久se精品一区精品二区| 99国产精品99久久久久久| 欧美丝袜自拍制服另类| 精品国免费一区二区三区| 国产精品久久久久久久久快鸭| 午夜视频在线观看一区二区| 国产一区二区免费看| 色av综合在线| 精品国产自在久精品国产| 中文子幕无线码一区tr| 肉丝袜脚交视频一区二区| 成人app网站| 精品国产免费一区二区三区四区 | 日韩一区二区三区高清免费看看| 中文字幕精品一区二区精品绿巨人 | 国产精品美女久久久久av爽李琼|