📄 _flflash.h
字号:
/*
* $Log: V:/Flite/archives/TrueFFS5/Src/_flflash.h_V $
*
* Rev 1.2 May 14 2002 15:02:46 oris
* Moved the needed defintions for the Boot SDK (under MTD_STANDALONE compilation flag) from public header.
*
* Rev 1.1 03 May 2002 20:23:48 andreyk
* typedef FLFlash definition moved from _FLFLASH.H to FLFLASH.H
*
* Rev 1.0 May 02 2002 19:58:58 oris
* Initial revision.
*/
/***********************************************************************************
* *
* M-Systems Confidential *
* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2002 *
* 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 *
* *
***********************************************************************************/
#ifndef _FLFLASH_H
#define _FLFLASH_H
#ifdef MTD_STANDALONE
typedef struct tSocket FLSocket;
struct tSocket
{
unsigned volNo; /* Volume no. of socket */
void FAR0 * base; /* Pointer to window base */
Sdword size; /* Window size (must by power of 2) */
};
#if (defined (VERIFY_WRITE) || defined(VERIFY_ERASE) || defined(MTD_RECONSTRUCT_BBT))
extern byte globalReadBack[SOCKETS][READ_BACK_BUFFER_SIZE];
#endif /* VERIFY_WRITE */
extern FLSocket *flSocketOf(unsigned volNo);
extern FLBuffer globalMTDBuffer;
extern int doc_noOfMTDs;
/* Replacement for various TrueFFS typedefs */
typedef unsigned long CardAddress; /* Physical offset on card */
#endif /* MTD_STANDALONE */
/*----------------------------------------------------------------------*/
/* 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 {
FlashType type; /* Flash device type (JEDEC id) */
byte mediaType; /* see media types obove */
byte ppp; /* number of allowed PPP */
dword busAccessType; /* saves bus access type */
dword maxEraseCycles; /* erase cycles limit per erase block */
dword changeableProtectedAreas; /* areas capable of changing protection */
/* attribute with no danger of loosing */
/* the entire chip */
byte totalProtectedAreas; /* total number of protection arweas */
dword erasableBlockSize; /* Smallest physically erasable size */
/* (with interleaving taken into account) */
byte erasableBlockSizeBits;/* Bits representing the erasable block */
dword chipSize; /* chip size */
byte noOfFloors; /* no of controllers in array */
word pageSize; /* size of flash page in bytes */
word noOfChips; /* no of chips in array */
dword firstUsableBlock; /* Some devices may not use all of the media */
/* blocks. For example mdocplus can not use */
/* the first 3 blocks. */
Sword interleaving; /* chip interleaving (The interleaving is */
/* defined as the address difference between */
/* two consecutive bytes on a chip) */
word 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 */
/*----------------------------------------------------------------------*/
/* f l a s h . m a p */
/* */
/* MTD specific map routine */
/* */
/* The default routine maps by socket mapping, and is suitable for all */
/* NOR Flash. */
/* NAND or other type Flash should use map-through-copy emulation: Read */
/* a block of Flash to an internal buffer and return a pointer to that */
/* buffer. */
/* */
/* Parameters: */
/* vol : Pointer identifying drive */
/* address : Card address to map */
/* length : Length to map */
/* */
/* Returns: */
/* Pointer to required card address */
/*----------------------------------------------------------------------*/
void FAR0 * (*map)(FLFlash *, CardAddress, int);
/*----------------------------------------------------------------------*/
/* f l a s h . r e a d */
/* */
/* MTD specific Flash read routine */
/* */
/* The default routine reads by copying from a mapped window, and is */
/* suitable for all NOR Flash. */
/* */
/* Parameters: */
/* vol : Pointer identifying drive */
/* address : Card address to read */
/* buffer : Area to read into */
/* length : Length to read */
/* modes : See write mode flags definition above */
/* */
/*----------------------------------------------------------------------*/
FLStatus (*read)(FLFlash *, CardAddress, void FAR1 *, dword, word);
/*----------------------------------------------------------------------*/
/* f l a s h . w r i t e */
/* */
/* MTD specific Flash write routine */
/* */
/* The default routine returns a write-protect error. */
/* */
/* Parameters: */
/* vol : Pointer identifying drive */
/* address : Card address to write to */
/* buffer : Address of data to write */
/* length : Number of bytes to write */
/* modes : See write mode flags definition above */
/* */
/* Returns: */
/* FLStatus : 0 on success, failed otherwise */
/*----------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -