angelsl | ee21f4b | 2013-02-18 18:48:53 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Samsung Electronics Co., Ltd. |
| 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 | #ifndef _LIB_SECION_H_ |
| 18 | #define _LIB_SECION_H_ |
| 19 | |
| 20 | #include <unistd.h> |
| 21 | |
| 22 | typedef unsigned long ion_phys_addr_t; |
| 23 | typedef int ion_client; |
| 24 | typedef int ion_buffer; |
| 25 | |
| 26 | enum ION_MSYNC_FLAGS { |
| 27 | IMSYNC_DEV_TO_READ = 0, |
| 28 | IMSYNC_DEV_TO_WRITE = 1, |
| 29 | IMSYNC_DEV_TO_RW = 2, |
| 30 | IMSYNC_SYNC_FOR_DEV = 0x10000, |
| 31 | IMSYNC_SYNC_FOR_CPU = 0x20000, |
| 32 | }; |
| 33 | |
| 34 | struct secion_param { |
| 35 | ion_client client; |
| 36 | ion_buffer buffer; |
| 37 | size_t size; |
| 38 | void *memory; |
| 39 | ion_phys_addr_t physaddr; |
| 40 | }; |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | extern "C" { |
| 44 | #endif |
| 45 | |
| 46 | ion_client ion_client_create(void); |
| 47 | void ion_client_destroy(ion_client client); |
| 48 | ion_buffer ion_alloc(ion_client client, size_t len, size_t align, unsigned int flags); |
| 49 | void ion_free(ion_buffer buffer); |
| 50 | void *ion_map(ion_buffer buffer, size_t len, off_t offset); |
| 51 | int ion_unmap(void *addr, size_t len); |
| 52 | int ion_msync(ion_client client, ion_buffer buffer, enum ION_MSYNC_FLAGS flags, size_t size, off_t offset); |
| 53 | ion_phys_addr_t ion_getphys(ion_client client, ion_buffer buffer); |
| 54 | int createIONMem(struct secion_param *param, size_t size, unsigned int flags); |
| 55 | int destroyIONMem(struct secion_param *param); |
| 56 | |
| 57 | #ifdef __cplusplus |
| 58 | } |
| 59 | #endif |
| 60 | #endif /* _LIB_SECION_H_ */ |