📄 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.5 Jan 27 2004 08:14:02 oris
* Changed comments
*
* Rev 1.4 Sep 01 2003 19:07:54 oris
* - Added new supported technologies definitions:
* FL_SUPPORT_WRITE_CACHE 0x10
* FL_2K_ADDRESS_SPACE 0x20
* FL_SUPPORT_SEQUENTIAL_READ 0x40
*
* Rev 1.3 Aug 10 2003 13:48:08 roneng
*
* The following definition were added to flashTechnology Types
* - FL_SUPPORT_WRITE_CACHE
* - FL_2K_ADDRESS_SPACE
* - FL_SUPPORT_SEQUENTIAL_READ
*
*
* Rev 1.2 Jun 16 2003 01:18:18 oris
* Added TFFS_DLL_API prefix.
*
* Rev 1.1 Jun 05 2003 03:11:58 oris
* Bug fix - wrong FAR level qualifier in access layer routines.
*
* Rev 1.0 Apr 09 2003 12:15:58 OriS
* Initial revision.
*
*/
#ifndef FLFLASH_H
#define FLFLASH_H
#include "flbase.h"
#ifndef MTD_STANDALONE
#include "flsocket.h"
#else
#include "flbuffer.h"
#endif /* MTD_STANDALONE */
/* Some useful types for mapped Flash locations */
typedef volatile FLByte FAR0 * FlashPTR;
typedef volatile unsigned short int FAR0 * FlashWPTR;
typedef volatile FLDword FAR0 * FlashDPTR;
typedef FLWord FlashType; /* JEDEC id */
typedef volatile FLByte FAR0* NDOC2window;
/* DiskOnChip memory access routines type defintions */
/* Doc memory read routine */
typedef void (FAR1 FLMemRead)(volatile FLByte FAR1* win,FLWord regOffset,FLByte FAR1* dest,FLWord count);
/* Doc memory write routine */
typedef void (FAR1 FLMemWrite)(volatile FLByte FAR1* win,FLWord regOffset,FLByte FAR1* src,FLWord count);
/* Doc memory set routine */
typedef void (FAR1 FLMemSet)(volatile FLByte FAR1* win,FLWord regOffset,FLWord count, FLByte val);
/* Doc memory 8 bit read routine */
typedef FLByte (FAR1 FLMemRead8bit)(volatile FLByte FAR1* win,FLWord offset);
/* Doc memory 8 bit write routine */
typedef void (FAR1 FLMemWrite8bit)(volatile FLByte FAR1* win,FLWord offset,FLByte Data);
/* Doc memory 16 bit read routine */
typedef FLWord (FAR1 FLMemRead16bit)(volatile FLByte FAR1* win,FLWord offset);
/* Doc memory 16 bit write routine */
typedef void (FAR1 FLMemWrite16bit)(volatile FLByte FAR1* win,FLWord offset,FLWord Data);
/* Doc memory window size */
typedef FLDword (FAR1 FLMemWindowSize)(void);
/* Interleave change event Call back routine */
typedef FLStatus (FAR1 FLMemSetGetMode)(FLByte interleave, FLByte socketNo , FLDword flag);
typedef struct { /* DiskOnChip memory access routines */
FLDword access; /* Output only */
FLMemRead * memRead;
FLMemWrite * memWrite;
FLMemSet * memSet;
FLMemRead8bit * memRead8bit;
FLMemWrite8bit * memWrite8bit;
FLMemRead16bit * memRead16bit;
FLMemWrite16bit * memWrite16bit;
FLMemWindowSize * memWindowSize;
FLMemSetGetMode * memSetGetMode;
}FLAccessStruct;
#define NOT_FLASH 0
/* Media types */
#define NOT_DOC_TYPE 0
#define DOC_TYPE 1
#define MDOC_TYPE 2
#define DOC2000TSOP_TYPE 3
#define MDOCP_TYPE 4
#define MDOCP_16_TYPE 5
#define DOC_OREN_TYPE 6
#define M512_G3_TYPE 7
#define M256_P3_TYPE 8
#define M256_G3_TYPE 9
#define M128_P3_TYPE 10
#define M1G_G3_TYPE 11
#define M512_P3_TYPE 12
#define AMD_NOR_TYPE 100
#define SEIJA_TYPE 200
/* page characteristics flags */
#define BIG_PAGE 0x0100 /* page size > 100H*/
#define FULL_PAGE 0x0200 /* no partial page programming*/
#define BIG_ADDR 0x0400 /* 4 byte address cycle */
/* MTD write routine mode flags */
#define FL_DATA 0 /* Read/Write data area */
#define OVERWRITE 1 /* Overwriting non-erased area */
#define EDC 2 /* Activate ECC/EDC */
#define EXTRA 4 /* Read/write spare area */
#define DELETE_FLAG 0x20 /* Write sector with delete mark on sector flags*/
#define NO_SECOND_TRY 0x8000 /* do not read again on EDC error */
#define TRANSACTION_BITS 0x0F00 /* bits that are saved for transaction no' */
/* Protection attributes */
#define PROTECTABLE 1 /* partition can recieve protection */
#define READ_PROTECTED 2 /* partition is read protected */
#define WRITE_PROTECTED 4 /* partition is write protected */
#define LOCK_ENABLED 8 /* HW lock signal is enabled */
#define LOCK_ASSERTED 16 /* HW lock signal is asserted */
#define KEY_INSERTED 32 /* key is inserted (not currently */
#define CHANGEABLE_PROTECTION 64 /* changeable protection area type */
#define OTW_PROTECTED 128 /* partition is locked forever */
#define STICKY_LOCK_ASSERTED 256 /* Sticky lock is activated */
/* protection specific defintions */
#define PROTECTION_KEY_LENGTH 8 /* Size of protection key in bytes */
#define MAX_PROTECTED_PARTITIONS 2 /* Max Number of protected partitiosn */
#define DEFAULT_KEY "00000000"
/* IPL modes */
#define FL_IPL_MODE_NORMAL 0 /* IPL - Written as usual */
#define FL_IPL_DOWNLOAD 1 /* IPL - Force download of new IPL */
#define FL_IPL_MODE_SA 2 /* IPL - Written with Strong Arm mode enabled */
#define FL_IPL_MODE_XSCALE 4 /* IPL - Written with X-Scale mode enabled */
/* OTP specific defintions */
#define CUSTOMER_ID_LEN 4
#define UNIQUE_ID_LEN 16
/* BBT block types */
#define BBT_GOOD_UNIT 0xff
#define BBT_UNAVAIL_UNIT 0x1
#define BBT_BAD_UNIT 0x0
/* General purpose */
#define MAX_SECTORS_PER_BLOCK 64
/* Flag bit values */
#define SUSPEND_FOR_WRITE 1 /* MTD provides suspend for write */
#define NFTL_ENABLED 2 /* Flash can run NFTL */
#define INFTL_ENABLED 4 /* Flash can run INFTL */
#define EXTERNAL_EPROM 8 /* Can support external eprom */
#define SAFTL_ENABLED 0x10 /* Flash can run SAFTL */
/* Flash Technology types */
#define FL_SUPPORT_MLC 0x01
#define FL_SUPPORT_RELIABLE 0x02
#define FL_SUPPORT_FAST 0x04
#define FL_SUPPORT_NO_MATCHING 0x08
#define FL_SUPPORT_WRITE_CACHE 0x10
#define FL_2K_ADDRESS_SPACE 0x20
#define FL_SUPPORT_SEQUENTIAL_READ 0x40
/* Bus types */
#define FL_SRAM_MODE 0 /* Data bus and Address bus are diffrent buses */
#define FL_MUX_MODE 1 /* Data and Address buses are multiplexed on the same bus */
#define FL_LPC_MODE 2 /* Data and Address buses are both using the LPC bus */
#define FL_ICP_MODE 3
/* Miscelenios definitions for the API */
#define LOCKED_OTP 1
#define DEEP_POWER_DOWN 1 /* must be the same as in blockdev.h */
#define EXIT_DEEP_POWER_DOWN 0 /* must be the same as in blockdev.h */
/* Debuging flags */
#define DEBUG_ERASE_OPERATION 0 /* Erase operation type for informOfOperation routine */
#define DEBUG_WRITE_OPERATION 1 /* Write operation type for informOfOperation routine */
#define DEBUG_READ_OPERATION 2 /* Read operation type for informOfOperation routine */
/* MTD registration information */
extern int noOfMTDs; /* No. of MTDs actually registered */
/* Flash array identification structure */
typedef struct tFlash FLFlash; /* Forward definition */
#ifndef FL_NO_USE_FUNC
/*----------------------------------------------------------------------*/
/* f l S e t D o c B u s R o u t i n e */
/* */
/* Set user defined memory acces routines for DiskOnChip. */
/* */
/* Parameters: */
/* socket : Socket number to install routine for. */
/* structPtr : Pointer to function structure. */
/* */
/* Returns: */
/* FLStatus : 0 on success, otherwise failed */
/*----------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
TFFS_DLL_API FLStatus NAMING_CONVENTION flSetDocBusRoutine(FLByte socket, FLAccessStruct FAR1 * structPtr);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*----------------------------------------------------------------------*/
/* f l G e t D o c B u s R o u t i n e */
/* */
/* Get currently installed memory access routines for DiskOnChip. */
/* */
/* Parameters: */
/* socket : Socket number to install routine for. */
/* structPtr : Pointer to function structure. */
/* */
/* Returns: */
/* FLStatus : 0 on success, otherwise failed */
/*----------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
TFFS_DLL_API FLStatus NAMING_CONVENTION flGetDocBusRoutine(FLByte socket, FLAccessStruct FAR1 * structPtr);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* FL_NO_USE_FUNC */
#include "_flflash.h"
#endif /* FLFLASH_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -