emu8000.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #ifndef __SOUND_EMU8000_H
  2. #define __SOUND_EMU8000_H
  3. /*
  4. * Defines for the emu8000 (AWE32/64)
  5. *
  6. * Copyright (C) 1999 Steve Ratcliffe
  7. * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #include <sound/emux_synth.h>
  24. #include <sound/seq_kernel.h>
  25. /*
  26. * Hardware parameters.
  27. */
  28. #define EMU8000_MAX_DRAM (28 * 1024 * 1024) /* Max on-board mem is 28Mb ???*/
  29. #define EMU8000_DRAM_OFFSET 0x200000 /* Beginning of on board ram */
  30. #define EMU8000_CHANNELS 32 /* Number of hardware channels */
  31. #define EMU8000_DRAM_VOICES 30 /* number of normal voices */
  32. /* Flags to set a dma channel to read or write */
  33. #define EMU8000_RAM_READ 0
  34. #define EMU8000_RAM_WRITE 1
  35. #define EMU8000_RAM_CLOSE 2
  36. #define EMU8000_RAM_MODE_MASK 0x03
  37. #define EMU8000_RAM_RIGHT 0x10 /* use 'right' DMA channel */
  38. enum {
  39. EMU8000_CONTROL_BASS = 0,
  40. EMU8000_CONTROL_TREBLE,
  41. EMU8000_CONTROL_CHORUS_MODE,
  42. EMU8000_CONTROL_REVERB_MODE,
  43. EMU8000_CONTROL_FM_CHORUS_DEPTH,
  44. EMU8000_CONTROL_FM_REVERB_DEPTH,
  45. EMU8000_NUM_CONTROLS,
  46. };
  47. /*
  48. * Structure to hold all state information for the emu8000 driver.
  49. *
  50. * Note 1: The chip supports 32 channels in hardware this is max_channels
  51. * some of the channels may be used for other things so max_channels is
  52. * the number in use for wave voices.
  53. */
  54. struct snd_emu8000 {
  55. struct snd_emux *emu;
  56. int index; /* sequencer client index */
  57. int seq_ports; /* number of sequencer ports */
  58. int fm_chorus_depth; /* FM OPL3 chorus depth */
  59. int fm_reverb_depth; /* FM OPL3 reverb depth */
  60. int mem_size; /* memory size */
  61. unsigned long port1; /* Port usually base+0 */
  62. unsigned long port2; /* Port usually at base+0x400 */
  63. unsigned long port3; /* Port usually at base+0x800 */
  64. struct resource *res_port1;
  65. struct resource *res_port2;
  66. struct resource *res_port3;
  67. unsigned short last_reg;/* Last register command */
  68. spinlock_t reg_lock;
  69. int dram_checked;
  70. struct snd_card *card; /* The card that this belongs to */
  71. int chorus_mode;
  72. int reverb_mode;
  73. int bass_level;
  74. int treble_level;
  75. struct snd_util_memhdr *memhdr;
  76. spinlock_t control_lock;
  77. struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
  78. struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
  79. };
  80. /* sequencer device id */
  81. #define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
  82. /* exported functions */
  83. int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
  84. struct snd_seq_device **ret);
  85. void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
  86. unsigned int val);
  87. unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
  88. unsigned int reg);
  89. void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
  90. unsigned int val);
  91. unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
  92. unsigned int reg);
  93. void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
  94. void snd_emu8000_init_fm(struct snd_emu8000 *emu);
  95. void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
  96. void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
  97. void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
  98. int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
  99. int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
  100. #endif /* __SOUND_EMU8000_H */