bml.h

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

H
522
字号
                                                    7,                      \
                                                    XSR_METHOD_IN_DIRECT,   \
                                                    XSR_READ_ACCESS)

/* added for XSR v1.5.x */
/*****************************************************************************/
/*  UINT32  nSbn;                                                            */
/*  UINT32  nBlks;                                                           */
/*  UINT32  nRet;                                                            */
/*  UINT32  nVol;                                                            */
/*  UINT8  *pBufIn;                                                          */
/*                                                                           */
/*  nVol      = 0;                                                           */
/*  nDevIdx   = 0;                                                           */
/*                                                                           */
/*  *(UINT32*)pBufIn = nSbn;                                                 */
/*  *((UINT32*)(pBufIn + 4)) = nBlks;                                        */
/*                                                                           */
/*  BML_IOCtl(nVol, BML_IOCTL_SET_BLOCK_LOCK, pBufIn, 0,                     */
/*                                              NULL, 0, &nRet)              */
/*****************************************************************************/
#define     BML_IOCTL_SET_BLOCK_LOCK        XSR_IOCTL_CODE(XSR_MODULE_BML,  \
                                                    8,                      \
                                                    XSR_METHOD_BUFFERED,    \
                                                    XSR_WRITE_ACCESS)
                                                                                                        
/*****************************************************************************/
/* device specification structure in Volume                                  */
/*****************************************************************************/
typedef struct {
    UINT16       nPgsPerBlk;    /* the number of pages per block             */
    UINT8        nSctsPerPg;    /* the number of sectors per page            */
    UINT8        nLsnPos;       /* offset for storing LSN in spare area      */

    UINT8        nEccPos;       /* offset for storing ECC value in spare area*/
    UINT8        nReserved8;    /* Reserved                                  */
    UINT16       nReserved16;   /* Reserved                                  */

    UINT32       nTrTime;       /* read-time of NAND device (unit: nsec)     */
    UINT32       nTwTime;       /* write-time of NAND device (unit : nsec)   */
    UINT32       nTeTime;       /* erase-time of NAND device (unit : nsec)   */
    UINT32       nTfTime;       /* transfer-time from NAND device to host    
                                   memory (unit : nsec)                      */

    UINT32       nNumOfUsBlks;  /* the number of usable blocks in the volume */
    BOOL32       bMErasePol;    /* MErase Policy                             */

    UINT32       nEccPol;       /* ECC policy                                */
    
    UINT8        aUID[XSR_UID_SIZE]; /* Uniqure ID in OTP area of NAND device*/
} BMLVolSpec;

/*****************************************************************************/
/* partition entry structure                                                 */
/*****************************************************************************/
typedef struct {
    UINT32       nID;           /* partition entry ID                        */
    UINT32       nAttr;         /* Attribute                                 */
    UINT32       n1stVbn;       /* 1st virtual block number                  */
    UINT32       nNumOfBlks;    /* # of blocks                               */
} XSRPartEntry;

/*****************************************************************************/
/* partition information structure                                           */
/*****************************************************************************/
typedef struct {
    UINT8         aSig[BML_MAX_PART_SIG];   /* signature of partition 
                                               information                   */
    UINT32        nVer;                     /* version of partition 
                                               information                   */
    UINT32        nNumOfPartEntry;          /* # of partition entry          */
    XSRPartEntry  stPEntry[BML_MAX_PARTENTRY];
} XSRPartI;

/*****************************************************************************/
/* partition extension information structure                                 */
/*****************************************************************************/
typedef struct {
    UINT32       nID;           /* nID of partition information extension    */
    UINT32       nSizeOfData;   /* size of pData                             */
    VOID        *pData;         /* pointer of user-defined data structure    */
} XSRPIExt;


typedef struct {
    UINT32       nSrcVsn;       /* source virtual sector number              */
    UINT16       nRndInOffset;  /* spare area offset (0~15) for random-in    */
                                /* Random-In of ScrArg is only used          */
                                /* for spare area                            */
    UINT16       nRndInBytes;   /* number of bytes for random-in             */
    UINT8       *pRndInBuf;     /* buffer pointer for random-in              */
} SrcArg;

typedef struct {
    SrcArg       aSrcArg[XSR_MAX_REQSEC];
    UINT32       nDstVsn;       /* destination virtual sector number         */
    UINT32       nCopyCnt;      /* number of CopyArg                         */
} CopyArg;

/*****************************************************************************/
/* exported function prototype of BML                                        */
/*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/*****************************************************************************/
/* APIs for pre-programming                                                  */
/*****************************************************************************/
#if !defined(XSR_NBL2)
INT32   BML_Format           (UINT32  nVol,  XSRPartI *pstPart, UINT32 nFlag);
#endif /* XSR_NBL2 */

/*****************************************************************************/
/* Major APIs                                                                */
/*****************************************************************************/
INT32   BML_Init             (VOID);
INT32   BML_Open             (UINT32  nVol);

#if !defined(XSR_NBL2)
INT32   BML_Close            (UINT32  nVol);
#endif /* XSR_NBL2 */
INT32   BML_Read             (UINT32  nVol,  UINT32  nVsn,  UINT32 nNumOfScts,
                              UINT8  *pMBuf, UINT8  *pSBuf, UINT32 nFlag);
INT32   BML_MRead            (UINT32  nVol,  UINT32 nVsn,   UINT32 nNumOfScts,
                              UINT8  *pMBuf, UINT8 *pSBuf,  UINT32 nFlag);
/* added for XSR v1.5.x */
INT32   BML_SGLRead          (UINT32  nVol,  UINT32 nVsn,   UINT32 nNumOfScts,
                              SGL   *pstSGL, UINT8 *pSBuf,  UINT32 nFlag);
#if !defined(XSR_NBL2)
INT32   BML_Write            (UINT32  nVol,  UINT32  nVsn,  UINT32 nNumOfScts,
                              UINT8  *pMBuf, UINT8  *pSBuf, UINT32 nFlag);
INT32   BML_MWrite           (UINT32  nVol,  UINT32  nVsn,  UINT32 nNumOfScts,
                              UINT8  *pMBuf, UINT8  *pSBuf, UINT32 nFlag);
/* added for XSR v1.5.x */
INT32   BML_SGLWrite         (UINT32  nVol,  UINT32  nVsn,  UINT32 nNumOfScts,
                              SGL   *pstSGL, UINT8  *pSBuf, UINT32 nFlag);
INT32   BML_EraseBlk         (UINT32  nVol,  UINT32  nVbn,  UINT32 nFlag);
INT32   BML_MEraseBlk        (UINT32  nVol,  MEBArg *pstMEBArg, UINT32 nFlag);
INT32   BML_FlushOp          (UINT32  nVol,  UINT32   nFlag);
INT32   BML_GetBBInfo        (UINT32 nVol, UINT8 nDevNo, UINT8* pSRBInfo, UINT8* nBBCnt);
#endif /* XSR_NBL2 */

INT32   BML_GetVolInfo       (UINT32  nVol,  BMLVolSpec  *pstVolSpec);
INT32   BML_LoadPIEntry      (UINT32  nVol,  UINT32 nID,
                              XSRPartEntry  *pstPartEntry);
INT32	BML_GetDevInfo		 (UINT32  nVol, LLDSpec  *pstLLDSpec);                              
/*****************************************************************************/
/* APIs only used in STL                                                     */
/*****************************************************************************/
#if !defined(XSR_NBL2)
INT32   BML_CopyBack         (UINT32  nVol, CpBkArg *pstCpArg, UINT32  nFlag);
INT32   BML_Copy             (UINT32  nVol, CopyArg *pstCpArg, UINT32  nFlag);
/* INT32   BML_ReplaceBlk       (UINT32  nVol, UINT32  nVsn); */	/* removed for XSR v1.5.x */
#endif /* XSR_NBL2 */

/*****************************************************************************/
/* Extra APIs                                                                */
/*****************************************************************************/
#if !defined(XSR_NBL2)
INT32   BML_StorePIExt       (UINT32  nVol,  XSRPIExt *pExtInfo);
#endif /* XSR_NBL2 */
INT32   BML_LoadPIExt        (UINT32  nVol,  UINT32    nID, XSRPIExt *pExtInfo);
INT32   BML_IOCtl            (UINT32  nVol,  UINT32    nCode,
                                             UINT8    *pBufIn,   UINT32  nLenIn,
                                             UINT8    *pBufOut,  UINT32  nLenOut,
                                             UINT32   *pBytesReturned);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif  /* _XSR_BML_H_ */

⌨️ 快捷键说明

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