Blame include/sound/hdspm.h

Packit 4a16fb
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
Packit 4a16fb
#ifndef __SOUND_HDSPM_H
Packit 4a16fb
#define __SOUND_HDSPM_H
Packit 4a16fb
/*
Packit 4a16fb
 *   Copyright (C) 2003 Winfried Ritsch (IEM)
Packit 4a16fb
 *   based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
Packit 4a16fb
 *
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is free software; you can redistribute it and/or modify
Packit 4a16fb
 *   it under the terms of the GNU General Public License as published by
Packit 4a16fb
 *   the Free Software Foundation; either version 2 of the License, or
Packit 4a16fb
 *   (at your option) any later version.
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is distributed in the hope that it will be useful,
Packit 4a16fb
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
 *   GNU General Public License for more details.
Packit 4a16fb
 *
Packit 4a16fb
 *   You should have received a copy of the GNU General Public License
Packit 4a16fb
 *   along with this program; if not, write to the Free Software
Packit 4a16fb
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#include <linux/types.h>
Packit 4a16fb
Packit 4a16fb
/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
Packit 4a16fb
#define HDSPM_MAX_CHANNELS      64
Packit 4a16fb
Packit 4a16fb
enum hdspm_io_type {
Packit 4a16fb
	MADI,
Packit 4a16fb
	MADIface,
Packit 4a16fb
	AIO,
Packit 4a16fb
	AES32,
Packit 4a16fb
	RayDAT
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_speed {
Packit 4a16fb
	ss,
Packit 4a16fb
	ds,
Packit 4a16fb
	qs
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/* -------------------- IOCTL Peak/RMS Meters -------------------- */
Packit 4a16fb
Packit 4a16fb
struct hdspm_peak_rms {
Packit 4a16fb
	__u32 input_peaks[64];
Packit 4a16fb
	__u32 playback_peaks[64];
Packit 4a16fb
	__u32 output_peaks[64];
Packit 4a16fb
Packit 4a16fb
	__u64 input_rms[64];
Packit 4a16fb
	__u64 playback_rms[64];
Packit 4a16fb
	__u64 output_rms[64];
Packit 4a16fb
Packit 4a16fb
	__u8 speed; /* enum {ss, ds, qs} */
Packit 4a16fb
	int status2;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
Packit 4a16fb
	_IOR('H', 0x42, struct hdspm_peak_rms)
Packit 4a16fb
Packit 4a16fb
/* ------------ CONFIG block IOCTL ---------------------- */
Packit 4a16fb
Packit 4a16fb
struct hdspm_config {
Packit 4a16fb
	unsigned char pref_sync_ref;
Packit 4a16fb
	unsigned char wordclock_sync_check;
Packit 4a16fb
	unsigned char madi_sync_check;
Packit 4a16fb
	unsigned int system_sample_rate;
Packit 4a16fb
	unsigned int autosync_sample_rate;
Packit 4a16fb
	unsigned char system_clock_mode;
Packit 4a16fb
	unsigned char clock_source;
Packit 4a16fb
	unsigned char autosync_ref;
Packit 4a16fb
	unsigned char line_out;
Packit 4a16fb
	unsigned int passthru;
Packit 4a16fb
	unsigned int analog_out;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
Packit 4a16fb
	_IOR('H', 0x41, struct hdspm_config)
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 * If there's a TCO (TimeCode Option) board installed,
Packit 4a16fb
 * there are further options and status data available.
Packit 4a16fb
 * The hdspm_ltc structure contains the current SMPTE
Packit 4a16fb
 * timecode and some status information and can be
Packit 4a16fb
 * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
Packit 4a16fb
 * hdspm_status struct.
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
enum hdspm_ltc_format {
Packit 4a16fb
	format_invalid,
Packit 4a16fb
	fps_24,
Packit 4a16fb
	fps_25,
Packit 4a16fb
	fps_2997,
Packit 4a16fb
	fps_30
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_ltc_frame {
Packit 4a16fb
	frame_invalid,
Packit 4a16fb
	drop_frame,
Packit 4a16fb
	full_frame
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_ltc_input_format {
Packit 4a16fb
	ntsc,
Packit 4a16fb
	pal,
Packit 4a16fb
	no_video
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct hdspm_ltc {
Packit 4a16fb
	unsigned int ltc;
Packit 4a16fb
Packit 4a16fb
	enum hdspm_ltc_format format;
Packit 4a16fb
	enum hdspm_ltc_frame frame;
Packit 4a16fb
	enum hdspm_ltc_input_format input_format;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 * The status data reflects the device's current state
Packit 4a16fb
 * as determined by the card's configuration and
Packit 4a16fb
 * connection status.
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
enum hdspm_sync {
Packit 4a16fb
	hdspm_sync_no_lock = 0,
Packit 4a16fb
	hdspm_sync_lock = 1,
Packit 4a16fb
	hdspm_sync_sync = 2
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_madi_input {
Packit 4a16fb
	hdspm_input_optical = 0,
Packit 4a16fb
	hdspm_input_coax = 1
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_madi_channel_format {
Packit 4a16fb
	hdspm_format_ch_64 = 0,
Packit 4a16fb
	hdspm_format_ch_56 = 1
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_madi_frame_format {
Packit 4a16fb
	hdspm_frame_48 = 0,
Packit 4a16fb
	hdspm_frame_96 = 1
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
enum hdspm_syncsource {
Packit 4a16fb
	syncsource_wc = 0,
Packit 4a16fb
	syncsource_madi = 1,
Packit 4a16fb
	syncsource_tco = 2,
Packit 4a16fb
	syncsource_sync = 3,
Packit 4a16fb
	syncsource_none = 4
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct hdspm_status {
Packit 4a16fb
	__u8 card_type; /* enum hdspm_io_type */
Packit 4a16fb
	enum hdspm_syncsource autosync_source;
Packit 4a16fb
Packit 4a16fb
	__u64 card_clock;
Packit 4a16fb
	__u32 master_period;
Packit 4a16fb
Packit 4a16fb
	union {
Packit 4a16fb
		struct {
Packit 4a16fb
			__u8 sync_wc; /* enum hdspm_sync */
Packit 4a16fb
			__u8 sync_madi; /* enum hdspm_sync */
Packit 4a16fb
			__u8 sync_tco; /* enum hdspm_sync */
Packit 4a16fb
			__u8 sync_in; /* enum hdspm_sync */
Packit 4a16fb
			__u8 madi_input; /* enum hdspm_madi_input */
Packit 4a16fb
			__u8 channel_format; /* enum hdspm_madi_channel_format */
Packit 4a16fb
			__u8 frame_format; /* enum hdspm_madi_frame_format */
Packit 4a16fb
		} madi;
Packit 4a16fb
	} card_specific;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#define SNDRV_HDSPM_IOCTL_GET_STATUS \
Packit 4a16fb
	_IOR('H', 0x47, struct hdspm_status)
Packit 4a16fb
Packit 4a16fb
/*
Packit 4a16fb
 * Get information about the card and its add-ons.
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#define HDSPM_ADDON_TCO 1
Packit 4a16fb
Packit 4a16fb
struct hdspm_version {
Packit 4a16fb
	__u8 card_type; /* enum hdspm_io_type */
Packit 4a16fb
	char cardname[20];
Packit 4a16fb
	unsigned int serial;
Packit 4a16fb
	unsigned short firmware_rev;
Packit 4a16fb
	int addons;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
Packit 4a16fb
Packit 4a16fb
/* ------------- get Matrix Mixer IOCTL --------------- */
Packit 4a16fb
Packit 4a16fb
/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
Packit 4a16fb
 * 32768 Bytes
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
/* organisation is 64 channelfader in a continuous memory block */
Packit 4a16fb
/* equivalent to hardware definition, maybe for future feature of mmap of
Packit 4a16fb
 * them
Packit 4a16fb
 */
Packit 4a16fb
/* each of 64 outputs has 64 infader and 64 outfader:
Packit 4a16fb
   Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
Packit 4a16fb
Packit 4a16fb
#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
Packit 4a16fb
Packit 4a16fb
struct hdspm_channelfader {
Packit 4a16fb
	unsigned int in[HDSPM_MIXER_CHANNELS];
Packit 4a16fb
	unsigned int pb[HDSPM_MIXER_CHANNELS];
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct hdspm_mixer {
Packit 4a16fb
	struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct hdspm_mixer_ioctl {
Packit 4a16fb
	struct hdspm_mixer *mixer;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
/* use indirect access due to the limit of ioctl bit size */
Packit 4a16fb
#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
Packit 4a16fb
Packit 4a16fb
/* typedefs for compatibility to user-space */
Packit 4a16fb
typedef struct hdspm_peak_rms hdspm_peak_rms_t;
Packit 4a16fb
typedef struct hdspm_config_info hdspm_config_info_t;
Packit 4a16fb
typedef struct hdspm_version hdspm_version_t;
Packit 4a16fb
typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
Packit 4a16fb
typedef struct hdspm_mixer hdspm_mixer_t;
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
#endif