hdspm.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. #include <linux/types.h>
  24. /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
  25. #define HDSPM_MAX_CHANNELS 64
  26. enum hdspm_io_type {
  27. MADI,
  28. MADIface,
  29. AIO,
  30. AES32,
  31. RayDAT
  32. };
  33. enum hdspm_speed {
  34. ss,
  35. ds,
  36. qs
  37. };
  38. /* -------------------- IOCTL Peak/RMS Meters -------------------- */
  39. struct hdspm_peak_rms {
  40. __u32 input_peaks[64];
  41. __u32 playback_peaks[64];
  42. __u32 output_peaks[64];
  43. __u64 input_rms[64];
  44. __u64 playback_rms[64];
  45. __u64 output_rms[64];
  46. __u8 speed; /* enum {ss, ds, qs} */
  47. int status2;
  48. };
  49. #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
  50. _IOR('H', 0x42, struct hdspm_peak_rms)
  51. /* ------------ CONFIG block IOCTL ---------------------- */
  52. struct hdspm_config {
  53. unsigned char pref_sync_ref;
  54. unsigned char wordclock_sync_check;
  55. unsigned char madi_sync_check;
  56. unsigned int system_sample_rate;
  57. unsigned int autosync_sample_rate;
  58. unsigned char system_clock_mode;
  59. unsigned char clock_source;
  60. unsigned char autosync_ref;
  61. unsigned char line_out;
  62. unsigned int passthru;
  63. unsigned int analog_out;
  64. };
  65. #define SNDRV_HDSPM_IOCTL_GET_CONFIG \
  66. _IOR('H', 0x41, struct hdspm_config)
  67. /*
  68. * If there's a TCO (TimeCode Option) board installed,
  69. * there are further options and status data available.
  70. * The hdspm_ltc structure contains the current SMPTE
  71. * timecode and some status information and can be
  72. * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
  73. * hdspm_status struct.
  74. */
  75. enum hdspm_ltc_format {
  76. format_invalid,
  77. fps_24,
  78. fps_25,
  79. fps_2997,
  80. fps_30
  81. };
  82. enum hdspm_ltc_frame {
  83. frame_invalid,
  84. drop_frame,
  85. full_frame
  86. };
  87. enum hdspm_ltc_input_format {
  88. ntsc,
  89. pal,
  90. no_video
  91. };
  92. struct hdspm_ltc {
  93. unsigned int ltc;
  94. enum hdspm_ltc_format format;
  95. enum hdspm_ltc_frame frame;
  96. enum hdspm_ltc_input_format input_format;
  97. };
  98. #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
  99. /*
  100. * The status data reflects the device's current state
  101. * as determined by the card's configuration and
  102. * connection status.
  103. */
  104. enum hdspm_sync {
  105. hdspm_sync_no_lock = 0,
  106. hdspm_sync_lock = 1,
  107. hdspm_sync_sync = 2
  108. };
  109. enum hdspm_madi_input {
  110. hdspm_input_optical = 0,
  111. hdspm_input_coax = 1
  112. };
  113. enum hdspm_madi_channel_format {
  114. hdspm_format_ch_64 = 0,
  115. hdspm_format_ch_56 = 1
  116. };
  117. enum hdspm_madi_frame_format {
  118. hdspm_frame_48 = 0,
  119. hdspm_frame_96 = 1
  120. };
  121. enum hdspm_syncsource {
  122. syncsource_wc = 0,
  123. syncsource_madi = 1,
  124. syncsource_tco = 2,
  125. syncsource_sync = 3,
  126. syncsource_none = 4
  127. };
  128. struct hdspm_status {
  129. __u8 card_type; /* enum hdspm_io_type */
  130. enum hdspm_syncsource autosync_source;
  131. __u64 card_clock;
  132. __u32 master_period;
  133. union {
  134. struct {
  135. __u8 sync_wc; /* enum hdspm_sync */
  136. __u8 sync_madi; /* enum hdspm_sync */
  137. __u8 sync_tco; /* enum hdspm_sync */
  138. __u8 sync_in; /* enum hdspm_sync */
  139. __u8 madi_input; /* enum hdspm_madi_input */
  140. __u8 channel_format; /* enum hdspm_madi_channel_format */
  141. __u8 frame_format; /* enum hdspm_madi_frame_format */
  142. } madi;
  143. } card_specific;
  144. };
  145. #define SNDRV_HDSPM_IOCTL_GET_STATUS \
  146. _IOR('H', 0x47, struct hdspm_status)
  147. /*
  148. * Get information about the card and its add-ons.
  149. */
  150. #define HDSPM_ADDON_TCO 1
  151. struct hdspm_version {
  152. __u8 card_type; /* enum hdspm_io_type */
  153. char cardname[20];
  154. unsigned int serial;
  155. unsigned short firmware_rev;
  156. int addons;
  157. };
  158. #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
  159. /* ------------- get Matrix Mixer IOCTL --------------- */
  160. /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
  161. * 32768 Bytes
  162. */
  163. /* organisation is 64 channelfader in a continuous memory block */
  164. /* equivalent to hardware definition, maybe for future feature of mmap of
  165. * them
  166. */
  167. /* each of 64 outputs has 64 infader and 64 outfader:
  168. Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
  169. #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
  170. struct hdspm_channelfader {
  171. unsigned int in[HDSPM_MIXER_CHANNELS];
  172. unsigned int pb[HDSPM_MIXER_CHANNELS];
  173. };
  174. struct hdspm_mixer {
  175. struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
  176. };
  177. struct hdspm_mixer_ioctl {
  178. struct hdspm_mixer *mixer;
  179. };
  180. /* use indirect access due to the limit of ioctl bit size */
  181. #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
  182. /* typedefs for compatibility to user-space */
  183. typedef struct hdspm_peak_rms hdspm_peak_rms_t;
  184. typedef struct hdspm_config_info hdspm_config_info_t;
  185. typedef struct hdspm_version hdspm_version_t;
  186. typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
  187. typedef struct hdspm_mixer hdspm_mixer_t;
  188. #endif