hdspm.h 5.3 KB

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