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 */ 16 #ifndef __PVRUSB2_CTRL_H 17 #define __PVRUSB2_CTRL_H 18 19 struct pvr2_ctrl; 20 21 enum pvr2_ctl_type { 22 pvr2_ctl_int = 0, 23 pvr2_ctl_enum = 1, 24 pvr2_ctl_bitmask = 2, 25 pvr2_ctl_bool = 3, 26 }; 27 28 29 /* Set the given control. */ 30 int pvr2_ctrl_set_value(struct pvr2_ctrl *,int val); 31 32 /* Set/clear specific bits of the given control. */ 33 int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *,int mask,int val); 34 35 /* Get the current value of the given control. */ 36 int pvr2_ctrl_get_value(struct pvr2_ctrl *,int *valptr); 37 38 /* Retrieve control's type */ 39 enum pvr2_ctl_type pvr2_ctrl_get_type(struct pvr2_ctrl *); 40 41 /* Retrieve control's maximum value (int type) */ 42 int pvr2_ctrl_get_max(struct pvr2_ctrl *); 43 44 /* Retrieve control's minimum value (int type) */ 45 int pvr2_ctrl_get_min(struct pvr2_ctrl *); 46 47 /* Retrieve control's default value (any type) */ 48 int pvr2_ctrl_get_def(struct pvr2_ctrl *, int *valptr); 49 50 /* Retrieve control's enumeration count (enum only) */ 51 int pvr2_ctrl_get_cnt(struct pvr2_ctrl *); 52 53 /* Retrieve control's valid mask bits (bit mask only) */ 54 int pvr2_ctrl_get_mask(struct pvr2_ctrl *); 55 56 /* Retrieve the control's name */ 57 const char *pvr2_ctrl_get_name(struct pvr2_ctrl *); 58 59 /* Retrieve the control's desc */ 60 const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *); 61 62 /* Retrieve a control enumeration or bit mask value */ 63 int pvr2_ctrl_get_valname(struct pvr2_ctrl *,int,char *,unsigned int, 64 unsigned int *); 65 66 /* Return true if control is writable */ 67 int pvr2_ctrl_is_writable(struct pvr2_ctrl *); 68 69 /* Return V4L flags value for control (or zero if there is no v4l control 70 actually under this control) */ 71 unsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *); 72 73 /* Return V4L ID for this control or zero if none */ 74 int pvr2_ctrl_get_v4lid(struct pvr2_ctrl *); 75 76 /* Return true if control has custom symbolic representation */ 77 int pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *); 78 79 /* Convert a given mask/val to a custom symbolic value */ 80 int pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *, 81 int mask,int val, 82 char *buf,unsigned int maxlen, 83 unsigned int *len); 84 85 /* Convert a symbolic value to a mask/value pair */ 86 int pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *, 87 const char *buf,unsigned int len, 88 int *maskptr,int *valptr); 89 90 /* Convert a given mask/val to a symbolic value */ 91 int pvr2_ctrl_value_to_sym(struct pvr2_ctrl *, 92 int mask,int val, 93 char *buf,unsigned int maxlen, 94 unsigned int *len); 95 96 /* Convert a symbolic value to a mask/value pair */ 97 int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *, 98 const char *buf,unsigned int len, 99 int *maskptr,int *valptr); 100 101 /* Convert a given mask/val to a symbolic value - must already be 102 inside of critical region. */ 103 int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *, 104 int mask,int val, 105 char *buf,unsigned int maxlen, 106 unsigned int *len); 107 108 #endif /* __PVRUSB2_CTRL_H */ 109