Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | /* |
| 27 | * Data port addresses relative to the EMU base. |
| 28 | */ |
| 29 | #define EMU8000_DATA0(e) ((e)->port1) |
| 30 | #define EMU8000_DATA1(e) ((e)->port2) |
| 31 | #define EMU8000_DATA2(e) ((e)->port2+2) |
| 32 | #define EMU8000_DATA3(e) ((e)->port3) |
| 33 | #define EMU8000_PTR(e) ((e)->port3+2) |
| 34 | |
| 35 | /* |
| 36 | * Make a command from a register and channel. |
| 37 | */ |
| 38 | #define EMU8000_CMD(reg, chan) ((reg)<<5 | (chan)) |
| 39 | |
| 40 | /* |
| 41 | * Commands to read and write the EMU8000 registers. |
| 42 | * These macros should be used for all register accesses. |
| 43 | */ |
| 44 | #define EMU8000_CPF_READ(emu, chan) \ |
| 45 | snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(0, (chan))) |
| 46 | #define EMU8000_PTRX_READ(emu, chan) \ |
| 47 | snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(1, (chan))) |
| 48 | #define EMU8000_CVCF_READ(emu, chan) \ |
| 49 | snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(2, (chan))) |
| 50 | #define EMU8000_VTFT_READ(emu, chan) \ |
| 51 | snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(3, (chan))) |
| 52 | #define EMU8000_PSST_READ(emu, chan) \ |
| 53 | snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(6, (chan))) |
| 54 | #define EMU8000_CSL_READ(emu, chan) \ |
| 55 | snd_emu8000_peek_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(7, (chan))) |
| 56 | #define EMU8000_CCCA_READ(emu, chan) \ |
| 57 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(0, (chan))) |
| 58 | #define EMU8000_HWCF4_READ(emu) \ |
| 59 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 9)) |
| 60 | #define EMU8000_HWCF5_READ(emu) \ |
| 61 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 10)) |
| 62 | #define EMU8000_HWCF6_READ(emu) \ |
| 63 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 13)) |
| 64 | #define EMU8000_SMALR_READ(emu) \ |
| 65 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 20)) |
| 66 | #define EMU8000_SMARR_READ(emu) \ |
| 67 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 21)) |
| 68 | #define EMU8000_SMALW_READ(emu) \ |
| 69 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 22)) |
| 70 | #define EMU8000_SMARW_READ(emu) \ |
| 71 | snd_emu8000_peek_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 23)) |
| 72 | #define EMU8000_SMLD_READ(emu) \ |
| 73 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 26)) |
| 74 | #define EMU8000_SMRD_READ(emu) \ |
| 75 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 26)) |
| 76 | #define EMU8000_WC_READ(emu) \ |
| 77 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 27)) |
| 78 | #define EMU8000_HWCF1_READ(emu) \ |
| 79 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 29)) |
| 80 | #define EMU8000_HWCF2_READ(emu) \ |
| 81 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 30)) |
| 82 | #define EMU8000_HWCF3_READ(emu) \ |
| 83 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 31)) |
| 84 | #define EMU8000_INIT1_READ(emu, chan) \ |
| 85 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(2, (chan))) |
| 86 | #define EMU8000_INIT2_READ(emu, chan) \ |
| 87 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(2, (chan))) |
| 88 | #define EMU8000_INIT3_READ(emu, chan) \ |
| 89 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(3, (chan))) |
| 90 | #define EMU8000_INIT4_READ(emu, chan) \ |
| 91 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(3, (chan))) |
| 92 | #define EMU8000_ENVVOL_READ(emu, chan) \ |
| 93 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(4, (chan))) |
| 94 | #define EMU8000_DCYSUSV_READ(emu, chan) \ |
| 95 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(5, (chan))) |
| 96 | #define EMU8000_ENVVAL_READ(emu, chan) \ |
| 97 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(6, (chan))) |
| 98 | #define EMU8000_DCYSUS_READ(emu, chan) \ |
| 99 | snd_emu8000_peek((emu), EMU8000_DATA1(emu), EMU8000_CMD(7, (chan))) |
| 100 | #define EMU8000_ATKHLDV_READ(emu, chan) \ |
| 101 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(4, (chan))) |
| 102 | #define EMU8000_LFO1VAL_READ(emu, chan) \ |
| 103 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(5, (chan))) |
| 104 | #define EMU8000_ATKHLD_READ(emu, chan) \ |
| 105 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(6, (chan))) |
| 106 | #define EMU8000_LFO2VAL_READ(emu, chan) \ |
| 107 | snd_emu8000_peek((emu), EMU8000_DATA2(emu), EMU8000_CMD(7, (chan))) |
| 108 | #define EMU8000_IP_READ(emu, chan) \ |
| 109 | snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(0, (chan))) |
| 110 | #define EMU8000_IFATN_READ(emu, chan) \ |
| 111 | snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(1, (chan))) |
| 112 | #define EMU8000_PEFE_READ(emu, chan) \ |
| 113 | snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(2, (chan))) |
| 114 | #define EMU8000_FMMOD_READ(emu, chan) \ |
| 115 | snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(3, (chan))) |
| 116 | #define EMU8000_TREMFRQ_READ(emu, chan) \ |
| 117 | snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(4, (chan))) |
| 118 | #define EMU8000_FM2FRQ2_READ(emu, chan) \ |
| 119 | snd_emu8000_peek((emu), EMU8000_DATA3(emu), EMU8000_CMD(5, (chan))) |
| 120 | |
| 121 | |
| 122 | #define EMU8000_CPF_WRITE(emu, chan, val) \ |
| 123 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(0, (chan)), (val)) |
| 124 | #define EMU8000_PTRX_WRITE(emu, chan, val) \ |
| 125 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(1, (chan)), (val)) |
| 126 | #define EMU8000_CVCF_WRITE(emu, chan, val) \ |
| 127 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(2, (chan)), (val)) |
| 128 | #define EMU8000_VTFT_WRITE(emu, chan, val) \ |
| 129 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(3, (chan)), (val)) |
| 130 | #define EMU8000_PSST_WRITE(emu, chan, val) \ |
| 131 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(6, (chan)), (val)) |
| 132 | #define EMU8000_CSL_WRITE(emu, chan, val) \ |
| 133 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(7, (chan)), (val)) |
| 134 | #define EMU8000_CCCA_WRITE(emu, chan, val) \ |
| 135 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(0, (chan)), (val)) |
| 136 | #define EMU8000_HWCF4_WRITE(emu, val) \ |
| 137 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 9), (val)) |
| 138 | #define EMU8000_HWCF5_WRITE(emu, val) \ |
| 139 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 10), (val)) |
| 140 | #define EMU8000_HWCF6_WRITE(emu, val) \ |
| 141 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 13), (val)) |
| 142 | /* this register is not documented */ |
| 143 | #define EMU8000_HWCF7_WRITE(emu, val) \ |
| 144 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 14), (val)) |
| 145 | #define EMU8000_SMALR_WRITE(emu, val) \ |
| 146 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 20), (val)) |
| 147 | #define EMU8000_SMARR_WRITE(emu, val) \ |
| 148 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 21), (val)) |
| 149 | #define EMU8000_SMALW_WRITE(emu, val) \ |
| 150 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 22), (val)) |
| 151 | #define EMU8000_SMARW_WRITE(emu, val) \ |
| 152 | snd_emu8000_poke_dw((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 23), (val)) |
| 153 | #define EMU8000_SMLD_WRITE(emu, val) \ |
| 154 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 26), (val)) |
| 155 | #define EMU8000_SMRD_WRITE(emu, val) \ |
| 156 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 26), (val)) |
| 157 | #define EMU8000_WC_WRITE(emu, val) \ |
| 158 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(1, 27), (val)) |
| 159 | #define EMU8000_HWCF1_WRITE(emu, val) \ |
| 160 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 29), (val)) |
| 161 | #define EMU8000_HWCF2_WRITE(emu, val) \ |
| 162 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 30), (val)) |
| 163 | #define EMU8000_HWCF3_WRITE(emu, val) \ |
| 164 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(1, 31), (val)) |
| 165 | #define EMU8000_INIT1_WRITE(emu, chan, val) \ |
| 166 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(2, (chan)), (val)) |
| 167 | #define EMU8000_INIT2_WRITE(emu, chan, val) \ |
| 168 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(2, (chan)), (val)) |
| 169 | #define EMU8000_INIT3_WRITE(emu, chan, val) \ |
| 170 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(3, (chan)), (val)) |
| 171 | #define EMU8000_INIT4_WRITE(emu, chan, val) \ |
| 172 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(3, (chan)), (val)) |
| 173 | #define EMU8000_ENVVOL_WRITE(emu, chan, val) \ |
| 174 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(4, (chan)), (val)) |
| 175 | #define EMU8000_DCYSUSV_WRITE(emu, chan, val) \ |
| 176 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(5, (chan)), (val)) |
| 177 | #define EMU8000_ENVVAL_WRITE(emu, chan, val) \ |
| 178 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(6, (chan)), (val)) |
| 179 | #define EMU8000_DCYSUS_WRITE(emu, chan, val) \ |
| 180 | snd_emu8000_poke((emu), EMU8000_DATA1(emu), EMU8000_CMD(7, (chan)), (val)) |
| 181 | #define EMU8000_ATKHLDV_WRITE(emu, chan, val) \ |
| 182 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(4, (chan)), (val)) |
| 183 | #define EMU8000_LFO1VAL_WRITE(emu, chan, val) \ |
| 184 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(5, (chan)), (val)) |
| 185 | #define EMU8000_ATKHLD_WRITE(emu, chan, val) \ |
| 186 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(6, (chan)), (val)) |
| 187 | #define EMU8000_LFO2VAL_WRITE(emu, chan, val) \ |
| 188 | snd_emu8000_poke((emu), EMU8000_DATA2(emu), EMU8000_CMD(7, (chan)), (val)) |
| 189 | #define EMU8000_IP_WRITE(emu, chan, val) \ |
| 190 | snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(0, (chan)), (val)) |
| 191 | #define EMU8000_IFATN_WRITE(emu, chan, val) \ |
| 192 | snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(1, (chan)), (val)) |
| 193 | #define EMU8000_PEFE_WRITE(emu, chan, val) \ |
| 194 | snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(2, (chan)), (val)) |
| 195 | #define EMU8000_FMMOD_WRITE(emu, chan, val) \ |
| 196 | snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(3, (chan)), (val)) |
| 197 | #define EMU8000_TREMFRQ_WRITE(emu, chan, val) \ |
| 198 | snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(4, (chan)), (val)) |
| 199 | #define EMU8000_FM2FRQ2_WRITE(emu, chan, val) \ |
| 200 | snd_emu8000_poke((emu), EMU8000_DATA3(emu), EMU8000_CMD(5, (chan)), (val)) |
| 201 | |
| 202 | #define EMU8000_0080_WRITE(emu, chan, val) \ |
| 203 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(4, (chan)), (val)) |
| 204 | #define EMU8000_00A0_WRITE(emu, chan, val) \ |
| 205 | snd_emu8000_poke_dw((emu), EMU8000_DATA0(emu), EMU8000_CMD(5, (chan)), (val)) |
| 206 | |
| 207 | #endif /* __SOUND_EMU8000_REG_H */ |