sb16_csp.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. /* CSP modes */
  25. #define SNDRV_SB_CSP_MODE_NONE 0x00
  26. #define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
  27. #define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
  28. #define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
  29. /* CSP load flags */
  30. #define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
  31. #define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
  32. /* CSP sample width */
  33. #define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
  34. #define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
  35. /* CSP channels */
  36. #define SNDRV_SB_CSP_MONO 0x01
  37. #define SNDRV_SB_CSP_STEREO 0x02
  38. /* CSP rates */
  39. #define SNDRV_SB_CSP_RATE_8000 0x01
  40. #define SNDRV_SB_CSP_RATE_11025 0x02
  41. #define SNDRV_SB_CSP_RATE_22050 0x04
  42. #define SNDRV_SB_CSP_RATE_44100 0x08
  43. #define SNDRV_SB_CSP_RATE_ALL 0x0f
  44. /* CSP running state */
  45. #define SNDRV_SB_CSP_ST_IDLE 0x00
  46. #define SNDRV_SB_CSP_ST_LOADED 0x01
  47. #define SNDRV_SB_CSP_ST_RUNNING 0x02
  48. #define SNDRV_SB_CSP_ST_PAUSED 0x04
  49. #define SNDRV_SB_CSP_ST_AUTO 0x08
  50. #define SNDRV_SB_CSP_ST_QSOUND 0x10
  51. /* maximum QSound value (180 degrees right) */
  52. #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
  53. /* maximum microcode RIFF file size */
  54. #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
  55. /* microcode header */
  56. struct snd_sb_csp_mc_header {
  57. char codec_name[16]; /* id name of codec */
  58. unsigned short func_req; /* requested function */
  59. };
  60. /* microcode to be loaded */
  61. struct snd_sb_csp_microcode {
  62. struct snd_sb_csp_mc_header info;
  63. unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
  64. };
  65. /* start CSP with sample_width in mono/stereo */
  66. struct snd_sb_csp_start {
  67. int sample_width; /* sample width, look above */
  68. int channels; /* channels, look above */
  69. };
  70. /* CSP information */
  71. struct snd_sb_csp_info {
  72. char codec_name[16]; /* id name of codec */
  73. unsigned short func_nr; /* function number */
  74. unsigned int acc_format; /* accepted PCM formats */
  75. unsigned short acc_channels; /* accepted channels */
  76. unsigned short acc_width; /* accepted sample width */
  77. unsigned short acc_rates; /* accepted sample rates */
  78. unsigned short csp_mode; /* CSP mode, see above */
  79. unsigned short run_channels; /* current channels */
  80. unsigned short run_width; /* current sample width */
  81. unsigned short version; /* version id: 0x10 - 0x1f */
  82. unsigned short state; /* state bits */
  83. };
  84. /* HWDEP controls */
  85. /* get CSP information */
  86. #define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
  87. /* load microcode to CSP */
  88. /* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
  89. * defined for some architectures like MIPS, and it leads to build errors.
  90. * (x86 and co have 14-bit size, thus it's valid, though.)
  91. * As a workaround for skipping the size-limit check, here we don't use the
  92. * normal _IOW() macro but _IOC() with the manual argument.
  93. */
  94. #define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
  95. _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
  96. /* unload microcode from CSP */
  97. #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
  98. /* start CSP */
  99. #define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
  100. /* stop CSP */
  101. #define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
  102. /* pause CSP and DMA transfer */
  103. #define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
  104. /* restart CSP and DMA transfer */
  105. #define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
  106. #endif /* __SOUND_SB16_CSP_H */