getuid.c
来自「SAMSUNG S3C6410 CPU BSP for winmobile6」· C语言 代码 · 共 115 行
C
115 行
/*****************************************************************************/
/* */
/* PROJECT : PocketStoreII */
/* FILE : GetUID.c */
/* PURPOSE : the routine get Unique ID from NAND flash memory */
/* */
/*---------------------------------------------------------------------------*/
/* */
/* COPYRIGHT 2006 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-MAR-2003 [SongHo Yoon] : first writing */
/* 19-APR-2004 [JangHwan Kim]: Migration for PocketStoreII */
/* 03-FEB-2006 [Hyunsoo Cho] : Change API parameters */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* Header File Include */
/*****************************************************************************/
#include <windows.h>
#include <XSR.h>
#include <HalWrapper.h>
/*****************************************************************************/
/* Global Variable Declaration */
/*****************************************************************************/
extern CRITICAL_SECTION csPocketStoreBML; // for PS_hal_wrapper critical section
// It is defined in HAL_Wrapper.c
/*****************************************************************************/
/* Debug Definitions */
/*****************************************************************************/
#define GETUID_RTL_PRINT(x) PSII_RTL_PRINT(x)
#if GETUID_ERR_MSG_ON
#define GETUID_ERR_PRINT(x) PSII_RTL_PRINT(x)
#else
#define GETUID_ERR_PRINT(x)
#endif /* #if GETUID_ERR_MSG_ON */
#if GETUID_LOG_MSG_ON
#define GETUID_LOG_PRINT(x) PSII_DBG_PRINT(x)
#else
#define GETUID_LOG_PRINT(x)
#endif /* #if GETUID_LOG_MSG_ON */
#if GETUID_INF_MSG_ON
#define GETUID_INF_PRINT(x) PSII_DBG_PRINT(x)
#else
#define GETUID_INF_PRINT(x)
#endif /* #if GETUID_INF_MSG_ON */
/*****************************************************************************/
/* */
/* NAME */
/* OndUIDRead */
/* */
/* DESCRIPTION */
/* Get Unique ID from OneNAND */
/* */
/* PARAMETERS */
/* aUID */
/* Memory location for Unique ID */
/* */
/* RETURN VALUES */
/* If it successes, it returns TRUE. otherwize it returns FALSE */
/* */
/*****************************************************************************/
BOOL
OndUIDRead( UCHAR aUID[XSR_UID_SIZE] )
{
UINT32 nVol = 0;
BMLVolSpec stVolSpec;
BOOL bRet = FALSE;
INT32 nRet;
EnterCriticalSection(&csPocketStoreBML);
do {
nRet = BML_GetVolInfo(nVol, &stVolSpec);
if (nRet != BML_SUCCESS)
{
GETUID_ERR_PRINT((TEXT("[OTP:ERR] OndUIDRead Error\r\n")));
break;
}
memcpy(aUID, stVolSpec.aUID, XSR_UID_SIZE);
bRet = TRUE;
} while(0);
LeaveCriticalSection(&csPocketStoreBML);
return bRet;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?