bml.h

来自「SAMSUNG S3C6410 CPU BSP for winmobile6」· C头文件 代码 · 共 522 行 · 第 1/3 页

H
522
字号
/*****************************************************************************/
/*                                                                           */
/* PROJECT : AnyStore II                                                     */
/* MODULE  : XSR BML                                                         */
/* NAME    : BML header file                                                 */
/* FILE    : BML.h                                                           */
/* PURPOSE : This file contains the definition and protypes of exported      */
/*           functions for Block Management Layer.                           */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/*          COPYRIGHT 2003-2005 SAMSUNG ELECTRONICS CO., LTD.                */
/*                          ALL RIGHTS RESERVED                              */
/*                                                                           */
/*   Permission is hereby granted to licenses of Samsung Electronics         */
/*   Co., Ltd. products to use or abstract this computer program only in     */
/*   accordance with the terms of the NAND FLASH MEMORY SOFTWARE LICENSE     */
/*   AGREEMENT 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                                                          */
/*                                                                           */
/*   11-JUL-2003 [SongHo Yoon]: First writing                                */
/*   05-AUG-2003 [SongHo Yoon]: added nNumOfUsBlks into BMLVolSpec structure */
/*   16-AUG-2003 [SongHo Yoon]: replaced BML_ILLEGAL_ACCESS as               */
/*                              BML_INVALID_VOLUME                           */
/*   02-DEC-2003 [SongHo Yoon]: added parameter(nFlag) in BML_Format         */
/*   02-DEC-2003 [SongHo Yoon]: added BML_INIT_FORMAT/BML_REPARTITION        */
/*   04-DEC-2003 [SongHo Yoon]: changed members of XSRPartEntry structure    */
/*   13-DEC-2003 [SongHo Yoon]: added BML_IOCTL_XXX / BML_UNSUPPORTED_IOCTL  */
/*   13-DEC-2003 [SongHo Yoon]: changed return code                          */
/*                        BML_STORE_PEXTINFO_ERROR ==> BML_STORE_PIEXT_ERROR */
/*                        BML_LOAD_PEXTINFO_ERROR  ==> BML_LOAD_PIEXT_ERROR  */
/*   15-DEC-2003 [SongHo Yoon]: removed BML_ProtectROArea()                  */
/*   27-DEC-2003 [SongHo Yoon]: reorganization of BML return value           */
/*   08-JAN-2004 [SongHo Yoon]: added BML_PREV_OP_RESULT                     */
/*   13-JAN-2004 [SongHo Yoon]: added BML_FLAG_ECC_MASK / BML_FLAG_SYNC_MASK */
/*                                    BML_FLAG_GBBM_MASK                     */
/*   16-JAN-2004 [SongHo Yoon]: added BML_IOCTL_GET_FULL_PI                  */
/*   28-JAN-2004 [SongHo Yoon]: changed PARTITION_ID_FATFILESYSTEM to        */
/*                                       PARTITION_ID_FILESYSTEM             */
/*   02-FEB-2004 [SongHo Yoon]: removed BML_VOLUME_ALREADY_OPENED            */
/*                              added BML_DEVICE_ACCESS_ERROR                */
/*   12-FEB-2004 [SongHo Yoon]: changed BML_INIT_ALREADY_CALLED to           */
/*                                      BML_ALREADY_INITIALIZED              */
/*   17-FEB-2004 [SongHo Yoon]: added BML_ALREADY_OPENED                     */
/*   21-APR-2004 [SongHo Yoon]: added CopyArg structure                      */
/*                              added BML_Copy()                             */
/*   06-MAY-2004 [SongHo Yoon]: removed BML_GetPlaneNum()                    */
/*   07-SEP-2004 [Janghwan Kim] : changed type of OpTime variables of        */
/*                                BMLVolSpec structure (UINT16->UINT32)      */
/*   07-SEP-2004 [Janghwan Kim] : added BML_MEraseBlk()                      */
/*   10-SEP-2004 [Janghwan Kim] : added nEccPos in BMLVolSpec structure      */
/*   25-MAR-2005 [MinYoung Kim] : added definitions for Partition Entry ID   */
/*	 31-JAN-2005 [ByoungYoung Ahn]	: added BML_GetDevInfo()				 */
/*	 31-JAN-2006 [ByoungYoung Ahn] 	: added BML_IOCTL_SET_BLOCK_UNLOCK 		 */
/*   14-FEB-2006 [WooYoung Yang] : added BML_GetBBInfo()                     */
/*                                                                           */
/*****************************************************************************/

#ifndef _XSR_BML_H_
#define _XSR_BML_H_

#include <LLD.h>
/*****************************************************************************/
/* Common Constant definitions                                               */
/*****************************************************************************/
#define     BML_MAX_REQSEC                  (4)
#define     BML_MAX_PARTENTRY               ((512 - 16) / 16)
#define     BML_MAX_PART_SIG                (8)
#define		BML_MAX_ERL_PROCESS				(16)

/*****************************************************************************/
/* nFlag value of BML_ReadSector, BML_WriteSector,                           */
/*                BML_CopyBack, BML_EraseBlk                                 */
/*****************************************************************************/
#define     BML_FLAG_SYNC_MASK              (1 << 0)
#define     BML_FLAG_ASYNC_OP               (1 << 0)    /* Write/Erase/Copy  */
#define     BML_FLAG_SYNC_OP                (0 << 0)    /* Write/Erase/Copy  */
#define     BML_FLAG_SYNC_OP_INV            (~BML_FLAG_ASYNC_OP) 

#define     BML_FLAG_ECC_MASK               (1 << 1)
#define     BML_FLAG_ECC_ON                 (1 << 1)    /* Read/Write/Copy   */
#define     BML_FLAG_ECC_OFF                (0 << 1)    /* Read/Write/Copy   */
#define     BML_FLAG_ECC_OFF_INV            (~BML_FLAG_ECC_ON)

#define     BML_FLAG_BBM_MASK               (1 << 2)
#define     BML_FLAG_BBM_OFF                (1 << 2)    /* Read              */
#define     BML_FLAG_BBM_ON                 (0 << 2)    /* Read              */
#define     BML_FLAG_BBM_ON_INV             (~BML_FLAG_BBM_OFF)

/*****************************************************************************/
/* nFlag value of BML_FlushOp                                                */
/*****************************************************************************/
#define     BML_NORMAL_MODE                 (0 << 3)
#define     BML_EMERGENCY_MODE              (1 << 3)

/*****************************************************************************/
/* Return value of BML_XXX()                                                 */
/*****************************************************************************/
#define     BML_SUCCESS                     XSR_RETURN_VALUE(0, 0x0000, 0x0000)
#define     BML_CRITICAL_ERROR              XSR_RETURN_VALUE(1, 0x0001, 0x0000)
#define     BML_READ_ERROR                  XSR_RETURN_VALUE(1, 0x0002, 0x0000)
#define     BML_INVALID_DATA_ERROR          XSR_RETURN_VALUE(1, 0x0003, 0x0000)
#define     BML_ALREADY_OPENED              XSR_RETURN_VALUE(1, 0x0004, 0x0000)
#define     BML_WR_PROTECT_ERROR            XSR_RETURN_VALUE(1, 0x0005, 0x0000)
#define     BML_INVALID_PARAM               XSR_RETURN_VALUE(1, 0x0006, 0x0000)
#define     BML_NO_PIENTRY                  XSR_RETURN_VALUE(1, 0x0007, 0x0000)
#define     BML_STORE_PIEXT_ERROR           XSR_RETURN_VALUE(1, 0x0008, 0x0000)
#define     BML_MAKE_RSVR_ERROR             XSR_RETURN_VALUE(1, 0x0009, 0x0000)
#define     BML_DEVICE_ACCESS_ERROR         XSR_RETURN_VALUE(1, 0x000A, 0x0000)
#define     BML_UNFORMATTED                 XSR_RETURN_VALUE(1, 0x000B, 0x0000)
#define     BML_UNSUPPORTED_IOCTL           XSR_RETURN_VALUE(1, 0x000C, 0x0000)
#define     BML_CANT_LOCK_FOREVER           XSR_RETURN_VALUE(1, 0x000D, 0x0000)
#define     BML_CANT_UNLOCK_WHOLEAREA       XSR_RETURN_VALUE(1, 0x000E, 0x0000)
#define     BML_VOLUME_ALREADY_LOCKTIGHT    XSR_RETURN_VALUE(1, 0x000F, 0x0000)
#define     BML_CANT_CHANGE_PART_ATTR       XSR_RETURN_VALUE(1, 0x0010, 0x0000)
#define     BML_VOLUME_NOT_OPENED           XSR_RETURN_VALUE(1, 0x0011, 0x0000)
#define     BML_ALREADY_INITIALIZED         XSR_RETURN_VALUE(1, 0x0012, 0x0000)
#define     BML_ACQUIRE_SM_ERROR            XSR_RETURN_VALUE(1, 0x0013, 0x0000)
#define     BML_RELEASE_SM_ERROR            XSR_RETURN_VALUE(1, 0x0014, 0x0000)
#define     BML_OAM_ACCESS_ERROR            XSR_RETURN_VALUE(1, 0x0015, 0x0000)
#define     BML_PAM_ACCESS_ERROR            XSR_RETURN_VALUE(1, 0x0016, 0x0000)
#define     BML_CANT_LOCK_BLOCK             XSR_RETURN_VALUE(1, 0x0017, 0x0000)
#define		BML_ERASE_REFRESH_FAIL			XSR_RETURN_VALUE(1, 0x0018, 0x0000)
#define		BML_CANT_UNLOCK_BLOCK			XSR_RETURN_VALUE(1, 0x0019, 0x0000)
#define		BML_SKIP_ERASE_REFRESH			XSR_RETURN_VALUE(1, 0x001A, 0x0000)

/*****************************************************************************/
/* Minor Return value of BML_READ_ERROR and BML_INVALID_DATA_ERROR           */
/*****************************************************************************/
#define     BML_READ_ERROR_S0               XSR_RETURN_VALUE(0, 0x0000, 0x0002)
#define     BML_READ_ERROR_M0               XSR_RETURN_VALUE(0, 0x0000, 0x0008)
#define     BML_READ_ERROR_S1               XSR_RETURN_VALUE(0, 0x0000, 0x0020)
#define     BML_READ_ERROR_M1               XSR_RETURN_VALUE(0, 0x0000, 0x0080)
#define     BML_READ_ERROR_S2               XSR_RETURN_VALUE(0, 0x0000, 0x0200)
#define     BML_READ_ERROR_M2               XSR_RETURN_VALUE(0, 0x0000, 0x0800)
#define     BML_READ_ERROR_S3               XSR_RETURN_VALUE(0, 0x0000, 0x2000)
#define     BML_READ_ERROR_M3               XSR_RETURN_VALUE(0, 0x0000, 0x8000)

/* Previous Operation Flag */
/* BML_PREV_OP_RESULT is combined with BML_WR_PROTECT_ERROR, and means 
   Previous Operation Error of BML_WR_PROTECT_ERROR */
#define     BML_PREV_OP_RESULT              XSR_RETURN_VALUE(0, 0x0000, 0xF0F0)

/*****************************************************************************/
/* Partition Entry ID of BML_LoadPIEntry()                                   */
/* Partition Entry ID from 0 to 0x0FFFFFFF is reserved in BML                */
/* Following ID is the pre-defined value and User can use Partition Entry ID */
/* from PARTITION_USER_DEF_BASE                                              */
/*****************************************************************************/
#if 1
#define     PARTITION_ID_ONBL1              0  /* NAND bootloader stage 1    */
#define     PARTITION_ID_ONBL2              1  /* NAND bootloader stage 2    */
#define     PARTITION_ID_ONBL3              2  /* NAND bootloader stage 3    */
#define     PARTITION_ID_COPIEDOS           3  /* OS image copied from NAND 
                                                  flash memory to RAM        */
#define     PARTITION_ID_DEMANDONOS         4  /* OS image loaded on demand  */
#define     PARTITION_ID_FILESYSTEM         8  /* file system                */
#define     PARTITION_ID_FILESYSTEM1        9  /* file system 1              */

#define     PARTITION_ID_IPL                5  /* Initial Program Loader    */
#define     PARTITION_ID_EBOOT              6  /* Ethernet Bootloader       */
#define     PARTITION_ID_EBOOTCFG           7  /* Ethernet Bootloader       */

⌨️ 快捷键说明

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