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 <stdlib.h>
25 #include <string.h>
26
27 //VO_MEM_OPERATOR g_memOP;
28
29 #define UNUSED(x) (void)(x)
30
cmnMemAlloc(VO_S32 uID,VO_MEM_INFO * pMemInfo)31 VO_U32 cmnMemAlloc (VO_S32 uID, VO_MEM_INFO * pMemInfo)
32 {
33 UNUSED(uID);
34
35 if (!pMemInfo)
36 return VO_ERR_INVALID_ARG;
37
38 pMemInfo->VBuffer = malloc (pMemInfo->Size);
39 return 0;
40 }
41
cmnMemFree(VO_S32 uID,VO_PTR pMem)42 VO_U32 cmnMemFree (VO_S32 uID, VO_PTR pMem)
43 {
44 UNUSED(uID);
45
46 free (pMem);
47 return 0;
48 }
49
cmnMemSet(VO_S32 uID,VO_PTR pBuff,VO_U8 uValue,VO_U32 uSize)50 VO_U32 cmnMemSet (VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize)
51 {
52 UNUSED(uID);
53
54 memset (pBuff, uValue, uSize);
55 return 0;
56 }
57
cmnMemCopy(VO_S32 uID,VO_PTR pDest,VO_PTR pSource,VO_U32 uSize)58 VO_U32 cmnMemCopy (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize)
59 {
60 UNUSED(uID);
61
62 memcpy (pDest, pSource, uSize);
63 return 0;
64 }
65
cmnMemCheck(VO_S32 uID,VO_PTR pBuffer,VO_U32 uSize)66 VO_U32 cmnMemCheck (VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize)
67 {
68 UNUSED(uID);
69 UNUSED(pBuffer);
70 UNUSED(uSize);
71
72 return 0;
73 }
74
cmnMemCompare(VO_S32 uID,VO_PTR pBuffer1,VO_PTR pBuffer2,VO_U32 uSize)75 VO_S32 cmnMemCompare (VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize)
76 {
77 UNUSED(uID);
78
79 return memcmp(pBuffer1, pBuffer2, uSize);
80 }
81
cmnMemMove(VO_S32 uID,VO_PTR pDest,VO_PTR pSource,VO_U32 uSize)82 VO_U32 cmnMemMove (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize)
83 {
84 UNUSED(uID);
85
86 memmove (pDest, pSource, uSize);
87 return 0;
88 }
89
90