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_Card_DriverData_h
19 #define AHI_Drivers_Card_DriverData_h
21 #include <exec/types.h>
22 #include <exec/interrupts.h>
23 #include <devices/ahi.h>
25 #define DRIVER "sb128.audio"
26 #define DRIVER_NEED_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 CardData structure for each card found */
45 struct CardData
** driverdatas
;
48 #define RECORD_BUFFER_SAMPLES 1024
53 /*** PCI/Card initialization progress *********************************/
55 struct PCIDevice
*pci_dev
;
59 unsigned char chiprev
;
62 /** TRUE if bus mastering is activated */
63 BOOL pci_master_enabled
;
65 /** TRUE if the Card chip has been initialized */
66 BOOL card_initialized
;
68 /** TRUE if the card is an ES1370 */
71 /** A semaphore used for hardware access serialisation *******************/
72 struct SignalSemaphore sb128_semaphore
;
75 /*** The driverbase ******************************************************/
77 /** This field is also used as a lock and access to it is
78 * semaphore protected. */
79 struct DriverBase
* ahisubbase
;
82 /*** The AudioCtrl currently using this DriverData structure *************/
84 struct AHIAudioCtrlDrv
* audioctrl
;
87 /*** Playback/recording interrupts ***************************************/
89 /** TRUE when playback is enabled */
92 /** TRUE when recording is enabled */
95 /** The main (hardware) interrupt */
96 struct Interrupt interrupt
;
98 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
101 /** The playback software interrupt */
102 struct Interrupt playback_interrupt
;
104 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
105 BOOL playback_interrupt_enabled
;
107 /** The recording software interrupt */
108 struct Interrupt record_interrupt
;
110 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
111 BOOL record_interrupt_enabled
;
115 /*** CAMD support functions **********************************************/
117 /** CAMD transmitter function wrapped as a Hook */
118 struct Hook
* camd_transmitfunc
;
120 /** CAMD receiver function wrapped as a Hook */
121 struct Hook
* camd_receivefunc
;
123 /** True if CMAD V40 mode */
128 /*** Playback interrupt variables ****************************************/
130 APTR playback_buffer
;
131 APTR playback_buffer_nonaligned
;
132 APTR playback_buffer_phys
;
134 /** The mixing buffer (a cyclic buffer filled by AHI) */
137 /** The length of each playback buffer in sample frames */
138 ULONG current_frames
;
140 /** The length of each playback buffer in sample bytes */
141 ULONG current_bytesize
;
143 /** Where (inside the cyclic buffer) we're currently writing */
150 /*** Recording interrupt variables ***************************************/
152 /** The recording buffer (simple double buffering is used */
154 APTR record_buffer_nonaligned
;
155 APTR record_buffer_phys
;
157 /** Were (inside the recording buffer) the current data is */
158 APTR current_record_buffer
;
160 /** The length of each record buffer in sample bytes */
161 ULONG current_record_bytesize
;
167 /** Analog mixer variables ***********************************************/
169 /** The currently selected input */
172 /** The currently selected output */
175 /** The current (recording) monitor volume */
176 Fixed monitor_volume
;
178 /** The current (recording) input gain */
181 /** The current (playback) output volume */
184 /** The hardware register value corresponding to monitor_volume */
185 UWORD monitor_volume_bits
;
187 /** The hardware register value corresponding to input_gain */
188 UWORD input_gain_bits
;
190 /** The hardware register value corresponding to output_volume */
191 UWORD output_volume_bits
;
193 /** Saved state for AC97 mike */
196 /** Saved state for AC97 cd */
199 /** Saved state for AC97 video */
202 /** Saved state for AC97 aux */
205 /** Saved state for AC97 line in */
208 /** Saved state for AC97 phone */
211 /** Saved state of AK4531 Output Register 1 */
212 char ak4531_output_1
;
214 /** Saved state of AK4531 Output Register 1 */
215 char ak4531_output_2
;
217 /** The current Playback Frequency */
220 /** The current Record Frequency */
224 #endif /* AHI_Drivers_Card_DriverData_h */