1 #ifndef AHI_Drivers_Card_DriverData_h
2 #define AHI_Drivers_Card_DriverData_h
4 #include <exec/types.h>
5 #include <exec/interrupts.h>
6 #include <devices/ahi.h>
9 /** Make the common library code initialize a global SysBase for us.
10 It's required for hwaccess.c */
12 #define DRIVER "hdaudio.audio"
13 #define DRIVER_NEEDS_GLOBAL_EXECBASE
17 #define DRIVER_NEED_GLOBAL_EXECBASE
21 #define DRIVER_NEED_GLOBAL_EXECBASE
24 #include "DriverBase.h"
30 struct DriverBase driverbase
;
33 /** A sempahore used for locking */
34 struct SignalSemaphore semaphore
;
36 /** The number of cards found */
39 /** A HDAudioChip structure for each card found */
40 struct HDAudioChip
** driverdatas
;
43 #define DRIVERBASE_SIZEOF (sizeof (struct HDAudioBase))
45 #define RECORD_BUFFER_SAMPLES 1024
46 #define RECORD_BUFFER_SIZE_VALUE ADCBS_BUFSIZE_4096
50 struct BDLE
// Buffer Descriptor List (3.6.2)
52 ULONG lower_address
; // address for 32-bit systems
53 ULONG upper_address
; // only for use with 64-bit systems
54 ULONG length
; // in bytes
55 ULONG reserved_ioc
; // bit 0 is Interrupt on Completion
62 APTR
*bdl_nonaligned_addresses
;
64 ULONG sd_reg_offset
; // 3.3.35 offset 0x80 + (ISS) * 0x20
66 ULONG tag
; // index + 1
71 // Verb - Set Converter Format (Verb ID=2h)
75 UBYTE base44100
; // 1 if base= 44.1kHz, 0 if base=48kHz
76 UBYTE mult
; // multiplier 3 bits
77 UBYTE div
; // divisor 3 bits
84 struct PCIDevice
*pci_dev
;
91 unsigned char chiprev
;
100 ULONG rirb_rp
; // software read pointer
103 APTR dma_position_buffer
;
105 struct Stream
*streams
;
107 UBYTE nr_of_input_streams
;
108 UBYTE nr_of_output_streams
;
110 // important node ID's
111 UBYTE dac_nid
; // front L&R
114 BOOL adc_mixer_is_mux
;
115 UBYTE dac_volume_nid
;
126 UBYTE adc_mixer_indices
[5]; //0 = Line in, 1 = Mic in 1, 2 = Mic in 2, 3 = CD, 4 = Monitor Mixer
136 struct Freq
*frequencies
;
137 ULONG nr_of_frequencies
;
138 ULONG selected_freq_index
;
140 /*** PCI/Card initialization progress *********************************/
142 /** TRUE if bus mastering is activated */
143 BOOL pci_master_enabled
;
145 /** TRUE if the Card chip has been initialized */
146 BOOL card_initialized
;
148 /*** The driverbase ******************************************************/
150 /** This field is also used as a lock and access to is is
151 * semaphore protected. */
152 struct DriverBase
* ahisubbase
;
154 /*** The AudioCtrl currently using this DriverData structure *************/
156 struct AHIAudioCtrlDrv
* audioctrl
;
158 /*** Playback/recording interrupts ***************************************/
160 /** TRUE when playback is enabled */
163 /** TRUE when recording is enabled */
166 /** The main (hardware) interrupt */
167 struct Interrupt interrupt
;
169 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
170 BOOL interrupt_added
;
172 /** The playback software interrupt */
173 struct Interrupt playback_interrupt
;
175 /** The recording software interrupt */
176 struct Interrupt record_interrupt
;
178 /*** Card structures **************************************************/
180 APTR playback_buffer1
;
181 APTR playback_buffer2
;
183 /*** Playback interrupt variables ****************************************/
185 /** The mixing buffer (a cyclic buffer filled by AHI) */
188 /** The length of each playback buffer in sample frames */
189 ULONG current_frames
;
191 /** The length of each playback buffer in sample bytes */
192 ULONG current_bytesize
;
194 /** Where (inside the cyclic buffer) we're currently writing */
199 /*** Recording interrupt variables ***************************************/
201 /** The recording buffer (simple double buffering is used */
204 APTR record_buffer1_nonaligned
;
205 APTR record_buffer2_nonaligned
;
207 /** Were (inside the recording buffer) the current data is */
208 APTR current_record_buffer
;
210 /** The length of each record buffer in sample bytes */
211 ULONG current_record_bytesize
;
213 /** Analog mixer variables ***********************************************/
215 /** The currently selected input */
220 /** The currently selected output */
223 /** The current (recording) monitor volume */
224 Fixed monitor_volume
;
226 /** The current (recording) input gain */
229 /** The current (playback) output volume */
234 #endif /* AHI_Drivers_Card_DriverData_h */