Port the SB128 code to AROS.
[AROS.git] / workbench / devs / AHI / Drivers / SB128 / DriverData.h
blob69eb461dc07582dab07b13db7d527b7f79e5f22d
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 #ifdef __AROS__
28 #define DRIVER_NEED_GLOBAL_EXECBASE
29 #endif
31 #ifdef __amigaos4__
32 #define DRIVER_NEED_GLOBAL_EXECBASE
33 #endif
35 #include "DriverBase.h"
37 struct SB128_DATA;
39 struct SB128Base
41 /** Skeleton's variables *************************************************/
43 struct DriverBase driverbase;
46 /** A sempahore used for locking */
47 struct SignalSemaphore semaphore;
49 /** The number of cards found */
50 int cards_found;
52 /** A SB128_DATA structure for each card found */
53 struct SB128_DATA** driverdatas;
56 #define DRIVERBASE_SIZEOF (sizeof (struct SB128Base))
58 #define RECORD_BUFFER_SAMPLES 1024
61 struct SB128_DATA
63 /*** PCI/Card initialization progress *********************************/
65 struct PCIDevice *pci_dev;
66 APTR iobase;
67 unsigned long length;
68 unsigned short model;
69 unsigned char chiprev;
70 unsigned int irq;
72 /** TRUE if bus mastering is activated */
73 BOOL pci_master_enabled;
75 /** TRUE if the Card chip has been initialized */
76 BOOL card_initialized;
78 /** TRUE if the card is an ES1370 */
79 BOOL es1370;
81 /** A semaphore used for hardware access serialisation *******************/
82 struct SignalSemaphore sb128_semaphore;
85 /*** The driverbase ******************************************************/
87 /** This field is also used as a lock and access to it is
88 * semaphore protected. */
89 struct DriverBase* ahisubbase;
92 /*** The AudioCtrl currently using this DriverData structure *************/
94 struct AHIAudioCtrlDrv* audioctrl;
97 /*** Playback/recording interrupts ***************************************/
99 /** TRUE when playback is enabled */
100 BOOL is_playing;
102 /** TRUE when recording is enabled */
103 BOOL is_recording;
105 /** The main (hardware) interrupt */
106 struct Interrupt interrupt;
108 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
109 BOOL interrupt_added;
111 /** The playback software interrupt */
112 struct Interrupt playback_interrupt;
114 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
115 BOOL playback_interrupt_enabled;
117 /** The recording software interrupt */
118 struct Interrupt record_interrupt;
120 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
121 BOOL record_interrupt_enabled;
125 /*** CAMD support functions **********************************************/
127 /** CAMD transmitter function wrapped as a Hook */
128 struct Hook* camd_transmitfunc;
130 /** CAMD receiver function wrapped as a Hook */
131 struct Hook* camd_receivefunc;
133 /** True if CMAD V40 mode */
134 ULONG camd_v40;
138 /*** Playback interrupt variables ****************************************/
140 APTR playback_buffer;
141 APTR playback_buffer_nonaligned;
142 APTR playback_buffer_phys;
144 /** The mixing buffer (a cyclic buffer filled by AHI) */
145 APTR mix_buffer;
147 /** The length of each playback buffer in sample frames */
148 ULONG current_frames;
150 /** The length of each playback buffer in sample bytes */
151 ULONG current_bytesize;
153 /** Where (inside the cyclic buffer) we're currently writing */
154 APTR current_buffer;
156 int flip;
160 /*** Recording interrupt variables ***************************************/
162 /** The recording buffer (simple double buffering is used */
163 APTR record_buffer;
164 APTR record_buffer_nonaligned;
165 APTR record_buffer_phys;
167 /** Were (inside the recording buffer) the current data is */
168 APTR current_record_buffer;
170 /** The length of each record buffer in sample bytes */
171 ULONG current_record_bytesize;
173 int recflip;
177 /** Analog mixer variables ***********************************************/
179 /** The currently selected input */
180 UWORD input;
182 /** The currently selected output */
183 UWORD output;
185 /** The current (recording) monitor volume */
186 Fixed monitor_volume;
188 /** The current (recording) input gain */
189 Fixed input_gain;
191 /** The current (playback) output volume */
192 Fixed output_volume;
194 /** The hardware register value corresponding to monitor_volume */
195 UWORD monitor_volume_bits;
197 /** The hardware register value corresponding to input_gain */
198 UWORD input_gain_bits;
200 /** The hardware register value corresponding to output_volume */
201 UWORD output_volume_bits;
203 /** Saved state for AC97 mike */
204 UWORD ac97_mic;
206 /** Saved state for AC97 cd */
207 UWORD ac97_cd;
209 /** Saved state for AC97 video */
210 UWORD ac97_video;
212 /** Saved state for AC97 aux */
213 UWORD ac97_aux;
215 /** Saved state for AC97 line in */
216 UWORD ac97_linein;
218 /** Saved state for AC97 phone */
219 UWORD ac97_phone;
221 /** Saved state of AK4531 Output Register 1 */
222 char ak4531_output_1;
224 /** Saved state of AK4531 Output Register 1 */
225 char ak4531_output_2;
227 /** The current Playback Frequency */
228 int currentPlayFreq;
230 /** The current Record Frequency */
231 int currentRecFreq;
234 #endif /* AHI_Drivers_SB128_DriverData_h */