Skip to content

Commit

Permalink
Further TDM doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-xmos committed Oct 4, 2023
1 parent 2e6683b commit 28682cf
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 74 deletions.
12 changes: 5 additions & 7 deletions doc/programming_guide/reference/i2s/i2s.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
|I2S| Library
#############

A software defined library that allows you to control an |I2S| (Inter-IC Sound) bus via xcore ports. |I2S| is a digital data streaming interfaces particularly appropriate for transmission of audio data. TDM is a special case of |I2S| which supports transport of more than two audio channels and is partially included in the library. The components in the library are controlled via C and can either act as |I2S| master, |I2S| slave or TDM slave.
A software defined library that allows you to control an |I2S| (Inter-IC Sound) bus via xcore ports. |I2S| is a digital data streaming interfaces particularly appropriate for transmission of audio data. TDM is a special case of |I2S| which supports transport of more than two audio channels and is partially included in the library at this time. The components in the library are controlled via C and can either act as |I2S| master, |I2S| slave or TDM slave.

.. note::

TDM is only currently supported as a TDM16 slave Tx component. Expansion of this library to support master or slave Rx is possible and can be done on request.

|I2S| is a protocol between two devices where one is the *master* and one is the *slave* which determines which side drives the clock lines. The protocol is made up of four signals shown
in :ref:`i2s_wire_table`.
|I2S| is a protocol between two devices where one is the *master* and one is the *slave* which determines who drives the clock lines. The protocol is made up of four signals shown in :ref:`i2s_wire_table`.

.. _i2s_wire_table:

Expand All @@ -36,8 +35,7 @@ All |I2S| functions can be accessed via the ``i2s.h`` header:
#include <i2s.h>
TDM is a protocol between two devices similar where one is the *master* and one is the *slave* which determines which side drives the clock lines. The protocol is made up of four signals shown
in :ref:`tdm_wire_table`.
TDM is a protocol between two devices similar to |I2S| where one is the *master* and one is the *slave* which determines who drives the clock lines. The protocol is made up of four signals shown in :ref:`tdm_wire_table`.

.. _tdm_wire_table:

Expand All @@ -50,7 +48,7 @@ in :ref:`tdm_wire_table`.
- Bit clock. This is a fixed divide of the *MCLK* and is driven
by the master.
* - *FSYCNH*
- Frame synchronisation. Toggles at the start of the TDM data frame. This is driven by the master.
- Frame synchronization. Toggles at the start of the TDM data frame. This is driven by the master.
* - *DATA*
- Data line, driven by one of the slave or master depending on
the data direction. There may be several data lines in
Expand All @@ -76,4 +74,4 @@ Currently supported TDM functions can be accessed via the ``i2s_tdm_slave.h`` he
i2s_common.rst
i2s_master.rst
i2s_slave.rst
tdm_slave.rst
i2s_tdm_slave.rst
7 changes: 6 additions & 1 deletion doc/programming_guide/reference/i2s/i2s_common.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. include:: ../../../substitutions.rst
v.. include:: ../../../substitutions.rst

****************
|I2S| Common API
Expand All @@ -8,3 +8,8 @@ The following structures and functions are used by an |I2S| master or slave inst

.. doxygengroup:: hil_i2s_core
:content-only:

The following structures and functions are used by an TDM master or slave instance.

.. doxygengroup:: hil_i2s_tdm_core
:content-only:
2 changes: 1 addition & 1 deletion doc/programming_guide/reference/i2s/i2s_master.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following code snippet demonstrates the basic usage of an |I2S| master devic
.. code-block:: c
#include <xs1.h>
#include <i2s.h>
#include "i2s.h"
port_t p_i2s_dout[1];
port_t p_bclk;
Expand Down
59 changes: 59 additions & 0 deletions doc/programming_guide/reference/i2s/i2s_tdm_slave.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. include:: ../../../substitutions.rst

*********
TDM Slave
*********

TDM Slave Tx Usage
==================

The following code snippet demonstrates the basic usage of a TDM slave Tx device.

.. code-block:: c
#include <xs1.h>
#include "i2s_tdm_slave.h"
// Setup ports and clocks
port_t p_bclk = XS1_PORT_1A;
port_t p_fsync = XS1_PORT_1B;
port_t p_dout = XS1_PORT_1C;
xclock_t clk_bclk = XS1_CLKBLK_1;
// Setup callbacks
// NOTE: See API or sln_voice examples for more on using the callbacks
i2s_tdm_ctx_t ctx;
i2s_callback_group_t i_i2s = {
.init = (i2s_init_t) i2s_init,
.restart_check = (i2s_restart_check_t) i2s_restart_check,
.receive = NULL,
.send = (i2s_send_t) i2s_send,
.app_data = NULL,
};
// Initialize the TDM slave
i2s_tdm_slave_tx_16_init(
&ctx,
&i_i2s,
p_dout,
p_fsync,
p_bclk,
clk_bclk,
0,
I2S_SLAVE_SAMPLE_ON_BCLK_FALLING,
NULL);
// Start the slave device in this thread
// NOTE: You may wish to launch the slave device in a different thread.
// See the XTC Tools documentation reference for lib_xcore.
i2s_tdm_slave_tx_16_thread(&ctx);
TDM Slave Tx API
================

The following structures and functions are used to initialize and start a TDM slave Tx instance.

.. doxygengroup:: hil_i2s_tdm_slave_tx16
:content-only:

65 changes: 0 additions & 65 deletions doc/programming_guide/reference/i2s/tdm_slave.rst

This file was deleted.

0 comments on commit 28682cf

Please sign in to comment.