?? _flflash.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/include/_flflash.h-arc $
*
* Rev 1.4 Jan 27 2004 08:14:04 oris
* Changed comments
*
* Rev 1.3 Sep 01 2003 19:09:44 oris
* - changed MTDS definition to FL_MTDS
* - Added FLASH_EXTRA_BUFFER_SIZE definition
*
* Rev 1.2 Aug 10 2003 13:36:54 roneng
* FLASH_EXTRA_AREA_SIZE = 16
* FLASH_SECTOR_TOTAL_SIZE = 528
*
* Rev 1.1 Jun 16 2003 01:17:50 oris
* Added TFFS_DLL_API prefix.
*
* Rev 1.0 Apr 09 2003 12:16:02 OriS
* Initial revision.
*
*/
#ifndef _FLFLASH_H
#define _FLFLASH_H
#ifdef MTD_STANDALONE
/* The following definition are supposed to replace the TrueFFS socket layer */
typedef enum {PowerOff, PowerGoingOff, PowerOn} PowerState;
typedef struct tSocket FLSocket;
struct tSocket
{
unsigned volNo; /* Volume no. of socket */
PowerState DPDState; /* DPD mode */
struct { /* Window state */
unsigned int baseAddress; /* Physical base as a 4K page */
void FAR0 * base; /* Pointer to window base */
FLSDword size; /* Window size (must by power of 2) */
unsigned busWidth; /* 8 or 16 bits */
} window;
};
/* Replacement for various TrueFFS typedefs */
typedef FLDword CardAddress; /* Physical offset on card */
#else /* MTD_STANDALONE */
/* The address of this, if returned from map, denotes a data error */
extern FLStatus dataErrorObject;
#define dataErrorToken ((void FAR0 *) &dataErrorObject)
#endif /* MTD_STANDALONE */
typedef FLStatus (*MTDCallBackRoutine)(void *MyArguments);
typedef struct
{
FLDword OpFlags ;
FLStatus status ;
FLByte MaxBitErrors ; /* Write only */
FLByte VerifyWriteMode ; /* Write only */
FLDword bNoOfSectorsPassed ; /* Write only */
const FLByte FAR1 *writeMainBuf ;
} LastOperationResults ;
/*----------------------------------------------------------------------*/
/* MTD common paramete passing packet */
/* This structure contain the parameters that are passed for MTD */
/* private routines. In order to minimize parameter passed through the */
/* the stack and in order to boost performance, All MTD private */
/* routines recieve a single parameter for FLFlash structure. */
/* This structure is saved in FLFlash and passes all other needed */
/* parameters for all MTD routines. */
/*----------------------------------------------------------------------*/
typedef struct{
FLDword opFlags;
FLDword noOfSectors;
FLDword noOfSectorsPassed;
FLDword startSector;
FLDword freeSectorFound;
FLDword eraseCount;
FLDword partitionsFlags[FL_MAX_TL_PARTITIONS+1];
LastOperationResults* delayedStatus;
void* myargs;
MTDCallBackRoutine myRoutine;
FLByte FAR1* readMainBuf;
const FLByte FAR1* writeMainBuf;
FLByte FAR1 * extraBuf;
FLWord noOfUnits;
FLWord noOfUnitsPassed;
FLWord startUnit;
FLWord noOfUnitsArray[FL_MAX_TL_PARTITIONS+1];
FLWord noOfFirstUnitsArray[FL_MAX_TL_PARTITIONS+1];
FLWord partitionLogicalSize[FL_MAX_TL_PARTITIONS+1];
FLSDword unusedBlocks;
FLByte maxBitError;
FLByte verifyWriteMode;
FLByte noOfSkippedUnits;
FLByte activePartition;
FLByte noOfPartitions;
FLWord offset ;
FLWord length ;
}MTDArgumentPacket;
/* The following are flags for opFlags field - not all are supported */
#define MTD_DATA 0x00000001 /* Apply to main area of the sector */
#define MTD_EXTRA 0x00000002 /* Apply to extra area of the sector */
#define MTD_RAW_MODE 0x00000004 /* Use RAW flash access */
#define MTD_BCH 0x00000008
#define MTD_REL_MODE 0x00000010 /* Use the flash Reliable mode */
#define MTD_FAST_MODE 0x00000020 /* Use the flash FAST mode */
#define MTD_WRITE_OP 0x00000040 /* This is a write operation */
#define MTD_ERASE_OP 0x00000080 /* This is an erase operation */
#define MTD_SW_EDC 0x00000100 /* Add S/W EDC only */
#define MTD_NO_MATCHING 0x00000200 /* Do not match physical units into */
/* logical units */
#define MTD_NO_EDC 0x00000400 /* Disbale the EDC\ECC mechanism */
#define MTD_CHECK_RB 0x00000800 /* Pole the R/B of last operation */
#define MTD_DO_NOT_WAIT 0x00001000 /* Return without waiting for the */
/* flash to finish the operation */
#define MTD_ADD_ERASE_MARK 0x00010000 /* Place the erase mark after the */
/* erase operation */
#define MTD_ADD_ERASE_COUNT 0x00020000 /* Place the erase count after the */
/* erase operation */
#define MTD_532_BYTES 0x00040000 /* Page is 532 bytes instead of 528 */
/* The following are flags for the protection set routine */
#define DO_NOT_COMMIT_PROTECTION 0 /* The new values will take affect only after reset */
#define COMMIT_PROTECTION 1 /* The new values will take affect immediately */
#define MTD_ON_DPS_ONLY 2 /* The new protection will be placed only on the DPS */
/* The following values are for partitionFlags*/
#define MTD_SM 0 /* Use simple matching for partition*/
#define MTD_AM 1 /* Use advanced matching for partition*/
/* Miscelenious */
#define MAX_ERROR_BIT_PER_PAGE 4 /* Maximum allowed number of bit failures per page */
#define MAX_NUMBER_OF_PLANES 4 /* Maximum allowed number of planes */
#define FLASH_SECTOR_DATA_SIZE 512
#define FLASH_SECTOR_PAGEINFO_SIZE 7
#define FLASH_SECTOR_HM_SIZE 1
#define FLASH_SECTOR_BCH_SIZE 7
#define FLASH_SECTOR_DUMMY_SIZE 1
#define FLASH_EXTRA_BUFFER_SIZE (FLASH_SECTOR_PAGEINFO_SIZE + FLASH_SECTOR_DUMMY_SIZE)
#define FLASH_EXTRA_AREA_SIZE (FLASH_SECTOR_DUMMY_SIZE + FLASH_SECTOR_BCH_SIZE + FLASH_SECTOR_HM_SIZE + FLASH_SECTOR_PAGEINFO_SIZE) /* 16 */
#define FLASH_SECTOR_TOTAL_SIZE (FLASH_EXTRA_AREA_SIZE + FLASH_SECTOR_DATA_SIZE) /* 528 */
/*----------------------------------------------------------------------*/
/* Flash array identification structure */
/* */
/* This structure contains a description of the Flash array and */
/* routine pointers for the map, read, write & erase functions. */
/* */
/* The structure is initialized by the MTD that identifies the Flash */
/* array. */
/* On entry to an MTD, the Flash structure contains default routines */
/* for all operations. This routines are sufficient forread-only access */
/* to NOR Flash on a memory-mapped socket. The MTD should override the */
/* default routines with MTD specific ones when appropriate. */
/*----------------------------------------------------------------------*/
/* Flash array identification structure */
struct tFlash {
FLBoolean wasIdentified;
FlashType type; /* Flash device type (JEDEC id) */
FlashType subType;
FLByte flashTechnology; /* Flash technology properties */
/* FL_SUPPORT_MLC , FL_SUPPORT_RELIABLE */
/* FL_SUPPORT_FAST , FL_SUPPORT_NO_MATCHING */
FLByte mediaType; /* see media types obove */
FLDword busAccessType; /* saves bus access type */
FLDword maxEraseCycles; /* erase cycles limit per erase block */
FLByte changeableProtectedAreas; /* areas capable of changing protection */
/* attribute with no danger of loosing */
/* the entire chip */
FLByte totalProtectedAreas;/* total number of protection arweas */
FLByte if_cfg;
FLByte bBusType; /* Bus type */
FLDword mediaSize; /* chip size */
FLWord unitsInFirstFloor;
FLByte noOfFloors; /* no of controllers in array */
FLByte noOfChips; /* no of chips that the media contain. */
FLByte noOfBanks; /* no of banks that the media contain. */
FLSWord interleaving; /* chip interleaving (The interleaving is */
/* defined as the address difference between */
/* two consecutive bytes on a chip) */
FLByte noOfSectorsPerPage;/* Number of logical sectors in physical page*/
FLByte sharedSectors; /* Minimal number of sectors that can affect */
/* one another when written. */
FLByte noOfPlanes; /* Number of planes in the device. */ /* simultaniously. */
FLDword erasableBlockSize; /* Size of logical erasable unit */
FLDword erasableBlockSizeBits; /* Number of bits used to represent a logical*/
/* erasable unit size. */
FLDword dwIPLSize; /* Number of bytes of SRAM in the device. */
FLByte evenPagePPP; /* The maximum alowed PPP for even pages. */
FLByte oddPagePPP; /* The maximum alowed PPP for odd pages. */
FLDword averageRead; /* Average time for page read in microsec. */
FLDword averageWrite; /* Average time for page write in microsec. */
FLDword averageErase; /* Average time for page erase in microsec. */
FLByte maxBadPercentage; /* The flash vendor maximum bad blocks percentage*/
FLWord flags; /* Special capabilities & options Bits 0-7 */
/* may be used by FLite. Bits 8-15 are not */
/* used bt FLite and may beused by MTD's for */
/* MTD-specific purposes. */
void * mtdVars; /* Points to MTD private area for this socket.*/
/* This field, if used by the MTD, is */
/* initialized bythe MTD identification */
/* routine. */
FLSocket * socket; /* Socket of this drive. Note that 2 diffrent */
/* records are used. One for OSAK and the */
/* other forstandalone applications. */
NDOC2window win; /* DiskOnChip memory windows */
MTDArgumentPacket args; /* args passing for MTD private routines */
/*----------------------------------------------------------------------*/
/* f l a s h . m a p */
/* */
/* MTD specific map routine */
/* */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -