2 Copyright � 2004-2014, Davy Wentzler. All rights reserved.
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"
29 /** Skeleton's variables *************************************************/
31 struct DriverBase driverbase
;
34 /** A sempahore used for locking */
35 struct SignalSemaphore semaphore
;
37 /** The number of 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
50 /*** PCI/Card initialization progress *********************************/
52 struct PCIDevice
*pci_dev
;
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];
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 */
95 /** TRUE when recording is enabled */
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 */
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) */
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 */
152 APTR spdif_out_current_buffer
;
158 /*** Recording interrupt variables ***************************************/
160 /** The recording buffer (simple double buffering is used */
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
;
180 /** Analog mixer variables ***********************************************/
182 /** The currently selected input */
185 /** The currently selected output */
188 /** The current (recording) monitor volume */
189 Fixed monitor_volume
;
191 /** The current (recording) input gain */
194 /** The current (playback) 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 */
209 /** Saved state for AC97 cd */
212 /** Saved state for AC97 vide */
215 /** Saved state for AC97 aux */
218 /** Saved state for AC97 line in */
221 /** Saved state for AC97 phone */
225 #endif /* AHI_Drivers_Card_DriverData_h */