diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 988249d..65ffdff 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,20 @@ lib_board_support change log ============================ +1.1.1 +----- + + * CHANGED: Documentation improvements + * REMOVED: Dependency of examples on lib_i2s + + * Changes to dependencies: + + - lib_i2c: 6.3.0 -> 6.4.0 + + - lib_sw_pll: 2.3.0 -> 2.3.1 + + - lib_xassert: 4.3.0 -> 4.3.1 + 1.1.0 ----- diff --git a/Jenkinsfile b/Jenkinsfile index 5f5d8a2..584725f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,21 +2,31 @@ @Library('xmos_jenkins_shared_library@v0.34.0') _ -getApproval() +def archiveLib(String repoName) { + sh "git -C ${repoName} clean -xdf" + sh "zip ${repoName}_sw.zip -r ${repoName}" + archiveArtifacts artifacts: "${repoName}_sw.zip", allowEmptyArchive: false +} +def checkout_shallow() +{ + checkout scm: [ + $class: 'GitSCM', + branches: scm.branches, + userRemoteConfigs: scm.userRemoteConfigs, + extensions: [[$class: 'CloneOption', depth: 1, shallow: true, noTags: false]] + ] +} +getApproval() pipeline { agent none options { - disableConcurrentBuilds() + buildDiscarder(xmosDiscardBuildSettings()) skipDefaultCheckout() timestamps() - // on develop discard builds after a certain number else keep forever - buildDiscarder(logRotator( - numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '', - artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '' - )) } + parameters { string( name: 'TOOLS_VERSION', @@ -25,47 +35,53 @@ pipeline { ) string( name: 'XMOSDOC_VERSION', - defaultValue: '6.1.2', + defaultValue: 'v6.1.3', description: 'The xmosdoc version' ) + string( + name: 'INFR_APPS_VERSION', + defaultValue: 'v2.0.1', + description: 'The infr_apps version' + ) } environment { REPO = 'lib_board_support' PYTHON_VERSION = "3.12.1" - VENV_DIRNAME = ".venv" } stages { stage('Build and tests') { agent { - label 'linux&&64' + label 'documentation && linux && x86_64' } stages{ stage('Checkout'){ steps { println "Stage running on: ${env.NODE_NAME}" dir("${REPO}") { - checkout scm + checkout_shallow() createVenv() withTools(params.TOOLS_VERSION) { dir("examples") { - sh "cmake -G \"Unix Makefiles\" -B build" + sh 'cmake -G "Unix Makefiles" -B build -DDEPS_CLONE_SHALLOW=TRUE' } } } // dir } // steps - } + } // stage('Checkout') stage('Library checks') { steps { - runLibraryChecks("${WORKSPACE}/${REPO}", "v2.0.1") + warnError("lib checks") { + runLibraryChecks("${WORKSPACE}/${REPO}", "${params.INFR_APPS_VERSION}") + } } // steps - } // Library checks + } // stage('Library checks') stage('Build examples'){ steps { dir("${REPO}/examples") { withVenv { withTools(params.TOOLS_VERSION) { - sh "cmake -G \"Unix Makefiles\" -B build" + sh 'cmake -G "Unix Makefiles" -B build -DDEPS_CLONE_SHALLOW=TRUE' archiveArtifacts artifacts: "build/manifest.txt", allowEmptyArchive: false sh "xmake -C build -j 16" archiveArtifacts artifacts: "**/*.xe", allowEmptyArchive: false @@ -74,7 +90,7 @@ pipeline { } } } - } + } // stage('Build examples') stage('Test'){ steps { dir("${REPO}") { @@ -85,19 +101,21 @@ pipeline { } } } - } + } // stage('Test') stage('Documentation') { steps { dir("${REPO}") { - withVenv { - sh "pip install git+ssh://git@github.com/xmos/xmosdoc@v${params.XMOSDOC_VERSION}" - sh 'xmosdoc' - zip zipFile: "${REPO}_docs.zip", archive: true, dir: 'doc/_build' - } // withVenv + warnError("Docs") { + buildDocs() + } // warnError("Docs") } // dir } // steps - } // Documentation - + } // stage('Documentation') + stage("Archive Lib") { + steps { + archiveLib(REPO) + } + } //stage("Archive Lib") } post { always{ diff --git a/README.rst b/README.rst index 13ddd60..3b75c70 100644 --- a/README.rst +++ b/README.rst @@ -1,57 +1,70 @@ :orphan: -################# -lib_board_support -################# +##################################### +lib_board_support: XMOS board support +##################################### :vendor: XMOS -:version: 1.0.1 +:version: 1.1.1 :scope: General Use :description: Support library for XMOS development kits :category: General Purpose :keywords: I2C :devices: xcore.ai, xcore-200 +******* Summary ******* ``lib_board_support`` contains board specific hardware configuration code for various `XMOS` evaluation and development kits. +******** Features ******** - * Support for the following boards: - * ``XK_EVK_XU316`` - * ``XK_AUDIO_316_MC`` - * ``XK_AUDIO_216_MC`` - * Simple examples to demonstrating usage from both `XC` and `C`. + * Support for the following boards: + * ``XK_EVK_XU316`` + * ``XK_AUDIO_316_MC`` + * ``XK_AUDIO_216_MC`` + * Simple examples to demonstrating usage from both `XC` and `C`. -Known Issues ************ +Known issues +************ + + * None + +**************** +Development repo +**************** - * None + * `lib_board_support `_ -Required Tools +************** +Required tools ************** - * XMOS XTC Tools: 15.3.0 + * XMOS XTC Tools: 15.3.0 -Required Libraries (dependencies) +********************************* +Required libraries (dependencies) ********************************* - * lib_i2c (www.github.com/xmos/lib_i2c) - * lib_sw_pll (www.github.com/xmos/lib_sw_pll) - * lib_xassert (www.github.com/xmos/lib_xassert) + * `lib_i2c `_ + * `lib_sw_pll `_ + * `lib_xassert `_ -Related Application Notes +************************* +Related application notes ************************* The following application notes use this library: - * `AN02003: SPDIF/ADAT/I²S Receive to I²S Slave Bridge with ASRC `_ - * `AN02016: Integrating Audio Weaver (AWE) Core into USB Audio `_ + * `AN02003: SPDIF/ADAT/I²S Receive to I²S Slave Bridge with ASRC `_ + * `AN02016: Integrating Audio Weaver (AWE) Core into USB Audio `_ +******* Support ******* diff --git a/doc/Doxyfile.inc b/doc/Doxyfile.inc index befb23f..60f9a34 100644 --- a/doc/Doxyfile.inc +++ b/doc/Doxyfile.inc @@ -1,7 +1,7 @@ # This file provides overrides to the Doxyfile configuration PROJECT_NAME = lib_board_support -PROJECT_BRIEF = "Board specific hardware configuration code for various XMOS evaluation and development kits" +PROJECT_BRIEF = "XMOS board support" INPUT = ../lib_board_support/api/boards ../lib_board_support/api/boards/xk_evk_xu316 ../lib_board_support/api/boards/xk_audio_316_mc_ab ../lib_board_support/api/boards/xk_audio_216_mc_ab diff --git a/doc/rst/lib_board_support.rst b/doc/rst/lib_board_support.rst index ac280d5..0ad070b 100644 --- a/doc/rst/lib_board_support.rst +++ b/doc/rst/lib_board_support.rst @@ -61,12 +61,12 @@ the relevant header file. For example:: From then onwards the code may call the relevant API functions to setup and configure the board hardware. Examples are provided in the `examples` directory of this repo. -Note that in some cases, the `xcore` tile that calls the configuration function (usually from |I2S| -initialisation) is different from the tile where |I2C| master is placed. Since |I2C| master is +Note that in some cases, the `xcore` tile that calls the configuration function (usually from I²S +initialisation) is different from the tile where I²C master is placed. Since I²C master is required by most audio CODECs for configuration and `xcore` tiles can only communicate with each -other via channels, a remote server is needed to provide the |I2C| setup. This usually takes the -form of a task which is run on a thread placed on the |I2C| tile and is controlled via a channel -from the other tile where |I2S| resides. The cross-tile channel must be declared at the top-level +other via channels, a remote server is needed to provide the I²C setup. This usually takes the +form of a task which is run on a thread placed on the I²C tile and is controlled via a channel +from the other tile where I²S resides. The cross-tile channel must be declared at the top-level XC main function. The included examples provide a reference for this using both XC and C. ******************************** @@ -133,31 +133,20 @@ application where the hardware setup is called from C. These applications run on the `XK-EVK-XU316` and `XK-AUDIO-316-MC` boards respectively. -They show how to use the cross-tile communications in conjunction with the |I2C| master server. -The applications only setup the hardware and then exit the |I2C| server. +They show how to use the cross-tile communications in conjunction with the I²C master server. +The applications only setup the hardware and then exit the I²C server. XC Usage Example ================ -A more sophisticated example is also provided, written in XC, by `app_xk_audio_316_mc_loopback`. +The application `app_xk_audio_316_mc_simple_xc` demonstrates calling the hardware setup API from C. +It runs on the `XK-AUDIO-316-MC` board. -This application sets up the hardware on the `XK-AUDIO-316-MC` board and then runs an |I2S| -loopback application to take samples from the on-board ADCs and send the signals out through the -DACs. It keeps the |I2C| master server running in case the application wants to change sample rate -which requires |I2C| configuration of the audio CODECs. +Building and running +==================== +To build and run an example, run the following from an XTC tools terminal to configure the build:: -Two build configurations are included: - - - `XMOS_MASTER` - This configures the ADCs and DACs to |I2S| slave and the xcore.ai device - drives the |I2S| clocks. The on-chip application PLL is configured to drive the master clock - to the mixed signal devices. - - `XMOS_SLAVE` - This configures one the DACs to |I2S| master and the remaining DAC, all ADCs - and the `xcore.ai` device to |I2S| slave. The on-chip application PLL is configured to drive - the master clock to the mixed signal devices. - -To build and run the example, run the following from an XTC tools terminal to configure the build:: - - cd examples/app_xk_audio_316_mc_loopback + cd examples/ cmake -G "Unix Makefiles" -B build Any missing dependencies will be downloaded by the build system at this point. @@ -168,12 +157,13 @@ The application binaries can be built using ``xmake``:: To run the application use the following command:: - xrun bin/XMOS_MASTER/app_xk_audio_316_mc_loopback_XMOS_MASTER.xe + xrun --io bin/.xe -or:: +For example:: - xrun bin/XMOS_SLAVE/app_xk_audio_316_mc_loopback_XMOS_SLAVE.xe + cd examples/app_xk_audio_316_mc_simple_xc + cmake -G "Unix Makefiles" -B build + xmake -C build + xrun --io bin/app_xk_audio_316_mc_simple_xc.xe -Connect an analog audio source to the chosen ADC input channels and then monitor the looped back -output on the chosen DAC output channels. diff --git a/doc/rst/xk_audio_216_mc_ab/hw_216_mc.rst b/doc/rst/xk_audio_216_mc_ab/hw_216_mc.rst index 653107a..9b1ddc2 100644 --- a/doc/rst/xk_audio_216_mc_ab/hw_216_mc.rst +++ b/doc/rst/xk_audio_216_mc_ab/hw_216_mc.rst @@ -3,7 +3,7 @@ .. _usb_audio_sec_hw_216_mc: xcore-200 Multi-Channel Audio Board ------------------------------------ +==================================== `The XMOS xcore-200 Multi-channel Audio board `_ (XK-AUDIO-216-MC) is a complete hardware and reference software platform targeted at up to 32-channel USB and networked audio applications, such as DJ decks and mixers. @@ -17,26 +17,26 @@ simultaneously - at up to 192kHz. For full details regarding the hardware please refer to `xcore-200 Multichannel Audio Platform Hardware Manual `_. Analogue Input & Output -+++++++++++++++++++++++ +----------------------- A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. Each is fed into a CirrusLogic CS5368 ADC. Similarly a total of eight single-ended analog output channels are provided. Each is fed into a CirrusLogic CS4384 DAC. -The four digital |I2S|/TDM input and output channels are mapped to the `xcore` input/outputs through a header array. This jumper allows channel selection when the ADC/DAC is used in TDM mode +The four digital I²S/TDM input and output channels are mapped to the `xcore` input/outputs through a header array. This jumper allows channel selection when the ADC/DAC is used in TDM mode Digital Input & Output -++++++++++++++++++++++ +---------------------- Optical and coaxial digital audio transmitters are used to provide digital audio input output in formats such as IEC60958 consumer mode (S/PDIF) and ADAT. The output data streams from the `xcore-200` are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops. MIDI -++++ +---- MIDI I/O is provided on the board via standard 5-pin DIN connectors. The signals are buffered using 5V line drivers and are then connected to 1-bit ports on the `xcore-200`, via a 5V to 3.3V buffer. Audio Clocking -++++++++++++++ +-------------- A flexible clocking scheme is provided for both audio and other system services. In order to accommodate a multitude of clocking options, the low-jitter master clock is generated locally using a frequency multiplier PLL chip. The chip used is a Phaselink PL611-01, which is pre-programmed to provide a 24MHz clock from its CLK0 output, and either 24.576 MHz or 22.5792MHz from its CLK1 output. @@ -45,7 +45,7 @@ The 24MHz fixed output is provided to the `xcore-200` device as the main process Either the locally generated clock (from the PL611) or the recovered low jitter clock (from the CS2100) may be selected to clock the audio stages; the `xcore-200`, the ADC/DAC and Digital output stages. Selection is controlled via an additional I/O, bit 5 of PORT 8C. LEDs, Buttons and Other IO -++++++++++++++++++++++++++ +-------------------------- An array of 4*4 green LEDs, 3 buttons and a switch are provided for general purpose user interfacing. The LED array is driven by eight signals each controlling one of 4 rows and 4 columns. diff --git a/doc/rst/xk_audio_316_mc_ab/hw_316_mc.rst b/doc/rst/xk_audio_316_mc_ab/hw_316_mc.rst index f7bfee9..1096aac 100644 --- a/doc/rst/xk_audio_316_mc_ab/hw_316_mc.rst +++ b/doc/rst/xk_audio_316_mc_ab/hw_316_mc.rst @@ -2,7 +2,7 @@ .. _usb_audio_sec_hw_316_mc: xcore.ai Multi-Channel Audio Board -................................... +================================== The `XMOS xcore.ai Multichannel Audio Board` (XK-AUDIO-316-MC) is a complete hardware and software reference platform targeted at up to 32-channel USB audio applications, such as DJ decks, mixers and other musical instrument interfaces. The board can also be used to prototype products with reduced feature sets or HiFi style products. @@ -15,7 +15,7 @@ For full details regarding the hardware please refer to `xcore.ai Multichannel A |newpage| Hardware Features -+++++++++++++++++ +----------------- The location of the various features of the `xcore.ai Multichannel Audio Board` (XK-AUDIO-316-MC) is shown in :numref:`xk_audio_316_mc_block_diagram`. @@ -51,9 +51,9 @@ It includes the following features: - M: 3 general purpose buttons -- O: Flexible |I2S|/TDM input data routing +- O: Flexible I²S/TDM input data routing -- P: Flexible |I2S|/TDM output data routing +- P: Flexible I²S/TDM output data routing - Q: Integrated power supply @@ -65,24 +65,24 @@ It includes the following features: Analogue Input & Output -+++++++++++++++++++++++ +----------------------- A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. These inputs feed into a pair of quad-channel PCM1865 ADCs from Texas Instruments. A total of eight single-ended analog output channels are provided. These are fed from four PCM5122 stereo DAC's from Texas instruments. -All ADC's and DAC's are configured via an |I2C| bus. Due to an clash of device addresses a |I2C| multiplexor is used. +All ADC's and DAC's are configured via an I²C bus. Due to an clash of device addresses a I²C multiplexor is used. -The four digital |I2S|/TDM input and output channels are mapped to the xCORE input/outputs through a header array. These jumpers allow channel selection when the ADCs/DACs are used in TDM mode. +The four digital I²S/TDM input and output channels are mapped to the xCORE input/outputs through a header array. These jumpers allow channel selection when the ADCs/DACs are used in TDM mode. Digital Input & Output -++++++++++++++++++++++ +---------------------- Optical and coaxial digital audio transmitters are used to provide digital audio input output in formats such as IEC60958 consumer mode (S/PDIF) and ADAT. The output data streams from the `xcore` are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops. MIDI -++++ +---- MIDI input and output is provided on the board via standard 5-pin DIN connectors compliant to the MIDI specification. The signals are buffered using 5V line drivers and are then connected ports on the xCORE, via a 5V to 3.3V buffer. @@ -90,7 +90,7 @@ A 1-bit port is used for receive and a 4-bit port is used for transmit. A pull-u is no MIDI output when the `xcore` device is not actively driving the output. Audio Clocking -++++++++++++++ +-------------- In order to accommodate a multitude of clocking options a flexible clocking scheme is provided for the audio subsystem. @@ -98,7 +98,7 @@ Three methods of generating an audio master clock are provided on the board: * A Cirrus Logic CS2100-CP PLL device. The CS2100 features both a clock generator and clock multiplier/jitter reduced clock frequency synthesizer (clean up) and can generate a low jitter audio clock based on a synchronisation signal provided by the `xcore` - * A Skyworks Si5351B PLL device. The Si5351 is an |I2C| configurable clock generator that is suited for replacing crystals, crystal oscillators, VCXOs, phase-locked loops (PLLs), and fanout buffers. + * A Skyworks Si5351B PLL device. The Si5351 is an I²C configurable clock generator that is suited for replacing crystals, crystal oscillators, VCXOs, phase-locked loops (PLLs), and fanout buffers. * `xcore.ai` devices are equipped with a secondary (or `application`) PLL which can be used to generate audio clocks. @@ -111,7 +111,7 @@ Selecting between these methods is done via writing to bits 6 and 7 of PORT 8D o .. _hw_316_ctrlport: Control I/O -+++++++++++ +----------- 4 bits of PORT 8C are used to control external hardware on the board. This is described in :ref:`table_316_ctrlport`. @@ -141,7 +141,7 @@ Control I/O LEDs, Buttons and Other IO -++++++++++++++++++++++++++ +-------------------------- All programmable I/O on the board is configured for 3.3 volts. @@ -157,7 +157,7 @@ All spare I/O is brought out and made available on 0.1" headers for easy connect boards etc. Power -+++++ +----- The board is capable of acting as a USB2.0 self or bus powered device. If bus powered, the board takes power from the ``USB DEVICE`` connector (micro-B receptacle). If self powered, board takes power @@ -170,7 +170,7 @@ A power source select jumper (marked ``PWR SRC``) is used to select between bus To remain USB compliant the software should be properly configured for bus vs self powered operation Debug -+++++ +----- For convenience the board includes an on-board xTAG4 for debugging via JTAG/xSCOPE. This is accessed via the USB (micro-B) receptacle marked ``DEBUG``. diff --git a/doc/rst/xk_evk_xu316/hw_evk_xu316.rst b/doc/rst/xk_evk_xu316/hw_evk_xu316.rst index 5075dea..6e4f0e3 100644 --- a/doc/rst/xk_evk_xu316/hw_evk_xu316.rst +++ b/doc/rst/xk_evk_xu316/hw_evk_xu316.rst @@ -1,5 +1,5 @@ xcore.ai Evaluation Kit -....................... +======================= The `XMOS xcore.ai Evaluation Kit` (XK-EVK-XU316) is an evaluation board for the `xcore.ai` multi-core microcontroller from `XMOS`. @@ -36,20 +36,20 @@ For full details regarding the hardware please refer to `XK-EVK-XU316 xcore.ai E an "example" rather than a fully fledged reference design. Analogue Audio Input & Output -+++++++++++++++++++++++++++++ +----------------------------- -A stereo CODEC (TLV320AIC3204), connected to the xcore.ai device via an |I2S| interface, provides analogue input/output +A stereo CODEC (TLV320AIC3204), connected to the xcore.ai device via an I²S interface, provides analogue input/output functionality at line level. -The audio CODEC is are configured by the `xcore.ai` device via an |I2C| bus. +The audio CODEC is are configured by the `xcore.ai` device via an I²C bus. Audio Clocking -++++++++++++++ +-------------- `xcore.ai` devices are equipped with a secondary (or `application`) PLL which is used to generate the audio clocks for the CODEC. LEDs, Buttons and Other IO -++++++++++++++++++++++++++ +-------------------------- Four green LED's and two push buttons are provided for general purpose user interfacing. @@ -59,7 +59,7 @@ All spare I/O is brought out and made available on 0.1" headers for easy connect boards etc. Power -+++++ +----- The XK-EVK-XU316 requires a 5V power source that is normally provided through the micro-USB cable J3. The voltage is converted by on-board regulators to the 0V9, 1V8 and 3V3 supplies used by the components. @@ -68,7 +68,7 @@ The board should therefore be configured to present itself as a bus powered devi active USB host. Debug -+++++ +----- For convenience the board includes an on-board xTAG4 for debugging via JTAG/xSCOPE. This is accessed via the USB (micro-B) receptacle marked ``DEBUG``. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index f7d33b1..e5523a5 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.21) include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) project(lib_board_support) -add_subdirectory(app_xk_316_audio_mc_loopback) +add_subdirectory(app_xk_audio_316_mc_simple_xc) add_subdirectory(app_evk_316_simple_c) add_subdirectory(app_xk_audio_316_mc_simple_c) diff --git a/examples/app_xk_316_audio_mc_loopback/src/main.xc b/examples/app_xk_316_audio_mc_loopback/src/main.xc deleted file mode 100644 index 3e99ec1..0000000 --- a/examples/app_xk_316_audio_mc_loopback/src/main.xc +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2024 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. - -#include -#include -#include "i2s.h" -#include "xk_audio_316_mc_ab/board.h" - -#ifndef XMOS_I2S_MASTER -#define XMOS_I2S_MASTER 1 -#endif -#define SAMPLE_FREQUENCY 48000 -#define MASTER_CLOCK_FREQUENCY 24576000 -#define DATA_BITS 32 -#define CHANS_PER_FRAME 2 -#define NUM_I2S_LINES 4 - -// I2S resources -on tile[1]: in port p_mclk = PORT_MCLK_IN; -#if XMOS_I2S_MASTER -on tile[1]: buffered out port:32 p_lrclk = PORT_I2S_LRCLK; -on tile[1]: out port p_bclk = PORT_I2S_BCLK; -#else -on tile[1]: buffered in port:32 p_lrclk = PORT_I2S_LRCLK; -on tile[1]: in port p_bclk = PORT_I2S_BCLK; -#endif -on tile[1]: buffered out port:32 p_dac[NUM_I2S_LINES] = {PORT_I2S_DAC0, PORT_I2S_DAC1, PORT_I2S_DAC2, PORT_I2S_DAC3}; -on tile[1]: buffered in port:32 p_adc[NUM_I2S_LINES] = {PORT_I2S_ADC0 ,PORT_I2S_ADC1, PORT_I2S_ADC2, PORT_I2S_ADC3}; -on tile[1]: clock bclk = XS1_CLKBLK_1; - - -// Board configuration from lib_board_support -static const xk_audio_316_mc_ab_config_t hw_config = { - CLK_FIXED, // clk_mode. Drive a fixed MCLK output - !XMOS_I2S_MASTER, // 1 = dac_is_clock_master - MASTER_CLOCK_FREQUENCY, - 0, // pll_sync_freq (unused when driving fixed clock) - AUD_316_PCM_FORMAT_I2S, - DATA_BITS, - CHANS_PER_FRAME -}; - -[[distributable]] -void i2s_loopback(server i2s_frame_callback_if i_i2s, client i2c_master_if i_i2c) -{ - int32_t samples[NUM_I2S_LINES * CHANS_PER_FRAME] = {0}; // Array used for looping back samples - // Config can be done remotely via i_i2c - xk_audio_316_mc_ab_AudioHwInit(i_i2c, hw_config); - - while (1) { - select { - case i_i2s.init(i2s_config_t &?i2s_config, tdm_config_t &?tdm_config): - i2s_config.mode = I2S_MODE_I2S; - i2s_config.mclk_bclk_ratio = (MASTER_CLOCK_FREQUENCY / (SAMPLE_FREQUENCY * CHANS_PER_FRAME * DATA_BITS)); - xk_audio_316_mc_ab_AudioHwConfig(i_i2c, hw_config, SAMPLE_FREQUENCY, MASTER_CLOCK_FREQUENCY, 0, DATA_BITS, DATA_BITS); - break; - - case i_i2s.receive(size_t n_chans, int32_t in_samps[n_chans]): - for (int i = 0; i < n_chans; i++){ - samples[i] = in_samps[i]; // copy samples - } - break; - - case i_i2s.send(size_t n_chans, int32_t out_samps[n_chans]): - for (int i = 0; i < n_chans; i++){ - out_samps[i] = samples[i]; // copy samples - } - break; - - case i_i2s.restart_check() -> i2s_restart_t restart: - restart = I2S_NO_RESTART; // Keep on looping - break; - } - } -} - - -int main(void) -{ - interface i2c_master_if i_i2c[1]; // Cross tile interface - - par { - on tile[0]: { - xk_audio_316_mc_ab_board_setup(hw_config); // Setup must be done on tile[0] - xk_audio_316_mc_ab_i2c_master(i_i2c); // Run I2C master server task to allow control from tile[1] - } - - on tile[1]: { - interface i2s_frame_callback_if i_i2s; - - par { - // The application - loopback the I2S samples - note callbacks are inlined so does not take a thread - [[distribute]] i2s_loopback(i_i2s, i_i2c[0]); -#if XMOS_I2S_MASTER - i2s_frame_master(i_i2s, p_dac, NUM_I2S_LINES, p_adc, NUM_I2S_LINES, DATA_BITS, p_bclk, p_lrclk, p_mclk, bclk); -#else - i2s_frame_slave(i_i2s, p_dac, NUM_I2S_LINES, p_adc, NUM_I2S_LINES, DATA_BITS, p_bclk, p_lrclk, bclk); -#endif - } - } - } - return 0; -} diff --git a/examples/app_xk_audio_316_mc_simple_c/CMakeLists.txt b/examples/app_xk_audio_316_mc_simple_c/CMakeLists.txt index 177f554..bf2bb13 100644 --- a/examples/app_xk_audio_316_mc_simple_c/CMakeLists.txt +++ b/examples/app_xk_audio_316_mc_simple_c/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.21) include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) -project(app_xu316_mc_simple_c) +project(app_xk_audio_316_mc_simple_c) set(APP_HW_TARGET xk-audio-316-mc.xn) diff --git a/examples/app_xk_316_audio_mc_loopback/CMakeLists.txt b/examples/app_xk_audio_316_mc_simple_xc/CMakeLists.txt similarity index 57% rename from examples/app_xk_316_audio_mc_loopback/CMakeLists.txt rename to examples/app_xk_audio_316_mc_simple_xc/CMakeLists.txt index 54af051..22b21c1 100644 --- a/examples/app_xk_316_audio_mc_loopback/CMakeLists.txt +++ b/examples/app_xk_audio_316_mc_simple_xc/CMakeLists.txt @@ -1,21 +1,16 @@ cmake_minimum_required(VERSION 3.21) include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) -project(app_xu316_i2s_loopback) +project(app_xk_audio_316_mc_simple_xc) set(APP_HW_TARGET xk-audio-316-mc.xn) include(../deps.cmake) -set(COMPILER_FLAGS_COMMON -Os +set(APP_COMPILER_FLAGS -Os -g -report -DBOARD_SUPPORT_BOARD=XK_AUDIO_316_MC_AB) -set(APP_COMPILER_FLAGS_XMOS_MASTER ${COMPILER_FLAGS_COMMON} - -DXMOS_I2S_MASTER=1) - -set(APP_COMPILER_FLAGS_XMOS_SLAVE ${COMPILER_FLAGS_COMMON} - -DXMOS_I2S_MASTER=0) set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) diff --git a/examples/app_xk_audio_316_mc_simple_xc/src/main.xc b/examples/app_xk_audio_316_mc_simple_xc/src/main.xc new file mode 100644 index 0000000..8c805b8 --- /dev/null +++ b/examples/app_xk_audio_316_mc_simple_xc/src/main.xc @@ -0,0 +1,42 @@ +// Copyright 2024 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#include +#include +#include +#include "xk_audio_316_mc_ab/board.h" + + +// Board configuration from lib_board_support +static const xk_audio_316_mc_ab_config_t hw_config = { + CLK_FIXED, // clk_mode. Drive a fixed MCLK output + 0, // 1 = dac_is_clock_master + 24576000, + 0, // pll_sync_freq (unused when driving fixed clock) + AUD_316_PCM_FORMAT_I2S, + 32, + 2 +}; + +int main(void) +{ + interface i2c_master_if i_i2c[1]; // Cross tile interface + + par { + on tile[0]: { + printf("Hello from tile[0]\n"); + xk_audio_316_mc_ab_board_setup(hw_config); // Setup must be done on tile[0] + xk_audio_316_mc_ab_i2c_master(i_i2c); // Run I2C master server task to allow control from tile[1] + printf("Bye from tile[0]\n"); + } + + on tile[1]: { + printf("Hello from tile[1]\n"); + xk_audio_316_mc_ab_AudioHwInit(i_i2c[0], hw_config); + xk_audio_316_mc_ab_AudioHwConfig(i_i2c[0], hw_config, 48000, hw_config.default_mclk, 0, 24, 24); + xk_audio_316_mc_ab_i2c_master_exit(i_i2c[0]); // Quit the I2C master on tile[0] + printf("Bye from tile[1]\n"); + } + } + return 0; +} diff --git a/examples/app_xk_316_audio_mc_loopback/src/xk-audio-316-mc.xn b/examples/app_xk_audio_316_mc_simple_xc/src/xk-audio-316-mc.xn similarity index 100% rename from examples/app_xk_316_audio_mc_loopback/src/xk-audio-316-mc.xn rename to examples/app_xk_audio_316_mc_simple_xc/src/xk-audio-316-mc.xn diff --git a/examples/deps.cmake b/examples/deps.cmake index 4ba0677..4afc023 100644 --- a/examples/deps.cmake +++ b/examples/deps.cmake @@ -1,3 +1,2 @@ set(APP_DEPENDENT_MODULES "lib_board_support" - "lib_i2s(5.1.0)" - ) \ No newline at end of file + ) diff --git a/lib_board_support/lib_build_info.cmake b/lib_board_support/lib_build_info.cmake index 6024318..9da67d3 100644 --- a/lib_board_support/lib_build_info.cmake +++ b/lib_board_support/lib_build_info.cmake @@ -1,8 +1,9 @@ set(LIB_NAME lib_board_support) -set(LIB_VERSION 1.1.0) +set(LIB_VERSION 1.1.1) set(LIB_INCLUDES api/boards api/drivers) set(LIB_COMPILER_FLAGS -Os -g) -set(LIB_DEPENDENT_MODULES "lib_i2c(6.3.0)" - "lib_sw_pll(2.3.0)") +set(LIB_DEPENDENT_MODULES "lib_i2c(6.4.0)" + "lib_sw_pll(2.3.1)" + "lib_xassert(4.3.1)") XMOS_REGISTER_MODULE() diff --git a/lib_board_support/module_build_info b/lib_board_support/module_build_info index 23cecd1..8a4ade3 100644 --- a/lib_board_support/module_build_info +++ b/lib_board_support/module_build_info @@ -1,7 +1,8 @@ -VERSION = 1.1.0 +VERSION = 1.1.1 -DEPENDENT_MODULES = lib_i2c(>=6.3.0) - lib_sw_pll(>=2.3.0) +DEPENDENT_MODULES = lib_i2c(>=6.4.0) + lib_sw_pll(>=2.3.1) + lib_xassert(>=4.3.1) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -Os -g diff --git a/settings.yml b/settings.yml index 779d4d7..ebac394 100644 --- a/settings.yml +++ b/settings.yml @@ -2,8 +2,8 @@ lib_name: lib_board_support project: '{{lib_name}}' -title: '{{lib_name}}: XMOS Board Support' -version: 1.1.0 +title: '{{lib_name}}: XMOS board support' +version: 1.1.1 documentation: exclude_patterns_path: doc/exclude_patterns.inc