2 The contents of this file are subject to the AROS Public License Version 1.1 (the "License");
3 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
5 Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
6 ANY KIND, either express or implied. See the License for the specific language governing rights and
7 limitations under the License.
9 The Original Code is written by Davy Wentzler.
12 #ifndef AHI_Drivers_Card_DriverData_h
13 #define AHI_Drivers_Card_DriverData_h
15 #include <exec/types.h>
16 #include <exec/interrupts.h>
17 #include <devices/ahi.h>
19 #define DRIVER "cmi8738.audio"
20 #define DRIVER_NEED_GLOBAL_EXECBASE
21 #include "DriverBase.h"
36 /** Skeleton's variables *************************************************/
38 struct DriverBase driverbase
;
41 /** A sempahore used for locking */
42 struct SignalSemaphore semaphore
;
44 /** The number of cards found */
47 /** A CardData structure for each card found */
48 struct CardData
** driverdatas
;
51 #define RECORD_BUFFER_SAMPLES 1024
56 /*** PCI/Card initialization progress *********************************/
58 struct PCIDevice
*pci_dev
;
62 unsigned char chiprev
;
65 /** TRUE if bus mastering is activated */
66 BOOL pci_master_enabled
;
68 /** TRUE if the Card chip has been initialized */
69 BOOL card_initialized
;
73 /*** The driverbase ******************************************************/
75 /** This field is also used as a lock and access to is is
76 * semaphore protected. */
77 struct DriverBase
* ahisubbase
;
80 /*** The AudioCtrl currently using this DriverData structure *************/
82 struct AHIAudioCtrlDrv
* audioctrl
;
86 /*** Playback/recording interrupts ***************************************/
88 /** TRUE when playback is enabled */
91 /** TRUE when recording is enabled */
94 /** The main (hardware) interrupt */
95 struct Interrupt interrupt
;
97 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
100 /** The playback software interrupt */
101 struct Interrupt playback_interrupt
;
103 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
104 BOOL playback_interrupt_enabled
;
106 /** The recording software interrupt */
107 struct Interrupt record_interrupt
;
109 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
110 BOOL record_interrupt_enabled
;
114 /*** CAMD support functions **********************************************/
116 /** CAMD transmitter function wrapped as a Hook */
117 struct Hook
* camd_transmitfunc
;
119 /** CAMD receiver function wrapped as a Hook */
120 struct Hook
* camd_receivefunc
;
122 /** True if CMAD V40 mode */
127 /*** Playback interrupt variables ****************************************/
129 APTR playback_buffer
;
130 APTR playback_buffer_nonaligned
;
131 APTR playback_buffer_phys
;
133 /** The mixing buffer (a cyclic buffer filled by AHI) */
136 /** The length of each playback buffer in sample frames */
137 ULONG current_frames
;
139 /** The length of each playback buffer in sample bytes */
140 ULONG current_bytesize
;
142 /** 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 unsigned char mixerstate
;
172 /** The currently selected input */
175 /** The currently selected output */
178 /** The current (recording) monitor volume */
179 Fixed monitor_volume
;
181 /** The current (recording) input gain */
184 /** The current (playback) output volume */
187 /** The hardware register value corresponding to monitor_volume */
188 UWORD monitor_volume_bits
;
190 /** The hardware register value corresponding to input_gain */
191 UWORD input_gain_bits
;
193 /** The hardware register value corresponding to output_volume */
194 UWORD output_volume_bits
;
196 /** Saved state for AC97 mike */
199 /** Saved state for AC97 cd */
202 /** Saved state for AC97 vide */
205 /** Saved state for AC97 aux */
208 /** Saved state for AC97 line in */
211 /** Saved state for AC97 phone */
215 #endif /* AHI_Drivers_Card_DriverData_h */