sb16_csp.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
  3. * Takashi Iwai <tiwai@suse.de>
  4. *
  5. * SB16ASP/AWE32 CSP control
  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, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #ifndef __SOUND_SB16_CSP_H
  23. #define __SOUND_SB16_CSP_H
  24. #include <sound/sb.h>
  25. #include <sound/hwdep.h>
  26. #include <linux/firmware.h>
  27. #include <uapi/sound/sb16_csp.h>
  28. struct snd_sb_csp;
  29. /* indices for the known CSP programs */
  30. enum {
  31. CSP_PROGRAM_MULAW,
  32. CSP_PROGRAM_ALAW,
  33. CSP_PROGRAM_ADPCM_INIT,
  34. CSP_PROGRAM_ADPCM_PLAYBACK,
  35. CSP_PROGRAM_ADPCM_CAPTURE,
  36. CSP_PROGRAM_COUNT
  37. };
  38. /*
  39. * CSP operators
  40. */
  41. struct snd_sb_csp_ops {
  42. int (*csp_use) (struct snd_sb_csp * p);
  43. int (*csp_unuse) (struct snd_sb_csp * p);
  44. int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
  45. int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
  46. int (*csp_stop) (struct snd_sb_csp * p);
  47. int (*csp_qsound_transfer) (struct snd_sb_csp * p);
  48. };
  49. /*
  50. * CSP private data
  51. */
  52. struct snd_sb_csp {
  53. struct snd_sb *chip; /* SB16 DSP */
  54. int used; /* usage flag - exclusive */
  55. char codec_name[16]; /* name of codec */
  56. unsigned short func_nr; /* function number */
  57. unsigned int acc_format; /* accepted PCM formats */
  58. int acc_channels; /* accepted channels */
  59. int acc_width; /* accepted sample width */
  60. int acc_rates; /* accepted sample rates */
  61. int mode; /* MODE */
  62. int run_channels; /* current CSP channels */
  63. int run_width; /* current sample width */
  64. int version; /* CSP version (0x10 - 0x1f) */
  65. int running; /* running state */
  66. struct snd_sb_csp_ops ops; /* operators */
  67. spinlock_t q_lock; /* locking */
  68. int q_enabled; /* enabled flag */
  69. int qpos_left; /* left position */
  70. int qpos_right; /* right position */
  71. int qpos_changed; /* position changed flag */
  72. struct snd_kcontrol *qsound_switch;
  73. struct snd_kcontrol *qsound_space;
  74. struct mutex access_mutex; /* locking */
  75. const struct firmware *csp_programs[CSP_PROGRAM_COUNT];
  76. };
  77. int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
  78. #endif /* __SOUND_SB16_CSP */