pvrusb2-ctrl.h 3.3 KB

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