📄 flbase.h
字号:
/****************************************************************************** * * * Project: DOC Driver for Linux 2.4 Block device driver for mDOC H3 family * * of devices under Linux kernel 2.4. * * * * Version: 1.0 * * Email questions to: oemsupport@sandisk.com * * Copyright (C) SanDisk IL Ltd. 1995 - 2007 * * SanDisk IL Ltd., 7 Atir Yeda Street, Kfar Saba 44425, Israel * * * ****************************************************************************** * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the Free * * Software Foundation; either version 2 of the License, or any later version.* * This program is distributed in the hope that it will be useful, but WITHOUT* * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * * more details, which is set forth in the readme.txt file. * * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., 51 * * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * * * This License does not grant you any right to use the trademarks, service * * marks or logos of SanDisk IL Ltd. or SanDisk Corporation. * * Subject to the foregoing, SanDisk IL Ltd., for itself and on behalf of its * * licensors, hereby reserves all intellectual property rights in the program,* * except for the rights expressly granted in this License. * * * ******************************************************************************//*
* $Log:
*/
#ifndef FLBASE_H
#define FLBASE_H
#include "flcustom.h"
#include "flsystem.h"
#include "flsystyp.h"
#include "flchkdef.h"
#include "flcommon.h"
#ifndef MTD_STANDALONE
#include "flsysfun.h"
#endif /* MTD_STANDALONE */
/* Number of floors supported by the S/W
*
* Define Maximum Number of floors in a physical device
*
* The actual number of floors depends on the physical device placed
* on the socket.
*/
#define FL_MAX_NO_OF_FLOORS 4
/* General purpose macros */
#define BYTE_ADD_FAR(x,y) ((FLByte FAR1 *)addToFarPointer((FLByte FAR1 *)x,y))
#define WORD_ADD_FAR(x,y) ((FLWord FAR1 *)addToFarPointer((FLByte FAR1 *)x,y))
#define DWORD_ADD_FAR(x,y) ((FLDword FAR1 *)addToFarPointer((FLByte FAR1 *)x,y))
#define SBYTE_ADD_FAR(x,y) ((FLSByte FAR1 *)addToFarPointer((FLByte FAR1 *)x,y))
#define SWORD_ADD_FAR(x,y) ((FLSWord FAR1 *)addToFarPointer((FLByte FAR1 *)x,y))
#define SDWORD_ADD_FAR(x,y) ((FLSDword FAR1 *)addToFarPointer((FLByte FAR1 *)x,y))
/* Drive handle masks */
#define FL_GET_LOGICAL_PARTITION_FROM_HANDLE(ioreq) (FLByte)(((ioreq)->irHandle & 0xf00) >> 8)
#define FL_GET_DISK_HANDLE_FROM_S_P_LP(s,p, lp) ((s) | ((p) << 4) | ((FLHandle)(lp) << 8))
#define FL_SOCKET_AND_FLASH_PARTITION_BITS 0xFF
#define FL_DO_NOT_UPDATE_MBR (1 << 14) /* used by formatFS only */
#define INVALID_VOLUME_NUMBER 0xff
#define TL_SIGNATURE 6
#define FL_SECTOR_MASK (FL_SECTOR_SIZE - 1)
#define BITS_PER_BITE 8
/* General purpose macros adjusted according to the above customization files. */
/* Call a procedure returning status and fail if it fails. This works only in */
/* routines that return Status: */
#define checkStatus(exp) { FLStatus fl__status = (exp);if (fl__status != flOK) return fl__status; }
#define updateStatus(cur__stat, exp) { FLStatus fl__status = (exp);if (cur__stat == flOK) cur__stat = fl__status; }
#define TFFSMIN(a,b) (((a)>(b)) ? (b):(a))
#define TFFSMAX(a,b) (((a)<(b)) ? (b):(a))
/***************************************************************************/
/* Big \ Little endien architecture conversion macros. */
/***************************************************************************/
#ifndef FL_NO_PACKED_STRUCTS_SUPPORTED
#define COPY2(to,arg) *((FLWord *)(&to)) = *((FLWord *)(&arg))
#define COPY4(to,arg) *((FLDword *)(&to)) = *((FLDword *)(&arg))
#else
#define COPY2(to, offs, arg) FL_REF_2(to, offs) = FL_REF_2(arg, offs)
#define COPY4(to, offs, arg) FL_REF_4(to, offs) = FL_REF_4(arg, offs)
#endif /* FL_NO_PACKED_STRUCTS_SUPPORTED */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define UNAL2(arg) fromUNAL(arg)
#define toUNAL2(to,arg) toUNAL(to,arg)
#define UNAL4(arg) fromUNALLONG((FLByte const FAR0 *)(arg))
#define toUNAL4(to,arg) toUNALLONG((FLByte FAR0 *)to,arg)
/* for both LE and BE */
#define FL_GET_UNAL2(arg, offs) fromUNAL(((FLByte *)(arg)) + (offs))
#define FL_SET_UNAL2(to, offs, arg) toUNAL(((FLByte *)(to)) + (offs), (arg))
#define FL_GET_UNAL4(arg, offs) fromUNALLONG(((FLByte *)(arg)) + (offs))
#define FL_SET_UNAL4(to, offs, arg) toUNALLONG(((FLByte *)(to)) + (offs), (arg))
typedef LEulong LEmin;
/*************************************************/
/* Use routines instead of 'c' standard librarys */
/*************************************************/
#ifdef FL_VERIFY_WRITE
extern FLByte flVerifyWrite[FL_SOCKETS][FL_MAX_TL_PARTITIONS<<1];
#endif /* FL_VERIFY_WRITE */
/**********************************************/
/* Declare the TrueFFS environment variables */
/**********************************************/
#ifdef FL_NO_USE_FUNC
/* The code bellow allows you to customize your own routine for multi bytes */
/* transfers. Once FL_NO_USE_FUNC is defined, you can define the multi byte */
/* macros to these routines, and code them yourself in flsystem.c */
extern void FAR1 fl16bitDocReadNoShift (volatile FLByte FAR0 * win, FLWord offset, FLByte FAR1 * dest, FLWord count );
extern void FAR1 fl16bitDocWriteNoShift ( volatile FLByte FAR0 * win , FLWord offset , FLByte FAR1 * src, FLWord count );
#endif /* FL_NO_USE_FUNC */
#ifdef FL_ENVIRONMENT_VARS
extern void flSetEnvVar(void);
/**********************************************/
/* Declare the TrueFFS environment variables */
/**********************************************/
extern FLByte flDimageCfg;
#ifndef MTD_STANDALONE
extern FLByte flUseMultiDoc;
extern FLByte flMTLdefragMode;
extern FLByte flMaxUnitChain;
#ifdef FL_TFFS_OLD_ENV_VARS
extern FLByte flMarkDeleteOnFlash;
extern FLByte flPolicy[FL_SOCKETS][FL_MAX_TL_PARTITIONS];
#endif /* FL_TFFS_OLD_ENV_VARS */
extern FLWord flCacheSize[FL_SOCKETS][FL_MAX_TL_PARTITIONS];
extern FLByte flSkipStaticFilesWearLeveling[FL_SOCKETS][FL_MAX_TL_PARTITIONS];
extern FLByte flSuspendMode[FL_SOCKETS];
extern FLDword flTFFSBDDebugMode[FL_SOCKETS][FL_MAX_TL_PARTITIONS];
#ifdef FL_BD_AUTO_DPD_MODE
extern FLDword flBDAutoDPDMode[FL_SOCKETS];
#endif /* FL_BD_AUTO_DPD_MODE */
#endif /* MTD_STANDALONE */
/* Policies definitions (FL_SET_POLICY) */
#define FL_DEFAULT_POLICY 0
#define FL_COMPLETE_ASAP 1
#define FL_SECURED_DELETE 2
/* Mtl policies definitions (FL_MTL_POLICY) */
#define FL_MTL_DEFRAGMENT_ALL_DEVICES 0
#define FL_MTL_DEFRAGMENT_SEQUANTIAL 1
/* Suspend mode other then FL_OFF */
#define FL_SUSPEND_WRITE 1
#define FL_SUSPEND_IO 3
#define FL_IGNORE_WRITE 4
#define FL_IGNORE_ERASE 8
#define FL_PREVENT_IO (FL_IGNORE_ERASE | FL_IGNORE_WRITE | FL_SUSPEND_IO | FL_SUSPEND_WRITE)
/* Runtime replacement for compilation flags */
#define FL_DIMAGE 0x01
#define FL_PUTIMAGE 0x02
#define FL_PUTIMAGE_PARALLEL 0x04
#define FL_DIMAGE_ALL (FL_DIMAGE | FL_PUTIMAGE | FL_PUTIMAGE_PARALLEL)
/* Cache full media */
#define FL_MAX_ALLOWED_TL_CACHE_SIZE 0xFFF
#ifndef FL_DEFAULT_POLICY_MODE
#define FL_DEFAULT_POLICY_MODE(socket,partition) FL_OFF
#endif /* FL_DEFAULT_POLICY_MODE */
#ifndef FL_DEFAULT_BD_DPD_MODE
#define FL_DEFAULT_BD_DPD_MODE(socket) FL_OFF
#endif /* FL_DEFAULT_BD_DPD_MODE */
#ifndef FL_DEFAULT_BD_SUSPEND_MODE
#define FL_DEFAULT_BD_SUSPEND_MODE(socket) FL_OFF
#endif /* FL_DEFAULT_BD_SUSPEND_MODE */
#ifndef FL_DEFAULT_BD_DEBUG_MODE
#define FL_DEFAULT_BD_DEBUG_MODE(socket,partition) FL_OFF
#endif /* FL_DEFAULT_BD_DEBUG_MODE */
/* Either per partition or for all (backward compatible) */
#ifndef FL_DEFAULT_CACHE_SIZE_FOR_MINIMAL_CACHE
#define FL_DEFAULT_CACHE_SIZE_FOR_MINIMAL_CACHE 0x40
#endif /* FL_DEFAULT_CACHE_SIZE_FOR_MINIMAL_CACHE */
#ifndef FL_DEFAULT_TL_CACHE_SIZE
#define FL_DEFAULT_TL_CACHE_SIZE(socket,partition) FL_DEFAULT_CACHE_SIZE_FOR_MINIMAL_CACHE
#endif /* FL_DEFAULT_TL_CACHE_SIZE */
#ifndef FL_DEFAULT_WEARLEVELING_MODE
#define FL_DEFAULT_WEARLEVELING_MODE(socket,partition) FL_OFF
#endif /* FL_DEFAULT_WEARLEVELING_MODE */
#ifndef FL_DEFAULT_VERIFY_WRITE_MODE
#define FL_DEFAULT_VERIFY_WRITE_MODE(socket,partition) FL_OFF
#endif /* FL_DEFAULT_VERIFY_WRITE_MODE */
#ifndef FL_DEFAULT_TOOLS_MODE
#define FL_DEFAULT_TOOLS_MODE FL_OFF
#endif /* FL_DEFAULT_TOOLS_MODE */
#endif /* FL_ENVIRONMENT_VARS */
/* Set default to bus configuration (unless specified differently in flsystem.h */
#ifndef FL_DEFAULT_BUS_CONFIGURATION
#if (!defined(CHARSIZE) || (CHARSIZE != 16))
#define FL_DEFAULT_BUS_CONFIGURATION (FL_NO_ADDR_SHIFT | FL_BUS_HAS_8BIT_ACCESS | \
FL_BUS_HAS_16BIT_ACCESS | FL_BUS_HAS_32BIT_ACCESS)
#else
#define FL_DEFAULT_BUS_CONFIGURATION (FL_NO_ADDR_SHIFT | FL_BUS_HAS_16BIT_ACCESS)
#endif /* CHARSIZE */
#endif /* FL_DEFAULT_BUS_CONFIGURATION */
#ifndef FL_DEFAULT_BUS_MODE
#define FL_DEFAULT_BUS_MODE(socket) FL_DEFAULT_BUS_CONFIGURATION
#endif /* FL_DEFAULT_BUS_MODE */
#endif /* FLBASE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -