hdspm.h 5.3 KB

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