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