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

📄 pseudoftl.c

📁 s3c2450 bsp for wince 5.0 经验证,完全没问题
💻 C
📖 第 1 页 / 共 3 页
字号:
/*****************************************************************************/
/*                                                                           */
/* PROJECT : PocketStoreII v1.0.0_build001                                   */
/* MODULE  : Pseudo FTL                                                      */
/* NAME    : Pseudo FTL                                                      */
/* FILE    : PseudoFTL.c                                                     */
/* PURPOSE : This file contains the exported routine for interfacing with    */
/*           the upper layer of FTL.                                         */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/*          COPYRIGHT 2003-2004 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                                                          */
/*                                                                           */
/*   17-OCT-2006 [Seungkyu Kim]: first writing                               */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/
/* Headerfile Include                                                        */
/*****************************************************************************/
#include <windows.h>
#include <bldver.h>
#include <windev.h>
#include <types.h>
#include <excpt.h>
#include <tchar.h>
#include <devload.h>
#include <diskio.h>

#include <VFLBuffer.h>
#include <WMRTypes.h>
#include <VFL.h>
#include <HALWrapper.h>

#include <storemgr.h>
#include <pm.h>
#include <config.h>
#include <WMRConfig.h>
#include <WinCEWMROAM.h>
#include <FTL.h>

/*****************************************************************************/
/* Debug Definitions                                                         */
/*****************************************************************************/

#define FTLP_RTL_PRINT(x)        PSII_RTL_PRINT(x)

#if FTLP_ERR_MSG_ON
#define FTLP_ERR_PRINT(x)        PSII_RTL_PRINT(x)
#else
#define FTLP_ERR_PRINT(x)
#endif /* #if FTLP_ERR_MSG_ON */

#if FTLP_LOG_MSG_ON
#define FTLP_LOG_PRINT(x)        PSII_DBG_PRINT(x)
#else
#define FTLP_LOG_PRINT(x)
#endif  /* #if FTLP_LOG_MSG_ON */

#if FTLP_INF_MSG_ON
#define FTLP_INF_PRINT(x)        PSII_DBG_PRINT(x)
#else
#define FTLP_INF_PRINT(x)
#endif  /* #if FTLP_INF_MSG_ON */


/*****************************************************************************/
/* Global Variables                                                          */
/*****************************************************************************/


/*****************************************************************************/
/* Imported variable declarations                                            */
/*****************************************************************************/


/*****************************************************************************/
/* Imported function declarations                                            */
/*****************************************************************************/


/*****************************************************************************/
/* Local #define                                                             */
/*****************************************************************************/


/*****************************************************************************/
// Local constant definitions
/*****************************************************************************/


/*****************************************************************************/
// Local typedefs
/*****************************************************************************/


/*****************************************************************************/
/*                                                                           */
/* NAME                                                                      */
/*		FTL_Init                                                             */
/* DESCRIPTION                                                               */
/*      This function initializes FTL layer.                                 */
/* PARAMETERS                                                                */
/*      none                                                                 */
/* RETURN VALUES                                                             */
/*      FTL_SUCCESS                                                          */
/*            FTL_Init is completed.                                         */
/*      FTL_CRITICAL_ERROR                                                   */
/*            FTL_Init is failed.                                            */
/* NOTES                                                                     */
/*      Before all of other functions of FTL is called, FTL_Init() should be */
/*      called.                                                              */
/*                                                                           */
/*****************************************************************************/
INT32
FTL_Init(VOID)
{
    FTLPacket   stPacket;
    UINT32      nResult;

    FTLP_LOG_PRINT((TEXT("[FTLP: IN] ++FTL_Init()\r\n")));

    do {
        /* FTL Init */
        stPacket.nCtrlCode  = PM_HAL_FTL_INIT;
        stPacket.nLsn       = 0;
        stPacket.nNumOfScts = 0;
        stPacket.pBuf       = NULL;
        stPacket.pTotalScts = NULL;

        KernelIoControl(IOCTL_POCKETSTOREII_CMD,  /* Io Control Code */
                        &stPacket,                /* Input buffer (Additional Control Code) */
                        sizeof(FTLPacket),        /* Size of Input buffer */
                        NULL,                     /* Output buffer */
                        0,                        /* Size of Output buffer */
                        &nResult);                /* Error Return */

        if ((nResult != FTL_SUCCESS) && (nResult != FTL_CRITICAL_ERROR))
        {
            FTLP_ERR_PRINT((TEXT("[FTLP:ERR]  FTL_Init() failure. ERR Code=%x\r\n"), nResult));

            break;
        }

    } while(0);

    FTLP_LOG_PRINT((TEXT("[FTLP:OUT] --FTL_Init()\r\n")));

    return (INT32)nResult;

}


/*****************************************************************************/
/*                                                                           */
/* NAME                                                                      */
/*		FTL_Open                                                             */
/* DESCRIPTION                                                               */
/*      This function opens FTL layer.                                       */
/* PARAMETERS                                                                */
/*      none                                                                 */
/* RETURN VALUES                                                             */
/*      FTL_SUCCESS                                                          */
/*            FTL_Open is completed.                                         */
/*		FTL_CRITICAL_ERROR                                                   */
/*			  FTL_Open is failed.                                            */
/* NOTES                                                                     */
/*      Before FTL_Open() is called, FTL_Init() should be called.            */
/*                                                                           */
/*****************************************************************************/
INT32
FTL_Open(UINT32 *pTotalScts)
{
    FTLPacket   stPacket;
    UINT32      nResult;

    FTLP_LOG_PRINT((TEXT("[FTLP: IN] ++FTL_Open()\r\n")));
    FTLP_LOG_PRINT((TEXT("[FTLP: IN] ++FTL_Open()  pTotalScts = 0x%x\r\n"), pTotalScts));

    do {
        /* FTL_Open */
        stPacket.nCtrlCode  = PM_HAL_FTL_OPEN;
        stPacket.nLsn       = 0;
        stPacket.nNumOfScts = 0;
        stPacket.pBuf       = NULL;
        stPacket.pTotalScts = pTotalScts;

        KernelIoControl(IOCTL_POCKETSTOREII_CMD,  /* Io Control Code */
                        &stPacket,                /* Input buffer (Additional Control Code) */
                        sizeof(FTLPacket),        /* Size of Input buffer */
                        NULL,                     /* Output buffer */
                        0,                        /* Size of Output buffer */
                        &nResult);                /* Error Return */

        if (nResult != FTL_SUCCESS)
        {
            FTLP_ERR_PRINT((TEXT("[FTLP:ERR]  FTL_Open() failure. ERR Code=%x\r\n"), nResult));

            break;
        }

    } while(0);

    FTLP_LOG_PRINT((TEXT("[FTLP:OUT] --FTL_Open()\r\n")));

    return (INT32)nResult;
}


/*****************************************************************************/
/*                                                                           */
/* NAME                                                                      */
/*		FTL_Format                                                           */
/* DESCRIPTION                                                               */
/*      This function formats FTL.                                           */
/* PARAMETERS                                                                */
/*      none                                                                 */
/* RETURN VALUES                                                             */
/*		FTL_SUCCESS                                                          */
/*            FTL_Format is completed.                                       */
/*		FTL_CRITICAL_ERROR                                                   */
/*            FTL_Format is failed.    		                                 */
/* NOTES                                                                     */
/*      Before FTL_Format() is called, FTL_Init() should be called.          */
/*      When this function is called, AC power must be connected.            */
/*                                                                           */
/*****************************************************************************/
INT32
FTL_Format(VOID)
{
    FTLPacket   stPacket;
    UINT32      nResult;

    FTLP_LOG_PRINT((TEXT("[FTLP: IN] ++FTL_Format()\r\n")));

    do {
        /* FTL_Format */
        stPacket.nCtrlCode  = PM_HAL_FTL_FORMAT;
        stPacket.nLsn       = 0;
        stPacket.nNumOfScts = 0;
        stPacket.pBuf       = NULL;
        stPacket.pTotalScts = NULL;

⌨️ 快捷键说明

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