cmnMemory.c revision 41050cdb033641ddf26831d9272c0930f7b40a2d
1/*
2 ** Copyright 2003-2010, VisualOn, Inc.
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 **     http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16/*******************************************************************************
17	File:		cmnMemory.c
18
19	Content:	sample code for memory operator implementation
20
21*******************************************************************************/
22#include "cmnMemory.h"
23
24#include <malloc.h>
25#if defined LINUX
26#include <string.h>
27#endif
28
29//VO_MEM_OPERATOR		g_memOP;
30
31VO_U32 cmnMemAlloc (VO_S32 uID,  VO_MEM_INFO * pMemInfo)
32{
33	if (!pMemInfo)
34		return VO_ERR_INVALID_ARG;
35
36	pMemInfo->VBuffer = malloc (pMemInfo->Size);
37	return 0;
38}
39
40VO_U32 cmnMemFree (VO_S32 uID, VO_PTR pMem)
41{
42	free (pMem);
43	return 0;
44}
45
46VO_U32	cmnMemSet (VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize)
47{
48	memset (pBuff, uValue, uSize);
49	return 0;
50}
51
52VO_U32	cmnMemCopy (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize)
53{
54	memcpy (pDest, pSource, uSize);
55	return 0;
56}
57
58VO_U32	cmnMemCheck (VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize)
59{
60	return 0;
61}
62
63VO_S32 cmnMemCompare (VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize)
64{
65	return memcmp(pBuffer1, pBuffer2, uSize);
66}
67
68VO_U32	cmnMemMove (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize)
69{
70	memmove (pDest, pSource, uSize);
71	return 0;
72}
73
74