pseudobml.c
来自「SAMSUNG S3C6410 CPU BSP for winmobile6」· C语言 代码 · 共 1,257 行 · 第 1/5 页
C
1,257 行
return (INT32)nResult;
}
/*****************************************************************************/
/* */
/* NAME */
/* BML_Read */
/* DESCRIPTION */
/* This function reads virtual sectors */
/* PARAMETERS */
/* nVol [IN] */
/* Volume number */
/* nVsn [IN] */
/* First virtual sector number for reading */
/* nSctsInPg [IN] */
/* The number of sectors to read */
/* pMBuf [IN] */
/* Main sector buffer for reading */
/* pSBuf [IN] */
/* Spare sector buffer for reading */
/* nFlag [IN] */
/* BML_FLAG_ECC_ON */
/* BML_FLAG_ECC_OFF */
/* BML_FLAG_BBM_ON */
/* BML_FLAG_BBM_OFF */
/* RETURN VALUES */
/* BML_SUCCESS */
/* BML_Read is completed */
/* BML_READ_ERROR */
/* read data has the uncorrectable read error */
/* BML_INVALID_DATA_ERROR */
/* read data already has the uncorrectable read error */
/* BML_CRITICAL_ERROR */
/* critical error */
/* BML_INVALID_PARAM */
/* invalid parameter */
/* BML_ACQUIRE_SM_ERROR */
/* acquiring semaphore is failed */
/* BML_RELEASE_SM_ERROR */
/* releasing semaphore is failed */
/* NOTES */
/* */
/*****************************************************************************/
INT32
BML_Read(UINT32 nVol, UINT32 nVsn, UINT32 nSctsInPg,
UINT8 *pMBuf, UINT8 *pSBuf, UINT32 nFlag)
{
BMLPacket stPacket;
UINT32 nResult;
BMLP_LOG_PRINT((TEXT("[BMLP: IN] ++BML_Read()\r\n")));
do {
/* BML_Read */
stPacket.nVol = nVol;
stPacket.nCtrlCode = PS_HAL_BML_READ;
stPacket.nVbn = 0; // Not used
stPacket.nVsn = nVsn;
stPacket.nNumOfScts = nSctsInPg;
stPacket.nOpFlag = nFlag;
stPacket.pMBuf = pMBuf;
stPacket.pSBuf = pSBuf;
stPacket.pstMEBArg = 0; // by kathy
stPacket.pSGLBuf = 0; /* added for XSR v1.5.x */
KernelIoControl(IOCTL_POCKETSTOREII_CMD, /* IO Control Code */
&stPacket, /* Input buffer */
sizeof(BMLPacket),
NULL, /* Output buffer */
0,
&nResult);
if (nResult != BML_SUCCESS)
{
//BMLP_ERR_PRINT((TEXT("[BMLP:ERR] BML_Read() failure. ERR Code=%x\r\n"), nResult));
break;
}
} while(0);
BMLP_LOG_PRINT((TEXT("[BMLP:OUT] --BML_Read()\r\n")));
return (INT32)nResult;
}
/*****************************************************************************/
/* */
/* NAME */
/* BML_MRead */
/* DESCRIPTION */
/* This function reads virtual sectors */
/* PARAMETERS */
/* nVol [IN] */
/* Volume number */
/* nVsn [IN] */
/* First virtual sector number for reading */
/* nSctsInPg [IN] */
/* The number of sectors to read */
/* pMBuf [IN] */
/* Main sector buffer for reading */
/* pSBuf [IN] */
/* Spare sector buffer for reading */
/* nFlag [IN] */
/* BML_FLAG_ECC_ON */
/* BML_FLAG_ECC_OFF */
/* BML_FLAG_BBM_ON */
/* BML_FLAG_BBM_OFF */
/* RETURN VALUES */
/* BML_SUCCESS */
/* BML_Read is completed */
/* BML_READ_ERROR */
/* read data has the uncorrectable read error */
/* BML_INVALID_DATA_ERROR */
/* read data already has the uncorrectable read error */
/* BML_CRITICAL_ERROR */
/* critical error */
/* BML_INVALID_PARAM */
/* invalid parameter */
/* BML_ACQUIRE_SM_ERROR */
/* acquiring semaphore is failed */
/* BML_RELEASE_SM_ERROR */
/* releasing semaphore is failed */
/* NOTES */
/* */
/*****************************************************************************/
//BML_Read(UINT32 nVol, UINT32 nVsn, UINT32 nSctsInPg,
//BML_MRead(UINT32 nVol, UINT32 nVsn, UINT32 nNumOfScts,
INT32
BML_MRead(UINT32 nVol, UINT32 nVsn, UINT32 nNumOfScts,
UINT8 *pMBuf, UINT8 *pSBuf, UINT32 nFlag)
{
BMLPacket stPacket;
UINT32 nResult;
BMLP_LOG_PRINT((TEXT("[BMLP: IN] ++BML_Read()\r\n")));
do {
/* BML_Read */
stPacket.nVol = nVol;
stPacket.nCtrlCode = PS_HAL_BML_MREAD;
stPacket.nVbn = 0; // Not used
stPacket.nVsn = nVsn;
stPacket.nNumOfScts = nNumOfScts;
stPacket.nOpFlag = nFlag;
stPacket.pMBuf = pMBuf;
stPacket.pSBuf = pSBuf;
stPacket.pstMEBArg = 0; // by kathy
stPacket.pSGLBuf = 0; /* added for XSR v1.5.x */
KernelIoControl(IOCTL_POCKETSTOREII_CMD, /* IO Control Code */
&stPacket, /* Input buffer */
sizeof(BMLPacket),
NULL, /* Output buffer */
0,
&nResult);
if (nResult != BML_SUCCESS)
{
BMLP_ERR_PRINT((TEXT("[BMLP:ERR] BML_Read() failure. ERR Code=%x\r\n"), nResult));
break;
}
} while(0);
BMLP_LOG_PRINT((TEXT("[BMLP:OUT] --BML_Read()\r\n")));
return (INT32)nResult;
}
/*****************************************************************************/
/* */
/* NAME */
/* BML_Write */
/* DESCRIPTION */
/* This function writes virtual sectors */
/* PARAMETERS */
/* nVol [IN] */
/* Volume number */
/* nVsn [IN] */
/* First virtual sector number for writing */
/* nSctsInPg [IN] */
/* The number of sectors to write */
/* pMBuf [IN] */
/* Main sector buffer for writing */
/* pSBuf [IN] */
/* Spare sector buffer for writing */
/* nFlag [IN] */
/* Options for writing */
/* RETURN VALUES */
/* BML_SUCCESS */
/* BML_Write is completed */
/* BML_WR_PROTECT_ERROR */
/* write protect error */
/* BML_CRITICAL_ERROR */
/* critical error */
/* BML_INVALID_PARAM */
/* invalid parameters */
/* BML_ACQUIRE_SM_ERROR */
/* acquiring semaphore is failed */
/* BML_RELEASE_SM_ERROR */
/* releasing semaphore is failed */
/* NOTES */
/* */
/*****************************************************************************/
INT32
BML_Write(UINT32 nVol, UINT32 nVsn, UINT32 nSctsInPg,
UINT8 *pMBuf, UINT8 *pSBuf, UINT32 nFlag)
{
BMLPacket stPacket;
UINT32 nResult;
BMLP_LOG_PRINT((TEXT("[BMLP: IN] ++BML_Write()\r\n")));
do {
/* BML_Write */
stPacket.nVol = nVol;
stPacket.nCtrlCode = PS_HAL_BML_WRITE;
stPacket.nVbn = 0; // Not used
stPacket.nVsn = nVsn;
stPacket.nNumOfScts = nSctsInPg;
stPacket.nOpFlag = nFlag;
stPacket.pMBuf = pMBuf;
stPacket.pSBuf = pSBuf;
stPacket.pstMEBArg = 0; // by kathy
stPacket.pSGLBuf = 0; /* added for XSR v1.5.x */
KernelIoControl(IOCTL_POCKETSTOREII_CMD, /* IO Control Code */
&stPacket, /* Input buffer */
sizeof(BMLPacket),
NULL, /* Output buffer */
0,
&nResult);
if (nResult != BML_SUCCESS)
{
BMLP_ERR_PRINT((TEXT("[BMLP:ERR] BML_Write() failure. ERR Code=%x\r\n"), nResult));
break;
}
} while(0);
BMLP_LOG_PRINT((TEXT("[BMLP:OUT] --BML_Write()\r\n")));
return (INT32)nResult;
}
/*****************************************************************************/
/* */
/* NAME */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?