📄 defs.h
字号:
/******************************************************************************/
/* */
/* Copyright (C), 1995-2006, msystems Ltd. All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions are */
/* met: */
/* 1. Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the following disclaimer. */
/* 2. Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* 3. Neither the name of msystems nor the names of its contributors may be */
/* used to endorse or promote products derived from this software without */
/* specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/******************************************************************************/
/*
* $Log: V:/PVCSDB/DiskOnChip/archives/DocDriver/TrueFFS BD/src/defs.h-arc $
*
* Rev 1.2 Sep 11 2006 13:45:12 yaniv.iarovici
* Legal header added
*
* Rev 1.1 Aug 22 2006 13:22:40 Yaniv.Iarovici
* 1) Remove decleration fo 'void flInitGlobalVars(void)'
* 2) Add 'extern "c"' on:
* - flIdentifyFlash() external definition
* - flHandleConversionTable[] external definition
* - _flInit() definition
*
* Rev 1.0 Aug 08 2006 15:47:24 Polina.Marimont
* Initial revision.
*/
#ifndef _DEFS_H
#define _DEFS_H
/*=============================================================*/
/* from flsocket.h */
#include "flbuffer.h"
#define ATTRIBUTE_SPACE_MAPPED 0x8000
#define UNDEFINED_MAPPING 0x7fff
typedef enum {PowerOff, PowerGoingOff, PowerOn} PowerState;
extern FLByte noOfSockets; /* No. of drives actually registered */
/* The milliseconds counter is active when socket polling is enabled. When
the socket interval routine is called, the counter is incremented by
the interval in milliseconds.
The counter can be used to avoid getting in a loop that is not guaranteed
to terminate (such as waiting for a flash status register). Save the counter
at entry to the loop, and check in the loop the amount of time that
was spent in the loop. */
extern FLDword flMsecCounter;
typedef struct tSocket FLSocket;
/*=============================================================*/
/*=============================================================*/
/* from _flsoc.h */
struct tSocket {
unsigned volNo; /* Volume no. of socket */
PowerState DPDState; /* Actual DPD state */
#ifdef FL_VERIFY_WRITE
FLByte verifyWrite; /* VerifyWrite mode */
#endif /* FL_VERIFY_WRITE */
FLBoolean remapped; /* set to TRUE whenever the socket window is moved */
void (*powerOnCallback)(void *flash); /* Notification routine for Vcc on */
void * flash; /* Flash object for callback */
struct { /* Window state */
unsigned int baseAddress; /* Physical base as a 4K page */
unsigned int currentPage; /* Our current window page mapping */
void FAR0 * base; /* Pointer to window base */
FLSDword size; /* Window size (must by power of 2) */
unsigned speed; /* in nsec. */
unsigned busWidth; /* 8 or 16 bits */
} window;
FLBoolean (*cardDetected)(FLSocket * pVol);
void (*VccOn)(FLSocket * pVol);
void (*VccOff)(FLSocket * pVol);
FLStatus (*initSocket)(FLSocket * pVol);
void (*setWindow)(FLSocket * pVol);
void (*setMappingContext)(FLSocket * pVol, unsigned page);
FLBoolean (*getAndClearCardChangeIndicator)(FLSocket * pVol);
FLBoolean (*writeProtected)(FLSocket * pVol);
void (*updateSocketParams)(FLSocket * pVol, void FAR1 *params);
#ifdef FL_EXIT
void (*freeSocket)(FLSocket * pVol);
#endif
};
/* See interface documentation of functions in socket.c */
extern FLStatus updateSocketParameters(FLSocket *, void FAR1 *);
extern FLStatus flInitSockets(void);
#ifdef FL_EXIT
extern void flExitSocket(FLSocket *);
#endif
extern FLSocket* flSocketOf(unsigned volNo);
extern FLBuffer* flBufferOf(unsigned volNo);
#if (defined(FL_VERIFY_WRITE) || defined(VERIFY_VOLUME))
extern FLByte * flReadBackBufferOf(unsigned volNo);
#endif /* FL_VERIFY_WRITE || VERIFY_VOLUME */
extern void flNeedVcc(FLSocket *);
extern void flDontNeedVcc(FLSocket *);
#ifdef SOCKET_12_VOLTS
extern FLStatus flNeedVpp(FLSocket *);
extern void flDontNeedVpp(FLSocket *);
#endif
extern void flSocketSetBusy(FLSocket *, FLBoolean); /* entry/exit operations */
#ifndef FL_FIXED_MEDIA
extern FLStatus flMediaCheck(FLSocket *); /* check for media status change */
#endif /* FL_FIXED_MEDIA */
extern unsigned flGetMappingContext(FLSocket *); /* Currently mapped 4KB page */
extern void FAR0*flMap(FLSocket *, CardAddress); /* map and point at card address */
extern void flSetWindowBusWidth(FLSocket *, unsigned); /* set window data-path */
extern void flSetWindowSpeed(FLSocket *, unsigned); /* set window speed (nsec.) */
extern void flSetWindowSize(FLSocket *, unsigned); /* in 4KB units */
extern void flSetPowerOnCallback(FLSocket *, void (*)(void *), void *);
/* Set MTD notification for socket power on */
extern void flIntervalRoutine(FLSocket *); /* socket interval routine */
/*=============================================================*/
/*=============================================================*/
/* from flflash.h */
/* 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;
typedef FLByte Reg8bitType;
typedef FLWord Reg16bitType;
#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_H1_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 M1G_G4_TYPE 13
#define M512_P4_TYPE 14
#define H3_TYPE 15
#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 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_SA 2 /* Not used any more, done automatically by */
#define FL_IPL_MODE_XSCALE 4 /* Not used any more, done automatically by */
#define FL_IPL_READ_FROM_START 0
#define FL_IPL_DOWNLOAD_AND_READ 1
/* Bit 5 Quad Redundency of IPL mode */
#define FL_IPL_PAGE_QUAD_RED 32
/* smaller then IPL size */
/* OTP specific defintions */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -