GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / include / media / ir-common.h
blob528050e39ad9d539877294f5db2130b771e7d3c7
1 /*
3 * some common structs and functions to handle infrared remotes via
4 * input layer ...
6 * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef _IR_COMMON
24 #define _IR_COMMON
26 #include <linux/input.h>
27 #include <linux/workqueue.h>
28 #include <linux/interrupt.h>
29 #include <media/ir-core.h>
31 #define RC5_START(x) (((x)>>12)&3)
32 #define RC5_TOGGLE(x) (((x)>>11)&1)
33 #define RC5_ADDR(x) (((x)>>6)&31)
34 #define RC5_INSTR(x) ((x)&63)
36 struct ir_input_state {
37 /* configuration */
38 u64 ir_type;
40 /* key info */
41 u32 ir_key; /* ir scancode */
42 u32 keycode; /* linux key code */
43 int keypressed; /* current state */
46 /* this was saa7134_ir and bttv_ir, moved here for
47 * rc5 decoding. */
48 struct card_ir {
49 struct input_dev *dev;
50 struct ir_input_state ir;
51 char name[32];
52 char phys[32];
53 int users;
55 u32 running:1;
56 struct ir_dev_props props;
58 /* Usual gpio signalling */
60 u32 mask_keycode;
61 u32 mask_keydown;
62 u32 mask_keyup;
63 u32 polling;
64 u32 last_gpio;
65 int shift_by;
66 int start; // What should RC5_START() be
67 int addr; // What RC5_ADDR() should be.
68 int rc5_key_timeout;
69 int rc5_remote_gap;
70 struct work_struct work;
71 struct timer_list timer;
73 /* RC5 gpio */
74 u32 rc5_gpio;
75 struct timer_list timer_end; /* timer_end for code completion */
76 struct timer_list timer_keyup; /* timer_end for key release */
77 u32 last_rc5; /* last good rc5 code */
78 u32 last_bit; /* last raw bit seen */
79 u32 code; /* raw code under construction */
80 struct timeval base_time; /* time of last seen code */
81 int active; /* building raw code */
83 /* NEC decoding */
84 u32 nec_gpio;
85 struct tasklet_struct tlet;
87 /* IR core raw decoding */
88 u32 raw_decode;
91 /* Routines from ir-functions.c */
93 int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
94 const u64 ir_type);
95 void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
96 void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
97 u32 ir_key);
98 u32 ir_extract_bits(u32 data, u32 mask);
99 int ir_dump_samples(u32 *samples, int count);
100 int ir_decode_biphase(u32 *samples, int count, int low, int high);
101 int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
102 u32 ir_rc5_decode(unsigned int code);
104 void ir_rc5_timer_end(unsigned long data);
105 void ir_rc5_timer_keyup(unsigned long data);
107 #endif