/* SPDX-License-Identifier: GPL-2.0 */1#ifndef SOUND_FIREWIRE_DICE_INTERFACE_H_INCLUDED2#define SOUND_FIREWIRE_DICE_INTERFACE_H_INCLUDED34/*5* DICE device interface definitions6*/78/*9* Generally, all registers can be read like memory, i.e., with quadlet read or10* block read transactions with at least quadlet-aligned offset and length.11* Writes are not allowed except where noted; quadlet-sized registers must be12* written with a quadlet write transaction.13*14* All values are in big endian. The DICE firmware runs on a little-endian CPU15* and just byte-swaps _all_ quadlets on the bus, so values without endianness16* (e.g. strings) get scrambled and must be byte-swapped again by the driver.17*/1819/*20* Streaming is handled by the "DICE driver" interface. Its registers are21* located in this private address space.22*/23#define DICE_PRIVATE_SPACE 0xffffe0000000uLL2425/*26* The registers are organized in several sections, which are organized27* separately to allow them to be extended individually. Whether a register is28* supported can be detected by checking its offset against its section's size.29*30* The section offset values are relative to DICE_PRIVATE_SPACE; the offset/31* size values are measured in quadlets. Read-only.32*/33#define DICE_GLOBAL_OFFSET 0x0034#define DICE_GLOBAL_SIZE 0x0435#define DICE_TX_OFFSET 0x0836#define DICE_TX_SIZE 0x0c37#define DICE_RX_OFFSET 0x1038#define DICE_RX_SIZE 0x1439#define DICE_EXT_SYNC_OFFSET 0x1840#define DICE_EXT_SYNC_SIZE 0x1c41#define DICE_UNUSED2_OFFSET 0x2042#define DICE_UNUSED2_SIZE 0x244344/*45* Global settings.46*/4748/*49* Stores the full 64-bit address (node ID and offset in the node's address50* space) where the device will send notifications. Must be changed with51* a compare/swap transaction by the owner. This register is automatically52* cleared on a bus reset.53*/54#define GLOBAL_OWNER 0x00055#define OWNER_NO_OWNER 0xffff000000000000uLL56#define OWNER_NODE_SHIFT 485758/*59* A bitmask with asynchronous events; read-only. When any event(s) happen,60* the bits of previous events are cleared, and the value of this register is61* also written to the address stored in the owner register.62*/63#define GLOBAL_NOTIFICATION 0x00864/* Some registers in the Rx/Tx sections may have changed. */65#define NOTIFY_RX_CFG_CHG 0x0000000166#define NOTIFY_TX_CFG_CHG 0x0000000267/* Lock status of the current clock source may have changed. */68#define NOTIFY_LOCK_CHG 0x0000001069/* Write to the clock select register has been finished. */70#define NOTIFY_CLOCK_ACCEPTED 0x0000002071/* Lock status of some clock source has changed. */72#define NOTIFY_EXT_STATUS 0x0000004073/* Other bits may be used for device-specific events. */7475/*76* A name that can be customized for each device; read/write. Padded with zero77* bytes. Quadlets are byte-swapped. The encoding is whatever the host driver78* happens to be using.79*/80#define GLOBAL_NICK_NAME 0x00c81#define NICK_NAME_SIZE 648283/*84* The current sample rate and clock source; read/write. Whether a clock85* source or sample rate is supported is device-specific; the internal clock86* source is always available. Low/mid/high = up to 48/96/192 kHz. This87* register can be changed even while streams are running.88*/89#define GLOBAL_CLOCK_SELECT 0x04c90#define CLOCK_SOURCE_MASK 0x000000ff91#define CLOCK_SOURCE_AES1 0x0000000092#define CLOCK_SOURCE_AES2 0x0000000193#define CLOCK_SOURCE_AES3 0x0000000294#define CLOCK_SOURCE_AES4 0x0000000395#define CLOCK_SOURCE_AES_ANY 0x0000000496#define CLOCK_SOURCE_ADAT 0x0000000597#define CLOCK_SOURCE_TDIF 0x0000000698#define CLOCK_SOURCE_WC 0x0000000799#define CLOCK_SOURCE_ARX1 0x00000008100#define CLOCK_SOURCE_ARX2 0x00000009101#define CLOCK_SOURCE_ARX3 0x0000000a102#define CLOCK_SOURCE_ARX4 0x0000000b103#define CLOCK_SOURCE_INTERNAL 0x0000000c104#define CLOCK_RATE_MASK 0x0000ff00105#define CLOCK_RATE_32000 0x00000000106#define CLOCK_RATE_44100 0x00000100107#define CLOCK_RATE_48000 0x00000200108#define CLOCK_RATE_88200 0x00000300109#define CLOCK_RATE_96000 0x00000400110#define CLOCK_RATE_176400 0x00000500111#define CLOCK_RATE_192000 0x00000600112#define CLOCK_RATE_ANY_LOW 0x00000700113#define CLOCK_RATE_ANY_MID 0x00000800114#define CLOCK_RATE_ANY_HIGH 0x00000900115#define CLOCK_RATE_NONE 0x00000a00116#define CLOCK_RATE_SHIFT 8117118/*119* Enable streaming; read/write. Writing a non-zero value (re)starts all120* streams that have a valid iso channel set; zero stops all streams. The121* streams' parameters must be configured before starting. This register is122* automatically cleared on a bus reset.123*/124#define GLOBAL_ENABLE 0x050125126/*127* Status of the sample clock; read-only.128*/129#define GLOBAL_STATUS 0x054130/* The current clock source is locked. */131#define STATUS_SOURCE_LOCKED 0x00000001132/* The actual sample rate; CLOCK_RATE_32000-_192000 or _NONE. */133#define STATUS_NOMINAL_RATE_MASK 0x0000ff00134135/*136* Status of all clock sources; read-only.137*/138#define GLOBAL_EXTENDED_STATUS 0x058139/*140* The _LOCKED bits always show the current status; any change generates141* a notification.142*/143#define EXT_STATUS_AES1_LOCKED 0x00000001144#define EXT_STATUS_AES2_LOCKED 0x00000002145#define EXT_STATUS_AES3_LOCKED 0x00000004146#define EXT_STATUS_AES4_LOCKED 0x00000008147#define EXT_STATUS_ADAT_LOCKED 0x00000010148#define EXT_STATUS_TDIF_LOCKED 0x00000020149#define EXT_STATUS_ARX1_LOCKED 0x00000040150#define EXT_STATUS_ARX2_LOCKED 0x00000080151#define EXT_STATUS_ARX3_LOCKED 0x00000100152#define EXT_STATUS_ARX4_LOCKED 0x00000200153#define EXT_STATUS_WC_LOCKED 0x00000400154/*155* The _SLIP bits do not generate notifications; a set bit indicates that an156* error occurred since the last time when this register was read with157* a quadlet read transaction.158*/159#define EXT_STATUS_AES1_SLIP 0x00010000160#define EXT_STATUS_AES2_SLIP 0x00020000161#define EXT_STATUS_AES3_SLIP 0x00040000162#define EXT_STATUS_AES4_SLIP 0x00080000163#define EXT_STATUS_ADAT_SLIP 0x00100000164#define EXT_STATUS_TDIF_SLIP 0x00200000165#define EXT_STATUS_ARX1_SLIP 0x00400000166#define EXT_STATUS_ARX2_SLIP 0x00800000167#define EXT_STATUS_ARX3_SLIP 0x01000000168#define EXT_STATUS_ARX4_SLIP 0x02000000169#define EXT_STATUS_WC_SLIP 0x04000000170171/*172* The measured rate of the current clock source, in Hz; read-only.173*/174#define GLOBAL_SAMPLE_RATE 0x05c175176/*177* Some old firmware versions do not have the following global registers.178* Windows drivers produced by TCAT lost backward compatibility in its179* early release because they can handle firmware only which supports the180* following registers.181*/182183/*184* The version of the DICE driver specification that this device conforms to;185* read-only.186*/187#define GLOBAL_VERSION 0x060188189/*190* Supported sample rates and clock sources; read-only.191*/192#define GLOBAL_CLOCK_CAPABILITIES 0x064193#define CLOCK_CAP_RATE_32000 0x00000001194#define CLOCK_CAP_RATE_44100 0x00000002195#define CLOCK_CAP_RATE_48000 0x00000004196#define CLOCK_CAP_RATE_88200 0x00000008197#define CLOCK_CAP_RATE_96000 0x00000010198#define CLOCK_CAP_RATE_176400 0x00000020199#define CLOCK_CAP_RATE_192000 0x00000040200#define CLOCK_CAP_SOURCE_AES1 0x00010000201#define CLOCK_CAP_SOURCE_AES2 0x00020000202#define CLOCK_CAP_SOURCE_AES3 0x00040000203#define CLOCK_CAP_SOURCE_AES4 0x00080000204#define CLOCK_CAP_SOURCE_AES_ANY 0x00100000205#define CLOCK_CAP_SOURCE_ADAT 0x00200000206#define CLOCK_CAP_SOURCE_TDIF 0x00400000207#define CLOCK_CAP_SOURCE_WC 0x00800000208#define CLOCK_CAP_SOURCE_ARX1 0x01000000209#define CLOCK_CAP_SOURCE_ARX2 0x02000000210#define CLOCK_CAP_SOURCE_ARX3 0x04000000211#define CLOCK_CAP_SOURCE_ARX4 0x08000000212#define CLOCK_CAP_SOURCE_INTERNAL 0x10000000213214/*215* Names of all clock sources; read-only. Quadlets are byte-swapped. Names216* are separated with one backslash, the list is terminated with two217* backslashes. Unused clock sources are included.218*/219#define GLOBAL_CLOCK_SOURCE_NAMES 0x068220#define CLOCK_SOURCE_NAMES_SIZE 256221222/*223* Capture stream settings. This section includes the number/size registers224* and the registers of all streams.225*/226227/*228* The number of supported capture streams; read-only.229*/230#define TX_NUMBER 0x000231232/*233* The size of one stream's register block, in quadlets; read-only. The234* registers of the first stream follow immediately afterwards; the registers235* of the following streams are offset by this register's value.236*/237#define TX_SIZE 0x004238239/*240* The isochronous channel number on which packets are sent, or -1 if the241* stream is not to be used; read/write.242*/243#define TX_ISOCHRONOUS 0x008244245/*246* The number of audio channels; read-only. There will be one quadlet per247* channel; the first channel is the first quadlet in a data block.248*/249#define TX_NUMBER_AUDIO 0x00c250251/*252* The number of MIDI ports, 0-8; read-only. If > 0, there will be one253* additional quadlet in each data block, following the audio quadlets.254*/255#define TX_NUMBER_MIDI 0x010256257/*258* The speed at which the packets are sent, SCODE_100-_400; read/write.259* SCODE_800 is only available in Dice III.260*/261#define TX_SPEED 0x014262263/*264* Names of all audio channels; read-only. Quadlets are byte-swapped. Names265* are separated with one backslash, the list is terminated with two266* backslashes.267*/268#define TX_NAMES 0x018269#define TX_NAMES_SIZE 256270271/*272* Audio IEC60958 capabilities; read-only. Bitmask with one bit per audio273* channel.274*/275#define TX_AC3_CAPABILITIES 0x118276277/*278* Send audio data with IEC60958 label; read/write. Bitmask with one bit per279* audio channel. This register can be changed even while the stream is280* running.281*/282#define TX_AC3_ENABLE 0x11c283284/*285* Playback stream settings. This section includes the number/size registers286* and the registers of all streams.287*/288289/*290* The number of supported playback streams; read-only.291*/292#define RX_NUMBER 0x000293294/*295* The size of one stream's register block, in quadlets; read-only. The296* registers of the first stream follow immediately afterwards; the registers297* of the following streams are offset by this register's value.298*/299#define RX_SIZE 0x004300301/*302* The isochronous channel number on which packets are received, or -1 if the303* stream is not to be used; read/write.304*/305#define RX_ISOCHRONOUS 0x008306307/*308* Index of first quadlet to be interpreted; read/write. If > 0, that many309* quadlets at the beginning of each data block will be ignored, and all the310* audio and MIDI quadlets will follow.311*/312#define RX_SEQ_START 0x00c313314/*315* The number of audio channels; read-only. There will be one quadlet per316* channel.317*/318#define RX_NUMBER_AUDIO 0x010319320/*321* The number of MIDI ports, 0-8; read-only. If > 0, there will be one322* additional quadlet in each data block, following the audio quadlets.323*/324#define RX_NUMBER_MIDI 0x014325326/*327* Names of all audio channels; read-only. Quadlets are byte-swapped. Names328* are separated with one backslash, the list is terminated with two329* backslashes.330*/331#define RX_NAMES 0x018332#define RX_NAMES_SIZE 256333334/*335* Audio IEC60958 capabilities; read-only. Bitmask with one bit per audio336* channel.337*/338#define RX_AC3_CAPABILITIES 0x118339340/*341* Receive audio data with IEC60958 label; read/write. Bitmask with one bit342* per audio channel. This register can be changed even while the stream is343* running.344*/345#define RX_AC3_ENABLE 0x11c346347/*348* Extended synchronization information.349* This section can be read completely with a block read request.350*/351352/*353* Current clock source; read-only.354*/355#define EXT_SYNC_CLOCK_SOURCE 0x000356357/*358* Clock source is locked (boolean); read-only.359*/360#define EXT_SYNC_LOCKED 0x004361362/*363* Current sample rate (CLOCK_RATE_* >> CLOCK_RATE_SHIFT), _32000-_192000 or364* _NONE; read-only.365*/366#define EXT_SYNC_RATE 0x008367368/*369* ADAT user data bits; read-only.370*/371#define EXT_SYNC_ADAT_USER_DATA 0x00c372/* The data bits, if available. */373#define ADAT_USER_DATA_MASK 0x0f374/* The data bits are not available. */375#define ADAT_USER_DATA_NO_DATA 0x10376377#endif378379380