blob: 498e0466267f0172f6aaf9a57db9ce9030a9bdd1 [file] [log] [blame]
Karthikeyan Ramasubramaniana9859e82012-07-12 13:10:42 -06001/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/qmi_encdec.h>
15
16#include <mach/msm_qmi_interface.h>
17
18#include "kernel_test_service_v01.h"
19
20#define PING_REQ1_TLV_TYPE 0x1
21#define PING_RESP1_TLV_TYPE 0x2
22#define PING_OPT1_TLV_TYPE 0x10
23#define PING_OPT2_TLV_TYPE 0x11
24
25#define DATA_REQ1_TLV_TYPE 0x1
26#define DATA_RESP1_TLV_TYPE 0x2
27#define DATA_OPT1_TLV_TYPE 0x10
28#define DATA_OPT2_TLV_TYPE 0x11
29
30static struct elem_info test_name_type_v01_ei[] = {
31 {
32 .data_type = QMI_DATA_LEN,
33 .elem_len = 1,
34 .elem_size = sizeof(uint8_t),
35 .is_array = NO_ARRAY,
36 .tlv_type = QMI_COMMON_TLV_TYPE,
37 .offset = offsetof(struct test_name_type_v01,
38 name_len),
39 },
40 {
41 .data_type = QMI_UNSIGNED_1_BYTE,
42 .elem_len = TEST_MAX_NAME_SIZE_V01,
43 .elem_size = sizeof(char),
44 .is_array = VAR_LEN_ARRAY,
45 .tlv_type = QMI_COMMON_TLV_TYPE,
46 .offset = offsetof(struct test_name_type_v01,
47 name),
48 },
49 {
50 .data_type = QMI_EOTI,
51 .is_array = NO_ARRAY,
52 .tlv_type = QMI_COMMON_TLV_TYPE,
53 },
54};
55
56struct elem_info test_ping_req_msg_v01_ei[] = {
57 {
58 .data_type = QMI_UNSIGNED_1_BYTE,
59 .elem_len = 4,
60 .elem_size = sizeof(char),
61 .is_array = STATIC_ARRAY,
62 .tlv_type = PING_REQ1_TLV_TYPE,
63 .offset = offsetof(struct test_ping_req_msg_v01,
64 ping),
65 },
66 {
67 .data_type = QMI_OPT_FLAG,
68 .elem_len = 1,
69 .elem_size = sizeof(uint8_t),
70 .is_array = NO_ARRAY,
71 .tlv_type = PING_OPT1_TLV_TYPE,
72 .offset = offsetof(struct test_ping_req_msg_v01,
73 client_name_valid),
74 },
75 {
76 .data_type = QMI_STRUCT,
77 .elem_len = 1,
78 .elem_size = sizeof(struct test_name_type_v01),
79 .is_array = NO_ARRAY,
80 .tlv_type = PING_OPT1_TLV_TYPE,
81 .offset = offsetof(struct test_ping_req_msg_v01,
82 client_name),
83 .ei_array = test_name_type_v01_ei,
84 },
85 {
86 .data_type = QMI_EOTI,
87 .is_array = NO_ARRAY,
88 .tlv_type = QMI_COMMON_TLV_TYPE,
89 },
90};
91
92struct elem_info test_ping_resp_msg_v01_ei[] = {
93 {
94 .data_type = QMI_STRUCT,
95 .elem_len = 1,
96 .elem_size = sizeof(struct qmi_response_type_v01),
97 .is_array = NO_ARRAY,
98 .tlv_type = PING_RESP1_TLV_TYPE,
99 .offset = offsetof(struct test_ping_resp_msg_v01,
100 resp),
101 .ei_array = get_qmi_response_type_v01_ei(),
102 },
103 {
104 .data_type = QMI_OPT_FLAG,
105 .elem_len = 1,
106 .elem_size = sizeof(uint8_t),
107 .is_array = NO_ARRAY,
108 .tlv_type = PING_OPT1_TLV_TYPE,
109 .offset = offsetof(struct test_ping_resp_msg_v01,
110 pong_valid),
111 },
112 {
113 .data_type = QMI_UNSIGNED_1_BYTE,
114 .elem_len = 4,
115 .elem_size = sizeof(char),
116 .is_array = STATIC_ARRAY,
117 .tlv_type = PING_OPT1_TLV_TYPE,
118 .offset = offsetof(struct test_ping_resp_msg_v01,
119 pong),
120 },
121 {
122 .data_type = QMI_OPT_FLAG,
123 .elem_len = 1,
124 .elem_size = sizeof(uint8_t),
125 .is_array = NO_ARRAY,
126 .tlv_type = PING_OPT2_TLV_TYPE,
127 .offset = offsetof(struct test_ping_resp_msg_v01,
128 service_name_valid),
129 },
130 {
131 .data_type = QMI_STRUCT,
132 .elem_len = 1,
133 .elem_size = sizeof(struct test_name_type_v01),
134 .is_array = NO_ARRAY,
135 .tlv_type = PING_OPT2_TLV_TYPE,
136 .offset = offsetof(struct test_ping_resp_msg_v01,
137 service_name),
138 .ei_array = test_name_type_v01_ei,
139 },
140 {
141 .data_type = QMI_EOTI,
142 .is_array = NO_ARRAY,
143 .tlv_type = QMI_COMMON_TLV_TYPE,
144 },
145};
146
147struct elem_info test_data_req_msg_v01_ei[] = {
148 {
149 .data_type = QMI_DATA_LEN,
150 .elem_len = 1,
151 .elem_size = sizeof(uint32_t),
152 .is_array = NO_ARRAY,
153 .tlv_type = DATA_REQ1_TLV_TYPE,
154 .offset = offsetof(struct test_data_req_msg_v01,
155 data_len),
156 },
157 {
158 .data_type = QMI_UNSIGNED_1_BYTE,
159 .elem_len = TEST_MED_DATA_SIZE_V01,
160 .elem_size = sizeof(uint8_t),
161 .is_array = VAR_LEN_ARRAY,
162 .tlv_type = DATA_REQ1_TLV_TYPE,
163 .offset = offsetof(struct test_data_req_msg_v01,
164 data),
165 },
166 {
167 .data_type = QMI_OPT_FLAG,
168 .elem_len = 1,
169 .elem_size = sizeof(uint8_t),
170 .is_array = NO_ARRAY,
171 .tlv_type = DATA_OPT1_TLV_TYPE,
172 .offset = offsetof(struct test_data_req_msg_v01,
173 client_name_valid),
174 },
175 {
176 .data_type = QMI_STRUCT,
177 .elem_len = 1,
178 .elem_size = sizeof(struct test_name_type_v01),
179 .is_array = NO_ARRAY,
180 .tlv_type = DATA_OPT1_TLV_TYPE,
181 .offset = offsetof(struct test_data_req_msg_v01,
182 client_name),
183 .ei_array = test_name_type_v01_ei,
184 },
185 {
186 .data_type = QMI_EOTI,
187 .is_array = NO_ARRAY,
188 .tlv_type = QMI_COMMON_TLV_TYPE,
189 },
190};
191
192struct elem_info test_data_resp_msg_v01_ei[] = {
193 {
194 .data_type = QMI_STRUCT,
195 .elem_len = 1,
196 .elem_size = sizeof(struct qmi_response_type_v01),
197 .is_array = NO_ARRAY,
198 .tlv_type = DATA_RESP1_TLV_TYPE,
199 .offset = offsetof(struct test_data_resp_msg_v01,
200 resp),
201 .ei_array = get_qmi_response_type_v01_ei(),
202 },
203 {
204 .data_type = QMI_OPT_FLAG,
205 .elem_len = 1,
206 .elem_size = sizeof(uint8_t),
207 .is_array = NO_ARRAY,
208 .tlv_type = DATA_OPT1_TLV_TYPE,
209 .offset = offsetof(struct test_data_resp_msg_v01,
210 data_valid),
211 },
212 {
213 .data_type = QMI_DATA_LEN,
214 .elem_len = 1,
215 .elem_size = sizeof(uint32_t),
216 .is_array = NO_ARRAY,
217 .tlv_type = DATA_OPT1_TLV_TYPE,
218 .offset = offsetof(struct test_data_resp_msg_v01,
219 data_len),
220 },
221 {
222 .data_type = QMI_UNSIGNED_1_BYTE,
223 .elem_len = TEST_MED_DATA_SIZE_V01,
224 .elem_size = sizeof(uint8_t),
225 .is_array = VAR_LEN_ARRAY,
226 .tlv_type = DATA_OPT1_TLV_TYPE,
227 .offset = offsetof(struct test_data_resp_msg_v01,
228 data),
229 },
230 {
231 .data_type = QMI_OPT_FLAG,
232 .elem_len = 1,
233 .elem_size = sizeof(uint8_t),
234 .is_array = NO_ARRAY,
235 .tlv_type = DATA_OPT2_TLV_TYPE,
236 .offset = offsetof(struct test_data_resp_msg_v01,
237 service_name_valid),
238 },
239 {
240 .data_type = QMI_STRUCT,
241 .elem_len = 1,
242 .elem_size = sizeof(struct test_name_type_v01),
243 .is_array = NO_ARRAY,
244 .tlv_type = DATA_OPT2_TLV_TYPE,
245 .offset = offsetof(struct test_data_resp_msg_v01,
246 service_name),
247 .ei_array = test_name_type_v01_ei,
248 },
249 {
250 .data_type = QMI_EOTI,
251 .is_array = NO_ARRAY,
252 .tlv_type = QMI_COMMON_TLV_TYPE,
253 },
254};