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:		voMem.h
18
19	Content:	memory functions & data structures
20
21*******************************************************************************/
22
23#ifndef __voMem_H__
24#define __voMem_H__
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30#include "voIndex.h"
31
32typedef struct
33{
34	VO_S32				Size;				/*!< Buffer stride */
35	VO_S32				Flag;
36	VO_PTR				VBuffer;			/*!< user data pointer */
37	VO_PTR				PBuffer;			/*!< user data pointer */
38}
39VO_MEM_INFO;
40
41typedef struct VO_MEM_OPERATOR
42{
43	VO_U32 (VO_API * Alloc) (VO_S32 uID, VO_MEM_INFO * pMemInfo);
44	VO_U32 (VO_API * Free) (VO_S32 uID, VO_PTR pBuff);
45	VO_U32 (VO_API * Set) (VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize);
46	VO_U32 (VO_API * Copy) (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize);
47	VO_U32 (VO_API * Check) (VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize);
48	VO_S32 (VO_API * Compare) (VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize);
49	VO_U32 (VO_API * Move) (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize);
50} VO_MEM_OPERATOR;
51
52#define voMemAlloc(pBuff, pMemOP, ID, nSize) \
53{ \
54	VO_MEM_INFO voMemInfo; \
55	voMemInfo.Size=nSize; \
56	pMemOP->Alloc(ID, &voMemInfo); \
57	pBuff=(VO_PBYTE)voMemInfo.VBuffer; \
58}
59
60
61#ifdef __cplusplus
62}
63#endif /* __cplusplus */
64
65#endif // __voMem_H__
66