blob: 81990b2bcc981bb4f31cae44616aa052c5f1066e [file] [log] [blame]
Takashi Iwaief5fa1a2007-07-27 16:52:46 +02001#ifndef __SOUND_HDSPM_H
Takashi Iwai763f3562005-06-03 11:25:34 +02002#define __SOUND_HDSPM_H
3/*
4 * Copyright (C) 2003 Winfried Ritsch (IEM)
5 * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
6 *
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
24#define HDSPM_MAX_CHANNELS 64
25
26/* -------------------- IOCTL Peak/RMS Meters -------------------- */
27
Takashi Iwai763f3562005-06-03 11:25:34 +020028/* peam rms level structure like we get from hardware
29
30 maybe in future we can memory map it so I just copy it
31 to user on ioctl call now an dont change anything
32 rms are made out of low and high values
33 where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24)
34 (i asume so from the code)
35*/
36
Takashi Iwai98274f02005-11-17 14:52:34 +010037struct hdspm_peak_rms {
Takashi Iwai763f3562005-06-03 11:25:34 +020038
39 unsigned int level_offset[1024];
40
41 unsigned int input_peak[64];
42 unsigned int playback_peak[64];
43 unsigned int output_peak[64];
44 unsigned int xxx_peak[64]; /* not used */
45
46 unsigned int reserved[256]; /* not used */
47
48 unsigned int input_rms_l[64];
49 unsigned int playback_rms_l[64];
50 unsigned int output_rms_l[64];
51 unsigned int xxx_rms_l[64]; /* not used */
52
53 unsigned int input_rms_h[64];
54 unsigned int playback_rms_h[64];
55 unsigned int output_rms_h[64];
56 unsigned int xxx_rms_h[64]; /* not used */
57};
58
Takashi Iwai98274f02005-11-17 14:52:34 +010059struct hdspm_peak_rms_ioctl {
60 struct hdspm_peak_rms *peak;
Takashi Iwai763f3562005-06-03 11:25:34 +020061};
62
63/* use indirect access due to the limit of ioctl bit size */
Takashi Iwaief5fa1a2007-07-27 16:52:46 +020064#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
65 _IOR('H', 0x40, struct hdspm_peak_rms_ioctl)
Takashi Iwai763f3562005-06-03 11:25:34 +020066
67/* ------------ CONFIG block IOCTL ---------------------- */
68
Takashi Iwai98274f02005-11-17 14:52:34 +010069struct hdspm_config_info {
Takashi Iwai763f3562005-06-03 11:25:34 +020070 unsigned char pref_sync_ref;
71 unsigned char wordclock_sync_check;
72 unsigned char madi_sync_check;
73 unsigned int system_sample_rate;
74 unsigned int autosync_sample_rate;
75 unsigned char system_clock_mode;
76 unsigned char clock_source;
77 unsigned char autosync_ref;
78 unsigned char line_out;
79 unsigned int passthru;
80 unsigned int analog_out;
81};
82
Takashi Iwaief5fa1a2007-07-27 16:52:46 +020083#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \
84 _IOR('H', 0x41, struct hdspm_config_info)
Takashi Iwai763f3562005-06-03 11:25:34 +020085
86
87/* get Soundcard Version */
88
Takashi Iwai98274f02005-11-17 14:52:34 +010089struct hdspm_version {
Takashi Iwai763f3562005-06-03 11:25:34 +020090 unsigned short firmware_rev;
91};
92
Takashi Iwai98274f02005-11-17 14:52:34 +010093#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version)
Takashi Iwai763f3562005-06-03 11:25:34 +020094
95
96/* ------------- get Matrix Mixer IOCTL --------------- */
97
Takashi Iwaief5fa1a2007-07-27 16:52:46 +020098/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
99 * 32768 Bytes
100 */
Takashi Iwai763f3562005-06-03 11:25:34 +0200101
102/* organisation is 64 channelfader in a continous memory block */
Takashi Iwaief5fa1a2007-07-27 16:52:46 +0200103/* equivalent to hardware definition, maybe for future feature of mmap of
104 * them
105 */
Takashi Iwai763f3562005-06-03 11:25:34 +0200106/* each of 64 outputs has 64 infader and 64 outfader:
107 Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
108
109#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
110
Takashi Iwai98274f02005-11-17 14:52:34 +0100111struct hdspm_channelfader {
Takashi Iwai763f3562005-06-03 11:25:34 +0200112 unsigned int in[HDSPM_MIXER_CHANNELS];
113 unsigned int pb[HDSPM_MIXER_CHANNELS];
114};
115
Takashi Iwai98274f02005-11-17 14:52:34 +0100116struct hdspm_mixer {
117 struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
Takashi Iwai763f3562005-06-03 11:25:34 +0200118};
119
Takashi Iwai98274f02005-11-17 14:52:34 +0100120struct hdspm_mixer_ioctl {
121 struct hdspm_mixer *mixer;
Takashi Iwai763f3562005-06-03 11:25:34 +0200122};
123
124/* use indirect access due to the limit of ioctl bit size */
Takashi Iwai98274f02005-11-17 14:52:34 +0100125#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
126
127/* typedefs for compatibility to user-space */
128typedef struct hdspm_peak_rms hdspm_peak_rms_t;
129typedef struct hdspm_config_info hdspm_config_info_t;
130typedef struct hdspm_version hdspm_version_t;
131typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
132typedef struct hdspm_mixer hdspm_mixer_t;
Takashi Iwai763f3562005-06-03 11:25:34 +0200133
134#endif /* __SOUND_HDSPM_H */