emu8000_reg.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #ifndef __SOUND_EMU8000_REG_H
  2. #define __SOUND_EMU8000_REG_H
  3. /*
  4. * Register operations for the EMU8000
  5. *
  6. * Copyright (C) 1999 Steve Ratcliffe
  7. *
  8. * Based on awe_wave.c by Takashi Iwai
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. */
  25. /*
  26. * Data port addresses relative to the EMU base.
  27. */
  28. #define EMU8000_DATA0(e) ((e)->port1)
  29. #define EMU8000_DATA1(e) ((e)->port2)
  30. #define EMU8000_DATA2(e) ((e)->port2+2)
  31. #define EMU8000_DATA3(e) ((e)->port3)
  32. #define EMU8000_PTR(e) ((e)->port3+2)
  33. /*
  34. * Make a command from a register and channel.
  35. */
  36. #define EMU8000_CMD(reg, chan) ((reg)<<5 | (chan))
  37. /*
  38. * Commands to read and write the EMU8000 registers.
  39. * These macros should be used for all register accesses.
  40. */
  41. #define EMU8000_CPF_READ(emu, chan) \
  42. snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(0, (chan)))
  43. #define EMU8000_PTRX_READ(emu, chan) \
  44. snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(1, (chan)))
  45. #define EMU8000_CVCF_READ(emu, chan) \
  46. snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(2, (chan)))
  47. #define EMU8000_VTFT_READ(emu, chan) \
  48. snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(3, (chan)))
  49. #define EMU8000_PSST_READ(emu, chan) \
  50. snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(6, (chan)))
  51. #define EMU8000_CSL_READ(emu, chan) \
  52. snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(7, (chan)))
  53. #define EMU8000_CCCA_READ(emu, chan) \
  54. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(0, (chan)))
  55. #define EMU8000_HWCF4_READ(emu) \
  56. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 9))
  57. #define EMU8000_HWCF5_READ(emu) \
  58. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 10))
  59. #define EMU8000_HWCF6_READ(emu) \
  60. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 13))
  61. #define EMU8000_SMALR_READ(emu) \
  62. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 20))
  63. #define EMU8000_SMARR_READ(emu) \
  64. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 21))
  65. #define EMU8000_SMALW_READ(emu) \
  66. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 22))
  67. #define EMU8000_SMARW_READ(emu) \
  68. snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 23))
  69. #define EMU8000_SMLD_READ(emu) \
  70. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 26))
  71. #define EMU8000_SMRD_READ(emu) \
  72. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 26))
  73. #define EMU8000_WC_READ(emu) \
  74. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 27))
  75. #define EMU8000_HWCF1_READ(emu) \
  76. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 29))
  77. #define EMU8000_HWCF2_READ(emu) \
  78. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 30))
  79. #define EMU8000_HWCF3_READ(emu) \
  80. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 31))
  81. #define EMU8000_INIT1_READ(emu, chan) \
  82. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(2, (chan)))
  83. #define EMU8000_INIT2_READ(emu, chan) \
  84. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(2, (chan)))
  85. #define EMU8000_INIT3_READ(emu, chan) \
  86. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(3, (chan)))
  87. #define EMU8000_INIT4_READ(emu, chan) \
  88. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(3, (chan)))
  89. #define EMU8000_ENVVOL_READ(emu, chan) \
  90. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(4, (chan)))
  91. #define EMU8000_DCYSUSV_READ(emu, chan) \
  92. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(5, (chan)))
  93. #define EMU8000_ENVVAL_READ(emu, chan) \
  94. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(6, (chan)))
  95. #define EMU8000_DCYSUS_READ(emu, chan) \
  96. snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(7, (chan)))
  97. #define EMU8000_ATKHLDV_READ(emu, chan) \
  98. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(4, (chan)))
  99. #define EMU8000_LFO1VAL_READ(emu, chan) \
  100. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(5, (chan)))
  101. #define EMU8000_ATKHLD_READ(emu, chan) \
  102. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(6, (chan)))
  103. #define EMU8000_LFO2VAL_READ(emu, chan) \
  104. snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(7, (chan)))
  105. #define EMU8000_IP_READ(emu, chan) \
  106. snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(0, (chan)))
  107. #define EMU8000_IFATN_READ(emu, chan) \
  108. snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(1, (chan)))
  109. #define EMU8000_PEFE_READ(emu, chan) \
  110. snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(2, (chan)))
  111. #define EMU8000_FMMOD_READ(emu, chan) \
  112. snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(3, (chan)))
  113. #define EMU8000_TREMFRQ_READ(emu, chan) \
  114. snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(4, (chan)))
  115. #define EMU8000_FM2FRQ2_READ(emu, chan) \
  116. snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(5, (chan)))
  117. #define EMU8000_CPF_WRITE(emu, chan, val) \
  118. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(0, (chan)), (val))
  119. #define EMU8000_PTRX_WRITE(emu, chan, val) \
  120. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(1, (chan)), (val))
  121. #define EMU8000_CVCF_WRITE(emu, chan, val) \
  122. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(2, (chan)), (val))
  123. #define EMU8000_VTFT_WRITE(emu, chan, val) \
  124. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(3, (chan)), (val))
  125. #define EMU8000_PSST_WRITE(emu, chan, val) \
  126. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(6, (chan)), (val))
  127. #define EMU8000_CSL_WRITE(emu, chan, val) \
  128. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(7, (chan)), (val))
  129. #define EMU8000_CCCA_WRITE(emu, chan, val) \
  130. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(0, (chan)), (val))
  131. #define EMU8000_HWCF4_WRITE(emu, val) \
  132. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 9), (val))
  133. #define EMU8000_HWCF5_WRITE(emu, val) \
  134. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 10), (val))
  135. #define EMU8000_HWCF6_WRITE(emu, val) \
  136. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 13), (val))
  137. /* this register is not documented */
  138. #define EMU8000_HWCF7_WRITE(emu, val) \
  139. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 14), (val))
  140. #define EMU8000_SMALR_WRITE(emu, val) \
  141. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 20), (val))
  142. #define EMU8000_SMARR_WRITE(emu, val) \
  143. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 21), (val))
  144. #define EMU8000_SMALW_WRITE(emu, val) \
  145. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 22), (val))
  146. #define EMU8000_SMARW_WRITE(emu, val) \
  147. snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 23), (val))
  148. #define EMU8000_SMLD_WRITE(emu, val) \
  149. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 26), (val))
  150. #define EMU8000_SMRD_WRITE(emu, val) \
  151. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 26), (val))
  152. #define EMU8000_WC_WRITE(emu, val) \
  153. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 27), (val))
  154. #define EMU8000_HWCF1_WRITE(emu, val) \
  155. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 29), (val))
  156. #define EMU8000_HWCF2_WRITE(emu, val) \
  157. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 30), (val))
  158. #define EMU8000_HWCF3_WRITE(emu, val) \
  159. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 31), (val))
  160. #define EMU8000_INIT1_WRITE(emu, chan, val) \
  161. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(2, (chan)), (val))
  162. #define EMU8000_INIT2_WRITE(emu, chan, val) \
  163. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(2, (chan)), (val))
  164. #define EMU8000_INIT3_WRITE(emu, chan, val) \
  165. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(3, (chan)), (val))
  166. #define EMU8000_INIT4_WRITE(emu, chan, val) \
  167. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(3, (chan)), (val))
  168. #define EMU8000_ENVVOL_WRITE(emu, chan, val) \
  169. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(4, (chan)), (val))
  170. #define EMU8000_DCYSUSV_WRITE(emu, chan, val) \
  171. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(5, (chan)), (val))
  172. #define EMU8000_ENVVAL_WRITE(emu, chan, val) \
  173. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(6, (chan)), (val))
  174. #define EMU8000_DCYSUS_WRITE(emu, chan, val) \
  175. snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(7, (chan)), (val))
  176. #define EMU8000_ATKHLDV_WRITE(emu, chan, val) \
  177. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(4, (chan)), (val))
  178. #define EMU8000_LFO1VAL_WRITE(emu, chan, val) \
  179. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(5, (chan)), (val))
  180. #define EMU8000_ATKHLD_WRITE(emu, chan, val) \
  181. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(6, (chan)), (val))
  182. #define EMU8000_LFO2VAL_WRITE(emu, chan, val) \
  183. snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(7, (chan)), (val))
  184. #define EMU8000_IP_WRITE(emu, chan, val) \
  185. snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(0, (chan)), (val))
  186. #define EMU8000_IFATN_WRITE(emu, chan, val) \
  187. snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(1, (chan)), (val))
  188. #define EMU8000_PEFE_WRITE(emu, chan, val) \
  189. snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(2, (chan)), (val))
  190. #define EMU8000_FMMOD_WRITE(emu, chan, val) \
  191. snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(3, (chan)), (val))
  192. #define EMU8000_TREMFRQ_WRITE(emu, chan, val) \
  193. snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(4, (chan)), (val))
  194. #define EMU8000_FM2FRQ2_WRITE(emu, chan, val) \
  195. snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(5, (chan)), (val))
  196. #define EMU8000_0080_WRITE(emu, chan, val) \
  197. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(4, (chan)), (val))
  198. #define EMU8000_00A0_WRITE(emu, chan, val) \
  199. snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(5, (chan)), (val))
  200. #endif /* __SOUND_EMU8000_REG_H */