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

📄 _dochapi.h

📁 H3 M-system NAND flash driver in Linux OS, M-DOC driver
💻 H
📖 第 1 页 / 共 5 页
字号:
typedef struct {
	FLWord wVersion;
	FLByte bReserved1[0x3E];
	FLByte bHostRandomChallangeByDochPrivateKey[DOCH_CHLNG_SIZE];
	FLByte bReserved2[0x40];
	FLByte bDochRandomChallange[DOCH_CHLNG_SIZE];
	FLByte bDochPublicKey[DOCH_PKI_KEY_SIZE];
	FLByte bReservedForLargerKey[0x80];
} DOCH_DochPublicKey;

/*Structure for DOCH_VSCMD_EXT_SECURITY_CTRL::DOCH_VERIFY_HOST_KEY*/
typedef struct {
	FLWord	wVersion;
	FLByte	bReserved1[0x3E];
	FLByte	bDochRandomChallangeByHostPrivateKey[DOCH_CHLNG_SIZE];
	FLByte	bReserved2[0x180];
} DOCH_VerifyHostKey;

/******************************************************************************/
/*
 *	Algorithm structures
 */
/******************************************************************************/

/*Supported algorithms retrieval structure*/
/*----------------------------------------*/
typedef struct {
	FLWord	wVersion;
	FLByte	bReserved1[0x2];
	FLDword	wSymmetricAlgorithmsSupported;		/*Bitmap: AES...*/
	FLDword	wAsymmetricAlgorithmsSupported;		/*Bitmap: RSA...*/
	FLDword	wHashSchemesSupported;				/*Bitmap: SHA-1...*/
	FLDword	wRNGSchemesSupported;				/*Bitmap: TrueRandom...*/
	FLDword	wDecompressionSchemesSupported;		/*Bitmap: LZ77...*/
	FLDword	wCompressionSchemesSupported;		/*Bitmap: LZ77...*/
	FLByte	bReserved2[0x1E4];
} DOCH_supportedAlgorithms;

/*Specific algorithm capabilities retrieval structure and sub-structures*/
/*----------------------------------------------------------------------*/
typedef struct {
	FLDword	dwSize;
	FLDword	dwCalcTime;	/*For the key, in nano*/
} KeyAttr;

typedef struct {
	FLByte	bName[8];		/*In ASCII*/
	FLWord	wKeySizes;		/*Bitmap of key sizes supported by this mode*/
	FLByte	bReserved[0x6];
} ModeAttr;

typedef struct {
	FLWord		wVersion;
	FLByte		bReserved1[0x2];
	FLByte		bAlgorithmName[0x10];	/*In ASCII*/
	FLWord		wNumOfKeySizesSupported;
	FLWord		wNumOfModesSupported;
	FLByte		bReserved2[0x8];
	KeyAttr		keysAttributes[0x8];
	ModeAttr	modesAttributes[0x18];
} DOCH_AlgorithmCapabilities;

/*Enums for HASH control*/
/*----------------------*/
typedef enum {
	DOCH_HASH_REINITIALIZE			= 0x00,
	DOCH_HASH_CONTINUE				= 0x01,
	DOCH_HASH_CONTINUE_ACCUM		= 0x00,
	DOCH_HASH_STOP_ACCUM			= 0x01,
	DOCH_HASH_DONT_RETURN_DATA		= 0x00,
	DOCH_HASH_RETURN_ACCUM_DIGEST	= 0x02
} DOCH_HashStartStream;

typedef enum {
	DOCH_HASH_DECRYPTION_KEY		= 0x00,
	DOCH_HASH_ENCRYPTION_KEY		= 0x01,

	/*For Decryption*/
	DOCH_HASH_USE_DOCH_PUBLIC_KEY		= 0x00,
	DOCH_HASH_USE_HOST_PUBLIC_KEY		= 0x01,
	DOCH_HASH_USE_PARTITION_PUBLIC_KEY	= 0x02,

	/*For Encryption*/
	DOCH_HASH_USE_DOCH_PRIVATE_KEY		= 0x00,
	DOCH_HASH_USE_HOST_PRIVATE_KEY		= 0x01
} DOCH_HashSetKey;

/********************/
/*	API Routines	*/
/********************/

/*----------------------------------------------------------------------*/
/*        f l D O C H S e t D e f a u l t P a r t i t i o n				*/
/*                                                                      */
/* Set default partition for Standard-ATA commands                      */
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                        Partition number (zero based)		            */
/*      irCount			: SET_DEFAULT_PARTITION_TEMP                    */
/*						  SET_DEFAULT_PARTITION_PERM                    */
/*																		*/
/* ATA command:															*/
/*			DOCH_VSCMD_PARTITION_MANAGEMENT								*/
/* ATA sub-command:														*/
/*			DOCH_SET_DEFAULT_PARTITION									*/
/*                                                                      */
/* Returns:                                                             */
/*        DOCH_Error      : 0 on success, otherwise failed              */
/*----------------------------------------------------------------------*/
#define flDOCHSetDefaultPartition(ioreq) bdCallDOCH(SDK_SET_DEFAULT_PARTITION, ioreq)

/*----------------------------------------------------------------------*/
/*         f l D O C H S e t D a t a T r a n s f e r M o d e			*/
/*                                                                      */
/* Set Data transfer mode						                        */
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*		irCount			: Requested data transfer mode:					*/
/*								DOCH_DATA_XFER_MODE_SINGLE				*/
/*								DOCH_DATA_XFER_MODE_MULT				*/
/*																		*/
/* ATA command:															*/
/*			DOCH_VSCMD_EXT_DEVICE_CTRL									*/
/* ATA sub-command:														*/
/*			DOCH_SET_DATA_XFER_MODE										*/
/*                                                                      */
/* Returns:                                                             */
/*        DOCH_Error        : 0 on success, otherwise failed            */
/*----------------------------------------------------------------------*/
#define flDOCHSetDataTransferMode(ioreq) bdCallDOCH(SDK_SET_DATA_XFER_MODE, ioreq)

/*----------------------------------------------------------------------*/
/*       f l D O C H I d e n t i f y D i s k O n C h i p D e v i c e	*/
/*                                                                      */
/* Returns general information about the Device							*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*      irCount         : DOCH_IDENTIFY_FROM_FLASH						*/
/*						  DOCH_IDENTIFY_EXISTANCE						*/
/*      irData          : Address of DOCH_DeviceInfo struct				*/
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_EXT_DEVICE_CTRL									*/
/* ATA sub-command:														*/
/*			DOCH_IDENTIFY_DISKONCHIP_DEVICE								*/
/*																		*/
/* Returns:                                                             */
/*        DOCH_Error        : 0 on success, otherwise failed            */
/*----------------------------------------------------------------------*/
#define flDOCHIdentifyDiskOnChipDevice(ioreq) bdCallDOCH(SDK_IDENTIFY_DISKONCHIP_DEVICE, ioreq)
#define DOCH_IDENTIFY_FROM_FLASH	0x0
#define DOCH_IDENTIFY_EXISTANCE		DRIVE_HEAD_OPT1


/*----------------------------------------------------------------------*/
/*          f l  D O C H G e t R e s e t S t a t u s					*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_EXT_DEVICE_CTRL									*/
/* ATA sub-command:														*/
/*			DOCH_GET_RESET_STATUS										*/
/*																		*/
/* Returns:                                                             */
/*        irCount	      : 0	=	No reset since last query			*/
/*							1	=	The device has been reset since last*/
/*									query								*/
/*        DOCH_Error      : 0 on success, otherwise failed              */
/*----------------------------------------------------------------------*/
#define flDOCHGetResetStatus(ioreq) bdCallDOCH(SDK_GET_RESET_STATUS, ioreq)

/*----------------------------------------------------------------------*/
/*           f l D O C H N o t i f y R e s e t							*/
/*																		*/
/*	Notify the Device on an upcoming reset initiated by the Host.		*/
/*	Host should NOT perform actual reset before this command completes	*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_EXT_DEVICE_CTRL									*/
/* ATA sub-command:														*/
/*			DOCH_NOTIFY_RESET											*/
/*																		*/
/* Returns:                                                             */
/*        DOCH_Error        : 0 on success, otherwise failed            */
/*----------------------------------------------------------------------*/
#define flDOCHNotifyReset(ioreq) bdCallDOCH(SDK_NOTIFY_RESET, ioreq)

/*----------------------------------------------------------------------*/
/*        f l D O C H N o t i f y P l a t f o r m R e s u m e d			*/
/*																		*/
/*	Notify the Device that there was a reset,							*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_EXT_DEVICE_CTRL									*/
/* ATA sub-command:														*/
/*			DOCH_NOTIFY_PLATFORM_RESUMED								*/
/*																		*/
/* Returns:                                                             */
/*        DOCH_Error        : 0 on success, otherwise failed            */
/*----------------------------------------------------------------------*/
#define flDOCHNotifyPlatformResumed(ioreq) bdCallDOCH(SDK_NOTIFY_PLATFORM_RESUMED, ioreq)

/*----------------------------------------------------------------------*/
/*             f l D O C H P a r t i t i o n I n f o					*/
/*                                                                      */
/* Get information about a specific partition.                          */
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                        Partition number (zero based)		            */
/*      irData			: Address of user buffer to read partition      */
/*                        information into.                             */
/* ATA command:															*/
/*			DOCH_VSCMD_PARTITION_MANAGEMENT								*/
/* ATA sub-command:														*/
/*			DOCH_GET_PARTITION_INFO										*/
/*                                                                      */
/* Returns:                                                             */
/*        DOCH_Error        : 0 on success, otherwise failed            */
/*----------------------------------------------------------------------*/
#define flDOCHPartitionInfo(ioreq) bdCallDOCH(SDK_GET_PARTITION_INFO, ioreq)

/*----------------------------------------------------------------------*/
/*            f l D O C H D e l e t e P a r t i t i o n s				*/
/*                                                                      */
/* Delete range of partitions											*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*		irFlags			: DOCH_NORMAL_OPERATION                         */
/*						  DOCH_IMMEDIATE_OPERATION						*/
/*      irCount         : First partition to delete                     */
/*      irLength        : Last partition to delete						*/
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_PARTITION_MANAGEMENT								*/
/* ATA sub-command:														*/
/*			DOCH_DELETE_PARTITIONS										*/
/*																		*/
/* Returns:                                                             */
/*        DOCH_Error  : 0 on success, otherwise failed                  */
/*----------------------------------------------------------------------*/
#define flDOCHDeletePartitions(ioreq) bdCallDOCH(SDK_DELETE_PARTITIONS, ioreq)

/*----------------------------------------------------------------------*/
/*					f l D O C H U n f o r m a t							*/
/*                                                                      */
/* Unformats DOCH device.												*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_PARTITION_MANAGEMENT								*/
/* ATA sub-command:														*/
/*			DOCH_DELETE_PARTITIONS										*/
/*			DOCH_SET_DISK_USER_ATTR										*/
/*																		*/
/* Returns:                                                             */
/*        DOCH_Error  : 0 on success, otherwise failed                  */
/*----------------------------------------------------------------------*/
#define flDOCHUnformatDevice(ioreq) bdCallDOCH(SDK_UNFORMAT_DEVICE, ioreq)

/*----------------------------------------------------------------------*/
/*	           f l D O C H A d d P a r t i t i o n						*/
/*                                                                      */
/* Adds a partition														*/
/* The new partition is created on existing un-formatted disk capacity	*/
/*                                                                      */
/* Parameters:                                                          */
/*      irHandle        : Socket number (zero based)                    */
/*                                                                      */
/* ATA command:															*/
/*			DOCH_VSCMD_PARTITION_MANAGEMENT								*/
/* ATA sub-command:														*/
/*			DOCH_ADD_PARTITION											*/
/*																		*/
/* Returns:                                                             */
/*        irCount	: Number of the created partition                   */
/*        DOCH_Error  : 0 on success, otherwise failed                  */
/*----------------------------------------------------------------------*/
#define flDOCHAddPartition(ioreq) bdCallDOCH(SDK_ADD_PARTITION, ioreq)

/*----------------------------------------------------------------------*/
/*	           f l D O C H W r i t e I P L								*/
/*                                                                      */
/* Writes IPL partition.												*/
/* Sets IPL mode and size.												*/
/*                                                                      */

⌨️ 快捷键说明

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