18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci#ifndef __SOUND_HDSPM_H 38c2ecf20Sopenharmony_ci#define __SOUND_HDSPM_H 48c2ecf20Sopenharmony_ci/* 58c2ecf20Sopenharmony_ci * Copyright (C) 2003 Winfried Ritsch (IEM) 68c2ecf20Sopenharmony_ci * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 118c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2 of the License, or 128c2ecf20Sopenharmony_ci * (at your option) any later version. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 158c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 178c2ecf20Sopenharmony_ci * GNU General Public License for more details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 208c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software 218c2ecf20Sopenharmony_ci * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifdef __linux__ 258c2ecf20Sopenharmony_ci#include <linux/types.h> 268c2ecf20Sopenharmony_ci#endif 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ 298c2ecf20Sopenharmony_ci#define HDSPM_MAX_CHANNELS 64 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cienum hdspm_io_type { 328c2ecf20Sopenharmony_ci MADI, 338c2ecf20Sopenharmony_ci MADIface, 348c2ecf20Sopenharmony_ci AIO, 358c2ecf20Sopenharmony_ci AES32, 368c2ecf20Sopenharmony_ci RayDAT 378c2ecf20Sopenharmony_ci}; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_cienum hdspm_speed { 408c2ecf20Sopenharmony_ci ss, 418c2ecf20Sopenharmony_ci ds, 428c2ecf20Sopenharmony_ci qs 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* -------------------- IOCTL Peak/RMS Meters -------------------- */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct hdspm_peak_rms { 488c2ecf20Sopenharmony_ci __u32 input_peaks[64]; 498c2ecf20Sopenharmony_ci __u32 playback_peaks[64]; 508c2ecf20Sopenharmony_ci __u32 output_peaks[64]; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci __u64 input_rms[64]; 538c2ecf20Sopenharmony_ci __u64 playback_rms[64]; 548c2ecf20Sopenharmony_ci __u64 output_rms[64]; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci __u8 speed; /* enum {ss, ds, qs} */ 578c2ecf20Sopenharmony_ci int status2; 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ 618c2ecf20Sopenharmony_ci _IOR('H', 0x42, struct hdspm_peak_rms) 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* ------------ CONFIG block IOCTL ---------------------- */ 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistruct hdspm_config { 668c2ecf20Sopenharmony_ci unsigned char pref_sync_ref; 678c2ecf20Sopenharmony_ci unsigned char wordclock_sync_check; 688c2ecf20Sopenharmony_ci unsigned char madi_sync_check; 698c2ecf20Sopenharmony_ci unsigned int system_sample_rate; 708c2ecf20Sopenharmony_ci unsigned int autosync_sample_rate; 718c2ecf20Sopenharmony_ci unsigned char system_clock_mode; 728c2ecf20Sopenharmony_ci unsigned char clock_source; 738c2ecf20Sopenharmony_ci unsigned char autosync_ref; 748c2ecf20Sopenharmony_ci unsigned char line_out; 758c2ecf20Sopenharmony_ci unsigned int passthru; 768c2ecf20Sopenharmony_ci unsigned int analog_out; 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define SNDRV_HDSPM_IOCTL_GET_CONFIG \ 808c2ecf20Sopenharmony_ci _IOR('H', 0x41, struct hdspm_config) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci/* 838c2ecf20Sopenharmony_ci * If there's a TCO (TimeCode Option) board installed, 848c2ecf20Sopenharmony_ci * there are further options and status data available. 858c2ecf20Sopenharmony_ci * The hdspm_ltc structure contains the current SMPTE 868c2ecf20Sopenharmony_ci * timecode and some status information and can be 878c2ecf20Sopenharmony_ci * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the 888c2ecf20Sopenharmony_ci * hdspm_status struct. 898c2ecf20Sopenharmony_ci */ 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cienum hdspm_ltc_format { 928c2ecf20Sopenharmony_ci format_invalid, 938c2ecf20Sopenharmony_ci fps_24, 948c2ecf20Sopenharmony_ci fps_25, 958c2ecf20Sopenharmony_ci fps_2997, 968c2ecf20Sopenharmony_ci fps_30 978c2ecf20Sopenharmony_ci}; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cienum hdspm_ltc_frame { 1008c2ecf20Sopenharmony_ci frame_invalid, 1018c2ecf20Sopenharmony_ci drop_frame, 1028c2ecf20Sopenharmony_ci full_frame 1038c2ecf20Sopenharmony_ci}; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_cienum hdspm_ltc_input_format { 1068c2ecf20Sopenharmony_ci ntsc, 1078c2ecf20Sopenharmony_ci pal, 1088c2ecf20Sopenharmony_ci no_video 1098c2ecf20Sopenharmony_ci}; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_cistruct hdspm_ltc { 1128c2ecf20Sopenharmony_ci unsigned int ltc; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci enum hdspm_ltc_format format; 1158c2ecf20Sopenharmony_ci enum hdspm_ltc_frame frame; 1168c2ecf20Sopenharmony_ci enum hdspm_ltc_input_format input_format; 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* 1228c2ecf20Sopenharmony_ci * The status data reflects the device's current state 1238c2ecf20Sopenharmony_ci * as determined by the card's configuration and 1248c2ecf20Sopenharmony_ci * connection status. 1258c2ecf20Sopenharmony_ci */ 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_cienum hdspm_sync { 1288c2ecf20Sopenharmony_ci hdspm_sync_no_lock = 0, 1298c2ecf20Sopenharmony_ci hdspm_sync_lock = 1, 1308c2ecf20Sopenharmony_ci hdspm_sync_sync = 2 1318c2ecf20Sopenharmony_ci}; 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cienum hdspm_madi_input { 1348c2ecf20Sopenharmony_ci hdspm_input_optical = 0, 1358c2ecf20Sopenharmony_ci hdspm_input_coax = 1 1368c2ecf20Sopenharmony_ci}; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cienum hdspm_madi_channel_format { 1398c2ecf20Sopenharmony_ci hdspm_format_ch_64 = 0, 1408c2ecf20Sopenharmony_ci hdspm_format_ch_56 = 1 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cienum hdspm_madi_frame_format { 1448c2ecf20Sopenharmony_ci hdspm_frame_48 = 0, 1458c2ecf20Sopenharmony_ci hdspm_frame_96 = 1 1468c2ecf20Sopenharmony_ci}; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_cienum hdspm_syncsource { 1498c2ecf20Sopenharmony_ci syncsource_wc = 0, 1508c2ecf20Sopenharmony_ci syncsource_madi = 1, 1518c2ecf20Sopenharmony_ci syncsource_tco = 2, 1528c2ecf20Sopenharmony_ci syncsource_sync = 3, 1538c2ecf20Sopenharmony_ci syncsource_none = 4 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_cistruct hdspm_status { 1578c2ecf20Sopenharmony_ci __u8 card_type; /* enum hdspm_io_type */ 1588c2ecf20Sopenharmony_ci enum hdspm_syncsource autosync_source; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci __u64 card_clock; 1618c2ecf20Sopenharmony_ci __u32 master_period; 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci union { 1648c2ecf20Sopenharmony_ci struct { 1658c2ecf20Sopenharmony_ci __u8 sync_wc; /* enum hdspm_sync */ 1668c2ecf20Sopenharmony_ci __u8 sync_madi; /* enum hdspm_sync */ 1678c2ecf20Sopenharmony_ci __u8 sync_tco; /* enum hdspm_sync */ 1688c2ecf20Sopenharmony_ci __u8 sync_in; /* enum hdspm_sync */ 1698c2ecf20Sopenharmony_ci __u8 madi_input; /* enum hdspm_madi_input */ 1708c2ecf20Sopenharmony_ci __u8 channel_format; /* enum hdspm_madi_channel_format */ 1718c2ecf20Sopenharmony_ci __u8 frame_format; /* enum hdspm_madi_frame_format */ 1728c2ecf20Sopenharmony_ci } madi; 1738c2ecf20Sopenharmony_ci } card_specific; 1748c2ecf20Sopenharmony_ci}; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define SNDRV_HDSPM_IOCTL_GET_STATUS \ 1778c2ecf20Sopenharmony_ci _IOR('H', 0x47, struct hdspm_status) 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci/* 1808c2ecf20Sopenharmony_ci * Get information about the card and its add-ons. 1818c2ecf20Sopenharmony_ci */ 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define HDSPM_ADDON_TCO 1 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_cistruct hdspm_version { 1868c2ecf20Sopenharmony_ci __u8 card_type; /* enum hdspm_io_type */ 1878c2ecf20Sopenharmony_ci char cardname[20]; 1888c2ecf20Sopenharmony_ci unsigned int serial; 1898c2ecf20Sopenharmony_ci unsigned short firmware_rev; 1908c2ecf20Sopenharmony_ci int addons; 1918c2ecf20Sopenharmony_ci}; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci/* ------------- get Matrix Mixer IOCTL --------------- */ 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = 1988c2ecf20Sopenharmony_ci * 32768 Bytes 1998c2ecf20Sopenharmony_ci */ 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* organisation is 64 channelfader in a continuous memory block */ 2028c2ecf20Sopenharmony_ci/* equivalent to hardware definition, maybe for future feature of mmap of 2038c2ecf20Sopenharmony_ci * them 2048c2ecf20Sopenharmony_ci */ 2058c2ecf20Sopenharmony_ci/* each of 64 outputs has 64 infader and 64 outfader: 2068c2ecf20Sopenharmony_ci Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_cistruct hdspm_channelfader { 2118c2ecf20Sopenharmony_ci unsigned int in[HDSPM_MIXER_CHANNELS]; 2128c2ecf20Sopenharmony_ci unsigned int pb[HDSPM_MIXER_CHANNELS]; 2138c2ecf20Sopenharmony_ci}; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_cistruct hdspm_mixer { 2168c2ecf20Sopenharmony_ci struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; 2178c2ecf20Sopenharmony_ci}; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_cistruct hdspm_mixer_ioctl { 2208c2ecf20Sopenharmony_ci struct hdspm_mixer *mixer; 2218c2ecf20Sopenharmony_ci}; 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci/* use indirect access due to the limit of ioctl bit size */ 2248c2ecf20Sopenharmony_ci#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci#endif 227