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
22 #include "DriverBase.h"
37 /** Skeleton's variables *************************************************/
39 struct DriverBase driverbase
;
42 /** A sempahore used for locking */
43 struct SignalSemaphore semaphore
;
45 /** The number of cards found */
48 /** A CMI8738_DATA structure for each card found */
49 struct CMI8738_DATA
** driverdatas
;
52 #define DRIVERBASE_SIZEOF (sizeof (struct CMI8738Base))
54 #define RECORD_BUFFER_SAMPLES 1024
59 /*** PCI/Card initialization progress *********************************/
61 struct PCIDevice
*pci_dev
;
65 unsigned char chiprev
;
66 unsigned char chipvers
;
67 unsigned int channels
;
70 /** TRUE if bus mastering is activated */
71 BOOL pci_master_enabled
;
73 /** TRUE if the Card chip has been initialized */
74 BOOL card_initialized
;
78 /*** The driverbase ******************************************************/
80 /** This field is also used as a lock and access to is is
81 * semaphore protected. */
82 struct DriverBase
* ahisubbase
;
85 /*** The AudioCtrl currently using this DriverData structure *************/
87 struct AHIAudioCtrlDrv
* audioctrl
;
91 /*** Playback/recording interrupts ***************************************/
93 /** TRUE when playback is enabled */
96 /** TRUE when recording is enabled */
99 /** The main (hardware) interrupt */
100 struct Interrupt interrupt
;
102 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
103 BOOL interrupt_added
;
105 /** The playback software interrupt */
106 struct Interrupt playback_interrupt
;
108 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
109 BOOL playback_interrupt_enabled
;
111 /** The recording software interrupt */
112 struct Interrupt record_interrupt
;
114 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
115 BOOL record_interrupt_enabled
;
119 /*** CAMD support functions **********************************************/
121 /** CAMD transmitter function wrapped as a Hook */
122 struct Hook
* camd_transmitfunc
;
124 /** CAMD receiver function wrapped as a Hook */
125 struct Hook
* camd_receivefunc
;
127 /** True if CMAD V40 mode */
132 /*** Playback interrupt variables ****************************************/
134 APTR playback_buffer
;
135 APTR playback_buffer_nonaligned
;
136 APTR playback_buffer_phys
;
138 /** The mixing buffer (a cyclic buffer filled by AHI) */
141 /** The length of each playback buffer in sample frames */
142 ULONG current_frames
;
144 /** The length of each playback buffer in sample bytes */
145 ULONG current_bytesize
;
147 /** Where (inside the cyclic buffer) we're currently writing */
155 /*** Recording interrupt variables ***************************************/
157 /** The recording buffer (simple double buffering is used */
159 APTR record_buffer_nonaligned
;
160 APTR record_buffer_phys
;
162 /** Were (inside the recording buffer) the current data is */
163 APTR current_record_buffer
;
165 /** The length of each record buffer in sample bytes */
166 ULONG current_record_bytesize
;
172 /** Analog mixer variables ***********************************************/
174 unsigned char mixerstate
;
177 /** The currently selected input */
180 /** The currently selected output */
183 /** The current (recording) monitor volume */
184 Fixed monitor_volume
;
186 /** The current (recording) input gain */
189 /** The current (playback) output volume */
192 /** The hardware register value corresponding to monitor_volume */
193 UWORD monitor_volume_bits
;
195 /** The hardware register value corresponding to input_gain */
196 UWORD input_gain_bits
;
198 /** The hardware register value corresponding to output_volume */
199 UWORD output_volume_bits
;
201 /** Saved state for AC97 mike */
204 /** Saved state for AC97 cd */
207 /** Saved state for AC97 vide */
210 /** Saved state for AC97 aux */
213 /** Saved state for AC97 line in */
216 /** Saved state for AC97 phone */
220 #endif /* AHI_Drivers_CMI8738_DriverData_h */