Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 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. |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 14 | */ |
| 15 | |
Mauro Carvalho Chehab | 47f7912 | 2014-08-12 18:50:22 -0300 | [diff] [blame] | 16 | #ifndef _AS102_DRV_H |
| 17 | #define _AS102_DRV_H |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 18 | #include <linux/usb.h> |
Mauro Carvalho Chehab | fada193 | 2017-12-28 13:03:51 -0500 | [diff] [blame^] | 19 | #include <media/dvb_demux.h> |
| 20 | #include <media/dvb_frontend.h> |
| 21 | #include <media/dmxdev.h> |
Mauro Carvalho Chehab | 47f7912 | 2014-08-12 18:50:22 -0300 | [diff] [blame] | 22 | #include "as10x_handle.h" |
Sylwester Nawrocki | 82aae98 | 2011-11-06 16:31:40 -0300 | [diff] [blame] | 23 | #include "as10x_cmd.h" |
| 24 | #include "as102_usb_drv.h" |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 25 | |
| 26 | #define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" |
| 27 | #define DRIVER_NAME "as10x_usb" |
| 28 | |
Randy Dunlap | d29387e | 2011-11-16 18:17:03 -0800 | [diff] [blame] | 29 | #define debug as102_debug |
Sylwester Nawrocki | 82aae98 | 2011-11-06 16:31:40 -0300 | [diff] [blame] | 30 | extern struct usb_driver as102_usb_driver; |
Sylwester Nawrocki | a117263 | 2011-11-06 16:31:48 -0300 | [diff] [blame] | 31 | extern int elna_enable; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 32 | |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 33 | #define AS102_DEVICE_MAJOR 192 |
| 34 | |
| 35 | #define AS102_USB_BUF_SIZE 512 |
| 36 | #define MAX_STREAM_URB 32 |
| 37 | |
Sylwester Nawrocki | 34490a0 | 2011-11-06 16:31:50 -0300 | [diff] [blame] | 38 | struct as10x_bus_adapter_t { |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 39 | struct usb_device *usb_dev; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 40 | /* bus token lock */ |
| 41 | struct mutex lock; |
| 42 | /* low level interface for bus adapter */ |
| 43 | union as10x_bus_token_t { |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 44 | /* usb token */ |
| 45 | struct as10x_usb_token_cmd_t usb; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 46 | } token; |
| 47 | |
| 48 | /* token cmd xfer id */ |
| 49 | uint16_t cmd_xid; |
| 50 | |
| 51 | /* as10x command and response for dvb interface*/ |
| 52 | struct as10x_cmd_t *cmd, *rsp; |
| 53 | |
| 54 | /* bus adapter private ops callback */ |
Julia Lawall | f691ba9 | 2015-12-06 13:51:38 -0200 | [diff] [blame] | 55 | const struct as102_priv_ops_t *ops; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | struct as102_dev_t { |
Devin Heitmueller | 4f7b7c0 | 2011-10-31 12:24:48 -0300 | [diff] [blame] | 59 | const char *name; |
Sylwester Nawrocki | 34490a0 | 2011-11-06 16:31:50 -0300 | [diff] [blame] | 60 | struct as10x_bus_adapter_t bus_adap; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 61 | struct list_head device_entry; |
| 62 | struct kref kref; |
Gianluca Gennari | abfac0b | 2012-03-06 09:47:46 -0300 | [diff] [blame] | 63 | uint8_t elna_cfg; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 64 | |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 65 | struct dvb_adapter dvb_adap; |
Mauro Carvalho Chehab | b601d9a | 2014-08-12 18:50:19 -0300 | [diff] [blame] | 66 | struct dvb_frontend *dvb_fe; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 67 | struct dvb_demux dvb_dmx; |
| 68 | struct dmxdev dvb_dmxdev; |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 69 | |
Pierrick Hascoet | 41b44e0 | 2011-10-31 12:24:39 -0300 | [diff] [blame] | 70 | /* timer handle to trig ts stream download */ |
| 71 | struct timer_list timer_handle; |
| 72 | |
| 73 | struct mutex sem; |
| 74 | dma_addr_t dma_addr; |
| 75 | void *stream; |
| 76 | int streaming; |
| 77 | struct urb *stream_urb[MAX_STREAM_URB]; |
| 78 | }; |
| 79 | |
| 80 | int as102_dvb_register(struct as102_dev_t *dev); |
| 81 | void as102_dvb_unregister(struct as102_dev_t *dev); |
| 82 | |
Mauro Carvalho Chehab | 289297b | 2014-09-24 09:59:02 -0300 | [diff] [blame] | 83 | #endif |