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

📄 wmrtypes.h

📁 6410BSP3
💻 H
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************/
/*                                                                           */
/* PROJECT : Rainbow	                                                     */
/* MODULE  : Whimory types definition heade file	                         */
/* NAME    : Whimory types definition                                        */
/* FILE    : WMRTypes.h		                                                 */
/* PURPOSE : Types definition for Whimory                                    */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        COPYRIGHT 2003-2005, SAMSUNG ELECTRONICS CO., LTD.                 */
/*                      ALL RIGHTS RESERVED                                  */
/*                                                                           */
/*   Permission is hereby granted to licensees of Samsung Electronics        */
/*   Co., Ltd. products to use or abstract this computer program for the     */
/*   sole purpose of implementing a product based on Samsung                 */
/*   Electronics Co., Ltd. products. No other rights to reproduce, use,      */
/*   or disseminate this computer program, whether in part or in whole,      */
/*   are granted.                                                            */
/*                                                                           */
/*   Samsung Electronics Co., Ltd. makes no representation or warranties     */
/*   with respect to the performance of this computer program, and           */
/*   specifically disclaims any responsibility for any damages,              */
/*   special or consequential, connected with the use of this program.       */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/* REVISION HISTORY                                                          */
/*                                                                           */
/*   12-JUL-2005 [Jaesung Jung] : first writing                              */
/*   01-JAN-2007 [Inhwan Choi ] : 4k page nand support                       */
/*                                                                           */
/*****************************************************************************/

#ifndef _WMR_TYPES_H_
#define _WMR_TYPES_H_

/*****************************************************************************/
/* Basic Types                                                               */
/*****************************************************************************/
#if !defined(WMR_NO_BASIC_TYPES)

typedef		unsigned int        	UINT32;
typedef		signed int          	INT32;
typedef		unsigned short      	UINT16;
typedef		signed short        	INT16;
typedef		unsigned char       	UINT8;
typedef		signed char         	INT8;

#endif /* WMR_NO_BASIC_TYPES */

#ifndef		VOID
typedef		void                	VOID;
#endif		//VOID
typedef		UINT32              	BOOL32;

/*****************************************************************************/
/* Basic Constants                                                           */
/*****************************************************************************/
#define		FALSE32					(BOOL32) 0
#define		TRUE32					(BOOL32) 1

/*****************************************************************************/
/* Global Definition which should be shared by FTL, VFL, FIL                 */
/*****************************************************************************/
/* [NAND Device Type]									*/
/* these constants are used for WMRDeviceI.nDeviceType	*/
#define		WMR_SLC				1		/* SLC device type					 */
#define		WMR_MLC				2		/* MLC device type					 */

#define		IS_SLC				(GET_DevType() == WMR_SLC)
#define		IS_MLC				(GET_DevType() == WMR_MLC)

/*  Sort of Paired Page Address Translation (MLC)	*/
/* #if (WMR_MLC_LSB_RECOVERY) */
#define		WMR_MLC_NO				0
#define		WMR_MLC_LSB_CLASS1		1
#define		WMR_MLC_LSB_CLASS2		2
/* #endif */

/* whimory version signature							*/
#define     WMR_SIGNATURE       (('2' << 24) | ('2' << 16) | ('0' << 8) | ('W' << 0))

/*****************************************************************************/
/* NAND SECTOR BITMAP shared by FTL, VFL, FIL   				             */
/*****************************************************************************/
/*
case 1. SECTORS_PER_PAGE == 4, TWO_PLANE_PROGRAM = FALSE32
		FULL_SECTOR_BITMAP_PAGE = 	0xF (1111)
		LEFT_SECTOR_BITMAP_PAGE = 	0xF (1111)
		RIGHT_SECTOR_BITMAP_PAGE = 	0x0 (0000)

case 2. SECTORS_PER_PAGE == 4, TWO_PLANE_PROGRAM = TRUE32
		FULL_SECTOR_BITMAP_PAGE = 	0xFF (1111 1111)
		LEFT_SECTOR_BITMAP_PAGE = 	0x0F (0000 1111)
		RIGHT_SECTOR_BITMAP_PAGE = 	0xF0 (1111 0000)

case 3. SECTORS_PER_PAGE == 8, TWO_PLANE_PROGRAM = FALSE32
		FULL_SECTOR_BITMAP_PAGE = 	0xFF (1111 1111)
		LEFT_SECTOR_BITMAP_PAGE = 	0xFF (1111 1111)
		RIGHT_SECTOR_BITMAP_PAGE = 	0x00 (0000 0000)

case 4. SECTORS_PER_PAGE == 8, TWO_PLANE_PROGRAM = TRUE32
	 	FULL_SECTOR_BITMAP_PAGE = 	0xFFFF (1111 1111 1111 1111)
		LEFT_SECTOR_BITMAP_PAGE = 	0x00FF (0000 0000 1111 1111)
		RIGHT_SECTOR_BITMAP_PAGE = 	0xFF00 (1111 1111 0000 0000)
*/

#define 	FULL_SECTOR_BITMAP_PAGE 	((1 << (SECTORS_PER_PAGE * (TWO_PLANE_PROGRAM + 1))) - 1)
/*
	in case 1: 	FULL_SECTOR_BITMAP_PAGE = 	((1 << (4 * (0 + 1)))-1) = 0xF
	in case 2: 	FULL_SECTOR_BITMAP_PAGE = 	((1 << (4 * (1 + 1)))-1) = 0xFF
	in case 3: 	FULL_SECTOR_BITMAP_PAGE = 	((1 << (8 * (0 + 1)))-1) = 0xFF	
	in case 4: 	FULL_SECTOR_BITMAP_PAGE = 	((1 << (8 * (1 + 1)))-1) = 0xFFFF	
*/

#define 	LEFT_SECTOR_BITMAP_PAGE	\
	((FULL_SECTOR_BITMAP_PAGE) & ((FULL_SECTOR_BITMAP_PAGE) \
	>> (((SECTORS_PER_PAGE / 2) * TWO_PLANE_PROGRAM) * (TWO_PLANE_PROGRAM + 1))))
/*
	in case 1: ((0xF) & ((0xF) >> (((4/2)*0) * (0 + 1))) = 0xF 
	in case 2: ((0xFF) & ((0xFF) >> (((4/2)*1) * (1 + 1))) = 0x0F
	in case 3: ((0xFF) & ((0xFF) >> (((8/2)*0) * (0 + 1))) = 0xFF
	in case 4: ((0xFFFF) & ((0xFFFF) >> (((8/2)*1) * (1 + 1))) = 0x00FF
*/

#define 	RIGHT_SECTOR_BITMAP_PAGE \
	((FULL_SECTOR_BITMAP_PAGE) & ((FULL_SECTOR_BITMAP_PAGE) \
	<< ((SECTORS_PER_PAGE / (1 + TWO_PLANE_PROGRAM)) * (TWO_PLANE_PROGRAM + 1))))
/*
	in case 1: ((0xF) & ((0xF) << (((4/(1+0))*0) * (0 + 1))) = 0x0 
	in case 2: ((0xFF) & ((0xFF) << (((4/(1+1))*1) * (1 + 1))) = 0xF0
	in case 3: ((0xFF) & ((0xFF) << (((8/(1+0))*0) * (0 + 1))) = 0x00
	in case 4: ((0xFFFF) & ((0xFFFF) << (((8/(1+1))*1) * (1 + 1))) = 0xFF00
*/

typedef enum
{
	enuNONE_PLANE_BITMAP		= 0x0,	/*	non plane  					*/	
	enuBOTH_PLANE_BITMAP		= 0x3,	/*	both plane  					*/	
	enuLEFT_PLANE_BITMAP		= 0x1,	/*	only left plane(one plane)  	*/
	enuRIGHT_PLANE_BITMAP	= 0x2	/*	only right plane     				*/	
} t_plane_bitmap;


/*****************************************************************************/
/* Divide & remnant operation definitions					                 */
/*****************************************************************************/
#if (!WMR_STDLIB_SUPPORT)
#define		DIV(x, y)			((x) >> (y))
#define		REM(x, y)			((x) & ((1 << (y)) - 1))
#endif


/*****************************************************************************/
/* Global variables	definitions (Sector size for System)		             */
/*****************************************************************************/
#define     OND_SECTOR_SHIFT            (2)			// 0 : sector=512B,  2 : sector=2KB,  3 : sector=4KB


/*****************************************************************************/
/* Return value MACRO definition                                             */
/*****************************************************************************/
#define		WMR_RETURN_MAJOR(err)			(INT32)((err) & 0xFFFF0000)
#define		WMR_RETURN_MINOR(err)			(INT32)((err) & 0x0000FFFF)
#define		WMR_RETURN_VALUE(err, maj, min)	(INT32)(((UINT32)((err) & 0x00000001) << 31) | \
											        ((UINT32)((maj) & 0x00007FFF) << 16) | \
											         (UINT32)((min) & 0x0000FFFF))



/*****************************************************************************/
/* Global Structure Types which should be shared by FTL, VFL, FIL            */
/*****************************************************************************/
typedef struct {

	UINT32	nDeviceType;				/* the type of device SLC [1], MLC [2]				 */
	UINT32	nAddrCycle;					/* device address cycle				 */
	UINT32	nSecPerPage;				/* the number of sectors per page	 */
	UINT32	nSecPerVPage;				/* the number of sectors per super page	 */
	BOOL32	b2XProgram;					/* 2plane program support			 	 */		
	BOOL32	b2XRead;					/* 2plane read support			 		 */				
	BOOL32	b2XReadStatus;					/* 2plane read status support			 */	
	UINT32	nPagesPerBlock;				/* the count of pages per block		 */
	UINT32	nSecPerVb;					/* the number of sectors per virtual block */
	UINT32	nPagesPerVb;				/* the count of pages per virtual block */
	UINT32	nPagesPerBank;				/* the count of pages per bank		 */
	UINT32	nPagesTotal;				/* the total number of pages		 */
	UINT32	nVbTotal;					/* the total number of virtual block */
	UINT32	nUserVbTotal;				/* the total number of data virtual block */
	UINT32	nUserSecTotal;				/* the total number of data sector   */

	UINT32	nBlocksPerBank;				/* the count of blocks per bank		 */

	UINT32	nBytesPerPage;				/* bytes per page (main)			 */
	UINT32	nBytesPerSpare;				/* bytes per spare					 */
	UINT32	nBytesPerVPage;				/* bytes per super page (main)			 */
	UINT32	nBytesPerVSpare;				/* bytes per super spare					 */

	#if (!WMR_STDLIB_SUPPORT)
	UINT32	nSecPerPageShift;
	UINT32	nSecPerVPageShift;
	UINT32	nSecPerVbShift;
	UINT32	nPagesPerBankShift;
	UINT32	nPagesPerBlockShift;
	UINT32	nPagesPerVbShift;

	UINT32	nBlocksPerBankShift;
	#endif

	#if (WMR_READ_RECLAIM)
	BOOL32	bReadErrFlag;
	#endif

	#if (WMR_MLC_LSB_RECOVERY)
	UINT32	nMLCLSBClass;				/* Sort of Paired Address Translation (MLC) */
	#endif

    UINT32  nFATSize;

⌨️ 快捷键说明

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