📄 logicmtd.h
字号:
/***********************************************************************************/
/* M-Systems Confidential */
/* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2003 */
/* All Rights Reserved */
/***********************************************************************************/
/* NOTICE OF M-SYSTEMS OEM */
/* SOFTWARE LICENSE AGREEMENT */
/* */
/* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
/* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
/* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
/* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
/* E-MAIL = info@m-sys.com */
/***********************************************************************************/
/*
* $Log: V:/PVCSDB/DiskOnChip/archives/general storage/TrueFFS/src/mtd/logicmtd.h-arc $
*
* Rev 1.5 Aug 10 2003 13:50:34 roneng
* - Add bUnitsInChipBits field in MTD_VARS struct
*
* Rev 1.4 May 28 2003 18:07:50 roneng
* Remove MTD_VARS->bNumOfUnitBits
*
* Rev 1.3 May 27 2003 20:10:46 roneng
* - Add bTimesRecovering to avoid recovering from seq error in endless loop
*
* Rev 1.2 May 16 2003 00:57:18 OriS
* Added wChipId field.
*
* Rev 1.1 May 06 2003 11:56:04 OriS
* Added support for complete operation mode.
*
* Rev 1.0 Apr 09 2003 12:15:54 OriS
* Initial revision.
*
*/
/************************************************************************
* Name : logicalmtd.h *
* *
* Written : Ronen Golan *
* *
* Abstract : This file contains the routines of the Logical OREN MTD *
************************************************************************/
#ifndef MTD_LOGICAL_H
#define MTD_LOGICAL_H
#include "matchalg.h"
/******************************* #define *****************************/
#define USE_BBT_CACHE 0x1
#define ALWAYS_READ_FROM_FLASH 0x2
#define MAX_BYTES_NEEDED_FOR_REG_SAVING 20
typedef struct
{
FLByte bFloor ;
FLByte bBank ;
FLByte bNoOfPhyUnits ; /* Erase only */
FLWord wNoOfPhySectors ; /* Write only */
FLWord FirstPhyUnitInPlane ; /* Erase only (where to put the erase Mark) */
} completeOpVarsStruct,*completeOpVarsStructPtr ;
typedef struct
{
FLByte RegSavedValArea[MAX_BYTES_NEEDED_FOR_REG_SAVING] ;
FLByte DPS_0_Key[PROTECTION_KEY_LENGTH] ;
FLByte DPS_1_Key[PROTECTION_KEY_LENGTH] ;
} SavedDOC_State_S,*SavedDOC_State_P ;
typedef struct MTDVars_T
{
/*******************************************************************************/
/**************************** Buffers *******************************/
/*******************************************************************************/
FLBuffer* buffer; /* buffer for map through buffer */
#ifdef VERIFY_WRITE
FLByte FAR1 * readBackBuffer; /* buffer for read back */
#endif /* VERIFY_WRITE */
/*******************************************************************************/
/************************* Flash properties *******************************/
/*******************************************************************************/
FLWord wMakerCode ; /* Maker code that the flash returned */
FLWord wDeviceCode ; /* Device code that the flash returned */
FLByte bNoOfPlanesBits ; /* How many planes exist in chip */
FLDword dwChipSize; /* chip size */
FLByte bAddressBytes; /* Address bytes for READ/WRITE operation*/
FLByte bFlashType; /* SLC_TYPE / MLC_TYPE */
FLByte bPlaneArraysInChip; /* No of plane arrays in chip */
/*******************************************************************************/
/************************* Page properties ********************************/
/*******************************************************************************/
FLWord wPageSize; /* size of flash page in bytes */
FLByte bPageSizeBits; /* How many bits the page size contains */
FLWord wPageAreaSize; /* Size of AREA_A/AREA_B */
FLWord wPageTailSize; /* Size of AREA_C */
FLWord wPagesPerBlockBits; /* How many bits used for page in block */
/*******************************************************************************/
/************************* Unit properties ********************************/
/*******************************************************************************/
FLDword dwUnitSize; /* Smallest physically erasable size */
FLWord wUnitsInChip; /* total erasable blocks in flash device*/
FLByte bUnitsInChipBits; /* No Of Bits representing unit in addr */
/*******************************************************************************/
/************************* Bank properties ****************************/
/*******************************************************************************/
FLWord wBanksInFloor; /* no of chips in array */
FLWord wBanksInLastFloor; /* How many banks exists in last floor */
/*** INTERLEAVE_FLAGS: ***/
/*** OREN_INTLV_1_8_BIT - 8 bit flash is connected to each bank ***/
/*** OREN_INTLV_1_16_BIT - 16 bit flash is connected to each bank ***/
/*** OREN_INTLV_2_CASCADED - 2 8 bit flashes is connected to each bank ***/
FLByte bInterleaveFlag;
/*******************************************************************************/
/************************ Logical Block properties **************************/
/*******************************************************************************/
FLDword dwLogicalUnitsInBank ;
FLDword dwLogicalUnitsInFloor ;
FLDword dwLogicalUnitsInPlatform ;
/*******************************************************************************/
/********************** Logical Sector Properties **************************/
/*******************************************************************************/
FLByte bSectorsInPage;
FLDword dwSectorsInUnit;
FLDword dwSectorsInLogicalUnit;
FLDword dwSectorsInChip ;
FLDword dwSectorsInBank;
FLDword dwSectorsInFloor;
/*******************************************************************************/
/********************** Matching Algorithm Vars *****************************/
/*******************************************************************************/
void *MatchingAlgVars ;
/*******************************************************************************/
/********************** Exported routines from MatchingAlg Struct *************/
/*******************************************************************************/
FLStatus (*isGoodBlock) (FLFlash *,FLDword,FLByte,FLBoolean *);
FLStatus (*asicSetInNormalMode) (FLFlash *) ;
void (*MATCH_init) (FLFlash *) ;
FLStatus (*MATCH_unitLogicalToPhysical) (FLFlash *,LogicUnitType,PhyUnitType *) ;
FLBoolean (*MATCH_searchPhyUnitInLOOKUP_Table) (FLFlash *,PhyUnitType,FLByte,FLByte,LogicUnitType *) ;
/*******************************************************************************/
/********************** LastOperation Properties **************************/
/*******************************************************************************/
/*******************************************************************************/
/********************** Misc. ************************/
/*******************************************************************************/
FLWord wFlags; /* bitwise: BIG_PAGE, SLOW_IO etc. */
FLByte FirstUsableBlock[MAX_FLOORS] ;
FLDword LastOperation ;
completeOpVarsStruct completeOpVars ;
LastOperationResults* LastOperationResultsPtr ;
FLByte bLastFloor;
FLByte bLastBBT_Page ;
MTDCallBackRoutine WriteCallBackRoutinePtr ;
void *WriteCallBackArgument ;
MTDCallBackRoutine EraseCallBackRoutinePtr ;
void *EraseCallBackArgument ;
SavedDOC_State_P SavedDOC_State_Ptr ;
FLWord wChipId;
FLByte bTimesRecovering ;
/*******************************************************************************/
} MTDVarsStruct ;
#define MTD_VARS ((MTDVarsStruct *) flashPtr->mtdVars)
#endif /* MTD_LOGICAL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -