sb.h 5.2 KB

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