⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tffs_api.h

📁 H3 M-system NAND flash driver in Linux OS, M-DOC driver
💻 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:   V:/PVCSDB/DiskOnChip/archives/Test for 7.x/src/H3/tffs_api.h-arc  $
 * 
 *    Rev 1.29   Sep 11 2006 13:45:28   yaniv.iarovici
 * Legal header added
 * 
 *    Rev 1.28   Aug 16 2006 09:57:50   Yaniv.Iarovici
 * Fix compilation error due to PVCS comment
 * 
 *    Rev 1.26   Aug 16 2006 08:48:40   Yaniv.Iarovici
 * Change OTP partition size to 256KB (#define TFFS_API_OTP_PART_SIZE 0x40000 -> 256KB).
 * 
 *    Rev 1.25   Aug 09 2006 17:26:50   Polina.Marimont
 * initial for DOC Driver 1.0
 * 
 *    Rev 1.24.1.0   Aug 08 2006 15:55:34   Polina.Marimont
 * DOC Driver 1.0 initial
 * 
 *    Rev 1.23   Jun 18 2006 13:09:16   Polina.Marimont
 * AutoDPD and DPD parameters storage moved to SA SDK
 * 
 *    Rev 1.22   Jun 14 2006 18:00:18   Polina.Marimont
 * structures definitions moved to this file
 * 
 *    Rev 1.21   May 18 2006 09:48:50   polina.marimont
 * 1. added function for autoDPD support
 * 2. actual partition number API changed
 * 
 *    Rev 1.20   Apr 11 2006 13:17:22   tal.heller
 * add DOCH_SECURE_DELETE_DATA_OFFSET define
 * 
 *    Rev 1.19   Mar 22 2006 17:35:46   DoronC
 * Bug fix - add signature to disk attributes in order to use only 
 * format made by TrueFFS 7.1 and not by host SDK.
 * Other format will force reformating of the media.
 * 
 *    Rev 1.18   Mar 15 2006 16:18:18   DoronC
 * Bug fix - normal IPL of 8KB window was wrong.
 * 
 *    Rev 1.17   Mar 15 2006 11:28:18   DoronC
 * Bug fix - IPL write was not working properly.
 * 
 *    Rev 1.16   Mar 14 2006 09:54:16   DoronC
 * Bug fix - IPL size was limited to 1KB when righting normal node 
 * IPL instead of 2KB
 * 
 *    Rev 1.15   Mar 02 2006 08:30:54   DoronC
 * Bug fix - IPL was not working since size should be in sectors.
 * 
 *    Rev 1.14   Feb 14 2006 10:50:02   DoronC
 * Remove large variables from stack. use one global buffer for 
 * all large buffers needs.
 */

/***********************************************************************************/
/*																				   */
/*	Header file for sdk_api module												   */ 
/*																				   */
/***********************************************************************************/

#ifndef _TFFS_API
#define _TFFS_API

FLStatus bdCallTFFSToDOCH(FLFunctionNo functionNo, IOreq FAR2 *ioreq);

#ifdef BDK_ACCESS
typedef struct {
    FLDword dwStartReadSector;
    FLDword dwCurrentReadByte;
    FLDword dwReadLength;
    FLDword dwStartWriteSector;
    FLDword dwCurrentWriteByte;
    FLDword dwWriteLength;
    FLByte bWriteSubPartitionNum;
} sBdkInitValues;
#endif /*BDK_ACCESS*/

typedef struct __DocHVolume
{
	FLMutex mutex;
	FLByte numOfBinaryPartitions;
	FLByte iplExists;
	FLByte otpExists;
	FLBoolean verifyWrite;
	FLByte *intermediateBuf;
	FLDword mountCount[DOCH_MAX_PARTITIONS];
#ifdef BDK_ACCESS
	sBdkInitValues bdkInitValues;
#endif /*BDK_ACCESS*/
	FLDword dwVirtualUnitSize;
	FLDword dwVirtualUnitSizeInSectors;
	FLDword dwNumOfUnits;
	FLDword dwUnformattedCapacity;

	FLDword dwPowerMode[FL_SOCKETS]; /* saves power modes */
}DocHVolume;

/* MACRO: TFFS_API_IS_DPD_ON - determines whether one of Auto DPD modes defined */
#define TFFS_API_IS_AUTO_DPD_ON(socket) ( ((gDpdSettings.activeMode & DOCH_WM_NORMAL_AND_AUTO_STBY) == DOCH_WM_NORMAL_AND_AUTO_STBY) || \
									 ((gDpdSettings.activeMode & DOCH_WM_LOW_FREQ_AND_AUTO_STBY) == DOCH_WM_LOW_FREQ_AND_AUTO_STBY) || \
									 ((gDpdSettings.inActiveMode & DOCH_IM_IDLE_2_DPD) == DOCH_IM_IDLE_2_DPD) )
/* MACRO: TFFS_API_SAVE_DPD_STATES(socket) - saves the power modes into global variable */
#define TFFS_API_SAVE_POWER_MODES(socket) dochVol.dwPowerMode[socket] = gDpdSettings.inActiveMode | gDpdSettings.activeMode;

/********************/
/*	Defines			*/
/********************/

#define DOCH_SECTORS_IN_UNIT_BITS       9
#define DOCH_SECTORS_IN_UNIT            (1<<DOCH_SECTORS_IN_UNIT_BITS)

#define TFFS_API_MIGRATION_SIGNATURE "Migration1"
#define TFFS_API_OTP_PART_SIZE	0x40000	/*256KB*/
#define TFFS_API_OTP_PART_SIZE_SECTORS (TFFS_API_OTP_PART_SIZE / DOCH_SECTOR_SIZE)

#define TFFS_API_128K_NORMAL_IPL_SIZE            0x40
#define TFFS_API_8K_NORMAL_IPL_SIZE              0x4
#define TFFS_API_VIRTUAL_RAM_8K_IPL_SIZE    0x10
#define TFFS_API_VIRTUAL_RAM_128K_IPL_SIZE  0x100
#define TFFS_API_PAGED_IPL_SIZE             0x200


/* Protection attributes  - backward compatibility	*/
#define PROTECTABLE           1   /* partition can receive 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         */

#define TFFS_PROTECTION_KEY_LENGTH	8


#define DOCH_IPL_PARTITION_NUM      0
#define TFFS_API_OTP_PARTITION_NUM  1

#define DOCH_MAX_USED_PARTITIONS    16

#define DOCH_SECURE_DELETE_DATA_OFFSET	8

/**********************/
/*	Exported routines */
/**********************/

FLStatus DochSetEnvVolume(FLEnvVars variableType ,
						  FLByte  socket,
						  FLByte  volume,
						  FLDword value,
						  FLDword FAR2 *prevValue);

FLStatus DochSetEnvSocket(FLEnvVars variableType ,
						  FLByte socket ,
						  FLDword value,
						  FLDword FAR2 *prevValue);

FLStatus DochSetEnvAll(FLEnvVars variableType , FLDword value, FLDword FAR2 *prevValue);

TFFS_DLL_API FLStatus NAMING_CONVENTION DochSetDocBusRoutine(FLByte  socket, FLAccessStruct FAR1 * structPtr);
TFFS_DLL_API FLStatus NAMING_CONVENTION DochGetDocBusRoutine(FLByte  socket, FLAccessStruct FAR1 * structPtr);

FLStatus actualPartitionNum(FLByte* partNum, FLByte partitionType, FLSDword sdwSocketNo);

FLStatus tffsApiSetAutoDpd( FLEnvVars envVarType, FLSDword dwsSocket, FLDword value,  FLDword FAR2 *prevValue );

FLStatus tffsApiInit(void);
FLStatus tffsApiExit(void);

#endif /*_TFFS_API*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -