sb16_csp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
  4. * Takashi Iwai <tiwai@suse.de>
  5. *
  6. * SB16ASP/AWE32 CSP control
  7. */
  8. #ifndef __SOUND_SB16_CSP_H
  9. #define __SOUND_SB16_CSP_H
  10. /* CSP modes */
  11. #define SNDRV_SB_CSP_MODE_NONE 0x00
  12. #define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
  13. #define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
  14. #define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
  15. /* CSP load flags */
  16. #define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
  17. #define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
  18. /* CSP sample width */
  19. #define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
  20. #define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
  21. /* CSP channels */
  22. #define SNDRV_SB_CSP_MONO 0x01
  23. #define SNDRV_SB_CSP_STEREO 0x02
  24. /* CSP rates */
  25. #define SNDRV_SB_CSP_RATE_8000 0x01
  26. #define SNDRV_SB_CSP_RATE_11025 0x02
  27. #define SNDRV_SB_CSP_RATE_22050 0x04
  28. #define SNDRV_SB_CSP_RATE_44100 0x08
  29. #define SNDRV_SB_CSP_RATE_ALL 0x0f
  30. /* CSP running state */
  31. #define SNDRV_SB_CSP_ST_IDLE 0x00
  32. #define SNDRV_SB_CSP_ST_LOADED 0x01
  33. #define SNDRV_SB_CSP_ST_RUNNING 0x02
  34. #define SNDRV_SB_CSP_ST_PAUSED 0x04
  35. #define SNDRV_SB_CSP_ST_AUTO 0x08
  36. #define SNDRV_SB_CSP_ST_QSOUND 0x10
  37. /* maximum QSound value (180 degrees right) */
  38. #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
  39. /* maximum microcode RIFF file size */
  40. #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
  41. /* microcode header */
  42. struct snd_sb_csp_mc_header {
  43. char codec_name[16]; /* id name of codec */
  44. unsigned short func_req; /* requested function */
  45. };
  46. /* microcode to be loaded */
  47. struct snd_sb_csp_microcode {
  48. struct snd_sb_csp_mc_header info;
  49. unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
  50. };
  51. /* start CSP with sample_width in mono/stereo */
  52. struct snd_sb_csp_start {
  53. int sample_width; /* sample width, look above */
  54. int channels; /* channels, look above */
  55. };
  56. /* CSP information */
  57. struct snd_sb_csp_info {
  58. char codec_name[16]; /* id name of codec */
  59. unsigned short func_nr; /* function number */
  60. unsigned int acc_format; /* accepted PCM formats */
  61. unsigned short acc_channels; /* accepted channels */
  62. unsigned short acc_width; /* accepted sample width */
  63. unsigned short acc_rates; /* accepted sample rates */
  64. unsigned short csp_mode; /* CSP mode, see above */
  65. unsigned short run_channels; /* current channels */
  66. unsigned short run_width; /* current sample width */
  67. unsigned short version; /* version id: 0x10 - 0x1f */
  68. unsigned short state; /* state bits */
  69. };
  70. /* HWDEP controls */
  71. /* get CSP information */
  72. #define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
  73. /* load microcode to CSP */
  74. /* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
  75. * defined for some architectures like MIPS, and it leads to build errors.
  76. * (x86 and co have 14-bit size, thus it's valid, though.)
  77. * As a workaround for skipping the size-limit check, here we don't use the
  78. * normal _IOW() macro but _IOC() with the manual argument.
  79. */
  80. #define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
  81. _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
  82. /* unload microcode from CSP */
  83. #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
  84. /* start CSP */
  85. #define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
  86. /* stop CSP */
  87. #define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
  88. /* pause CSP and DMA transfer */
  89. #define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
  90. /* restart CSP and DMA transfer */
  91. #define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
  92. #endif /* __SOUND_SB16_CSP_H */