Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Drivers / Envy24 / DriverData.h
blob03776ae47e1e12ff2c8650b5bed9e546a4dbffb1
1 /*
2 Copyright � 2004-2014, Davy Wentzler. All rights reserved.
3 $Id$
4 */
6 #ifndef AHI_Drivers_Card_DriverData_h
7 #define AHI_Drivers_Card_DriverData_h
9 #include <exec/types.h>
10 #include <exec/interrupts.h>
11 #include <devices/ahi.h>
13 #define DRIVER "envy24.audio"
14 #define DRIVER_NEEDS_GLOBAL_EXECBASE
16 enum Model {PHASE88, MAUDIO_2496, MAUDIO_1010LT, MAUDIO_DELTA44, MAUDIO_DELTA66};
18 #include "DriverBase.h"
19 #include "I2C.h"
20 #include "ak_codec.h"
25 struct CardData;
27 struct CardBase
29 /** Skeleton's variables *************************************************/
31 struct DriverBase driverbase;
34 /** A sempahore used for locking */
35 struct SignalSemaphore semaphore;
37 /** The number of cards found */
38 int cards_found;
40 /** A CardData structure for each card found */
41 struct CardData** driverdatas;
44 #define DRIVERBASE_SIZEOF (sizeof (struct CardBase))
45 #define RECORD_BUFFER_SAMPLES 1764
48 struct CardData
50 /*** PCI/Card initialization progress *********************************/
52 struct PCIDevice *pci_dev;
53 unsigned long iobase;
54 unsigned long mtbase;
55 unsigned short model;
56 unsigned char chiprev;
57 unsigned char gpio_dir;
58 unsigned char gpio_data;
59 struct I2C_bit_ops *bit_ops;
60 struct I2C *i2c_cs8404;
61 struct I2C *i2c_in_addr;
62 struct I2C *i2c_out_addr;
63 enum akm_types akm_type;
64 struct akm_codec codec[4];
66 enum Model SubType;
69 /** TRUE if bus mastering is activated */
70 BOOL pci_master_enabled;
72 /** TRUE if the Card chip has been initialized */
73 BOOL card_initialized;
77 /*** The driverbase ******************************************************/
79 /** This field is also used as a lock and access to is is
80 * semaphore protected. */
81 struct DriverBase* ahisubbase;
84 /*** The AudioCtrl currently using this DriverData structure *************/
86 struct AHIAudioCtrlDrv* audioctrl;
90 /*** Playback/recording interrupts ***************************************/
92 /** TRUE when playback is enabled */
93 BOOL is_playing;
95 /** TRUE when recording is enabled */
96 BOOL is_recording;
98 /** The main (hardware) interrupt */
99 struct Interrupt interrupt;
101 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
102 BOOL interrupt_added;
104 /** The playback software interrupt */
105 struct Interrupt playback_interrupt;
107 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
108 BOOL playback_interrupt_enabled;
110 /** The recording software interrupt */
111 struct Interrupt record_interrupt;
113 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
114 BOOL record_interrupt_enabled;
118 /*** CAMD support functions **********************************************/
120 /** CAMD transmitter function wrapped as a Hook */
121 struct Hook* camd_transmitfunc;
123 /** CAMD receiver function wrapped as a Hook */
124 struct Hook* camd_receivefunc;
126 /** True if CMAD V40 mode */
127 ULONG camd_v40;
131 /*** Playback interrupt variables ****************************************/
133 APTR playback_buffer;
134 APTR spdif_out_buffer;
135 APTR playback_buffer_nonaligned;
136 APTR spdif_out_buffer_nonaligned;
137 APTR playback_buffer_phys;
138 APTR spdif_out_buffer_phys;
141 /** The mixing buffer (a cyclic buffer filled by AHI) */
142 APTR mix_buffer;
144 /** The length of each playback buffer in sample frames */
145 ULONG current_frames;
147 /** The length of each playback buffer in sample bytes */
148 ULONG current_bytesize;
150 /** Where (inside the cyclic buffer) we're currently writing */
151 APTR current_buffer;
152 APTR spdif_out_current_buffer;
154 int flip;
158 /*** Recording interrupt variables ***************************************/
160 /** The recording buffer (simple double buffering is used */
161 APTR record_buffer;
162 APTR record_buffer_32bit;
163 APTR record_buffer_nonaligned;
164 APTR record_buffer_nonaligned_32bit;
165 APTR record_buffer_phys;
166 APTR record_buffer_32bit_phys;
168 /** Were (inside the recording buffer) the current data is */
169 APTR current_record_buffer;
170 APTR current_record_buffer_32bit;
172 /** The length of each record buffer in sample bytes */
173 ULONG current_record_bytesize_32bit;
174 ULONG current_record_bytesize_target;
176 int recflip;
180 /** Analog mixer variables ***********************************************/
182 /** The currently selected input */
183 UWORD input;
185 /** The currently selected output */
186 UWORD output;
188 /** The current (recording) monitor volume */
189 Fixed monitor_volume;
191 /** The current (recording) input gain */
192 Fixed input_gain;
194 /** The current (playback) output volume */
195 Fixed output_volume;
197 /** The hardware register value corresponding to monitor_volume */
198 UWORD monitor_volume_bits;
200 /** The hardware register value corresponding to input_gain */
201 UWORD input_gain_bits;
203 /** The hardware register value corresponding to output_volume */
204 UWORD output_volume_bits;
206 /** Saved state for AC97 mike */
207 UWORD ac97_mic;
209 /** Saved state for AC97 cd */
210 UWORD ac97_cd;
212 /** Saved state for AC97 vide */
213 UWORD ac97_video;
215 /** Saved state for AC97 aux */
216 UWORD ac97_aux;
218 /** Saved state for AC97 line in */
219 UWORD ac97_linein;
221 /** Saved state for AC97 phone */
222 UWORD ac97_phone;
225 #endif /* AHI_Drivers_Card_DriverData_h */