xref: /linux/drivers/media/usb/pvrusb2/pvrusb2-ctrl.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 /*
2  *
3  *
4  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License
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.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20 #ifndef __PVRUSB2_CTRL_H
21 #define __PVRUSB2_CTRL_H
22 
23 struct pvr2_ctrl;
24 
25 enum pvr2_ctl_type {
26 	pvr2_ctl_int = 0,
27 	pvr2_ctl_enum = 1,
28 	pvr2_ctl_bitmask = 2,
29 	pvr2_ctl_bool = 3,
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 *, int *valptr);
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 V4L flags value for control (or zero if there is no v4l control
74    actually under this control) */
75 unsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *);
76 
77 /* Return V4L ID for this control or zero if none */
78 int pvr2_ctrl_get_v4lid(struct pvr2_ctrl *);
79 
80 /* Return true if control has custom symbolic representation */
81 int pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *);
82 
83 /* Convert a given mask/val to a custom symbolic value */
84 int pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *,
85 				  int mask,int val,
86 				  char *buf,unsigned int maxlen,
87 				  unsigned int *len);
88 
89 /* Convert a symbolic value to a mask/value pair */
90 int pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *,
91 				  const char *buf,unsigned int len,
92 				  int *maskptr,int *valptr);
93 
94 /* Convert a given mask/val to a symbolic value */
95 int pvr2_ctrl_value_to_sym(struct pvr2_ctrl *,
96 			   int mask,int val,
97 			   char *buf,unsigned int maxlen,
98 			   unsigned int *len);
99 
100 /* Convert a symbolic value to a mask/value pair */
101 int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *,
102 			   const char *buf,unsigned int len,
103 			   int *maskptr,int *valptr);
104 
105 /* Convert a given mask/val to a symbolic value - must already be
106    inside of critical region. */
107 int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *,
108 			   int mask,int val,
109 			   char *buf,unsigned int maxlen,
110 			   unsigned int *len);
111 
112 #endif /* __PVRUSB2_CTRL_H */
113