1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _AS10X_CMD_H_
20#define _AS10X_CMD_H_
21
22#ifdef __KERNEL__
23#include <linux/kernel.h>
24#endif
25
26#include "as10x_types.h"
27
28
29
30
31#define AS10X_CMD_ERROR -1
32
33#define SERVICE_PROG_ID 0x0002
34#define SERVICE_PROG_VERSION 0x0001
35
36#define HIER_NONE 0x00
37#define HIER_LOW_PRIORITY 0x01
38
39#define HEADER_SIZE (sizeof(struct as10x_cmd_header_t))
40
41
42#define GET_CONTEXT_DATA 1
43#define SET_CONTEXT_DATA 2
44
45
46#define CFG_MODE_ODSP_RESUME 0
47#define CFG_MODE_ODSP_SUSPEND 1
48
49
50#define DUMP_BLOCK_SIZE_MAX 0x20
51
52
53
54
55enum control_proc {
56 CONTROL_PROC_TURNON = 0x0001,
57 CONTROL_PROC_TURNON_RSP = 0x0100,
58 CONTROL_PROC_SET_REGISTER = 0x0002,
59 CONTROL_PROC_SET_REGISTER_RSP = 0x0200,
60 CONTROL_PROC_GET_REGISTER = 0x0003,
61 CONTROL_PROC_GET_REGISTER_RSP = 0x0300,
62 CONTROL_PROC_SETTUNE = 0x000A,
63 CONTROL_PROC_SETTUNE_RSP = 0x0A00,
64 CONTROL_PROC_GETTUNESTAT = 0x000B,
65 CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00,
66 CONTROL_PROC_GETTPS = 0x000D,
67 CONTROL_PROC_GETTPS_RSP = 0x0D00,
68 CONTROL_PROC_SETFILTER = 0x000E,
69 CONTROL_PROC_SETFILTER_RSP = 0x0E00,
70 CONTROL_PROC_REMOVEFILTER = 0x000F,
71 CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00,
72 CONTROL_PROC_GET_IMPULSE_RESP = 0x0012,
73 CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200,
74 CONTROL_PROC_START_STREAMING = 0x0013,
75 CONTROL_PROC_START_STREAMING_RSP = 0x1300,
76 CONTROL_PROC_STOP_STREAMING = 0x0014,
77 CONTROL_PROC_STOP_STREAMING_RSP = 0x1400,
78 CONTROL_PROC_GET_DEMOD_STATS = 0x0015,
79 CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500,
80 CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016,
81 CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600,
82 CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017,
83 CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700,
84 CONTROL_PROC_AGC_CHANGE_MODE = 0x0018,
85 CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800,
86
87 CONTROL_PROC_CONTEXT = 0x00FC,
88 CONTROL_PROC_CONTEXT_RSP = 0xFC00,
89 CONTROL_PROC_DUMP_MEMORY = 0x00FD,
90 CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00,
91 CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE,
92 CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00,
93 CONTROL_PROC_TURNOFF = 0x00FF,
94 CONTROL_PROC_TURNOFF_RSP = 0xFF00
95};
96
97union as10x_turn_on {
98
99 struct {
100
101 uint16_t proc_id;
102 } __packed req;
103
104 struct {
105
106 uint16_t proc_id;
107
108 uint8_t error;
109 } __packed rsp;
110} __packed;
111
112union as10x_turn_off {
113
114 struct {
115
116 uint16_t proc_id;
117 } __packed req;
118
119 struct {
120
121 uint16_t proc_id;
122
123 uint8_t err;
124 } __packed rsp;
125} __packed;
126
127union as10x_set_tune {
128
129 struct {
130
131 uint16_t proc_id;
132
133 struct as10x_tune_args args;
134 } __packed req;
135
136 struct {
137
138 uint16_t proc_id;
139
140 uint8_t error;
141 } __packed rsp;
142} __packed;
143
144union as10x_get_tune_status {
145
146 struct {
147
148 uint16_t proc_id;
149 } __packed req;
150
151 struct {
152
153 uint16_t proc_id;
154
155 uint8_t error;
156
157 struct as10x_tune_status sts;
158 } __packed rsp;
159} __packed;
160
161union as10x_get_tps {
162
163 struct {
164
165 uint16_t proc_id;
166 } __packed req;
167
168 struct {
169
170 uint16_t proc_id;
171
172 uint8_t error;
173
174 struct as10x_tps tps;
175 } __packed rsp;
176} __packed;
177
178union as10x_common {
179
180 struct {
181
182 uint16_t proc_id;
183 } __packed req;
184
185 struct {
186
187 uint16_t proc_id;
188
189 uint8_t error;
190 } __packed rsp;
191} __packed;
192
193union as10x_add_pid_filter {
194
195 struct {
196
197 uint16_t proc_id;
198
199 uint16_t pid;
200
201 uint8_t stream_type;
202
203 uint8_t idx;
204 } __packed req;
205
206 struct {
207
208 uint16_t proc_id;
209
210 uint8_t error;
211
212 uint8_t filter_id;
213 } __packed rsp;
214} __packed;
215
216union as10x_del_pid_filter {
217
218 struct {
219
220 uint16_t proc_id;
221
222 uint16_t pid;
223 } __packed req;
224
225 struct {
226
227 uint16_t proc_id;
228
229 uint8_t error;
230 } __packed rsp;
231} __packed;
232
233union as10x_start_streaming {
234
235 struct {
236
237 uint16_t proc_id;
238 } __packed req;
239
240 struct {
241
242 uint16_t proc_id;
243
244 uint8_t error;
245 } __packed rsp;
246} __packed;
247
248union as10x_stop_streaming {
249
250 struct {
251
252 uint16_t proc_id;
253 } __packed req;
254
255 struct {
256
257 uint16_t proc_id;
258
259 uint8_t error;
260 } __packed rsp;
261} __packed;
262
263union as10x_get_demod_stats {
264
265 struct {
266
267 uint16_t proc_id;
268 } __packed req;
269
270 struct {
271
272 uint16_t proc_id;
273
274 uint8_t error;
275
276 struct as10x_demod_stats stats;
277 } __packed rsp;
278} __packed;
279
280union as10x_get_impulse_resp {
281
282 struct {
283
284 uint16_t proc_id;
285 } __packed req;
286
287 struct {
288
289 uint16_t proc_id;
290
291 uint8_t error;
292
293 uint8_t is_ready;
294 } __packed rsp;
295} __packed;
296
297union as10x_fw_context {
298
299 struct {
300
301 uint16_t proc_id;
302
303 struct as10x_register_value reg_val;
304
305 uint16_t tag;
306
307 uint16_t type;
308 } __packed req;
309
310 struct {
311
312 uint16_t proc_id;
313
314 struct as10x_register_value reg_val;
315
316 uint16_t type;
317
318 uint8_t error;
319 } __packed rsp;
320} __packed;
321
322union as10x_set_register {
323
324 struct {
325
326 uint16_t proc_id;
327
328 struct as10x_register_addr reg_addr;
329
330 struct as10x_register_value reg_val;
331 } __packed req;
332
333 struct {
334
335 uint16_t proc_id;
336
337 uint8_t error;
338 } __packed rsp;
339} __packed;
340
341union as10x_get_register {
342
343 struct {
344
345 uint16_t proc_id;
346
347 struct as10x_register_addr reg_addr;
348 } __packed req;
349
350 struct {
351
352 uint16_t proc_id;
353
354 uint8_t error;
355
356 struct as10x_register_value reg_val;
357 } __packed rsp;
358} __packed;
359
360union as10x_cfg_change_mode {
361
362 struct {
363
364 uint16_t proc_id;
365
366 uint8_t mode;
367 } __packed req;
368
369 struct {
370
371 uint16_t proc_id;
372
373 uint8_t error;
374 } __packed rsp;
375} __packed;
376
377struct as10x_cmd_header_t {
378 uint16_t req_id;
379 uint16_t prog;
380 uint16_t version;
381 uint16_t data_len;
382} __packed;
383
384#define DUMP_BLOCK_SIZE 16
385
386union as10x_dump_memory {
387
388 struct {
389
390 uint16_t proc_id;
391
392 uint8_t dump_req;
393
394 struct as10x_register_addr reg_addr;
395
396 uint16_t num_blocks;
397 } __packed req;
398
399 struct {
400
401 uint16_t proc_id;
402
403 uint8_t error;
404
405 uint8_t dump_rsp;
406
407 union {
408 uint8_t data8[DUMP_BLOCK_SIZE];
409 uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)];
410 uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)];
411 } __packed u;
412 } __packed rsp;
413} __packed;
414
415union as10x_dumplog_memory {
416 struct {
417
418 uint16_t proc_id;
419
420 uint8_t dump_req;
421 } __packed req;
422 struct {
423
424 uint16_t proc_id;
425
426 uint8_t error;
427
428 uint8_t dump_rsp;
429
430 uint8_t data[DUMP_BLOCK_SIZE];
431 } __packed rsp;
432} __packed;
433
434union as10x_raw_data {
435
436 struct {
437 uint16_t proc_id;
438 uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
439 - 2 ];
440 } __packed req;
441
442 struct {
443 uint16_t proc_id;
444 uint8_t error;
445 uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
446 - 2 - 1 ];
447 } __packed rsp;
448} __packed;
449
450struct as10x_cmd_t {
451 struct as10x_cmd_header_t header;
452 union {
453 union as10x_turn_on turn_on;
454 union as10x_turn_off turn_off;
455 union as10x_set_tune set_tune;
456 union as10x_get_tune_status get_tune_status;
457 union as10x_get_tps get_tps;
458 union as10x_common common;
459 union as10x_add_pid_filter add_pid_filter;
460 union as10x_del_pid_filter del_pid_filter;
461 union as10x_start_streaming start_streaming;
462 union as10x_stop_streaming stop_streaming;
463 union as10x_get_demod_stats get_demod_stats;
464 union as10x_get_impulse_resp get_impulse_rsp;
465 union as10x_fw_context context;
466 union as10x_set_register set_register;
467 union as10x_get_register get_register;
468 union as10x_cfg_change_mode cfg_change_mode;
469 union as10x_dump_memory dump_memory;
470 union as10x_dumplog_memory dumplog_memory;
471 union as10x_raw_data raw_data;
472 } __packed body;
473} __packed;
474
475struct as10x_token_cmd_t {
476
477 struct as10x_cmd_t c;
478
479 struct as10x_cmd_t r;
480} __packed;
481
482
483
484
485
486
487void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
488 uint16_t cmd_len);
489int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id);
490
491
492int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
493int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
494
495int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
496 struct as10x_tune_args *ptune);
497
498int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
499 struct as10x_tune_status *pstatus);
500
501int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
502 struct as10x_tps *ptps);
503
504int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap,
505 struct as10x_demod_stats *pdemod_stats);
506
507int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
508 uint8_t *is_ready);
509
510
511int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
512 struct as10x_ts_filter *filter);
513int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
514 uint16_t pid_value);
515
516int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap);
517int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap);
518
519
520int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap,
521 uint16_t tag,
522 uint32_t value);
523int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap,
524 uint16_t tag,
525 uint32_t *pvalue);
526
527int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode);
528int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id);
529#endif
530