Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
as102_drv.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 
20 #include <linux/usb.h>
21 #include <dvb_demux.h>
22 #include <dvb_frontend.h>
23 #include <dmxdev.h>
24 #include "as10x_cmd.h"
25 #include "as102_usb_drv.h"
26 
27 #define DRIVER_FULL_NAME "Abilis Systems as10x usb driver"
28 #define DRIVER_NAME "as10x_usb"
29 
30 extern int as102_debug;
31 #define debug as102_debug
32 extern struct usb_driver as102_usb_driver;
33 extern int elna_enable;
34 
35 #define dprintk(debug, args...) \
36  do { if (debug) { \
37  pr_debug("%s: ", __func__); \
38  printk(args); \
39  } } while (0)
40 
41 #ifdef TRACE
42 #define ENTER() pr_debug(">> enter %s\n", __func__)
43 #define LEAVE() pr_debug("<< leave %s\n", __func__)
44 #else
45 #define ENTER()
46 #define LEAVE()
47 #endif
48 
49 #define AS102_DEVICE_MAJOR 192
50 
51 #define AS102_USB_BUF_SIZE 512
52 #define MAX_STREAM_URB 32
53 
55  struct usb_device *usb_dev;
56  /* bus token lock */
57  struct mutex lock;
58  /* low level interface for bus adapter */
60  /* usb token */
62  } token;
63 
64  /* token cmd xfer id */
66 
67  /* as10x command and response for dvb interface*/
68  struct as10x_cmd_t *cmd, *rsp;
69 
70  /* bus adapter private ops callback */
71  struct as102_priv_ops_t *ops;
72 };
73 
74 struct as102_dev_t {
75  const char *name;
78  struct kref kref;
80 
85 
86  /* demodulator stats */
88  /* signal strength */
90  /* bit error rate */
92 
93  /* timer handle to trig ts stream download */
95 
96  struct mutex sem;
98  void *stream;
99  int streaming;
101 };
102 
103 int as102_dvb_register(struct as102_dev_t *dev);
104 void as102_dvb_unregister(struct as102_dev_t *dev);
105 
106 int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe);