Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mixart_core.h
Go to the documentation of this file.
1 /*
2  * Driver for Digigram miXart soundcards
3  *
4  * low level interface with interrupt handling and mail box implementation
5  *
6  * Copyright (c) 2003 by Digigram <[email protected]>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  */
22 
23 #ifndef __SOUND_MIXART_CORE_H
24 #define __SOUND_MIXART_CORE_H
25 
26 
31 
32  MSG_CONSOLE_MANAGER = 0x070000,
34 
36 
50 
51  MSG_SYSTEM_FIRST_ID = 0x160000,
57 
60 
63 };
64 
65 
66 struct mixart_msg
67 {
69  struct mixart_uid uid;
70  void* data;
71  size_t size;
72 };
73 
74 /* structs used to communicate with miXart */
75 
77 {
83 } __attribute__((packed));
84 
85 
86 /* used for following struct */
87 #define MIXART_FLOAT_P_22_0_TO_HEX 0x41b00000 /* 22.0f */
88 #define MIXART_FLOAT_M_20_0_TO_HEX 0xc1a00000 /* -20.0f */
89 #define MIXART_FLOAT____0_0_TO_HEX 0x00000000 /* 0.0f */
90 
92 {
93  u32 line_max_level; /* float */
94  u32 micro_max_level; /* float */
95  u32 cd_max_level; /* float */
96 } __attribute__((packed));
97 
99 {
102  u32 max_level; /* float */
103  u32 min_var_level; /* float */
104  u32 max_var_level; /* float */
105  u32 step_var_level; /* float */
106  u32 fix_gain; /* float */
107  u32 zero_var; /* float */
108 } __attribute__((packed));
111 {
116 } __attribute__((packed));
117 
119 {
125 } __attribute__((packed));
128 {
132 } __attribute__((packed));
133 
135 {
139 } __attribute__((packed));
142 {
145 } __attribute__((packed));
148 /* used for nb_bytes_max_per_sample */
149 #define MIXART_FLOAT_P__4_0_TO_HEX 0x40800000 /* +4.0f */
150 #define MIXART_FLOAT_P__8_0_TO_HEX 0x41000000 /* +8.0f */
151 
153 {
157 } __attribute__((packed));
159 /* MSG_STREAM_ADD_INPUT_GROUP */
160 /* MSG_STREAM_ADD_OUTPUT_GROUP */
161 
163 {
172 } __attribute__((packed));
175 {
178 } __attribute__((packed));
181 {
187 } __attribute__((packed));
189 /* MSG_STREAM_DELETE_GROUP */
191 /* request : mixart_uid_t group */
194 {
197 } __attribute__((packed));
198 
200 /* MSG_STREAM_START_INPUT_STAGE_PACKET = 0x130000 + 7,
201  MSG_STREAM_START_OUTPUT_STAGE_PACKET = 0x130000 + 8,
202  MSG_STREAM_STOP_INPUT_STAGE_PACKET = 0x130000 + 10,
203  MSG_STREAM_STOP_OUTPUT_STAGE_PACKET = 0x130000 + 11,
204  */
205 
207 {
210 } __attribute__((packed));
213 {
218 } __attribute__((packed));
221 {
225 } __attribute__((packed));
226 
228 {
232  u32 stream_count; /* set to 1 for instance */
233  struct mixart_flow_info stream_info; /* could be an array[stream_count] */
234 } __attribute__((packed));
236 /* MSG_STREAM_START_STREAM_GRP_PACKET = 0x130000 + 6
237  MSG_STREAM_STOP_STREAM_GRP_PACKET = 0x130000 + 9
238  */
239 
241 {
245  u32 pipe_count; /* set to 1 for instance */
246  struct mixart_uid pipe_uid[1]; /* could be an array[pipe_count] */
247 } __attribute__((packed));
248 
250 {
253 } __attribute__((packed));
254 
255 
256 
257 /* Structures used by the MSG_SERVICES_TIMER_NOTIFY command */
258 
260 {
265 } __attribute__((packed));
268 {
271 } __attribute__((packed));
272 
274 /* MSG_CONSOLE_GET_CLOCK_UID = 0x070003,
275  */
276 
277 /* request is a uid with desc = MSG_CONSOLE_MANAGER | cardindex */
278 
280 {
282  struct mixart_uid uid;
283 } __attribute__((packed));
284 
285 /* MSG_CLOCK_CHECK_PROPERTIES = 0x200001,
286  MSG_CLOCK_SET_PROPERTIES = 0x200002,
287 */
288 
296 };
297 
304 };
305 
306 
308 {
321  u32 nb_callers; /* set to 1 (see below) */
323 } __attribute__((packed));
324 
326 {
329 } __attribute__((packed));
332 /* MSG_STREAM_SET_INPUT_STAGE_PARAM = 0x13000F */
333 /* MSG_STREAM_SET_OUTPUT_STAGE_PARAM = 0x130010 */
343 };
364 };
365 
367 {
368  u32 coding_type; /* use enum mixart_coding_type */
369  u32 sample_type; /* use enum mixart_sample_type */
370 
371  union {
372  struct {
378 
379  struct {
390  } format_info;
391 
407  u32 pipe_count; /* set to 1 (array size !) */
408  u32 stream_count; /* set to 1 (array size !) */
409  struct mixart_txx_stream_desc stream_desc[1]; /* only one stream per command, but this could be an array */
410 
411 } __attribute__((packed));
414 /* MSG_CONNECTOR_GET_OUT_AUDIO_LEVEL = 0x050009,
415  */
416 
419 {
421  u32 digital_level; /* float */
422  u32 analog_level; /* float */
423  u32 monitor_level; /* float */
427 } __attribute__((packed));
430 /* MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL = 0x05000A,
431  */
433 /* used for valid_mask below */
434 #define MIXART_AUDIO_LEVEL_ANALOG_MASK 0x01
435 #define MIXART_AUDIO_LEVEL_DIGITAL_MASK 0x02
436 #define MIXART_AUDIO_LEVEL_MONITOR_MASK 0x04
437 #define MIXART_AUDIO_LEVEL_MUTE_MASK 0x08
438 #define MIXART_AUDIO_LEVEL_MUTE_M1_MASK 0x10
439 #define MIXART_AUDIO_LEVEL_MUTE_M2_MASK 0x20
442 {
447  u32 digital_level; /* float */
448  u32 analog_level; /* float */
449  u32 monitor_level; /* float */
454 } __attribute__((packed));
455 
456 
457 /* MSG_SYSTEM_ENUM_PHYSICAL_IO = 0x16000E,
458  */
459 
460 #define MIXART_MAX_PHYS_IO (MIXART_MAX_CARDS * 2 * 2) /* 4 * (analog+digital) * (playback+capture) */
461 
463 {
469 } __attribute__((packed));
470 
471 
472 /* MSG_PHYSICALIO_SET_LEVEL = 0x0F0008,
473  MSG_PHYSICALIO_GET_LEVEL = 0x0F000C,
474 */
475 
477 {
478  u32 analog_level; /* float */
480 } __attribute__((packed));
481 
483 {
484  s32 channel; /* 0=left, 1=right, -1=both, -2=both same */
486 } __attribute__((packed));
489 /* MSG_STREAM_SET_IN_AUDIO_LEVEL = 0x130015,
490  */
491 
493 {
499 } __attribute__((packed));
500 
502 {
505  u32 audio_count; /* set to <= 2 */
508 } __attribute__((packed));
509 
510 /* response is a 32 bit status */
512 
513 /* MSG_STREAM_SET_OUT_STREAM_LEVEL = 0x130017,
514  */
515 
516 /* defines used for valid_mask1 */
517 #define MIXART_OUT_STREAM_SET_LEVEL_LEFT_AUDIO1 0x01
518 #define MIXART_OUT_STREAM_SET_LEVEL_LEFT_AUDIO2 0x02
519 #define MIXART_OUT_STREAM_SET_LEVEL_RIGHT_AUDIO1 0x04
520 #define MIXART_OUT_STREAM_SET_LEVEL_RIGHT_AUDIO2 0x08
521 #define MIXART_OUT_STREAM_SET_LEVEL_STREAM_1 0x10
522 #define MIXART_OUT_STREAM_SET_LEVEL_STREAM_2 0x20
523 #define MIXART_OUT_STREAM_SET_LEVEL_MUTE_1 0x40
524 #define MIXART_OUT_STREAM_SET_LEVEL_MUTE_2 0x80
525 
527 {
538 } __attribute__((packed));
539 
541 {
544 } __attribute__((packed));
547 {
551  u32 nb_of_stream; /* set to 1 */
552  struct mixart_set_out_stream_level stream_level; /* could be an array */
553 } __attribute__((packed));
554 
555 /* response to this request is a u32 status value */
556 
558 /* exported */
559 void snd_mixart_init_mailbox(struct mixart_mgr *mgr);
560 void snd_mixart_exit_mailbox(struct mixart_mgr *mgr);
561 
562 int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int max_resp_size, void *resp_data);
563 int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, struct mixart_msg *request, u32 notif_event);
565 
566 irqreturn_t snd_mixart_interrupt(int irq, void *dev_id);
567 void snd_mixart_msg_tasklet(unsigned long arg);
568 
569 void snd_mixart_reset_board(struct mixart_mgr *mgr);
570 
571 #endif /* __SOUND_MIXART_CORE_H */