2 emu10kx.audio - AHI driver for SoundBlaster Live! series
3 Copyright (C) 2002-2005 Martin Blom <martin@blom.org>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <clib/alib_protos.h>
23 #include <proto/utility.h>
29 static ULONG dsp_register
[] = {
30 /* Input volume GPR */
45 /* Output volume GPR */
59 VOL_ANALOG_SURROUND_L
,
60 VOL_ANALOG_SURROUND_R
,
64 /* AHI_FRONT-to-rear GPR */
68 /* AHI_SURROUND-to-rear GPR */
72 /* AHI_FRONT-to-center and AHI_FRONT-to-LFE GPRs */
77 /******************************************************************************
78 ** Read from AC97 register ****************************************************
79 ******************************************************************************/
82 AC97GetFunc( struct Hook
* hook
,
83 struct EMU10kxBase
* EMU10kxBase
,
84 struct AC97GetMessage
* msg
)
86 struct DriverBase
* AHIsubBase
= (struct DriverBase
*) EMU10kxBase
;
87 struct EMU10kxData
* dd
;
89 if( msg
->CardNum
>= (ULONG
) EMU10kxBase
->cards_found
||
90 EMU10kxBase
->driverdatas
[ msg
->CardNum
] == NULL
)
92 Req( "No valid EMU10kxData for AC97 card %ld.", msg
->CardNum
);
96 dd
= EMU10kxBase
->driverdatas
[ msg
->CardNum
];
98 if (msg
->Register
>= emu10kx_dsp_first
&&
99 msg
->Register
< emu10kx_dsp_last
) {
101 ULONG reg
= dsp_register
[msg
->Register
- emu10kx_dsp_first
];
104 // Reading is not supported yet ...
108 return emu10k1_readac97( &dd
->card
, msg
->Register
);
113 /******************************************************************************
114 ** Write to AC97 register *****************************************************
115 ******************************************************************************/
118 AC97SetFunc( struct Hook
* hook
,
119 struct EMU10kxBase
* EMU10kxBase
,
120 struct AC97SetMessage
* msg
)
122 struct DriverBase
* AHIsubBase
= (struct DriverBase
*) EMU10kxBase
;
123 struct EMU10kxData
* dd
;
125 if( msg
->CardNum
>= (ULONG
) EMU10kxBase
->cards_found
||
126 EMU10kxBase
->driverdatas
[ msg
->CardNum
] == NULL
)
128 Req( "No valid EMU10kxData for AC97 card %ld.", msg
->CardNum
);
132 dd
= EMU10kxBase
->driverdatas
[ msg
->CardNum
];
134 if (msg
->Register
>= emu10kx_dsp_first
&&
135 msg
->Register
< emu10kx_dsp_last
) {
136 ULONG reg
= dsp_register
[msg
->Register
- emu10kx_dsp_first
];
138 emu10k1_set_volume_gpr( &dd
->card
, reg
, 100, VOL_5BIT
);
141 emu10k1_writeac97( &dd
->card
, msg
->Register
, msg
->Value
);