?? ebootwmroam.c
字號:
/*****************************************************************************/
/* */
/* PROJECT : Rainbow */
/* MODULE : OS Adaptation Module */
/* NAME : OSLess OAM */
/* FILE : WMROAM.c */
/* PURPOSE : This file contain the OS Adaptation Modules for OSless platform */
/* such as BootLoader */
/* */
/*---------------------------------------------------------------------------*/
/* */
/* 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 */
/* */
/* 18-AUG-2005 [Yangsup Lee] : first writing */
/* */
/*****************************************************************************/
#include <windows.h>
#include "WMRConfig.h"
#include "WMRTypes.h"
#include "EbootWMROAM.h"
//#include <stdarg.h>
//#include <stdio.h>
//#include "S5L8700.h"
/*****************************************************************************/
/* Global variables definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Local #defines */
/*****************************************************************************/
#define WMR_LOCAL_MEM_SIZE ((50 * 1024) / sizeof(UINT32))
/*****************************************************************************/
/* Local typedefs */
/*****************************************************************************/
/*****************************************************************************/
/* Local constant definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Static variables definitions */
/*****************************************************************************/
static UINT32 aMemBuf[WMR_LOCAL_MEM_SIZE];
static UINT32 nMallocPtr = 0;
/* for Blues LLD */
//UINT8 aTempSBuf[512];
//UINT8 aMakeSECCBuf[512];
//UINT8 aTempEccBuf[12];
//BOOL32 aNeedSync[WMR_MAX_DEVICE * 2];
//UINT8 TestMBuf[2];
//UINT8 TestMBuf[2048];
//UINT8 TestSBuf[512];
// for TFS4
#if 0
UINT8 szBuff[512];
t_char sBuff[2];
t_uint8 usBuffer[2];
t_char *pArg[2];
t_kfat_string sTmp;
t_kfat_string strUnicode;
t_kfat_string strChild, strChildShort, strRead;
t_dir_entry stDE[2];
t_file_table_entry stParent, stChild;
#endif
#if 0
extern UINT8 aChecksumTable[];
#else
/*****************************************************************************/
/* Static variables definitions */
/*****************************************************************************/
PRIVATE const UINT8 aChecksumTable[256] =
{ 8, 7, 7, 6, 7, 6, 6, 5, 7, 6, 6, 5, 6, 5, 5, 4,
7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3,
6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
6, 5, 5, 4, 5, 4, 4, 3, 5, 4, 4, 3, 4, 3, 3, 2,
5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
5, 4, 4, 3, 4, 3, 3, 2, 4, 3, 3, 2, 3, 2, 2, 1,
4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0
};
#endif
/*****************************************************************************/
/* Code Implementation */
/*****************************************************************************/
/*****************************************************************************/
/* */
/* NAME */
/* WMR_GetChkSum */
/* DESCRIPTION */
/* This function returns the sum of 0 count of pBuf. */
/* PARAMETERS */
/* pBuf [IN] the pointer of buffer */
/* nSize [IN] the size of buffer */
/* RETURN VALUES */
/* the sum of 0 count */
/* NOTES */
/* */
/*****************************************************************************/
UINT16
WMR_GetChkSum(UINT8 *pBuf, UINT32 nSize)
{
register UINT32 nIdx;
register const UINT8 *pD8;
register const UINT8 *pCheckSum;
register UINT32 nSum = 0;
pD8 = pBuf;
pCheckSum = aChecksumTable;
if(nSize < 512)
{
for (nIdx = 0; nIdx < nSize; nIdx++)
{
nSum += *(pCheckSum + *(pD8++));
}
}
else
{
for (nIdx = 0; nIdx < nSize / 8; nIdx++)
{
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
nSum += *(pCheckSum + *(pD8++));
}
}
return (UINT16)nSum;
}
/*****************************************************************************/
/* */
/* NAME */
/* OAM_Malloc */
/* DESCRIPTION */
/* This function allocates memory for Whimory */
/* */
/* PARAMETERS */
/* nSize [IN] */
/* Size to be allocated */
/* */
/* RETURN VALUES */
/* Pointer of allocated memory */
/* */
/* NOTES */
/* This function is called by function that wants to use memory */
/* */
/*****************************************************************************/
VOID *
OAM_Malloc(UINT32 nSize)
{
#ifdef NO_MALLOC
WMR_RTL_PRINT((TEXT("[FTL:ERR] OAM_Malloc() : NO_MALLOC defined\r\n")));
while(1);
#else
UINT32 nAlignSize;
nAlignSize = nSize / sizeof(UINT32);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -