Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * dvb_frontend.h |
| 3 | * |
| 4 | * Copyright (C) 2001 convergence integrated media GmbH |
| 5 | * Copyright (C) 2004 convergence GmbH |
| 6 | * |
| 7 | * Written by Ralph Metzler |
| 8 | * Overhauled by Holger Waechtler |
| 9 | * Kernel I2C stuff by Michael Hunold <hunold@convergence.de> |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Lesser General Public License |
| 13 | * as published by the Free Software Foundation; either version 2.1 |
| 14 | * of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | |
| 22 | * You should have received a copy of the GNU Lesser General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | #ifndef _DVB_FRONTEND_H_ |
| 29 | #define _DVB_FRONTEND_H_ |
| 30 | |
| 31 | #include <linux/types.h> |
| 32 | #include <linux/sched.h> |
| 33 | #include <linux/ioctl.h> |
| 34 | #include <linux/i2c.h> |
| 35 | #include <linux/module.h> |
| 36 | #include <linux/errno.h> |
| 37 | #include <linux/delay.h> |
| 38 | |
| 39 | #include <linux/dvb/frontend.h> |
| 40 | |
| 41 | #include "dvbdev.h" |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | struct dvb_frontend_tune_settings { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 44 | int min_delay_ms; |
| 45 | int step_size; |
| 46 | int max_drift; |
| 47 | struct dvb_frontend_parameters parameters; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | struct dvb_frontend; |
| 51 | |
| 52 | struct dvb_frontend_ops { |
| 53 | |
| 54 | struct dvb_frontend_info info; |
| 55 | |
| 56 | void (*release)(struct dvb_frontend* fe); |
| 57 | |
| 58 | int (*init)(struct dvb_frontend* fe); |
| 59 | int (*sleep)(struct dvb_frontend* fe); |
| 60 | |
Andrew de Quincey | 36cb557 | 2006-01-09 15:25:07 -0200 | [diff] [blame] | 61 | /* if this is set, it overrides the default swzigzag */ |
| 62 | int (*tune)(struct dvb_frontend* fe, |
| 63 | struct dvb_frontend_parameters* params, |
| 64 | unsigned int mode_flags, |
| 65 | int *delay, |
| 66 | fe_status_t *status); |
| 67 | |
| 68 | /* these two are only used for the swzigzag code */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | int (*set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings); |
| 71 | |
Andrew de Quincey | 36cb557 | 2006-01-09 15:25:07 -0200 | [diff] [blame] | 72 | int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); |
| 73 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | int (*read_status)(struct dvb_frontend* fe, fe_status_t* status); |
| 75 | int (*read_ber)(struct dvb_frontend* fe, u32* ber); |
| 76 | int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength); |
| 77 | int (*read_snr)(struct dvb_frontend* fe, u16* snr); |
| 78 | int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks); |
| 79 | |
| 80 | int (*diseqc_reset_overload)(struct dvb_frontend* fe); |
| 81 | int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd); |
| 82 | int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply); |
| 83 | int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd); |
| 84 | int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone); |
| 85 | int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); |
Peter Beutner | 400b708 | 2006-01-09 15:32:43 -0200 | [diff] [blame] | 86 | int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg); |
| 87 | int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 88 | int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | #define MAX_EVENT 8 |
| 92 | |
| 93 | struct dvb_fe_events { |
| 94 | struct dvb_frontend_event events[MAX_EVENT]; |
| 95 | int eventw; |
| 96 | int eventr; |
| 97 | int overflow; |
| 98 | wait_queue_head_t wait_queue; |
| 99 | struct semaphore sem; |
| 100 | }; |
| 101 | |
| 102 | struct dvb_frontend { |
| 103 | struct dvb_frontend_ops* ops; |
| 104 | struct dvb_adapter *dvb; |
| 105 | void* demodulator_priv; |
| 106 | void* frontend_priv; |
Oliver Endriss | 2f27bdc | 2006-02-28 09:31:16 -0300 | [diff] [blame] | 107 | void* misc_priv; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | extern int dvb_register_frontend(struct dvb_adapter* dvb, |
| 111 | struct dvb_frontend* fe); |
| 112 | |
| 113 | extern int dvb_unregister_frontend(struct dvb_frontend* fe); |
| 114 | |
Andrew de Quincey | 86f40cc | 2006-03-30 15:53:35 -0300 | [diff] [blame] | 115 | extern void dvb_frontend_reinitialise(struct dvb_frontend *fe); |
| 116 | |
NooneImportant | 83b75b0 | 2005-11-08 21:35:27 -0800 | [diff] [blame] | 117 | extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec); |
| 118 | extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime); |
| 119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | #endif |