dice-interface.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. #ifndef SOUND_FIREWIRE_DICE_INTERFACE_H_INCLUDED
  2. #define SOUND_FIREWIRE_DICE_INTERFACE_H_INCLUDED
  3. /*
  4. * DICE device interface definitions
  5. */
  6. /*
  7. * Generally, all registers can be read like memory, i.e., with quadlet read or
  8. * block read transactions with at least quadlet-aligned offset and length.
  9. * Writes are not allowed except where noted; quadlet-sized registers must be
  10. * written with a quadlet write transaction.
  11. *
  12. * All values are in big endian. The DICE firmware runs on a little-endian CPU
  13. * and just byte-swaps _all_ quadlets on the bus, so values without endianness
  14. * (e.g. strings) get scrambled and must be byte-swapped again by the driver.
  15. */
  16. /*
  17. * Streaming is handled by the "DICE driver" interface. Its registers are
  18. * located in this private address space.
  19. */
  20. #define DICE_PRIVATE_SPACE 0xffffe0000000uLL
  21. /*
  22. * The registers are organized in several sections, which are organized
  23. * separately to allow them to be extended individually. Whether a register is
  24. * supported can be detected by checking its offset against its section's size.
  25. *
  26. * The section offset values are relative to DICE_PRIVATE_SPACE; the offset/
  27. * size values are measured in quadlets. Read-only.
  28. */
  29. #define DICE_GLOBAL_OFFSET 0x00
  30. #define DICE_GLOBAL_SIZE 0x04
  31. #define DICE_TX_OFFSET 0x08
  32. #define DICE_TX_SIZE 0x0c
  33. #define DICE_RX_OFFSET 0x10
  34. #define DICE_RX_SIZE 0x14
  35. #define DICE_EXT_SYNC_OFFSET 0x18
  36. #define DICE_EXT_SYNC_SIZE 0x1c
  37. #define DICE_UNUSED2_OFFSET 0x20
  38. #define DICE_UNUSED2_SIZE 0x24
  39. /*
  40. * Global settings.
  41. */
  42. /*
  43. * Stores the full 64-bit address (node ID and offset in the node's address
  44. * space) where the device will send notifications. Must be changed with
  45. * a compare/swap transaction by the owner. This register is automatically
  46. * cleared on a bus reset.
  47. */
  48. #define GLOBAL_OWNER 0x000
  49. #define OWNER_NO_OWNER 0xffff000000000000uLL
  50. #define OWNER_NODE_SHIFT 48
  51. /*
  52. * A bitmask with asynchronous events; read-only. When any event(s) happen,
  53. * the bits of previous events are cleared, and the value of this register is
  54. * also written to the address stored in the owner register.
  55. */
  56. #define GLOBAL_NOTIFICATION 0x008
  57. /* Some registers in the Rx/Tx sections may have changed. */
  58. #define NOTIFY_RX_CFG_CHG 0x00000001
  59. #define NOTIFY_TX_CFG_CHG 0x00000002
  60. /* Lock status of the current clock source may have changed. */
  61. #define NOTIFY_LOCK_CHG 0x00000010
  62. /* Write to the clock select register has been finished. */
  63. #define NOTIFY_CLOCK_ACCEPTED 0x00000020
  64. /* Lock status of some clock source has changed. */
  65. #define NOTIFY_EXT_STATUS 0x00000040
  66. /* Other bits may be used for device-specific events. */
  67. /*
  68. * A name that can be customized for each device; read/write. Padded with zero
  69. * bytes. Quadlets are byte-swapped. The encoding is whatever the host driver
  70. * happens to be using.
  71. */
  72. #define GLOBAL_NICK_NAME 0x00c
  73. #define NICK_NAME_SIZE 64
  74. /*
  75. * The current sample rate and clock source; read/write. Whether a clock
  76. * source or sample rate is supported is device-specific; the internal clock
  77. * source is always available. Low/mid/high = up to 48/96/192 kHz. This
  78. * register can be changed even while streams are running.
  79. */
  80. #define GLOBAL_CLOCK_SELECT 0x04c
  81. #define CLOCK_SOURCE_MASK 0x000000ff
  82. #define CLOCK_SOURCE_AES1 0x00000000
  83. #define CLOCK_SOURCE_AES2 0x00000001
  84. #define CLOCK_SOURCE_AES3 0x00000002
  85. #define CLOCK_SOURCE_AES4 0x00000003
  86. #define CLOCK_SOURCE_AES_ANY 0x00000004
  87. #define CLOCK_SOURCE_ADAT 0x00000005
  88. #define CLOCK_SOURCE_TDIF 0x00000006
  89. #define CLOCK_SOURCE_WC 0x00000007
  90. #define CLOCK_SOURCE_ARX1 0x00000008
  91. #define CLOCK_SOURCE_ARX2 0x00000009
  92. #define CLOCK_SOURCE_ARX3 0x0000000a
  93. #define CLOCK_SOURCE_ARX4 0x0000000b
  94. #define CLOCK_SOURCE_INTERNAL 0x0000000c
  95. #define CLOCK_RATE_MASK 0x0000ff00
  96. #define CLOCK_RATE_32000 0x00000000
  97. #define CLOCK_RATE_44100 0x00000100
  98. #define CLOCK_RATE_48000 0x00000200
  99. #define CLOCK_RATE_88200 0x00000300
  100. #define CLOCK_RATE_96000 0x00000400
  101. #define CLOCK_RATE_176400 0x00000500
  102. #define CLOCK_RATE_192000 0x00000600
  103. #define CLOCK_RATE_ANY_LOW 0x00000700
  104. #define CLOCK_RATE_ANY_MID 0x00000800
  105. #define CLOCK_RATE_ANY_HIGH 0x00000900
  106. #define CLOCK_RATE_NONE 0x00000a00
  107. #define CLOCK_RATE_SHIFT 8
  108. /*
  109. * Enable streaming; read/write. Writing a non-zero value (re)starts all
  110. * streams that have a valid iso channel set; zero stops all streams. The
  111. * streams' parameters must be configured before starting. This register is
  112. * automatically cleared on a bus reset.
  113. */
  114. #define GLOBAL_ENABLE 0x050
  115. /*
  116. * Status of the sample clock; read-only.
  117. */
  118. #define GLOBAL_STATUS 0x054
  119. /* The current clock source is locked. */
  120. #define STATUS_SOURCE_LOCKED 0x00000001
  121. /* The actual sample rate; CLOCK_RATE_32000-_192000 or _NONE. */
  122. #define STATUS_NOMINAL_RATE_MASK 0x0000ff00
  123. /*
  124. * Status of all clock sources; read-only.
  125. */
  126. #define GLOBAL_EXTENDED_STATUS 0x058
  127. /*
  128. * The _LOCKED bits always show the current status; any change generates
  129. * a notification.
  130. */
  131. #define EXT_STATUS_AES1_LOCKED 0x00000001
  132. #define EXT_STATUS_AES2_LOCKED 0x00000002
  133. #define EXT_STATUS_AES3_LOCKED 0x00000004
  134. #define EXT_STATUS_AES4_LOCKED 0x00000008
  135. #define EXT_STATUS_ADAT_LOCKED 0x00000010
  136. #define EXT_STATUS_TDIF_LOCKED 0x00000020
  137. #define EXT_STATUS_ARX1_LOCKED 0x00000040
  138. #define EXT_STATUS_ARX2_LOCKED 0x00000080
  139. #define EXT_STATUS_ARX3_LOCKED 0x00000100
  140. #define EXT_STATUS_ARX4_LOCKED 0x00000200
  141. #define EXT_STATUS_WC_LOCKED 0x00000400
  142. /*
  143. * The _SLIP bits do not generate notifications; a set bit indicates that an
  144. * error occurred since the last time when this register was read with
  145. * a quadlet read transaction.
  146. */
  147. #define EXT_STATUS_AES1_SLIP 0x00010000
  148. #define EXT_STATUS_AES2_SLIP 0x00020000
  149. #define EXT_STATUS_AES3_SLIP 0x00040000
  150. #define EXT_STATUS_AES4_SLIP 0x00080000
  151. #define EXT_STATUS_ADAT_SLIP 0x00100000
  152. #define EXT_STATUS_TDIF_SLIP 0x00200000
  153. #define EXT_STATUS_ARX1_SLIP 0x00400000
  154. #define EXT_STATUS_ARX2_SLIP 0x00800000
  155. #define EXT_STATUS_ARX3_SLIP 0x01000000
  156. #define EXT_STATUS_ARX4_SLIP 0x02000000
  157. #define EXT_STATUS_WC_SLIP 0x04000000
  158. /*
  159. * The measured rate of the current clock source, in Hz; read-only.
  160. */
  161. #define GLOBAL_SAMPLE_RATE 0x05c
  162. /*
  163. * The version of the DICE driver specification that this device conforms to;
  164. * read-only.
  165. */
  166. #define GLOBAL_VERSION 0x060
  167. /* Some old firmware versions do not have the following global registers: */
  168. /*
  169. * Supported sample rates and clock sources; read-only.
  170. */
  171. #define GLOBAL_CLOCK_CAPABILITIES 0x064
  172. #define CLOCK_CAP_RATE_32000 0x00000001
  173. #define CLOCK_CAP_RATE_44100 0x00000002
  174. #define CLOCK_CAP_RATE_48000 0x00000004
  175. #define CLOCK_CAP_RATE_88200 0x00000008
  176. #define CLOCK_CAP_RATE_96000 0x00000010
  177. #define CLOCK_CAP_RATE_176400 0x00000020
  178. #define CLOCK_CAP_RATE_192000 0x00000040
  179. #define CLOCK_CAP_SOURCE_AES1 0x00010000
  180. #define CLOCK_CAP_SOURCE_AES2 0x00020000
  181. #define CLOCK_CAP_SOURCE_AES3 0x00040000
  182. #define CLOCK_CAP_SOURCE_AES4 0x00080000
  183. #define CLOCK_CAP_SOURCE_AES_ANY 0x00100000
  184. #define CLOCK_CAP_SOURCE_ADAT 0x00200000
  185. #define CLOCK_CAP_SOURCE_TDIF 0x00400000
  186. #define CLOCK_CAP_SOURCE_WC 0x00800000
  187. #define CLOCK_CAP_SOURCE_ARX1 0x01000000
  188. #define CLOCK_CAP_SOURCE_ARX2 0x02000000
  189. #define CLOCK_CAP_SOURCE_ARX3 0x04000000
  190. #define CLOCK_CAP_SOURCE_ARX4 0x08000000
  191. #define CLOCK_CAP_SOURCE_INTERNAL 0x10000000
  192. /*
  193. * Names of all clock sources; read-only. Quadlets are byte-swapped. Names
  194. * are separated with one backslash, the list is terminated with two
  195. * backslashes. Unused clock sources are included.
  196. */
  197. #define GLOBAL_CLOCK_SOURCE_NAMES 0x068
  198. #define CLOCK_SOURCE_NAMES_SIZE 256
  199. /*
  200. * Capture stream settings. This section includes the number/size registers
  201. * and the registers of all streams.
  202. */
  203. /*
  204. * The number of supported capture streams; read-only.
  205. */
  206. #define TX_NUMBER 0x000
  207. /*
  208. * The size of one stream's register block, in quadlets; read-only. The
  209. * registers of the first stream follow immediately afterwards; the registers
  210. * of the following streams are offset by this register's value.
  211. */
  212. #define TX_SIZE 0x004
  213. /*
  214. * The isochronous channel number on which packets are sent, or -1 if the
  215. * stream is not to be used; read/write.
  216. */
  217. #define TX_ISOCHRONOUS 0x008
  218. /*
  219. * The number of audio channels; read-only. There will be one quadlet per
  220. * channel; the first channel is the first quadlet in a data block.
  221. */
  222. #define TX_NUMBER_AUDIO 0x00c
  223. /*
  224. * The number of MIDI ports, 0-8; read-only. If > 0, there will be one
  225. * additional quadlet in each data block, following the audio quadlets.
  226. */
  227. #define TX_NUMBER_MIDI 0x010
  228. /*
  229. * The speed at which the packets are sent, SCODE_100-_400; read/write.
  230. */
  231. #define TX_SPEED 0x014
  232. /*
  233. * Names of all audio channels; read-only. Quadlets are byte-swapped. Names
  234. * are separated with one backslash, the list is terminated with two
  235. * backslashes.
  236. */
  237. #define TX_NAMES 0x018
  238. #define TX_NAMES_SIZE 256
  239. /*
  240. * Audio IEC60958 capabilities; read-only. Bitmask with one bit per audio
  241. * channel.
  242. */
  243. #define TX_AC3_CAPABILITIES 0x118
  244. /*
  245. * Send audio data with IEC60958 label; read/write. Bitmask with one bit per
  246. * audio channel. This register can be changed even while the stream is
  247. * running.
  248. */
  249. #define TX_AC3_ENABLE 0x11c
  250. /*
  251. * Playback stream settings. This section includes the number/size registers
  252. * and the registers of all streams.
  253. */
  254. /*
  255. * The number of supported playback streams; read-only.
  256. */
  257. #define RX_NUMBER 0x000
  258. /*
  259. * The size of one stream's register block, in quadlets; read-only. The
  260. * registers of the first stream follow immediately afterwards; the registers
  261. * of the following streams are offset by this register's value.
  262. */
  263. #define RX_SIZE 0x004
  264. /*
  265. * The isochronous channel number on which packets are received, or -1 if the
  266. * stream is not to be used; read/write.
  267. */
  268. #define RX_ISOCHRONOUS 0x008
  269. /*
  270. * Index of first quadlet to be interpreted; read/write. If > 0, that many
  271. * quadlets at the beginning of each data block will be ignored, and all the
  272. * audio and MIDI quadlets will follow.
  273. */
  274. #define RX_SEQ_START 0x00c
  275. /*
  276. * The number of audio channels; read-only. There will be one quadlet per
  277. * channel.
  278. */
  279. #define RX_NUMBER_AUDIO 0x010
  280. /*
  281. * The number of MIDI ports, 0-8; read-only. If > 0, there will be one
  282. * additional quadlet in each data block, following the audio quadlets.
  283. */
  284. #define RX_NUMBER_MIDI 0x014
  285. /*
  286. * Names of all audio channels; read-only. Quadlets are byte-swapped. Names
  287. * are separated with one backslash, the list is terminated with two
  288. * backslashes.
  289. */
  290. #define RX_NAMES 0x018
  291. #define RX_NAMES_SIZE 256
  292. /*
  293. * Audio IEC60958 capabilities; read-only. Bitmask with one bit per audio
  294. * channel.
  295. */
  296. #define RX_AC3_CAPABILITIES 0x118
  297. /*
  298. * Receive audio data with IEC60958 label; read/write. Bitmask with one bit
  299. * per audio channel. This register can be changed even while the stream is
  300. * running.
  301. */
  302. #define RX_AC3_ENABLE 0x11c
  303. /*
  304. * Extended synchronization information.
  305. * This section can be read completely with a block read request.
  306. */
  307. /*
  308. * Current clock source; read-only.
  309. */
  310. #define EXT_SYNC_CLOCK_SOURCE 0x000
  311. /*
  312. * Clock source is locked (boolean); read-only.
  313. */
  314. #define EXT_SYNC_LOCKED 0x004
  315. /*
  316. * Current sample rate (CLOCK_RATE_* >> CLOCK_RATE_SHIFT), _32000-_192000 or
  317. * _NONE; read-only.
  318. */
  319. #define EXT_SYNC_RATE 0x008
  320. /*
  321. * ADAT user data bits; read-only.
  322. */
  323. #define EXT_SYNC_ADAT_USER_DATA 0x00c
  324. /* The data bits, if available. */
  325. #define ADAT_USER_DATA_MASK 0x0f
  326. /* The data bits are not available. */
  327. #define ADAT_USER_DATA_NO_DATA 0x10
  328. #endif