Merge branch 'develop' into feature/pendragon

1st attempt
This commit is contained in:
Michael Banther
2019-10-29 16:40:47 +00:00
13 changed files with 311 additions and 195 deletions

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@
.DS_Store
test_results.csv
_build*
**/.venv/**
# waf build files
.lock-waf_*

7
Brewfile Normal file
View File

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

View File

@@ -12,20 +12,26 @@ lib_xua Change Log
* ADDED: Initial library documentation
* ADDED: Application note AN00247: Using lib_xua with lib_spdif (transmit)
* ADDED: Separate callbacks for input/output audio stream start/stop
* CHANGE: I2S hardware resources no longer used globally and must be passed
to XUA_AudioHub()
* CHANGE: XUA_AudioHub() no longer pars S/PDIF transmitter task
* CHANGE: Moved to lib_spdif (from module_spdif_tx & module_spdif_rx)
* CHANGE: Define NUM_PDM_MICS renamed to XUA_NUM_PDM_MICS
* CHANGE: Define NO_USB renamed to XUA_USB_EN
* CHANGE: Build files updated to support new "xcommon" behaviour in xwaf.
* RESOLVED: wChannelConfig in UAC1 descriptor set according to output channel
count
* RESOLVED: Indexing of ADAT channel strings (#18059)
* RESOLVED: Rebooting device fails when PLL config "not reset" bit is set
* RESOLVED: Rebooting device fails when PLL config "not reset" bit is set
* Changes to dependencies:
- lib_spdif: Added dependency 3.0.0
- lib_dsp: Added dependency 5.0.0
- lib_mic_array: Added dependency 4.0.0
- lib_spdif: Added dependency 3.1.0
- lib_xassert: Added dependency 3.0.1
@@ -101,7 +107,7 @@ Legacy release history
7.3.0
-----
- CHANGE: Example OSX DFU host app updated to now take PID as runtime
- CHANGE: Example OSX DFU host app updated to now take PID as runtime
argument. This enabled multiple XMOS devices to be attached to the host
during DFU process

158
Jenkinsfile vendored
View File

@@ -1,61 +1,141 @@
@Library('xmos_jenkins_shared_library@master') _
@Library('xmos_jenkins_shared_library@develop') _
getApproval()
pipeline {
agent {
label 'x86&&macOS&&Apps'
}
agent none
environment {
VIEW = 'xua'
REPO = 'lib_xua'
VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}"
}
triggers {
/* Trigger this Pipeline on changes to the repos dependencies
*
* If this Pipeline is running in a pull request, the triggers are set
* on the base branch the PR is set to merge in to.
*
* Otherwise the triggers are set on the branch of a matching name to the
* one this Pipeline is on.
*/
upstream(
upstreamProjects:
(env.JOB_NAME.contains('PR-') ?
"../lib_device_control/${env.CHANGE_TARGET}," +
"../lib_dsp/${env.CHANGE_TARGET}," +
"../lib_i2c/${env.CHANGE_TARGET}," +
"../lib_logging/${env.CHANGE_TARGET}," +
"../lib_mic_array/${env.CHANGE_TARGET}," +
"../lib_spdif/${env.CHANGE_TARGET}," +
"../lib_xassert/${env.CHANGE_TARGET}," +
"../lib_xud/${env.CHANGE_TARGET}," +
"../tools_released/${env.CHANGE_TARGET}," +
"../tools_xmostest/${env.CHANGE_TARGET}," +
"../xdoc_released/${env.CHANGE_TARGET}"
:
"../lib_device_control/${env.BRANCH_NAME}," +
"../lib_dsp/${env.BRANCH_NAME}," +
"../lib_i2c/${env.BRANCH_NAME}," +
"../lib_logging/${env.BRANCH_NAME}," +
"../lib_mic_array/${env.BRANCH_NAME}," +
"../lib_spdif/${env.BRANCH_NAME}," +
"../lib_xassert/${env.BRANCH_NAME}," +
"../lib_xud/${env.BRANCH_NAME}," +
"../tools_released/${env.BRANCH_NAME}," +
"../tools_xmostest/${env.BRANCH_NAME}," +
"../xdoc_released/${env.BRANCH_NAME}"),
threshold: hudson.model.Result.SUCCESS
)
}
options {
skipDefaultCheckout()
}
stages {
stage('Get view') {
steps {
prepareAppsSandbox("${VIEW}", "${REPO}")
stage('Basic tests') {
agent {
label 'x86_64&&brew'
}
}
stage('Library checks') {
steps {
xcoreLibraryChecks("${REPO}")
}
}
stage('Tests') {
steps {
runXmostest("${REPO}", 'tests')
}
}
stage('Host builds') {
steps {
dir("${REPO}") {
dir("${REPO}") {
dir('host') {
dir('xmosdfu') {
sh 'make -f Makefile.OSX64'
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('xCORE builds') {
steps {
dir("${REPO}") {
xcoreAllAppNotesBuild('examples')
dir("${REPO}") {
runXdoc('doc')
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()
}
}
}
}
}
}
post {
success {
updateViewfiles()
}
cleanup {
cleanWs()
stage('Update') {
agent {
label 'x86_64&&brew'
}
steps {
updateViewfiles()
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
}
}

7
Pipfile Normal file
View File

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

2
cpanfile Normal file
View File

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

View File

@@ -1,37 +1,67 @@
# You can set flags specifically for your module by using the MODULE_XCC_FLAGS
# variable. So the following
#
# MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3
#
# specifies that everything in the modules should have the application
# build flags with -O3 appended (so the files will build at
# optimization level -O3).
#
# You can also set MODULE_XCC_C_FLAGS, MODULE_XCC_XC_FLAGS etc..
VERSION = 0.2.0
MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-asm
DEPENDENT_MODULES = lib_logging(>=3.0.0) \
lib_xassert(>=4.0.0) \
lib_xud(>=0.2.0) \
lib_spdif(>=4.0.0) \
lib_mic_array(>=4.0.0)
MODULE_XCC_FLAGS = $(XCC_FLAGS) \
-O3 \
-DREF_CLK_FREQ=100 \
-fasm-linenum \
-fcomment-asm
# Core
XCC_FLAGS_xua_endpoint0.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_xua_ep0_uacreqs.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_dbcalc.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_audioports.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_audioports.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
# DFU
XCC_FLAGS_dfu.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_flash_interface.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
OPTIONAL_HEADERS += xua_conf.h
VERSION = 0.2.0
EXPORT_INCLUDE_DIRS = api \
src/core \
src/core/audiohub \
src/core/buffer/ep \
src/core/endpoint0 \
src/dfu
DEPENDENT_MODULES = lib_logging(>=2.1.0) lib_xassert(>=2.0.0) lib_xud(>=0.1.0) lib_spdif(>=3.0.0)
INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \
src/core/buffer/decouple \
src/core/clocking \
src/core/mixer \
src/core/pdm_mics \
src/core/ports \
src/core/support \
src/core/support/powersave \
src/core/user \
src/core/user/audiostream \
src/core/user/hid \
src/core/user/hostactive \
src/midi
INCLUDE_DIRS = api src/* src/core/* src/core/user/hid
SOURCE_DIRS = src/core \
src/core/audiohub \
src/core/buffer/decouple \
src/core/buffer/ep \
src/core/clocking \
src/core/endpoint0 \
src/core/mixer \
src/core/pdm_mics \
src/core/ports \
src/core/support \
src/core/support/powersave \
src/core/user/audiostream \
src/core/user/hostactive \
src/core/xuduser \
src/dfu \
src/midi
#ignore host dir
SOURCE_DIRS = src/*
# The following file specific flags are not automatically kept in sync with the wscript file
# Core
EXCLUDE_FILES += descriptors_2.rst
XCC_FLAGS_xua_endpoint0.c = -Os -mno-dual-issue $(XCC_FLAGS)
XCC_FLAGS_xua_ep0_uacreqs.xc = -Os -mno-dual-issue $(XCC_FLAGS)
XCC_FLAGS_dbcalc.xc = -Os -mno-dual-issue $(XCC_FLAGS)
XCC_FLAGS_audioports.c = -Os -mno-dual-issue $(XCC_FLAGS)
XCC_FLAGS_audioports.xc = -Os -mno-dual-issue $(XCC_FLAGS)
# DFU
XCC_FLAGS_dfu.xc = -Os -mno-dual-issue $(XCC_FLAGS)
XCC_FLAGS_flash_interface.c = -Os -mno-dual-issue $(XCC_FLAGS)
XCC_FLAGS_flashlib_user.c = -Os -mno-dual-issue $(XCC_FLAGS)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved
/**
* @brief Implements endpoint zero for an USB Audio 1.0/2.0 device
* @author Ross Owen, XMOS Semiconductor
@@ -439,18 +439,50 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
}
#if (NUM_USB_CHAN_OUT > 0) && (NUM_USB_CHAN_IN > 0)
if ((sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) || (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT))
{
/* Check for stream start stop on output and input audio interfaces */
if(sp.wValue && !g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT] && !g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT])
unsigned num_input_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT];
unsigned num_output_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT];
if (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT)
{
/* If start and input AND output not currently running */
UserAudioStreamStart();
// in: 0 -> 1
if (sp.wValue && !num_input_interfaces)
{
UserAudioInputStreamStart();
if (!num_output_interfaces)
{
UserAudioStreamStart();
}
}
// in: 1 -> 0
else if (!sp.wValue && num_input_interfaces)
{
UserAudioInputStreamStop();
if (!num_output_interfaces)
{
UserAudioStreamStop();
}
}
}
else if(((sp.wIndex == 1) && (!sp.wValue)) && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT] && (!g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT]))
else if (sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT)
{
/* if output stop and output running and input not running */
UserAudioStreamStop();
// out: 0 -> 1
if (sp.wValue && !num_output_interfaces)
{
UserAudioOutputStreamStart();
if (!num_input_interfaces)
{
UserAudioStreamStart();
}
}
// out: 1 -> 0
else if (!sp.wValue && num_output_interfaces)
{
UserAudioOutputStreamStop();
if (!num_input_interfaces)
{
UserAudioStreamStop();
}
}
}
else if(((sp.wIndex == 2) && (!sp.wValue)) && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT] && (!g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT]))
{
@@ -465,11 +497,13 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
{
/* if start and not currently running */
UserAudioStreamStart();
UserAudioOutputStreamStart();
}
else if (!sp.wValue && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT])
{
/* if stop and currently running */
UserAudioStreamStop();
UserAudioOutputStreamStop();
}
}
#elif (NUM_USB_CHAN_IN > 0)
@@ -479,11 +513,13 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
{
/* if start and not currently running */
UserAudioStreamStart();
UserAudioInputStreamStart();
}
else if (!sp.wValue && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT])
{
/* if stop and currently running */
UserAudioStreamStop();
UserAudioInputStreamStop();
}
}
#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
/**
* @file xua_ep0_descriptors.h
* @brief Device Descriptors
@@ -423,7 +423,22 @@ USB_Descriptor_Device_t devDesc_Audio1 =
#endif
#if (AUDIO_CLASS == 2)
/* Device Descriptor for Audio Class 2.0 (Assumes High-Speed ) */
/* Device Descriptor for Audio Class 2.0 (Assumes High-Speed )
*
* The use of two configurations dates back to Windows XP (could be SP2). This
* lacked some standards support and incorrectly parsed the full audio class 2.0
* descriptor with its IADs (Interface Association Descriptors). The observed
* behaviour included loading the built-in audio class 1.0 driver on some
* interfaces (possibly the wrong ones, too), and hanging.
*
* Presenting a blank configuration first prevented loading the composite driver
* and issues arising from it, while still allowing to load a vendor driver on
* the actual configuration.
*
* Recent Windows subsystem can parse our class 2.0 descriptor correctly
* (certainly Windows 7 and onwards). It may be possible to remove this
* workaround.
*/
USB_Descriptor_Device_t devDesc_Audio2 =
{
.bLength = sizeof(USB_Descriptor_Device_t),

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"
@@ -107,6 +107,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio)
dc[0].mic_gain_compensation[2]=0;
dc[0].mic_gain_compensation[3]=0;
dc[0].channel_count = 4;
dc[0].async_interface_enabled = 0;
dc[1].dcc = &dcc;
dc[1].data = mic_decimator_fir_data[4];
dc[1].mic_gain_compensation[0]=0;
@@ -114,6 +115,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio)
dc[1].mic_gain_compensation[2]=0;
dc[1].mic_gain_compensation[3]=0;
dc[1].channel_count = 4;
dc[0].async_interface_enabled = 0;
mic_array_decimator_configure(c_ds_output, decimatorCount, dc);

View File

@@ -1,6 +1,9 @@
// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved
/* Default implementations of AudioStreamStop() and AudioStreamStart()
* callbacks.
*/
/* Deafult implementations of AudioStreamStop() and AudioStreamStart(). Both can be over-ridden */
void UserAudioStreamStop() __attribute__ ((weak));
void UserAudioStreamStop()
{
@@ -12,3 +15,27 @@ void UserAudioStreamStart()
{
return;
}
void UserAudioInputStreamStop() __attribute__ ((weak));
void UserAudioInputStreamStop()
{
return;
}
void UserAudioInputStreamStart() __attribute__ ((weak));
void UserAudioInputStreamStart()
{
return;
}
void UserAudioOutputStreamStop() __attribute__ ((weak));
void UserAudioOutputStreamStop()
{
return;
}
void UserAudioOutputStreamStart() __attribute__ ((weak));
void UserAudioOutputStreamStart()
{
return;
}

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 _AUDIOSTREAM_H_
#define _AUDIOSTREAM_H_
@@ -14,5 +14,17 @@ void UserAudioStreamStart(void);
/* Any actions required on stream stop e.g. DAC mute - run every steam stop */
void UserAudioStreamStop(void);
/* Any actions required on input stream start */
void UserAudioInputStreamStart(void);
/* Any actions required on input stream stop */
void UserAudioInputStreamStop(void);
/* Any actions required on output stream start */
void UserAudioOutputStreamStart(void);
/* Any actions required on output stream stop */
void UserAudioOutputStreamStop(void);
#endif

View File

@@ -1,109 +0,0 @@
import os.path
def create_list_from_make_flag(bld, list_of_flags):
for i, flag in enumerate(list_of_flags):
if flag.startswith('$('):
for f in bld.env[flag.strip('$()')]:
list_of_flags.insert(i, f)
i += 1
list_of_flags.remove(flag)
return list_of_flags
def create_list_of_strings(whitespace_seperated_list):
list_of_strings = whitespace_seperated_list.split(' ')
for item in list_of_strings:
item = "'{}'".format(item)
return list_of_strings
def read_module_build_info(bld):
with open(os.path.join(bld.path.abspath(), 'module_build_info')) as file:
module_build_info = {}
for line in file.readlines():
line = line.strip()
if line and not line.startswith('#'):
key, value = line.split('=', 1)
module_build_info[key.strip(' +')] = value.strip()
try:
module_build_info['OPTIONAL_HEADERS'] = (
create_list_of_strings(module_build_info['OPTIONAL_HEADERS']))
except KeyError:
pass
try:
module_build_info['DEPENDENT_MODULES'] = (
create_list_of_strings(module_build_info['DEPENDENT_MODULES']))
except KeyError:
pass
try:
module_build_info['MODULE_XCC_FLAGS'] = (
create_list_from_make_flag(bld,
create_list_of_strings(module_build_info['MODULE_XCC_FLAGS'])))
except KeyError:
pass
try:
module_build_info['MODULE_XCC_XC_FLAGS'] = (
create_list_from_make_flag(bld,
create_list_of_strings(module_build_info['MODULE_XCC_XC_FLAGS'])))
except KeyError:
pass
try:
module_build_info['MODULE_XCC_C_FLAGS'] = (
create_list_from_make_flag(bld,
create_list_of_strings(module_build_info['MODULE_XCC_C_FLAGS'])))
except KeyError:
pass
try:
module_build_info['MODULE_XCC_CPP_FLAGS'] = (
create_list_from_make_flag(bld,
create_list_of_strings(module_build_info['MODULE_XCC_CPP_FLAGS'])))
except KeyError:
pass
try:
module_build_info['MODULE_XCC_ASM_FLAGS'] = (
create_list_from_make_flag(bld,
create_list_of_strings(module_build_info['MODULE_XCC_ASM_FLAGS'])))
except KeyError:
pass
try:
module_build_info['INCLUDE_DIRS'] = (
create_list_of_strings(module_build_info['INCLUDE_DIRS']))
except KeyError:
pass
return module_build_info
def use_module(bld):
module_build_info = read_module_build_info(bld)
source = bld.path.ant_glob(['src/**/*.xc', 'src/**/*.c', 'src/**/*.S'],
excl=['**/descriptors_2.rst'])
bld.env.MODULE_XCC_FLAGS = module_build_info['MODULE_XCC_FLAGS']
# The following file specific flags are not automatically kept in sync with the module_build_info file
# Core
bld.env['XCC_FLAGS_endpoint0.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_xua_ep0_uacreqs.xc'] = 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_audioports.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.env['XCC_FLAGS_audioports.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
# DFU
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.env['XCC_FLAGS_flashlib_user.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue']
bld.module(
source=source,
depends_on=module_build_info['DEPENDENT_MODULES'],
includes=module_build_info['INCLUDE_DIRS'],
optional_headers=module_build_info['OPTIONAL_HEADERS'],
version=module_build_info['VERSION'])