Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Drivers / EMU10kx / DriverData.h
blobab65917a1ef21874d090f205953d70b59bd2dcdd
1 /*
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.
20 #ifndef AHI_Drivers_EMU10kx_DriverData_h
21 #define AHI_Drivers_EMU10kx_DriverData_h
23 #include <exec/types.h>
24 #include <exec/interrupts.h>
25 #include <devices/ahi.h>
27 #include "emu10kx-ac97.h"
28 #include "emu10kx-camd.h"
29 #include "hwaccess.h"
30 #include "voicemgr.h"
32 /** Make the common library code initialize a global SysBase for us.
33 It's required for hwaccess.c */
35 #define DRIVER_NEEDS_GLOBAL_EXECBASE
36 #include "DriverBase.h"
38 struct EMU10kxData;
40 struct EMU10kxBase
42 /** Skeleton's variables *************************************************/
44 struct DriverBase driverbase;
47 /** The driver's global data *********************************************/
50 /** A sempahore used for locking */
51 struct SignalSemaphore semaphore;
53 /** The number of cards found */
54 int cards_found;
56 /** A EMU10kxData structure for each card found */
57 struct EMU10kxData** driverdatas;
59 /** The public CAMD interface */
60 struct EMU10kxCamd camd;
62 /** The public AC97 interface */
63 struct EMU10kxAC97 ac97;
65 /** TRUE if the DMA buffers have to be flushed before played etc. */
66 BOOL flush_caches;
69 #define DRIVERBASE_SIZEOF (sizeof (struct EMU10kxBase))
71 #define RECORD_BUFFER_SAMPLES 4096
72 #define RECORD_BUFFER_SIZE_VALUE ADCBS_BUFSIZE_16384
73 #ifndef __AMIGAOS4__
74 #define TIMER_INTERRUPT_FREQUENCY 1000
75 #else
76 #define TIMER_INTERRUPT_FREQUENCY 80
77 #endif
80 struct EMU10kxData
82 /** Skeleton's variables *************************************************/
84 struct DriverData driverdata;
86 /*** PCI/EMU10kx initialization progress *********************************/
88 /** TRUE if bus mastering is activated */
89 BOOL pci_master_enabled;
91 /** TRUE if the EMU10kx chip has been initialized */
92 BOOL emu10k1_initialized;
94 /*** The driverbase ******************************************************/
96 /** This field is also used as a lock and access to is is
97 * semaphore protected. */
98 struct DriverBase* ahisubbase;
100 /*** The AudioCtrl currently using this DriverData structure *************/
102 struct AHIAudioCtrlDrv* audioctrl;
104 /*** Playback/recording interrupts ***************************************/
106 /** TRUE when playback is enabled */
107 BOOL is_playing;
109 /** TRUE when recording is enabled */
110 BOOL is_recording;
112 /** The main (hardware) interrupt */
113 struct Interrupt interrupt;
115 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
116 BOOL interrupt_added;
118 /** The playback software interrupt */
119 struct Interrupt playback_interrupt;
121 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
122 BOOL playback_interrupt_enabled;
124 /** The recording software interrupt */
125 struct Interrupt record_interrupt;
127 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
128 BOOL record_interrupt_enabled;
130 /*** CAMD support functions **********************************************/
132 /** CAMD transmitter function wrapped as a Hook */
133 struct Hook* camd_transmitfunc;
135 /** CAMD receiver function wrapped as a Hook */
136 struct Hook* camd_receivefunc;
138 /** True if CMAD V40 mode */
139 ULONG camd_v40;
141 /*** EMU10kx structures **************************************************/
143 struct emu10k1_card card;
144 struct emu_voice voices[4];
146 UWORD voice_buffers_allocated;
147 UWORD voices_allocated;
148 UWORD voices_started;
149 UWORD pad;
152 /*** Playback interrupt variables ****************************************/
154 /** The mixing buffer (a cyclic buffer filled by AHI) */
155 APTR mix_buffer;
157 /** The length of each playback buffer in sample frames */
158 ULONG current_length;
160 /** The length of each playback buffer in sample bytes */
161 ULONG current_size;
163 /** Where (inside the cyclic buffer) we're currently writing */
164 APTR current_buffers[4];
166 /** The offset (inside the cyclic buffer) we're currently writing */
167 ULONG current_position;
170 /*** Recording interrupt variables ***************************************/
172 /** The recording buffer (simple double buffering is used */
173 APTR record_buffer;
175 /** The DMA handle for the record buffer */
176 dma_addr_t record_dma_handle;
178 /** Were (inside the recording buffer) the current data is */
179 APTR current_record_buffer;
181 /** Analog mixer variables ***********************************************/
183 /** The currently selected input */
184 UWORD input;
186 /** The currently selected output */
187 UWORD output;
189 /** The current (recording) monitor volume */
190 Fixed monitor_volume;
192 /** The current (recording) input gain */
193 Fixed input_gain;
195 /** The current (playback) output volume */
196 Fixed output_volume;
198 /** The hardware register value corresponding to monitor_volume */
199 UWORD monitor_volume_bits;
201 /** The hardware register value corresponding to input_gain */
202 UWORD input_gain_bits;
204 /** The hardware register value corresponding to output_volume */
205 UWORD output_volume_bits;
207 /** Saved state for AC97 mike */
208 UWORD ac97_mic;
210 /** Saved state for AC97 cd */
211 UWORD ac97_cd;
213 /** Saved state for AC97 vide */
214 UWORD ac97_video;
216 /** Saved state for AC97 aux */
217 UWORD ac97_aux;
219 /** Saved state for AC97 line in */
220 UWORD ac97_linein;
222 /** Saved state for AC97 phone */
223 UWORD ac97_phone;
226 #endif /* AHI_Drivers_EMU10kx_DriverData_h */