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
102 /* request identifier */
107 /* response identifier */
117 /* request identifier */
122 /* response identifier */
132 /* request identifier */
135 struct as10x_tune_args args;
139 /* response identifier */
149 /* request identifier */
154 /* response identifier */
159 struct as10x_tune_status sts;
166 /* request identifier */
171 /* response identifier */
176 struct as10x_tps tps;
183 /* request identifier */
188 /* response identifier */
198 /* request identifier */
202 /* stream type (MPE, PSI/SI or PES )*/
204 /* PID index in filter table */
209 /* response identifier */
221 /* request identifier */
228 /* response identifier */
238 /* request identifier */
243 /* response identifier */
253 /* request identifier */
258 /* response identifier */
268 /* request identifier */
273 /* response identifier */
278 struct as10x_demod_stats stats;
285 /* request identifier */
290 /* response identifier */
294 /* impulse response ready */
302 /* request identifier */
304 /* value to write (for set context)*/
305 struct as10x_register_value reg_val;
308 /* context request type */
313 /* response identifier */
315 /* value read (for get context) */
316 struct as10x_register_value reg_val;
317 /* context request type */
327 /* response identifier */
329 /* register description */
330 struct as10x_register_addr reg_addr;
331 /* register content */
332 struct as10x_register_value reg_val;
336 /* response identifier */
346 /* response identifier */
348 /* register description */
349 struct as10x_register_addr reg_addr;
353 /* response identifier */
357 /* register content */
358 struct as10x_register_value reg_val;
365 /* request identifier */
372 /* response identifier */
379 struct as10x_cmd_header_t {
386 #define DUMP_BLOCK_SIZE 16
390 /* request identifier */
392 /* dump memory type request */
394 /* register description */
395 struct as10x_register_addr reg_addr;
396 /* nb blocks to read */
401 /* response identifier */
409 uint8_t data8[DUMP_BLOCK_SIZE];
410 uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)];
411 uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)];
418 /* request identifier */
420 /* dump memory type request */
424 /* request identifier */
431 uint8_t data[DUMP_BLOCK_SIZE];
439 uint8_t data[64 - sizeof(struct as10x_cmd_header_t) -2 /* proc_id */];
445 uint8_t data[64 - sizeof(struct as10x_cmd_header_t) /* header */
446 - 2 /* proc_id */ - 1 /* rc */];
452 struct as10x_cmd_header_t header;
458 GET_TUNE_STATUS get_tune_status;
461 ADD_PID_FILTER add_pid_filter;
462 DEL_PID_FILTER del_pid_filter;
463 START_STREAMING start_streaming;
464 STOP_STREAMING stop_streaming;
465 GET_DEMOD_STATS get_demod_stats;
466 GET_IMPULSE_RESP get_impulse_rsp;
468 SET_REGISTER set_register;
469 GET_REGISTER get_register;
470 CFG_CHANGE_MODE cfg_change_mode;
471 DUMP_MEMORY dump_memory;
472 DUMPLOG_MEMORY dumplog_memory;
477 struct as10x_token_cmd_t {
479 struct as10x_cmd_t c;
481 struct as10x_cmd_t r;
486 /**************************/
487 /* FUNCTION DECLARATION */
488 /**************************/
490 void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
492 int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id);
499 int as10x_cmd_turn_on(as10x_handle_t *phandle);
500 int as10x_cmd_turn_off(as10x_handle_t *phandle);
502 int as10x_cmd_set_tune(as10x_handle_t *phandle,
503 struct as10x_tune_args *ptune);
505 int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
506 struct as10x_tune_status *pstatus);
508 int as10x_cmd_get_tps(as10x_handle_t *phandle,
509 struct as10x_tps *ptps);
511 int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
512 struct as10x_demod_stats *pdemod_stats);
514 int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
517 /* as10x cmd stream */
518 int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
519 struct as10x_ts_filter *filter);
520 int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
523 int as10x_cmd_start_streaming(as10x_handle_t *phandle);
524 int as10x_cmd_stop_streaming(as10x_handle_t *phandle);
527 int as10x_cmd_set_context(as10x_handle_t *phandle,
530 int as10x_cmd_get_context(as10x_handle_t *phandle,
534 int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode);
535 int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id);
540 /* EOF - vim: set textwidth=80 ts=3 sw=3 sts=3 et: */