📄 wmrtypes.h
字号:
BOOL32 b8BitECC;
} WMRDeviceInfo;
typedef struct {
UINT32 nNumOfBank; /* the number of banks */
UINT32 nNumOfMaps; /* the number of map blocks */
BOOL32 bInterLeaving; /* support interleaving or not */
BOOL32 bInternalInterLeaving; /* support internal interleaving or not */
BOOL32 bCheckSpareECC; /* check spare ecc or not (for bad check)*/
#if (!WMR_STDLIB_SUPPORT)
UINT32 nNumOfBankShift;
UINT32 nNumOfMapsShift;
#endif
UINT32 nFSScanRatio; // scan percentage of total FTL area
UINT32 nOSScanRatio; // scan percentage of total FTL area
BOOL32 bBootingScan;
UINT32 nCriticalReadCountValue; // scan percentage of total FTL area
} WMRConfig;
typedef struct {
UINT32 nWMRAreaStart; /* WMR_AREA_SIZE */
UINT32 nSPAreaSize; /* the block number of Special area size */
UINT32 nVFLAreaSize; /* the block number of VFL area size */
UINT32 nReservedSecSize; /* the size of reserved section */
UINT32 nFTLInfoStart; /* FTL info section start */
UINT32 nFTLInfoSize; /* FTL info section size */
UINT32 nFreeSecStart; /* free section start */
UINT32 nDataSecStart; /* data section start */
UINT32 nDataSecSize; /* data section size */
UINT32 nReclaimCnt;
} WMRLayout;
/*****************************************************************************/
/* Global variables extern */
/*****************************************************************************/
extern WMRDeviceInfo stDeviceInfo;
extern WMRConfig stConfig;
extern WMRLayout stLayout;
/*****************************************************************************/
/* Global variables redefinitions (WMRDeviceInfo) */
/*****************************************************************************/
#define GET_DevType() (stDeviceInfo.nDeviceType)
#define SET_DevType(x) (stDeviceInfo.nDeviceType = x)
#define DEV_ADDR_CYCLE (stDeviceInfo.nAddrCycle)
#define SECTORS_PER_PAGE (stDeviceInfo.nSecPerPage)
#define SECTORS_PER_SUPAGE (stDeviceInfo.nSecPerVPage)
#define TWO_PLANE_PROGRAM (stDeviceInfo.b2XProgram)
#define TWO_PLANE_READ (stDeviceInfo.b2XRead)
#define TWO_PLANE_READ_STATUS (stDeviceInfo.b2XReadStatus)
#define PAGES_PER_BLOCK (stDeviceInfo.nPagesPerBlock)
#define SECTORS_PER_SUBLK (stDeviceInfo.nSecPerVb)
#define PAGES_PER_SUBLK (stDeviceInfo.nPagesPerVb)
#define PAGES_PER_BANK (stDeviceInfo.nPagesPerBank)
#define PAGES_TOTAL (stDeviceInfo.nPagesTotal)
#define ECC_8BIT_SPPORT (stDeviceInfo.b8BitECC) // to support 8Bit ecc hsjang 080923
#define PAGES_PER_METADATA (1)
#define SUBLKS_TOTAL (stDeviceInfo.nVbTotal)
#define USER_SUBLKS_TOTAL (stDeviceInfo.nUserVbTotal)
#define USER_SECTORS_TOTAL (stDeviceInfo.nUserSecTotal)
#if (!WMR_STDLIB_SUPPORT)
#define SECTORS_PER_PAGE_SHIFT (stDeviceInfo.nSecPerPageShift)
#define SECTORS_PER_SUPAGE_SHIFT (stDeviceInfo.nSecPerVPageShift)
#define SECTORS_PER_SUBLK_SHIFT (stDeviceInfo.nSecPerVbShift)
#define PAGES_PER_BLOCK_SHIFT (stDeviceInfo.nPagesPerBlockShift)
#define PAGES_PER_SUBLK_SHIFT (stDeviceInfo.nPagesPerVbShift)
#define PAGES_PER_BANK_SHIFT (stDeviceInfo.nPagesPerBankShift)
#define BLOCKS_PER_BANK_SHIFT (stDeviceInfo.nBlocksPerBankShift)
#endif
#define BLOCKS_PER_BANK (stDeviceInfo.nBlocksPerBank)
#define BYTES_PER_SECTOR (WMR_SECTOR_SIZE)
#define BYTES_PER_SPARE (WMR_SPARE_SIZE)
#define BYTES_PER_MAIN_PAGE (stDeviceInfo.nBytesPerPage)
#define BYTES_PER_SPARE_PAGE (stDeviceInfo.nBytesPerSpare)
#define BYTES_PER_MAIN_SUPAGE (stDeviceInfo.nBytesPerVPage)
#define BYTES_PER_SPARE_SUPAGE (stDeviceInfo.nBytesPerVSpare)
#if (WMR_READ_RECLAIM)
#define READ_ERR_FLAG (stDeviceInfo.bReadErrFlag)
#endif
#if (WMR_MLC_LSB_RECOVERY)
#define MLC_LSB_CLASS (stDeviceInfo.nMLCLSBClass)
#endif
#define FAT_SIZE (stDeviceInfo.nFATSize)
/*****************************************************************************/
/* Global variables redefinitions (WMRConfig) */
/*****************************************************************************/
#define BANKS_TOTAL (stConfig.nNumOfBank)
#define NUM_MAPS (stConfig.nNumOfMaps)
#define IS_SUPPORT_INTERLEAVING (stConfig.bInterLeaving)
#define IS_SUPPORT_INTERNAL_INTERLEAVING (stConfig.bInternalInterLeaving)
#define IS_CHECK_SPARE_ECC (stConfig.bCheckSpareECC)
#if (!WMR_STDLIB_SUPPORT)
#define BANKS_TOTAL_SHIFT (stConfig.nNumOfBankShift)
#define NUM_MAPS_SHIFT (stConfig.nNumOfMapsShift)
#endif
#define FS_SCAN_RATIO (stConfig.nFSScanRatio)
#define OS_SCAN_RATIO (stConfig.nOSScanRatio)
#define BOOTING_SCAN (stConfig.bBootingScan)
#define CRITICAL_READ_CNT (stConfig.nCriticalReadCountValue)
#define SCAN_OS (1<<1)
#define SCAN_FS (1<<2)
/*****************************************************************************/
/* Global variables redefinitions (WMRLayout) */
/*
+---------------------------+
| WMR_AREA (1) |
+---------------------------+
| SPECIAL_AREA (0) | User specific area
+---------------------------+
| VFL_INFO_SECTION (4) |
+---------------------------+
| RESERVED_SECTION | = SUBLKS_TOTAL - (FTL_AREA_SIZE + WMR_AREA_SIZE + VFL_INFO_SECTION_SIZE);
+---------------------------+
| FTL_INFO_SECTION | = (SUBLKS_TOTAL / WMR_MAPS_PER_BLOCK) + 2
+---------------------------+
| FREE_SECTION (10) |
| + LOG_SECTION (7) |
| + FREE_LIST_SIZE (3) |
+---------------------------+
| DATA_SECTION | = SUBLKS_TOTAL * WMR_USER_SUBLKS_RATIO / 256;
+---------------------------+
*/
/*****************************************************************************/
#define WMR_AREA_DEF_SIZE (10) // WMR(1) + TOC(2) + Eboot(7)
#define WMR_AREA_SIZE (stLayout.nWMRAreaStart) // WMR(1) + TOC(1) + Eboot(5)
#define SPECIAL_AREA_START (WMR_AREA_SIZE)
#define SPECIAL_AREA_SIZE (stLayout.nSPAreaSize) // dodan2-061129
#define VFL_AREA_START (SPECIAL_AREA_START + SPECIAL_AREA_SIZE)
#define VFL_AREA_SIZE (stLayout.nVFLAreaSize)
#define VFL_INFO_SECTION_START (VFL_AREA_START)
#define VFL_INFO_SECTION_SIZE (4)
#define RESERVED_SECTION_START (VFL_INFO_SECTION_START + VFL_INFO_SECTION_SIZE)
#define RESERVED_SECTION_SIZE (stLayout.nReservedSecSize)
#define FTL_INFO_SECTION_START (stLayout.nFTLInfoStart)
#define FTL_INFO_SECTION_SIZE (stLayout.nFTLInfoSize)
#if (!WMR_MLC_LSB_RECOVERY)
#define LOG_SECTION_SIZE (FREE_SECTION_SIZE - FREE_LIST_SIZE)
#define FREE_SECTION_START (stLayout.nFreeSecStart)
#define FREE_SECTION_SIZE (10)
#define FREE_LIST_SIZE (3)
#else
#define LOG_SECTION_SIZE ((FREE_SECTION_SIZE - FREE_LIST_SIZE)/2)
#define FREE_SECTION_START (stLayout.nFreeSecStart)
#define FREE_SECTION_SIZE (17)
#define FREE_LIST_SIZE (3)
#endif
#define DATA_SECTION_START (stLayout.nDataSecStart)
#define DATA_SECTION_SIZE (stLayout.nDataSecSize)
#define FTL_AREA_START (VFL_AREA_START + VFL_AREA_SIZE)
#define FTL_AREA_SIZE (FTL_INFO_SECTION_SIZE + FREE_SECTION_SIZE + USER_SUBLKS_TOTAL)
#define WMR_MAX_RECLAIM (stLayout.nReclaimCnt)
/*****************************************************************************/
/* exported function prototype */
/*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
VOID CalcGlobal (BOOL32 bInternalInterleaving);
#if (WMR_MLC_LSB_RECOVERY)
UINT32 GetMlcClass (UINT8 nDID, UINT8 nHID);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _WMR_TYPES_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -