ctamixer.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
  3. *
  4. * This source file is released under GPL v2 license (no other versions).
  5. * See the COPYING file included in the main directory of this source
  6. * distribution for the license terms and conditions.
  7. *
  8. * @File ctamixer.h
  9. *
  10. * @Brief
  11. * This file contains the definition of the Audio Mixer
  12. * resource management object.
  13. *
  14. * @Author Liu Chun
  15. * @Date May 21 2008
  16. *
  17. */
  18. #ifndef CTAMIXER_H
  19. #define CTAMIXER_H
  20. #include "ctresource.h"
  21. #include <linux/spinlock.h>
  22. /* Define the descriptor of a summation node resource */
  23. struct sum {
  24. struct rsc rsc; /* Basic resource info */
  25. unsigned char idx[8];
  26. };
  27. /* Define sum resource request description info */
  28. struct sum_desc {
  29. unsigned int msr;
  30. };
  31. struct sum_mgr {
  32. struct rsc_mgr mgr; /* Basic resource manager info */
  33. spinlock_t mgr_lock;
  34. /* request one sum resource */
  35. int (*get_sum)(struct sum_mgr *mgr,
  36. const struct sum_desc *desc, struct sum **rsum);
  37. /* return one sum resource */
  38. int (*put_sum)(struct sum_mgr *mgr, struct sum *sum);
  39. };
  40. /* Constructor and destructor of daio resource manager */
  41. int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr);
  42. int sum_mgr_destroy(struct sum_mgr *sum_mgr);
  43. /* Define the descriptor of a amixer resource */
  44. struct amixer_rsc_ops;
  45. struct amixer {
  46. struct rsc rsc; /* Basic resource info */
  47. unsigned char idx[8];
  48. struct rsc *input; /* pointer to a resource acting as source */
  49. struct sum *sum; /* Put amixer output to this summation node */
  50. struct amixer_rsc_ops *ops; /* AMixer specific operations */
  51. };
  52. struct amixer_rsc_ops {
  53. int (*set_input)(struct amixer *amixer, struct rsc *rsc);
  54. int (*set_scale)(struct amixer *amixer, unsigned int scale);
  55. int (*set_invalid_squash)(struct amixer *amixer, unsigned int iv);
  56. int (*set_sum)(struct amixer *amixer, struct sum *sum);
  57. int (*commit_write)(struct amixer *amixer);
  58. /* Only for interleaved recording */
  59. int (*commit_raw_write)(struct amixer *amixer);
  60. int (*setup)(struct amixer *amixer, struct rsc *input,
  61. unsigned int scale, struct sum *sum);
  62. int (*get_scale)(struct amixer *amixer);
  63. };
  64. /* Define amixer resource request description info */
  65. struct amixer_desc {
  66. unsigned int msr;
  67. };
  68. struct amixer_mgr {
  69. struct rsc_mgr mgr; /* Basic resource manager info */
  70. spinlock_t mgr_lock;
  71. /* request one amixer resource */
  72. int (*get_amixer)(struct amixer_mgr *mgr,
  73. const struct amixer_desc *desc,
  74. struct amixer **ramixer);
  75. /* return one amixer resource */
  76. int (*put_amixer)(struct amixer_mgr *mgr, struct amixer *amixer);
  77. };
  78. /* Constructor and destructor of amixer resource manager */
  79. int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr);
  80. int amixer_mgr_destroy(struct amixer_mgr *amixer_mgr);
  81. #endif /* CTAMIXER_H */