grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / AHI / Drivers / VIA-AC97 / DriverData.h
blob9ab18411147cdf58719e32e0a7e061b67b76c8b6
1 /*
2 Copyright © 2005-2013, Davy Wentzler. All rights reserved.
3 Copyright © 2010-2013, The AROS Development Team. All rights reserved.
4 $Id$
5 */
7 #ifndef AHI_Drivers_VIAAC97_DriverData_h
8 #define AHI_Drivers_VIAAC97_DriverData_h
10 #include <exec/types.h>
11 #include <exec/interrupts.h>
12 #include <devices/ahi.h>
14 #include "hwaccess.h"
16 /** Make the common library code initialize a global SysBase for us.
17 It's required for hwaccess.c */
19 #define DRIVER_NEEDS_GLOBAL_EXECBASE
20 #include "DriverBase.h"
22 struct CardData;
24 struct CardBase
26 /** Skeleton's variables *************************************************/
28 struct DriverBase driverbase;
31 /** The driver's global data *********************************************/
34 /** A sempahore used for locking */
35 struct SignalSemaphore semaphore;
37 /** The number of cards found */
38 int cards_found;
40 /** A CardData structure for each card found */
41 struct CardData** driverdatas;
44 #define DRIVERBASE_SIZEOF (sizeof (struct CardBase))
46 #define RECORD_BUFFER_SAMPLES 4096
47 #define RECORD_BUFFER_SIZE_VALUE ADCBS_BUFSIZE_16384
50 struct snd_dma_device {
51 int type; /* SNDRV_DMA_TYPE_XXX */
52 // struct device *dev; /* generic device */
55 struct snd_dma_buffer {
56 struct snd_dma_device dev; /* device type */
57 unsigned char *area; /* virtual pointer */
58 void *addr; /* physical address */
59 int bytes; /* buffer size in bytes */
60 void *private_data; /* private for allocator; don't touch */
63 struct snd_via_sg_table { // scatter/gather format. Oh joy, the docs talk about EOL, base counts etc...
64 APTR offset;
65 unsigned int size;
68 struct CardData
71 struct PCIDevice *pci_dev;
72 unsigned long iobase;
73 unsigned long length;
74 unsigned short model;
75 unsigned int irq;
76 int flip;
77 int recflip;
78 UBYTE chiprev;
80 struct snd_dma_buffer table;
81 struct snd_via_sg_table *play_idx_table;
82 struct snd_via_sg_table *rec_idx_table;
84 APTR play_idx_table_nonaligned;
85 APTR rec_idx_table_nonaligned;
87 /*** PCI/Card initialization progress *********************************/
89 /** TRUE if bus mastering is activated */
90 BOOL pci_master_enabled;
92 /** TRUE if the Card chip has been initialized */
93 BOOL card_initialized;
95 /*** The driverbase ******************************************************/
97 /** This field is also used as a lock and access to is is
98 * semaphore protected. */
99 struct DriverBase* ahisubbase;
101 /*** The AudioCtrl currently using this DriverData structure *************/
103 struct AHIAudioCtrlDrv* audioctrl;
105 /*** Playback/recording interrupts ***************************************/
107 /** TRUE when playback is enabled */
108 BOOL is_playing;
110 /** TRUE when recording is enabled */
111 BOOL is_recording;
113 /** The main (hardware) interrupt */
114 struct Interrupt interrupt;
116 /** TRUE if the hardware interrupt has been added to the PCI subsystem */
117 BOOL interrupt_added;
119 /** The playback software interrupt */
120 struct Interrupt playback_interrupt;
122 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
123 BOOL playback_interrupt_enabled;
125 /** The recording software interrupt */
126 struct Interrupt record_interrupt;
128 /** TRUE if the hardware interrupt may Cause() playback_interrupt */
129 BOOL record_interrupt_enabled;
131 /** The reset handler */
132 struct Interrupt reset_handler;
134 /** TRUE if the reset handler has been added to the system */
135 BOOL reset_handler_added;
137 /*** CAMD support functions **********************************************/
139 /** CAMD transmitter function wrapped as a Hook */
140 struct Hook* camd_transmitfunc;
142 /** CAMD receiver function wrapped as a Hook */
143 struct Hook* camd_receivefunc;
145 /** True if CMAD V40 mode */
146 ULONG camd_v40;
148 /*** Card structures **************************************************/
150 APTR playback_buffer1;
151 APTR playback_buffer2;
152 APTR playback_buffer1_nonaligned;
153 APTR playback_buffer2_nonaligned;
156 /*** Playback interrupt variables ****************************************/
158 /** The mixing buffer (a cyclic buffer filled by AHI) */
159 APTR mix_buffer;
161 /** The length of each playback buffer in sample frames */
162 ULONG current_frames;
164 /** The length of each playback buffer in sample bytes */
165 ULONG current_bytesize;
167 /** Where (inside the cyclic buffer) we're currently writing */
168 APTR current_buffer;
172 /*** Recording interrupt variables ***************************************/
174 /** The recording buffer (simple double buffering is used */
175 APTR record_buffer1;
176 APTR record_buffer2;
177 APTR record_buffer1_nonaligned;
178 APTR record_buffer2_nonaligned;
180 /** Were (inside the recording buffer) the current data is */
181 APTR current_record_buffer;
183 /** The length of each record buffer in sample bytes */
184 ULONG current_record_bytesize;
186 /** Analog mixer variables ***********************************************/
188 /** The currently selected input */
189 UWORD input;
191 /** The currently selected output */
192 UWORD output;
194 /** The current (recording) monitor volume */
195 Fixed monitor_volume;
197 /** The current (recording) input gain */
198 Fixed input_gain;
200 /** The current (playback) output volume */
201 Fixed output_volume;
203 /** The hardware register value corresponding to monitor_volume */
204 UWORD monitor_volume_bits;
206 /** The hardware register value corresponding to input_gain */
207 UWORD input_gain_bits;
209 /** The hardware register value corresponding to output_volume */
210 UWORD output_volume_bits;
212 /** Saved state for AC97 mike */
213 UWORD ac97_mic;
215 /** Saved state for AC97 cd */
216 UWORD ac97_cd;
218 /** Saved state for AC97 vide */
219 UWORD ac97_video;
221 /** Saved state for AC97 aux */
222 UWORD ac97_aux;
224 /** Saved state for AC97 line in */
225 UWORD ac97_linein;
227 /** Saved state for AC97 phone */
228 UWORD ac97_phone;
231 #endif /* AHI_Drivers_VIAAC97_DriverData_h */