kludged together at Wed Nov 14 22:52:05 UTC 2007 --zeur. tweaked at Thu Nov 15 00:28:03 UTC 2007 --zeur. second draft completed at Fri Nov 16 17:50:01 UTC 2007 --zeur. [Behavioral Specification] Message format>> #define % "bit notation" #define 0 bit #define OC OpCode #define DATA Data #define " " seperator #define | "I/D seperator" Bit order: big-endian Byte order: network OC DATA DATA DATA %0000|0000 0000 0000 #undef 0 Valid opcodes: % Description Data 0000 NoOp Ignored 0001 Initialize See PROTOCOLS below 1100 Command accept Ignored 1101 Command resend Ignored (but see ERROR CORRECTION below) 1110 Command reject Ignored 1111 Reset device Ignored Protocols>> Initialization data: %0 Description 0000 Set default protocol 0001 Set protocol v1 1111 Undefined %1 Description 0000 RESERVED 1111 Undefined %2 Description 0000 Extended flag area 1111 Undefined Protocol v1: %0 Description Data 0010 Set audio input format See AUDIO INPUTS below 0011 Set audio output format See AUDIO OUTPUTS below 0100 Set rate See RATE SELECTION below 0101 Set rate extended See RATE SELECTION below 0110 Set frequency See FREQUENCY SELECTION below 0101 Set frequency extended See FREQUENCY SELECTION below 0110 Data See DATA TRANSMISSION below 0111 Set extended Custom (but see ERROR CORRECTION below) 1000 Set padding See PADDING below 1001 Set channel See CHANNELS below 1110 RESERVED Audio Inputs>> %0 Description Data 0000 Set default Ignored 0001 Set PCM Ignored 0002 Set DSD Ignored 0111 Set extended Custom 1111 Undefined Unspecified Audio Outputs>> %0 Description Data 0000 Set default Ignored 0001 Set PCM Ignored 0002 Set DSD Ignored 0110 Set input format Ignored 0111 Set extended Custom 1111 Undefined Unspecified Rate Selection>> Set rate: %0 Description 0000-1111 Set rate NibbleOne %1 Description 0000-1111 Set rate NibbleTwo %2 Description 0000-1111 Set rate NibbleThree Set rate extended: %0 Description 0000-1111 Set rate NibbleFour %1 Description 0000-1111 Set rate NibbleFive %2 Description 0000-1111 Set rate NibbleSix Frequency Selection>> Set frequency: %0 Description 0000-1111 Set frequency NibbleOne %1 Description 0000-1111 Set frequency NibbleTwo %2 Description 0000-1111 Set frequency NibbleThree Set frequency extended: %0 Description 0000-1111 Set frequency NibbleFour %1 Description 0000-1111 Set frequency NibbleFive %2 Description 0000-1111 Set frequency NibbleSix Error Correction>> Set extended: %0 Descriptioni Data 0000 Use default Ignored 0001 Use parity See USE PARITY below 0010 Use CRC See USE CRC below 0011 Use CRC extended See USE CRC below 1111 Undefined Unspecified Use parity: %0 Description Data 0000-1111 Set parity Parity type (see below) %1 Description 0000 Use default 0001 Set even parity 0110 Set odd parity 1111 Unset parity Use CRC: %0 Description 0000-1111 Set CRC NibbleOne %1 Description 0000-1111 Set CRC NibbleTwo Use CRC extended: %0 Description 0000-1111 Set CRC NibbleThree %1 Description 0000-1111 Set CRC NibbleFour Data Transmission>> Data: %0 %1 %2 Description 0000-1111 0000-1111 0000-1111 Data fields Padding>> %0 Description Data 0000 Use default Ignored 0001 Disable padding Ignored 0002 Pad to size See PAD TO SIZE below 1111 Undefined Unspecified Pad to size: %0 %1 Description 0000-1111 0000-1111 Pad to size Channels>> %0 Description Data 0000 Use default Ignored 0001 Use channels See USE CHANNELS below 0002 Set channel See SET CHANNEL below 1111 Undefined Unspecified Use channels: %0 %1 Description 0000-1111 0000-1111 Use channels Set channel: %0 %1 Description 0000-1111 0000-1111 Set channel [General Overview] This document describes a method to transmit digital audio data over a serial, full-duplex interface. It is not intended to be hot-pluggable on the software end; rather, the following steps for attachment are STRONGLY RECOMMENDED: 1) Shut down the software interface on both ends, if running. 2) Connect the transmitting device to the receiving device using the appropriate interface. 3) Bring up the software interface on the receiver. 4) Bring up the software interface on the transmitter. In the case of stand-alone devices, instead of controlling the interface software, toggling the power and waiting a few seconds should suffice. [State Machine] Not all is explained here; should be pretty straightforward to figure out. Use 1100 not only to ack, but also to indicate that a setting is acceptable. Same (but in reverse :^) for 1110. #define RE Receiver #define TR Transmitter Receiver>> 1) Reset bit counter; 2) Clear data buffer; 3) Disable error correction; 4) Wait for 0001 from TR; 5) Protocol acceptable? 5a) If true, send 1100 and continue; 5b) If false, send 0111, and wait for 1111. 6) Load default settings; 7) Wait for and process further messages. On 0110: 1) Read one bit of data and store in buffer; 2) Increase bit counter; 3) Bit counter == rate? 3a) If true, output sample, clear buffer, reset bit counter and continue; 3b) If false, continue; 4) Loop to step 1. Transmitter>> 1) Disable error correction; 2) Send 0001 to RE; 3) Protocol accepted? 3a) If true, continue; 3b) If false, issue 1111, wait .8 seconds, and loop to step 1; 4) Transmit error correction settings; 5) Error correction accepted? 5a) If true, intiate error correction; 5b) If false, do the right thing; 6) Transmit other settings; 7) Settings accepted? 7a) If true, continue; 7b) If false, go to step 3b; 8) Transmit sample; 9) Data accepted? 9a) If true, wait for next sample and continue; 9b) If false, try again repeatedly until next sample arrives; 10) Loop to step 8. [Error Correction] A word about error correction. Parity bits are appended to messages (with odd parity going first); if the link in question can't be sensibly addressed bitwise, this is not a recommended option. Messages containing CRC sums are sent prior to the message they apply to. In a really paranoid environment, this allows both options to be turned on. In that case, the CRC is computed /without/ the parity data. The CRC message 'format' consists of the checksum; when properly set, it's length is known. Error correction, once enabled and acknowledged, is applied both upstream and downstream. [Channels] Specifying 1001 0002 will cause any further 0001, 0011, 0100, 0101, and 0110 commands to affect the indicated channel /only/. [Padding] This facility was added to further accomodate non-bit adressable interfaces. The transmitter will pad data for a single, single-channel sample to the indicated size. When set, the extra bits -- if present -- will be ignored by the reciever.