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
16 #include "DriverBase.h"
22 struct DriverBase driverbase
;
25 /** A sempahore used for locking */
26 struct SignalSemaphore semaphore
;
28 /** The number of cards found */
31 /** A HDAudioChip structure for each card found */
32 struct HDAudioChip
** driverdatas
;
35 #define DRIVERBASE_SIZEOF (sizeof (struct HDAudioBase))
37 #define RECORD_BUFFER_SAMPLES 1024
38 #define RECORD_BUFFER_SIZE_VALUE ADCBS_BUFSIZE_4096
42 struct BDLE
// Buffer Descriptor List (3.6.2)
44 ULONG lower_address
; // address for 32-bit systems
45 ULONG upper_address
; // only for use with 64-bit systems
46 ULONG length
; // in bytes
47 ULONG reserved_ioc
; // bit 0 is Interrupt on Completion
54 APTR
*bdl_nonaligned_addresses
;
56 ULONG sd_reg_offset
; // 3.3.35 offset 0x80 + (ISS) * 0x20
58 ULONG tag
; // index + 1
63 // Verb - Set Converter Format (Verb ID=2h)
67 UBYTE base44100
; // 1 if base= 44.1kHz, 0 if base=48kHz
68 UBYTE mult
; // multiplier 3 bits
69 UBYTE div
; // divisor 3 bits
76 struct PCIDevice
*pci_dev
;
82 unsigned char chiprev
;
91 ULONG rirb_rp
; // software read pointer
94 APTR dma_position_buffer
;
96 struct Stream
*streams
;
98 UBYTE nr_of_input_streams
;
99 UBYTE nr_of_output_streams
;
101 // important node ID's
102 UBYTE function_group
;
103 UBYTE dac_nid
; // front L&R
106 BOOL adc_mixer_is_mux
;
107 UBYTE dac_volume_nids
[10];
108 UBYTE dac_volume_count
;
118 UBYTE adc_mixer_indices
[5]; //0 = Line in, 1 = Mic in 1, 2 = Mic in 2, 3 = CD, 4 = Monitor Mixer
128 struct Freq
*frequencies
;
129 ULONG nr_of_frequencies
;
130 ULONG selected_freq_index
;
132 UBYTE eapd_gpio_mask
;
134 /*** PCI/Card initialization progress *********************************/
136 /** TRUE if bus mastering is activated */
137 BOOL pci_master_enabled
;
139 /** TRUE if the Card chip has been initialized */
140 BOOL card_initialized
;
142 /*** The driverbase ******************************************************/
144 /** This field is also used as a lock and access to is is
145 * semaphore protected. */
146 struct DriverBase
* ahisubbase
;
148 /*** The AudioCtrl currently using this DriverData structure *************/
150 struct AHIAudioCtrlDrv
* audioctrl
;
152 /*** Playback/recording interrupts ***************************************/
154 /** TRUE when playback is enabled */
157 /** TRUE when recording is enabled */
160 /** The main (hardware) interrupt */
161 struct Interrupt interrupt
;
163 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
164 BOOL interrupt_added
;
166 /** The playback software interrupt */
167 struct Interrupt playback_interrupt
;
169 /** The recording software interrupt */
170 struct Interrupt record_interrupt
;
172 /*** Card structures **************************************************/
174 APTR playback_buffer1
;
175 APTR playback_buffer2
;
177 /*** Playback interrupt variables ****************************************/
179 /** The mixing buffer (a cyclic buffer filled by AHI) */
182 /** The length of each playback buffer in sample frames */
183 ULONG current_frames
;
185 /** The length of each playback buffer in sample bytes */
186 ULONG current_bytesize
;
188 /** Where (inside the cyclic buffer) we're currently writing */
193 /*** Recording interrupt variables ***************************************/
195 /** The recording buffer (simple double buffering is used */
198 APTR record_buffer1_nonaligned
;
199 APTR record_buffer2_nonaligned
;
201 /** Were (inside the recording buffer) the current data is */
202 APTR current_record_buffer
;
204 /** The length of each record buffer in sample bytes */
205 ULONG current_record_bytesize
;
207 /** Analog mixer variables ***********************************************/
209 /** The currently selected input */
214 /** The currently selected output */
217 /** The current (recording) monitor volume */
218 Fixed monitor_volume
;
220 /** The current (recording) input gain */
223 /** The current (playback) output volume */
228 #endif /* AHI_Drivers_Card_DriverData_h */