hdspm.h 5.4 KB

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