示例#1
0
VOID
OAM_Assert(BOOL32 bVal, const UINT8 *szFile, UINT32 nLine)
{
	if(!bVal)
	{
		WMR_RTL_PRINT((TEXT("[FTL:ERR]  OAM_Assert Error [%s:%d]!\r\n"), szFile, nLine));
		WMR_RTL_PRINT((TEXT("\n <log P1=\"101\" P2=\"WMROAM\" P3=\"\" P4=\"OAM_Assert()\" P5=\"OAM_Assert Error [%x:%d]\" P6=\"\" P7=\"\" />\n"), szFile, nLine));
		while(1);
	}

}
示例#2
0
VOID
MMT_Assert(BOOL32 bVal, const TCHAR *szFile, UINT32 nLine)
{
    if(!bVal)
    {
        WMR_RTL_PRINT((TEXT("[MMT:ERR] MMT_Assert Error [%s:%d]!\r\n"), szFile, nLine));
        WMR_RTL_PRINT((TEXT("\r\n<log P1=\"100\" P2=\"POR\" P3=\"\" P4=\"MMT_Assert(%s:%d)\" />\r\n"), szFile, nLine));

        while(1);
	}

}
示例#3
0
VOID
OAM_Free(VOID  *pMem)
{
#ifdef NO_MALLOC	// by dodan2 061216
	WMR_RTL_PRINT((TEXT("[FTL:ERR]  OAM_Free() : NO_MALLOC defined\r\n")));
	while(1);
#else
	if (pMem != NULL) free(pMem);
#endif
}
示例#4
0
VOID
OAM_Assert(BOOL32 bVal, const TCHAR *szFile, UINT32 nLine)
{
	if(!bVal)
	{
        RETAILMSG(TRUE, (_T("[ERR] OAM_Assert Error [%s:%d]!\r\n"), szFile, nLine));
        WMR_RTL_PRINT((TEXT("\r\n<log P1=\"100\" P2=\"WinCEWMROAM\" P3=\"\" P4=\"OAM_Assert(%s:%d)\" />\r\n"), szFile, nLine));

		while(1);
	}

}
示例#5
0
VOID *
OAM_Malloc(UINT32 nSize)
{
#ifdef NO_MALLOC	// by dodan2 061216
	WMR_RTL_PRINT((TEXT("[FTL:ERR]  OAM_Malloc() : NO_MALLOC defined\r\n")));
	while(1);
#else
// hmseo-061017 start
    if (nSize < 64) nSize = 64;     /* I don't know.. Why this is needed */
    return (void *)malloc(nSize);
// hmseo-061017 end
#endif
}
示例#6
0
VOID
OAM_Free(VOID  *pMem)
{
#ifdef NO_MALLOC	// by dodan2 061216
	WMR_RTL_PRINT((TEXT("[FTL:ERR]  OAM_Free() : NO_MALLOC defined\r\n")));
	while(1);
#else
	UINT32	i, j;
	UINT32	arraynum;

//	RETAILMSG(1, (L"OAM_Free : (UINT32)(pMem)=0x%x \n", (UINT32)(pMem)));
	if ( (UINT32)(pMem) != 0xFFFFFFFF )
	{
		for ( i = 0; i < OSLESS_MALLOC_POOL_SIZE_BY_KB; i ++ )
		{
//			RETAILMSG(1, (L"OAM_Free : i=%d, memarray[%d].startAddress=0x%x \n", i, i, memarray[i].startAddress));
			if ( memarray[i].startAddress == (UINT32)(pMem) )
			{
//				RETAILMSG(1, (L"OAM_Free : memarray[%d].startAddress=0x%x, memarray[%d].size=0x%x \r\n", i, memarray[i].startAddress, i, memarray[i].size));
//				RETAILMSG(1, (L"OAM_Free : memarray[%d].size/1024 = 0x%x \n", i, memarray[i].size/1024));

				arraynum = ((UINT32)(pMem) - (UINT32)(&(aMemBuf[0])))/1024;
				for ( j = 0; j < memarray[i].size/1024; j++ )
				{
//					RETAILMSG(1, (L"OAM_Free : j=%d, memAddr[%d]=0x%x \n", j, arraynum, memAddr[arraynum]));
					memAddr[arraynum] = FREE;
					arraynum++;
				}

				memarray[i].startAddress	= 0;
				memarray[i].size			= 0;

//				RETAILMSG(1, (L"OAM_Free : i=%d \r\n"));

				break;
			}
		}
	}

//	_OAM_ASSERT(0);
#endif
}
示例#7
0
VOID *
OAM_Malloc(UINT32 nSize)
{
#ifdef NO_MALLOC	// by dodan2 061216
	WMR_RTL_PRINT((TEXT("[FTL:ERR]  OAM_Malloc() : NO_MALLOC defined\r\n")));
	while(1);
#else
	UINT32  nAlignSize;
	UINT32	nAlignArrayStart;
	UINT32	nAlignArrayNumber;
	UINT32	i;
	UINT32	j;

//	RETAILMSG(1, (L"OAM_Malloc : nSize=0x%x \n", nSize));

	if ( firstMemalloc == TRUE )
	{
		for ( i = 0; i < OSLESS_MALLOC_POOL_SIZE_BY_KB; i++ )
		{
			memAddr[i] = FREE;
			memarray[i].startAddress = 0;
			memarray[i].size = 0;
		}
		firstMemalloc = FALSE;
	}

	nAlignArrayNumber = nSize/1024+(nSize%1024==0?0:1);
//	RETAILMSG(1, (L"OAM_Malloc : nAlignArrayNumber=%d \n", nAlignArrayNumber));
	nAlignSize = nAlignArrayNumber*1024;
//	RETAILMSG(1, (L"OAM_Malloc : nAlignSize=%d \n", nAlignSize));

	for ( i = 0; i < OSLESS_MALLOC_POOL_SIZE_BY_KB; i++ )
	{
//		RETAILMSG(1, (L"OAM_Malloc : i=%d, memAddr[%d]=0x%x \n", i, i, memAddr[i]));
		if ( memAddr[i] == USED ) continue;
		for (j = 0; j < nAlignArrayNumber; j++)
		{
//			RETAILMSG(1, (L"OAM_Malloc : i+j=%d, memAddr[%d]=0x%x \n", i+j, i+j, memAddr[i+j]));
			if ( memAddr[i+j] == FREE )
				continue;
			else
				break;
		}
//		RETAILMSG(1, (L"OAM_Malloc : j=%d, nAlignArrayNumber=%d \n", j, nAlignArrayNumber));
		if ( j == nAlignArrayNumber )	// found
		{
			nAlignArrayStart = i;
			nMallocPtr = i*1024/sizeof(UINT32);
			break;
		}
	}
//	RETAILMSG(1, (L"OAM_Malloc : nMallocPtr=0x%x \n", nMallocPtr));

//	RETAILMSG(1, (L"OAM_Malloc : nAlignArrayStart=0x%x \n", nAlignArrayStart));
//	RETAILMSG(1, (L"OAM_Malloc : nAlignArrayNumber=0x%x \n", nAlignArrayNumber));
	for ( i = nAlignArrayStart; i < nAlignArrayStart+nAlignArrayNumber; i++ )
	{
		memAddr[i] = USED;
	}

 	if (nMallocPtr+nAlignSize > WMR_LOCAL_MEM_SIZE*4)
	{
		RETAILMSG(1, (L"aMemBuf=0x%x\n", &(aMemBuf[0])));
		RETAILMSG(1, (L"nAlignSize=0x%x nMallocPtr=0x%x WMR_LOCAL_MEM_SIZE=0x%x\n", nAlignSize, nMallocPtr, WMR_LOCAL_MEM_SIZE));
 		return NULL;
	}

	for ( i = 0; i < OSLESS_MALLOC_POOL_SIZE_BY_KB; i ++ )
	{
//		RETAILMSG(1, (L"OAM_Malloc : memarray[%d].startAddress=0x%x \n", i, memarray[i].startAddress));
		if ( memarray[i].startAddress == 0 )
		{
			memarray[i].startAddress	= (UINT32)(&(aMemBuf[nMallocPtr]));
			memarray[i].size			= nAlignSize;
			break;
		}
	}
//	RETAILMSG(1, (L"OAM_Malloc : memarray[%d].startAddress=0x%x \n", i, memarray[i].startAddress));
//	RETAILMSG(1, (L"OAM_Malloc : memarray[%d].size=0x%x \r\n", i, memarray[i].size));
//	RETAILMSG(1, (L"OAM_Malloc : &(aMemBuf[0x%x])=0x%x \r\n", nMallocPtr, &(aMemBuf[nMallocPtr])));
	return (VOID *) &(aMemBuf[nMallocPtr]);
#endif
}