emu8000.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __SOUND_EMU8000_H
  3. #define __SOUND_EMU8000_H
  4. /*
  5. * Defines for the emu8000 (AWE32/64)
  6. *
  7. * Copyright (C) 1999 Steve Ratcliffe
  8. * Copyright (C) 1999-2000 Takashi Iwai <[email protected]>
  9. */
  10. #include <sound/emux_synth.h>
  11. #include <sound/seq_kernel.h>
  12. /*
  13. * Hardware parameters.
  14. */
  15. #define EMU8000_MAX_DRAM (28 * 1024 * 1024) /* Max on-board mem is 28Mb ???*/
  16. #define EMU8000_DRAM_OFFSET 0x200000 /* Beginning of on board ram */
  17. #define EMU8000_CHANNELS 32 /* Number of hardware channels */
  18. #define EMU8000_DRAM_VOICES 30 /* number of normal voices */
  19. /* Flags to set a dma channel to read or write */
  20. #define EMU8000_RAM_READ 0
  21. #define EMU8000_RAM_WRITE 1
  22. #define EMU8000_RAM_CLOSE 2
  23. #define EMU8000_RAM_MODE_MASK 0x03
  24. #define EMU8000_RAM_RIGHT 0x10 /* use 'right' DMA channel */
  25. enum {
  26. EMU8000_CONTROL_BASS = 0,
  27. EMU8000_CONTROL_TREBLE,
  28. EMU8000_CONTROL_CHORUS_MODE,
  29. EMU8000_CONTROL_REVERB_MODE,
  30. EMU8000_CONTROL_FM_CHORUS_DEPTH,
  31. EMU8000_CONTROL_FM_REVERB_DEPTH,
  32. EMU8000_NUM_CONTROLS,
  33. };
  34. /*
  35. * Structure to hold all state information for the emu8000 driver.
  36. *
  37. * Note 1: The chip supports 32 channels in hardware this is max_channels
  38. * some of the channels may be used for other things so max_channels is
  39. * the number in use for wave voices.
  40. */
  41. struct snd_emu8000 {
  42. struct snd_emux *emu;
  43. int index; /* sequencer client index */
  44. int seq_ports; /* number of sequencer ports */
  45. int fm_chorus_depth; /* FM OPL3 chorus depth */
  46. int fm_reverb_depth; /* FM OPL3 reverb depth */
  47. int mem_size; /* memory size */
  48. unsigned long port1; /* Port usually base+0 */
  49. unsigned long port2; /* Port usually at base+0x400 */
  50. unsigned long port3; /* Port usually at base+0x800 */
  51. unsigned short last_reg;/* Last register command */
  52. spinlock_t reg_lock;
  53. int dram_checked;
  54. struct snd_card *card; /* The card that this belongs to */
  55. int chorus_mode;
  56. int reverb_mode;
  57. int bass_level;
  58. int treble_level;
  59. struct snd_util_memhdr *memhdr;
  60. spinlock_t control_lock;
  61. struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
  62. struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
  63. };
  64. /* sequencer device id */
  65. #define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
  66. /* exported functions */
  67. int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
  68. struct snd_seq_device **ret);
  69. void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
  70. unsigned int val);
  71. unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
  72. unsigned int reg);
  73. void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
  74. unsigned int val);
  75. unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
  76. unsigned int reg);
  77. void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
  78. void snd_emu8000_init_fm(struct snd_emu8000 *emu);
  79. void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
  80. void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
  81. void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
  82. int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
  83. int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
  84. #endif /* __SOUND_EMU8000_H */