blob: eb701e981c0f0f415f11bd5aa42630238209ab68 [file] [log] [blame]
angelslee21f4b2013-02-18 18:48:53 +08001/*
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
22typedef unsigned long ion_phys_addr_t;
23typedef int ion_client;
24typedef int ion_buffer;
25
26enum 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
34struct 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
43extern "C" {
44#endif
45
46ion_client ion_client_create(void);
47void ion_client_destroy(ion_client client);
48ion_buffer ion_alloc(ion_client client, size_t len, size_t align, unsigned int flags);
49void ion_free(ion_buffer buffer);
50void *ion_map(ion_buffer buffer, size_t len, off_t offset);
51int ion_unmap(void *addr, size_t len);
52int ion_msync(ion_client client, ion_buffer buffer, enum ION_MSYNC_FLAGS flags, size_t size, off_t offset);
53ion_phys_addr_t ion_getphys(ion_client client, ion_buffer buffer);
54int createIONMem(struct secion_param *param, size_t size, unsigned int flags);
55int destroyIONMem(struct secion_param *param);
56
57#ifdef __cplusplus
58}
59#endif
60#endif /* _LIB_SECION_H_ */