• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2013 Rockchip Electronics Co., LTD.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * @file        Rockchip_OSAL_SharedMemory.h
20  * @brief
21  * @author      csy(csy@rock-chips.com)
22  * @version     1.0.0
23  * @history
24  *   2013.11.26 : Create
25  */
26 
27 
28 #ifndef ROCKCHIP_OSAL_SHAREDMEMORY
29 #define ROCKCHIP_OSAL_SHAREDMEMORY
30 
31 #include "Rockchip_OSAL_ion.h"
32 #include "vpu_type.h"
33 #include "OMX_Types.h"
34 #include "Rockchip_OSAL_Memory.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef enum _SECURE_MEMORY_TYPE {
40     MEMORY_TYPE_ION,
41     MEMORY_TYPE_DRM
42 } SECURE_MEMORY_TYPE;
43 
44 OMX_HANDLETYPE Rockchip_OSAL_SharedMemory_Open();
45 void Rockchip_OSAL_SharedMemory_Close(OMX_HANDLETYPE handle, OMX_BOOL b_secure);
46 OMX_PTR Rockchip_OSAL_SharedMemory_Alloc(OMX_HANDLETYPE handle, OMX_U32 size, MEMORY_TYPE memoryType);
47 void Rockchip_OSAL_SharedMemory_Free(OMX_HANDLETYPE handle, OMX_PTR pBuffer);
48 int Rockchip_OSAL_SharedMemory_VirtToION(OMX_HANDLETYPE handle, OMX_PTR pBuffer);
49 OMX_PTR Rockchip_OSAL_SharedMemory_IONToVirt(OMX_HANDLETYPE handle, int ion_fd);
50 OMX_S32 Rockchip_OSAL_SharedMemory_getPhyAddress(OMX_HANDLETYPE handle, int share_fd, OMX_U32 *phyaddress);
51 #ifdef AVS80
52 OMX_U32 Rockchip_OSAL_SharedMemory_HandleToAddress(OMX_HANDLETYPE handle, OMX_HANDLETYPE handle_ptr);
53 OMX_PTR Rockchip_OSAL_SharedMemory_HandleToSecureAddress(OMX_HANDLETYPE handle, OMX_HANDLETYPE handle_ptr, RK_S32 size);
54 #endif
55 void    Rockchip_OSAL_SharedMemory_SecureUnmap(OMX_HANDLETYPE handle, OMX_HANDLETYPE handle_ptr, RK_S32 size);
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif
61 
62