blob: bf4cf65441fb0c561762e4bf5e081bec1aa30942 [file] [log] [blame]
Mike Iselyd8554972006-06-26 20:58:46 -03001/*
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
24struct pvr2_ctrl;
25
26enum pvr2_ctl_type {
27 pvr2_ctl_int = 0,
28 pvr2_ctl_enum = 1,
29 pvr2_ctl_bitmask = 2,
Mike Isely33213962006-06-25 20:04:40 -030030 pvr2_ctl_bool = 3,
Mike Iselyd8554972006-06-26 20:58:46 -030031};
32
33
34/* Set the given control. */
35int pvr2_ctrl_set_value(struct pvr2_ctrl *,int val);
36
37/* Set/clear specific bits of the given control. */
38int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *,int mask,int val);
39
40/* Get the current value of the given control. */
41int pvr2_ctrl_get_value(struct pvr2_ctrl *,int *valptr);
42
43/* Retrieve control's type */
44enum pvr2_ctl_type pvr2_ctrl_get_type(struct pvr2_ctrl *);
45
46/* Retrieve control's maximum value (int type) */
47int pvr2_ctrl_get_max(struct pvr2_ctrl *);
48
49/* Retrieve control's minimum value (int type) */
50int pvr2_ctrl_get_min(struct pvr2_ctrl *);
51
52/* Retrieve control's default value (any type) */
53int pvr2_ctrl_get_def(struct pvr2_ctrl *);
54
55/* Retrieve control's enumeration count (enum only) */
56int pvr2_ctrl_get_cnt(struct pvr2_ctrl *);
57
58/* Retrieve control's valid mask bits (bit mask only) */
59int pvr2_ctrl_get_mask(struct pvr2_ctrl *);
60
61/* Retrieve the control's name */
62const char *pvr2_ctrl_get_name(struct pvr2_ctrl *);
63
64/* Retrieve the control's desc */
65const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *);
66
67/* Retrieve a control enumeration or bit mask value */
68int pvr2_ctrl_get_valname(struct pvr2_ctrl *,int,char *,unsigned int,
69 unsigned int *);
70
71/* Return true if control is writable */
72int pvr2_ctrl_is_writable(struct pvr2_ctrl *);
73
74/* Return true if control has custom symbolic representation */
75int pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *);
76
77/* Convert a given mask/val to a custom symbolic value */
78int pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *,
79 int mask,int val,
80 char *buf,unsigned int maxlen,
81 unsigned int *len);
82
83/* Convert a symbolic value to a mask/value pair */
84int pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *,
85 const char *buf,unsigned int len,
86 int *maskptr,int *valptr);
87
88/* Convert a given mask/val to a symbolic value */
89int pvr2_ctrl_value_to_sym(struct pvr2_ctrl *,
90 int mask,int val,
91 char *buf,unsigned int maxlen,
92 unsigned int *len);
93
94/* Convert a symbolic value to a mask/value pair */
95int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *,
96 const char *buf,unsigned int len,
97 int *maskptr,int *valptr);
98
99/* Convert a given mask/val to a symbolic value - must already be
100 inside of critical region. */
101int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *,
102 int mask,int val,
103 char *buf,unsigned int maxlen,
104 unsigned int *len);
105
106#endif /* __PVRUSB2_CTRL_H */
107
108/*
109 Stuff for Emacs to see, in order to encourage consistent editing style:
110 *** Local Variables: ***
111 *** mode: c ***
112 *** fill-column: 75 ***
113 *** tab-width: 8 ***
114 *** c-basic-offset: 8 ***
115 *** End: ***
116 */