18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __PVRUSB2_CTRL_H
78c2ecf20Sopenharmony_ci#define __PVRUSB2_CTRL_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct pvr2_ctrl;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cienum pvr2_ctl_type {
128c2ecf20Sopenharmony_ci	pvr2_ctl_int = 0,
138c2ecf20Sopenharmony_ci	pvr2_ctl_enum = 1,
148c2ecf20Sopenharmony_ci	pvr2_ctl_bitmask = 2,
158c2ecf20Sopenharmony_ci	pvr2_ctl_bool = 3,
168c2ecf20Sopenharmony_ci};
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* Set the given control. */
208c2ecf20Sopenharmony_ciint pvr2_ctrl_set_value(struct pvr2_ctrl *,int val);
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* Set/clear specific bits of the given control. */
238c2ecf20Sopenharmony_ciint pvr2_ctrl_set_mask_value(struct pvr2_ctrl *,int mask,int val);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Get the current value of the given control. */
268c2ecf20Sopenharmony_ciint pvr2_ctrl_get_value(struct pvr2_ctrl *,int *valptr);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Retrieve control's type */
298c2ecf20Sopenharmony_cienum pvr2_ctl_type pvr2_ctrl_get_type(struct pvr2_ctrl *);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Retrieve control's maximum value (int type) */
328c2ecf20Sopenharmony_ciint pvr2_ctrl_get_max(struct pvr2_ctrl *);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Retrieve control's minimum value (int type) */
358c2ecf20Sopenharmony_ciint pvr2_ctrl_get_min(struct pvr2_ctrl *);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* Retrieve control's default value (any type) */
388c2ecf20Sopenharmony_ciint pvr2_ctrl_get_def(struct pvr2_ctrl *, int *valptr);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* Retrieve control's enumeration count (enum only) */
418c2ecf20Sopenharmony_ciint pvr2_ctrl_get_cnt(struct pvr2_ctrl *);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Retrieve control's valid mask bits (bit mask only) */
448c2ecf20Sopenharmony_ciint pvr2_ctrl_get_mask(struct pvr2_ctrl *);
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* Retrieve the control's name */
478c2ecf20Sopenharmony_ciconst char *pvr2_ctrl_get_name(struct pvr2_ctrl *);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Retrieve the control's desc */
508c2ecf20Sopenharmony_ciconst char *pvr2_ctrl_get_desc(struct pvr2_ctrl *);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* Retrieve a control enumeration or bit mask value */
538c2ecf20Sopenharmony_ciint pvr2_ctrl_get_valname(struct pvr2_ctrl *,int,char *,unsigned int,
548c2ecf20Sopenharmony_ci			  unsigned int *);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/* Return true if control is writable */
578c2ecf20Sopenharmony_ciint pvr2_ctrl_is_writable(struct pvr2_ctrl *);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Return V4L flags value for control (or zero if there is no v4l control
608c2ecf20Sopenharmony_ci   actually under this control) */
618c2ecf20Sopenharmony_ciunsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* Return V4L ID for this control or zero if none */
648c2ecf20Sopenharmony_ciint pvr2_ctrl_get_v4lid(struct pvr2_ctrl *);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* Return true if control has custom symbolic representation */
678c2ecf20Sopenharmony_ciint pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *);
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* Convert a given mask/val to a custom symbolic value */
708c2ecf20Sopenharmony_ciint pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *,
718c2ecf20Sopenharmony_ci				  int mask,int val,
728c2ecf20Sopenharmony_ci				  char *buf,unsigned int maxlen,
738c2ecf20Sopenharmony_ci				  unsigned int *len);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* Convert a symbolic value to a mask/value pair */
768c2ecf20Sopenharmony_ciint pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *,
778c2ecf20Sopenharmony_ci				  const char *buf,unsigned int len,
788c2ecf20Sopenharmony_ci				  int *maskptr,int *valptr);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/* Convert a given mask/val to a symbolic value */
818c2ecf20Sopenharmony_ciint pvr2_ctrl_value_to_sym(struct pvr2_ctrl *,
828c2ecf20Sopenharmony_ci			   int mask,int val,
838c2ecf20Sopenharmony_ci			   char *buf,unsigned int maxlen,
848c2ecf20Sopenharmony_ci			   unsigned int *len);
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* Convert a symbolic value to a mask/value pair */
878c2ecf20Sopenharmony_ciint pvr2_ctrl_sym_to_value(struct pvr2_ctrl *,
888c2ecf20Sopenharmony_ci			   const char *buf,unsigned int len,
898c2ecf20Sopenharmony_ci			   int *maskptr,int *valptr);
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* Convert a given mask/val to a symbolic value - must already be
928c2ecf20Sopenharmony_ci   inside of critical region. */
938c2ecf20Sopenharmony_ciint pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *,
948c2ecf20Sopenharmony_ci			   int mask,int val,
958c2ecf20Sopenharmony_ci			   char *buf,unsigned int maxlen,
968c2ecf20Sopenharmony_ci			   unsigned int *len);
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#endif /* __PVRUSB2_CTRL_H */
99