dice-interface.h 12 KB

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