3 The contents of this file are subject to the AROS Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
4 http://www.aros.org/license.html
6 Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
7 ANY KIND, either express or implied. See the License for the specific language governing rights and
8 limitations under the License.
10 The Original Code is (C) Copyright 2004-2011 Ross Vumbaca.
12 The Initial Developer of the Original Code is Ross Vumbaca.
18 #ifndef AHI_Drivers_SB128_DriverData_h
19 #define AHI_Drivers_SB128_DriverData_h
21 #include <exec/types.h>
22 #include <exec/interrupts.h>
23 #include <devices/ahi.h>
25 #define DRIVER_NEEDS_GLOBAL_EXECBASE
27 #include "DriverBase.h"
33 /** Skeleton's variables *************************************************/
35 struct DriverBase driverbase
;
38 /** A sempahore used for locking */
39 struct SignalSemaphore semaphore
;
41 /** The number of cards found */
44 /** A SB128_DATA structure for each card found */
45 struct SB128_DATA
** driverdatas
;
48 #define DRIVERBASE_SIZEOF (sizeof (struct SB128Base))
50 #define RECORD_BUFFER_SAMPLES 1024
55 /*** PCI/Card initialization progress *********************************/
57 struct PCIDevice
*pci_dev
;
61 unsigned char chiprev
;
64 /** TRUE if bus mastering is activated */
65 BOOL pci_master_enabled
;
67 /** TRUE if the Card chip has been initialized */
68 BOOL card_initialized
;
70 /** TRUE if the card is an ES1370 */
73 /** A semaphore used for hardware access serialisation *******************/
74 struct SignalSemaphore sb128_semaphore
;
77 /*** The driverbase ******************************************************/
79 /** This field is also used as a lock and access to it is
80 * semaphore protected. */
81 struct DriverBase
* ahisubbase
;
84 /*** The AudioCtrl currently using this DriverData structure *************/
86 struct AHIAudioCtrlDrv
* audioctrl
;
89 /*** Playback/recording interrupts ***************************************/
91 /** TRUE when playback is enabled */
94 /** TRUE when recording is enabled */
97 /** The main (hardware) interrupt */
98 struct Interrupt interrupt
;
100 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
101 BOOL interrupt_added
;
103 /** The playback software interrupt */
104 struct Interrupt playback_interrupt
;
106 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
107 BOOL playback_interrupt_enabled
;
109 /** The recording software interrupt */
110 struct Interrupt record_interrupt
;
112 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
113 BOOL record_interrupt_enabled
;
117 /*** CAMD support functions **********************************************/
119 /** CAMD transmitter function wrapped as a Hook */
120 struct Hook
* camd_transmitfunc
;
122 /** CAMD receiver function wrapped as a Hook */
123 struct Hook
* camd_receivefunc
;
125 /** True if CMAD V40 mode */
130 /*** Playback interrupt variables ****************************************/
132 APTR playback_buffer
;
133 APTR playback_buffer_nonaligned
;
134 APTR playback_buffer_phys
;
136 /** The mixing buffer (a cyclic buffer filled by AHI) */
139 /** The length of each playback buffer in sample frames */
140 ULONG current_frames
;
142 /** The length of each playback buffer in sample bytes */
143 ULONG current_bytesize
;
145 /** Where (inside the cyclic buffer) we're currently writing */
152 /*** Recording interrupt variables ***************************************/
154 /** The recording buffer (simple double buffering is used */
156 APTR record_buffer_nonaligned
;
157 APTR record_buffer_phys
;
159 /** Were (inside the recording buffer) the current data is */
160 APTR current_record_buffer
;
162 /** The length of each record buffer in sample bytes */
163 ULONG current_record_bytesize
;
169 /** Analog mixer variables ***********************************************/
171 /** The currently selected input */
174 /** The currently selected output */
177 /** The current (recording) monitor volume */
178 Fixed monitor_volume
;
180 /** The current (recording) input gain */
183 /** The current (playback) output volume */
186 /** The hardware register value corresponding to monitor_volume */
187 UWORD monitor_volume_bits
;
189 /** The hardware register value corresponding to input_gain */
190 UWORD input_gain_bits
;
192 /** The hardware register value corresponding to output_volume */
193 UWORD output_volume_bits
;
195 /** Saved state for AC97 mike */
198 /** Saved state for AC97 cd */
201 /** Saved state for AC97 video */
204 /** Saved state for AC97 aux */
207 /** Saved state for AC97 line in */
210 /** Saved state for AC97 phone */
213 /** Saved state of AK4531 Output Register 1 */
214 char ak4531_output_1
;
216 /** Saved state of AK4531 Output Register 1 */
217 char ak4531_output_2
;
219 /** The current Playback Frequency */
222 /** The current Record Frequency */
226 #endif /* AHI_Drivers_SB128_DriverData_h */