1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2 #ifndef __SOUND_HDSPM_H 3 #define __SOUND_HDSPM_H 4 /* 5 * Copyright (C) 2003 Winfried Ritsch (IEM) 6 * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) 7 * 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 */ 23 24 #ifdef __linux__ 25 #include <linux/types.h> 26 #endif 27 28 /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ 29 #define HDSPM_MAX_CHANNELS 64 30 31 enum hdspm_io_type { 32 MADI, 33 MADIface, 34 AIO, 35 AES32, 36 RayDAT 37 }; 38 39 enum hdspm_speed { 40 ss, 41 ds, 42 qs 43 }; 44 45 /* -------------------- IOCTL Peak/RMS Meters -------------------- */ 46 47 struct hdspm_peak_rms { 48 __u32 input_peaks[64]; 49 __u32 playback_peaks[64]; 50 __u32 output_peaks[64]; 51 52 __u64 input_rms[64]; 53 __u64 playback_rms[64]; 54 __u64 output_rms[64]; 55 56 __u8 speed; /* enum {ss, ds, qs} */ 57 int status2; 58 }; 59 60 #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ 61 _IOR('H', 0x42, struct hdspm_peak_rms) 62 63 /* ------------ CONFIG block IOCTL ---------------------- */ 64 65 struct hdspm_config { 66 unsigned char pref_sync_ref; 67 unsigned char wordclock_sync_check; 68 unsigned char madi_sync_check; 69 unsigned int system_sample_rate; 70 unsigned int autosync_sample_rate; 71 unsigned char system_clock_mode; 72 unsigned char clock_source; 73 unsigned char autosync_ref; 74 unsigned char line_out; 75 unsigned int passthru; 76 unsigned int analog_out; 77 }; 78 79 #define SNDRV_HDSPM_IOCTL_GET_CONFIG \ 80 _IOR('H', 0x41, struct hdspm_config) 81 82 /* 83 * If there's a TCO (TimeCode Option) board installed, 84 * there are further options and status data available. 85 * The hdspm_ltc structure contains the current SMPTE 86 * timecode and some status information and can be 87 * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the 88 * hdspm_status struct. 89 */ 90 91 enum hdspm_ltc_format { 92 format_invalid, 93 fps_24, 94 fps_25, 95 fps_2997, 96 fps_30 97 }; 98 99 enum hdspm_ltc_frame { 100 frame_invalid, 101 drop_frame, 102 full_frame 103 }; 104 105 enum hdspm_ltc_input_format { 106 ntsc, 107 pal, 108 no_video 109 }; 110 111 struct hdspm_ltc { 112 unsigned int ltc; 113 114 enum hdspm_ltc_format format; 115 enum hdspm_ltc_frame frame; 116 enum hdspm_ltc_input_format input_format; 117 }; 118 119 #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) 120 121 /* 122 * The status data reflects the device's current state 123 * as determined by the card's configuration and 124 * connection status. 125 */ 126 127 enum hdspm_sync { 128 hdspm_sync_no_lock = 0, 129 hdspm_sync_lock = 1, 130 hdspm_sync_sync = 2 131 }; 132 133 enum hdspm_madi_input { 134 hdspm_input_optical = 0, 135 hdspm_input_coax = 1 136 }; 137 138 enum hdspm_madi_channel_format { 139 hdspm_format_ch_64 = 0, 140 hdspm_format_ch_56 = 1 141 }; 142 143 enum hdspm_madi_frame_format { 144 hdspm_frame_48 = 0, 145 hdspm_frame_96 = 1 146 }; 147 148 enum hdspm_syncsource { 149 syncsource_wc = 0, 150 syncsource_madi = 1, 151 syncsource_tco = 2, 152 syncsource_sync = 3, 153 syncsource_none = 4 154 }; 155 156 struct hdspm_status { 157 __u8 card_type; /* enum hdspm_io_type */ 158 enum hdspm_syncsource autosync_source; 159 160 __u64 card_clock; 161 __u32 master_period; 162 163 union { 164 struct { 165 __u8 sync_wc; /* enum hdspm_sync */ 166 __u8 sync_madi; /* enum hdspm_sync */ 167 __u8 sync_tco; /* enum hdspm_sync */ 168 __u8 sync_in; /* enum hdspm_sync */ 169 __u8 madi_input; /* enum hdspm_madi_input */ 170 __u8 channel_format; /* enum hdspm_madi_channel_format */ 171 __u8 frame_format; /* enum hdspm_madi_frame_format */ 172 } madi; 173 } card_specific; 174 }; 175 176 #define SNDRV_HDSPM_IOCTL_GET_STATUS \ 177 _IOR('H', 0x47, struct hdspm_status) 178 179 /* 180 * Get information about the card and its add-ons. 181 */ 182 183 #define HDSPM_ADDON_TCO 1 184 185 struct hdspm_version { 186 __u8 card_type; /* enum hdspm_io_type */ 187 char cardname[20]; 188 unsigned int serial; 189 unsigned short firmware_rev; 190 int addons; 191 }; 192 193 #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) 194 195 /* ------------- get Matrix Mixer IOCTL --------------- */ 196 197 /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = 198 * 32768 Bytes 199 */ 200 201 /* organisation is 64 channelfader in a continuous memory block */ 202 /* equivalent to hardware definition, maybe for future feature of mmap of 203 * them 204 */ 205 /* each of 64 outputs has 64 infader and 64 outfader: 206 Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ 207 208 #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 209 210 struct hdspm_channelfader { 211 unsigned int in[HDSPM_MIXER_CHANNELS]; 212 unsigned int pb[HDSPM_MIXER_CHANNELS]; 213 }; 214 215 struct hdspm_mixer { 216 struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; 217 }; 218 219 struct hdspm_mixer_ioctl { 220 struct hdspm_mixer *mixer; 221 }; 222 223 /* use indirect access due to the limit of ioctl bit size */ 224 #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) 225 226 #endif 227