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 16 #include <linux/usb.h> 17 #include <dvb_demux.h> 18 #include <dvb_frontend.h> 19 #include <dmxdev.h> 20 #include "as10x_cmd.h" 21 #include "as102_usb_drv.h" 22 23 #define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" 24 #define DRIVER_NAME "as10x_usb" 25 26 #define debug as102_debug 27 extern struct usb_driver as102_usb_driver; 28 extern int elna_enable; 29 30 #define AS102_DEVICE_MAJOR 192 31 32 #define AS102_USB_BUF_SIZE 512 33 #define MAX_STREAM_URB 32 34 35 struct as10x_bus_adapter_t { 36 struct usb_device *usb_dev; 37 /* bus token lock */ 38 struct mutex lock; 39 /* low level interface for bus adapter */ 40 union as10x_bus_token_t { 41 /* usb token */ 42 struct as10x_usb_token_cmd_t usb; 43 } token; 44 45 /* token cmd xfer id */ 46 uint16_t cmd_xid; 47 48 /* as10x command and response for dvb interface*/ 49 struct as10x_cmd_t *cmd, *rsp; 50 51 /* bus adapter private ops callback */ 52 struct as102_priv_ops_t *ops; 53 }; 54 55 struct as102_dev_t { 56 const char *name; 57 struct as10x_bus_adapter_t bus_adap; 58 struct list_head device_entry; 59 struct kref kref; 60 uint8_t elna_cfg; 61 62 struct dvb_adapter dvb_adap; 63 struct dvb_frontend *dvb_fe; 64 struct dvb_demux dvb_dmx; 65 struct dmxdev dvb_dmxdev; 66 67 /* timer handle to trig ts stream download */ 68 struct timer_list timer_handle; 69 70 struct mutex sem; 71 dma_addr_t dma_addr; 72 void *stream; 73 int streaming; 74 struct urb *stream_urb[MAX_STREAM_URB]; 75 }; 76 77 int as102_dvb_register(struct as102_dev_t *dev); 78 void as102_dvb_unregister(struct as102_dev_t *dev); 79 80 /* FIXME: move it to a separate header */ 81 struct dvb_frontend *as102_attach(const char *name, 82 struct as10x_bus_adapter_t *bus_adap, 83 uint8_t elna_cfg); 84