1 /* 2 * Abilis Systems Single DVB-T Receiver 3 * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> 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 #define debug as102_debug 31 extern struct usb_driver as102_usb_driver; 32 extern int elna_enable; 33 34 #define AS102_DEVICE_MAJOR 192 35 36 #define AS102_USB_BUF_SIZE 512 37 #define MAX_STREAM_URB 32 38 39 struct as10x_bus_adapter_t { 40 struct usb_device *usb_dev; 41 /* bus token lock */ 42 struct mutex lock; 43 /* low level interface for bus adapter */ 44 union as10x_bus_token_t { 45 /* usb token */ 46 struct as10x_usb_token_cmd_t usb; 47 } token; 48 49 /* token cmd xfer id */ 50 uint16_t cmd_xid; 51 52 /* as10x command and response for dvb interface*/ 53 struct as10x_cmd_t *cmd, *rsp; 54 55 /* bus adapter private ops callback */ 56 struct as102_priv_ops_t *ops; 57 }; 58 59 struct as102_dev_t { 60 const char *name; 61 struct as10x_bus_adapter_t bus_adap; 62 struct list_head device_entry; 63 struct kref kref; 64 uint8_t elna_cfg; 65 66 struct dvb_adapter dvb_adap; 67 struct dvb_frontend dvb_fe; 68 struct dvb_demux dvb_dmx; 69 struct dmxdev dvb_dmxdev; 70 71 /* demodulator stats */ 72 struct as10x_demod_stats demod_stats; 73 /* signal strength */ 74 uint16_t signal_strength; 75 /* bit error rate */ 76 uint32_t ber; 77 78 /* timer handle to trig ts stream download */ 79 struct timer_list timer_handle; 80 81 struct mutex sem; 82 dma_addr_t dma_addr; 83 void *stream; 84 int streaming; 85 struct urb *stream_urb[MAX_STREAM_URB]; 86 }; 87 88 int as102_dvb_register(struct as102_dev_t *dev); 89 void as102_dvb_unregister(struct as102_dev_t *dev); 90 91 int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe); 92 int as102_dvb_unregister_fe(struct dvb_frontend *dev); 93