grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / AHI / Drivers / SB128 / DriverData.h
blob7f6c9d91bf8e4ca82a3a3b40adc74348f1c18bc3
1 /*
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.
14 All Rights Reserved.
18 #ifndef AHI_Drivers_SB128_DriverData_h
19 #define AHI_Drivers_SB128_DriverData_h
21 #include <exec/types.h>
22 #include <exec/interrupts.h>
23 #include <devices/ahi.h>
25 #define DRIVER_NEEDS_GLOBAL_EXECBASE
27 #include "DriverBase.h"
29 struct SB128_DATA;
31 struct SB128Base
33 /** Skeleton's variables *************************************************/
35 struct DriverBase driverbase;
38 /** A sempahore used for locking */
39 struct SignalSemaphore semaphore;
41 /** The number of cards found */
42 int cards_found;
44 /** A SB128_DATA structure for each card found */
45 struct SB128_DATA** driverdatas;
48 #define DRIVERBASE_SIZEOF (sizeof (struct SB128Base))
50 #define RECORD_BUFFER_SAMPLES 1024
53 struct SB128_DATA
55 /*** PCI/Card initialization progress *********************************/
57 struct PCIDevice *pci_dev;
58 APTR iobase;
59 unsigned long length;
60 unsigned short model;
61 unsigned char chiprev;
62 unsigned int irq;
64 /** TRUE if bus mastering is activated */
65 BOOL pci_master_enabled;
67 /** TRUE if the Card chip has been initialized */
68 BOOL card_initialized;
70 /** TRUE if the card is an ES1370 */
71 BOOL es1370;
73 /** A semaphore used for hardware access serialisation *******************/
74 struct SignalSemaphore sb128_semaphore;
77 /*** The driverbase ******************************************************/
79 /** This field is also used as a lock and access to it is
80 * semaphore protected. */
81 struct DriverBase* ahisubbase;
84 /*** The AudioCtrl currently using this DriverData structure *************/
86 struct AHIAudioCtrlDrv* audioctrl;
89 /*** Playback/recording interrupts ***************************************/
91 /** TRUE when playback is enabled */
92 BOOL is_playing;
94 /** TRUE when recording is enabled */
95 BOOL is_recording;
97 /** The main (hardware) interrupt */
98 struct Interrupt interrupt;
100 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
101 BOOL interrupt_added;
103 /** The playback software interrupt */
104 struct Interrupt playback_interrupt;
106 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
107 BOOL playback_interrupt_enabled;
109 /** The recording software interrupt */
110 struct Interrupt record_interrupt;
112 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
113 BOOL record_interrupt_enabled;
117 /*** CAMD support functions **********************************************/
119 /** CAMD transmitter function wrapped as a Hook */
120 struct Hook* camd_transmitfunc;
122 /** CAMD receiver function wrapped as a Hook */
123 struct Hook* camd_receivefunc;
125 /** True if CMAD V40 mode */
126 ULONG camd_v40;
130 /*** Playback interrupt variables ****************************************/
132 APTR playback_buffer;
133 APTR playback_buffer_nonaligned;
134 APTR playback_buffer_phys;
136 /** The mixing buffer (a cyclic buffer filled by AHI) */
137 APTR mix_buffer;
139 /** The length of each playback buffer in sample frames */
140 ULONG current_frames;
142 /** The length of each playback buffer in sample bytes */
143 ULONG current_bytesize;
145 /** Where (inside the cyclic buffer) we're currently writing */
146 APTR current_buffer;
148 int flip;
152 /*** Recording interrupt variables ***************************************/
154 /** The recording buffer (simple double buffering is used */
155 APTR record_buffer;
156 APTR record_buffer_nonaligned;
157 APTR record_buffer_phys;
159 /** Were (inside the recording buffer) the current data is */
160 APTR current_record_buffer;
162 /** The length of each record buffer in sample bytes */
163 ULONG current_record_bytesize;
165 int recflip;
169 /** Analog mixer variables ***********************************************/
171 /** The currently selected input */
172 UWORD input;
174 /** The currently selected output */
175 UWORD output;
177 /** The current (recording) monitor volume */
178 Fixed monitor_volume;
180 /** The current (recording) input gain */
181 Fixed input_gain;
183 /** The current (playback) output volume */
184 Fixed output_volume;
186 /** The hardware register value corresponding to monitor_volume */
187 UWORD monitor_volume_bits;
189 /** The hardware register value corresponding to input_gain */
190 UWORD input_gain_bits;
192 /** The hardware register value corresponding to output_volume */
193 UWORD output_volume_bits;
195 /** Saved state for AC97 mike */
196 UWORD ac97_mic;
198 /** Saved state for AC97 cd */
199 UWORD ac97_cd;
201 /** Saved state for AC97 video */
202 UWORD ac97_video;
204 /** Saved state for AC97 aux */
205 UWORD ac97_aux;
207 /** Saved state for AC97 line in */
208 UWORD ac97_linein;
210 /** Saved state for AC97 phone */
211 UWORD ac97_phone;
213 /** Saved state of AK4531 Output Register 1 */
214 char ak4531_output_1;
216 /** Saved state of AK4531 Output Register 1 */
217 char ak4531_output_2;
219 /** The current Playback Frequency */
220 int currentPlayFreq;
222 /** The current Record Frequency */
223 int currentRecFreq;
226 #endif /* AHI_Drivers_SB128_DriverData_h */