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
28 #define DRIVER_NEED_GLOBAL_EXECBASE
32 #define DRIVER_NEED_GLOBAL_EXECBASE
35 #include "DriverBase.h"
41 /** Skeleton's variables *************************************************/
43 struct DriverBase driverbase
;
46 /** A sempahore used for locking */
47 struct SignalSemaphore semaphore
;
49 /** The number of cards found */
52 /** A SB128_DATA structure for each card found */
53 struct SB128_DATA
** driverdatas
;
56 #define DRIVERBASE_SIZEOF (sizeof (struct SB128Base))
58 #define RECORD_BUFFER_SAMPLES 1024
63 /*** PCI/Card initialization progress *********************************/
65 struct PCIDevice
*pci_dev
;
69 unsigned char chiprev
;
72 /** TRUE if bus mastering is activated */
73 BOOL pci_master_enabled
;
75 /** TRUE if the Card chip has been initialized */
76 BOOL card_initialized
;
78 /** TRUE if the card is an ES1370 */
81 /** A semaphore used for hardware access serialisation *******************/
82 struct SignalSemaphore sb128_semaphore
;
85 /*** The driverbase ******************************************************/
87 /** This field is also used as a lock and access to it is
88 * semaphore protected. */
89 struct DriverBase
* ahisubbase
;
92 /*** The AudioCtrl currently using this DriverData structure *************/
94 struct AHIAudioCtrlDrv
* audioctrl
;
97 /*** Playback/recording interrupts ***************************************/
99 /** TRUE when playback is enabled */
102 /** TRUE when recording is enabled */
105 /** The main (hardware) interrupt */
106 struct Interrupt interrupt
;
108 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
109 BOOL interrupt_added
;
111 /** The playback software interrupt */
112 struct Interrupt playback_interrupt
;
114 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
115 BOOL playback_interrupt_enabled
;
117 /** The recording software interrupt */
118 struct Interrupt record_interrupt
;
120 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
121 BOOL record_interrupt_enabled
;
125 /*** CAMD support functions **********************************************/
127 /** CAMD transmitter function wrapped as a Hook */
128 struct Hook
* camd_transmitfunc
;
130 /** CAMD receiver function wrapped as a Hook */
131 struct Hook
* camd_receivefunc
;
133 /** True if CMAD V40 mode */
138 /*** Playback interrupt variables ****************************************/
140 APTR playback_buffer
;
141 APTR playback_buffer_nonaligned
;
142 APTR playback_buffer_phys
;
144 /** The mixing buffer (a cyclic buffer filled by AHI) */
147 /** The length of each playback buffer in sample frames */
148 ULONG current_frames
;
150 /** The length of each playback buffer in sample bytes */
151 ULONG current_bytesize
;
153 /** Where (inside the cyclic buffer) we're currently writing */
160 /*** Recording interrupt variables ***************************************/
162 /** The recording buffer (simple double buffering is used */
164 APTR record_buffer_nonaligned
;
165 APTR record_buffer_phys
;
167 /** Were (inside the recording buffer) the current data is */
168 APTR current_record_buffer
;
170 /** The length of each record buffer in sample bytes */
171 ULONG current_record_bytesize
;
177 /** Analog mixer variables ***********************************************/
179 /** The currently selected input */
182 /** The currently selected output */
185 /** The current (recording) monitor volume */
186 Fixed monitor_volume
;
188 /** The current (recording) input gain */
191 /** The current (playback) output volume */
194 /** The hardware register value corresponding to monitor_volume */
195 UWORD monitor_volume_bits
;
197 /** The hardware register value corresponding to input_gain */
198 UWORD input_gain_bits
;
200 /** The hardware register value corresponding to output_volume */
201 UWORD output_volume_bits
;
203 /** Saved state for AC97 mike */
206 /** Saved state for AC97 cd */
209 /** Saved state for AC97 video */
212 /** Saved state for AC97 aux */
215 /** Saved state for AC97 line in */
218 /** Saved state for AC97 phone */
221 /** Saved state of AK4531 Output Register 1 */
222 char ak4531_output_1
;
224 /** Saved state of AK4531 Output Register 1 */
225 char ak4531_output_2
;
227 /** The current Playback Frequency */
230 /** The current Record Frequency */
234 #endif /* AHI_Drivers_SB128_DriverData_h */