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 IDs
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
;
119 UBYTE adc_mixer_indices
[5]; //0 = Line in, 1 = Mic in 1, 2 = Mic in 2, 3 = CD, 4 = Monitor Mixer
129 struct Freq
*frequencies
;
130 ULONG nr_of_frequencies
;
131 ULONG selected_freq_index
;
133 UBYTE eapd_gpio_mask
;
135 /*** PCI/Card initialization progress *********************************/
137 /** TRUE if bus mastering is activated */
138 BOOL pci_master_enabled
;
140 /** TRUE if the Card chip has been initialized */
141 BOOL card_initialized
;
143 /*** The driverbase ******************************************************/
145 /** This field is also used as a lock and access to is is
146 * semaphore protected. */
147 struct DriverBase
* ahisubbase
;
149 /*** The AudioCtrl currently using this DriverData structure *************/
151 struct AHIAudioCtrlDrv
* audioctrl
;
153 /*** Playback/recording interrupts ***************************************/
155 /** TRUE when playback is enabled */
158 /** TRUE when recording is enabled */
161 /** The main (hardware) interrupt */
162 struct Interrupt interrupt
;
164 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
165 BOOL interrupt_added
;
167 /** The playback software interrupt */
168 struct Interrupt playback_interrupt
;
170 /** The recording software interrupt */
171 struct Interrupt record_interrupt
;
173 /*** Card structures **************************************************/
175 APTR playback_buffer1
;
176 APTR playback_buffer2
;
178 /*** Playback interrupt variables ****************************************/
180 /** The mixing buffer (a cyclic buffer filled by AHI) */
183 /** The length of each playback buffer in sample frames */
184 ULONG current_frames
;
186 /** The length of each playback buffer in sample bytes */
187 ULONG current_bytesize
;
189 /** Where (inside the cyclic buffer) we're currently writing */
194 /*** Recording interrupt variables ***************************************/
196 /** The recording buffer (simple double buffering is used */
199 APTR record_buffer1_nonaligned
;
200 APTR record_buffer2_nonaligned
;
202 /** Were (inside the recording buffer) the current data is */
203 APTR current_record_buffer
;
205 /** The length of each record buffer in sample bytes */
206 ULONG current_record_bytesize
;
208 /** Analog mixer variables ***********************************************/
210 /** The currently selected input */
215 /** The currently selected output */
218 /** The current (recording) monitor volume */
219 Fixed monitor_volume
;
221 /** The current (recording) input gain */
224 /** The current (playback) output volume */
229 #endif /* AHI_Drivers_Card_DriverData_h */