pvrusb2-ctrl.h 3.8 KB

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