Merge with Linus' kernel.
[linux-2.6-block.git] / include / sound / cs46xx_dsp_spos.h
CommitLineData
1da177e4
LT
1/*
2 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef __CS46XX_DSP_SPOS_H__
23#define __CS46XX_DSP_SPOS_H__
24
25#include "cs46xx_dsp_scb_types.h"
26#include "cs46xx_dsp_task_types.h"
27
28#define SYMBOL_CONSTANT 0x0
29#define SYMBOL_SAMPLE 0x1
30#define SYMBOL_PARAMETER 0x2
31#define SYMBOL_CODE 0x3
32
33#define SEGTYPE_SP_PROGRAM 0x00000001
34#define SEGTYPE_SP_PARAMETER 0x00000002
35#define SEGTYPE_SP_SAMPLE 0x00000003
36#define SEGTYPE_SP_COEFFICIENT 0x00000004
37
38#define DSP_SPOS_UU 0x0deadul /* unused */
39#define DSP_SPOS_DC 0x0badul /* don't care */
40#define DSP_SPOS_DC_DC 0x0bad0badul /* don't care */
41#define DSP_SPOS_UUUU 0xdeadc0edul /* unused */
42#define DSP_SPOS_UUHI 0xdeadul
43#define DSP_SPOS_UULO 0xc0edul
44#define DSP_SPOS_DCDC 0x0badf1d0ul /* don't care */
45#define DSP_SPOS_DCDCHI 0x0badul
46#define DSP_SPOS_DCDCLO 0xf1d0ul
47
48#define DSP_MAX_TASK_NAME 60
49#define DSP_MAX_SYMBOL_NAME 100
50#define DSP_MAX_SCB_NAME 60
51#define DSP_MAX_SCB_DESC 200
52#define DSP_MAX_TASK_DESC 50
53
54#define DSP_MAX_PCM_CHANNELS 32
55#define DSP_MAX_SRC_NR 14
56
57#define DSP_PCM_MAIN_CHANNEL 1
58#define DSP_PCM_REAR_CHANNEL 2
59#define DSP_PCM_CENTER_LFE_CHANNEL 3
60#define DSP_PCM_S71_CHANNEL 4 /* surround 7.1 */
61#define DSP_IEC958_CHANNEL 5
62
63#define DSP_SPDIF_STATUS_OUTPUT_ENABLED 1
64#define DSP_SPDIF_STATUS_PLAYBACK_OPEN 2
65#define DSP_SPDIF_STATUS_HW_ENABLED 4
66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8
67
3d19f804 68struct dsp_symbol_entry {
1da177e4
LT
69 u32 address;
70 char symbol_name[DSP_MAX_SYMBOL_NAME];
71 int symbol_type;
72
73 /* initialized by driver */
3d19f804 74 struct dsp_module_desc * module;
1da177e4 75 int deleted;
3d19f804 76};
1da177e4 77
3d19f804 78struct dsp_symbol_desc {
1da177e4
LT
79 int nsymbols;
80
3d19f804 81 struct dsp_symbol_entry *symbols;
1da177e4
LT
82
83 /* initialized by driver */
84 int highest_frag_index;
3d19f804 85};
1da177e4 86
3d19f804 87struct dsp_segment_desc {
1da177e4
LT
88 int segment_type;
89 u32 offset;
90 u32 size;
91 u32 * data;
3d19f804 92};
1da177e4 93
3d19f804 94struct dsp_module_desc {
1da177e4 95 char * module_name;
3d19f804 96 struct dsp_symbol_desc symbol_table;
1da177e4 97 int nsegments;
3d19f804 98 struct dsp_segment_desc * segments;
1da177e4
LT
99
100 /* initialized by driver */
101 u32 overlay_begin_address;
102 u32 load_address;
103 int nfixups;
3d19f804 104};
1da177e4 105
3d19f804 106struct dsp_scb_descriptor {
1da177e4
LT
107 char scb_name[DSP_MAX_SCB_NAME];
108 u32 address;
109 int index;
110
3d19f804
TI
111 struct dsp_scb_descriptor * sub_list_ptr;
112 struct dsp_scb_descriptor * next_scb_ptr;
113 struct dsp_scb_descriptor * parent_scb_ptr;
1da177e4 114
3d19f804
TI
115 struct dsp_symbol_entry * task_entry;
116 struct dsp_symbol_entry * scb_symbol;
1da177e4 117
3d19f804 118 struct snd_info_entry *proc_info;
1da177e4
LT
119 int ref_count;
120 spinlock_t lock;
121
122 int deleted;
3d19f804 123};
1da177e4 124
3d19f804 125struct dsp_task_descriptor {
1da177e4
LT
126 char task_name[DSP_MAX_TASK_NAME];
127 int size;
128 u32 address;
129 int index;
3d19f804 130};
1da177e4 131
3d19f804 132struct dsp_pcm_channel_descriptor {
1da177e4
LT
133 int active;
134 int src_slot;
135 int pcm_slot;
136 u32 sample_rate;
137 u32 unlinked;
3d19f804
TI
138 struct dsp_scb_descriptor * pcm_reader_scb;
139 struct dsp_scb_descriptor * src_scb;
140 struct dsp_scb_descriptor * mixer_scb;
1da177e4
LT
141
142 void * private_data;
3d19f804 143};
1da177e4 144
3d19f804
TI
145struct dsp_spos_instance {
146 struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */
1da177e4
LT
147
148 int nmodules;
3d19f804 149 struct dsp_module_desc * modules; /* modules loaded into SP */
1da177e4 150
3d19f804 151 struct dsp_segment_desc code;
1da177e4
LT
152
153 /* Main PCM playback mixer */
3d19f804 154 struct dsp_scb_descriptor * master_mix_scb;
1da177e4
LT
155 u16 dac_volume_right;
156 u16 dac_volume_left;
157
158 /* Rear/surround PCM playback mixer */
3d19f804 159 struct dsp_scb_descriptor * rear_mix_scb;
1da177e4
LT
160
161 /* Center/LFE mixer */
3d19f804 162 struct dsp_scb_descriptor * center_lfe_mix_scb;
1da177e4
LT
163
164 int npcm_channels;
165 int nsrc_scb;
3d19f804 166 struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
1da177e4
LT
167 int src_scb_slots[DSP_MAX_SRC_NR];
168
169 /* cache this symbols */
3d19f804
TI
170 struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
171 struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
1da177e4
LT
172
173 /* proc fs */
3d19f804
TI
174 struct snd_card *snd_card;
175 struct snd_info_entry * proc_dsp_dir;
176 struct snd_info_entry * proc_sym_info_entry;
177 struct snd_info_entry * proc_modules_info_entry;
178 struct snd_info_entry * proc_parameter_dump_info_entry;
179 struct snd_info_entry * proc_sample_dump_info_entry;
1da177e4
LT
180
181 /* SCB's descriptors */
182 int nscb;
183 int scb_highest_frag_index;
3d19f804
TI
184 struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
185 struct snd_info_entry * proc_scb_info_entry;
186 struct dsp_scb_descriptor * the_null_scb;
1da177e4
LT
187
188 /* Task's descriptors */
189 int ntask;
3d19f804
TI
190 struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
191 struct snd_info_entry * proc_task_info_entry;
1da177e4
LT
192
193 /* SPDIF status */
194 int spdif_status_out;
195 int spdif_status_in;
196 u16 spdif_input_volume_right;
197 u16 spdif_input_volume_left;
198 /* spdif channel status,
199 left right and user validity bits */
200 unsigned int spdif_csuv_default;
201 unsigned int spdif_csuv_stream;
202
203 /* SPDIF input sample rate converter */
3d19f804 204 struct dsp_scb_descriptor * spdif_in_src;
1da177e4 205 /* SPDIF input asynch. receiver */
3d19f804 206 struct dsp_scb_descriptor * asynch_rx_scb;
1da177e4
LT
207
208 /* Capture record mixer SCB */
3d19f804 209 struct dsp_scb_descriptor * record_mixer_scb;
1da177e4
LT
210
211 /* CODEC input SCB */
3d19f804 212 struct dsp_scb_descriptor * codec_in_scb;
1da177e4
LT
213
214 /* reference snooper */
3d19f804 215 struct dsp_scb_descriptor * ref_snoop_scb;
1da177e4
LT
216
217 /* SPDIF output PCM reference */
3d19f804 218 struct dsp_scb_descriptor * spdif_pcm_input_scb;
1da177e4
LT
219
220 /* asynch TX task */
3d19f804 221 struct dsp_scb_descriptor * asynch_tx_scb;
1da177e4
LT
222
223 /* record sources */
3d19f804
TI
224 struct dsp_scb_descriptor * pcm_input;
225 struct dsp_scb_descriptor * adc_input;
1da177e4
LT
226
227 int spdif_in_sample_rate;
3d19f804 228};
1da177e4
LT
229
230#endif /* __DSP_SPOS_H__ */