Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
as10x_cmd.h
Go to the documentation of this file.
1 /*
2  * Abilis Systems Single DVB-T Receiver
3  * Copyright (C) 2008 Pierrick Hascoet <[email protected]>
4  *
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)
8  * any later version.
9  *
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.
14  *
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.
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 /* MACRO DEFINITIONS */
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 /* context request types */
42 #define GET_CONTEXT_DATA 1
43 #define SET_CONTEXT_DATA 2
44 
45 /* ODSP suspend modes */
46 #define CFG_MODE_ODSP_RESUME 0
47 #define CFG_MODE_ODSP_SUSPEND 1
48 
49 /* Dump memory size */
50 #define DUMP_BLOCK_SIZE_MAX 0x20
51 
52 /*********************************/
53 /* TYPE DEFINITION */
54 /*********************************/
86 
95 };
96 
98  /* request */
99  struct {
100  /* request identifier */
102  } __packed req;
103  /* response */
104  struct {
105  /* response identifier */
107  /* error */
109  } __packed rsp;
110 } __packed;
111 
113  /* request */
114  struct {
115  /* request identifier */
117  } __packed req;
118  /* response */
119  struct {
120  /* response identifier */
122  /* error */
124  } __packed rsp;
125 } __packed;
126 
128  /* request */
129  struct {
130  /* request identifier */
132  /* tune params */
134  } __packed req;
135  /* response */
136  struct {
137  /* response identifier */
139  /* response error */
141  } __packed rsp;
142 } __packed;
143 
145  /* request */
146  struct {
147  /* request identifier */
149  } __packed req;
150  /* response */
151  struct {
152  /* response identifier */
154  /* response error */
156  /* tune status */
158  } __packed rsp;
159 } __packed;
160 
162  /* request */
163  struct {
164  /* request identifier */
166  } __packed req;
167  /* response */
168  struct {
169  /* response identifier */
171  /* response error */
173  /* tps details */
174  struct as10x_tps tps;
175  } __packed rsp;
176 } __packed;
177 
179  /* request */
180  struct {
181  /* request identifier */
183  } __packed req;
184  /* response */
185  struct {
186  /* response identifier */
188  /* response error */
190  } __packed rsp;
191 } __packed;
192 
194  /* request */
195  struct {
196  /* request identifier */
198  /* PID to filter */
200  /* stream type (MPE, PSI/SI or PES )*/
202  /* PID index in filter table */
204  } __packed req;
205  /* response */
206  struct {
207  /* response identifier */
209  /* response error */
211  /* Filter id */
213  } __packed rsp;
214 } __packed;
215 
217  /* request */
218  struct {
219  /* request identifier */
221  /* PID to remove */
223  } __packed req;
224  /* response */
225  struct {
226  /* response identifier */
228  /* response error */
230  } __packed rsp;
231 } __packed;
232 
234  /* request */
235  struct {
236  /* request identifier */
238  } __packed req;
239  /* response */
240  struct {
241  /* response identifier */
243  /* error */
245  } __packed rsp;
246 } __packed;
247 
249  /* request */
250  struct {
251  /* request identifier */
253  } __packed req;
254  /* response */
255  struct {
256  /* response identifier */
258  /* error */
260  } __packed rsp;
261 } __packed;
262 
264  /* request */
265  struct {
266  /* request identifier */
268  } __packed req;
269  /* response */
270  struct {
271  /* response identifier */
273  /* error */
275  /* demod stats */
277  } __packed rsp;
278 } __packed;
279 
281  /* request */
282  struct {
283  /* request identifier */
285  } __packed req;
286  /* response */
287  struct {
288  /* response identifier */
290  /* error */
292  /* impulse response ready */
294  } __packed rsp;
295 } __packed;
296 
298  /* request */
299  struct {
300  /* request identifier */
302  /* value to write (for set context)*/
304  /* context tag */
306  /* context request type */
308  } __packed req;
309  /* response */
310  struct {
311  /* response identifier */
313  /* value read (for get context) */
314  struct as10x_register_value reg_val;
315  /* context request type */
316  uint16_t type;
317  /* error */
319  } __packed rsp;
320 } __packed;
321 
323  /* request */
324  struct {
325  /* response identifier */
327  /* register description */
329  /* register content */
331  } __packed req;
332  /* response */
333  struct {
334  /* response identifier */
336  /* error */
338  } __packed rsp;
339 } __packed;
340 
342  /* request */
343  struct {
344  /* response identifier */
346  /* register description */
348  } __packed req;
349  /* response */
350  struct {
351  /* response identifier */
353  /* error */
355  /* register content */
357  } __packed rsp;
358 } __packed;
359 
361  /* request */
362  struct {
363  /* request identifier */
365  /* mode */
367  } __packed req;
368  /* response */
369  struct {
370  /* response identifier */
372  /* error */
374  } __packed rsp;
375 } __packed;
376 
382 } __packed;
383 
384 #define DUMP_BLOCK_SIZE 16
385 
387  /* request */
388  struct {
389  /* request identifier */
391  /* dump memory type request */
393  /* register description */
395  /* nb blocks to read */
397  } __packed req;
398  /* response */
399  struct {
400  /* response identifier */
402  /* error */
404  /* dump response */
406  /* data */
407  union {
411  } __packed u;
412  } __packed rsp;
413 } __packed;
414 
416  struct {
417  /* request identifier */
419  /* dump memory type request */
421  } __packed req;
422  struct {
423  /* request identifier */
425  /* error */
427  /* dump response */
429  /* dump data */
431  } __packed rsp;
432 } __packed;
433 
435  /* request */
436  struct {
438  uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
439  - 2 /* proc_id */];
440  } __packed req;
441  /* response */
442  struct {
445  uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
446  - 2 /* proc_id */ - 1 /* rc */];
447  } __packed rsp;
448 } __packed;
449 
450 struct as10x_cmd_t {
452  union {
472  } __packed body;
473 } __packed;
474 
476  /* token cmd */
477  struct as10x_cmd_t c;
478  /* token response */
479  struct as10x_cmd_t r;
480 } __packed;
481 
482 
483 /**************************/
484 /* FUNCTION DECLARATION */
485 /**************************/
486 
487 void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
488  uint16_t cmd_len);
490 
491 /* as10x cmd */
492 int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
493 int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
494 
495 int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
496  struct as10x_tune_args *ptune);
497 
499  struct as10x_tune_status *pstatus);
500 
501 int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
502  struct as10x_tps *ptps);
503 
505  struct as10x_demod_stats *pdemod_stats);
506 
508  uint8_t *is_ready);
509 
510 /* as10x cmd stream */
512  struct as10x_ts_filter *filter);
514  uint16_t pid_value);
515 
518 
519 /* as10x cmd cfg */
521  uint16_t tag,
522  uint32_t value);
524  uint16_t tag,
525  uint32_t *pvalue);
526 
529 #endif