📄 davotttbl.h
字号:
/* Copyright (c) 1995-2004 Intel Corporation */
/* Intel Confidential */
/* ###########################################################################
### DAV - Direct Access Volume Enhancement to FDI
###
### Module: DavOttTbl.h - Types & Macros Include File
###
### $Workfile: DavOttTbl.h $
### $Revision: 14 $
### $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_OTT_TABLE_H__ /* sentry header */
#define __DAV_OTT_TABLE_H__
#if (DIRECT_ACCESS_VOLUME == TRUE)
/*### Global Declarations
#########################*/
#define OTTTBL_MaxEntries 255 /* 1 Byte */
/*Fix Start:SCR964 */
/*########################################################################*/
/*### Object Tracking Table (OTT) */
/*
// OTTTBL_Leader (16 bytes)
//
// 3 2 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 <- Bits ( 4 Bytes)
// +-------------------------------+-------------------------------+
// 0 | UniqueId 1 | ReclaimType | RFU |
// +-------------------------------+-------------------------------+
// 1 | EndBlkNum | StartBlkNum |
// +---------------------------------------------------------------+
// 2 | RFU |
// +-------------------------------+-------------------------------+
// 3 | NumRows | UniqueId 2 |
// +---------------+---------------+---------------+---------------+
// | 0 | 1 | 2 | 3 | <- Byte
//
*/
typedef struct
{
UINT16 UniqueId1;
UINT8 ReclaimType;
UINT8 RFU_1;
UINT16 EndBlockNumber;
UINT16 StartBlockNumber;
UINT32 RFU_2;
UINT16 NumRows;
UINT16 UniqueId2;
} OTTTBL_Leader, __FAR_ * OTTTBL_LeaderPtr;
/*Fix End:SCR964 */
/* UniqueId1 */
#define OTTTBL_UniqueId1 0xF0F0
void OTTTBL_SetUniqueId1(OTTTBL_LeaderPtr aPtr, UINT16 aWord);
UINT16 OTTTBL_GetUniqueId1(OTTTBL_LeaderPtr aPtr);
/* Number Rows */
/*Fix Start:SCR964 */
void OTTTBL_SetNumRows(OTTTBL_LeaderPtr aPtr, UINT16 aWord);
UINT16 OTTTBL_GetNumRows(OTTTBL_LeaderPtr aPtr);
/*Fix End:SCR964 */
/* Entry Operation */
#define OTTTBL_ReclaimType_NotUsed 0xFF
#define OTTTBL_ReclaimType_Defrag 0x01 /* 0000 0001 */
#define OTTTBL_ReclaimType_Reallocate 0x02 /* 0000 0010 */
#define OTTTBL_ReclaimType_ReclaimInPlace 0x03 /* 0000 0100 */
void OTTTBL_SetReclaimType(OTTTBL_LeaderPtr aPtr, UINT8 aByte);
UINT8 OTTTBL_GetReclaimType(OTTTBL_LeaderPtr aPtr);
/* Ending Block */
/*Fix Start:SCR964 */
void OTTTBL_SetEndWorkBlockNumber(OTTTBL_LeaderPtr aPtr, UINT16 aWord);
UINT16 OTTTBL_GetEndWorkBlockNumber(OTTTBL_LeaderPtr aPtr);
/*Fix End:SCR964 */
/* Starting Block */
/*Fix Start:SCR964 */
void OTTTBL_SetStartWorkBlockNumber(OTTTBL_LeaderPtr aPtr, UINT16 aWord);
UINT16 OTTTBL_GetStartWorkBlockNumber(OTTTBL_LeaderPtr aPtr);
/*Fix End:SCR964 */
/* UniqueId2 */
#define OTTTBL_UniqueId2 0xF0F0
void OTTTBL_SetUniqueId2(OTTTBL_LeaderPtr aPtr, UINT16 aWord);
UINT16 OTTTBL_GetUniqueId2(OTTTBL_LeaderPtr aPtr);
/*
// OTTTBL_Entry (16 bytes)
// 3 2 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 <- Bits ( 4 Bytes)
// +-------------------------------+-------------------------------+
// 0 | Source |
// +-------------------------------+-------------------------------+
// 1 | Destination |
// +-------------------------------+-------------------------------+
// 2 | Size |
// +-------------------------------+-------------------------------+
// 3 | RFU | PinKeepStatus | Type | RFU |
// +-------------------------------+-------------------------------+
// | 0 | 1 | 2 | 3 | <- Byte
Order is accending based on destination address:
[0] Block 2
[1] Block 3
[2] Block 4
*/
typedef struct
{
UINT32 Source;
UINT32 Destination;
UINT32 Size;
UINT8 RFU8_1;
UINT8 PinStatusKeepStatus;
UINT8 Type;
UINT8 RFU8_2;
} OTTTBL_Entry, __FAR_ * OTTTBL_EntryPtr;
/*Fix Start:SCR964 */
ERR_CODE OTTTBL_AllocateFlash(FDI_Handle aObjHandle, OTTTBL_EntryPtr aEntryArrayPtr, UINT16 aArraySize, UINT8 aReclaimType, UINT16 aFirstRowBlkNum, UINT16 aLastRowBlkNum);
/*Fix End:SCR964 */
/* Entry Source */
void OTTTBL_SetOttEntrySource(OTTTBL_EntryPtr aPtr, UINT32 aDWord);
UINT32 OTTTBL_GetOttEntrySource(OTTTBL_EntryPtr aPtr);
/* Entry Destination */
void OTTTBL_SetOttEntryDestination(OTTTBL_EntryPtr aPtr, UINT32 aDWord);
UINT32 OTTTBL_GetOttEntryDestination(OTTTBL_EntryPtr aPtr);
/* Entry Size */
void OTTTBL_SetOttEntrySize(OTTTBL_EntryPtr aPtr, UINT32 aDWord);
UINT32 OTTTBL_GetOttEntrySize(OTTTBL_EntryPtr aPtr);
/* Pin Status */
#define OTTTBL_OttEntryPinStatus_NotUsed 0x0F /* XXXX 1111 */
#define OTTTBL_OttEntryPinStatus_Pinned 0x01 /* XXXX 0001 */
#define OTTTBL_OttEntryPinStatus_NotPinned 0x02 /* XXXX 0010 */
#define OTTTBL_OttEntryPinStatus_PinnedForBackup 0x04 /* XXXX 0100 */
#define OTTTBL_OttEntryPinStatus_PinnedForErase 0x08 /* XXXX 1000 */
void OTTTBL_SetOttEntryPinStatus(OTTTBL_EntryPtr aPtr, UINT8 aNibble);
UINT8 OTTTBL_GetOttEntryPinStatus(OTTTBL_EntryPtr aPtr);
/* SRam Keep Status */
#define OTTTBL_OttEntryKeepStatus_NotForFlash 0xF0 /* 1111 XXXX */
#define OTTTBL_OttEntryKeepStatus_KeepForFlash 0x10 /* 0001 XXXX */
void OTTTBL_SetOttEntryKeepStatus(OTTTBL_EntryPtr aPtr, UINT8 aNibble);
UINT8 OTTTBL_GetOttEntryKeepStatus(OTTTBL_EntryPtr aPtr);
/* Entry Type Field */
#define OTTTBL_OttEntryType_NotUsed 0x3F
#define OTTTBL_OttEntryType_DirtyChunk 0x03
#define OTTTBL_OttEntryType_FreeChunk 0x0C
#define OTTTBL_OttEntryType_UserObject 0x30
void OTTTBL_SetOttEntryType(OTTTBL_EntryPtr aPtr, UINT8 aByte);
UINT8 OTTTBL_GetOttEntryType(OTTTBL_EntryPtr aPtr);
/*
// OTTTBL_ObjectTable (28 bytes)
//
// 3 2 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 <- Bits ( 4 Bytes)
// +---------------------------------------------------------------+
// 0 | |
// + +
// 1 | |
// + OttHeader +
// 2 | |
// + +
// 3 | |
// +---------------------------------------------------------------+
// 4 | |
// + +
// 5 | |
// + OttEntry[OTTTBL_MaxConfigurationEntries] +
// 6 | |
// + +
// 7 | |
// +---------------+---------------+---------------+---------------+
// | 0 | 1 | 2 | 3 | <- Byte
//
*/
typedef struct
{
OTTTBL_Leader OttHeader;
OTTTBL_Entry OttEntry[OTTTBL_MaxEntries];
} OTTTBL_ObjectTable, __FAR_ * OTTTBL_ObjectTablePtr;
typedef enum
{
enByDestinationAddress,
enBySourceAddress
} EnSortOrder;
typedef enum
{
enObjectPointFirst, /* First point resides in a block range */
enObjectPointSecond, /* Second point resides in a block range */
enObjectPointBoth, /* Both points resides in a block range */
enObjectPointNeither
} EnObjectPoint;
typedef struct
{
UINT16 StartingObjListIndex;
UINT16 EndingObjListIndex;
UINT32 RangeSize;
UINT32 AvailableSize;
} RECL_RangeNode;
/*########################################################################*/
/*### Public Functions */
#define OTTTBL_CalcTableSize(aNumRows) \
(sizeof(OTTTBL_Leader)+(sizeof(OTTTBL_Entry)*aNumRows))
/* Utility Functions */
void OTTTBL_InitializeSRAMOTT(OTTTBL_EntryPtr aPtr, UINT16 ArraySize);
ERR_CODE OTTTBL_ReadTableIntoSRAM(OTTTBL_LeaderPtr aLeaderPtr, FDI_Handle* aEntryHandlePtr, OTTTBL_EntryPtr aPtr, UINT16 ArraySize, UINT16* aActualArraySize);
ERR_CODE OTTTBL_SortObjects (OTTTBL_EntryPtr aOTTTBL, UINT16 aNumObjects, EnSortOrder aSortOrder);
ERR_CODE OTTTBL_SortRangeNodesByRangeSize(RECL_RangeNode* MoveableRangeTable, UINT8 NumberOfMoveableRanges);
ERR_CODE OTTTBL_SortRangeNodesByIndex(RECL_RangeNode* MoveableRangeTable, UINT8 NumberOfMoveableRanges);
OTTTBL_EntryPtr OTTTBL_FindBestFitObject(OTTTBL_EntryPtr aEntryPtr, UINT32 aSize, RECL_RangeNode* aMoveableRangeTable, UINT8 aNumberOfMoveableRanges, UINT8 aStartingRange);
BOOLEAN OTTTBL_IsMoving(OTTTBL_LeaderPtr aLeaderPtr, OTTTBL_EntryPtr aEntryPtr, BOOLEAN aForceCopyOpr);
/* Ott Search functions */
ERR_CODE OTTTBL_GetFirstOttEntry(FDI_Handle* aHandlePtr, OTTTBL_EntryPtr aEntryPtr, OTTTBL_LeaderPtr aLeaderPtr);
ERR_CODE OTTTBL_GetNextOttEntry (FDI_Handle* aFlashNextPtr, OTTTBL_EntryPtr aEntryPtr, FDI_Handle* aFlashCurrentPtr);
/*Fix Start:SCR964 */
void OTTTBL_CalcSourceBlockRange(OTTTBL_EntryPtr aEntryPtr, UINT16* aStartBlockPtr, UINT16* aEndBlockPtr);
void OTTTBL_CalcDestinationBlockRange(OTTTBL_EntryPtr aEntryPtr, UINT16* aStartBlockPtr, UINT16* aEndBlockPtr);
/*Fix End:SCR964 */
FDI_Handle OTTTBL_CalcSourceHandle(OTTTBL_EntryPtr aEntryPtr);
FDI_Handle OTTTBL_CalcDestinationHandle(OTTTBL_EntryPtr aEntryPtr);
/*Fix Start:SCR964 */
UINT32 OTTTBL_CalcDestinationBytesInBlock(OTTTBL_EntryPtr aEntryPtr, UINT16 aBlockNumber, UINT32* aBFPtr, UINT32* aCURPtr, UINT32* aAFPtr);
ERR_CODE OTTTBL_CalcOttIndexToBlock(UINT16 aRtIndex, OTTTBL_EntryPtr aEntryPtr, UINT16 aNumEntries, UINT16* aIndexPtr);
/*Fix End:SCR964 */
#endif /* DIRECT_ACCESS_VOLUME */
#endif /* __DAV_OTT_TABLE_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -