30 Commits

Author SHA1 Message Date
Sam Chesney
e0ab8d4346 Merge pull request #92 from larry-xmos/release/0.1.3
XVF3500 maintenance release
2019-08-23 17:37:33 +01:00
Larry Snizek
0eaefc3478 Jenkins release ready for merging 2019-08-23 17:17:21 +01:00
Larry Snizek
dcfe0235ad Unstuck test script 2019-08-23 17:04:31 +01:00
Larry Snizek
58713733a2 Troubleshoot Jenkins release 2019-08-23 16:38:53 +01:00
Larry Snizek
a135b674f7 Troubleshoot Jenkins release 2019-08-23 16:37:20 +01:00
Larry Snizek
43eb63e271 Test Jenkins release on a pull request 2019-08-23 15:56:34 +01:00
Sam Chesney
7d06aa543a Merge pull request #90 from larry-xmos/release/0.1.3
XVF3500 maintenance release
2019-08-23 14:56:04 +01:00
Larry Snizek
235b06f00a Add Jenkins release steps 2019-08-23 14:32:24 +01:00
Sam Chesney
f90022618b Merge pull request #87 from larry-xmos/release/0.1.3
XVF3500 maintenance release
2019-08-23 13:44:57 +01:00
Larry Snizek
5b1132a603 Changelog update 2019-08-23 13:15:23 +01:00
Larry Snizek
2e6ce1e4e1 More documentation build fixes 2019-08-23 13:10:59 +01:00
Larry Snizek
a48ae96f39 AN00246: Remove missing block diagram 2019-08-23 12:39:35 +01:00
Larry Snizek
ebe263605c AN00246: Fix xdoc build 2019-08-23 12:16:52 +01:00
Larry Snizek
502db6ee48 Git ignore of Python virtual environment 2019-08-22 14:43:00 +01:00
Larry Snizek
df8cdd8692 More release checks 2019-08-22 14:21:54 +01:00
Larry Snizek
83b8c727f6 Buggy Git ignore 2019-08-22 14:21:50 +01:00
Larry Snizek
3cbb8282c7 GitFlow-like view name in Jenkins file 2019-08-22 11:57:15 +01:00
Larry Snizek
9cd76b2a4b Satisfy release checks 2019-08-22 11:48:38 +01:00
Larry Snizek
7d1d2af8d2 Draft Jenkins file 2019-08-20 17:59:06 +01:00
Larry Snizek
fa3ccb555b Also update i2s_loopback test to work with 14.4 tools 2019-08-20 17:58:51 +01:00
Larry Snizek
9ea6a3de3c Remove wscript to ensure always xcommon build 2019-08-20 16:49:00 +01:00
Larry Snizek
58eb2fe612 Update AN00246 to API with master clock passed in 2019-08-20 16:41:49 +01:00
Larry Snizek
f4ab2d9b82 Infrastructure files from pull request #84 2019-08-20 15:29:26 +01:00
Larry Snizek
5a1865d9d5 Changelog and version number for 0.1.3 release 2019-08-20 15:26:11 +01:00
Larry Snizek
c59a545197 Copyright notice update 2019-08-20 15:26:11 +01:00
Luciano Martin
232ab79f78 Remove obsolete flag subword-selectt 2019-08-20 15:26:11 +01:00
Luciano Martin
2aab72a817 Remove global variable for p_mclk_in 2019-08-20 15:26:11 +01:00
Larry Snizek
156bf61b62 Empty Jenkins file 2019-08-19 18:00:26 +01:00
Sam Chesney
408d9b7c42 Merge pull request #53 from lucianomartin/fix_buildbot
Add missing copyright
2018-04-10 11:11:53 +01:00
Luciano Martin
a572bf9c5a Add missing copyright 2018-04-09 10:41:54 +01:00
33 changed files with 256 additions and 395 deletions

3
.gitignore vendored
View File

@@ -11,7 +11,8 @@ module_dfu/host/xmosdfu/xmosdfu
*.xi
*.i
*.bin
.*
.build*
*/.venv/*
*~
*.a
*.swp

7
Brewfile Normal file
View File

@@ -0,0 +1,7 @@
tap 'homebrew/core'
brew 'perl'
brew 'cpanm'
brew 'python@2'
brew 'pipenv'

View File

@@ -1,6 +1,14 @@
lib_xua Change Log
==================
0.1.3
-----
* CHANGED: Remove sharing of global master clock port variable for
compatibility with tools 14.4 (API change but preserve 0.1 version as this
is maintenance branch)
* CHANGED: Remove obsolete -fsubword-select to clear warning in tools 14.4
0.1.2
-----
@@ -55,7 +63,7 @@ lib_xua Change Log
Legacy release history
----------------------
======================
(Note: Forked from sc_usb_audio at this point)
@@ -332,7 +340,7 @@ Legacy release history
Legacy release history
----------------------
======================
Please see changelog in sw_usb_audio for changes prior to 6.8.0 release.

123
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,123 @@
@Library('xmos_jenkins_shared_library@develop') _
getApproval()
pipeline {
agent none
environment {
REPO = 'lib_xua'
VIEW = 'lib_xua_release_0_1_3'
}
options {
skipDefaultCheckout()
}
stages {
stage('Basic tests') {
agent {
label 'x86_64&&brew'
}
stages {
stage('Get view') {
steps {
xcorePrepareSandbox("${VIEW}", "${REPO}")
}
}
stage('Library checks') {
steps {
xcoreLibraryChecks("${REPO}")
}
}
stage('Tests') {
steps {
runXmostest("${REPO}", 'tests')
}
}
stage('xCORE builds') {
steps {
dir("${REPO}") {
xcoreAllAppNotesBuild('examples')
dir("${REPO}") {
runXdoc('doc')
}
}
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
stage('Build host apps') {
failFast true
parallel {
stage('Build Linux host app') {
agent {
label 'x86_64&&brew&&linux'
}
steps {
xcorePrepareSandbox("${VIEW}", "${REPO}")
dir("${REPO}/${REPO}/host/xmosdfu") {
sh 'make -f Makefile.Linux64'
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
stage('Build Mac host app') {
agent {
label 'x86_64&&brew&&macOS'
}
steps {
xcorePrepareSandbox("${VIEW}", "${REPO}")
dir("${REPO}/${REPO}/host/xmosdfu") {
sh 'make -f Makefile.OSX64'
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
}
}
stage('Release and update') {
agent {
label 'x86_64&&brew'
}
stages {
stage('Get view') {
steps {
xcorePrepareSandbox("${VIEW}", "${REPO}")
}
}
stage('Release') {
when {
expression {
isReleaseBranchOfOrganisation('xmos')
}
}
steps {
sh "mkdir ${REPO}/empty"
xcoreReleaseToGithub("${WORKSPACE}/${REPO}","${WORKSPACE}/${REPO}/empty")
}
}
stage('Update') {
steps {
updateViewfiles()
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
Software Release License Agreement
Copyright (c) 2011-2018, XMOS, All rights reserved.
Copyright (c) 2011-2019, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.

7
Pipfile Normal file
View File

@@ -0,0 +1,7 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
flake8 = "*"

View File

@@ -5,7 +5,7 @@ USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.
Required software (dependencies)
................................
--------------------------------
* lib_logging
* lib_xud
@@ -13,6 +13,6 @@ Required software (dependencies)
Checking dependent libs
Software version and dependencies
.................................
---------------------------------
.. libdeps::

2
cpanfile Normal file
View File

@@ -0,0 +1,2 @@
requires 'File::Copy::Recursive';
requires 'LWP::Simple'

View File

@@ -1,6 +1,6 @@
Software Release License Agreement
Copyright (c) 2018, XMOS, All rights reserved.
Copyright (c) 2018-2019, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
@@ -132,4 +132,4 @@ This License shall be governed by and construed in accordance with English law a
This License has been entered into on the date stated at the beginning of it.
Schedule
XMOS lib_xua software
XMOS application note AN00246 software

View File

@@ -3,14 +3,14 @@ APP_NAME = app_xua_simple
TARGET = xk-audio-216-mc.xn
# The flags passed to xcc when building the application
XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -fsubword-select -save-temps \
-g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] \
-DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope
XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \
-g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] \
-DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope
# The USED_MODULES variable lists other module used by the application. These
# modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables.
# Modules are expected to be in the directory above the BASE_DIR directory.
USED_MODULES = lib_xua lib_device_control lib_xud module_i2c_shared module_i2c_single_port module_locks
USED_MODULES = lib_xua lib_xud module_i2c_shared module_i2c_single_port
#=============================================================================
# The following part of the Makefile includes the common build infrastructure

View File

@@ -2,7 +2,7 @@
How to use the lib_xua_library
===============================
.. version:: 0.1.0
.. version:: 0.1.3
Summary
-------

View File

@@ -0,0 +1,2 @@
rst/_build
pdf

View File

@@ -1,240 +0,0 @@
.. include:: ../../README.rst
|newpage|
Overview
--------
Introduction
............
The XMOS USB Audio (XUA) library provides an implemention of USB Audio Class 2.0
This application note demonstrates the implementation of a basic USB Audio Device on
the xCORE-200 MC Audio board.
Block diagram
.............
.. figure:: images/block_diagram.*
:width: 80%
Application block diagram
The application uses a single logical core which runs the application and makes
calls to the |I2C| master library functions as required.
How to use lib_xua
------------------
The Makefile
............
To start using the lib_xua, you need to add ``lib_xua`` to your Makefile::
USED_MODULES = .. lib_xua ...
This demo also uses the XMOS USB Device library (``lib_xud``) for low-level USB connectivity.
The Makefile also includes::
USED_MODULES = .. lib_xud ..
``lib_xud`` library requires some flags for correct operation. Firstly the
tile on which ``lib_xud`` will be execute, for example::
XCC_FLAGS = .. -DUSB_TILE=tile[1] ..
Secondly, the architecture of the target device, for example::
XCC_FLAGS = .. -DXUD_SERIES_SUPPORT=XUD_X200_SERIES ..
Includes
........
This application requires the system header that defines XMOS xCORE specific
defines for declaring and initialising hardware:
.. literalinclude:: app_xua_simple.xc
:start-on: include <xs1.h>
:end-before: include "xua.h"
The XUA library functions are defined in ``xua.h``. This header must
be included in your code to use the library.
.. literalinclude:: app_xua_simple.xc
:start-on: include "xua.h"
:end-on: include "xud_device.h"
Allocating hardware resources
.............................
A most basic implementation of a USB Audio device (i.e. simple stereo input and output via I2S)
using ``lib_xua`` requires the follow pins:
- I2S Bit Clock (from xCORE to DAC)
- I2S L/R clock (from xCORE to DAC)
- I2S Data line (from xCORE to DAC)
- I2S Data line (from ADC to xCORE)
- Audio Master clock (from clock source to xCORE)
.. note::
ANOO246 assumes xCORE is I2S bus master
On an xCORE the pins are controlled by ``ports``. The application therefore declares various ``ports``
for this purpose:
.. literalinclude:: app_xua_simple.xc
:start-on: /* Port declaration
:end-on: /* Clock-block
In addition to ``port`` resources two clock-block resources are also required:
.. literalinclude:: app_xua_simple.xc
:start-on: /* Clock-block
:end-on: /* clock clk_audio_mclk
Other declarations
..................
``lib_xua`` currently requires the manual declaration of tables for the endpoint types for
``lib_xud`` and the calling the main XUD funtion in a par (``XUD_Main()``).
For a simple application the following endpoints are required:
- ``Control`` enpoint zero
- ``Isochonous`` endpoint for each direction for audio data to/from the USB host
These are declared as follows:
.. literalinclude:: app_xua_simple.xc
:start-on: /* Endpoint type tables
:end-on: /* XUD_EpType epTypeTableIn
The application main() function
...............................
The ``main()`` function sets up the tasks in the application.
Various channels are required in order to allow the required tasks to communcate.
These must be declared":
.. literalinclude:: app_xua_simple.xc
:start-on: /* Channels for lib_xud
:end-on: /* chan c_aud_ctl
The rest of the ``main()`` function starts all the tasks in parallel
using the xC ``par`` construct:
.. literalinclude:: app_xua_simple.xc
:start-on: par
:end-before: return 0
This code starts the low-level USB task, an Endpoint 0 task, an Audio buffering task and a task to handle
the audio I/O (i.e. I2S signalling).
Configuration
.............
``lib_xua`` has many parameters than can be configured at build time, some examples include:
- Sample-rates
- Channel counts
- Audio Class version
- Product/Vendor ID's
- Various product strings
- Master clock frequency
These parameters are set via defines in an optional ``xua_conf.h`` header file.
|appendix|
|newpage|
Demo Hardware Setup
-------------------
To run the demo, connect a USB cable to power the xCORE-200 MC Audio board
and plug the xTAG to the board and connect the xTAG USB cable to your
development machine.
.. figure:: images/hw_setup.*
:width: 80%
Hardware setup
|newpage|
Launching the demo application
------------------------------
Once the demo example has been built either from the command line using xmake or
via the build mechanism of xTIMEcomposer studio it can be executed on the xCORE-200
MC Audio board.
Once built there will be a ``bin/`` directory within the project which contains
the binary for the xCORE device. The xCORE binary has a XMOS standard .xe extension.
Launching from the command line
...............................
From the command line you use the ``xrun`` tool to download and run the code
on the xCORE device::
xrun --xscope bin/app_xua_simple.xe
Once this command has executed the application will be running on the
xCORE-200 MC Audio Board
Launching from xTIMEcomposer Studio
...................................
From xTIMEcomposer Studio use the run mechanism to download code to xCORE device.
Select the xCORE binary from the ``bin/`` directory, right click and go to Run
Configurations. Double click on xCORE application to create a new run configuration,
enable the xSCOPE I/O mode in the dialog box and then
select Run.
Once this command has executed the application will be running on the
xCORE-200 MC Audio board.
Running the application
.......................
Once running the device will be detected as a USB Audio device - note, Windows operating
systems may require a third party driver for correct operation
|newpage|
References
----------
.. nopoints::
* XMOS Tools User Guide
http://www.xmos.com/published/xtimecomposer-user-guide
* XMOS xCORE Programming Guide
http://www.xmos.com/published/xmos-programming-guide
* XMOS lib_xua Library
http://www.xmos.com/support/libraries/lib_xua
* XMOS lib_xud Library
http://www.xmos.com/support/libraries/lib_xud
|newpage|
Full source code listing
------------------------
Source code for main.xc
.......................
.. literalinclude:: app_xua_simple.xc
:largelisting:
|newpage|

View File

@@ -1,4 +1,5 @@
.. include:: ../../README.rst
.. |I2C| replace:: I\ :sup:`2`\ C
|newpage|
@@ -16,10 +17,10 @@ the xCORE-200 MC Audio board.
Block diagram
.............
.. figure:: images/block_diagram.*
:width: 80%
Application block diagram
.. .. figure:: images/block_diagram.*
.. :width: 80%
..
.. Application block diagram
The application uses a single logical core which runs the application and makes
calls to the |I2C| master library functions as required.
@@ -136,6 +137,17 @@ the audio I/O (i.e. I2S signalling).
Configuration
.............
``lib_xua`` has many parameters than can be configured at build time, some examples include:
- Sample-rates
- Channel counts
- Audio Class version
- Product/Vendor ID's
- Various product strings
- Master clock frequency
These parameters are set via defines in an optional ``xua_conf.h`` header file.
|appendix|
|newpage|

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved
/* A very simple *example* of a USB audio application (and as such is un-verified for production)
*
@@ -24,13 +24,7 @@ buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
/* Note, declared unsafe as sometimes we want to share this port
e.g. PDM mics and I2S use same master clock IO */
port p_mclk_in_ = PORT_MCLK_IN;
unsafe
{
/* TODO simplify this */
unsafe port p_mclk_in; /* Audio master clock input */
}
in port p_mclk_in = PORT_MCLK_IN;
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
in port p_mclk_in2 = PORT_MCLK_IN2;
@@ -85,11 +79,7 @@ int main()
/* IOHub core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
on tile[0]: {
unsafe
{
p_mclk_in = p_mclk_in_;
}
XUA_AudioHub(c_aud);
XUA_AudioHub(c_aud, p_mclk_in);
}
}

View File

@@ -1,6 +1,6 @@
Software Release License Agreement
Copyright (c) 2017-2018, XMOS, All rights reserved.
Copyright (c) 2017-2019, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved
#ifndef __XUA_AUDIOHUB_H__
#define __XUA_AUDIOHUB_H__
@@ -17,12 +17,14 @@
*
* \param c_aud Audio sample channel connected to the mixer() thread or the
* decouple() thread
* \param p_mclk_in Master clock port
* \param c_dig channel connected to the clockGen() thread for
* receiving/transmitting samples
* \param c_config An optional channel that will be passed on to the
* CODEC configuration functions.
*/
void XUA_AudioHub(chanend ?c_aud
, in port p_mclk_in
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, chanend c_spdif_tx
#endif

2
lib_xua/doc/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
rst/_build
pdf

View File

@@ -2,6 +2,7 @@
.. include:: ../../../README.rst
==============
XMOS USB Audio
==============

View File

@@ -1,3 +1,4 @@
// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@@ -9,11 +9,11 @@
#
# You can also set MODULE_XCC_C_FLAGS, MODULE_XCC_XC_FLAGS etc..
MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-asm -fsubword-select
MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-asm
OPTIONAL_HEADERS += xua_conf.h
VERSION = 0.1.2
VERSION = 0.1.3
DEPENDENT_MODULES = lib_logging(>=2.1.0) lib_xud(>=0.1.0)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved
/**
* @file xua_audiohub.xc
* @brief XMOS USB 2.0 Audio Reference Design. Audio Functions.
@@ -100,7 +100,6 @@ extern buffered out port:32 p_bclk;
unsigned dsdMode = DSD_MODE_OFF;
/* Master clock input */
extern unsafe port p_mclk_in;
extern in port p_mclk_in2;
#if (XUA_SPDIF_TX_EN)
@@ -1274,6 +1273,7 @@ static void dummy_deliver(chanend ?c_out, unsigned &command)
#endif
void XUA_AudioHub(chanend ?c_mix_out
, in port p_mclk_in
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, chanend c_spdif_out
#endif

View File

@@ -1,3 +1,4 @@
# Copyright (c) 2015-2019, XMOS Ltd, All rights reserved
def genstrings(outputChanCount, chanString, portString, structureString, adc_dac):

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2012-2019, XMOS Ltd, All rights reserved
#include "xua.h" /* Device specific defines */
#ifndef EXCLUDE_USB_AUDIO_MAIN
@@ -123,15 +123,7 @@ on tile[AUDIO_IO_TILE] : buffered out port:32 p_lrclk = PORT_I2S_LRCLK;
on tile[AUDIO_IO_TILE] : buffered out port:32 p_bclk = PORT_I2S_BCLK;
#endif
/* Note, declared unsafe as sometimes we want to share this port
e.g. PDM mics and I2S use same master clock IO */
on tile[AUDIO_IO_TILE] : port p_mclk_in_ = PORT_MCLK_IN;
/* TODO p_mclk_in should be delared as an unsafe resource */
unsafe
{
unsafe port p_mclk_in;
}
on tile[AUDIO_IO_TILE] : in port p_mclk_in = PORT_MCLK_IN;
#ifndef NO_USB
on tile[XUD_TILE] : in port p_for_mclk_count = PORT_MCLK_COUNT;
@@ -185,6 +177,16 @@ on tile[SPDIF_TX_TILE] : clock clk_mst_spd = CLKBLK_SPDIF_TX;
on tile[XUD_TILE] : clock clk_spd_rx = CLKBLK_SPDIF_RX;
#endif
#if (NUM_PDM_MICS > 0)
in port p_pdm_clk = PORT_PDM_CLK;
in buffered port:32 p_pdm_mics = PORT_PDM_DATA;
#if (PDM_TILE != AUDIO_IO_TILE)
/* If Mics and I2S are not the same tile we need a separate MCLK port */
in port p_pdm_mclk = PORT_PDM_MCLK;
#endif
#endif
#if(XUD_SERIES_SUPPORT == XUD_L_SERIES) && defined(ADAT_RX)
/* Cannot use default clock (CLKBLK_REF) for ADAT RX since it is tied to the
60MHz USB clock on G/L series parts. */
@@ -351,12 +353,6 @@ VENDOR_REQUESTS_PARAMS_DEC_
unsigned x;
thread_speed();
/* TODO p_mclk_in should be delared as an unsafe resource */
unsafe
{
p_mclk_in = p_mclk_in_;
}
/* Attach mclk count port to mclk clock-block (for feedback) */
//set_port_clock(p_for_mclk_count, clk_audio_mclk);
#if(AUDIO_IO_TILE != XUD_TILE)
@@ -440,6 +436,9 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
, server interface i_dfu ?dfuInterface
#endif
#if (NUM_PDM_MICS > 0)
#if (PDM_TILE == AUDIO_IO_TILE)
, streaming chanend c_ds_output[2]
#endif
, chanend c_pdm_pcm
#endif
)
@@ -454,6 +453,11 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
#define c_dig_rx null
#endif
#if (NUM_PDM_MICS > 0) && (PDM_TILE == AUDIO_IO_TILE)
/* Configure clocks ports - sharing mclk port with I2S */
xua_pdm_mic_config(p_mclk_in, p_pdm_clk, p_pdm_mics, clk_pdm);
#endif
par
{
#ifdef MIXER
@@ -472,6 +476,7 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
#define AUDIO_CHANNEL c_aud_in
#endif
XUA_AudioHub(AUDIO_CHANNEL
, p_mclk_in
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, c_spdif_tx
#endif
@@ -486,6 +491,9 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
#endif
);
}
#if (NUM_PDM_MICS > 0) && (PDM_TILE == AUDIO_IO_TILE)
xua_pdm_mic(c_ds_output, p_pdm_mics);
#endif
#if defined(SPDIF_RX) || defined(ADAT_RX)
{
@@ -614,11 +622,6 @@ int main()
on tile[AUDIO_IO_TILE]:
{
/* TODO p_mclk_in should be delared as an unsafe resource */
unsafe
{
p_mclk_in = p_mclk_in_;
}
usb_audio_io(c_mix_out, c_adc
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, c_spdif_tx
@@ -631,6 +634,9 @@ int main()
, dfuInterface
#endif
#if (NUM_PDM_MICS > 0)
#if (PDM_TILE == AUDIO_IO_TILE)
, c_ds_output
#endif
, c_pdm_pcm
#endif
);
@@ -706,16 +712,14 @@ int main()
#ifndef PDM_RECORD
#if (NUM_PDM_MICS > 0)
#if (PDM_TILE != AUDIO_IO_TILE)
/* PDM Mics running on a separate to AudioHub */
on stdcore[PDM_TILE]:
{
/* TODO p_mclk_in should be delared as an unsafe resource */
unsafe
{
p_mclk_in = p_mclk_in_;
}
pdm_mic(c_ds_output);
xua_pdm_mic_config(p_pdm_mclk, p_pdm_clk, p_pdm_mics, clk_pdm);
xua_pdm_mic(c_ds_output, p_pdm_mics);
}
#endif
#ifdef MIC_PROCESSING_USE_INTERFACE
on stdcore[PDM_TILE].core[0]: pdm_buffer(c_ds_output, c_pdm_pcm, i_mic_process);
#else

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved
#include "xua.h"
@@ -20,21 +20,6 @@
#define MAX_DECIMATION_FACTOR (96000/(MIN_FREQ/AUD_TO_MICS_RATIO))
/* Hardware resources */
/* TODO these should be in main.xc with the rest of the resources */
in port p_pdm_clk = PORT_PDM_CLK;
in buffered port:32 p_pdm_mics = PORT_PDM_DATA;
#if (PDM_TILE != AUDIO_IO_TILE)
/* If Mics and I2S are on the same tile we'll share an MCLK port */
in port p_pdm_mclk = PORT_PDM_MCLK;
#else
extern unsafe port p_mclk_in;
#endif
/* Delcared in main.xc */
extern clock clk_pdm;
#ifndef MIC_BUFFER_DEPTH
#define MIC_BUFFER_DEPTH 1
#endif
@@ -228,15 +213,8 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio)
#error MAX_FREQ > 48000 NOT CURRENTLY SUPPORTED
#endif
void pdm_mic(streaming chanend c_ds_output[2])
void xua_pdm_mic_config(in port p_pdm_mclk, in port p_pdm_clk, buffered in port:32 p_pdm_mics, clock clk_pdm)
{
streaming chan c_4x_pdm_mic_0;
#if (NUM_PDM_MICS > 4)
streaming chan c_4x_pdm_mic_1;
#else
#define c_4x_pdm_mic_1 null
#endif
/* Mics expect a clock in the 3Mhz range, calculate the divide based on mclk */
/* e.g. For a 48kHz range mclk we expect a 3072000Hz mic clock */
/* e.g. For a 44.1kHz range mclk we expect a 2822400Hz mic clock */
@@ -246,19 +224,22 @@ void pdm_mic(streaming chanend c_ds_output[2])
unsigned micDiv = MCLK_48/3072000;
#if (PDM_TILE != AUDIO_IO_TILE)
configure_clock_src_divide(clk_pdm, p_pdm_mclk, micDiv/2);
#else
/* Sharing mclk port with I2S */
unsafe
{
configure_clock_src_divide(clk_pdm, (port) p_mclk_in, micDiv/2);
}
#endif
configure_port_clock_output(p_pdm_clk, clk_pdm);
configure_in_port(p_pdm_mics, clk_pdm);
start_clock(clk_pdm);
}
void xua_pdm_mic(streaming chanend c_ds_output[2], buffered in port:32 p_pdm_mics)
{
streaming chan c_4x_pdm_mic_0;
#if (NUM_PDM_MICS > 4)
streaming chan c_4x_pdm_mic_1;
#else
#define c_4x_pdm_mic_1 null
#endif
par
{
mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1);
@@ -268,4 +249,5 @@ void pdm_mic(streaming chanend c_ds_output[2])
#endif
}
}
#endif

View File

@@ -1,7 +1,10 @@
// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved
#include "mic_array.h"
/* Configures PDM ports/clocks */
void xua_pdm_mic_config(in port p_pdm_mclk, in port p_pdm_clk, buffered in port:32 p_pdm_mics, clock clk_pdm);
#ifdef MIC_PROCESSING_USE_INTERFACE
/* Interface based user processing */
typedef interface mic_process_if
@@ -22,7 +25,7 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio
void user_pdm_process(server mic_process_if i_mic_data);
/* PDM interface and decimation cores */
void pdm_mic(streaming chanend c_ds_output[2]);
void xua_pdm_mic(streaming chanend c_ds_output[2], buffered in port:32 p_pdm_mics);
#else
@@ -36,7 +39,7 @@ void user_pdm_init();
void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio);
/* PDM interface and decimation cores */
void pdm_mic(streaming chanend c_ds_output[2]);
void xua_pdm_mic(streaming chanend c_ds_output[2], buffered in port:32 p_pdm_mics);
#endif

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved
#include <xs1.h>
#include <platform.h>
#include <print.h>
@@ -7,7 +7,7 @@
extern unsafe port p_mclk_in;
extern in port p_mclk_in;
extern clock clk_audio_mclk;
extern clock clk_audio_bclk;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved
/*
Warnings relating to configuration defines located in this XC source file rather than the devicedefines.h header file in order to avoid multiple warnings being issued when the devicedefines.h header file is included in multiple files.
@@ -60,10 +60,6 @@ Warnings relating to configuration defines located in this XC source file rather
#warning AUDIO_CLASS not defined, using 2
#endif
#ifndef AUDIO_CLASS_FALLBACK
#warning AUDIO_CLASS_FALLBACK not defined, using 0 (i.e. disabled)
#endif
/* Sanity check on FS channel counts */
#if (NUM_USB_CHAN_OUT_FS > NUM_USB_CHAN_OUT)
#error NUM_USB_CHAN_OUT_FS expected to be less than or equal to NUM_USB_CHAN_OUT

View File

@@ -1,35 +0,0 @@
def use_module(bld):
bld.env.XCC_FLAGS = bld.env.XCC_FLAGS + [
'-O3', '-DREF_CLK_FREQ=100', '-fasm-linenum', '-fcomment-asm',
'-fsubword-select', '-DXUD_FULL_PIDTABLE=1'
]
source = bld.path.ant_glob(
[
'src/**/*.xc', 'src/**/*.c', 'src/**/*.S'
],
excl=[
'**/descriptors_2.rst'
])
depends_on = [
'lib_logging(>=2.0.0)', 'lib_xassert(>=2.0.0)', 'lib_xud(>=1.0.0)'
]
bld.env['XCC_FLAGS_endpoint0.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_dbcalc.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_audiorequests.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_flashlib_user.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_audioports.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_audioports.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_dfu.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_flash_interface.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.module(
source=source,
depends_on=depends_on,
includes=['api'],
optional_headers='xua_conf.h',
version='1.0.0')

View File

@@ -1,6 +1,6 @@
Software Release License Agreement
Copyright (c) 2016-2018, XMOS, All rights reserved.
Copyright (c) 2016-2019, XMOS, All rights reserved.
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved
#include <platform.h>
#include <stdlib.h>
#include <print.h>
@@ -79,18 +79,12 @@ buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
/* Note, declared unsafe as sometimes we want to share this port
e.g. PDM mics and I2S use same master clock IO */
port p_mclk_in_ = PORT_MCLK_IN;
in port p_mclk_in = PORT_MCLK_IN;
/* Clock-block declarations */
clock clk_audio_bclk = on tile[AUDIO_IO_TILE]: XS1_CLKBLK_1; /* Bit clock */
clock clk_audio_mclk = on tile[AUDIO_IO_TILE]: XS1_CLKBLK_2; /* Master clock */
unsafe
{
/* TODO simplify this */
unsafe port p_mclk_in; /* Audio master clock input */
}
#ifdef SIMULATION
#define INITIAL_SKIP_FRAMES 10
#define TOTAL_TEST_FRAMES 100
@@ -224,13 +218,9 @@ int main(void)
par {
on tile[AUDIO_IO_TILE]:
{
unsafe
{
p_mclk_in = p_mclk_in_;
}
par
{
XUA_AudioHub(c_out);
XUA_AudioHub(c_out, p_mclk_in);
generator(c_checker, c_out);
checker(c_checker, 0);
#ifdef SIMULATION

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python2.7
# Copyright (c) 2018-2019, XMOS Ltd, All rights reserved
import xmostest
import os.path

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python
# Copyright (c) 2018-2019, XMOS Ltd, All rights reserved
import xmostest
def runtest_one_config(env, format, i2s_role, num_chans_in, num_chans_out, sample_rate):