1 #ifndef __ION_UTILS_H
2 #define __ION_UTILS_H
3
4 #include "ion.h"
5
6 #define SOCKET_NAME "ion_socket"
7 #define ION_DEVICE "/dev/ion"
8
9 #define ION_BUFFER_LEN 4096
10 #define MAX_HEAP_COUNT ION_HEAP_TYPE_CUSTOM
11
12 struct socket_info {
13 int sockfd;
14 int datafd;
15 unsigned long buflen;
16 };
17
18 struct ion_buffer_info {
19 int ionfd;
20 int buffd;
21 unsigned int heap_type;
22 unsigned int flag_type;
23 unsigned long heap_size;
24 unsigned long buflen;
25 unsigned char *buffer;
26 };
27
28
29
30 void write_buffer(void *buffer, unsigned long len);
31
32
33 void read_buffer(void *buffer, unsigned long len);
34
35
36
37
38 int ion_export_buffer_fd(struct ion_buffer_info *ion_info);
39
40
41
42
43 int ion_import_buffer_fd(struct ion_buffer_info *ion_info);
44
45
46 void ion_close_buffer_fd(struct ion_buffer_info *ion_info);
47
48
49 int socket_send_fd(struct socket_info *skinfo);
50
51
52 int socket_receive_fd(struct socket_info *skinfo);
53
54
55 #endif