V4L/DVB (4228a): pvrusb2 to kernel 2.6.18
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / media / video / pvrusb2 / pvrusb2-ctrl.h
1 /*
2 *
3 * $Id$
4 *
5 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21 #ifndef __PVRUSB2_CTRL_H
22 #define __PVRUSB2_CTRL_H
23
24 struct pvr2_ctrl;
25
26 enum pvr2_ctl_type {
27 pvr2_ctl_int = 0,
28 pvr2_ctl_enum = 1,
29 pvr2_ctl_bitmask = 2,
30 };
31
32
33 /* Set the given control. */
34 int pvr2_ctrl_set_value(struct pvr2_ctrl *,int val);
35
36 /* Set/clear specific bits of the given control. */
37 int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *,int mask,int val);
38
39 /* Get the current value of the given control. */
40 int pvr2_ctrl_get_value(struct pvr2_ctrl *,int *valptr);
41
42 /* Retrieve control's type */
43 enum pvr2_ctl_type pvr2_ctrl_get_type(struct pvr2_ctrl *);
44
45 /* Retrieve control's maximum value (int type) */
46 int pvr2_ctrl_get_max(struct pvr2_ctrl *);
47
48 /* Retrieve control's minimum value (int type) */
49 int pvr2_ctrl_get_min(struct pvr2_ctrl *);
50
51 /* Retrieve control's default value (any type) */
52 int pvr2_ctrl_get_def(struct pvr2_ctrl *);
53
54 /* Retrieve control's enumeration count (enum only) */
55 int pvr2_ctrl_get_cnt(struct pvr2_ctrl *);
56
57 /* Retrieve control's valid mask bits (bit mask only) */
58 int pvr2_ctrl_get_mask(struct pvr2_ctrl *);
59
60 /* Retrieve the control's name */
61 const char *pvr2_ctrl_get_name(struct pvr2_ctrl *);
62
63 /* Retrieve the control's desc */
64 const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *);
65
66 /* Retrieve a control enumeration or bit mask value */
67 int pvr2_ctrl_get_valname(struct pvr2_ctrl *,int,char *,unsigned int,
68 unsigned int *);
69
70 /* Return true if control is writable */
71 int pvr2_ctrl_is_writable(struct pvr2_ctrl *);
72
73 /* Return true if control has custom symbolic representation */
74 int pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *);
75
76 /* Convert a given mask/val to a custom symbolic value */
77 int pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *,
78 int mask,int val,
79 char *buf,unsigned int maxlen,
80 unsigned int *len);
81
82 /* Convert a symbolic value to a mask/value pair */
83 int pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *,
84 const char *buf,unsigned int len,
85 int *maskptr,int *valptr);
86
87 /* Convert a given mask/val to a symbolic value */
88 int pvr2_ctrl_value_to_sym(struct pvr2_ctrl *,
89 int mask,int val,
90 char *buf,unsigned int maxlen,
91 unsigned int *len);
92
93 /* Convert a symbolic value to a mask/value pair */
94 int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *,
95 const char *buf,unsigned int len,
96 int *maskptr,int *valptr);
97
98 /* Convert a given mask/val to a symbolic value - must already be
99 inside of critical region. */
100 int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *,
101 int mask,int val,
102 char *buf,unsigned int maxlen,
103 unsigned int *len);
104
105 #endif /* __PVRUSB2_CTRL_H */
106
107 /*
108 Stuff for Emacs to see, in order to encourage consistent editing style:
109 *** Local Variables: ***
110 *** mode: c ***
111 *** fill-column: 75 ***
112 *** tab-width: 8 ***
113 *** c-basic-offset: 8 ***
114 *** End: ***
115 */