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_CMI8738_DriverData_h
13 #define AHI_Drivers_CMI8738_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_NEEDS_GLOBAL_EXECBASE
23 #define DRIVER_NEED_GLOBAL_EXECBASE
27 #define DRIVER_NEED_GLOBAL_EXECBASE
30 #include "DriverBase.h"
45 /** Skeleton's variables *************************************************/
47 struct DriverBase driverbase
;
50 /** A sempahore used for locking */
51 struct SignalSemaphore semaphore
;
53 /** The number of cards found */
56 /** A CMI8738_DATA structure for each card found */
57 struct CMI8738_DATA
** driverdatas
;
60 #define DRIVERBASE_SIZEOF (sizeof (struct CMI8738Base))
62 #define RECORD_BUFFER_SAMPLES 1024
67 /*** PCI/Card initialization progress *********************************/
69 struct PCIDevice
*pci_dev
;
73 unsigned char chiprev
;
74 unsigned char chipvers
;
75 unsigned int channels
;
78 /** TRUE if bus mastering is activated */
79 BOOL pci_master_enabled
;
81 /** TRUE if the Card chip has been initialized */
82 BOOL card_initialized
;
86 /*** The driverbase ******************************************************/
88 /** This field is also used as a lock and access to is is
89 * semaphore protected. */
90 struct DriverBase
* ahisubbase
;
93 /*** The AudioCtrl currently using this DriverData structure *************/
95 struct AHIAudioCtrlDrv
* audioctrl
;
99 /*** Playback/recording interrupts ***************************************/
101 /** TRUE when playback is enabled */
104 /** TRUE when recording is enabled */
107 /** The main (hardware) interrupt */
108 struct Interrupt interrupt
;
110 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
111 BOOL interrupt_added
;
113 /** The playback software interrupt */
114 struct Interrupt playback_interrupt
;
116 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
117 BOOL playback_interrupt_enabled
;
119 /** The recording software interrupt */
120 struct Interrupt record_interrupt
;
122 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
123 BOOL record_interrupt_enabled
;
127 /*** CAMD support functions **********************************************/
129 /** CAMD transmitter function wrapped as a Hook */
130 struct Hook
* camd_transmitfunc
;
132 /** CAMD receiver function wrapped as a Hook */
133 struct Hook
* camd_receivefunc
;
135 /** True if CMAD V40 mode */
140 /*** Playback interrupt variables ****************************************/
142 APTR playback_buffer
;
143 APTR playback_buffer_nonaligned
;
144 APTR playback_buffer_phys
;
146 /** The mixing buffer (a cyclic buffer filled by AHI) */
149 /** The length of each playback buffer in sample frames */
150 ULONG current_frames
;
152 /** The length of each playback buffer in sample bytes */
153 ULONG current_bytesize
;
155 /** Where (inside the cyclic buffer) we're currently writing */
163 /*** Recording interrupt variables ***************************************/
165 /** The recording buffer (simple double buffering is used */
167 APTR record_buffer_nonaligned
;
168 APTR record_buffer_phys
;
170 /** Were (inside the recording buffer) the current data is */
171 APTR current_record_buffer
;
173 /** The length of each record buffer in sample bytes */
174 ULONG current_record_bytesize
;
180 /** Analog mixer variables ***********************************************/
182 unsigned char mixerstate
;
185 /** The currently selected input */
188 /** The currently selected output */
191 /** The current (recording) monitor volume */
192 Fixed monitor_volume
;
194 /** The current (recording) input gain */
197 /** The current (playback) output volume */
200 /** The hardware register value corresponding to monitor_volume */
201 UWORD monitor_volume_bits
;
203 /** The hardware register value corresponding to input_gain */
204 UWORD input_gain_bits
;
206 /** The hardware register value corresponding to output_volume */
207 UWORD output_volume_bits
;
209 /** Saved state for AC97 mike */
212 /** Saved state for AC97 cd */
215 /** Saved state for AC97 vide */
218 /** Saved state for AC97 aux */
221 /** Saved state for AC97 line in */
224 /** Saved state for AC97 phone */
228 #endif /* AHI_Drivers_CMI8738_DriverData_h */