diff --git a/lib_xua/doc/rst/feat.rst b/lib_xua/doc/rst/feat.rst index 54be90ee..0461ce82 100644 --- a/lib_xua/doc/rst/feat.rst +++ b/lib_xua/doc/rst/feat.rst @@ -63,10 +63,12 @@ S/PDIF Transmit ~~~~~~~~~~~~~~~ ``lib_xua`` supports the development of devices with S/PDIF transmit functionality through the use of -``lib_spdif``. The XMOS S/PDIF transmitted runs in a single core and supports rates up to 192kHz. +``lib_spdif``. The XMOS S/PDIF transmitter runs in a single core and supports rates up to 192kHz. The S/PDIF transmitter core takes PCM audio samples via a channel and outputs them -in S/PDIF format to a port. +in S/PDIF format to a port. The channel should be declared a normal:: + + chan c_spdif_tx Samples are provided to the S/PDIF transmitter task from the ``XUA_AudioHub()`` task. @@ -74,6 +76,28 @@ In order to use the S/PDIF transmmiter with ``lib_xua`` hardware resources must buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT; /* SPDIF transmit port */ +This port should be clocked from the master-clock, ``lib_spdif`` provides a helper function for setting up the port:: + + spdif_tx_port_config(p_spdif_tx2, clk_audio_mclk, p_mclk_in, delay); + +.. note:: If sharing the master-clock port and clockblock with ``XUA_AudioHub()`` (or any other task) then this setup + should be done before running the tasks in a par{} + +Finally the S/PDIF transmitter task must be run - passing in the port and channel for communication with ``XUA_AudioHub``. +For example:: + + par + { + while(1) + { + /* Run the S/PDIF transmitter task */ + spdif_tx(p_spdif_tx2, c_spdif_tx); + } + + /* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */ + /* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */ + XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_spdif_tx); + } For further details please see the documentation, application notes and examples provided for ``lib_spdif``.