Rename ipc_header to ipc_fmt_header, add ipc_rfs_header and utility functions
[libsamsung-ipc.git] / include / protocol.h
1 /*
2  * This file is part of libsamsung-ipc.
3  *
4  * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
5  *
6  * libsamsung-ipc is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * libsamsung-ipc is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with libsamsung-ipc.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include <samsung-ipc.h>
22
23 #ifndef __SAMSUNG_IPC_PROTOCOL_H__
24 #define __SAMSUNG_IPC_PROTOCOL_H__
25
26 /*
27  * Types
28  */
29
30 /* AP -> Baseband */
31 #define IPC_TYPE_EXEC                                           0x01
32 #define IPC_TYPE_GET                                            0x02
33 #define IPC_TYPE_SET                                            0x03
34 #define IPC_TYPE_CFRM                                           0x04
35 #define IPC_TYPE_EVENT                                          0x05
36
37 /* Baseband -> AP */
38 #define IPC_TYPE_INDI                                           0x01
39 #define IPC_TYPE_RESP                                           0x02
40 #define IPC_TYPE_NOTI                                           0x03
41
42 /*
43  * Groups
44  */
45
46 #define IPC_GROUP_PWR                                           0x01
47 #define IPC_GROUP_CALL                                          0x02
48 #define IPC_GROUP_SMS                                           0x04
49 #define IPC_GROUP_SEC                                           0x05
50 #define IPC_GROUP_PB                                            0x06
51 #define IPC_GROUP_DISP                                          0x07
52 #define IPC_GROUP_NET                                           0x08
53 #define IPC_GROUP_SND                                           0x09
54 #define IPC_GROUP_MISC                                          0x0A
55 #define IPC_GROUP_SVC                                           0x0B
56 #define IPC_GROUP_SS                                            0x0C
57 #define IPC_GROUP_GPRS                                          0x0D
58 #define IPC_GROUP_SAT                                           0x0E
59 #define IPC_GROUP_CFG                                           0x0F
60 #define IPC_GROUP_IMEI                                          0x10
61 #define IPC_GROUP_GPS                                           0x11
62 #define IPC_GROUP_SAP                                           0x12
63 #define IPC_GROUP_RFS                                           0x42
64 #define IPC_GROUP_GEN                                           0x80
65
66 /*
67  * Macros
68  */
69
70 #define IPC_COMMAND(f)                          ((f->group << 8) | f->index)
71 #define IPC_GROUP(m)                            (m >> 8)
72 #define IPC_INDEX(m)                            (m & 0xff)
73
74 /*
75  * Structures
76  */
77
78 struct ipc_fmt_header {
79     unsigned short length;
80     unsigned char mseq;
81     unsigned char aseq;
82     unsigned char group;
83     unsigned char index;
84     unsigned char type;
85 } __attribute__((__packed__));
86
87 struct ipc_rfs_header {
88     unsigned int length;
89     unsigned char index;
90     unsigned char id;
91 } __attribute__((__packed__));
92
93 #endif
94
95 // vim:ts=4:sw=4:expandtab