forked from PAWPAW-Mirror/lib_xua
Merge branch 'develop' into xross-patch-2
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
lib_xua Change Log
|
||||
==================
|
||||
|
||||
1.2.0
|
||||
-----
|
||||
|
||||
* ADDED: Makefile.Win32 for xmosdfu on Windows
|
||||
* FIXED: Bump default BCD device number to v1.2.0
|
||||
* FIXED: xmosdfu now fails with an error when given a directory (#119)
|
||||
* FIXED: Compilation errors related to HID code
|
||||
* FIXED: Runtime error when using mic array interface
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
|
||||
* RESOLVED: Zero length input packets generated before enumeration causing I2S
|
||||
timing pushout at startup
|
||||
* CHANGED: Pin Python package versions
|
||||
* REMOVED: not necessary cpanfile
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
|
||||
* ADDED: Ability to read or modify serial number string
|
||||
|
||||
1.0.1
|
||||
-----
|
||||
|
||||
|
||||
38
Jenkinsfile
vendored
38
Jenkinsfile
vendored
@@ -1,4 +1,4 @@
|
||||
@Library('xmos_jenkins_shared_library@v0.12.1') _
|
||||
@Library('xmos_jenkins_shared_library@v0.14.2') _
|
||||
|
||||
getApproval()
|
||||
|
||||
@@ -84,6 +84,42 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Pi host app') {
|
||||
agent {
|
||||
label 'pi'
|
||||
}
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
checkout scm
|
||||
dir("${REPO}/host/xmosdfu") {
|
||||
sh 'make -f Makefile.Pi'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
xcoreCleanSandbox()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Windows host app') {
|
||||
agent {
|
||||
label 'x86_64&&windows'
|
||||
}
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
checkout scm
|
||||
dir("${REPO}/host/xmosdfu") {
|
||||
runVS('nmake /f Makefile.Win32')
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
xcoreCleanSandbox()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Update') {
|
||||
|
||||
7
Pipfile
7
Pipfile
@@ -1,7 +0,0 @@
|
||||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
flake8 = "*"
|
||||
@@ -1,6 +1,6 @@
|
||||
Software Release License Agreement
|
||||
|
||||
Copyright (c) 2017-2018, XMOS, All rights reserved.
|
||||
Copyright (c) 2017-2020, 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.
|
||||
|
||||
|
||||
@@ -39,3 +39,18 @@ Raspberry Pi
|
||||
A makefile is provided for Raspbian. libusb is required and can be installed using the ``apt-get`` command from previous Linux section.
|
||||
|
||||
.. literalinclude:: Makefile.Pi
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
To build on Windows, you must first install Visual Studio 2019 Build Tools with
|
||||
C++ support. `This is available from Microsoft's website. <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_
|
||||
|
||||
To build, open a Developer Command Prompt via the start menu and navigate to the
|
||||
xmosdfu folder. The command to build is as follows:
|
||||
|
||||
``nmake /f Makefile.Win32``
|
||||
|
||||
This Makefile contains the following:
|
||||
|
||||
.. literalinclude:: Makefile.Win32
|
||||
|
||||
@@ -4,6 +4,9 @@ Using the DFU loader - macOS (via the XMOS DFU loader)
|
||||
The XMOS DFU loader is provided as source as part of the XMOS USB Audio software
|
||||
framework, see :ref:`usb_audiosec_building_xmos_dfu`.
|
||||
|
||||
NOTE: Windows requires the installation of libusbK drivers on the DFU endpoint.
|
||||
We recommend using `Zadig <https://zadig.akeo.ie/>`_.
|
||||
|
||||
Set up the image loader
|
||||
-----------------------
|
||||
|
||||
@@ -18,7 +21,7 @@ Download new firmware
|
||||
|
||||
To program the new firmware run the command:
|
||||
|
||||
``./xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin``
|
||||
``./bin/xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin``
|
||||
|
||||
Replace ``XMOS_L2_AUDIO2_PID`` with product ID of your target device. Invoke
|
||||
``xmosdfu`` with no arguments to get a list of all supported product IDs.
|
||||
@@ -35,7 +38,7 @@ present.
|
||||
|
||||
Run the command:
|
||||
|
||||
``./xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin``
|
||||
``./bin/xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin``
|
||||
|
||||
The file ``currentfirmware.bin`` contains the latest upgrade image. This file is
|
||||
an exact copy of the data from the flash and can be downloaded to the device
|
||||
@@ -47,6 +50,6 @@ Reverting firmware to factory image
|
||||
To revert the device back to its factory (i.e XFLASH) installed state from the
|
||||
new firmware, run the command:
|
||||
|
||||
``./xmosdfu XMOS_L2_AUDIO2_PID --revertfactory``
|
||||
``./bin/xmosdfu XMOS_L2_AUDIO2_PID --revertfactory``
|
||||
|
||||
The device will now be running, and only contain the factory firmware.
|
||||
|
||||
@@ -442,6 +442,16 @@
|
||||
#define CODEC_MASTER (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial Number String used by the device
|
||||
*
|
||||
* Default: ""
|
||||
*/
|
||||
#ifndef SERIAL_STR
|
||||
#define SERIAL_STR ""
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Vendor String used by the device. This is also pre-pended to various strings used by the design.
|
||||
*
|
||||
@@ -516,21 +526,21 @@
|
||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
||||
*/
|
||||
#ifndef BCD_DEVICE_J
|
||||
#define BCD_DEVICE_J (0)
|
||||
#define BCD_DEVICE_J (1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
||||
*/
|
||||
#ifndef BCD_DEVICE_M
|
||||
#define BCD_DEVICE_M (1)
|
||||
#define BCD_DEVICE_M (2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
||||
*/
|
||||
#ifndef BCD_DEVICE_N
|
||||
#define BCD_DEVICE_N (1)
|
||||
#define BCD_DEVICE_N (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,6 +62,16 @@ void XUA_Endpoint0_setProductStr(char * unsafe product_str);
|
||||
void XUA_Endpoint0_setProductStr(char * product_str);
|
||||
#endif
|
||||
|
||||
/** Function to set the Serial string
|
||||
*
|
||||
* \param serial_str Serial string to set
|
||||
*/
|
||||
#ifdef __XC__
|
||||
void XUA_Endpoint0_setSerialStr(char * unsafe serial_str);
|
||||
#else
|
||||
void XUA_Endpoint0_setSerialStr(char * serial_str);
|
||||
#endif
|
||||
|
||||
/** Function to set the BCD device
|
||||
*
|
||||
* \param bcdDevice BCD device to set
|
||||
@@ -72,34 +82,44 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice);
|
||||
|
||||
/** Function to get the Vendor string
|
||||
*
|
||||
* \param vid vendor string
|
||||
* \return vendor string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getVendorStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getVendorStr(;
|
||||
char * XUA_Endpoint0_getVendorStr();
|
||||
#endif
|
||||
|
||||
/** Function to get the Product string
|
||||
*
|
||||
* \param pid Product string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getProductStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getProductStr(;
|
||||
#endif
|
||||
|
||||
/** Function to get the Vendor string
|
||||
*
|
||||
* \return Vendor string
|
||||
*/
|
||||
unsigned short XUA_Endpoint0_getVendorId();
|
||||
|
||||
/** Function to get the Product string
|
||||
*
|
||||
* \return Product string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getProductStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getProductStr();
|
||||
#endif
|
||||
|
||||
/** Function to get the Serial Number string
|
||||
*
|
||||
* \return Serial string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getSerialStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getSerialStr();
|
||||
#endif
|
||||
|
||||
/** Function to get the Vendor ID
|
||||
*
|
||||
* \return Vendor ID
|
||||
*/
|
||||
unsigned short XUA_Endpoint0_getVendorId();
|
||||
|
||||
/** Function to get the Product ID
|
||||
*
|
||||
* \return Product ID
|
||||
*/
|
||||
unsigned short XUA_Endpoint0_getProductId();
|
||||
|
||||
/** Function to get the BCD device
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
all:
|
||||
g++ -m32 -Wall -g -o xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0
|
||||
mkdir -p bin
|
||||
g++ -m32 -Wall -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
all:
|
||||
g++ -Wall -g -o xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0
|
||||
mkdir -p bin
|
||||
g++ -Wall -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
all:
|
||||
g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX32 libusb/OSX32/libusb-1.0.0.dylib -m32 -Wall
|
||||
mkdir -p bin
|
||||
g++ -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/OSX32 libusb/OSX32/libusb-1.0.0.dylib -m32 -Wall
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
all:
|
||||
g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX64 libusb/OSX64/libusb-1.0.0.dylib -Wall
|
||||
mkdir -p bin
|
||||
g++ -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/OSX64 libusb/OSX64/libusb-1.0.0.dylib -Wall
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
# vendor and product IDs
|
||||
|
||||
xmosdfu: xmosdfu.cpp
|
||||
g++ -D_GNU_SOURCE -Wall -g -o xmosdfu -Ilibusb/Rasp -lusb-1.0 -x c xmosdfu.cpp -std=c99
|
||||
mkdir -p bin
|
||||
g++ -D_GNU_SOURCE -Wall -g -o bin/xmosdfu -Ilibusb/Rasp -lusb-1.0 -x c xmosdfu.cpp -std=c99
|
||||
|
||||
31
lib_xua/host/xmosdfu/Makefile.Win32
Normal file
31
lib_xua/host/xmosdfu/Makefile.Win32
Normal file
@@ -0,0 +1,31 @@
|
||||
# Build tested with Visual Studio 2017 command prompt
|
||||
#
|
||||
# Run: nmake /f Makefile.Win32
|
||||
#
|
||||
# NOTE: To run xmosdfu on Windows, libusbK drivers must be installed on the DFU endpoint
|
||||
# We recommend using the third-party Zadig tool for this.
|
||||
|
||||
COMMON_FLAGS = \
|
||||
/D BECLEAR_HOST=1 \
|
||||
/I libusb\Win32 \
|
||||
/nologo \
|
||||
/W4 \
|
||||
/WX- \
|
||||
/O2 \
|
||||
/EHa \
|
||||
/D _CRT_SECURE_NO_WARNINGS \
|
||||
xmosdfu.cpp \
|
||||
|
||||
all: xmosdfu
|
||||
|
||||
xmosdfu:
|
||||
if not exist bin mkdir bin
|
||||
CL.exe \
|
||||
$(COMMON_FLAGS) \
|
||||
/Fe"bin\xmosdfu.exe" \
|
||||
/link "libusb\Win32\libusb-1.0.lib""
|
||||
copy libusb-1.0.dll bin
|
||||
del *.obj
|
||||
|
||||
clean:
|
||||
rmdir /s /q bin
|
||||
BIN
lib_xua/host/xmosdfu/libusb-1.0.dll
Normal file
BIN
lib_xua/host/xmosdfu/libusb-1.0.dll
Normal file
Binary file not shown.
BIN
lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib
Normal file
BIN
lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib
Normal file
Binary file not shown.
2039
lib_xua/host/xmosdfu/libusb/Win32/libusb.h
Normal file
2039
lib_xua/host/xmosdfu/libusb/Win32/libusb.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -73,42 +73,42 @@ system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
echo ""
|
||||
echo "*** DFU download new firmware 1 ***"
|
||||
$PROGDIR/xmosdfu $device_pid --download $update1
|
||||
$PROGDIR/bin/xmosdfu $device_pid --download $update1
|
||||
sleep 2
|
||||
echo "Version Read:"
|
||||
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
echo ""
|
||||
echo "*** DFU download new firmware 2 ***"
|
||||
$PROGDIR/xmosdfu $device_pid --download $update2
|
||||
$PROGDIR/bin/xmosdfu $device_pid --download $update2
|
||||
sleep 2
|
||||
echo "Version Read:"
|
||||
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
echo ""
|
||||
echo "*** DFU upload existing firmware ***"
|
||||
$PROGDIR/xmosdfu $device_pid --upload upload.bin
|
||||
$PROGDIR/bin/xmosdfu $device_pid --upload upload.bin
|
||||
sleep 2
|
||||
echo "Version Read:"
|
||||
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
echo ""
|
||||
echo "*** DFU revert to factory ***"
|
||||
$PROGDIR/xmosdfu $device_pid --revertfactory
|
||||
$PROGDIR/bin/xmosdfu $device_pid --revertfactory
|
||||
sleep 2
|
||||
echo "Version Read:"
|
||||
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
echo ""
|
||||
echo "*** DFU download uploaded firmware ***"
|
||||
$PROGDIR/xmosdfu $device_pid --download upload.bin
|
||||
$PROGDIR/bin/xmosdfu $device_pid --download upload.bin
|
||||
sleep 2
|
||||
echo "Version Read:"
|
||||
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
echo ""
|
||||
echo "*** DFU revert to factory ***"
|
||||
$PROGDIR/xmosdfu $device_pid --revertfactory
|
||||
$PROGDIR/bin/xmosdfu $device_pid --revertfactory
|
||||
sleep 2
|
||||
echo "Version Read:"
|
||||
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved
|
||||
// Copyright (c) 2012-2020, XMOS Ltd, All rights reserved
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
// Used for checking if a file is a directory
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
// Aliases for Windows
|
||||
#define stat _stat
|
||||
#define fstat _fstat
|
||||
#define fileno _fileno
|
||||
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
void Sleep(unsigned milliseconds) {
|
||||
usleep(milliseconds * 1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "libusb.h"
|
||||
|
||||
/* the device's vendor and product id */
|
||||
@@ -51,7 +72,7 @@ static int find_xmos_device(unsigned int id, unsigned int pid, unsigned int list
|
||||
libusb_device *dev;
|
||||
libusb_device **devs;
|
||||
int i = 0;
|
||||
int found = 0;
|
||||
unsigned int found = 0;
|
||||
|
||||
size_t count = libusb_get_device_list(NULL, &devs);
|
||||
if ((int)count < 0)
|
||||
@@ -195,7 +216,7 @@ int xmos_dfu_restore_state(unsigned int interface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dfu_download(unsigned int interface, unsigned int block_num, unsigned int size, unsigned char *data)
|
||||
unsigned int dfu_download(unsigned int interface, unsigned int block_num, unsigned int size, unsigned char *data)
|
||||
{
|
||||
//printf("... Downloading block number %d size %d\r", block_num, size);
|
||||
/* Returns actual data size transferred */
|
||||
@@ -212,7 +233,7 @@ int dfu_upload(unsigned int interface, unsigned int block_num, unsigned int size
|
||||
|
||||
int write_dfu_image(char *file)
|
||||
{
|
||||
int i = 0;
|
||||
unsigned int i = 0;
|
||||
FILE* inFile = NULL;
|
||||
int image_size = 0;
|
||||
unsigned int num_blocks = 0;
|
||||
@@ -225,6 +246,7 @@ int write_dfu_image(char *file)
|
||||
unsigned int timeout = 0;
|
||||
unsigned char strIndex = 0;
|
||||
unsigned int dfuBlockCount = 0;
|
||||
struct stat statbuf;
|
||||
|
||||
inFile = fopen( file, "rb" );
|
||||
if( inFile == NULL )
|
||||
@@ -233,6 +255,19 @@ int write_dfu_image(char *file)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check if file is a directory */
|
||||
int status = fstat(fileno(inFile), &statbuf);
|
||||
if (status != 0)
|
||||
{
|
||||
fprintf(stderr,"Error: Failed to get info on file.\n");
|
||||
return -1;
|
||||
}
|
||||
if ( S_ISDIR(statbuf.st_mode) )
|
||||
{
|
||||
fprintf(stderr,"Error: Specified path is a directory.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Discover the size of the image. */
|
||||
if( 0 != fseek( inFile, 0, SEEK_END ) )
|
||||
{
|
||||
@@ -259,7 +294,7 @@ int write_dfu_image(char *file)
|
||||
{
|
||||
memset(block_data, 0x0, block_size);
|
||||
fread(block_data, 1, block_size, inFile);
|
||||
int transferred = dfu_download(0, dfuBlockCount, block_size, block_data);
|
||||
unsigned int transferred = dfu_download(0, dfuBlockCount, block_size, block_data);
|
||||
if(transferred != block_size)
|
||||
{
|
||||
/* Error */
|
||||
@@ -334,7 +369,7 @@ int read_dfu_image(char *file)
|
||||
|
||||
static void print_device_list(FILE *file, const char *indent)
|
||||
{
|
||||
for (int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++)
|
||||
for (long unsigned int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++)
|
||||
{
|
||||
fprintf(file, "%s%-30s (0x%0x)\n", indent, pidList[i].device_name, pidList[i].pid);
|
||||
}
|
||||
@@ -371,7 +406,7 @@ static unsigned int select_pid(char *device_pid)
|
||||
}
|
||||
|
||||
// Otherwise do a lookup of names
|
||||
for (int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++)
|
||||
for (long unsigned int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++)
|
||||
{
|
||||
if (strcmp(device_pid, pidList[i].device_name) == 0)
|
||||
{
|
||||
@@ -501,7 +536,7 @@ int main(int argc, char **argv)
|
||||
printf("Waiting for device to restart and enter DFU mode...\n");
|
||||
|
||||
// Wait for device to enter dfu mode and restart
|
||||
system("sleep 20");
|
||||
Sleep(20 * 1000);
|
||||
#endif
|
||||
|
||||
// NOW IN DFU APPLICATION MODE
|
||||
@@ -556,7 +591,7 @@ int main(int argc, char **argv)
|
||||
printf("... Reverting device to factory image\n");
|
||||
xmos_dfu_revertfactory();
|
||||
// Give device time to revert firmware
|
||||
system("sleep 2");
|
||||
Sleep(2 * 1000);
|
||||
xmos_dfu_resetfromdfu(XMOS_DFU_IF);
|
||||
}
|
||||
else
|
||||
@@ -572,5 +607,5 @@ int main(int argc, char **argv)
|
||||
libusb_close(devh);
|
||||
libusb_exit(NULL);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION = 1.0.1
|
||||
VERSION = 1.2.0
|
||||
|
||||
DEPENDENT_MODULES = lib_logging(>=3.0.0) \
|
||||
lib_xassert(>=4.0.0) \
|
||||
@@ -45,6 +45,7 @@ INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \
|
||||
src/core/user/audiostream \
|
||||
src/core/user/hid \
|
||||
src/core/user/hostactive \
|
||||
src/hid \
|
||||
src/midi
|
||||
|
||||
SOURCE_DIRS = src/core \
|
||||
|
||||
@@ -36,9 +36,10 @@ extern unsigned int g_curSamFreqMultiplier;
|
||||
#define SET_SHARED_GLOBAL0(x,y) SET_SHARED_GLOBAL(x,y)
|
||||
#endif
|
||||
|
||||
|
||||
/* Global var for speed. Related to feedback. Used by input stream to determine IN packet size */
|
||||
unsigned g_speed;
|
||||
/* Initialise g_speed now so we get a sensible packet size until we start properly calculating feedback in the SoF case */
|
||||
/* Without this, zero size input packets fill the input FIFO and it takes a long time to clear out when feedback starts */
|
||||
/* This can cause a delay to the decouple ISR being serviced pushing our I2S timing. Initialising solves this */
|
||||
unsigned g_speed = (AUDIO_CLASS == 2) ? (DEFAULT_FREQ/8000) << 16 : (DEFAULT_FREQ/1000) << 16;
|
||||
unsigned g_freqChange = 0;
|
||||
unsigned feedbackValid = 0;
|
||||
|
||||
|
||||
@@ -118,6 +118,9 @@ char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2;
|
||||
char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1;
|
||||
#endif
|
||||
|
||||
/* Global variable for current USB Serial Number strings */
|
||||
char g_serial_str[XUA_MAX_STR_LEN] = SERIAL_STR;
|
||||
|
||||
/* Subslot */
|
||||
const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
|
||||
#if(OUTPUT_FORMAT_COUNT > 1)
|
||||
@@ -289,6 +292,9 @@ void XUA_Endpoint0_setStrTable() {
|
||||
concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio2);
|
||||
concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio2);
|
||||
#endif
|
||||
|
||||
// update Serial strings
|
||||
concatenateAndCopyStrings(g_serial_str, "", g_strTable.serialStr);
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_setVendorStr(char* vendor_str) {
|
||||
@@ -301,6 +307,11 @@ void XUA_Endpoint0_setProductStr(char* product_str) {
|
||||
concatenateAndCopyStrings(product_str, "", g_product_str);
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_setSerialStr(char* serial_str) {
|
||||
debug_printf("XUA_Endpoint0_setSerialStr() with string %s\n", serial_str);
|
||||
concatenateAndCopyStrings(serial_str, "", g_serial_str);
|
||||
}
|
||||
|
||||
char* XUA_Endpoint0_getVendorStr() {
|
||||
return g_strTable.vendorStr;
|
||||
}
|
||||
@@ -313,6 +324,10 @@ char* XUA_Endpoint0_getProductStr() {
|
||||
#endif
|
||||
}
|
||||
|
||||
char* XUA_Endpoint0_getSerialStr() {
|
||||
return g_strTable.serialStr;
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_setProductId(unsigned short pid) {
|
||||
#if (AUDIO_CLASS == 1)
|
||||
devDesc_Audio1.idProduct = pid;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08"
|
||||
#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09"
|
||||
#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a"
|
||||
#define XUA_SERIAL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0b"
|
||||
|
||||
// The value below must match the length of XUA_DESCR_EMPTY_STRING.
|
||||
#define XUA_MAX_STR_LEN (32)
|
||||
@@ -334,7 +335,7 @@ StringDescTable_t g_strTable =
|
||||
{
|
||||
.langID = "\x09\x04", /* US English */
|
||||
.vendorStr = XUA_VENDOR_EMPTY_STRING,
|
||||
.serialStr = "",
|
||||
.serialStr = XUA_SERIAL_EMPTY_STRING,
|
||||
#if (AUDIO_CLASS == 2)
|
||||
.productStr_Audio2 = XUA_PRODUCT_EMPTY_STRING,
|
||||
.outputInterfaceStr_Audio2 = XUA_PRODUCT_EMPTY_STRING,
|
||||
@@ -434,7 +435,7 @@ USB_Descriptor_Device_t devDesc_Audio1 =
|
||||
.bcdDevice = BCD_DEVICE,
|
||||
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
||||
.iProduct = offsetof(StringDescTable_t, productStr_Audio1)/sizeof(char *),
|
||||
.iSerialNumber = 0,
|
||||
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
|
||||
.bNumConfigurations = 1
|
||||
};
|
||||
#endif
|
||||
@@ -470,7 +471,7 @@ USB_Descriptor_Device_t devDesc_Audio2 =
|
||||
.bcdDevice = BCD_DEVICE,
|
||||
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
||||
.iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
|
||||
.iSerialNumber = 0,
|
||||
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
|
||||
.bNumConfigurations = 0x02 /* Set to 2 such that windows does not load composite driver */
|
||||
};
|
||||
|
||||
@@ -493,7 +494,7 @@ unsigned char devDesc_Null[] =
|
||||
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
|
||||
offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
||||
offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
|
||||
0, /* 16 iSerialNumber : Index of serial number decriptor */
|
||||
offsetof(StringDescTable_t, serialStr)/sizeof(char *), /* 16 iSerialNumber : Index of serial number decriptor */
|
||||
0x01 /* 17 bNumConfigurations : Number of possible configs */
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved
|
||||
// Copyright (c) 2015-2020, XMOS Ltd, All rights reserved
|
||||
|
||||
#include "xua.h"
|
||||
|
||||
@@ -115,7 +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;
|
||||
dc[1].async_interface_enabled = 0;
|
||||
|
||||
mic_array_decimator_configure(c_ds_output, decimatorCount, dc);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
|
||||
// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
#include <print.h>
|
||||
@@ -61,7 +61,7 @@ unsigned int divide, unsigned curSamFreq)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__XS2A__)
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
unsafe
|
||||
{
|
||||
/* Clock bitclock clock block from master clock pin (divided) */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Copyright (c) 2019, XMOS Ltd, All rights reserved
|
||||
// Copyright (c) 2019-2020, XMOS Ltd, All rights reserved
|
||||
#include <stdint.h>
|
||||
#include <xs1.h>
|
||||
#include "descriptor_defs.h"
|
||||
#include "hid.h"
|
||||
|
||||
19
python/setup.py
Normal file
19
python/setup.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2020, XMOS Ltd, All rights reserved
|
||||
import setuptools
|
||||
|
||||
# Another repository might depend on python code defined in this one. The
|
||||
# procedure to set up a suitable python environment for that repository may
|
||||
# pip-install this one as editable using this setup.py file. To minimise the
|
||||
# chance of version conflicts while ensuring a minimal degree of conformity,
|
||||
# the 3rd-party modules listed here require the same major version and at
|
||||
# least the same minor version as specified in the requirements.txt file.
|
||||
# The same modules should appear in the requirements.txt file as given below.
|
||||
setuptools.setup(
|
||||
name='lib_xua',
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=[
|
||||
'flake8~=3.8',
|
||||
],
|
||||
dependency_links=[
|
||||
],
|
||||
)
|
||||
34
requirements.txt
Normal file
34
requirements.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
# python_version 3.7.6
|
||||
#
|
||||
# The parse_version_from_requirements() function in the installPipfile.groovy
|
||||
# file of the Jenkins Shared Library uses the python_version comment to set
|
||||
# the version of python used.
|
||||
|
||||
# Distributed (released) dependencies
|
||||
#
|
||||
# The python modules listed below specify a known working combination required
|
||||
# by the python code in this repository. The procedure used to set up a
|
||||
# suitable python environment for it installs the version of each module in
|
||||
# the list. Using a specific version ensures a controlled infrastructure for
|
||||
# development, testing and release of this repository.
|
||||
#
|
||||
# Another repository might depend on python code defined in this one. The
|
||||
# procedure to set up a suitable python environment for that repository may
|
||||
# pip-install this one as editable using this repository's setup.py file. The
|
||||
# same modules should appear in the setup.py list as given below.
|
||||
|
||||
flake8==3.8.3
|
||||
|
||||
# Development dependencies
|
||||
#
|
||||
# Each link listed below specifies the path to a setup.py file which are
|
||||
# installed in editable mode with '-e $PATH' (without the quotes).
|
||||
#
|
||||
# If python code in this repository depends on python code under development
|
||||
# in another repository, then an entry for that other respository should
|
||||
# appear in this list instead of the released dependencies list.
|
||||
#
|
||||
# If this repository uses the setup functionality (e.g., script entry points)
|
||||
# of its own setup.py file, then this list must include an entry for that
|
||||
# setup.py file, e.g., '-e .' or '-e ./python' (without the quotes).
|
||||
-e ./python
|
||||
Reference in New Issue
Block a user