grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / AHI / Drivers / CMI8738 / DriverData.h
blob50a42628c593f9a79ed090fc0e43479c7eb769d9
1 /*
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"
24 struct CMI8738_DATA;
26 struct tester
28 unsigned long diff;
29 int flip;
30 int oldflip;
31 int A;
32 int Missed;
35 struct CMI8738Base
37 /** Skeleton's variables *************************************************/
39 struct DriverBase driverbase;
42 /** A sempahore used for locking */
43 struct SignalSemaphore semaphore;
45 /** The number of cards found */
46 int 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
57 struct CMI8738_DATA
59 /*** PCI/Card initialization progress *********************************/
61 struct PCIDevice *pci_dev;
62 APTR iobase;
63 unsigned long length;
64 unsigned short model;
65 unsigned char chiprev;
66 unsigned char chipvers;
67 unsigned int channels;
68 unsigned int irq;
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 */
94 BOOL is_playing;
96 /** TRUE when recording is enabled */
97 BOOL is_recording;
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 */
128 ULONG camd_v40;
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) */
139 APTR mix_buffer;
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 */
148 APTR current_buffer;
150 int flip;
151 int oldflip;
155 /*** Recording interrupt variables ***************************************/
157 /** The recording buffer (simple double buffering is used */
158 APTR record_buffer;
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;
168 int recflip;
172 /** Analog mixer variables ***********************************************/
174 unsigned char mixerstate;
177 /** The currently selected input */
178 UWORD input;
180 /** The currently selected output */
181 UWORD output;
183 /** The current (recording) monitor volume */
184 Fixed monitor_volume;
186 /** The current (recording) input gain */
187 Fixed input_gain;
189 /** The current (playback) output volume */
190 Fixed 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 */
202 UWORD ac97_mic;
204 /** Saved state for AC97 cd */
205 UWORD ac97_cd;
207 /** Saved state for AC97 vide */
208 UWORD ac97_video;
210 /** Saved state for AC97 aux */
211 UWORD ac97_aux;
213 /** Saved state for AC97 line in */
214 UWORD ac97_linein;
216 /** Saved state for AC97 phone */
217 UWORD ac97_phone;
220 #endif /* AHI_Drivers_CMI8738_DriverData_h */