2 * Abilis Systems Single DVB-T Receiver
3 * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <linux/kernel.h>
26 #include "as10x_types.h"
28 /*********************************/
29 /* MACRO DEFINITIONS */
30 /*********************************/
31 #define AS10X_CMD_ERROR -1
33 #define SERVICE_PROG_ID 0x0002
34 #define SERVICE_PROG_VERSION 0x0001
36 #define HIER_NONE 0x00
37 #define HIER_LOW_PRIORITY 0x01
39 #define HEADER_SIZE (sizeof(struct as10x_cmd_header_t))
41 /* context request types */
42 #define GET_CONTEXT_DATA 1
43 #define SET_CONTEXT_DATA 2
45 /* ODSP suspend modes */
46 #define CFG_MODE_ODSP_RESUME 0
47 #define CFG_MODE_ODSP_SUSPEND 1
49 /* Dump memory size */
50 #define DUMP_BLOCK_SIZE_MAX 0x20
52 /*********************************/
54 /*********************************/
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,
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
100 /* request identifier */
105 /* response identifier */
112 union as10x_turn_off {
115 /* request identifier */
120 /* response identifier */
127 union as10x_set_tune {
130 /* request identifier */
133 struct as10x_tune_args args;
137 /* response identifier */
144 union as10x_get_tune_status {
147 /* request identifier */
152 /* response identifier */
157 struct as10x_tune_status sts;
161 union as10x_get_tps {
164 /* request identifier */
169 /* response identifier */
174 struct as10x_tps tps;
181 /* request identifier */
186 /* response identifier */
193 union as10x_add_pid_filter {
196 /* request identifier */
200 /* stream type (MPE, PSI/SI or PES )*/
202 /* PID index in filter table */
207 /* response identifier */
216 union as10x_del_pid_filter {
219 /* request identifier */
226 /* response identifier */
233 union as10x_start_streaming {
236 /* request identifier */
241 /* response identifier */
248 union as10x_stop_streaming {
251 /* request identifier */
256 /* response identifier */
263 union as10x_get_demod_stats {
266 /* request identifier */
271 /* response identifier */
276 struct as10x_demod_stats stats;
280 union as10x_get_impulse_resp {
283 /* request identifier */
288 /* response identifier */
292 /* impulse response ready */
297 union as10x_fw_context {
300 /* request identifier */
302 /* value to write (for set context)*/
303 struct as10x_register_value reg_val;
306 /* context request type */
311 /* response identifier */
313 /* value read (for get context) */
314 struct as10x_register_value reg_val;
315 /* context request type */
322 union as10x_set_register {
325 /* response identifier */
327 /* register description */
328 struct as10x_register_addr reg_addr;
329 /* register content */
330 struct as10x_register_value reg_val;
334 /* response identifier */
341 union as10x_get_register {
344 /* response identifier */
346 /* register description */
347 struct as10x_register_addr reg_addr;
351 /* response identifier */
355 /* register content */
356 struct as10x_register_value reg_val;
360 union as10x_cfg_change_mode {
363 /* request identifier */
370 /* response identifier */
377 struct as10x_cmd_header_t {
384 #define DUMP_BLOCK_SIZE 16
386 union as10x_dump_memory {
389 /* request identifier */
391 /* dump memory type request */
393 /* register description */
394 struct as10x_register_addr reg_addr;
395 /* nb blocks to read */
400 /* response identifier */
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)];
415 union as10x_dumplog_memory {
417 /* request identifier */
419 /* dump memory type request */
423 /* request identifier */
430 uint8_t data[DUMP_BLOCK_SIZE];
434 union as10x_raw_data {
438 uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
445 uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
446 - 2 /* proc_id */ - 1 /* rc */];
451 struct as10x_cmd_header_t header;
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;
475 struct as10x_token_cmd_t {
477 struct as10x_cmd_t c;
479 struct as10x_cmd_t r;
483 /**************************/
484 /* FUNCTION DECLARATION */
485 /**************************/
487 void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
489 int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id);
492 int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
493 int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
495 int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
496 struct as10x_tune_args *ptune);
498 int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
499 struct as10x_tune_status *pstatus);
501 int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
502 struct as10x_tps *ptps);
504 int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap,
505 struct as10x_demod_stats *pdemod_stats);
507 int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
510 /* as10x cmd stream */
511 int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
512 struct as10x_ts_filter *filter);
513 int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
516 int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap);
517 int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap);
520 int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap,
523 int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap,
527 int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode);
528 int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id);