amdtp.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* -*- c-basic-offset: 8 -*- */
  2. #ifndef __AMDTP_H
  3. #define __AMDTP_H
  4. #include <asm/types.h>
  5. #include "ieee1394-ioctl.h"
  6. /* The userspace interface for the Audio & Music Data Transmission
  7. * Protocol driver is really simple. First, open /dev/amdtp, use the
  8. * ioctl to configure format, rate, dimension and either plug or
  9. * channel, then start writing samples.
  10. *
  11. * The formats supported by the driver are listed below.
  12. * AMDTP_FORMAT_RAW corresponds to the AM824 raw format, which can
  13. * carry any number of channels, so use this if you're streaming
  14. * multichannel audio. The AMDTP_FORMAT_IEC958_PCM corresponds to the
  15. * AM824 IEC958 encapsulation without the IEC958 data bit set, using
  16. * AMDTP_FORMAT_IEC958_AC3 will transmit the samples with the data bit
  17. * set, suitable for transmitting compressed AC-3 audio.
  18. *
  19. * The rate field specifies the transmission rate; supported values
  20. * are 32000, 44100, 48000, 88200, 96000, 176400 and 192000.
  21. *
  22. * The dimension field specifies the dimension of the signal, that is,
  23. * the number of audio channels. Only AMDTP_FORMAT_RAW supports
  24. * settings greater than 2.
  25. *
  26. * The mode field specifies which transmission mode to use. The AMDTP
  27. * specifies two different transmission modes: blocking and
  28. * non-blocking. The blocking transmission mode always send a fixed
  29. * number of samples, typically 8, 16 or 32. To exactly match the
  30. * transmission rate, the driver alternates between sending empty and
  31. * non-empty packets. In non-blocking mode, the driver transmits as
  32. * small packets as possible. For example, for a transmission rate of
  33. * 44100Hz, the driver should send 5 41/80 samples in every cycle, but
  34. * this is not possible so instead the driver alternates between
  35. * sending 5 and 6 samples.
  36. *
  37. * The last thing to specify is either the isochronous channel to use
  38. * or the output plug to connect to. If you know what channel the
  39. * destination device will listen on, you can specify the channel
  40. * directly and use the AMDTP_IOC_CHANNEL ioctl. However, if the
  41. * destination device chooses the channel and uses the IEC61883-1 plug
  42. * mechanism, you can specify an output plug to connect to. The
  43. * driver will pick up the channel number from the plug once the
  44. * destination device locks the output plug control register. In this
  45. * case set the plug field and use the AMDTP_IOC_PLUG ioctl.
  46. *
  47. * Having configured the interface, the driver now accepts writes of
  48. * regular 16 bit signed little endian samples, with the channels
  49. * interleaved. For example, 4 channels would look like:
  50. *
  51. * | sample 0 | sample 1 ...
  52. * | ch. 0 | ch. 1 | ch. 2 | ch. 3 | ch. 0 | ...
  53. * | lsb | msb | lsb | msb | lsb | msb | lsb | msb | lsb | msb | ...
  54. *
  55. */
  56. enum {
  57. AMDTP_FORMAT_RAW,
  58. AMDTP_FORMAT_IEC958_PCM,
  59. AMDTP_FORMAT_IEC958_AC3
  60. };
  61. enum {
  62. AMDTP_MODE_BLOCKING,
  63. AMDTP_MODE_NON_BLOCKING,
  64. };
  65. enum {
  66. AMDTP_INPUT_LE16,
  67. AMDTP_INPUT_BE16,
  68. };
  69. struct amdtp_ioctl {
  70. __u32 format;
  71. __u32 rate;
  72. __u32 dimension;
  73. __u32 mode;
  74. union { __u32 channel; __u32 plug; } u;
  75. };
  76. #endif /* __AMDTP_H */