📄 davrectb.h
字号:
/* Copyright (c) 1995-2002 Intel Corporation */
/* Intel Confidential */
/* ###########################################################################
### DAV - Direct Access Volume Enhancement to FDI
###
### Module: davrectb.h - Reclaim Table Include File
###
### $Workfile: davrectb.h $
### $Revision: 48 $
### $NoKeywords: $
########################################################################### */
/*
*****************************************************************
* NOTICE OF LICENSE AGREEMENT
*
* This code is provided by Intel Corp., and the use is governed
* under the terms of a license agreement. See license agreement
* for complete terms of license.
*
* YOU MAY ONLY USE THE SOFTWARE WITH INTEL FLASH PRODUCTS. YOUR
* USE OF THE SOFTWARE WITH ANY OTHER FLASH PRODUCTS IS EXPRESSLY
* PROHIBITED UNLESS AND UNTIL YOU APPLY FOR, AND ARE GRANTED IN
* INTEL'S SOLE DISCRETION, A SEPARATE WRITTEN SOFTWARE LICENSE
* FROM INTEL LICENSING ANY SUCH USE.
*****************************************************************
*/
#ifndef __dav_rectbl_h /* sentry header */
#define __dav_rectbl_h
/*### Global Declarations
#########################*/
#if (DIRECT_ACCESS_VOLUME == TRUE)
/*### Reclaim Table Tracking Data Structures
###################################################################*/
/* Reclaim Table Entry Structure */
typedef struct
{
UINT32 FirstHeaderLocation;
UINT32 Status;
} RECTBL_TableEntry;
typedef RECTBL_TableEntry __FAR_ * RECTBL_TableEntryPtr;
#define RECTBL_EntryStatusOffset (offsetof(RECTBL_TableEntry, Status))
/*### Reclaim Table Information Macros/Definition
###################################################################*/
typedef struct
{
UINT16 TableId;
UINT16 FirstBlock;
UINT16 TotalBlocks;
UINT16 word_align;
} RECTBL_TableInfo, __FAR_ * RECTBL_TableInfoPtr;
#define RECTBL_TableIdOffset (offsetof(RECTBL_TableInfo, TableId))
#define RECTBL_FirstBlockOffset (offsetof(RECTBL_TableInfo, FirstBlock))
#define RECTBL_TotalBlocksOffset (offsetof(RECTBL_TableInfo, TotalBlocks))
#define RECTBL_TableDataOffset (sizeof(RECTBL_TableInfo))
#define RECTBL_TableInfoSize (sizeof(RECTBL_TableInfo))
/* Reclaim Table (TableId) States */
#define RECTBL_TableDataInit 0xFFFF
#define RECTBL_TableDataValid 0xF0F0
#define RECTBL_TableDataInvalid 0x0000
#define RECTBL_HeaderName "#$%RECLAIMTBL%$#"
#define RECTBL_HeaderNameLength (sizeof(RECTBL_HeaderName) - 1)
#define RECTBL_HeaderEntrySize (HDR_CalcHdrSize(RECTBL_HeaderNameLength - 1))
#define RECTBL_TableEntrySize (sizeof(RECTBL_TableEntry))
/* Size of the paragraph reclaim table rounded up to the nearest */
/* paragraph boundary. */
#define RECTBL_ParaRecTblSize \
(RoundUp(((FDI_NumFlashBlocks * RECTBL_TableEntrySize) + \
RECTBL_TableInfoSize), FDI_ParagraphLength))
/* Size of the page reclaim table rounded up to the nearest page */
/* boundary. */
#define RECTBL_PageRecTblSize \
(RoundUp((FDI_NumFlashBlocks * RECTBL_TableEntrySize), FDI_PageSize))
/*### Reclaim Table Entry macros
###################################################################*/
/*### RECTBL_TableEntry: Status Field Mask value */
#define RECTBL_MASK_Status 0x00003FFF
#define RECTBL_InitStatusEntry(table_entry) \
(table_entry).Status = 0xFFFFFFFF; \
(table_entry).FirstHeaderLocation = 0xFFFFFFFF
#define RECTBL_NoFirstHeaderMarker 0xffffffff
/*### RECTBL_TableEntry: Status */
#define RECTBL_MASK_ReclaimInProgress 0x00003
#define RECTBL_MASK_EraseInProgress 0x0000C
#define RECTBL_MASK_EraseComplete 0x00030
#define RECTBL_MASK_CopyComplete 0x000C0
#define RECTBL_MASK_BlockDone 0x00300
#define RECTBL_MASK_ValidFHL 0x00C00
#define RECTBL_MASK_PVO 0x03000
#define RECTBL_InitStatus(table_entry) \
((table_entry).Status |= RECTBL_MASK_Status)
/* Get the Status in Reclaim Table Entry */
#define RECTBL_GetStatus(table_entry) \
((table_entry).Status & RECTBL_MASK_Status)
/* Reclaim In Progress (RIP) */
#define RECTBL_IsReclaimInProgress(table_entry) \
(!((table_entry).Status & RECTBL_MASK_ReclaimInProgress))
#define RECTBL_MarkReclaimInProgress(table_entry) \
((table_entry).Status &= ~RECTBL_MASK_ReclaimInProgress)
/* Valid First Header Location (ValidFHL) */
#define RECTBL_IsValidFHL(table_entry) \
(!((table_entry).Status & RECTBL_MASK_ValidFHL))
#define RECTBL_MarkValidFHL(table_entry) \
((table_entry).Status &= ~RECTBL_MASK_ValidFHL)
/* Erase In Progress (EIP) */
#define RECTBL_IsEraseInProgress(table_entry) \
(!((table_entry).Status & RECTBL_MASK_EraseInProgress))
#define RECTBL_MarkEraseInProgress(table_entry) \
((table_entry).Status &= ~RECTBL_MASK_EraseInProgress)
/* Erase Complete (EC) */
#define RECTBL_IsEraseComplete(table_entry) \
(!((table_entry).Status & RECTBL_MASK_EraseComplete))
#define RECTBL_MarkEraseComplete(table_entry) \
((table_entry).Status &= ~RECTBL_MASK_EraseComplete)
/* Copy Complete (CC) */
#define RECTBL_IsCopyComplete(table_entry) \
(!((table_entry).Status & RECTBL_MASK_CopyComplete))
#define RECTBL_MarkCopyComplete(table_entry) \
((table_entry).Status &= ~RECTBL_MASK_CopyComplete)
/* Block Done/Full */
#define RECTBL_IsBlockDone(table_entry) \
(!((table_entry).Status & RECTBL_MASK_BlockDone))
#define RECTBL_MarkBlockDone(table_entry) \
((table_entry).Status &= ~RECTBL_MASK_BlockDone)
/*### RECTBL_TableEntry: First Header Location */
#define RECTBL_GetFirstHeaderLocation(table_entry, block) \
((table_entry).FirstHeaderLocation + Block2Handle(block))
#define RECTBL_SetFirstHeaderLocation(table_entry, offset) \
((table_entry).FirstHeaderLocation = (offset - BlockAlign(offset)))
/*### RECTBL_TableEntry: Previous Valid Object */
#define RECTBL_PVO_NoPrevValid RECTBL_MASK_PVO
#define RECTBL_PVO_PrevValid 0x00000000
#define RECTBL_IsPreviousValidObject(table_entry) \
(((table_entry).Status & RECTBL_MASK_PVO) == RECTBL_PVO_PrevValid)
#define RECTBL_MarkPreviousValidObject(table_entry, prev_valid) \
((table_entry).Status = ((table_entry).Status & ~RECTBL_MASK_PVO) | prev_valid)
/*### Memory reserves for the reclaim table */
/*################################################################### */
/*### This is the amount of space that must be taken from free */
/*### space in order to ensure a paragraph reclaim. */
/*### (2 Header entries + 1 Reclaim table in paragraph space) */
#define RECTBL_ParaReclaimSpace \
(RoundUp(RECTBL_ParaRecTblSize, FDI_ParagraphLength) + \
(2 * RoundUp(RECTBL_HeaderEntrySize, FDI_ParagraphLength)))
/*### This is the amount of space that must be taken from free */
/*### space in order to ensure a page reclaim. */
/*### (1 Reclaim Table in page space) */
#define RECTBL_PageReclaimSpace \
(RoundUp(RECTBL_PageRecTblSize, FDI_ParagraphLength))
/* The address of the reclaim table for a page reclaim is */
/* at the Top of the reclaim block minus 1 page. */
#define RECTBL_RBAddrInPageReclaim \
(FDI_ReclaimBlockAddress + FDI_BlockSize - FDI_PageSize)
/* The address of the reclaim table for a paragraph reclaim is */
/* at the Bottom of the reclaim block. */
#define RECTBL_RBAddrInParaReclaim (FDI_ReclaimBlockAddress)
/*ISF defines and Macros*/
#define RECTBL_EntryISF_MASK 0xAAAAAAAA /* 0x00002AAA*/
#define GetRECTBLQuasiState(status) ((status ^ (status << 1)) & RECTBL_EntryISF_MASK)
#define FixRECTBLQuasiStateTo00(unknown, status) \
((~(unknown | (unknown >> 1))) & status)
#define FixRECTBLQuasiStateTo11(temp_state, status) ((temp_state | (temp_state >> 1)) | status)
/*Table ID*/
#define RECTBL_TableInfoISF_MASK 0xAAAA /* 0xF0F0*/
#define GetRECTBL_IDQuasiState(status) ((status ^ (status << 1)) & RECTBL_TableInfoISF_MASK)
#define FixRECTBL_IDQuasiStateTo00(unknown, status) \
((~(unknown | (unknown >> 1))) & status)
#define FixRECTBL_IDQuasiStateTo11(temp_state, status) ((temp_state | (temp_state >> 1)) | status)
/*End Table ID*/
/*End ISF defines and Macros*/
/*### Global Functions
#########################*/
ERR_CODE RECTBL_CreateTable(HDR_SearchInfoPtr table_info_ptr,
BOOLEAN use_page_space,
BOOLEAN restart);
ERR_CODE RECTBL_WriteTableInfo(FDI_Handle table_address,
RECTBL_TableInfoPtr table_info_ptr,
BOOLEAN para_reclaim_tbl);
ERR_CODE RECTBL_MarkTableComplete(FDI_Handle tbl_hdr_addr,
FDI_Handle tbl_base_addr,
BOOLEAN mark_hdr2valid,
BOOLEAN restart);
ERR_CODE RECTBL_GetTableInfo(FDI_Handle table_address,
RECTBL_TableInfoPtr table_info_ptr,
BOOLEAN para_reclaim_tbl,
BOOLEAN restart);
ERR_CODE RECTBL_WriteTable(FDI_Handle table_handle,
UINT32 block,
RECTBL_TableEntryPtr status_ptr,
BOOLEAN para_reclaim_tbl,
BOOLEAN restart);
ERR_CODE RECTBL_ReadTable(FDI_Handle table_handle,
UINT32 block,
RECTBL_TableEntryPtr status_ptr,
BOOLEAN para_reclaim_tbl,
BOOLEAN restart);
#endif /* sentry */
#endif /* DIRECT_ACCESS_VOLUME */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -