This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.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         pvr2_ctl_bool = 3,
31 };
32
33
34 /* Set the given control. */
35 int pvr2_ctrl_set_value(struct pvr2_ctrl *,int val);
36
37 /* Set/clear specific bits of the given control. */
38 int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *,int mask,int val);
39
40 /* Get the current value of the given control. */
41 int pvr2_ctrl_get_value(struct pvr2_ctrl *,int *valptr);
42
43 /* Retrieve control's type */
44 enum pvr2_ctl_type pvr2_ctrl_get_type(struct pvr2_ctrl *);
45
46 /* Retrieve control's maximum value (int type) */
47 int pvr2_ctrl_get_max(struct pvr2_ctrl *);
48
49 /* Retrieve control's minimum value (int type) */
50 int pvr2_ctrl_get_min(struct pvr2_ctrl *);
51
52 /* Retrieve control's default value (any type) */
53 int pvr2_ctrl_get_def(struct pvr2_ctrl *);
54
55 /* Retrieve control's enumeration count (enum only) */
56 int pvr2_ctrl_get_cnt(struct pvr2_ctrl *);
57
58 /* Retrieve control's valid mask bits (bit mask only) */
59 int pvr2_ctrl_get_mask(struct pvr2_ctrl *);
60
61 /* Retrieve the control's name */
62 const char *pvr2_ctrl_get_name(struct pvr2_ctrl *);
63
64 /* Retrieve the control's desc */
65 const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *);
66
67 /* Retrieve a control enumeration or bit mask value */
68 int pvr2_ctrl_get_valname(struct pvr2_ctrl *,int,char *,unsigned int,
69                           unsigned int *);
70
71 /* Return true if control is writable */
72 int pvr2_ctrl_is_writable(struct pvr2_ctrl *);
73
74 /* Return V4L flags value for control (or zero if there is no v4l control
75    actually under this control) */
76 unsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *);
77
78 /* Return V4L ID for this control or zero if none */
79 int pvr2_ctrl_get_v4lid(struct pvr2_ctrl *);
80
81 /* Return true if control has custom symbolic representation */
82 int pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *);
83
84 /* Convert a given mask/val to a custom symbolic value */
85 int pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *,
86                                   int mask,int val,
87                                   char *buf,unsigned int maxlen,
88                                   unsigned int *len);
89
90 /* Convert a symbolic value to a mask/value pair */
91 int pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *,
92                                   const char *buf,unsigned int len,
93                                   int *maskptr,int *valptr);
94
95 /* Convert a given mask/val to a symbolic value */
96 int pvr2_ctrl_value_to_sym(struct pvr2_ctrl *,
97                            int mask,int val,
98                            char *buf,unsigned int maxlen,
99                            unsigned int *len);
100
101 /* Convert a symbolic value to a mask/value pair */
102 int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *,
103                            const char *buf,unsigned int len,
104                            int *maskptr,int *valptr);
105
106 /* Convert a given mask/val to a symbolic value - must already be
107    inside of critical region. */
108 int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *,
109                            int mask,int val,
110                            char *buf,unsigned int maxlen,
111                            unsigned int *len);
112
113 #endif /* __PVRUSB2_CTRL_H */
114
115 /*
116   Stuff for Emacs to see, in order to encourage consistent editing style:
117   *** Local Variables: ***
118   *** mode: c ***
119   *** fill-column: 75 ***
120   *** tab-width: 8 ***
121   *** c-basic-offset: 8 ***
122   *** End: ***
123   */