Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 #ifndef __SOUND_HDSPM_H
0003 #define __SOUND_HDSPM_H
0004 /*
0005  *   Copyright (C) 2003 Winfried Ritsch (IEM)
0006  *   based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
0007  *
0008  *
0009  *   This program is free software; you can redistribute it and/or modify
0010  *   it under the terms of the GNU General Public License as published by
0011  *   the Free Software Foundation; either version 2 of the License, or
0012  *   (at your option) any later version.
0013  *
0014  *   This program is distributed in the hope that it will be useful,
0015  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *   GNU General Public License for more details.
0018  *
0019  *   You should have received a copy of the GNU General Public License
0020  *   along with this program; if not, write to the Free Software
0021  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0022  */
0023 
0024 #ifdef __linux__
0025 #include <linux/types.h>
0026 #endif
0027 
0028 /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
0029 #define HDSPM_MAX_CHANNELS      64
0030 
0031 enum hdspm_io_type {
0032     MADI,
0033     MADIface,
0034     AIO,
0035     AES32,
0036     RayDAT
0037 };
0038 
0039 enum hdspm_speed {
0040     ss,
0041     ds,
0042     qs
0043 };
0044 
0045 /* -------------------- IOCTL Peak/RMS Meters -------------------- */
0046 
0047 struct hdspm_peak_rms {
0048     __u32 input_peaks[64];
0049     __u32 playback_peaks[64];
0050     __u32 output_peaks[64];
0051 
0052     __u64 input_rms[64];
0053     __u64 playback_rms[64];
0054     __u64 output_rms[64];
0055 
0056     __u8 speed; /* enum {ss, ds, qs} */
0057     int status2;
0058 };
0059 
0060 #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
0061     _IOR('H', 0x42, struct hdspm_peak_rms)
0062 
0063 /* ------------ CONFIG block IOCTL ---------------------- */
0064 
0065 struct hdspm_config {
0066     unsigned char pref_sync_ref;
0067     unsigned char wordclock_sync_check;
0068     unsigned char madi_sync_check;
0069     unsigned int system_sample_rate;
0070     unsigned int autosync_sample_rate;
0071     unsigned char system_clock_mode;
0072     unsigned char clock_source;
0073     unsigned char autosync_ref;
0074     unsigned char line_out;
0075     unsigned int passthru;
0076     unsigned int analog_out;
0077 };
0078 
0079 #define SNDRV_HDSPM_IOCTL_GET_CONFIG \
0080     _IOR('H', 0x41, struct hdspm_config)
0081 
0082 /*
0083  * If there's a TCO (TimeCode Option) board installed,
0084  * there are further options and status data available.
0085  * The hdspm_ltc structure contains the current SMPTE
0086  * timecode and some status information and can be
0087  * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
0088  * hdspm_status struct.
0089  */
0090 
0091 enum hdspm_ltc_format {
0092     format_invalid,
0093     fps_24,
0094     fps_25,
0095     fps_2997,
0096     fps_30
0097 };
0098 
0099 enum hdspm_ltc_frame {
0100     frame_invalid,
0101     drop_frame,
0102     full_frame
0103 };
0104 
0105 enum hdspm_ltc_input_format {
0106     ntsc,
0107     pal,
0108     no_video
0109 };
0110 
0111 struct hdspm_ltc {
0112     unsigned int ltc;
0113 
0114     enum hdspm_ltc_format format;
0115     enum hdspm_ltc_frame frame;
0116     enum hdspm_ltc_input_format input_format;
0117 };
0118 
0119 #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
0120 
0121 /*
0122  * The status data reflects the device's current state
0123  * as determined by the card's configuration and
0124  * connection status.
0125  */
0126 
0127 enum hdspm_sync {
0128     hdspm_sync_no_lock = 0,
0129     hdspm_sync_lock = 1,
0130     hdspm_sync_sync = 2
0131 };
0132 
0133 enum hdspm_madi_input {
0134     hdspm_input_optical = 0,
0135     hdspm_input_coax = 1
0136 };
0137 
0138 enum hdspm_madi_channel_format {
0139     hdspm_format_ch_64 = 0,
0140     hdspm_format_ch_56 = 1
0141 };
0142 
0143 enum hdspm_madi_frame_format {
0144     hdspm_frame_48 = 0,
0145     hdspm_frame_96 = 1
0146 };
0147 
0148 enum hdspm_syncsource {
0149     syncsource_wc = 0,
0150     syncsource_madi = 1,
0151     syncsource_tco = 2,
0152     syncsource_sync = 3,
0153     syncsource_none = 4
0154 };
0155 
0156 struct hdspm_status {
0157     __u8 card_type; /* enum hdspm_io_type */
0158     enum hdspm_syncsource autosync_source;
0159 
0160     __u64 card_clock;
0161     __u32 master_period;
0162 
0163     union {
0164         struct {
0165             __u8 sync_wc; /* enum hdspm_sync */
0166             __u8 sync_madi; /* enum hdspm_sync */
0167             __u8 sync_tco; /* enum hdspm_sync */
0168             __u8 sync_in; /* enum hdspm_sync */
0169             __u8 madi_input; /* enum hdspm_madi_input */
0170             __u8 channel_format; /* enum hdspm_madi_channel_format */
0171             __u8 frame_format; /* enum hdspm_madi_frame_format */
0172         } madi;
0173     } card_specific;
0174 };
0175 
0176 #define SNDRV_HDSPM_IOCTL_GET_STATUS \
0177     _IOR('H', 0x47, struct hdspm_status)
0178 
0179 /*
0180  * Get information about the card and its add-ons.
0181  */
0182 
0183 #define HDSPM_ADDON_TCO 1
0184 
0185 struct hdspm_version {
0186     __u8 card_type; /* enum hdspm_io_type */
0187     char cardname[20];
0188     unsigned int serial;
0189     unsigned short firmware_rev;
0190     int addons;
0191 };
0192 
0193 #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
0194 
0195 /* ------------- get Matrix Mixer IOCTL --------------- */
0196 
0197 /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
0198  * 32768 Bytes
0199  */
0200 
0201 /* organisation is 64 channelfader in a continuous memory block */
0202 /* equivalent to hardware definition, maybe for future feature of mmap of
0203  * them
0204  */
0205 /* each of 64 outputs has 64 infader and 64 outfader:
0206    Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
0207 
0208 #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
0209 
0210 struct hdspm_channelfader {
0211     unsigned int in[HDSPM_MIXER_CHANNELS];
0212     unsigned int pb[HDSPM_MIXER_CHANNELS];
0213 };
0214 
0215 struct hdspm_mixer {
0216     struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
0217 };
0218 
0219 struct hdspm_mixer_ioctl {
0220     struct hdspm_mixer *mixer;
0221 };
0222 
0223 /* use indirect access due to the limit of ioctl bit size */
0224 #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
0225 
0226 #endif