sb.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #define DSP_RESET (devc->base + 0x6)
  3. #define DSP_READ (devc->base + 0xA)
  4. #define DSP_WRITE (devc->base + 0xC)
  5. #define DSP_COMMAND (devc->base + 0xC)
  6. #define DSP_STATUS (devc->base + 0xC)
  7. #define DSP_DATA_AVAIL (devc->base + 0xE)
  8. #define DSP_DATA_AVL16 (devc->base + 0xF)
  9. #define MIXER_ADDR (devc->base + 0x4)
  10. #define MIXER_DATA (devc->base + 0x5)
  11. #define OPL3_LEFT (devc->base + 0x0)
  12. #define OPL3_RIGHT (devc->base + 0x2)
  13. #define OPL3_BOTH (devc->base + 0x8)
  14. /* DSP Commands */
  15. #define DSP_CMD_SPKON 0xD1
  16. #define DSP_CMD_SPKOFF 0xD3
  17. #define DSP_CMD_DMAON 0xD0
  18. #define DSP_CMD_DMAOFF 0xD4
  19. #define IMODE_NONE 0
  20. #define IMODE_OUTPUT PCM_ENABLE_OUTPUT
  21. #define IMODE_INPUT PCM_ENABLE_INPUT
  22. #define IMODE_INIT 3
  23. #define IMODE_MIDI 4
  24. #define NORMAL_MIDI 0
  25. #define UART_MIDI 1
  26. /*
  27. * Device models
  28. */
  29. #define MDL_NONE 0
  30. #define MDL_SB1 1 /* SB1.0 or 1.5 */
  31. #define MDL_SB2 2 /* SB2.0 */
  32. #define MDL_SB201 3 /* SB2.01 */
  33. #define MDL_SBPRO 4 /* SB Pro */
  34. #define MDL_SB16 5 /* SB16/32/AWE */
  35. #define MDL_SBPNP 6 /* SB16/32/AWE PnP */
  36. #define MDL_JAZZ 10 /* Media Vision Jazz16 */
  37. #define MDL_SMW 11 /* Logitech SoundMan Wave (Jazz16) */
  38. #define MDL_ESS 12 /* ESS ES688 and ES1688 */
  39. #define MDL_AZTECH 13 /* Aztech Sound Galaxy family */
  40. #define MDL_ES1868MIDI 14 /* MIDI port of ESS1868 */
  41. #define MDL_AEDSP 15 /* Audio Excel DSP 16 */
  42. #define MDL_ESSPCI 16 /* ESS PCI card */
  43. #define MDL_YMPCI 17 /* Yamaha PCI sb in emulation */
  44. #define SUBMDL_ALS007 42 /* ALS-007 differs from SB16 only in mixer */
  45. /* register assignment */
  46. #define SUBMDL_ALS100 43 /* ALS-100 allows sampling rates of up */
  47. /* to 48kHz */
  48. /*
  49. * Config flags
  50. */
  51. #define SB_NO_MIDI 0x00000001
  52. #define SB_NO_MIXER 0x00000002
  53. #define SB_NO_AUDIO 0x00000004
  54. #define SB_NO_RECORDING 0x00000008 /* No audio recording */
  55. #define SB_MIDI_ONLY (SB_NO_AUDIO|SB_NO_MIXER)
  56. #define SB_PCI_IRQ 0x00000010 /* PCI shared IRQ */
  57. struct mixer_def {
  58. unsigned int regno: 8;
  59. unsigned int bitoffs:4;
  60. unsigned int nbits:4;
  61. };
  62. typedef struct mixer_def mixer_tab[32][2];
  63. typedef struct mixer_def mixer_ent;
  64. struct sb_module_options
  65. {
  66. int esstype; /* ESS chip type */
  67. int acer; /* Do acer notebook init? */
  68. int sm_games; /* Logitech soundman games? */
  69. };
  70. typedef struct sb_devc {
  71. int dev;
  72. /* Hardware parameters */
  73. int *osp;
  74. int minor, major;
  75. int type;
  76. int model, submodel;
  77. int caps;
  78. # define SBCAP_STEREO 0x00000001
  79. # define SBCAP_16BITS 0x00000002
  80. /* Hardware resources */
  81. int base;
  82. int irq;
  83. int dma8, dma16;
  84. int pcibase; /* For ESS Maestro etc */
  85. /* State variables */
  86. int opened;
  87. /* new audio fields for full duplex support */
  88. int fullduplex;
  89. int duplex;
  90. int speed, bits, channels;
  91. volatile int irq_ok;
  92. volatile int intr_active, irq_mode;
  93. /* duplicate audio fields for full duplex support */
  94. volatile int intr_active_16, irq_mode_16;
  95. /* Mixer fields */
  96. int *levels;
  97. mixer_tab *iomap;
  98. size_t iomap_sz; /* number or records in the iomap table */
  99. int mixer_caps, recmask, outmask, supported_devices;
  100. int supported_rec_devices, supported_out_devices;
  101. int my_mixerdev;
  102. int sbmixnum;
  103. /* Audio fields */
  104. unsigned long trg_buf;
  105. int trigger_bits;
  106. int trg_bytes;
  107. int trg_intrflag;
  108. int trg_restart;
  109. /* duplicate audio fields for full duplex support */
  110. unsigned long trg_buf_16;
  111. int trigger_bits_16;
  112. int trg_bytes_16;
  113. int trg_intrflag_16;
  114. int trg_restart_16;
  115. unsigned char tconst;
  116. /* MIDI fields */
  117. int my_mididev;
  118. int input_opened;
  119. int midi_broken;
  120. void (*midi_input_intr) (int dev, unsigned char data);
  121. void *midi_irq_cookie; /* IRQ cookie for the midi */
  122. spinlock_t lock;
  123. struct sb_module_options sbmo; /* Module options */
  124. } sb_devc;
  125. /*
  126. * PCI card types
  127. */
  128. #define SB_PCI_ESSMAESTRO 1 /* ESS Maestro Legacy */
  129. #define SB_PCI_YAMAHA 2 /* Yamaha Legacy */
  130. /*
  131. * Functions
  132. */
  133. int sb_dsp_command (sb_devc *devc, unsigned char val);
  134. int sb_dsp_get_byte(sb_devc * devc);
  135. int sb_dsp_reset (sb_devc *devc);
  136. void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value);
  137. unsigned int sb_getmixer (sb_devc *devc, unsigned int port);
  138. int sb_dsp_detect (struct address_info *hw_config, int pci, int pciio, struct sb_module_options *sbmo);
  139. int sb_dsp_init (struct address_info *hw_config, struct module *owner);
  140. void sb_dsp_unload(struct address_info *hw_config, int sbmpu);
  141. int sb_mixer_init(sb_devc *devc, struct module *owner);
  142. void sb_mixer_unload(sb_devc *devc);
  143. void sb_mixer_set_stereo (sb_devc *devc, int mode);
  144. void smw_mixer_init(sb_devc *devc);
  145. void sb_dsp_midi_init (sb_devc *devc, struct module *owner);
  146. void sb_audio_init (sb_devc *devc, char *name, struct module *owner);
  147. void sb_midi_interrupt (sb_devc *devc);
  148. void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val);
  149. int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right);
  150. int sb_audio_open(int dev, int mode);
  151. void sb_audio_close(int dev);
  152. /* From sb_common.c */
  153. void sb_dsp_disable_midi(int port);
  154. int probe_sbmpu (struct address_info *hw_config, struct module *owner);
  155. void unload_sbmpu (struct address_info *hw_config);
  156. void unload_sb16(struct address_info *hw_info);
  157. void unload_sb16midi(struct address_info *hw_info);