pvrusb2-ctrl.h 3.5 KB

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