forked from PAWPAW-Mirror/lib_xua
Compare commits
293 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
073bc9552a | ||
|
|
39fda0a178 | ||
|
|
91d16b13a2 | ||
|
|
ad889247a0 | ||
|
|
a7675ba997 | ||
|
|
41c6b90549 | ||
|
|
b62782faa0 | ||
|
|
8c30ce60f2 | ||
|
|
b3d66f4ca4 | ||
|
|
bdb5c56f7c | ||
|
|
a08f5d78fb | ||
|
|
515ec9c022 | ||
|
|
c0104fcf48 | ||
|
|
f88e5877be | ||
|
|
d33397164b | ||
|
|
a087e31b0f | ||
|
|
418622c593 | ||
|
|
6b0688d23e | ||
|
|
37ce235594 | ||
|
|
64cbd072f4 | ||
|
|
9b0e541e95 | ||
|
|
4d68b26b42 | ||
|
|
662b24386d | ||
|
|
c60da7fd82 | ||
|
|
45ab345521 | ||
|
|
692c4ee7ed | ||
|
|
5fa86dabbb | ||
|
|
9863b37ead | ||
|
|
46f516ddbc | ||
|
|
a404138903 | ||
|
|
147b5fb7f7 | ||
|
|
ebb3a0bfcb | ||
|
|
ec87a43dbf | ||
|
|
b0a8735623 | ||
|
|
93721f3144 | ||
|
|
d7b41cd35f | ||
|
|
d3560ca7fe | ||
|
|
ff86ac8d2a | ||
|
|
eebd438620 | ||
|
|
5bb44c54e1 | ||
|
|
36d325a457 | ||
|
|
d40ede1525 | ||
|
|
4f37069efb | ||
|
|
9f667d96f8 | ||
|
|
c352ed1132 | ||
|
|
a18e5a976f | ||
|
|
737c5bd7d0 | ||
|
|
7a0cfca280 | ||
|
|
3988906e39 | ||
|
|
cd0248c162 | ||
|
|
55de7a8abd | ||
|
|
911c8c51f2 | ||
|
|
fa9d483d2f | ||
|
|
1ae9c55477 | ||
|
|
94a05a8ece | ||
|
|
a93987d281 | ||
|
|
4f35551547 | ||
|
|
cb774f3c11 | ||
|
|
66a611f4fd | ||
|
|
b61ea63d40 | ||
|
|
8c132af069 | ||
|
|
93229a7509 | ||
|
|
466cc0abbb | ||
|
|
d5d5bd0637 | ||
|
|
ee6c22bd37 | ||
|
|
703a277059 | ||
|
|
b88342ab2b | ||
|
|
e7f9428731 | ||
|
|
6400e146d0 | ||
|
|
da114a1dea | ||
|
|
77398218b5 | ||
|
|
244a7718a1 | ||
|
|
e71ffdba00 | ||
|
|
625123e4a6 | ||
|
|
548992ab5c | ||
|
|
ccc1ee4021 | ||
|
|
ab96a726d6 | ||
|
|
d3d9b5ba23 | ||
|
|
c3e95a379f | ||
|
|
5be97ac227 | ||
|
|
8799f5f36e | ||
|
|
71dd8b5409 | ||
|
|
e41aed6ffb | ||
|
|
548ccebb27 | ||
|
|
3895b486ab | ||
|
|
ebeae1fa17 | ||
|
|
f328deb336 | ||
|
|
353d7c3c8d | ||
|
|
5f971af054 | ||
|
|
2b5dab51b5 | ||
|
|
19be25809b | ||
|
|
26cac1abb1 | ||
|
|
03a5024520 | ||
|
|
08ed5ee668 | ||
|
|
2b96ea0171 | ||
|
|
1b186a0c2f | ||
|
|
ed7a33b40f | ||
|
|
459ce6bd63 | ||
|
|
3819f30ad0 | ||
|
|
79e256f829 | ||
|
|
be90779db5 | ||
|
|
de382e5cc0 | ||
|
|
6dfc934d36 | ||
|
|
7dfd78deb4 | ||
|
|
fac0542920 | ||
|
|
8c9e8b11b9 | ||
|
|
21b259bc88 | ||
|
|
589c16d56c | ||
|
|
b4d5cb93f1 | ||
|
|
1d22975fd2 | ||
|
|
5354d94987 | ||
|
|
171ef30f42 | ||
|
|
8c175187c8 | ||
|
|
53f80dfba4 | ||
|
|
21c1e661ae | ||
|
|
d515458b83 | ||
|
|
b853589120 | ||
|
|
966d8db9a9 | ||
|
|
dc22b0593f | ||
|
|
0892ff9a8b | ||
|
|
65b1b41ec4 | ||
|
|
3b6f1c80e2 | ||
|
|
bf9e150310 | ||
|
|
1857ddbc67 | ||
|
|
145c0cb80f | ||
|
|
1fe4fc6771 | ||
|
|
88a3d6b20d | ||
|
|
33ec43134c | ||
|
|
2bbebc0a39 | ||
|
|
32af5b7b20 | ||
|
|
fc6915be6f | ||
|
|
d9dc7cc7c7 | ||
|
|
898a6c2410 | ||
|
|
da758f48fa | ||
|
|
2923f7574b | ||
|
|
436a268781 | ||
|
|
8233ef1d47 | ||
|
|
1109e08dd8 | ||
|
|
15f1d4de59 | ||
|
|
911a82cd83 | ||
|
|
ec657d1e8d | ||
|
|
9e82d613bb | ||
|
|
eb62940dc6 | ||
|
|
ef46bd72b9 | ||
|
|
7abcb487a9 | ||
|
|
e87a53ff83 | ||
|
|
8e05595710 | ||
|
|
ffee831f5d | ||
|
|
ad88e3342e | ||
|
|
d0986cb37f | ||
|
|
9d148f68a3 | ||
|
|
3b1b7f81dc | ||
|
|
1e4bcf01c7 | ||
|
|
46ce681a88 | ||
|
|
0cb3aab9c2 | ||
|
|
4c6fb9f271 | ||
|
|
2bc36947a8 | ||
|
|
7f001e1780 | ||
|
|
a04d06303b | ||
|
|
9b153bbda5 | ||
|
|
9d55c315c8 | ||
|
|
36a5163f4f | ||
|
|
e8e31ed8ff | ||
|
|
afeac0fa81 | ||
|
|
46d8201ba6 | ||
|
|
5910638bed | ||
|
|
f25a765e82 | ||
|
|
e3068ad245 | ||
|
|
1a5280ad14 | ||
|
|
4033b26587 | ||
|
|
65103d8c88 | ||
|
|
364efa72c3 | ||
|
|
3da2b12b59 | ||
|
|
8c397b1514 | ||
|
|
55cfb7b7da | ||
|
|
32e4fb55d3 | ||
|
|
687c06864c | ||
|
|
8c7dfab9f2 | ||
|
|
b711b3adf6 | ||
|
|
5c402f26c9 | ||
|
|
bec7111cfd | ||
|
|
20cba85383 | ||
|
|
01c2874953 | ||
|
|
5ea315fee8 | ||
|
|
4dbe332b2c | ||
|
|
0f0e8506b3 | ||
|
|
ada99bd1d9 | ||
|
|
a3617a641f | ||
|
|
f01bf03605 | ||
|
|
a237472efb | ||
|
|
5fe76d3720 | ||
|
|
0130d3fb32 | ||
|
|
45671148d5 | ||
|
|
6f146cccbc | ||
|
|
00eb07e637 | ||
|
|
a411b864c2 | ||
|
|
1f6140c912 | ||
|
|
e98c0b11bc | ||
|
|
285be1cd7a | ||
|
|
3f3007c3ac | ||
|
|
32e06c1ad2 | ||
|
|
95b80ebf72 | ||
|
|
25d4a74b59 | ||
|
|
99be4c9005 | ||
|
|
05bf241ab8 | ||
|
|
e401895314 | ||
|
|
ea5575a621 | ||
|
|
066231d86a | ||
|
|
108c551cef | ||
|
|
008508c8ae | ||
|
|
6636e2f505 | ||
|
|
b47a30a04c | ||
|
|
567e5cc0e0 | ||
|
|
382b1a8754 | ||
|
|
4446ab89c0 | ||
|
|
b871b4c046 | ||
|
|
fd45908ff6 | ||
|
|
dab84e56df | ||
|
|
64805d203e | ||
|
|
9d41387b8a | ||
|
|
162c9a14ce | ||
|
|
345f5dc369 | ||
|
|
bc957cb593 | ||
|
|
12789a1bee | ||
|
|
4c9130166c | ||
|
|
aec5bb8daa | ||
|
|
3106ccefcf | ||
|
|
7b43785816 | ||
|
|
0b9d970f75 | ||
|
|
f2b09522b8 | ||
|
|
d0b2c77177 | ||
|
|
cafdd8c93d | ||
|
|
13abe0e9e1 | ||
|
|
8a9d8cdd3e | ||
|
|
3c129ab521 | ||
|
|
dd7a8f423e | ||
|
|
a9e97b33b9 | ||
|
|
6adc94642a | ||
|
|
33fcac9c47 | ||
|
|
7b433a40fc | ||
|
|
b81d096a5a | ||
|
|
fc8a7a1ec9 | ||
|
|
fcee74d912 | ||
|
|
d1650afd37 | ||
|
|
02596cc5a9 | ||
|
|
a9dddfab2f | ||
|
|
f3e8a1937f | ||
|
|
b1f3cc0024 | ||
|
|
46cac9afb9 | ||
|
|
b552d60567 | ||
|
|
3ae4a4e456 | ||
|
|
728980e7dc | ||
|
|
29ab72e614 | ||
|
|
f1a1ee077f | ||
|
|
eb6d3b0869 | ||
|
|
fbef825a3b | ||
|
|
9cdbe9c62d | ||
|
|
0e27c7f2ff | ||
|
|
c0dade0156 | ||
|
|
ede81bd5f7 | ||
|
|
7836aacf47 | ||
|
|
4ffe3d94c7 | ||
|
|
0f47ef96be | ||
|
|
496dd16431 | ||
|
|
cbf2320de6 | ||
|
|
ae5d364226 | ||
|
|
bd805acf04 | ||
|
|
9b2efd07ad | ||
|
|
1ddbfdd8c1 | ||
|
|
2c5058d953 | ||
|
|
294d3a469e | ||
|
|
f66ddc53eb | ||
|
|
e55aa3ca8e | ||
|
|
368031064a | ||
|
|
e6c8766bb7 | ||
|
|
844cfb2ec2 | ||
|
|
a44d5466b5 | ||
|
|
0ed4ed0974 | ||
|
|
a8ba18094f | ||
|
|
89fe6c4d5d | ||
|
|
4b6a3697ac | ||
|
|
703ba4975a | ||
|
|
8a869ce230 | ||
|
|
6b9249507d | ||
|
|
c31f1521c2 | ||
|
|
35fe4fadeb | ||
|
|
7d7ec6858d | ||
|
|
cf5c486c62 | ||
|
|
d765ba1dfb | ||
|
|
49f1739098 | ||
|
|
21eee27d64 | ||
|
|
8c2dea71dc | ||
|
|
c3a45b2cba |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,6 +20,8 @@
|
||||
test_results.csv
|
||||
_build*
|
||||
**/.venv/**
|
||||
**/.vscode/**
|
||||
**.egg-info
|
||||
|
||||
# waf build files
|
||||
.lock-waf_*
|
||||
|
||||
@@ -1,6 +1,65 @@
|
||||
lib_xua Change Log
|
||||
==================
|
||||
|
||||
3.1.0
|
||||
-----
|
||||
|
||||
* CHANGED: Removed logic from HID API functions allowing a Report ID of 0 to
|
||||
be used as "all/any" Report
|
||||
|
||||
3.0.0
|
||||
-----
|
||||
|
||||
* ADDED: Support for HID Report IDs
|
||||
* REMOVED: Support for HID Reports containing controls from mixed Usage
|
||||
pages
|
||||
* CHANGED: Renamed the HID API file xua_hid_report_descriptor.h to
|
||||
xua_hid_report.h
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
- lib_locks: Added dependency 2.1.0
|
||||
|
||||
2.1.1
|
||||
-----
|
||||
|
||||
* CHANGED: Setting of HID report items
|
||||
|
||||
2.1.0
|
||||
-----
|
||||
|
||||
* CHANGED: Updated clock blocks to support lib_xud v2.0.0
|
||||
* CHANGED: Updated dependency on lib_xud to v2.0.0 for use by XVF3600
|
||||
|
||||
2.0.1
|
||||
-----
|
||||
|
||||
* CHANGED: Reverted dependency on lib_xud to v1.2.0 for use by XVF3510
|
||||
|
||||
2.0.0
|
||||
-----
|
||||
|
||||
* ADDED: Function to get a Report item description
|
||||
* CHANGED: Check HID Usage Page when changing a Report item description
|
||||
* CHANGED: HID event ID from list to bit and byte location in HID Report
|
||||
* CHANGED: Interface to UserHIDRecordEvent()
|
||||
* ADDED: Support for multiple flash specs defined by DFU_FLASH_DEVICE
|
||||
* ADDED: Nullable c_aud_ctl chan-end optimisation for fixed rate devices
|
||||
|
||||
1.3.0
|
||||
-----
|
||||
|
||||
* CHANGED: Move HID descriptors to ease maintenance
|
||||
* CHANGED: Move legacy tests to separate directory
|
||||
* CHANGED: Replace unused GPI-specific HID event names with generic ones
|
||||
* ADDED: Build default HID Report descriptor at boot-time
|
||||
* ADDED: Function to return length of HID Report
|
||||
* CHANGED: HID Report to return multiple bytes
|
||||
* CHANGED: NO_USB conditional compilation switch with XUA_USB_EN
|
||||
* REMOVED: XS1 support
|
||||
* CHANGED: Clock blocks used for BCLK and MCLK
|
||||
* REMOVED: Arguments no longer supported by XUD_Main
|
||||
|
||||
1.2.0
|
||||
-----
|
||||
|
||||
|
||||
65
Jenkinsfile
vendored
65
Jenkinsfile
vendored
@@ -27,11 +27,70 @@ pipeline {
|
||||
xcoreLibraryChecks("${REPO}")
|
||||
}
|
||||
}
|
||||
stage('Tests') {
|
||||
steps {
|
||||
runXmostest("${REPO}", 'tests')
|
||||
stage('XS2 Tests') {
|
||||
failFast true
|
||||
parallel {
|
||||
stage('Legacy tests') {
|
||||
steps {
|
||||
runXmostest("${REPO}", 'legacy_tests')
|
||||
}
|
||||
}
|
||||
stage('Unit tests') {
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
dir('tests') {
|
||||
dir('xua_unit_tests') {
|
||||
withVenv {
|
||||
runWaf('.', "configure clean build --target=xcore200")
|
||||
// runWaf('.', "configure clean build --target=xcoreai")
|
||||
// stash name: 'xua_unit_tests', includes: 'bin/*xcoreai.xe, '
|
||||
viewEnv() {
|
||||
runPython("TARGET=XCORE200 pytest -s")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// stage('xcore.ai Verification') {
|
||||
// agent {
|
||||
// label 'xcore.ai-explorer'
|
||||
// }
|
||||
// options {
|
||||
// skipDefaultCheckout()
|
||||
// }
|
||||
// stages{
|
||||
// stage('Get View') {
|
||||
// steps {
|
||||
// xcorePrepareSandbox("${VIEW}", "${REPO}")
|
||||
// }
|
||||
// }
|
||||
// stage('Unit tests') {
|
||||
// steps {
|
||||
// dir("${REPO}") {
|
||||
// dir('tests') {
|
||||
// dir('xua_unit_tests') {
|
||||
// withVenv {
|
||||
// unstash 'xua_unit_tests'
|
||||
// viewEnv() {
|
||||
// runPython("TARGET=XCOREAI pytest -s")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } // stages
|
||||
// post {
|
||||
// cleanup {
|
||||
// cleanWs()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
stage('xCORE builds') {
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
|
||||
@@ -3,8 +3,9 @@ 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] -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 \
|
||||
-DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -fxscope
|
||||
|
||||
#-DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ int main()
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2,
|
||||
c_sof, epTypeTableOut, epTypeTableIn,
|
||||
null, null, -1 ,
|
||||
XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
|
||||
168
examples/AN00246_xua_example/src/hid_report_descriptor.h
Normal file
168
examples/AN00246_xua_example/src/hid_report_descriptor.h
Normal file
@@ -0,0 +1,168 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 5)
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 4)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 3)
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 2)
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 1)
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -75,7 +75,7 @@
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
|
||||
@@ -3,9 +3,9 @@ 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 \
|
||||
-DXUD_CORE_CLOCK=600 -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.
|
||||
|
||||
@@ -61,7 +61,7 @@ int main()
|
||||
par
|
||||
{
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
/* Note, since we are not using many features we pass in null for quite a few params.. */
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 5)
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 4)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 3)
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 2)
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 1)
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -22,7 +22,6 @@ out port p_gpio = on tile[0]:XS1_PORT_8C;
|
||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
||||
unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
{
|
||||
unsigned char data[1] = {0};
|
||||
unsigned char gpioVal = 0;
|
||||
|
||||
/* Set master clock select appropriately and put ADC and DAC into reset */
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
|
||||
@@ -3,9 +3,9 @@ APP_NAME = app_xua_simple
|
||||
TARGET = mic_array_ref.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 \
|
||||
-DXUD_CORE_CLOCK=600 -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.
|
||||
|
||||
@@ -65,7 +65,7 @@ int main()
|
||||
par
|
||||
{
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS);
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS);
|
||||
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
/* Note, since we are not using many features we pass in null for quite a few params.. */
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 5)
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 4)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 3)
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 2)
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 1)
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -81,7 +81,7 @@
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
|
||||
@@ -3,7 +3,7 @@ TARGET = xk-audio-216-mc.xn
|
||||
USED_MODULES = lib_xua \
|
||||
module_i2c_shared module_i2c_single_port lib_logging
|
||||
|
||||
BUILD_FLAGS = -O0 -g -lflash -DXUD_SERIES_SUPPORT=4 -fxscope -save-temps -march=xs2a -DUSB_TILE=tile[1]
|
||||
BUILD_FLAGS = -O0 -g -lflash -DXUD_SERIES_SUPPORT=4 -DXUD_CORE_CLOCK=600 -fxscope -save-temps -march=xs2a -DUSB_TILE=tile[1]
|
||||
|
||||
BUILD_FLAGS_i2s_master_2in_2out_48khz = $(BUILD_FLAGS) \
|
||||
-D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \
|
||||
167
legacy_tests/app_test_i2s_loopback/hid_report_descriptor.h
Normal file
167
legacy_tests/app_test_i2s_loopback/hid_report_descriptor.h
Normal file
@@ -0,0 +1,167 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 1, 0, 0 ) };
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 5 )
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 4 )
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 3 )
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 2 )
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 1 )
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 0 )
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t * const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -83,10 +83,12 @@
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
<Attribute Name="QE_REGISTER" Value="flash_qe_location_status_reg_0"/>
|
||||
<Attribute Name="QE_BIT" Value="flash_qe_bit_6"/>
|
||||
</Device>
|
||||
</ExternalDevices>
|
||||
<JTAGChain>
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __custom_defines_h__
|
||||
|
||||
#define EXCLUDE_USB_AUDIO_MAIN
|
||||
#define NUM_PDM_MICS 0
|
||||
#define XUA_NUM_PDM_MICS 0
|
||||
#define XUD_TILE 1
|
||||
#define AUDIO_IO_TILE 0
|
||||
#define MIXER 0
|
||||
@@ -1,860 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="com.xmos.cdt.toolchain.1285928753">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.xmos.cdt.toolchain.1285928753" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="com.xmos.cdt.core.XdeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.xmos.cdt.core.XEBinaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration buildProperties="" description="" id="com.xmos.cdt.toolchain.1285928753" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="com.xmos.cdt.toolchain.1285928753.790908561" name="/" resourcePath="">
|
||||
<toolChain id="com.xmos.cdt.toolchain.1969897956" name="com.xmos.cdt.toolchain" superClass="com.xmos.cdt.toolchain">
|
||||
<targetPlatform archList="all" binaryParser="com.xmos.cdt.core.XEBinaryParser;org.eclipse.cdt.core.GNU_ELF" id="com.xmos.cdt.core.platform.1615568037" isAbstract="false" osList="linux,win32,macosx" superClass="com.xmos.cdt.core.platform"/>
|
||||
<builder arguments="-f .makefile" id="com.xmos.cdt.builder.base.45159417" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="com.xmos.cdt.builder.base">
|
||||
<outputEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="outputPath" name="bin"/>
|
||||
</outputEntries>
|
||||
</builder>
|
||||
<tool id="com.xmos.cdt.xc.compiler.404499215" name="com.xmos.cdt.xc.compiler" superClass="com.xmos.cdt.xc.compiler">
|
||||
<option id="com.xmos.xc.compiler.option.defined.symbols.1492092903" name="com.xmos.xc.compiler.option.defined.symbols" superClass="com.xmos.xc.compiler.option.defined.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__XC__=1"/>
|
||||
<listOptionValue builtIn="false" value="__llvm__=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELAXED=0"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_CONSUME=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQUIRE=2"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELEASE=3"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQ_REL=4"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_SEQ_CST=5"/>
|
||||
<listOptionValue builtIn="false" value="__PRAGMA_REDEFINE_EXTNAME=1"/>
|
||||
<listOptionValue builtIn="false" value="__VERSION__="4.2.1"/>
|
||||
<listOptionValue builtIn="false" value="__CONSTANT_CFSTRINGS__=1"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_LITTLE_ENDIAN__=1234"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_BIG_ENDIAN__=4321"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_PDP_ENDIAN__=3412"/>
|
||||
<listOptionValue builtIn="false" value="__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"/>
|
||||
<listOptionValue builtIn="false" value="__LITTLE_ENDIAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="_ILP32=1"/>
|
||||
<listOptionValue builtIn="false" value="__ILP32__=1"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_FLOAT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_INT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_LONG__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_POINTER__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SHORT__=2"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_PTRDIFF_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SIZE_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WCHAR_T__=1"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WINT_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_WIDTH__=8"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
|
||||
<listOptionValue builtIn="false" value="__POINTER_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__=_"/>
|
||||
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
|
||||
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
|
||||
<listOptionValue builtIn="false" value="__xcore__=1"/>
|
||||
<listOptionValue builtIn="false" value="__XS1B__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_16__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_32__=1"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=14"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=3"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1403"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=2"/>
|
||||
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
|
||||
<listOptionValue builtIn="false" value="_XSCOPE_PROBES_INCLUDE_FILE="/var/folders/0l/8jd0xy095ps890m302j532580000h5/T//cc8JvR3b.h""/>
|
||||
</option>
|
||||
<option id="com.xmos.xc.compiler.option.include.paths.834699451" name="com.xmos.xc.compiler.option.include.paths" superClass="com.xmos.xc.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/xc""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/clang""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst/images}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/client}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/class}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core/included}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/control}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user}""/>
|
||||
</option>
|
||||
<inputType id="com.xmos.cdt.xc.compiler.input.2062798368" name="XC" superClass="com.xmos.cdt.xc.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="com.xmos.cdt.c.compiler.1931691289" name="com.xmos.cdt.c.compiler" superClass="com.xmos.cdt.c.compiler">
|
||||
<option id="com.xmos.c.compiler.option.defined.symbols.534062814" name="com.xmos.c.compiler.option.defined.symbols" superClass="com.xmos.c.compiler.option.defined.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__llvm__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang_major__=3"/>
|
||||
<listOptionValue builtIn="false" value="__clang_minor__=6"/>
|
||||
<listOptionValue builtIn="false" value="__clang_patchlevel__=0"/>
|
||||
<listOptionValue builtIn="false" value="__clang_version__="3.6.0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC__=4"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELAXED=0"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_CONSUME=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQUIRE=2"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELEASE=3"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQ_REL=4"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_SEQ_CST=5"/>
|
||||
<listOptionValue builtIn="false" value="__PRAGMA_REDEFINE_EXTNAME=1"/>
|
||||
<listOptionValue builtIn="false" value="__VERSION__="4.2.1"/>
|
||||
<listOptionValue builtIn="false" value="__CONSTANT_CFSTRINGS__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_RTTI=1"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_LITTLE_ENDIAN__=1234"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_BIG_ENDIAN__=4321"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_PDP_ENDIAN__=3412"/>
|
||||
<listOptionValue builtIn="false" value="__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"/>
|
||||
<listOptionValue builtIn="false" value="__LITTLE_ENDIAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="_ILP32=1"/>
|
||||
<listOptionValue builtIn="false" value="__ILP32__=1"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_FLOAT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_INT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_LONG__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_POINTER__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SHORT__=2"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_PTRDIFF_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SIZE_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WCHAR_T__=1"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WINT_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_WIDTH__=8"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
|
||||
<listOptionValue builtIn="false" value="__POINTER_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_C_SUFFIX__=U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__=_"/>
|
||||
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_STDC_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_BOOL_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_SHORT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_INT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LLONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_POINTER_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
|
||||
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
|
||||
<listOptionValue builtIn="false" value="__xcore__=1"/>
|
||||
<listOptionValue builtIn="false" value="__XS1B__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_VERSION__=199901L"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_16__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_32__=1"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=14"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=3"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1403"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=2"/>
|
||||
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
|
||||
<listOptionValue builtIn="false" value="_XSCOPE_PROBES_INCLUDE_FILE="/var/folders/0l/8jd0xy095ps890m302j532580000h5/T//ccVdKn1b.h""/>
|
||||
</option>
|
||||
<option id="com.xmos.c.compiler.option.include.paths.1661660573" name="com.xmos.c.compiler.option.include.paths" superClass="com.xmos.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/clang""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst/images}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/client}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/class}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core/included}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/control}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user}""/>
|
||||
</option>
|
||||
<inputType id="com.xmos.cdt.c.compiler.input.c.1188610778" name="C" superClass="com.xmos.cdt.c.compiler.input.c"/>
|
||||
</tool>
|
||||
<tool id="com.xmos.cdt.cxx.compiler.1403352573" name="com.xmos.cdt.cxx.compiler" superClass="com.xmos.cdt.cxx.compiler">
|
||||
<option id="com.xmos.cxx.compiler.option.defined.symbols.665306874" name="com.xmos.cxx.compiler.option.defined.symbols" superClass="com.xmos.cxx.compiler.option.defined.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__llvm__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang__=1"/>
|
||||
<listOptionValue builtIn="false" value="__clang_major__=3"/>
|
||||
<listOptionValue builtIn="false" value="__clang_minor__=6"/>
|
||||
<listOptionValue builtIn="false" value="__clang_patchlevel__=0"/>
|
||||
<listOptionValue builtIn="false" value="__clang_version__="3.6.0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_MINOR__=2"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_PATCHLEVEL__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC__=4"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_ABI_VERSION=1002"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELAXED=0"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_CONSUME=1"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQUIRE=2"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_RELEASE=3"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_ACQ_REL=4"/>
|
||||
<listOptionValue builtIn="false" value="__ATOMIC_SEQ_CST=5"/>
|
||||
<listOptionValue builtIn="false" value="__PRAGMA_REDEFINE_EXTNAME=1"/>
|
||||
<listOptionValue builtIn="false" value="__VERSION__="4.2.1"/>
|
||||
<listOptionValue builtIn="false" value="__CONSTANT_CFSTRINGS__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_RTTI=1"/>
|
||||
<listOptionValue builtIn="false" value="__DEPRECATED=1"/>
|
||||
<listOptionValue builtIn="false" value="__GNUG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__GXX_WEAK__=1"/>
|
||||
<listOptionValue builtIn="false" value="__private_extern__=extern"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_LITTLE_ENDIAN__=1234"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_BIG_ENDIAN__=4321"/>
|
||||
<listOptionValue builtIn="false" value="__ORDER_PDP_ENDIAN__=3412"/>
|
||||
<listOptionValue builtIn="false" value="__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"/>
|
||||
<listOptionValue builtIn="false" value="__LITTLE_ENDIAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="_ILP32=1"/>
|
||||
<listOptionValue builtIn="false" value="__ILP32__=1"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SCHAR_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__SHRT_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_MAX__=2147483647L"/>
|
||||
<listOptionValue builtIn="false" value="__LONG_LONG_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_FLOAT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_INT__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_DOUBLE__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_LONG_LONG__=8"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_POINTER__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SHORT__=2"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_PTRDIFF_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_SIZE_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WCHAR_T__=1"/>
|
||||
<listOptionValue builtIn="false" value="__SIZEOF_WINT_T__=4"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__PTRDIFF_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__SIZE_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_WIDTH__=8"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__SIG_ATOMIC_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTMAX_WIDTH__=64"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINTPTR_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DENORM_MIN__=1.40129846e-45F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_DIG__=6"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EPSILON__=1.19209290e-7F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MANT_DIG__=24"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_10_EXP__=38"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX_EXP__=128"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MAX__=3.40282347e+38F"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_10_EXP__=(-37)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN_EXP__=(-125)"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_MIN__=1.17549435e-38F"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DENORM_MIN__=4.9406564584124654e-324"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_EPSILON__=2.2204460492503131e-16"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MAX__=1.7976931348623157e+308"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__DBL_MIN__=2.2250738585072014e-308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DENORM_MIN__=4.9406564584124654e-324L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_DENORM__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_DIG__=15"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_EPSILON__=2.2204460492503131e-16L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_INFINITY__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_HAS_QUIET_NAN__=1"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MANT_DIG__=53"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_10_EXP__=308"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX_EXP__=1024"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MAX__=1.7976931348623157e+308L"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_10_EXP__=(-307)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN_EXP__=(-1021)"/>
|
||||
<listOptionValue builtIn="false" value="__LDBL_MIN__=2.2250738585072014e-308L"/>
|
||||
<listOptionValue builtIn="false" value="__POINTER_WIDTH__=32"/>
|
||||
<listOptionValue builtIn="false" value="__CHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WCHAR_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__WINT_UNSIGNED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__INT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__INT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__INT32_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__INT64_C_SUFFIX__=LL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__INT8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_C_SUFFIX__"/>
|
||||
<listOptionValue builtIn="false" value="__UINT16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__INT16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_C_SUFFIX__=U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__INT32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_C_SUFFIX__=ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__INT64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_LEAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_LEAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_TYPE__=signed"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_MAX__=127"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTd__="hhd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST8_FMTi__="hhi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_MAX__=255"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTo__="hho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTu__="hhu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTx__="hhx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST8_FMTX__="hhX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_TYPE__=short"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_MAX__=32767"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTd__="hd""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST16_FMTi__="hi""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_MAX__=65535"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTo__="ho""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTu__="hu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTx__="hx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST16_FMTX__="hX""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_TYPE__=int"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_MAX__=2147483647"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTd__="d""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST32_FMTi__="i""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_TYPE__=unsigned"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_MAX__=4294967295U"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTo__="o""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTu__="u""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTx__="x""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST32_FMTX__="X""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_MAX__=9223372036854775807LL"/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTd__="lld""/>
|
||||
<listOptionValue builtIn="false" value="__INT_FAST64_FMTi__="lli""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_TYPE__=long"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_MAX__=18446744073709551615ULL"/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTo__="llo""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTu__="llu""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTx__="llx""/>
|
||||
<listOptionValue builtIn="false" value="__UINT_FAST64_FMTX__="llX""/>
|
||||
<listOptionValue builtIn="false" value="__USER_LABEL_PREFIX__=_"/>
|
||||
<listOptionValue builtIn="false" value="__FINITE_MATH_ONLY__=0"/>
|
||||
<listOptionValue builtIn="false" value="__GNUC_GNU_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_BOOL_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_SHORT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_INT_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_LLONG_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__GCC_ATOMIC_POINTER_LOCK_FREE=1"/>
|
||||
<listOptionValue builtIn="false" value="__NO_INLINE__=1"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_EVAL_METHOD__=0"/>
|
||||
<listOptionValue builtIn="false" value="__FLT_RADIX__=2"/>
|
||||
<listOptionValue builtIn="false" value="__DECIMAL_DIG__=17"/>
|
||||
<listOptionValue builtIn="false" value="__xcore__=1"/>
|
||||
<listOptionValue builtIn="false" value="__XS1B__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_HOSTED__=1"/>
|
||||
<listOptionValue builtIn="false" value="__cplusplus=199711L"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_16__=1"/>
|
||||
<listOptionValue builtIn="false" value="__STDC_UTF_32__=1"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_YEAR=14"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MONTH=3"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MAJOR=1403"/>
|
||||
<listOptionValue builtIn="false" value="XCC_VERSION_MINOR=2"/>
|
||||
<listOptionValue builtIn="false" value="__XCC_HAVE_FLOAT__=1"/>
|
||||
<listOptionValue builtIn="false" value="_XSCOPE_PROBES_INCLUDE_FILE="/var/folders/0l/8jd0xy095ps890m302j532580000h5/T//cc8vh80e.h""/>
|
||||
</option>
|
||||
<option id="com.xmos.cxx.compiler.option.include.paths.1031009526" name="com.xmos.cxx.compiler.option.include.paths" superClass="com.xmos.cxx.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/clang""/>
|
||||
<listOptionValue builtIn="false" value=""${XMOS_TOOL_PATH}/target/include/c++/v1""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst/images}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/client}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/class}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core/included}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/core}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user/control}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_logging/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc/rst}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/api}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/doc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lib_xud/src/user}""/>
|
||||
</option>
|
||||
<inputType id="com.xmos.cdt.cxx.compiler.input.cpp.223196941" name="C++" superClass="com.xmos.cdt.cxx.compiler.input.cpp"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding=".build*" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="lib_xua.null.1378855182" name="lib_xua"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
</cproject>
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>lib_xua</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.xmos.cdt.core.ProjectInfoSyncBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.xmos.cdt.core.LegacyProjectCheckerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.xmos.cdt.core.ModulePathBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>com.xmos.cdt.core.XdeProjectNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><xproject><repository>lib_xua</repository><partnum>XM-012639-SM</partnum></xproject>
|
||||
@@ -1244,10 +1244,6 @@ enum USBEndpointNumber_Out
|
||||
|
||||
#define MAX_VOL (0x20000000)
|
||||
|
||||
#if defined(SU1_ADC_ENABLE) && (SU1_ADC_ENABLE == 0)
|
||||
#undef SU1_ADC_ENABLE
|
||||
#endif
|
||||
|
||||
#if defined(LEVEL_METER_LEDS) && !defined(LEVEL_UPDATE_RATE)
|
||||
#define LEVEL_UPDATE_RATE 400000
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
* \param c_ep0_out Chanend connected to the XUD_Manager() out endpoint array
|
||||
* \param c_ep0_in Chanend connected to the XUD_Manager() in endpoint array
|
||||
* \param c_audioCtrl Chanend connected to the decouple thread for control
|
||||
* audio (sample rate changes etc.)
|
||||
* audio (sample rate changes etc.). Note when nulled, the
|
||||
* audio device only supports single sample rate/format and
|
||||
* DFU is not supported either since this channel is used
|
||||
* to carry messages about format, rate and DFU state
|
||||
* \param c_mix_ctl Optional chanend to be connected to the mixer thread if
|
||||
* present
|
||||
* \param c_clk_ctl Optional chanend to be connected to the clockgen thread if
|
||||
@@ -25,7 +28,7 @@
|
||||
* \param c_EANativeTransport_ctrl Optional chanend to be connected to EA Native
|
||||
* endpoint manager if present
|
||||
*/
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl,
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend ?c_audioCtrl,
|
||||
chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu ?dfuInterface
|
||||
VENDOR_REQUESTS_PARAMS_DEC_);
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
VERSION = 1.2.0
|
||||
VERSION = 3.1.0
|
||||
|
||||
DEPENDENT_MODULES = lib_logging(>=3.0.0) \
|
||||
lib_xassert(>=4.0.0) \
|
||||
lib_xud(>=1.0.0) \
|
||||
lib_xud(>=2.0.1) \
|
||||
lib_spdif(>=4.0.0) \
|
||||
lib_mic_array(>=4.0.0)
|
||||
lib_mic_array(>=4.0.0) \
|
||||
lib_locks(>=2.0.3)
|
||||
|
||||
MODULE_XCC_FLAGS = $(XCC_FLAGS) \
|
||||
-O3 \
|
||||
@@ -40,7 +41,6 @@ INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \
|
||||
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 \
|
||||
@@ -58,7 +58,6 @@ SOURCE_DIRS = src/core \
|
||||
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 \
|
||||
|
||||
@@ -72,13 +72,8 @@
|
||||
|
||||
//int ksp_enter, ksp_exit, r11_store;
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
#define ISSUE_MODE_SINGLE ".issue_mode single\n"
|
||||
#define ISSUE_MODE_DUAL ".issue_mode dual\n"
|
||||
#else
|
||||
#define ISSUE_MODE_SINGLE
|
||||
#define ISSUE_MODE_DUAL
|
||||
#endif
|
||||
|
||||
#define do_interrupt_handler(f,args) \
|
||||
asm(ISSUE_MODE_SINGLE\
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include "xua.h"
|
||||
#if XUA_USB_EN
|
||||
@@ -21,8 +21,10 @@
|
||||
#include "testct_byref.h"
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#include "xua_hid_report.h"
|
||||
#include "user_hid.h"
|
||||
unsigned char g_hidData[HID_DATA_BYTES] = {0};
|
||||
#include "xua_hid.h"
|
||||
unsigned char g_hidData[HID_MAX_DATA_BYTES] = {0U};
|
||||
#endif
|
||||
|
||||
void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max);
|
||||
@@ -91,7 +93,7 @@ unsigned int fb_clocks[4];
|
||||
void XUA_Buffer(
|
||||
register chanend c_aud_out,
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
register chanend c_aud_in,
|
||||
register chanend c_aud_in,
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||
chanend c_aud_fb,
|
||||
@@ -196,7 +198,7 @@ unsafe{volatile unsigned * unsafe masterClockFreq_ptr;}
|
||||
*/
|
||||
void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
register chanend c_aud_in,
|
||||
register chanend c_aud_in,
|
||||
#endif
|
||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||
chanend c_aud_fb,
|
||||
@@ -371,7 +373,14 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
XUD_SetReady_In(ep_hid, g_hidData, 1);
|
||||
|
||||
while (!hidIsReportDescriptorPrepared())
|
||||
;
|
||||
|
||||
UserHIDInit();
|
||||
unsigned hid_ready_flag = 0U;
|
||||
unsigned hid_ready_id = 0U;
|
||||
|
||||
#endif
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
@@ -381,6 +390,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
timer tmr;
|
||||
|
||||
while(1)
|
||||
{
|
||||
XUD_Result_t result;
|
||||
@@ -437,9 +448,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
if(receivedSampleFreq != AUDIO_STOP_FOR_DFU)
|
||||
{
|
||||
sampleFreq = receivedSampleFreq;
|
||||
#ifdef FB_TOLERANCE_TEST
|
||||
#ifdef FB_TOLERANCE_TEST
|
||||
expected_fb = ((sampleFreq * 0x2000) / frameTime);
|
||||
#endif
|
||||
#endif
|
||||
/* Reset FB */
|
||||
/* Note, Endpoint 0 will hold off host for a sufficient period to allow our feedback
|
||||
* to stabilise (i.e. sofCount == 128 to fire) */
|
||||
@@ -700,7 +711,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#endif
|
||||
sofCount++;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
#if (NUM_USB_CHAN_IN > 0)
|
||||
/* Sent audio packet DEVICE -> HOST */
|
||||
@@ -708,8 +719,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
{
|
||||
/* Inform stream that buffer sent */
|
||||
SET_SHARED_GLOBAL0(g_aud_to_host_flag, bufferIn+1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (NUM_USB_CHAN_OUT > 0)
|
||||
@@ -729,8 +740,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
{
|
||||
XUD_SetReady_In(ep_aud_fb, (fb_clocks, unsigned char[]), 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
/* Received Audio packet HOST -> DEVICE. Datalength written to length */
|
||||
case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result):
|
||||
@@ -741,164 +752,165 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
|
||||
/* Sync with decouple thread */
|
||||
SET_SHARED_GLOBAL0(g_aud_from_host_flag, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MIDI
|
||||
case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result):
|
||||
case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result):
|
||||
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
/* Get buffer data from host - MIDI OUT from host always into a single buffer */
|
||||
midi_data_remaining_to_device = length;
|
||||
|
||||
midi_from_host_rdptr = midi_from_host_buffer;
|
||||
|
||||
if (midi_data_remaining_to_device)
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
read_via_xc_ptr(datum, midi_from_host_rdptr);
|
||||
outuint(c_midi, datum);
|
||||
midi_from_host_rdptr += 4;
|
||||
midi_data_remaining_to_device -= 4;
|
||||
/* Get buffer data from host - MIDI OUT from host always into a single buffer */
|
||||
midi_data_remaining_to_device = length;
|
||||
|
||||
midi_from_host_rdptr = midi_from_host_buffer;
|
||||
|
||||
if (midi_data_remaining_to_device)
|
||||
{
|
||||
read_via_xc_ptr(datum, midi_from_host_rdptr);
|
||||
outuint(c_midi, datum);
|
||||
midi_from_host_rdptr += 4;
|
||||
midi_data_remaining_to_device -= 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
/* MIDI IN to host */
|
||||
case XUD_SetData_Select(c_midi_to_host, ep_midi_to_host, result):
|
||||
/* MIDI IN to host */
|
||||
case XUD_SetData_Select(c_midi_to_host, ep_midi_to_host, result):
|
||||
|
||||
/* The buffer has been sent to the host, so we can ack the midi thread */
|
||||
if (midi_data_collected_from_device != 0)
|
||||
{
|
||||
/* Swap the collecting and sending buffer */
|
||||
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
||||
/* The buffer has been sent to the host, so we can ack the midi thread */
|
||||
if (midi_data_collected_from_device != 0)
|
||||
{
|
||||
/* Swap the collecting and sending buffer */
|
||||
swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent);
|
||||
|
||||
/* Request to send packet */
|
||||
XUD_SetReady_InPtr(ep_midi_to_host, midi_to_host_buffer_being_sent, midi_data_collected_from_device);
|
||||
/* Request to send packet */
|
||||
XUD_SetReady_InPtr(ep_midi_to_host, midi_to_host_buffer_being_sent, midi_data_collected_from_device);
|
||||
|
||||
/* Mark as waiting for host to poll us */
|
||||
midi_waiting_on_send_to_host = 1;
|
||||
/* Reset the collected data count */
|
||||
midi_data_collected_from_device = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
midi_waiting_on_send_to_host = 0;
|
||||
}
|
||||
break;
|
||||
/* Mark as waiting for host to poll us */
|
||||
midi_waiting_on_send_to_host = 1;
|
||||
/* Reset the collected data count */
|
||||
midi_data_collected_from_device = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
midi_waiting_on_send_to_host = 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef IAP
|
||||
/* IAP OUT from host. Datalength writen to tmp */
|
||||
case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result):
|
||||
/* IAP OUT from host. Datalength writen to tmp */
|
||||
case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result):
|
||||
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
iap_data_remaining_to_device = length;
|
||||
|
||||
if(iap_data_remaining_to_device)
|
||||
if((result == XUD_RES_OKAY) && (length > 0))
|
||||
{
|
||||
// Send length first so iAP thread knows how much data to expect
|
||||
// Don't expect ack from this to make it simpler
|
||||
outuint(c_iap, iap_data_remaining_to_device);
|
||||
iap_data_remaining_to_device = length;
|
||||
|
||||
/* Send out first byte in buffer */
|
||||
datum_iap = iap_from_host_buffer[0];
|
||||
outuint(c_iap, datum_iap);
|
||||
if(iap_data_remaining_to_device)
|
||||
{
|
||||
// Send length first so iAP thread knows how much data to expect
|
||||
// Don't expect ack from this to make it simpler
|
||||
outuint(c_iap, iap_data_remaining_to_device);
|
||||
|
||||
/* Set read ptr to next byte in buffer */
|
||||
iap_from_host_rdptr = 1;
|
||||
iap_data_remaining_to_device -= 1;
|
||||
/* Send out first byte in buffer */
|
||||
datum_iap = iap_from_host_buffer[0];
|
||||
outuint(c_iap, datum_iap);
|
||||
|
||||
/* Set read ptr to next byte in buffer */
|
||||
iap_from_host_rdptr = 1;
|
||||
iap_data_remaining_to_device -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
/* IAP IN to host */
|
||||
case XUD_SetData_Select(c_iap_to_host, ep_iap_to_host, result):
|
||||
/* IAP IN to host */
|
||||
case XUD_SetData_Select(c_iap_to_host, ep_iap_to_host, result):
|
||||
|
||||
if(result == XUD_RES_RST)
|
||||
{
|
||||
XUD_ResetEndpoint(ep_iap_to_host, null);
|
||||
if(result == XUD_RES_RST)
|
||||
{
|
||||
XUD_ResetEndpoint(ep_iap_to_host, null);
|
||||
#ifdef IAP_INT_EP
|
||||
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
||||
XUD_ResetEndpoint(ep_iap_to_host_int, null);
|
||||
#endif
|
||||
iap_send_reset(c_iap);
|
||||
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
||||
iap_data_collected_from_device = 0;
|
||||
iap_data_remaining_to_device = -1;
|
||||
iap_expected_data_length = 0;
|
||||
iap_from_host_rdptr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send out an iAP packet to host, ACK last msg from iAP to let it know we can move on..*/
|
||||
iap_send_ack(c_iap);
|
||||
}
|
||||
break; /* IAP IN to host */
|
||||
iap_send_reset(c_iap);
|
||||
iap_draining_chan = 1; // Drain c_iap until a reset is sent back
|
||||
iap_data_collected_from_device = 0;
|
||||
iap_data_remaining_to_device = -1;
|
||||
iap_expected_data_length = 0;
|
||||
iap_from_host_rdptr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send out an iAP packet to host, ACK last msg from iAP to let it know we can move on..*/
|
||||
iap_send_ack(c_iap);
|
||||
}
|
||||
break; /* IAP IN to host */
|
||||
|
||||
#ifdef IAP_INT_EP
|
||||
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result):
|
||||
case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result):
|
||||
|
||||
/* Do nothing.. */
|
||||
/* Note, could get a reset notification here, but deal with it in the case above */
|
||||
break;
|
||||
/* Do nothing.. */
|
||||
/* Note, could get a reset notification here, but deal with it in the case above */
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
/* iAP EA Native Transport OUT from host */
|
||||
case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result):
|
||||
if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0)
|
||||
{
|
||||
// Notify EA Protocol user code we have iOS app data from XUD
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_DATA);
|
||||
}
|
||||
break;
|
||||
/* iAP EA Native Transport OUT from host */
|
||||
case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result):
|
||||
if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0)
|
||||
{
|
||||
// Notify EA Protocol user code we have iOS app data from XUD
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_DATA);
|
||||
}
|
||||
break;
|
||||
|
||||
/* iAP EA Native Transport IN to host */
|
||||
case XUD_SetData_Select(c_iap_ea_native_in, ep_iap_ea_native_in, result):
|
||||
switch (result)
|
||||
{
|
||||
case XUD_RES_RST:
|
||||
XUD_ResetEndpoint(ep_iap_ea_native_in, null);
|
||||
// Notify user code of USB reset to allow any state to be cleared
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_RESET;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
/* iAP EA Native Transport IN to host */
|
||||
case XUD_SetData_Select(c_iap_ea_native_in, ep_iap_ea_native_in, result):
|
||||
switch (result)
|
||||
{
|
||||
case XUD_RES_RST:
|
||||
XUD_ResetEndpoint(ep_iap_ea_native_in, null);
|
||||
// Notify user code of USB reset to allow any state to be cleared
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_RESET;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
|
||||
case XUD_RES_OKAY: // EA Protocol user data successfully passed to XUD
|
||||
// Notify user code
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_DATA_SENT;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//::
|
||||
case XUD_RES_OKAY: // EA Protocol user data successfully passed to XUD
|
||||
// Notify user code
|
||||
iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL);
|
||||
// Set up the control flag to send to EA Protocol user code when it responds
|
||||
iap_ea_native_control_flag = EA_NATIVE_DATA_SENT;
|
||||
iap_ea_native_control_to_send = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//::
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
/* HID Report Data */
|
||||
/* HID Report Data */
|
||||
case XUD_SetData_Select(c_hid, ep_hid, result):
|
||||
{
|
||||
g_hidData[0]=0;
|
||||
UserHIDGetData(g_hidData);
|
||||
XUD_SetReady_In(ep_hid, g_hidData, 1);
|
||||
}
|
||||
break;
|
||||
hid_ready_flag = 0U;
|
||||
unsigned reportTime;
|
||||
tmr :> reportTime;
|
||||
hidCaptureReportTime(hid_ready_id, reportTime);
|
||||
hidCalcNextReportTime(hid_ready_id);
|
||||
hidClearChangePending(hid_ready_id);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef MIDI
|
||||
/* Received word from MIDI thread - Check for ACK or Data */
|
||||
/* Received word from MIDI thread - Check for ACK or Data */
|
||||
case midi_get_ack_or_data(c_midi, is_ack, datum):
|
||||
if (is_ack)
|
||||
{
|
||||
/* An ack from the midi/uart thread means it has accepted some data we sent it
|
||||
* we are okay to send another word */
|
||||
* we are okay to send another word */
|
||||
if (midi_data_remaining_to_device <= 0)
|
||||
{
|
||||
/* We have read an entire packet - Mark ready to receive another */
|
||||
@@ -963,7 +975,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
if (is_ack_iap)
|
||||
{
|
||||
/* An ack from the iap/uart thread means it has accepted some data we sent it
|
||||
* we are okay to send another word */
|
||||
* we are okay to send another word */
|
||||
if (iap_data_remaining_to_device == 0)
|
||||
{
|
||||
/* We have read an entire packet - Mark ready to receive another */
|
||||
@@ -996,7 +1008,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
}
|
||||
else
|
||||
{
|
||||
// Too many events from device - drop
|
||||
// Too many events from device - drop
|
||||
}
|
||||
|
||||
/* Once we have the whole message, sent it to host */
|
||||
@@ -1034,7 +1046,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
}
|
||||
break;
|
||||
|
||||
# if IAP_EA_NATIVE_TRANS
|
||||
# if IAP_EA_NATIVE_TRANS
|
||||
/* Change of EA Native Transport interface setting */
|
||||
case inuint_byref(c_iap_ea_native_ctrl, iap_ea_native_interface_alt_setting):
|
||||
/* Handshake */
|
||||
@@ -1092,6 +1104,26 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#if ( 0 < HID_CONTROLS )
|
||||
if (!hid_ready_flag)
|
||||
{
|
||||
for (unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); id++)
|
||||
{
|
||||
if ( hidIsChangePending(id) || !HidIsSetIdleSilenced(id) )
|
||||
{
|
||||
int hidDataLength = (int) UserHIDGetData(id, g_hidData);
|
||||
XUD_SetReady_In(ep_hid, g_hidData, hidDataLength);
|
||||
|
||||
hid_ready_id = id;
|
||||
hid_ready_flag = 1U;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
//::
|
||||
#endif
|
||||
|
||||
@@ -1099,7 +1131,6 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* XUA_USB_EN */
|
||||
|
||||
@@ -66,7 +66,7 @@ enum USBInterfaceNumber
|
||||
INTERFACE_COUNT /* End marker */
|
||||
};
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#ifndef ENDPOINT_INT_INTERVAL_IN_HID
|
||||
#define ENDPOINT_INT_INTERVAL_IN_HID 0x08
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#include "vendorrequests.h"
|
||||
|
||||
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
|
||||
unsigned short unitId, unsigned char direction, chanend c_audioControl,
|
||||
unsigned short unitId, unsigned char direction, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
NULLABLE_RESOURCE(chanend, c_mix_ctl),
|
||||
NULLABLE_RESOURCE(chanend, c_clk_ctL)) __attribute__ ((weak));
|
||||
|
||||
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
|
||||
unsigned short unitId, unsigned char direction, chanend c_audioControl,
|
||||
unsigned short unitId, unsigned char direction, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
NULLABLE_RESOURCE(chanend, c_mix_ctl),
|
||||
NULLABLE_RESOURCE(chanend, c_clk_ctL))
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
int VendorAudioRequests(XUD_ep ep0_out, XUD_ep ep0_in, unsigned char bRequest, unsigned char cs, unsigned char cn,
|
||||
unsigned short unitId, unsigned char direction, chanend c_audioControl,
|
||||
unsigned short unitId, unsigned char direction, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
NULLABLE_RESOURCE(chanend, c_mix_ctl),
|
||||
NULLABLE_RESOURCE(chanend, c_clk_ctL));
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <xassert.h>
|
||||
#include "xua.h"
|
||||
|
||||
#if XUA_USB_EN
|
||||
@@ -23,18 +24,24 @@
|
||||
#include "vendorrequests.h"
|
||||
#include "xc_ptr.h"
|
||||
#include "xua_ep0_uacreqs.h"
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#include "hid.h"
|
||||
#include "xua_hid.h"
|
||||
#include "xua_hid_report.h"
|
||||
#endif
|
||||
|
||||
#if DSD_CHANS_DAC > 0
|
||||
#include "dsd_support.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_UNIT XUA_EP0
|
||||
|
||||
#ifndef DEBUG_PRINT_ENABLE_XUA_EP0
|
||||
#define DEBUG_PRINT_ENABLE_XUA_EP0 0
|
||||
#endif // DEBUG_PRINT_ENABLE_XUA_EP0
|
||||
#include "debug_print.h"
|
||||
|
||||
#include "debug_print.h"
|
||||
#include "xua_usb_params_funcs.h"
|
||||
|
||||
#ifndef __XC__
|
||||
@@ -51,7 +58,7 @@
|
||||
#if ((AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK)) && defined(DFU)
|
||||
#warning DFU will not be enabled in AUDIO 1.0 mode due to Windows requesting driver
|
||||
#endif
|
||||
#endif
|
||||
#endif // FORCE_UAC1_DFU
|
||||
|
||||
/* MIDI not supported in Audio 1.0 mode */
|
||||
#if ((AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK)) && defined(MIDI)
|
||||
@@ -85,9 +92,6 @@ extern void device_reboot(void);
|
||||
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#include "xua_hid.h"
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
@@ -391,7 +395,7 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcd) {
|
||||
#endif // AUDIO_CLASS == 1}
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||
{
|
||||
ep0_out = XUD_InitEp(c_ep0_out);
|
||||
@@ -478,6 +482,8 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
|
||||
/* Check if device has started in DFU mode */
|
||||
if (DFUReportResetState(null))
|
||||
{
|
||||
assert((c_audioControl != NULL) && msg("DFU not supported when c_audioControl is null"));
|
||||
|
||||
/* Stop audio */
|
||||
outuint(c_audioControl, SET_SAMPLE_FREQ);
|
||||
outuint(c_audioControl, AUDIO_STOP_FOR_DFU);
|
||||
@@ -518,9 +524,26 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont
|
||||
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
hidReportInit();
|
||||
hidPrepareReportDescriptor();
|
||||
|
||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||
unsigned char hidReportDescriptorLengthLo = hidReportDescriptorLength & 0xFF;
|
||||
unsigned char hidReportDescriptorLengthHi = (hidReportDescriptorLength & 0xFF00) >> 8;
|
||||
|
||||
#if( AUDIO_CLASS == 1 )
|
||||
cfgDesc_Audio1[USB_HID_DESCRIPTOR_OFFSET + HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
||||
cfgDesc_Audio1[USB_HID_DESCRIPTOR_OFFSET + HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
||||
#endif
|
||||
|
||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
||||
#endif // 0 < HID_CONTROLS
|
||||
|
||||
}
|
||||
|
||||
void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||
{
|
||||
if (result == XUD_RES_OKAY)
|
||||
@@ -547,6 +570,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
/* Only send change if we need to */
|
||||
if((sp.wValue > 0) && (g_curStreamAlt_Out != sp.wValue))
|
||||
{
|
||||
assert((c_audioControl != null) && msg("Format change not supported when c_audioControl is null"));
|
||||
g_curStreamAlt_Out = sp.wValue;
|
||||
|
||||
/* Send format of data onto buffering */
|
||||
@@ -582,6 +606,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
/* Only send change if we need to */
|
||||
if((sp.wValue > 0) && (g_curStreamAlt_In != sp.wValue))
|
||||
{
|
||||
assert((c_audioControl != null) && msg("Format change not supported when c_audioControl is null"));
|
||||
g_curStreamAlt_In = sp.wValue;
|
||||
|
||||
/* Send format of data onto buffering */
|
||||
@@ -729,15 +754,22 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
switch (descriptorType)
|
||||
{
|
||||
case HID_HID:
|
||||
/* Return HID Descriptor */
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
||||
sizeof(hidDescriptor), sp.wLength);
|
||||
{
|
||||
/* Return HID Descriptor */
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
||||
sizeof(hidDescriptor), sp.wLength);
|
||||
}
|
||||
break;
|
||||
case HID_REPORT:
|
||||
/* Return HID report descriptor */
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptor,
|
||||
sizeof(hidReportDescriptor), sp.wLength);
|
||||
break;
|
||||
{
|
||||
/* Return HID report descriptor */
|
||||
unsigned char* hidReportDescriptorPtr;
|
||||
hidReportDescriptorPtr = hidGetReportDescriptor();
|
||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptorPtr,
|
||||
hidReportDescriptorLength, sp.wLength);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -819,6 +851,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
if ((DFU_IF == INTERFACE_NUMBER_DFU) && (sp.bRequest != XMOS_DFU_SAVESTATE) &&
|
||||
(sp.bRequest != XMOS_DFU_RESTORESTATE))
|
||||
{
|
||||
assert((c_audioControl != null) && msg("DFU not supported when c_audioControl is null"));
|
||||
// Stop audio
|
||||
outuint(c_audioControl, SET_SAMPLE_FREQ);
|
||||
outuint(c_audioControl, AUDIO_STOP_FOR_DFU);
|
||||
@@ -1061,7 +1094,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
}
|
||||
|
||||
/* Endpoint 0 function. Handles all requests to the device */
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||
{
|
||||
USB_SetupPacket_t sp;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */
|
||||
#include "usbaudiocommon.h"
|
||||
#include "xud_device.h"
|
||||
#include "usbaudio20.h" /* Defines from USB Audio 2.0 spec */
|
||||
#include "xua_hid_descriptor.h"
|
||||
|
||||
#ifdef IAP_EA_NATIVE_TRANS
|
||||
#include "iap2.h" /* Defines iAP EA Native Transport protocol name */
|
||||
@@ -580,33 +580,6 @@ unsigned char devQualDesc_Null[] =
|
||||
#define MIXER_LENGTH (0)
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */
|
||||
{
|
||||
0x05, 0x01, /* Usage Page (Generic Desktop) */
|
||||
0x09, 0x06, /* Usage (Keyboard) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x04, /* Report Count (4) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x00, /* Logical Maximum (0) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0x95, 0x01, /* Report Count (1) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x05, 0x0C, /* Usage Page (Consumer) */
|
||||
0x0a, 0x21, 0x02, /* Usage (AC Search) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0x0a, 0x26, 0x02, /* Usage (AC Stop) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x05, 0x07, /* Usage Page (Key Codes) */
|
||||
0x19, 0x72, /* Usage Minimum (Keyboard F23) */
|
||||
0x29, 0x73, /* Usage Maximum (Keyboard F24) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||
0xc0 /* End collection (Application) */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Max packet sizes:
|
||||
* Samples per channel. e.g (192000+7999/8000) = 24
|
||||
* Must allow 1 sample extra per chan (24 + 1) = 25
|
||||
@@ -808,7 +781,7 @@ typedef struct
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
USB_Descriptor_Interface_t HID_Interface;
|
||||
unsigned char hidDesc[9]; //TODO ideally we would have a struct for this.
|
||||
USB_HID_Descriptor_t HID_Descriptor;
|
||||
USB_Descriptor_Endpoint_t HID_In_Endpoint;
|
||||
#endif
|
||||
|
||||
@@ -1939,7 +1912,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
.wLockDelay = 0x0008,
|
||||
},
|
||||
#endif /* (INPUT_FORMAT_COUNT > 2) */
|
||||
#endif /* #if(NUM_USB_CHAN_IN > 0) */
|
||||
#endif /* (NUM_USB_CHAN_IN > 0) */
|
||||
|
||||
#ifdef MIDI
|
||||
/* MIDI Descriptors */
|
||||
@@ -2204,60 +2177,24 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
||||
#endif /* IAP */
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
.HID_Interface =
|
||||
{
|
||||
9, /* 0 bLength : Size of descriptor in Bytes */
|
||||
4, /* 1 bDescriptorType (Interface: 0x04)*/
|
||||
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
||||
0, /* 3 bAlternateSetting : Value used alternate interfaces using SetInterface Request */
|
||||
1, /* 4: bNumEndpoints : Number of endpoitns for this interface (excluding 0) */
|
||||
3, /* 5: bInterfaceClass */
|
||||
0, /* 6: bInterfaceSubClass - no boot device */
|
||||
0, /* 7: bInterfaceProtocol*/
|
||||
0, /* 8 iInterface */
|
||||
},
|
||||
|
||||
{
|
||||
9, /* 0 bLength : Size of descriptor in Bytes */
|
||||
0x21, /* 1 bDescriptorType (HID) */
|
||||
0x10, /* 2 bcdHID */
|
||||
0x01, /* 3 bcdHID */
|
||||
0, /* 4 bCountryCode */
|
||||
1, /* 5 bNumDescriptors */
|
||||
0x22, /* 6 bDescriptorType[0] (Report) */
|
||||
sizeof(hidReportDescriptor) & 0xff,/* 7 wDescriptorLength[0] */
|
||||
sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */
|
||||
},
|
||||
|
||||
.HID_In_Endpoint =
|
||||
{
|
||||
/* Endpoint descriptor (IN) */
|
||||
0x7, /* 0 bLength */
|
||||
5, /* 1 bDescriptorType */
|
||||
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
||||
3, /* 3 bmAttributes (INTERRUPT) */
|
||||
64, /* 4 wMaxPacketSize */
|
||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||
}
|
||||
#include "xua_hid_descriptors.h"
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif /* (AUDIO_CLASS == 2) */
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#if (AUDIO_CLASS ==1 )
|
||||
unsigned char hidDescriptor[] =
|
||||
{
|
||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
||||
0x21, /* 1 bDescriptorType (HID) */
|
||||
0x10, /* 2 bcdHID */
|
||||
0x01, /* 3 bcdHID */
|
||||
0x00, /* 4 bCountryCode */
|
||||
0x01, /* 5 bNumDescriptors */
|
||||
0x22, /* 6 bDescriptorType[0] (Report) */
|
||||
sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */
|
||||
sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */
|
||||
#include "xua_hid_descriptor_contents.h"
|
||||
};
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
unsigned char* hidDescriptor = (unsigned char*) &cfgDesc_Audio2.HID_Descriptor;
|
||||
#else
|
||||
#error "Unknown Audio Class"
|
||||
#endif
|
||||
#endif // 0 < HID_CONTROLS
|
||||
|
||||
|
||||
/* Configuration Descriptor for Null device */
|
||||
@@ -2362,6 +2299,12 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
/*
|
||||
* The value of HID_INTERFACE_BYTES must match the length of the descriptors defined in
|
||||
* - xua_hid_descriptor_contents.h
|
||||
* - xua_hid_endpoint_descriptor_contents.h and
|
||||
* - xua_hid_interface_descriptor_contents.h
|
||||
*/
|
||||
#define HID_INTERFACE_BYTES ( 9 + 9 + 7 )
|
||||
#define HID_INTERFACES_A1 1
|
||||
#else
|
||||
@@ -2403,6 +2346,10 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
||||
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES)
|
||||
#endif
|
||||
|
||||
#define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16)
|
||||
|
||||
#if (MIN_FREQ_FS < 12000) && (MAX_FREQ_FS > 48000)
|
||||
@@ -2906,36 +2853,7 @@ unsigned char cfgDesc_Audio1[] =
|
||||
#endif
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
/* HID interface descriptor */
|
||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
||||
0x04, /* 1 bDescriptorType (Interface: 0x04)*/
|
||||
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
||||
0x00, /* 3 bAlternateSetting : Value used alternate interfaces using SetInterface Request */
|
||||
0x01, /* 4: bNumEndpoints : Number of endpoitns for this interface (excluding 0) */
|
||||
0x03, /* 5: bInterfaceClass */
|
||||
0x00, /* 6: bInterfaceSubClass - no boot device */
|
||||
0x00, /* 7: bInterfaceProtocol*/
|
||||
0x00, /* 8 iInterface */
|
||||
|
||||
/* HID descriptor */
|
||||
0x09, /* 0 bLength : Size of descriptor in Bytes */
|
||||
0x21, /* 1 bDescriptorType (HID) */
|
||||
0x10, /* 2 bcdHID */
|
||||
0x01, /* 3 bcdHID */
|
||||
0x00, /* 4 bCountryCode */
|
||||
0x01, /* 5 bNumDescriptors */
|
||||
0x22, /* 6 bDescriptorType[0] (Report) */
|
||||
sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */
|
||||
sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */
|
||||
|
||||
/* HID Endpoint descriptor (IN) */
|
||||
0x07, /* 0 bLength */
|
||||
0x05, /* 1 bDescriptorType */
|
||||
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
||||
0x03, /* 3 bmAttributes (INTERRUPT) */
|
||||
0x40, /* 4 wMaxPacketSize */
|
||||
0x00, /* 5 wMaxPacketSize */
|
||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||
#include "xua_hid_descriptors.h"
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
@@ -1285,4 +1285,4 @@ XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket
|
||||
return XUD_RES_ERR;
|
||||
}
|
||||
#endif
|
||||
#endif /* NO_USB */
|
||||
#endif /* XUA_USB_EN */
|
||||
|
||||
@@ -187,23 +187,15 @@ on tile[XUD_TILE] : clock clk_spd_rx = CLKBLK_SPDIF_RX;
|
||||
#endif
|
||||
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
in port p_pdm_clk = PORT_PDM_CLK;
|
||||
in port p_pdm_clk = PORT_PDM_CLK;
|
||||
|
||||
in buffered port:32 p_pdm_mics = PORT_PDM_DATA;
|
||||
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;
|
||||
in port p_pdm_mclk = PORT_PDM_MCLK;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if(XUD_SERIES_SUPPORT == XUD_L_SERIES) && (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. */
|
||||
on tile[XUD_TILE] : clock clk_adat_rx = CLKBLK_ADAT_RX;
|
||||
#endif
|
||||
|
||||
on tile[AUDIO_IO_TILE] : clock clk_audio_mclk = CLKBLK_MCLK; /* Master clock */
|
||||
|
||||
#if(AUDIO_IO_TILE != XUD_TILE) && XUA_USB_EN
|
||||
@@ -212,17 +204,7 @@ on tile[XUD_TILE] : clock clk_audio_mclk_usb = CLKBLK_MCLK;
|
||||
on tile[XUD_TILE] : in port p_mclk_in_usb = PORT_MCLK_IN_USB;
|
||||
#endif
|
||||
|
||||
on tile[AUDIO_IO_TILE] : clock clk_audio_bclk = CLKBLK_I2S_BIT; /* Bit clock */
|
||||
|
||||
|
||||
/* L/G Series needs a port to use for USB reset */
|
||||
#if (XUD_SERIES_SUPPORT != XUD_U_SERIES) && defined(PORT_USB_RESET)
|
||||
/* This define is checked since it could be on a shift reg or similar */
|
||||
on tile[XUD_TILE] : out port p_usb_rst = PORT_USB_RESET;
|
||||
#else
|
||||
/* Reset port not required for U series due to built in Phy */
|
||||
#define p_usb_rst null
|
||||
#endif
|
||||
on tile[AUDIO_IO_TILE] : clock clk_audio_bclk = CLKBLK_I2S_BIT; /* Bit clock */
|
||||
|
||||
#ifdef IAP
|
||||
/* I2C ports - in a struct for use with module_i2c_shared & module_i2c_simple/module_i2c_single_port */
|
||||
@@ -346,8 +328,7 @@ VENDOR_REQUESTS_PARAMS_DEC_
|
||||
|
||||
/* USB Interface Core */
|
||||
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
|
||||
c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
|
||||
null, 0, usbSpeed, XUD_PWR_CFG);
|
||||
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, XUD_PWR_CFG);
|
||||
}
|
||||
|
||||
/* USB Packet buffering Core */
|
||||
@@ -445,7 +426,7 @@ void SpdifTxWrapper(chanend c_spdif_tx)
|
||||
}
|
||||
#endif
|
||||
|
||||
void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
|
||||
void usb_audio_io(chanend ?c_aud_in,
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
chanend c_spdif_tx,
|
||||
#endif
|
||||
@@ -573,11 +554,6 @@ int main()
|
||||
chan c_ea_data;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SU1_ADC_ENABLE
|
||||
chan c_adc;
|
||||
#else
|
||||
#define c_adc null
|
||||
#endif
|
||||
|
||||
#ifdef MIXER
|
||||
chan c_mix_ctl;
|
||||
@@ -661,7 +637,7 @@ int main()
|
||||
|
||||
on tile[AUDIO_IO_TILE]:
|
||||
{
|
||||
usb_audio_io(c_mix_out, c_adc
|
||||
usb_audio_io(c_mix_out
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
, c_spdif_tx
|
||||
#endif
|
||||
@@ -727,11 +703,6 @@ int main()
|
||||
{
|
||||
set_thread_fast_mode_on();
|
||||
|
||||
#if(XUD_SERIES_SUPPORT == XUD_L_SERIES)
|
||||
/* Can't use REF clock on L-series as this is usb clock */
|
||||
set_port_clock(p_adat_rx, clk_adat_rx);
|
||||
start_clock(clk_adat_rx);
|
||||
#endif
|
||||
while (1)
|
||||
{
|
||||
adatReceiver48000(p_adat_rx, c_adat_rx);
|
||||
@@ -767,11 +738,6 @@ int main()
|
||||
#endif /*MIC_PROCESSING_USE_INTERFACE*/
|
||||
#endif /*XUA_NUM_PDM_MICS > 0*/
|
||||
#endif /*PDM_RECORD*/
|
||||
|
||||
|
||||
#ifdef SU1_ADC_ENABLE
|
||||
xs1_su_adc_service(c_adc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
// Copyright 2018-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
//#include "devicedefines.h"
|
||||
|
||||
#define MAX_MIX_COUNT 8
|
||||
#define MIX_INPUTS 18
|
||||
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
|
||||
#define DOMIX_TOP(i) \
|
||||
.cc_top doMix##i.function,doMix##i; \
|
||||
.align 4 ;\
|
||||
@@ -50,52 +46,6 @@ doMix##i##: ;\
|
||||
.size doMix##i, .-doMix##i; \
|
||||
.cc_bottom doMix##i##.function;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#define DOMIX_TOP(i) \
|
||||
.cc_top doMix##i.function,doMix##i; \
|
||||
.align 4 ;\
|
||||
.globl doMix##i ;\
|
||||
.type doMix##i, @function ;\
|
||||
.globl doMix##i##.nstackwords ;\
|
||||
.globl doMix##i##.maxthreads ; \
|
||||
.globl doMix##i##.maxtimers ; \
|
||||
.globl doMix##i##.maxchanends ; \
|
||||
.globl doMix##i##.maxsync ;\
|
||||
.linkset doMix##i##.locnoside, 1; \
|
||||
.linkset doMix##i##.locnochandec, 1;\
|
||||
.linkset doMix##i##.nstackwords, 0 ;\
|
||||
.linkset doMix##i##.maxchanends, 0 ;\
|
||||
.linkset doMix##i##.maxtimers, 0 ;\
|
||||
.linkset doMix##i##.maxthreads, 1; \
|
||||
doMix##i##: ;\
|
||||
set cp, r0; \
|
||||
set dp, r1; \
|
||||
lsub r0, r1, r0, r0, r0;\
|
||||
.label_##i##:
|
||||
|
||||
#define DOMIX_BOT(i) \
|
||||
ldap r11, _dp; \
|
||||
set dp, r11;\
|
||||
ldap r11, _cp;\
|
||||
set cp, r11;\
|
||||
\
|
||||
mov r0, r1;\
|
||||
ldc r2, 0x19;\
|
||||
sext r0, r2;\
|
||||
eq r0, r0, r1;\
|
||||
bf r0, .L20; \
|
||||
\
|
||||
shl r0, r1, 0x7;\
|
||||
retsp 0x0;\
|
||||
\
|
||||
\
|
||||
.size doMix##i, .-doMix##i; \
|
||||
.cc_bottom doMix##i##.function;
|
||||
|
||||
#endif
|
||||
|
||||
#define N MIX_INPUTS
|
||||
#define BODY(i) \
|
||||
ldw r2,cp[i]; \
|
||||
@@ -115,8 +65,6 @@ doMix##i##: ;\
|
||||
retsp 0x0; \
|
||||
|
||||
|
||||
|
||||
|
||||
#if(MAX_MIX_COUNT > 0)
|
||||
DOMIX_TOP(0)
|
||||
#include "repeat.h"
|
||||
|
||||
@@ -62,37 +62,12 @@ unsigned int divide, unsigned curSamFreq)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
unsafe
|
||||
{
|
||||
/* Clock bitclock clock block from master clock pin (divided) */
|
||||
configure_clock_src_divide(clk_audio_bclk, (port) p_mclk_in, (divide/2));
|
||||
configure_port_clock_output(p_bclk, clk_audio_bclk);
|
||||
}
|
||||
#else
|
||||
#error XS1 no longer supported in audio core
|
||||
/* For a divide of one (i.e. bitclock == master-clock) BClk is set to clock_output mode.
|
||||
* In this mode it outputs an edge clock on every tick of itsassociated clock_block.
|
||||
*
|
||||
* For all other divides, BClk is clocked by the master clock and data
|
||||
* will be output to p_bclk to generate the bit clock.
|
||||
*/
|
||||
if (divide == 1) /* e.g. 176.4KHz from 11.2896 */
|
||||
{
|
||||
configure_port_clock_output(p_bclk, clk_audio_mclk);
|
||||
|
||||
/* Generate bit clock block straight from mclk */
|
||||
configure_clock_src(clk_audio_bclk, p_mclk_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* bit clock port from master clock clock-clock block */
|
||||
configure_out_port_no_ready(p_bclk, clk_audio_mclk, 0);
|
||||
|
||||
/* Generate bit clock block from pin */
|
||||
configure_clock_src(clk_audio_bclk, p_bclk);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!isnull(p_lrclk))
|
||||
{
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef ARCH_U_POWER_SAVING_
|
||||
#define ARCH_U_POWER_SAVING_
|
||||
|
||||
/* Sets the voltage down by VOLTAGE_REDUCTION_mV (voltage is set to 10 * X + 600 mV),
|
||||
* and adjusts other features to save power
|
||||
*/
|
||||
void archU_powerSaving();
|
||||
|
||||
#endif /*ARCH_U_POWER_SAVING_*/
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#if (XUD_SERIES_SUPPORT==1)
|
||||
#include "archU_powerSaving.h"
|
||||
#include <xs1.h>
|
||||
#include <xs1_l_registers.h>
|
||||
#include <xs1_su_registers.h>
|
||||
#include <platform.h>
|
||||
|
||||
#if (XCC_MAJOR_VERSION >= 1300)
|
||||
#include <hwtimer.h>
|
||||
#else
|
||||
#define hwtimer_t timer
|
||||
#endif
|
||||
|
||||
#ifndef VOLTAGE_REDUCTION_mV
|
||||
#define VOLTAGE_REDUCTION_mV 20
|
||||
#endif
|
||||
|
||||
unsigned get_tile_id(tileref t); // Required for use with 12.0 tools. get_tile_id() available in xs1.h with 13.0 tools.
|
||||
|
||||
#define ARCH_U_VOLTAGE_FIRST_STEP 39 // First step down from 1V
|
||||
#define ARCH_U_SSWITCH_PRESCALER 8 // Sswitch down to 1/8 clk freq
|
||||
|
||||
void archU_powerSaving()
|
||||
{
|
||||
if (get_local_tile_id() == get_tile_id(tile[0]))
|
||||
{
|
||||
unsigned writeval[1];
|
||||
unsigned char writevalc[1];
|
||||
|
||||
// Reduce the VDDCORE voltage level
|
||||
for (unsigned count=0; count < (VOLTAGE_REDUCTION_mV/10); count++)
|
||||
{
|
||||
hwtimer_t t;
|
||||
int time;
|
||||
|
||||
writeval[0] = (ARCH_U_VOLTAGE_FIRST_STEP - count);
|
||||
write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_VOUT1_LVL_NUM, 1, writeval);
|
||||
|
||||
t :> time;
|
||||
time += (1 * PLATFORM_REFERENCE_MHZ); // Wait 1us per step
|
||||
t when timerafter(time) :> void;
|
||||
}
|
||||
|
||||
// Set switch prescaler down
|
||||
write_node_config_reg(tile[0], XS1_SSWITCH_CLK_DIVIDER_NUM, (ARCH_U_SSWITCH_PRESCALER - 1)); // PLL clk will be divided by value + 1
|
||||
|
||||
// Both DC-DCs in PWM mode, I/O and PLL supply on, Analogue & core on
|
||||
writeval[0] = XS1_SU_PWR_VOUT1_EN_SET(0, 1);
|
||||
writeval[0] = XS1_SU_PWR_VOUT2_EN_SET(writeval[0], 1);
|
||||
writeval[0] = XS1_SU_PWR_VOUT5_EN_SET(writeval[0], 1);
|
||||
writeval[0] = XS1_SU_PWR_VOUT6_EN_SET(writeval[0], 1);
|
||||
write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_STATE_AWAKE_NUM, 1, writeval);
|
||||
|
||||
// USB suspend off, voltage adjustable, sleep clock 32KHz
|
||||
writeval[0] = XS1_SU_PWR_USB_PD_EN_SET(0, 1);
|
||||
writeval[0] = XS1_SU_PWR_RST_VOUT_LVL_SET(writeval[0], 1);
|
||||
writeval[0] = XS1_SU_PWR_LD_AWAKE_SET(writeval[0], 1);
|
||||
write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_MISC_CTRL_NUM, 1, writeval);
|
||||
|
||||
// Turn off on-chip silicon oscillator (20MHz or 32KHz)
|
||||
writevalc[0] = XS1_SU_ON_SI_OSC_EN_SET(0, 1);
|
||||
writevalc[0] = XS1_SU_ON_SI_OSC_SLOW_SET(writevalc[0], 1);
|
||||
write_periph_8(usb_tile, XS1_SU_PER_OSC_CHANEND_NUM, XS1_SU_PER_OSC_ON_SI_CTRL_NUM, 1, writevalc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,18 +5,9 @@
|
||||
#include <print.h>
|
||||
#include <xs1_su.h>
|
||||
|
||||
#define XS1_SU_PERIPH_USB_ID 0x1
|
||||
|
||||
//Normally we would enumerate the XUD_SERIES_SUPPORT possibilities using defines in
|
||||
//xud.h but we have hard coded them to remove dependancy of sc_xud
|
||||
|
||||
#if (XUD_SERIES_SUPPORT == 4)
|
||||
#include "xs2_su_registers.h"
|
||||
#define XS2_SU_PERIPH_USB_ID 0x1
|
||||
#define PLL_MASK 0x3FFFFFFF
|
||||
#else
|
||||
#define PLL_MASK 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
/* Note, this function is prototyped in xs1.h only from 13 tools onwards */
|
||||
unsigned get_tile_id(tileref);
|
||||
@@ -38,22 +29,12 @@ static void reset_tile(unsigned const tileId)
|
||||
*/
|
||||
void device_reboot(void)
|
||||
{
|
||||
#if (XUD_SERIES_SUPPORT == 1)
|
||||
/* Disconnect from bus */
|
||||
unsigned data[] = {4};
|
||||
write_periph_32(usb_tile, XS1_SU_PERIPH_USB_ID, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 1, data);
|
||||
|
||||
/* Ideally we would reset SU1 here but then we loose power to the xcore and therefore the DFU flag */
|
||||
/* Disable USB and issue reset to xcore only - not analogue chip */
|
||||
write_node_config_reg(usb_tile, XS1_SU_CFG_RST_MISC_NUM,0b10);
|
||||
#else
|
||||
|
||||
unsigned int localTileId = get_local_tile_id();
|
||||
unsigned int tileId;
|
||||
unsigned int tileArrayLength;
|
||||
unsigned int localTileNum;
|
||||
|
||||
#if (XUD_SERIES_SUPPORT == 4)
|
||||
#if defined(__XS2A__)
|
||||
/* Disconnect from bus */
|
||||
unsigned data[] = {4};
|
||||
write_periph_32(usb_tile, XS2_SU_PERIPH_USB_ID, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 1, data);
|
||||
@@ -75,24 +56,14 @@ void device_reboot(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
/* Reset all even tiles, starting from the remote ones */
|
||||
for(int tileNum = tileArrayLength-2; tileNum>=0; tileNum-=2)
|
||||
#else
|
||||
/* Reset all tiles, starting from the remote ones */
|
||||
for(int tileNum = tileArrayLength-1; tileNum>=0; tileNum--)
|
||||
#endif
|
||||
{
|
||||
/* Cannot cast tileref to unsigned! */
|
||||
tileId = get_tile_id(tile[tileNum]);
|
||||
|
||||
/* Do not reboot local tile (or tiles residing on the same node) yet */
|
||||
#if defined(__XS2A__) || defined(__XS3A__)
|
||||
if((localTileNum | 1) != (tileNum | 1))
|
||||
|
||||
#else
|
||||
if(localTileNum != tileNum)
|
||||
#endif
|
||||
{
|
||||
reset_tile(tileId);
|
||||
}
|
||||
@@ -100,7 +71,6 @@ void device_reboot(void)
|
||||
|
||||
/* Finally reboot the node this tile resides on */
|
||||
reset_tile(localTileId);
|
||||
#endif
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -4,46 +4,14 @@
|
||||
#ifndef _UAC_HWRESOURCES_H_
|
||||
#define _UAC_HWRESOURCES_H_
|
||||
|
||||
#if XUA_USB_EN
|
||||
#include "xud.h" /* XMOS USB Device Layer defines and functions */
|
||||
#endif
|
||||
|
||||
#if ((XUD_SERIES_SUPPORT != XUD_U_SERIES) && (XUD_SERIES_SUPPORT != XUD_X200_SERIES))
|
||||
|
||||
/* XUD_L_SERIES and XUD_G_SERIES */
|
||||
|
||||
#if (AUDIO_IO_TILE == XUD_TILE)
|
||||
/* Note: L series ref clocked clocked from USB clock when USB enabled - use another clockblock for MIDI
|
||||
* if MIDI and XUD on same tile. See XUD documentation.
|
||||
*
|
||||
* This is a clash with S/PDIF Tx but simultaneous S/PDIF and MIDI not currently supported on single tile device
|
||||
*
|
||||
*/
|
||||
#define CLKBLK_MIDI XS1_CLKBLK_1;
|
||||
#else
|
||||
#define CLKBLK_MIDI XS1_CLKBLK_REF;
|
||||
#endif
|
||||
|
||||
#define CLKBLK_SPDIF_TX XS1_CLKBLK_1
|
||||
#define CLKBLK_SPDIF_RX XS1_CLKBLK_1
|
||||
#define CLKBLK_MCLK XS1_CLKBLK_2 /* Note, potentially used twice */
|
||||
#define CLKBLK_ADAT_RX XS1_CLKBLK_3
|
||||
#define CLKBLK_USB_RST XS1_CLKBLK_4 /* Clock block passed into L/G series XUD */
|
||||
#define CLKBLK_FLASHLIB XS1_CLKBLK_5 /* Clock block for use by flash lib */
|
||||
|
||||
#define CLKBLK_I2S_BIT XS1_CLKBLK_3
|
||||
|
||||
#else
|
||||
|
||||
/* XUD_U_SERIES, XUD_X200_SERIES */
|
||||
/* Note, U-series XUD uses clock blocks 4 and 5 - see XUD_Ports.xc */
|
||||
#define CLKBLK_MIDI XS1_CLKBLK_REF;
|
||||
#define CLKBLK_SPDIF_TX XS1_CLKBLK_1
|
||||
#define CLKBLK_SPDIF_RX XS1_CLKBLK_1
|
||||
#define CLKBLK_MCLK XS1_CLKBLK_2 /* Note, potentially used twice */
|
||||
#define CLKBLK_MCLK XS1_CLKBLK_2
|
||||
#define CLKBLK_FLASHLIB XS1_CLKBLK_3 /* Clock block for use by flash lib */
|
||||
#define CLKBLK_ADAT_RX XS1_CLKBLK_REF /* Use REF for ADAT_RX on U/x200 series */
|
||||
#define CLKBLK_I2S_BIT XS1_CLKBLK_3
|
||||
#endif
|
||||
|
||||
#endif /* _UAC_HWRESOURCES_H_ */
|
||||
|
||||
@@ -1,66 +1,60 @@
|
||||
// Copyright 2013-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) API
|
||||
*
|
||||
* This file defines the Application Programming Interface (API) used to record HID
|
||||
* events and retrieve a HID Report for sending to a host.
|
||||
* The using application has the responsibility to fulfill this API.
|
||||
* Document section numbers refer to the HID Device Class Definition, version 1.11.
|
||||
*/
|
||||
|
||||
#ifndef __USER_HID_H__
|
||||
#define __USER_HID_H__
|
||||
|
||||
/**
|
||||
* \brief HID event identifiers
|
||||
*
|
||||
* This enumeration defines a constant value for each HID event.
|
||||
* It defines one value for each of the four GPI pins supported in the standard voice products.
|
||||
* It defines a further 28 values for generic events.
|
||||
*/
|
||||
typedef enum hidEventId_t {
|
||||
HID_EVENT_ID_GPI0 = 0,
|
||||
HID_EVENT_ID_GPI1,
|
||||
HID_EVENT_ID_GPI2,
|
||||
HID_EVENT_ID_GPI3,
|
||||
HID_EVENT_ID_EVT0,
|
||||
HID_EVENT_ID_EVT1,
|
||||
HID_EVENT_ID_EVT2,
|
||||
HID_EVENT_ID_EVT3,
|
||||
HID_EVENT_ID_EVT4,
|
||||
HID_EVENT_ID_EVT5,
|
||||
HID_EVENT_ID_EVT6,
|
||||
HID_EVENT_ID_EVT7,
|
||||
HID_EVENT_ID_EVT8,
|
||||
HID_EVENT_ID_EVT9,
|
||||
HID_EVENT_ID_EVT10,
|
||||
HID_EVENT_ID_EVT11,
|
||||
HID_EVENT_ID_EVT12,
|
||||
HID_EVENT_ID_EVT13,
|
||||
HID_EVENT_ID_EVT14,
|
||||
HID_EVENT_ID_EVT15,
|
||||
HID_EVENT_ID_EVT16,
|
||||
HID_EVENT_ID_EVT17,
|
||||
HID_EVENT_ID_EVT18,
|
||||
HID_EVENT_ID_EVT19,
|
||||
HID_EVENT_ID_EVT20,
|
||||
HID_EVENT_ID_EVT21,
|
||||
HID_EVENT_ID_EVT22,
|
||||
HID_EVENT_ID_EVT23,
|
||||
HID_EVENT_ID_EVT24,
|
||||
HID_EVENT_ID_EVT25,
|
||||
HID_EVENT_ID_EVT26,
|
||||
HID_EVENT_ID_EVT27,
|
||||
HID_EVENT_ID_INVALID = 0xffffffff,
|
||||
} hidEventId_t;
|
||||
#include <stddef.h>
|
||||
|
||||
#define HID_DATA_BYTES 4
|
||||
/**
|
||||
* \brief HID event
|
||||
*
|
||||
* This struct identifies:
|
||||
* - the HID Report that reports an event, i.e., the ID,
|
||||
* - the location within the HID Report for the event, i.e., the byte and bit, and
|
||||
* - the value to report for that location (typically interpreted as a Boolean).
|
||||
* It assumes only single bit flags within the HID Report.
|
||||
*/
|
||||
typedef struct hidEvent_t {
|
||||
unsigned bit;
|
||||
unsigned byte;
|
||||
unsigned id;
|
||||
unsigned value;
|
||||
} hidEvent_t;
|
||||
|
||||
#define HID_MAX_DATA_BYTES ( 4 )
|
||||
#define HID_EVENT_INVALID_ID ( 0x100 )
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
|
||||
/**
|
||||
* \brief Get the data for the next HID report
|
||||
* \brief Get the data for the next HID Report
|
||||
*
|
||||
* \note This function returns the HID data as a list of unsigned char because the
|
||||
* \c XUD_SetReady_In() accepts data for transmission to the USB Host using
|
||||
* this type.
|
||||
*
|
||||
* \param{out} hidData The HID data
|
||||
* \param[in] id The HID Report ID (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* Set to zero if the application provides only one HID Report
|
||||
* which does not include a Report ID
|
||||
* \param[out] hidData The HID data
|
||||
* If using Report IDs, this function places the Report ID in
|
||||
* the first element; otherwise the first element holds the
|
||||
* first byte of HID event data.
|
||||
*
|
||||
* \returns The length of the HID Report in the \a hidData argument
|
||||
* \retval Zero means no new HID event data has been recorded for the given \a id
|
||||
*/
|
||||
void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]);
|
||||
size_t UserHIDGetData( const unsigned id, unsigned char hidData[ HID_MAX_DATA_BYTES ]);
|
||||
|
||||
/**
|
||||
* \brief Initialize HID processing
|
||||
@@ -70,17 +64,18 @@ void UserHIDInit( void );
|
||||
/**
|
||||
* \brief Record that a HID event has occurred
|
||||
*
|
||||
* \param{in} hidEventId The identifier of an event which has occurred
|
||||
* \param{in} hidEventData A list of data associated with the event
|
||||
* \param{in} hidEventDataSize The length of the event data list
|
||||
* \param[in] hidEvent A list of events which have occurred.
|
||||
* Each element specifies a HID Report ID, a bit and byte
|
||||
* within the HID Report and the value for it.
|
||||
* Set the Report ID to zero if not using Report IDs
|
||||
* (see 5.6, 6.2.2.7, 8.1 and 8.2).
|
||||
* \param[in] hidEventCnt The length of the \a hidEvent list.
|
||||
*
|
||||
* \note At present, this function only takes a single element of event data, i.e.
|
||||
* hidEventDataSize must equal 1.
|
||||
*
|
||||
* \note At present, this function treats the event data as a Boolean flag.
|
||||
* Zero means False; all other values mean True.
|
||||
* \returns The index of the first unrecorded event in \a hidEvent
|
||||
* \retval Zero indicates no events were recorded
|
||||
* \retval \a hidEventCnt indicates all events were recorded
|
||||
*/
|
||||
void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize );
|
||||
size_t UserHIDRecordEvent( const hidEvent_t hidEvent[], const size_t hidEventCnt );
|
||||
|
||||
#endif /* ( 0 < HID_CONTROLS ) */
|
||||
#endif /* __USER_HID_H__ */
|
||||
|
||||
@@ -5,19 +5,18 @@
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
|
||||
#ifndef NO_USB
|
||||
#if XUA_USB_EN
|
||||
#include "xud_device.h"
|
||||
#include "dfu_types.h"
|
||||
#include "flash_interface.h"
|
||||
#include "dfu_interface.h"
|
||||
|
||||
#if (XUD_SERIES_SUPPORT==4)
|
||||
/* xCORE-200 */
|
||||
#if defined(__XS2A__)
|
||||
/* Note range 0x7FFC8 - 0x7FFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0x7ffcc
|
||||
#else
|
||||
/* Note range 0x1FFC8 - 0x1FFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0x1ffcc
|
||||
/* Note range 0xFFFC8 - 0xFFFFF guarenteed to be untouched by tools */
|
||||
#define FLAG_ADDRESS 0xfffcc
|
||||
#endif
|
||||
|
||||
/* Store Flag to fixed address */
|
||||
@@ -581,6 +580,6 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, ch
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
#endif /* NO_USB */
|
||||
#endif /* XUA_USB_EN */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -90,9 +90,9 @@ int flash_cmd_enable_ports()
|
||||
|
||||
#ifdef DFU_FLASH_DEVICE
|
||||
#ifdef QUAD_SPI_FLASH
|
||||
result = fl_connectToDevice(&p_qflash, flash_devices, 1);
|
||||
result = fl_connectToDevice(&p_qflash, flash_devices, sizeof(flash_devices) / sizeof(fl_QuadDeviceSpec));
|
||||
#else
|
||||
result = fl_connectToDevice(&p_flash, flash_devices, 1);
|
||||
result = fl_connectToDevice(&p_flash, flash_devices, sizeof(flash_devices) / sizeof(fl_DeviceSpec));
|
||||
#endif
|
||||
#else
|
||||
/* Use default flash list */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 XMOS LIMITED.
|
||||
// Copyright 2019-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <stdint.h>
|
||||
#include <xs1.h>
|
||||
@@ -7,38 +7,19 @@
|
||||
#include "xud.h"
|
||||
#include "xud_std_requests.h"
|
||||
#include "xua_hid.h"
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#define DEBUG_UNIT HID_XC
|
||||
#define DEBUG_PRINT_ENABLE_HID_XC 0
|
||||
#include "debug_print.h"
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#define MS_IN_TICKS 100000U
|
||||
|
||||
static unsigned s_hidChangePending = 0U;
|
||||
static unsigned s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS;
|
||||
static unsigned s_hidIdleActive = 0U;
|
||||
static unsigned s_hidIndefiniteDuration = 0U;
|
||||
static unsigned s_hidNextReportTime = 0U;
|
||||
static unsigned s_hidReportTime = 0U;
|
||||
|
||||
unsafe {
|
||||
volatile unsigned * unsafe s_hidChangePendingPtr = &s_hidChangePending;
|
||||
}
|
||||
|
||||
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
||||
static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime );
|
||||
static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod );
|
||||
static XUD_Result_t HidProcessSetIdleRequest( XUD_ep c_ep0_out, XUD_ep c_ep0_in, USB_SetupPacket_t &sp );
|
||||
static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime );
|
||||
|
||||
void HidCalcNextReportTime( void )
|
||||
{
|
||||
s_hidNextReportTime = s_hidReportTime + s_hidCurrentPeriod;
|
||||
}
|
||||
|
||||
void HidCaptureReportTime( void )
|
||||
{
|
||||
timer tmr;
|
||||
tmr :> s_hidReportTime;
|
||||
}
|
||||
|
||||
XUD_Result_t HidInterfaceClassRequests(
|
||||
XUD_ep c_ep0_out,
|
||||
XUD_ep c_ep0_in,
|
||||
@@ -58,47 +39,28 @@ XUD_Result_t HidInterfaceClassRequests(
|
||||
return result;
|
||||
}
|
||||
|
||||
void HidClearChangePending( void )
|
||||
unsigned HidIsSetIdleSilenced( const unsigned id )
|
||||
{
|
||||
unsafe {
|
||||
*s_hidChangePendingPtr = 0U;
|
||||
}
|
||||
}
|
||||
unsigned isSilenced = hidIsIdleActive( id );
|
||||
|
||||
unsigned HidIsChangePending( void )
|
||||
{
|
||||
return( s_hidChangePending != 0 );
|
||||
}
|
||||
if( !isSilenced ) {
|
||||
unsigned currentTime;
|
||||
// Use inline assembly to access the time without creating a side-effect.
|
||||
// The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case.
|
||||
// Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality.
|
||||
asm volatile( "gettime %0" : "=r" ( currentTime ));
|
||||
isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime )));
|
||||
}
|
||||
|
||||
unsigned HidIsSetIdleSilenced( void )
|
||||
{
|
||||
unsigned isSilenced = s_hidIdleActive;
|
||||
|
||||
if( s_hidIdleActive ) {
|
||||
unsigned currentTime;
|
||||
// Use inline assembly to access the time without creating a side-effect.
|
||||
// The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case.
|
||||
// Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality.
|
||||
asm volatile( "gettime %0" : "=r" ( currentTime ));
|
||||
isSilenced = ( s_hidIndefiniteDuration || ( timeafter( s_hidNextReportTime, currentTime )));
|
||||
}
|
||||
|
||||
return isSilenced;
|
||||
}
|
||||
|
||||
void HidSetChangePending( void )
|
||||
{
|
||||
unsafe {
|
||||
*s_hidChangePendingPtr = 1;
|
||||
}
|
||||
return isSilenced;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Calculate the timer value for sending the next HID Report.
|
||||
*
|
||||
* With regard to Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human
|
||||
* Interface Devices (HID) Version 1.11, I've interpreted 'currently executing period' and
|
||||
* 'current period' to mean the previously established Set Idle duration if one has been
|
||||
* Interface Devices (HID) Version 1.11, 'currently executing period' and 'current period' have
|
||||
* been interpreted to mean the previously established Set Idle duration if one has been
|
||||
* established or the polling interval from the HID Report Descriptor if a Set Idle duration
|
||||
* has not been established.
|
||||
*
|
||||
@@ -112,7 +74,7 @@ void HidSetChangePending( void )
|
||||
*/
|
||||
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod )
|
||||
{
|
||||
unsigned nextReportTime = 0;
|
||||
unsigned nextReportTime = 0U;
|
||||
|
||||
if( HidFindSetIdleActivationPoint( currentPeriod, reportToSetIdleInterval )) {
|
||||
/* Activate immediately after sending the next HID Report */
|
||||
@@ -171,6 +133,29 @@ static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, con
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Configure a hid report's next report time and idle status based on a setidle request
|
||||
*
|
||||
* \param[in] reportId -- The report ID to modify
|
||||
* \param[in] reportDuration -- The duration of the setidle request
|
||||
*
|
||||
*/
|
||||
static void HidUpdateReportPeriod( unsigned reportId, unsigned reportDuration ) {
|
||||
unsigned currentPeriod = hidGetReportPeriod( reportId );
|
||||
|
||||
hidSetIdle( reportId, ( 0U == reportDuration ) || ( ENDPOINT_INT_INTERVAL_IN_HID < reportDuration ));
|
||||
|
||||
if( hidIsIdleActive( reportId )) {
|
||||
unsigned reportTime = hidGetReportTime( reportId );
|
||||
unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( reportTime );
|
||||
unsigned nextReportTime = HidCalcNewReportTime( currentPeriod, reportTime, reportToSetIdleInterval, reportDuration * MS_IN_TICKS );
|
||||
hidSetNextReportTime( reportId, nextReportTime );
|
||||
currentPeriod = reportDuration * MS_IN_TICKS;
|
||||
}
|
||||
|
||||
hidSetReportPeriod( reportId, currentPeriod );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Process a Set Idle request
|
||||
*
|
||||
@@ -208,20 +193,24 @@ static XUD_Result_t HidProcessSetIdleRequest( XUD_ep c_ep0_out, XUD_ep c_ep0_in,
|
||||
|
||||
Any Interface value other than INTERFACE_NUMBER_HID indicates an error by the USB Host.
|
||||
*/
|
||||
if(( 0U == reportId ) && ( INTERFACE_NUMBER_HID == interfaceNum )) {
|
||||
s_hidIdleActive = (( 0U == duration ) || ( ENDPOINT_INT_INTERVAL_IN_HID < duration ));
|
||||
if( INTERFACE_NUMBER_HID == interfaceNum ) {
|
||||
if( hidIsReportIdValid( reportId ) ) {
|
||||
HidUpdateReportPeriod( reportId, duration );
|
||||
|
||||
if( s_hidIdleActive ) {
|
||||
unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( s_hidReportTime );
|
||||
s_hidNextReportTime = HidCalcNewReportTime( s_hidCurrentPeriod, s_hidReportTime, reportToSetIdleInterval, duration * MS_IN_TICKS );
|
||||
s_hidCurrentPeriod = duration * MS_IN_TICKS;
|
||||
s_hidIndefiniteDuration = ( 0U == duration );
|
||||
} else {
|
||||
s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS;
|
||||
s_hidIndefiniteDuration = 0U;
|
||||
result = XUD_DoSetRequestStatus( c_ep0_in );
|
||||
}
|
||||
else if ( reportId == 0U ) {
|
||||
// Wildcard request - set all report IDs to idle
|
||||
unsigned startReportId = hidGetNextValidReportId(reportId);
|
||||
|
||||
result = XUD_DoSetRequestStatus( c_ep0_in );
|
||||
reportId = startReportId;
|
||||
do {
|
||||
HidUpdateReportPeriod( reportId, duration );
|
||||
reportId = hidGetNextValidReportId( reportId );
|
||||
} while( reportId != startReportId);
|
||||
|
||||
result = XUD_DoSetRequestStatus( c_ep0_in );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
853
lib_xua/src/hid/hid_report.c
Normal file
853
lib_xua/src/hid/hid_report.c
Normal file
@@ -0,0 +1,853 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <xs1.h>
|
||||
|
||||
#include "descriptor_defs.h"
|
||||
#include "xua_hid_report.h"
|
||||
#include "hid_report_descriptor.h"
|
||||
#include "swlock.h"
|
||||
|
||||
|
||||
#define HID_REPORT_ITEM_LOCATION_SIZE ( 1 )
|
||||
#define HID_REPORT_DESCRIPTOR_ITEM_COUNT ( sizeof hidReportDescriptorItems / sizeof ( USB_HID_Short_Item_t* ))
|
||||
#define HID_REPORT_DESCRIPTOR_MAX_LENGTH ( HID_REPORT_DESCRIPTOR_ITEM_COUNT * \
|
||||
( sizeof ( USB_HID_Short_Item_t ) - HID_REPORT_ITEM_LOCATION_SIZE ))
|
||||
|
||||
swlock_t hidStaticVarLock = SWLOCK_INITIAL_VALUE;
|
||||
|
||||
/*
|
||||
* Each element in s_hidChangePending corresponds to an element in hidReports.
|
||||
*/
|
||||
|
||||
static unsigned s_hidChangePending[ HID_REPORT_COUNT ];
|
||||
static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ];
|
||||
static size_t s_hidReportDescriptorLength;
|
||||
static unsigned s_hidReportDescriptorPrepared;
|
||||
|
||||
static unsigned s_hidCurrentPeriod[ HID_REPORT_COUNT ];
|
||||
static unsigned s_hidIdleActive[ HID_REPORT_COUNT ];
|
||||
static unsigned s_hidNextReportTime[ HID_REPORT_COUNT ];
|
||||
static unsigned s_hidReportTime[ HID_REPORT_COUNT ];
|
||||
|
||||
/**
|
||||
* @brief Get the bit position from the location of a report element
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] location The \c location field from a \c USB_HID_Report_Element_t
|
||||
*
|
||||
* @return The bit position of the report element
|
||||
*/
|
||||
static unsigned hidGetElementBitLocation( const unsigned short location );
|
||||
|
||||
/**
|
||||
* @brief Get the byte position from the location of a report element
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] location The \c location field from a \c USB_HID_Report_Element_t
|
||||
*
|
||||
* @return The byte position of the report element within the HID report
|
||||
*/
|
||||
static unsigned hidGetElementByteLocation( const unsigned short location );
|
||||
|
||||
/**
|
||||
* @brief Get the report identifier from the location of a report element
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] location The \c location field from a \c USB_HID_Report_Element_t
|
||||
*
|
||||
* @return The report id of the report element within the HID report
|
||||
*/
|
||||
static unsigned hidGetElementReportId( const unsigned short location );
|
||||
|
||||
/**
|
||||
* @brief Get the report length from the location of a report element
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] location The \c location field from a \c USB_HID_Report_Element_t
|
||||
*
|
||||
* @return The length of the HID report
|
||||
*/
|
||||
static size_t hidGetElementReportLength( const unsigned short location );
|
||||
|
||||
/**
|
||||
* @brief Get the number of data bytes from the header of an Item
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] header The \c header field from a \c USB_HID_Short_Item
|
||||
*
|
||||
* @return The amount of data for the Item
|
||||
*/
|
||||
static unsigned hidGetItemSize( const unsigned char header );
|
||||
|
||||
/**
|
||||
* @brief Get the Tag from the header of an Item
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] header The \c header field from a \c USB_HID_Short_Item
|
||||
*
|
||||
* @return The Tag of the Item
|
||||
*/
|
||||
static unsigned hidGetItemTag( const unsigned char header );
|
||||
|
||||
/**
|
||||
* @brief Get the Type from the header of an Item
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] header The \c header field from a \c USB_HID_Short_Item
|
||||
*
|
||||
* @return The Type of the Item
|
||||
*/
|
||||
static unsigned hidGetItemType( const unsigned char header );
|
||||
|
||||
/**
|
||||
* @brief Get the Usage Page number for a given byte in the HID Report
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The HID Report ID for the Usage Page.
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @return The USB HID Usage Page code or zero if the \a id parameter is out-of-range
|
||||
*/
|
||||
static unsigned hidGetUsagePage( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Translate an Item from the \c USB_HID_Short_Item format to raw bytes
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] inPtr A pointer to a \c USB_HID_Short_Item
|
||||
* @param[in,out] outPtrPtr A pointer to a pointer to the next available space in the raw
|
||||
* byte buffer. Passed as a pointer to a pointer to allow this
|
||||
* function to return the updated pointer to the raw byte buffer.
|
||||
*
|
||||
* @return The number of bytes placed in the raw byte buffer
|
||||
*/
|
||||
static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr );
|
||||
|
||||
unsigned hidIsReportIdInUse ( void ) {
|
||||
return !hidIsReportIdValid(0U);
|
||||
}
|
||||
|
||||
void hidCalcNextReportTime( const unsigned id )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
s_hidNextReportTime[ idx ] = s_hidReportTime[ idx ] + s_hidCurrentPeriod[ idx ];
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidCaptureReportTime( const unsigned id, const unsigned time )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
s_hidReportTime[ idx ] = time;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidClearChangePending( const unsigned id )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if(( id == 0U ) || ( id == hidGetElementReportId( hidReports[ idx ]->location ))) {
|
||||
s_hidChangePending[ idx ] = 0U;
|
||||
break;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
static unsigned hidGetElementBitLocation( const unsigned short location )
|
||||
{
|
||||
unsigned bBit = ( location & HID_REPORT_ELEMENT_LOC_BIT_MASK ) >> HID_REPORT_ELEMENT_LOC_BIT_SHIFT;
|
||||
return bBit;
|
||||
}
|
||||
|
||||
static unsigned hidGetElementByteLocation( const unsigned short location )
|
||||
{
|
||||
unsigned bByte = ( location & HID_REPORT_ELEMENT_LOC_BYTE_MASK ) >> HID_REPORT_ELEMENT_LOC_BYTE_SHIFT;
|
||||
return bByte;
|
||||
}
|
||||
|
||||
static unsigned hidGetElementReportId( const unsigned short location )
|
||||
{
|
||||
unsigned bReportId = ( location & HID_REPORT_ELEMENT_LOC_ID_MASK ) >> HID_REPORT_ELEMENT_LOC_ID_SHIFT;
|
||||
return bReportId;
|
||||
}
|
||||
|
||||
static size_t hidGetElementReportLength( const unsigned short location )
|
||||
{
|
||||
size_t bReportLen = (size_t)( location & HID_REPORT_ELEMENT_LOC_LEN_MASK ) >> HID_REPORT_ELEMENT_LOC_LEN_SHIFT;
|
||||
return bReportLen;
|
||||
}
|
||||
|
||||
static unsigned hidGetItemSize( const unsigned char header )
|
||||
{
|
||||
unsigned bSize = ( header & HID_REPORT_ITEM_HDR_SIZE_MASK ) >> HID_REPORT_ITEM_HDR_SIZE_SHIFT;
|
||||
return bSize;
|
||||
}
|
||||
|
||||
static unsigned hidGetItemTag( const unsigned char header )
|
||||
{
|
||||
unsigned bTag = ( header & HID_REPORT_ITEM_HDR_TAG_MASK ) >> HID_REPORT_ITEM_HDR_TAG_SHIFT;
|
||||
return bTag;
|
||||
}
|
||||
|
||||
static unsigned hidGetItemType( const unsigned char header )
|
||||
{
|
||||
unsigned bType = ( header & HID_REPORT_ITEM_HDR_TYPE_MASK ) >> HID_REPORT_ITEM_HDR_TYPE_SHIFT;
|
||||
return bType;
|
||||
}
|
||||
|
||||
unsigned hidGetNextReportTime( const unsigned id ) {
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
unsigned retVal = 0U;
|
||||
|
||||
for ( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = s_hidNextReportTime[ idx ];
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned char* hidGetReportDescriptor( void )
|
||||
{
|
||||
unsigned char* retVal = NULL;
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
|
||||
if( s_hidReportDescriptorPrepared ) {
|
||||
retVal = s_hidReportDescriptor;
|
||||
}
|
||||
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
size_t hidGetReportDescriptorLength( void )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
size_t retVal = ( s_hidReportDescriptorPrepared ) ? s_hidReportDescriptorLength : 0U;
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidGetReportIdLimit ( void ) {
|
||||
unsigned retVal = 0U;
|
||||
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location );
|
||||
if( reportId >= retVal ) {
|
||||
retVal = reportId + 1;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidGetNextValidReportId ( unsigned idPrev ) {
|
||||
size_t retIndex = 0;
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location );
|
||||
if( reportId == idPrev ) {
|
||||
retIndex = (idx + 1) % HID_REPORT_COUNT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned retVal = hidGetElementReportId( hidReports[ retIndex ]->location );
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
#define HID_CONFIGURABLE_ELEMENT_COUNT ( sizeof hidConfigurableElements / sizeof ( USB_HID_Report_Element_t* ))
|
||||
unsigned hidGetReportItem(
|
||||
const unsigned id,
|
||||
const unsigned byte,
|
||||
const unsigned bit,
|
||||
unsigned char* const page,
|
||||
unsigned char* const header,
|
||||
unsigned char data[]
|
||||
)
|
||||
{
|
||||
unsigned retVal = HID_STATUS_BAD_ID;
|
||||
for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) {
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ];
|
||||
swlock_release(&hidStaticVarLock);
|
||||
|
||||
unsigned bBit = hidGetElementBitLocation( element.location );
|
||||
unsigned bByte = hidGetElementByteLocation( element.location );
|
||||
unsigned bId = hidGetElementReportId( element.location );
|
||||
|
||||
if( id == bId ) {
|
||||
retVal = HID_STATUS_BAD_LOCATION;
|
||||
|
||||
if(( bit == bBit ) && ( byte == bByte )) {
|
||||
*page = hidGetUsagePage( id );
|
||||
*header = element.item.header;
|
||||
|
||||
for( size_t dataIdx = 0U; dataIdx < HID_REPORT_ITEM_MAX_SIZE; ++data, ++dataIdx ) {
|
||||
*data = element.item.data[ dataIdx ];
|
||||
}
|
||||
|
||||
retVal = HID_STATUS_GOOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
size_t hidGetReportLength( const unsigned id )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
size_t retVal = 0U;
|
||||
if( s_hidReportDescriptorPrepared ) {
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = hidGetElementReportLength( hidReports[ idx ]->location );
|
||||
}
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidGetReportPeriod( const unsigned id )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
unsigned retVal = 0U;
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = s_hidCurrentPeriod[ idx ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidGetReportTime( const unsigned id )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
unsigned retVal = 0U;
|
||||
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = s_hidReportTime[ idx ];
|
||||
}
|
||||
}
|
||||
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static unsigned hidGetUsagePage( const unsigned id )
|
||||
{
|
||||
unsigned retVal = 0U;
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = hidReports[ idx ]->item.data[ 0 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidIsChangePending( const unsigned id )
|
||||
{
|
||||
unsigned retVal = 0U;
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = ( s_hidChangePending[ idx ] != 0U );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidIsIdleActive( const unsigned id )
|
||||
{
|
||||
unsigned retVal = 0U;
|
||||
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
retVal = ( s_hidIdleActive[ idx ] != 0U );
|
||||
break;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidIsReportDescriptorPrepared( void )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
unsigned retVal = s_hidReportDescriptorPrepared;
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidIsReportIdValid ( unsigned id ) {
|
||||
size_t retVal = 0;
|
||||
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location );
|
||||
if( reportId == id ) {
|
||||
retVal = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
swlock_release(&hidStaticVarLock);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void hidPrepareReportDescriptor( void )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
if( !s_hidReportDescriptorPrepared ) {
|
||||
s_hidReportDescriptorLength = 0U;
|
||||
unsigned char* ptr = s_hidReportDescriptor;
|
||||
|
||||
for( size_t idx = 0U; idx < HID_REPORT_DESCRIPTOR_ITEM_COUNT; ++idx ) {
|
||||
s_hidReportDescriptorLength += hidTranslateItem( hidReportDescriptorItems[ idx ], &ptr );
|
||||
}
|
||||
|
||||
s_hidReportDescriptorPrepared = 1U;
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidReportInit( void )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS * HID_REPORT_COUNT;
|
||||
}
|
||||
memset( s_hidIdleActive, 0, sizeof( s_hidIdleActive ) );
|
||||
memset( s_hidChangePending, 0, sizeof( s_hidChangePending ) );
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidResetReportDescriptor( void )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
s_hidReportDescriptorPrepared = 0U;
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidSetChangePending( const unsigned id )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
s_hidChangePending[ idx ] = 1U;
|
||||
break;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidSetIdle( const unsigned id, const unsigned state )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
s_hidIdleActive[ idx ] = ( state != 0U );
|
||||
break;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
void hidSetNextReportTime( const unsigned id, const unsigned time )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
s_hidNextReportTime[ idx ] = time;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
unsigned hidSetReportItem(
|
||||
const unsigned id,
|
||||
const unsigned byte,
|
||||
const unsigned bit,
|
||||
const unsigned char page,
|
||||
const unsigned char header,
|
||||
const unsigned char data[]
|
||||
)
|
||||
{
|
||||
unsigned retVal = HID_STATUS_IN_USE;
|
||||
|
||||
if( !s_hidReportDescriptorPrepared ) {
|
||||
retVal = HID_STATUS_BAD_ID;
|
||||
unsigned bSize = hidGetItemSize( header );
|
||||
unsigned bTag = hidGetItemTag ( header );
|
||||
unsigned bType = hidGetItemType( header );
|
||||
|
||||
if(( HID_REPORT_ITEM_MAX_SIZE < bSize ) ||
|
||||
( HID_REPORT_ITEM_USAGE_TAG != bTag ) ||
|
||||
( HID_REPORT_ITEM_USAGE_TYPE != bType )) {
|
||||
retVal = HID_STATUS_BAD_HEADER;
|
||||
} else {
|
||||
for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) {
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ];
|
||||
swlock_release(&hidStaticVarLock);
|
||||
|
||||
unsigned bBit = hidGetElementBitLocation( element.location );
|
||||
unsigned bByte = hidGetElementByteLocation( element.location );
|
||||
unsigned bId = hidGetElementReportId( element.location );
|
||||
|
||||
if( id == bId ) {
|
||||
retVal = HID_STATUS_BAD_PAGE;
|
||||
unsigned pg = hidGetUsagePage( id );
|
||||
|
||||
if( page == pg ) {
|
||||
retVal = HID_STATUS_BAD_LOCATION;
|
||||
|
||||
if(( bit == bBit ) && ( byte == bByte )) {
|
||||
element.item.header = header;
|
||||
|
||||
for( size_t dataIdx = 0U; dataIdx < bSize; ++dataIdx ) {
|
||||
element.item.data[ dataIdx ] = data[ dataIdx ];
|
||||
}
|
||||
|
||||
for( size_t dataIdx = bSize; dataIdx < HID_REPORT_ITEM_MAX_SIZE; ++dataIdx ) {
|
||||
element.item.data[ dataIdx ] = 0U;
|
||||
}
|
||||
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
*hidConfigurableElements[ elementIdx ] = element;
|
||||
swlock_release(&hidStaticVarLock);
|
||||
retVal = HID_STATUS_GOOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void hidSetReportPeriod( const unsigned id, const unsigned period )
|
||||
{
|
||||
swlock_acquire(&hidStaticVarLock);
|
||||
for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) {
|
||||
if( id == hidGetElementReportId( hidReports[ idx ]->location )) {
|
||||
s_hidCurrentPeriod[ idx ] = period;
|
||||
break;
|
||||
}
|
||||
}
|
||||
swlock_release(&hidStaticVarLock);
|
||||
}
|
||||
|
||||
static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr )
|
||||
{
|
||||
size_t count = 0U;
|
||||
*(*outPtrPtr)++ = inPtr->header;
|
||||
++count;
|
||||
|
||||
unsigned dataLength = hidGetItemSize( inPtr->header );
|
||||
for( size_t idx = 0U; idx < dataLength; ++idx ) {
|
||||
*(*outPtrPtr)++ = inPtr->data[ idx ];
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// hid_report_descriptor.h validation functions for development purposes
|
||||
|
||||
/**
|
||||
* @brief Internal HID Report Descriptor validation state
|
||||
*/
|
||||
struct HID_validation_info {
|
||||
int collectionOpenedCount; //!< Current count of open collections (to track that they are all closed)
|
||||
int reportCount; //!< Current count of defined reports (to count them)
|
||||
|
||||
int currentReportIdx; //!< Index of current report in hidReports array
|
||||
int currentConfigurableElementIdx; //!< Index of current configurable element in hidConfigurableElements array
|
||||
|
||||
unsigned char reportIds[HID_REPORT_COUNT]; // Array of report IDs (for general validation & duplication detection)
|
||||
unsigned reportUsagePage[HID_REPORT_COUNT]; // Array of the usage page for each report (for general validation)
|
||||
|
||||
unsigned current_bit_size; // State tracker for the current set report bit width (todo: should technically be a stack)
|
||||
unsigned current_bit_count; // State tracker for the current set report count (todo: should technically be a stack)
|
||||
unsigned current_bit_offset; // Current bit offset into this report (for location validation)
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Validation step for hidReportValidate, checking the info struct to ensure correctness of Report IDs
|
||||
*
|
||||
* @param info The info struct that has been built by hidReportValidate to check
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateInfoStructReportIDs( struct HID_validation_info *info ) {
|
||||
if ( info->reportCount != HID_REPORT_COUNT) {
|
||||
if ( !( info->reportCount == 0 && HID_REPORT_COUNT == 1 ) ) {
|
||||
// (Only if report IDs are being used)
|
||||
printf("Error: The number of actual reports does not match HID_REPORT_COUNT.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
for ( size_t idx1 = 0; idx1 < HID_REPORT_COUNT; ++idx1 ) {
|
||||
for ( size_t idx2 = idx1 + 1; idx2 < HID_REPORT_COUNT; ++idx2 ) {
|
||||
if ( info->reportIds[idx1] == info->reportIds[idx2] ) {
|
||||
printf("Error: Duplicate report ID 0x%02x.\n", info->reportIds[idx1]);
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( size_t idx = 0; idx < HID_REPORT_COUNT; ++idx ) {
|
||||
if ( info->reportIds[idx] != hidGetElementReportId( hidReports[idx]->location ) ) {
|
||||
printf("Error: Report ID in descriptor does not match report ID in hidReports.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
if ( info->reportCount && info->reportIds[idx] == 0 ) {
|
||||
printf("Error: Report ID 0 is invalid.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validation step for hidReportValidate, checking reports are the correct length specified in their location field
|
||||
*
|
||||
* @param info The info struct that has been built by hidReportValidate to check
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateInfoStructReportLength( struct HID_validation_info *info ) {
|
||||
if ( info->current_bit_offset % 8 ) {
|
||||
printf("Error: HID Report not byte aligned (%d bits).\n", info->current_bit_offset);
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
if ( ( info->current_bit_offset / 8 ) != hidGetElementReportLength( hidReports[info->currentReportIdx]->location ) ) {
|
||||
printf("Error: Actual report length does not match value in location field %d != %d.\n",
|
||||
( info->current_bit_offset / 8 ),
|
||||
hidGetElementReportLength( hidReports[info->currentReportIdx]->location ));
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validation step for hidReportValidate, collections are correctly opened and closed
|
||||
*
|
||||
* @param info The info struct that has been built by hidReportValidate to check
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateInfoStructCollections( struct HID_validation_info *info ) {
|
||||
if ( info->collectionOpenedCount ) {
|
||||
printf("Error: Collections not equally opened and closed.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validation step for hidReportValidate, High level - Checks the summarised information in the info struct by calling
|
||||
* the subroutines for checking.
|
||||
*
|
||||
* @param info The info struct that has been built by hidReportValidate to check
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateInfoStruct( struct HID_validation_info *info ) {
|
||||
unsigned status = hidReportValidateInfoStructCollections( info );
|
||||
if( status == HID_STATUS_GOOD ) {
|
||||
status = hidReportValidateInfoStructReportIDs( info );
|
||||
}
|
||||
if( status == HID_STATUS_GOOD ) {
|
||||
status = hidReportValidateInfoStructReportLength( info );
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Preparation step for hidReportValidate, Adds a report ID field into the information struct for validation
|
||||
*
|
||||
* @param info The info struct being built by hidReportValidate
|
||||
* @param item The ReportId item being added
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateAddReportId( struct HID_validation_info *info, const USB_HID_Short_Item_t *item ) {
|
||||
if ( info->reportCount == 0 ) {
|
||||
if ( info->current_bit_offset ) {
|
||||
printf("Error: Some elements not associated with report ID.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
info->reportUsagePage[0] = 0;
|
||||
} else {
|
||||
unsigned status = hidReportValidateInfoStructReportLength( info );
|
||||
if ( status ) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
if ( hidGetItemSize(item->header) != 1 ) {
|
||||
printf("Error: ReportId field has invalid length %d (expected 1)\n", hidGetItemSize(item->header));
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
info->reportIds[info->reportCount] = item->data[0];
|
||||
info->currentReportIdx = info->reportCount;
|
||||
info->reportCount += 1;
|
||||
info->current_bit_offset = 0;
|
||||
if ( info->reportCount > HID_REPORT_COUNT ) {
|
||||
printf("Error: HID_REPORT_COUNT does not match number of report IDs in descriptor.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Preparation step for hidReportValidate, Adds a Usage Page field into the information struct for validation
|
||||
*
|
||||
* @param info The info struct being built by hidReportValidate
|
||||
* @param item The UsagePage item being added
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateAddUsagePageItem( struct HID_validation_info *info, const USB_HID_Short_Item_t *item ) {
|
||||
|
||||
if ( info->collectionOpenedCount == 0 ) {
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
if ( info->reportUsagePage[info->currentReportIdx] ) {
|
||||
printf("Error: Multiple usage pages per report ID not supported by this implementation.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
switch (hidGetItemSize(item->header)){
|
||||
case 1:
|
||||
info->reportUsagePage[info->currentReportIdx] = item->data[0];
|
||||
break;
|
||||
case 2:
|
||||
info->reportUsagePage[info->currentReportIdx] = ((unsigned) item->data[1] << 8) + item->data[0];
|
||||
break;
|
||||
default:
|
||||
printf("Error: Invalid size for UsagePage report descriptor item.\n");
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Preparation step for hidReportValidate, Adds a Usage field into the information struct for validation
|
||||
*
|
||||
* @param info The info struct being built by hidReportValidate
|
||||
* @param item The Usage item being added
|
||||
* @return unsigned HID_STATUS value
|
||||
*/
|
||||
static unsigned hidReportValidateAddUsageItem( struct HID_validation_info *info, const USB_HID_Short_Item_t *item) {
|
||||
if ( ( info->currentConfigurableElementIdx < HID_CONFIGURABLE_ELEMENT_COUNT ) &&
|
||||
( &(hidConfigurableElements[info->currentConfigurableElementIdx]->item) == item ) ) {
|
||||
|
||||
USB_HID_Report_Element_t *element = hidConfigurableElements[info->currentConfigurableElementIdx];
|
||||
unsigned bBit = hidGetElementBitLocation( element->location );
|
||||
unsigned bByte = hidGetElementByteLocation( element->location );
|
||||
unsigned bReportId = hidGetElementReportId( element->location );
|
||||
|
||||
if ( bBit != ( info->current_bit_offset % 8 ) || bByte != ( info->current_bit_offset / 8 ) ) {
|
||||
printf("Error: Locator bit/byte setting incorrect for configurable element index %d.\n", info->currentConfigurableElementIdx);
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
if ( bReportId != info->reportIds[info->currentReportIdx] ) {
|
||||
printf("Error: Locator report ID setting incorrect for configurable element index %d.\n", info->currentConfigurableElementIdx);
|
||||
return HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
info->currentConfigurableElementIdx += 1;
|
||||
}
|
||||
return HID_STATUS_GOOD;
|
||||
}
|
||||
|
||||
unsigned hidReportValidate( void )
|
||||
{
|
||||
struct HID_validation_info info = {};
|
||||
unsigned status = HID_STATUS_GOOD;
|
||||
|
||||
// Fill in the validation info struct by iterating through the hid report items
|
||||
for ( size_t idx = 0; idx < HID_REPORT_DESCRIPTOR_ITEM_COUNT; ++idx ) {
|
||||
const USB_HID_Short_Item_t *item = hidReportDescriptorItems[idx];
|
||||
unsigned bTag = hidGetItemTag ( item->header );
|
||||
unsigned bType = hidGetItemType( item->header );
|
||||
|
||||
if ( bTag == HID_REPORT_ITEM_TAG_COLLECTION && bType == HID_REPORT_ITEM_TYPE_MAIN ) {
|
||||
info.collectionOpenedCount += 1;
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_END_COLLECTION && bType == HID_REPORT_ITEM_TYPE_MAIN ) {
|
||||
info.collectionOpenedCount -= 1;
|
||||
if ( info.collectionOpenedCount < 0 ) {
|
||||
printf("Error: Collection closed while there is no collection open.\n");
|
||||
status = HID_STATUS_BAD_REPORT_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_INPUT && bType == HID_REPORT_ITEM_TYPE_MAIN ) {
|
||||
info.current_bit_offset += (info.current_bit_size * info.current_bit_count);
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_REPORT_SIZE && bType == HID_REPORT_ITEM_TYPE_GLOBAL ) {
|
||||
info.current_bit_size = item->data[0];
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_REPORT_COUNT && bType == HID_REPORT_ITEM_TYPE_GLOBAL ) {
|
||||
info.current_bit_count = item->data[0];
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_REPORT_ID && bType == HID_REPORT_ITEM_TYPE_GLOBAL ) {
|
||||
status = hidReportValidateAddReportId( &info, item );
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_USAGE_PAGE && bType == HID_REPORT_ITEM_TYPE_GLOBAL ) {
|
||||
status = hidReportValidateAddUsagePageItem( &info, item );
|
||||
}
|
||||
else if ( bTag == HID_REPORT_ITEM_TAG_USAGE && bType == HID_REPORT_ITEM_TYPE_LOCAL ) {
|
||||
status = hidReportValidateAddUsageItem( &info, item );
|
||||
}
|
||||
|
||||
if ( status ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(status) {
|
||||
return status;
|
||||
} else {
|
||||
return hidReportValidateInfoStruct( &info );
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,12 @@
|
||||
// Copyright 2019-2021 XMOS LIMITED.
|
||||
// Copyright 2019-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) Class Request functions
|
||||
*
|
||||
* Document section numbers refer to the HID Device Class Definition, version 1.11.
|
||||
*/
|
||||
|
||||
#ifndef __XUA_HID_H__
|
||||
#define __XUA_HID_H__
|
||||
|
||||
@@ -9,49 +15,11 @@
|
||||
#include "xud.h"
|
||||
#include "xud_std_requests.h"
|
||||
|
||||
/**
|
||||
* \brief Calculate the next time to respond with a HID Report.
|
||||
*
|
||||
* If the USB Host has previously sent a valid HID Set_Idle request with
|
||||
* a duration of zero or greater than the default reporting interval,
|
||||
* the device sends HID Reports periodically or when the value of the
|
||||
* payload has changed.
|
||||
*
|
||||
* This function calculates the time for sending the next periodic
|
||||
* HID Report.
|
||||
*/
|
||||
void HidCalcNextReportTime( void );
|
||||
|
||||
/**
|
||||
* \brief Capture the time of sending the current HID Report.
|
||||
*
|
||||
* If the USB Host has previously sent a valid HID Set_Idle request with
|
||||
* a duration of zero or greater than the default reporting interval,
|
||||
* the device sends HID Reports periodically or when the value of the
|
||||
* payload has changed.
|
||||
*
|
||||
* This function captures the time when the HID Report was sent so that
|
||||
* a subsequent call to HidCalNextReportTime() can calculate the time
|
||||
* to send the next periodic HID Report.
|
||||
*/
|
||||
void HidCaptureReportTime( void );
|
||||
|
||||
XUD_Result_t HidInterfaceClassRequests(
|
||||
XUD_ep c_ep0_out,
|
||||
XUD_ep c_ep0_in,
|
||||
REFERENCE_PARAM( USB_SetupPacket_t, sp ));
|
||||
|
||||
/**
|
||||
* \brief Register that previously changed HID Report data has reported
|
||||
* to the USB Host.
|
||||
*/
|
||||
void HidClearChangePending( void );
|
||||
|
||||
/**
|
||||
* \brief Indicate if a change to the HID Report data has been received.
|
||||
*/
|
||||
unsigned HidIsChangePending( void );
|
||||
|
||||
/**
|
||||
* \brief Indicate whether to send a HID Report based on elapsed time.
|
||||
*
|
||||
@@ -64,15 +32,15 @@ unsigned HidIsChangePending( void );
|
||||
* whether or not the time to send the next periodic HID Report has
|
||||
* elapsed.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* \return A Boolean value indicating whether or not to send the HID Report.
|
||||
* \retval 1 -- Do not send the HID Report
|
||||
* \retval 0 -- Send the HID Report
|
||||
*/
|
||||
unsigned HidIsSetIdleSilenced( void );
|
||||
|
||||
/**
|
||||
* \brief Register that a change to the HID Report data has been received.
|
||||
*/
|
||||
void HidSetChangePending( void );
|
||||
unsigned HidIsSetIdleSilenced( const unsigned id );
|
||||
|
||||
#endif // __XUA_HID_H__
|
||||
|
||||
28
lib_xua/src/hid/xua_hid_descriptor.h
Normal file
28
lib_xua/src/hid/xua_hid_descriptor.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) descriptor
|
||||
*
|
||||
* This file defines the structure of the HID descriptor.
|
||||
* Document section numbers refer to the HID Device Class Definition, version 1.11.
|
||||
*/
|
||||
|
||||
#ifndef _HID_DESCRIPTOR_
|
||||
#define _HID_DESCRIPTOR_
|
||||
|
||||
#define HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ( 7 )
|
||||
|
||||
/* USB HID Descriptor (section 6.2.1) */
|
||||
typedef struct
|
||||
{
|
||||
unsigned char bLength; /* Size of the descriptor (bytes) */
|
||||
unsigned char bDescriptorType0; /* Descriptor type, a constant, 0x21 (section 7.1) */
|
||||
unsigned char bcdHID[2]; /* HID class specification release */
|
||||
unsigned char bCountryCode; /* Country code of localized hardware */
|
||||
unsigned char bNumDescriptors; /* Number of class descriptors */
|
||||
unsigned char bDescriptorType1; /* Type of 1st class descriptor (section 7.1) */
|
||||
unsigned char wDescriptorLength1[2]; /* Length in bytes of the 1st class descriptor */
|
||||
} __attribute__((packed)) USB_HID_Descriptor_t;
|
||||
|
||||
#endif // _HID_DESCRIPTOR_
|
||||
64
lib_xua/src/hid/xua_hid_descriptor_contents.h
Normal file
64
lib_xua/src/hid/xua_hid_descriptor_contents.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) Endpoint descriptors
|
||||
*
|
||||
* This file lists the contents of the HID Endpoint descriptor returned during enumeration.
|
||||
*/
|
||||
|
||||
#ifndef _HID_DESCRIPTOR_CONTENTS_
|
||||
#define _HID_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#include "xua_hid_descriptor.h"
|
||||
|
||||
#define HID_DESCRIPTOR_LENGTH_0 ( 0x09 ) /* Size of descriptor in Bytes */
|
||||
#define HID_DESCRIPTOR_TYPE_0 ( 0x21 ) /* HID 0x21 */
|
||||
#define HID_BCD_VERSION_LO ( 0x10 ) /* HID class specification release */
|
||||
#define HID_BCD_VERSION_HI ( 0x01 )
|
||||
#define HID_COUNTRY_CODE ( 0x00 ) /* Country code of localized hardware */
|
||||
#define HID_NUM_DESCRIPTORS ( 0x01 ) /* Number of class descriptors */
|
||||
#define HID_DESCRIPTOR_TYPE_1 ( 0x22 ) /* Type of 1st class descriptor, Report 0x22 */
|
||||
#define HID_DESCRIPTOR_LENGTH_1_LO ( 0x00 ) /* Length of 1st class descriptor, set to zero */
|
||||
#define HID_DESCRIPTOR_LENGTH_1_HI ( 0x00 ) /* since only pre-processor directives allowed here */
|
||||
|
||||
#endif // _HID_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
|
||||
/* HID descriptor */
|
||||
HID_DESCRIPTOR_LENGTH_0, /* 0 bLength */
|
||||
HID_DESCRIPTOR_TYPE_0, /* 1 bDescriptorType (HID) */
|
||||
HID_BCD_VERSION_LO, /* 2 bcdHID */
|
||||
HID_BCD_VERSION_HI, /* 3 bcdHID */
|
||||
HID_COUNTRY_CODE, /* 4 bCountryCode */
|
||||
HID_NUM_DESCRIPTORS, /* 5 bNumDescriptors */
|
||||
HID_DESCRIPTOR_TYPE_1, /* 6 bDescriptorType[0] */
|
||||
HID_DESCRIPTOR_LENGTH_1_LO, /* 7 wDescriptorLength[0] */
|
||||
HID_DESCRIPTOR_LENGTH_1_HI, /* 8 wDescriptorLength[0] */
|
||||
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
|
||||
.HID_Descriptor =
|
||||
{
|
||||
/* HID descriptor */
|
||||
.bLength = sizeof(USB_HID_Descriptor_t),
|
||||
.bDescriptorType0 = HID_DESCRIPTOR_TYPE_0,
|
||||
.bcdHID =
|
||||
{
|
||||
HID_BCD_VERSION_LO,
|
||||
HID_BCD_VERSION_HI,
|
||||
},
|
||||
.bCountryCode = HID_COUNTRY_CODE,
|
||||
.bNumDescriptors = HID_NUM_DESCRIPTORS,
|
||||
.bDescriptorType1 = HID_DESCRIPTOR_TYPE_1,
|
||||
.wDescriptorLength1 =
|
||||
{
|
||||
HID_DESCRIPTOR_LENGTH_1_LO,
|
||||
HID_DESCRIPTOR_LENGTH_1_HI,
|
||||
},
|
||||
},
|
||||
|
||||
#else
|
||||
#error "Unknown Audio Class"
|
||||
#endif
|
||||
20
lib_xua/src/hid/xua_hid_descriptors.h
Normal file
20
lib_xua/src/hid/xua_hid_descriptors.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) descriptors
|
||||
*
|
||||
* This file lists the contents of the HID descriptors returned during enumeration.
|
||||
* The full definition of the enumerated descriptors appears in xua_ep0_descriptors.h.
|
||||
* That file should #include the contents of this one at an appropriate point in the
|
||||
* definition of the cfgDesc_Audio1 and cfgDesc_Audio2 arrays.
|
||||
*/
|
||||
|
||||
#ifndef _HID_DESCRIPTORS_
|
||||
#define _HID_DESCRIPTORS_
|
||||
|
||||
#include "xua_hid_interface_descriptor_contents.h"
|
||||
#include "xua_hid_descriptor_contents.h"
|
||||
#include "xua_hid_endpoint_descriptor_contents.h"
|
||||
|
||||
#endif // _HID_DESCRIPTORS_
|
||||
49
lib_xua/src/hid/xua_hid_endpoint_descriptor_contents.h
Normal file
49
lib_xua/src/hid/xua_hid_endpoint_descriptor_contents.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) Endpoint descriptors
|
||||
*
|
||||
* This file lists the contents of the HID Endpoint descriptor returned during enumeration.
|
||||
*/
|
||||
|
||||
#ifndef _HID_ENDPOINT_DESCRIPTOR_CONTENTS_
|
||||
#define _HID_ENDPOINT_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#include "descriptor_defs.h"
|
||||
|
||||
#define HID_ENDPOINT_DESCRIPTOR_LENGTH ( 0x07 ) /* Size of descriptor in Bytes */
|
||||
#define HID_ENDPOINT_DESCRIPTOR_TYPE ( 0x05 ) /* Endpoint 0x05 */
|
||||
#define HID_ENDPOINT_ATTRIBUTES ( 0x03 ) /* Interrupt */
|
||||
#define HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO ( 0x40 )
|
||||
#define HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI ( 0x00 )
|
||||
|
||||
#endif // _HID_ENDPOINT_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
|
||||
/* HID Endpoint descriptor (IN) */
|
||||
HID_ENDPOINT_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||
HID_ENDPOINT_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||
ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */
|
||||
HID_ENDPOINT_ATTRIBUTES, /* 3 bmAttributes (INTERRUPT) */
|
||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO, /* 4 wMaxPacketSize */
|
||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
|
||||
.HID_In_Endpoint =
|
||||
{
|
||||
/* Endpoint descriptor (IN) */
|
||||
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||
.bDescriptorType = HID_ENDPOINT_DESCRIPTOR_TYPE,
|
||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_HID,
|
||||
.bmAttributes = HID_ENDPOINT_ATTRIBUTES,
|
||||
.wMaxPacketSize = HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO,
|
||||
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
||||
},
|
||||
|
||||
#else
|
||||
#error "Unknown Audio Class"
|
||||
#endif
|
||||
57
lib_xua/src/hid/xua_hid_interface_descriptor_contents.h
Normal file
57
lib_xua/src/hid/xua_hid_interface_descriptor_contents.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) Interface descriptor
|
||||
*
|
||||
* This file lists the contents of the HID Interface descriptor returned during enumeration.
|
||||
*/
|
||||
|
||||
#ifndef _HID_INTERFACE_DESCRIPTOR_CONTENTS_
|
||||
#define _HID_INTERFACE_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#include "descriptor_defs.h"
|
||||
|
||||
#define HID_INTERFACE_DESCRIPTOR_LENGTH ( 0x09 ) /* Size of descriptor in Bytes */
|
||||
#define HID_INTERFACE_DESCRIPTOR_TYPE ( 0x04 ) /* Interface 0x04 */
|
||||
#define HID_INTERFACE_ALTERNATE_SETTING ( 0x00 ) /* Value used alternate interfaces using SetInterface Request */
|
||||
#define HID_INTERFACE_NUMBER_OF_ENDPOINTS ( 0x01 ) /* Number of endpoitns for this interface (excluding 0) */
|
||||
#define HID_INTERFACE_CLASS ( 0x03 )
|
||||
#define HID_INTERFACE_SUBCLASS ( 0x00 ) /* No boot device */
|
||||
#define HID_INTERFACE_PROTOCOL ( 0x00 )
|
||||
#define HID_INTERFACE_STRING_DESCRIPTOR_INDEX ( 0x00 )
|
||||
|
||||
#endif // _HID_INTERFACE_DESCRIPTOR_CONTENTS_
|
||||
|
||||
#if (AUDIO_CLASS == 1)
|
||||
|
||||
/* HID interface descriptor */
|
||||
HID_INTERFACE_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||
HID_INTERFACE_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||
INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */
|
||||
HID_INTERFACE_ALTERNATE_SETTING, /* 3 bAlternateSetting */
|
||||
HID_INTERFACE_NUMBER_OF_ENDPOINTS, /* 4: bNumEndpoints */
|
||||
HID_INTERFACE_CLASS, /* 5: bInterfaceClass */
|
||||
HID_INTERFACE_SUBCLASS, /* 6: bInterfaceSubClass */
|
||||
HID_INTERFACE_PROTOCOL, /* 7: bInterfaceProtocol*/
|
||||
HID_INTERFACE_STRING_DESCRIPTOR_INDEX, /* 8 iInterface */
|
||||
|
||||
#elif (AUDIO_CLASS == 2)
|
||||
|
||||
.HID_Interface =
|
||||
{
|
||||
/* HID interface descriptor */
|
||||
.bLength = sizeof(USB_Descriptor_Interface_t),
|
||||
.bDescriptorType = HID_INTERFACE_DESCRIPTOR_TYPE,
|
||||
.bInterfaceNumber = INTERFACE_NUMBER_HID,
|
||||
.bAlternateSetting = HID_INTERFACE_ALTERNATE_SETTING,
|
||||
.bNumEndpoints = HID_INTERFACE_NUMBER_OF_ENDPOINTS,
|
||||
.bInterfaceClass = HID_INTERFACE_CLASS,
|
||||
.bInterfaceSubClass = HID_INTERFACE_SUBCLASS,
|
||||
.bInterfaceProtocol = HID_INTERFACE_PROTOCOL,
|
||||
.iInterface = HID_INTERFACE_STRING_DESCRIPTOR_INDEX,
|
||||
},
|
||||
|
||||
#else
|
||||
#error "Unknown Audio Class"
|
||||
#endif
|
||||
551
lib_xua/src/hid/xua_hid_report.h
Normal file
551
lib_xua/src/hid/xua_hid_report.h
Normal file
@@ -0,0 +1,551 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) Report descriptor
|
||||
*
|
||||
* This file defines the structure of the HID Report descriptor and declares
|
||||
* functions for manipulating it.
|
||||
* Because the Report descriptor defines the length of the HID Report, this file
|
||||
* declares a function for obtaining the Report length as well.
|
||||
* The using application has the responsibility to define the report descriptor
|
||||
* structure and default contents in their hid_report_descriptor.h file.
|
||||
* Document section numbers refer to the HID Device Class Definition, version 1.11.
|
||||
*/
|
||||
|
||||
#ifndef _XUA_HID_REPORT_
|
||||
#define _XUA_HID_REPORT_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "xua_hid_report_descriptor_constants.h"
|
||||
|
||||
#define HID_REPORT_ITEM_HDR_SIZE_MASK ( 0x03 )
|
||||
#define HID_REPORT_ITEM_HDR_SIZE_SHIFT ( 0U )
|
||||
|
||||
#define HID_REPORT_ITEM_HDR_TAG_MASK ( 0xF0 )
|
||||
#define HID_REPORT_ITEM_HDR_TAG_SHIFT ( 4U )
|
||||
|
||||
#define HID_REPORT_ITEM_HDR_TYPE_MASK ( 0x0C )
|
||||
#define HID_REPORT_ITEM_HDR_TYPE_SHIFT ( 2U )
|
||||
|
||||
#define HID_REPORT_ELEMENT_LOC_BIT_MASK ( 0x0070 )
|
||||
#define HID_REPORT_ELEMENT_LOC_BIT_SHIFT ( 4U )
|
||||
|
||||
#define HID_REPORT_ELEMENT_LOC_BYTE_MASK ( 0x000F )
|
||||
#define HID_REPORT_ELEMENT_LOC_BYTE_SHIFT ( 0U )
|
||||
|
||||
#define HID_REPORT_ELEMENT_LOC_ID_MASK ( 0xF000 )
|
||||
#define HID_REPORT_ELEMENT_LOC_ID_SHIFT ( 12U )
|
||||
|
||||
#define HID_REPORT_ELEMENT_LOC_LEN_MASK ( 0x0F00 )
|
||||
#define HID_REPORT_ELEMENT_LOC_LEN_SHIFT ( 8U )
|
||||
|
||||
#define HID_REPORT_ITEM_MAX_SIZE ( 2U )
|
||||
|
||||
#define HID_REPORT_ITEM_USAGE_TAG ( 0U )
|
||||
#define HID_REPORT_ITEM_USAGE_TYPE ( 2U )
|
||||
|
||||
/**
|
||||
* @brief Helper macro to configure the location field of USB_HID_Report_Element_t.
|
||||
*
|
||||
* @param id The report ID that this element is within.
|
||||
* @param len (only relevant for the usage_page elements in hidReports) The length
|
||||
* of the report under this report ID.
|
||||
* @param byte The byte location of this element in the report.
|
||||
* @param bit The bit location (within the byte) of this element in the report.
|
||||
*/
|
||||
#define HID_REPORT_SET_LOC(id, len, byte, bit) (\
|
||||
(( id << HID_REPORT_ELEMENT_LOC_ID_SHIFT ) & HID_REPORT_ELEMENT_LOC_ID_MASK ) | \
|
||||
(( len << HID_REPORT_ELEMENT_LOC_LEN_SHIFT ) & HID_REPORT_ELEMENT_LOC_LEN_MASK ) | \
|
||||
(( byte << HID_REPORT_ELEMENT_LOC_BYTE_SHIFT ) & HID_REPORT_ELEMENT_LOC_BYTE_MASK ) | \
|
||||
(( bit << HID_REPORT_ELEMENT_LOC_BIT_SHIFT ) & HID_REPORT_ELEMENT_LOC_BIT_MASK ))
|
||||
|
||||
/**
|
||||
* @brief Helper macro to configure the header field of USB_HID_Short_Item_t
|
||||
*
|
||||
* @param size The size of the report descriptor item (valid values: 0, 1, 2)
|
||||
* @param type The type of the report descriptor item
|
||||
* @param tag The tag
|
||||
*/
|
||||
#define HID_REPORT_SET_HEADER(size, type, tag) (\
|
||||
(( size << HID_REPORT_ITEM_HDR_SIZE_SHIFT) & HID_REPORT_ITEM_HDR_SIZE_MASK ) |\
|
||||
(( type << HID_REPORT_ITEM_HDR_TYPE_SHIFT) & HID_REPORT_ITEM_HDR_TYPE_MASK ) |\
|
||||
(( tag << HID_REPORT_ITEM_HDR_TAG_SHIFT ) & HID_REPORT_ITEM_HDR_TAG_MASK ) )
|
||||
|
||||
#define HID_STATUS_GOOD ( 0U )
|
||||
#define HID_STATUS_BAD_HEADER ( 1U )
|
||||
#define HID_STATUS_BAD_ID ( 2U )
|
||||
#define HID_STATUS_BAD_LOCATION ( 3U )
|
||||
#define HID_STATUS_BAD_PAGE ( 4U )
|
||||
#define HID_STATUS_IN_USE ( 5U )
|
||||
#define HID_STATUS_BAD_REPORT_DESCRIPTOR ( 6U )
|
||||
|
||||
#define MS_IN_TICKS 100000U
|
||||
|
||||
/**
|
||||
* @brief USB HID Report Descriptor Short Item
|
||||
*
|
||||
* @note
|
||||
* To reduce memory use, this type does not support Short Items with 4 data bytes.
|
||||
* See section 6.2.2.2
|
||||
*
|
||||
* Elements:
|
||||
*
|
||||
* header - the item prefix containing the size, type and tag fields (see 6.2.2.2)
|
||||
* Format (bit range): bSize (0:1), bType (2:3), bTag (4:7)
|
||||
* data - a two byte array for holding the item's data
|
||||
* The bSize field indicates which data bytes are in use
|
||||
* id - a non-standard extension identifying the HID Report ID associated with
|
||||
* the item (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* location - a non-standard extension locating the item within the HID Report
|
||||
* Format (bit range): iByte (0:3), iBit (4:6), Reserved (7)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned char header;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ];
|
||||
} USB_HID_Short_Item_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
USB_HID_Short_Item_t item;
|
||||
unsigned short location;
|
||||
} USB_HID_Report_Element_t;
|
||||
|
||||
/**
|
||||
* \brief Calculate the next time to respond with a HID Report.
|
||||
*
|
||||
* If the USB Host has previously sent a valid HID Set_Idle request with
|
||||
* a duration of zero or greater than the default reporting interval,
|
||||
* the device sends HID Reports periodically or when the value of the
|
||||
* payload has changed.
|
||||
*
|
||||
* This function calculates the time for sending the next periodic
|
||||
* HID Report.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*/
|
||||
void hidCalcNextReportTime( const unsigned id );
|
||||
|
||||
/**
|
||||
* \brief Capture the time of sending the current HID Report.
|
||||
*
|
||||
* If the USB Host has previously sent a valid HID Set_Idle request with
|
||||
* a duration of zero or greater than the default reporting interval,
|
||||
* the device sends HID Reports periodically or when the value of the
|
||||
* payload has changed.
|
||||
*
|
||||
* This function captures the time when the HID Report was sent so that
|
||||
* a subsequent call to HidCalNextReportTime() can calculate the time
|
||||
* to send the next periodic HID Report.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @param[in] time The time when the HID Report for the given \a id was sent.
|
||||
*/
|
||||
void hidCaptureReportTime( const unsigned id, const unsigned time );
|
||||
|
||||
/**
|
||||
* \brief Register that a previously changed HID Report data has been sent
|
||||
* to the USB Host.
|
||||
*
|
||||
* HID processing maintains a list of HID Reports with changed data not yet
|
||||
* reported to the USB Host.
|
||||
*
|
||||
* Applications that have only one HID Report may or may not use a Report ID.
|
||||
* Applications that have more than one HID Report must use Report IDs.
|
||||
*
|
||||
* For applications that do not use Report IDs, the list contains one element.
|
||||
* That element tracks whether or not an unreported change has occurred in the
|
||||
* HID data.
|
||||
* For applications that use Report IDs, the list contains one element per
|
||||
* Report ID.
|
||||
* Each element tracks unreported changes for the corresponding Report ID.
|
||||
*
|
||||
* Calling this function for a given Report ID indicates that the changed
|
||||
* HID data has been reported to the USB Host.
|
||||
*
|
||||
* \warning This function will fail silently if given an id that is not
|
||||
* either the value zero (in the case that Report IDs are not in use),
|
||||
* or a Report ID that is in use.
|
||||
*
|
||||
* \param[in] id A HID Report ID.
|
||||
* Use zero if the application does not use Report IDs.
|
||||
*/
|
||||
void hidClearChangePending( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Get the next valid report ID - iterator style.
|
||||
*
|
||||
* This function will loop around and start returning the first report ID again once it has
|
||||
* returned all valid report IDs.
|
||||
*
|
||||
* @param idPrev The previous returned id, or 0 if this is the first call
|
||||
* @return unsigned The next valid report ID.
|
||||
*/
|
||||
unsigned hidGetNextValidReportId ( unsigned idPrev );
|
||||
|
||||
/**
|
||||
* @brief Get the HID Report descriptor
|
||||
*
|
||||
* This function returns a pointer to the USB HID Report descriptor.
|
||||
* It returns NULL if the Report descriptor has not been prepared,
|
||||
* i.e., no one has called \c hidPrepareReportDescriptor().
|
||||
*
|
||||
* @note An XC-callable version of this function has not been provided.
|
||||
* XC requires explicit declaration of the kind of pointer returned,
|
||||
* hence an XC implementation of the function.
|
||||
*
|
||||
* @return A pointer to a list of unsigned char containing the Report descriptor
|
||||
*/
|
||||
#if !defined(__XC__)
|
||||
unsigned char* hidGetReportDescriptor( void );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the length of the HID Report descriptor
|
||||
*
|
||||
* This function returns the length of the USB HID Report descriptor.
|
||||
* It returns zero if the Report descriptor has not been prepared,
|
||||
* i.e., no one has called \c hidPrepareReportDescriptor().
|
||||
*
|
||||
* @return The length of the Report descriptor in bytes
|
||||
*/
|
||||
size_t hidGetReportDescriptorLength( void );
|
||||
|
||||
/**
|
||||
* \brief Get the upper limit of HID Report identifiers
|
||||
*
|
||||
* This function returns the upper limit of the HID Report identifiers.
|
||||
* The upper limit has a value one greater than the maximum HID Report identifier.
|
||||
* In the case that HID Report identifiers are not in use, this function returns the value 1.
|
||||
*
|
||||
* \returns The upper limit of HID Report identifiers
|
||||
*/
|
||||
unsigned hidGetReportIdLimit ( void );
|
||||
|
||||
/**
|
||||
* @brief Get a HID Report descriptor item
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2).
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
* @param[in] byte The byte position of the control within the HID Report
|
||||
* @param[in] bit The bit position of the control within the \a byte
|
||||
* @param[out] page The USB HID Usage Page code for the Item (see 5.5)
|
||||
* @param[out] header The LSB of the Item containing the bSize, bType and bTag fields (see 6.2.2.2)
|
||||
* @param[out] data A two element array containing data bytes for the Item
|
||||
*
|
||||
* @return A status value
|
||||
* @retval \c HID_STATUS_GOOD Item successfully returned
|
||||
* @retval \c HID_STATUS_BAD_ID The \a id argument specifies a non-existant HID Report
|
||||
* @retval \c HID_STATUS_BAD_LOCATION The \a bit or \a byte arguments specify a location outside
|
||||
* of the HID Report
|
||||
*/
|
||||
#if defined(__XC__)
|
||||
unsigned hidGetReportItem(
|
||||
const unsigned id,
|
||||
const unsigned byte,
|
||||
const unsigned bit,
|
||||
unsigned char* unsafe const page,
|
||||
unsigned char* unsafe const header,
|
||||
unsigned char* unsafe const data);
|
||||
#else
|
||||
unsigned hidGetReportItem(
|
||||
const unsigned id,
|
||||
const unsigned byte,
|
||||
const unsigned bit,
|
||||
unsigned char* const page,
|
||||
unsigned char* const header,
|
||||
unsigned char data[]);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the time to send the next HID Report for the given \a id
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @returns The time at which to send the next HID Report for the given \a id
|
||||
*/
|
||||
unsigned hidGetNextReportTime( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Get the length of the HID Report
|
||||
*
|
||||
* This function returns the length of the USB HID Report.
|
||||
* It returns zero if the Report descriptor has not been prepared,
|
||||
* i.e., no one has called \c hidPrepareReportDescriptor(),
|
||||
* or if the \a id argument specifies a non-existent HID Report
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @return The length of the Report in bytes
|
||||
*/
|
||||
size_t hidGetReportLength( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Get the HID Report period for the given \a id
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @returns The period for the given HID Report \a id in units of ms.
|
||||
* The value zero means the period is indefinite.
|
||||
*/
|
||||
unsigned hidGetReportPeriod( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Get the HID Report time for the given \a id
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @returns The time of the last call to \c hidCaptureReportTime()
|
||||
*/
|
||||
unsigned hidGetReportTime( const unsigned id );
|
||||
|
||||
/**
|
||||
* \brief Indicate if a change to the HID Report data has been received.
|
||||
*
|
||||
* HID processing maintains a list of HID Reports with changed data not yet
|
||||
* reported to the USB Host.
|
||||
*
|
||||
* Applications that have only one HID Report may or may not use a Report ID.
|
||||
* Applications that have more than one HID Report must use Report IDs.
|
||||
*
|
||||
* For applications that do not use Report IDs, the list contains one element.
|
||||
* That element tracks whether or not an unreported change has occurred in the
|
||||
* HID data.
|
||||
* For applications that use Report IDs, the list contains one element per
|
||||
* Report ID.
|
||||
* Each element tracks unreported changes for the corresponding Report ID.
|
||||
*
|
||||
* Calling this function with a given Report ID returns an indication of
|
||||
* whether unreported HID data exists for that Report ID.
|
||||
*
|
||||
* \warning This function will return zero if given an id that is not
|
||||
* either the value zero (in the case that Report IDs are not in use),
|
||||
* or a Report ID that is in use.
|
||||
*
|
||||
* \param[in] id A HID Report ID.
|
||||
* Use zero if the application does not use Report IDs.
|
||||
*
|
||||
* \returns A Boolean indicating whether the given \a id has a changed
|
||||
* HID Report not yet sent to the USB Host.
|
||||
* \retval True The given \a id has changed HID Report data.
|
||||
* \retval False The given \a id does not have changed HID Report data.
|
||||
*/
|
||||
unsigned hidIsChangePending( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Indicate if the HID report for the given \a id is idle
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
*
|
||||
* \returns A Boolean indicating whether the HID Report for the given \a id is idle.
|
||||
* \retval True The HID Report is idle.
|
||||
* \retval False The HID Report is not idle.
|
||||
*/
|
||||
unsigned hidIsIdleActive( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Indicate if the HID Report descriptor has been prepared
|
||||
*
|
||||
* \returns A Boolean indicating whether the HID Report descriptor has been prepared.
|
||||
* \retval True The HID Report descriptor has been prepared.
|
||||
* \retval False The HID Report descriptor has not been prepared.
|
||||
*/
|
||||
unsigned hidIsReportDescriptorPrepared( void );
|
||||
|
||||
/**
|
||||
* @brief Does the application use Report IDs?
|
||||
*
|
||||
* If the application is not using Report IDs, then the id value that is passed around
|
||||
* everywhere can just be zero. Otherwise zero is an invalid ID.
|
||||
*
|
||||
* @return Boolean
|
||||
* @retval 1 Report IDs are in use
|
||||
* @retval 0 Report IDs are not in use
|
||||
*/
|
||||
unsigned hidIsReportIdInUse ( void );
|
||||
|
||||
/**
|
||||
* @brief Is the provided report ID valid for passing to other functions.
|
||||
*
|
||||
* e.g If Report IDs are not in use, then only 0 will return true.
|
||||
* e.g If Report IDs are in use, then 0 will return false and the report IDs that
|
||||
* are in use will return true when passed to this function.
|
||||
*
|
||||
* @param id The ID to check
|
||||
* @return boolean
|
||||
* @retval 0 The report ID is not valid, other functions may fail silently
|
||||
* @retval 1 The report ID is valid and can be used as the argument to other functions
|
||||
*/
|
||||
unsigned hidIsReportIdValid ( unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Prepare the USB HID Report descriptor
|
||||
*
|
||||
* After preparation, \c hidGetReportDescriptor() returns a list suitable for transmission over USB.
|
||||
* Call this function after altering one or more Report Items using \c hidSetReportItem().
|
||||
*/
|
||||
void hidPrepareReportDescriptor( void );
|
||||
|
||||
/**
|
||||
* @brief Initialise the USB HID Report functionality
|
||||
*
|
||||
* Call this function before using any other functions in this API.
|
||||
*/
|
||||
void hidReportInit( void );
|
||||
|
||||
/**
|
||||
* @brief Reset the USB HID Report descriptor
|
||||
*
|
||||
* After reset, \c hidGetReportDescriptor() returns NULL until a subsequent call to
|
||||
* \c hidPrepareReportDescriptor() occurs.
|
||||
* Call this function before altering one or more Report Items using \c hidSetReportItem().
|
||||
*/
|
||||
void hidResetReportDescriptor( void );
|
||||
|
||||
/**
|
||||
* \brief Register that a change to the HID Report data has been received.
|
||||
*
|
||||
* HID processing maintains a list of HID Reports with changed data not yet
|
||||
* reported to the USB Host.
|
||||
*
|
||||
* Applications that have only one HID Report may or may not use a Report ID.
|
||||
* Applications that have more than one HID Report must use Report IDs.
|
||||
*
|
||||
* For applications that do not use Report IDs, the list contains one element.
|
||||
* That element tracks whether or not an unreported change has occurred in the
|
||||
* HID data.
|
||||
* For applications that use Report IDs, the list contains one element per
|
||||
* Report ID.
|
||||
* Each element tracks unreported changes for the corresponding Report ID.
|
||||
*
|
||||
* Calling this function with a given Report ID indicates that the HID data
|
||||
* for that Report ID has changed and has not yet been reported to the USB
|
||||
* Host.
|
||||
*
|
||||
* \warning This function will fail silently if given an id that is not
|
||||
* either the value zero (in the case that Report IDs are not in use),
|
||||
* or a Report ID that is in use.
|
||||
*
|
||||
* \param[in] id A HID Report ID.
|
||||
* Use zero if the application does not use Report IDs.
|
||||
*/
|
||||
void hidSetChangePending( const unsigned id );
|
||||
|
||||
/**
|
||||
* @brief Set the HID Report Idle state for the given \a id
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @param[in] state A Boolean indicating the Idle state
|
||||
* If true, the HID Report for the given \a id is Idle, otherwise it
|
||||
* is not Idle.
|
||||
*/
|
||||
void hidSetIdle( const unsigned id, const unsigned state );
|
||||
|
||||
/**
|
||||
* @brief Set the time to send the HID Report for the given \a id
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @param[in] time The time to send the HID Report for the given \a id.
|
||||
*/
|
||||
void hidSetNextReportTime( const unsigned id, const unsigned time );
|
||||
|
||||
/**
|
||||
* @brief Modify a HID Report descriptor item
|
||||
*
|
||||
* @warning This function does not check that the length of the \a data array matches the value of
|
||||
* the bSize field in the \a header. For safe operation use a \a data array of at least
|
||||
* \c HID_REPORT_ITEM_MAX_SIZE bytes in length.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
* @param[in] byte The byte position of the control within the HID Report
|
||||
* @param[in] bit The bit position of the control within the \a byte
|
||||
* @param[in] page The USB HID Usage Page code for the Item (see 5.5)
|
||||
* @param[in] header The LSB of the Item containing the bSize, bType and bTag fields (see 6.2.2.2)
|
||||
* @param[in] data An array containing data bytes or NULL for an Item with no data
|
||||
*
|
||||
* @return A status value
|
||||
* @retval \c HID_STATUS_GOOD Item successfully updated
|
||||
* @retval \c HID_STATUS_BAD_HEADER The Item header specified a data size greater than 2 or
|
||||
* a Tag or Type inconsistent with a Usage Item
|
||||
* @retval \c HID_STATUS_BAD_ID The \a id argument specifies a non-existent HID Report
|
||||
* @retval \c HID_STATUS_BAD_LOCATION The \a bit or \a byte arguments specify a location outside
|
||||
* of the HID Report
|
||||
* @retval \c HID_STATUS_BAD_PAGE The \a byte argument specifies a location for controls from
|
||||
* a Usage Page other than the one given by the \a page parameter
|
||||
* @retval \c HID_STATUS_IN_USE The Report descriptor is in use
|
||||
*/
|
||||
unsigned hidSetReportItem(
|
||||
const unsigned id,
|
||||
const unsigned byte,
|
||||
const unsigned bit,
|
||||
const unsigned char page,
|
||||
const unsigned char header,
|
||||
const unsigned char data[]);
|
||||
|
||||
/**
|
||||
* @brief Set the HID Report period for the given \a id
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2)
|
||||
* A value of zero means the application does not use Report IDs.
|
||||
*
|
||||
* @param[in] period The period for sending the HID Report in units of ms.
|
||||
* This period must be a multiple of 4 ms.
|
||||
* Use zero to indicate an indefinite period.
|
||||
*/
|
||||
void hidSetReportPeriod( const unsigned id, const unsigned period );
|
||||
|
||||
/**
|
||||
* @brief Development function: Validate the contents of hid_report_descriptor.h for common errors, printing
|
||||
* error messages if any issues were found.
|
||||
*
|
||||
* This function is intended for use when developing the contents of hid_report_descriptor.h, which is static,
|
||||
* so shouldn't be required for use in a production application.
|
||||
*
|
||||
* @return Validation result
|
||||
* @retval HID_STATUS_GOOD The validation found no issues with the data structures defined
|
||||
* in hid_report_descriptor.h
|
||||
* @retval HID_STATUS_BAD_REPORT_DESCRIPTOR The validation encountered an issue with the data structures
|
||||
* defined in hid_report_descriptor.h . More information is
|
||||
* provided in the printed messages.
|
||||
*/
|
||||
unsigned hidReportValidate( void );
|
||||
|
||||
#endif // _XUA_HID_REPORT_
|
||||
66
lib_xua/src/hid/xua_hid_report_descriptor_constants.h
Normal file
66
lib_xua/src/hid/xua_hid_report_descriptor_constants.h
Normal file
@@ -0,0 +1,66 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/**
|
||||
* @brief Human Interface Device (HID) Report descriptor constants
|
||||
*
|
||||
* This file defines a collection of constants from the USB HID documents.
|
||||
* This includes constants from:
|
||||
* - Device Class Definition for Human Interface Devices, version 1.11
|
||||
* - HID Usage Tables for Universal Serial Bus, version 1.22
|
||||
*
|
||||
* This file is incomplete, but can be expanded with new constants as necessary.
|
||||
*/
|
||||
|
||||
#ifndef _XUA_HID_REPORT_DESCRIPTOR_CONSTANTS_
|
||||
#define _XUA_HID_REPORT_DESCRIPTOR_CONSTANTS_
|
||||
|
||||
|
||||
// Constants from the USB Device Class Definition for HID for type
|
||||
#define HID_REPORT_ITEM_TYPE_MAIN ( 0x00 )
|
||||
#define HID_REPORT_ITEM_TYPE_GLOBAL ( 0x01 )
|
||||
#define HID_REPORT_ITEM_TYPE_LOCAL ( 0x02 )
|
||||
#define HID_REPORT_ITEM_TYPE_RESERVED ( 0x03 )
|
||||
|
||||
// Constants from the USB Device Class Definition for HID for tag
|
||||
// Main items
|
||||
#define HID_REPORT_ITEM_TAG_INPUT ( 0x08 )
|
||||
#define HID_REPORT_ITEM_TAG_OUTPUT ( 0x09 )
|
||||
#define HID_REPORT_ITEM_TAG_FEATURE ( 0x0B )
|
||||
#define HID_REPORT_ITEM_TAG_COLLECTION ( 0x0A )
|
||||
#define HID_REPORT_ITEM_TAG_END_COLLECTION ( 0x0C )
|
||||
|
||||
// Global items
|
||||
#define HID_REPORT_ITEM_TAG_USAGE_PAGE ( 0x00 )
|
||||
#define HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM ( 0x01 )
|
||||
#define HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM ( 0x02 )
|
||||
#define HID_REPORT_ITEM_TAG_PHYSICAL_MINIMUM ( 0x03 )
|
||||
#define HID_REPORT_ITEM_TAG_PHYSICAL_MAXIMUM ( 0x04 )
|
||||
#define HID_REPORT_ITEM_TAG_UNIT_EXPONENT ( 0x05 )
|
||||
#define HID_REPORT_ITEM_TAG_UNIT ( 0x06 )
|
||||
#define HID_REPORT_ITEM_TAG_REPORT_SIZE ( 0x07 )
|
||||
#define HID_REPORT_ITEM_TAG_REPORT_ID ( 0x08 )
|
||||
#define HID_REPORT_ITEM_TAG_REPORT_COUNT ( 0x09 )
|
||||
#define HID_REPORT_ITEM_TAG_PUSH ( 0x0A )
|
||||
#define HID_REPORT_ITEM_TAG_POP ( 0x0B )
|
||||
|
||||
// Local items
|
||||
#define HID_REPORT_ITEM_TAG_USAGE ( 0x00 )
|
||||
#define HID_REPORT_ITEM_TAG_USAGE_MINIMUM ( 0x01 )
|
||||
#define HID_REPORT_ITEM_TAG_USAGE_MAXIMUM ( 0x02 )
|
||||
#define HID_REPORT_ITEM_TAG_DESIGNATOR_INDEX ( 0x03 )
|
||||
#define HID_REPORT_ITEM_TAG_DESIGNATOR_MINIMUM ( 0x04 )
|
||||
#define HID_REPORT_ITEM_TAG_DESIGNATOR_MAXIMUM ( 0x05 )
|
||||
#define HID_REPORT_ITEM_TAG_STRING_INDEX ( 0x07 )
|
||||
#define HID_REPORT_ITEM_TAG_STRING_MINIMUM ( 0x08 )
|
||||
#define HID_REPORT_ITEM_TAG_STRING_MAXIMUM ( 0x09 )
|
||||
#define HID_REPORT_ITEM_TAG_DELIMITER ( 0x0A )
|
||||
|
||||
// Constants from HID Usage Tables
|
||||
// Usage page IDs (incomplete)
|
||||
#define USB_HID_USAGE_PAGE_ID_GENERIC_DESKTOP ( 0x01 )
|
||||
#define USB_HID_USAGE_PAGE_ID_KEYBOARD ( 0x07 )
|
||||
#define USB_HID_USAGE_PAGE_ID_TELEPHONY_DEVICE ( 0x0B )
|
||||
#define USB_HID_USAGE_PAGE_ID_CONSUMER ( 0x0C )
|
||||
|
||||
#endif // _XUA_HID_REPORT_DESCRIPTOR_CONSTANTS_
|
||||
7
module_locks/README.rst
Normal file
7
module_locks/README.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
module_locks Readme
|
||||
===================
|
||||
|
||||
:scope: Dummy module
|
||||
:description: Allows compiling legacy_tests in lib_xua with lib_locks. sc_i2c is used in the tests and it requires module_locks from sc_util, but the definitions in sc_utils conflict with the ones in lib_locks.
|
||||
:keywords: dummy
|
||||
:boards: XMOS Dev Kit
|
||||
1
module_locks/module_build_info
Normal file
1
module_locks/module_build_info
Normal file
@@ -0,0 +1 @@
|
||||
# Dummy module used in legacy_tests. See README.rst for more details.
|
||||
@@ -14,6 +14,8 @@ setuptools.setup(
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=[
|
||||
'flake8~=3.8',
|
||||
'pytest~=6.0',
|
||||
'pytest-xdist~=1.34',
|
||||
],
|
||||
dependency_links=[
|
||||
],
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
# same modules should appear in the setup.py list as given below.
|
||||
|
||||
flake8==3.8.3
|
||||
pytest==6.0.0
|
||||
pytest-xdist==1.34.0
|
||||
|
||||
# Development dependencies
|
||||
#
|
||||
|
||||
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
*/runners/*
|
||||
test_results.csv
|
||||
|
||||
102
tests/xua_unit_tests/CMakeLists.txt
Normal file
102
tests/xua_unit_tests/CMakeLists.txt
Normal file
@@ -0,0 +1,102 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(XMOS_TOOLS_PATH $ENV{XMOS_TOOL_PATH}/bin)
|
||||
|
||||
#**********************
|
||||
# Setup XMOS toolchain
|
||||
#**********************
|
||||
if(NOT DEFINED ENV{XUA_PATH})
|
||||
message(FATAL_ERROR "XUA_PATH environment variable not defined")
|
||||
# some more commands
|
||||
endif()
|
||||
include("$ENV{XUA_PATH}/cmake_utils/xmos_toolchain.cmake")
|
||||
|
||||
#**********************
|
||||
# Project
|
||||
#**********************
|
||||
# Disable in-source build.
|
||||
#if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
# message(FATAL_ERROR "In-source build is not allowed! Please specify a build folder.\n\tex:cmake -B build")
|
||||
#endif()
|
||||
|
||||
|
||||
## Define project
|
||||
project(xua_unit_tests VERSION 0.1.0)
|
||||
|
||||
## Enable languages for project
|
||||
enable_language(CXX XC C ASM)
|
||||
|
||||
message(STATUS "CAME HERE")
|
||||
add_custom_target("runners" ALL)
|
||||
add_custom_command(
|
||||
TARGET runners
|
||||
COMMAND python generate_unity_runners.py
|
||||
COMMENT "generate unity runners"
|
||||
)
|
||||
|
||||
message(STATUS "CAME HERE 1")
|
||||
file( GLOB APP_SOURCES src/test*.xc )
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
|
||||
foreach( testsourcefile ${APP_SOURCES} )
|
||||
get_filename_component(ITEM_NAME ${testsourcefile} NAME_WE)
|
||||
message(STATUS "item_name " ${ITEM_NAME})
|
||||
add_executable(${ITEM_NAME})
|
||||
set(APP_COMPILER_FLAGS
|
||||
"-O2"
|
||||
"-g"
|
||||
"-Wall"
|
||||
"-report"
|
||||
"-fxscope"
|
||||
"-target=XCORE-AI-EXPLORER"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/config.xscope"
|
||||
"-DUNITY_SUPPORT_64"
|
||||
"-DUNITY_INCLUDE_DOUBLE"
|
||||
)
|
||||
set_source_files_properties(
|
||||
"runners/${ITEM_NAME}/${ITEM_NAME}_Runner.c"
|
||||
PROPERTIES GENERATED TRUE
|
||||
)
|
||||
|
||||
set(APP_SRCS
|
||||
${testsourcefile}
|
||||
"runners/${ITEM_NAME}/${ITEM_NAME}_Runner.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../Unity/src/unity.c"
|
||||
)
|
||||
set(APP_INCLUDES
|
||||
"src"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../Unity/src"
|
||||
)
|
||||
set(APP_DEPENDENT_MODULES
|
||||
"lib_xua(>=2.0.0)"
|
||||
"lib_logging(>=3.0.0)"
|
||||
"lib_xassert(>=4.0.0)"
|
||||
"lib_xud(>=2.0.0)"
|
||||
"lib_spdif(>=4.0.0)"
|
||||
"lib_mic_array(>=4.0.0)"
|
||||
)
|
||||
|
||||
include("$ENV{XUA_PATH}/cmake_utils/xua.cmake")
|
||||
set_target_properties(${ITEM_NAME} PROPERTIES OUTPUT_NAME ${ITEM_NAME}.xe)
|
||||
target_compile_options(${ITEM_NAME} PRIVATE ${APP_COMPILER_FLAGS})
|
||||
|
||||
target_include_directories(${ITEM_NAME}
|
||||
PRIVATE ${APP_INCLUDES}
|
||||
PRIVATE ${XUA_INCLUDES_ALL}
|
||||
)
|
||||
|
||||
target_sources(${ITEM_NAME}
|
||||
PRIVATE ${APP_SRCS}
|
||||
PRIVATE ${XUA_SRCS_ALL}
|
||||
)
|
||||
add_dependencies(${ITEM_NAME} runners)
|
||||
target_link_options(${ITEM_NAME} PRIVATE ${APP_COMPILER_FLAGS})
|
||||
## Set any additional flags only for C++
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11")
|
||||
|
||||
endforeach( testsourcefile ${APP_SOURCES} )
|
||||
|
||||
message(STATUS ${APP_SOURCES})
|
||||
|
||||
message(STATUS "CAME HERE 2")
|
||||
## Register the application
|
||||
#XMOS_REGISTER_APP()
|
||||
32
tests/xua_unit_tests/README.md
Normal file
32
tests/xua_unit_tests/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# xua_unit_tests test application
|
||||
|
||||
This example builds the xua_unit_tests application for XCORE AI
|
||||
|
||||
## Prerequisites for building
|
||||
|
||||
[XMOS Toolchain 15.0.3](https://www.xmos.com/software/tools/) or newer.
|
||||
|
||||
Install [CMake](https://cmake.org/download/) version 3.13 or newer.
|
||||
|
||||
## Building for xCORE
|
||||
|
||||
Set environment variable for lib_xua path:
|
||||
|
||||
> export XUA_PATH=<path to lib_xua>
|
||||
|
||||
cd to lib_xua/tests/xua_unit_tests
|
||||
|
||||
Run cmake and build
|
||||
|
||||
> cmake .
|
||||
> make
|
||||
|
||||
## Run on hardware
|
||||
|
||||
Ensure your XCORE AI EXPLORER board is powered up and connected to the XTAG debugger.
|
||||
Make sure the input.wav file is copied into the build directory
|
||||
|
||||
> pytest -n 1
|
||||
|
||||
|
||||
You should see the tests collected by pytest pass
|
||||
23
tests/xua_unit_tests/config.xscope
Normal file
23
tests/xua_unit_tests/config.xscope
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- ======================================================= -->
|
||||
<!-- The 'ioMode' attribute on the xSCOPEconfig -->
|
||||
<!-- element can take the following values: -->
|
||||
<!-- "none", "basic", "timed" -->
|
||||
<!-- -->
|
||||
<!-- The 'type' attribute on Probe -->
|
||||
<!-- elements can take the following values: -->
|
||||
<!-- "STARTSTOP", "CONTINUOUS", "DISCRETE", "STATEMACHINE" -->
|
||||
<!-- -->
|
||||
<!-- The 'datatype' attribute on Probe -->
|
||||
<!-- elements can take the following values: -->
|
||||
<!-- "NONE", "UINT", "INT", "FLOAT" -->
|
||||
<!-- ======================================================= -->
|
||||
|
||||
<xSCOPEconfig ioMode="none" enabled="false">
|
||||
|
||||
<!-- For example: -->
|
||||
<!-- <Probe name="Probe Name" type="CONTINUOUS" datatype="UINT" units="Value" enabled="true"/> -->
|
||||
<!-- From the target code, call: xscope_int(PROBE_NAME, value); -->
|
||||
|
||||
</xSCOPEconfig>
|
||||
115
tests/xua_unit_tests/conftest.py
Normal file
115
tests/xua_unit_tests/conftest.py
Normal file
@@ -0,0 +1,115 @@
|
||||
# Copyright 2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
from __future__ import print_function
|
||||
from builtins import str
|
||||
import os.path
|
||||
import pytest
|
||||
import subprocess
|
||||
|
||||
target = os.environ.get('TARGET', 'all_possible')
|
||||
print("target = ", target)
|
||||
|
||||
def pytest_collect_file(parent, path):
|
||||
if(path.ext == ".xe"):
|
||||
if(target == 'all_possible'):
|
||||
return UnityTestSource.from_parent(parent, fspath=path)
|
||||
if(target == 'XCOREAI' and ('xcoreai' in path.basename)):
|
||||
return UnityTestSource.from_parent(parent, fspath=path)
|
||||
if(target == 'XCORE200' and ('xcore200' in path.basename)):
|
||||
return UnityTestSource.from_parent(parent, fspath=path)
|
||||
|
||||
|
||||
class UnityTestSource(pytest.File):
|
||||
def collect(self):
|
||||
# Find the binary built from the runner for this test file
|
||||
#
|
||||
# Assume the following directory layout:
|
||||
# unit_tests/ <- Test root directory
|
||||
# |-- bin/ <- Compiled binaries of the test runners
|
||||
# |-- conftest.py <- This file
|
||||
# |-- runners/ <- Auto-generated buildable source of test binaries
|
||||
# |-- src/ <- Unity test functions
|
||||
# `-- wscript <- Build system file used to generate/build runners
|
||||
xe_name = ((os.path.basename(self.name)).split("."))[0] + ".xe"
|
||||
test_bin_path = os.path.join('bin', xe_name)
|
||||
|
||||
yield UnityTestExecutable.from_parent(self, name=self.name)
|
||||
|
||||
|
||||
class UnityTestExecutable(pytest.Item):
|
||||
def __init__(self, name, parent):
|
||||
super(UnityTestExecutable, self).__init__(name, parent)
|
||||
self._nodeid = self.name # Override the naming to suit C better
|
||||
|
||||
def runtest(self):
|
||||
# Run the binary in the simulator
|
||||
simulator_fail = False
|
||||
test_output = None
|
||||
try:
|
||||
if('xcore200' in self.name):
|
||||
print("run axe for executable ", self.name)
|
||||
test_output = subprocess.check_output(['axe', self.name], text=True)
|
||||
else:
|
||||
print("run xrun for executable ", self.name)
|
||||
test_output = subprocess.check_output(['xrun', '--io', '--id', '0', self.name], text=True, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# Unity exits non-zero if an assertion fails
|
||||
simulator_fail = True
|
||||
test_output = e.output
|
||||
|
||||
# Parse the Unity output
|
||||
unity_pass = False
|
||||
test_output = test_output.split('\n')
|
||||
for line in test_output:
|
||||
if 'test' in line:
|
||||
test_report = line.split(':')
|
||||
# Unity output is as follows:
|
||||
# <test_source>:<line_number>:<test_case>:PASS
|
||||
# <test_source>:<line_number>:<test_case>:FAIL:<failure_reason>
|
||||
test_source = test_report[0]
|
||||
line_number = test_report[1]
|
||||
test_case = test_report[2]
|
||||
result = test_report[3]
|
||||
failure_reason = None
|
||||
print(('\n {}()'.format(test_case)), end=' ')
|
||||
if result == 'PASS':
|
||||
unity_pass = True
|
||||
continue
|
||||
if result == 'FAIL':
|
||||
failure_reason = test_report[4]
|
||||
print('') # Insert line break after test_case print
|
||||
raise UnityTestException(self, {'test_source': test_source,
|
||||
'line_number': line_number,
|
||||
'test_case': test_case,
|
||||
'failure_reason':
|
||||
failure_reason})
|
||||
|
||||
if simulator_fail:
|
||||
raise Exception(self, "Simulation failed.")
|
||||
if not unity_pass:
|
||||
raise Exception(self, "Unity test output not found.")
|
||||
print('') # Insert line break after final test_case which passed
|
||||
|
||||
def repr_failure(self, excinfo):
|
||||
if isinstance(excinfo.value, UnityTestException):
|
||||
return '\n'.join([str(self.parent).strip('<>'),
|
||||
'{}:{}:{}()'.format(
|
||||
excinfo.value[1]['test_source'],
|
||||
excinfo.value[1]['line_number'],
|
||||
excinfo.value[1]['test_case']),
|
||||
'Failure reason:',
|
||||
excinfo.value[1]['failure_reason']])
|
||||
else:
|
||||
return str(excinfo.value)
|
||||
|
||||
def reportinfo(self):
|
||||
# It's not possible to give sensible line number info for an executable
|
||||
# so we return it as 0.
|
||||
#
|
||||
# The source line number will instead be recovered from the Unity print
|
||||
# statements.
|
||||
return self.fspath, 0, self.name
|
||||
|
||||
|
||||
class UnityTestException(Exception):
|
||||
pass
|
||||
120
tests/xua_unit_tests/generate_unity_runners.py
Normal file
120
tests/xua_unit_tests/generate_unity_runners.py
Normal file
@@ -0,0 +1,120 @@
|
||||
# Copyright 2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import glob
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
UNITY_TEST_DIR = 'src'
|
||||
UNITY_TEST_PREFIX = 'test_'
|
||||
UNITY_RUNNER_DIR = 'runners'
|
||||
UNITY_RUNNER_SUFFIX = '_Runner'
|
||||
project_root = os.path.join('..', '..', '..')
|
||||
|
||||
def get_ruby():
|
||||
"""
|
||||
Check ruby is avaliable and return the command to invoke it.
|
||||
"""
|
||||
interpreter_name = 'ruby'
|
||||
try:
|
||||
dev_null = open(os.devnull, 'w')
|
||||
# Call the version command to check the interpreter can be run
|
||||
subprocess.check_call([interpreter_name, '--version'],
|
||||
stdout=dev_null,
|
||||
close_fds=True)
|
||||
except OSError as e:
|
||||
print("Failed to run Ruby interpreter: {}".format(e), file=sys.stderr)
|
||||
exit(1) # TODO: Check this is the correct way to kill xwaf on error
|
||||
|
||||
return interpreter_name
|
||||
|
||||
def get_unity_runner_generator(project_root_path):
|
||||
"""
|
||||
Check the Unity generate_test_runner script is avaliable, and return the
|
||||
path to it.
|
||||
"""
|
||||
unity_runner_generator = os.path.join(
|
||||
project_root_path, 'Unity', 'auto', 'generate_test_runner.rb')
|
||||
if not os.path.exists(unity_runner_generator):
|
||||
print("Unity repo not found in workspace", file=sys.stderr)
|
||||
exit(1) # TODO: Check this is the correct way to kill xwaf on error
|
||||
return unity_runner_generator
|
||||
|
||||
|
||||
def get_test_name(test_path):
|
||||
"""
|
||||
Return the test name by removing the extension from the filename.
|
||||
"""
|
||||
return os.path.splitext(os.path.basename(test_path))[0]
|
||||
|
||||
|
||||
def get_file_type(filename):
|
||||
"""
|
||||
Return the extension from the filename.
|
||||
"""
|
||||
return filename.rsplit('.')[-1:][0]
|
||||
|
||||
|
||||
def generate_unity_runner(project_root_path, unity_test_path, unity_runner_dir,
|
||||
unity_runner_suffix):
|
||||
"""
|
||||
Invoke the Unity runner generation script for the given test file, and
|
||||
return the path to the generated file. The output directory will be created
|
||||
if it does not already exist.
|
||||
"""
|
||||
runner_path = os.path.join(os.path.join(unity_runner_dir, get_test_name(unity_test_path)))
|
||||
if not os.path.exists(runner_path):
|
||||
os.makedirs(runner_path)
|
||||
|
||||
unity_runner_path = os.path.join(
|
||||
runner_path, get_test_name(unity_test_path) + unity_runner_suffix
|
||||
+ '.' + 'c')
|
||||
|
||||
try:
|
||||
subprocess.check_call([get_ruby(),
|
||||
get_unity_runner_generator(project_root_path),
|
||||
unity_test_path,
|
||||
unity_runner_path])
|
||||
except OSError as e:
|
||||
print("Ruby generator failed for {}\n\t{}".format(unity_test_path, e),
|
||||
file=sys.stderr)
|
||||
exit(1) # TODO: Check this is the correct way to kill xwaf on error
|
||||
|
||||
|
||||
def find_unity_test_paths(unity_test_dir, unity_test_prefix):
|
||||
"""
|
||||
Return a list of all file paths with the unity_test_prefix found in the
|
||||
unity_test_dir.
|
||||
"""
|
||||
return glob.glob(os.path.join(unity_test_dir, unity_test_prefix+'*'))
|
||||
|
||||
|
||||
def find_unity_tests(unity_test_dir, unity_test_prefix):
|
||||
"""
|
||||
Return a dictionary of all {test names, test language} pairs with the
|
||||
unity_test_prefix found in the unity_test_dir.
|
||||
"""
|
||||
unity_test_paths = find_unity_test_paths(unity_test_dir, unity_test_prefix)
|
||||
print('unity_test_paths = ', unity_test_paths)
|
||||
return {get_test_name(path): get_file_type(path)
|
||||
for path in unity_test_paths}
|
||||
|
||||
def find_unity_test_paths(unity_test_dir, unity_test_prefix):
|
||||
"""
|
||||
Return a list of all file paths with the unity_test_prefix found in the
|
||||
unity_test_dir.
|
||||
"""
|
||||
return glob.glob(os.path.join(unity_test_dir, unity_test_prefix+'*'))
|
||||
|
||||
|
||||
def generate_runners():
|
||||
UNITY_TESTS = find_unity_tests(UNITY_TEST_DIR, UNITY_TEST_PREFIX)
|
||||
print('UNITY_TESTS = ',UNITY_TESTS)
|
||||
unity_test_paths = find_unity_test_paths(UNITY_TEST_DIR, UNITY_TEST_PREFIX)
|
||||
print('unity_test_paths = ',unity_test_paths)
|
||||
for unity_test_path in unity_test_paths:
|
||||
generate_unity_runner(project_root, unity_test_path, UNITY_RUNNER_DIR, UNITY_RUNNER_SUFFIX)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_runners()
|
||||
@@ -0,0 +1,296 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#define USB_HID_REPORT_ID_KEYBOARD ( 0x01 )
|
||||
#define USB_HID_REPORT_ID_CONSUMER ( 0x02 )
|
||||
#define USB_HID_REPORT_ID_TELEPHONY ( 0x03 )
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
* (These are short items as the location field isn't relevant for them)
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount4 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x04, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount7 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x07, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsagePageGenericDesktop = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.data = { USB_HID_USAGE_PAGE_ID_GENERIC_DESKTOP, 0x00 }};
|
||||
static const USB_HID_Short_Item_t hidUsagePageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 }};
|
||||
static const USB_HID_Short_Item_t hidUsagePageTelephony = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.data = { USB_HID_USAGE_PAGE_ID_TELEPHONY_DEVICE, 0x00 }};
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageKeyboard = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x06, 0x00 }};
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 }};
|
||||
static const USB_HID_Short_Item_t hidUsageTelephonyHeadset = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x05, 0x00 }};
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidReportId1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_ID),
|
||||
.data = { USB_HID_REPORT_ID_KEYBOARD, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportId2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_ID),
|
||||
.data = { USB_HID_REPORT_ID_CONSUMER, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportId3 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_ID),
|
||||
.data = { USB_HID_REPORT_ID_TELEPHONY, 0x00 } };
|
||||
|
||||
static const USB_HID_Report_Element_t hidReportKeyboard = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_KEYBOARD, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_KEYBOARD, 1, 0, 0 )
|
||||
};
|
||||
|
||||
static const USB_HID_Report_Element_t hidReportConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 2, 0, 0 )
|
||||
};
|
||||
|
||||
static const USB_HID_Report_Element_t hidReportTelephony = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_TELEPHONY_DEVICE, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_TELEPHONY, 1, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageReport1Byte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x17, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_KEYBOARD, 0, 0, 0 )
|
||||
}; // 't'
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport1Byte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x72, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_KEYBOARD, 0, 0, 2 )
|
||||
}; // F23
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport1Byte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x73, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_KEYBOARD, 0, 0, 3 )
|
||||
}; // F24
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(2, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x26, 0x02 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 0, 0 )
|
||||
}; // AC Stop
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(2, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x21, 0x02 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 0, 1 )
|
||||
}; // AC Search
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 0, 2 )
|
||||
}; // Mute
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xCF, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 0, 4 )
|
||||
}; // Voice Command
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte0Bit6 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 0, 6 )
|
||||
}; // Vol+
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte0Bit7 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 0, 7 )
|
||||
}; // Vol-
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport2Byte1Bit7 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_CONSUMER, 0, 1, 7 )
|
||||
}; // Bass boost
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport3Byte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x20, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_TELEPHONY, 0, 0, 0 )
|
||||
}; // Hook Switch
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageReport3Byte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0x2F, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_TELEPHONY, 0, 0, 1 )
|
||||
}; // Phone Mute
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageReport1Byte0Bit0,
|
||||
&hidUsageReport1Byte0Bit2,
|
||||
&hidUsageReport1Byte0Bit3,
|
||||
|
||||
&hidUsageReport2Byte0Bit0,
|
||||
&hidUsageReport2Byte0Bit1,
|
||||
&hidUsageReport2Byte0Bit2,
|
||||
&hidUsageReport2Byte0Bit4,
|
||||
&hidUsageReport2Byte0Bit6,
|
||||
&hidUsageReport2Byte0Bit7,
|
||||
&hidUsageReport2Byte1Bit7,
|
||||
|
||||
&hidUsageReport3Byte0Bit0,
|
||||
&hidUsageReport3Byte0Bit1
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the locator filled out with ID and size
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportKeyboard,
|
||||
&hidReportConsumer,
|
||||
&hidReportTelephony
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&hidUsagePageGenericDesktop,
|
||||
&hidUsageKeyboard,
|
||||
&hidReportSize1,
|
||||
&hidLogicalMinimum0,
|
||||
&hidCollectionApplication, // Report 1
|
||||
&hidReportId1,
|
||||
&(hidReportKeyboard.item),
|
||||
&hidLogicalMaximum1,
|
||||
&hidReportCount1,
|
||||
&(hidUsageReport1Byte0Bit0.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidInputConstArray,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageReport1Byte0Bit2.item),
|
||||
&hidInputDataVar,
|
||||
&(hidUsageReport1Byte0Bit3.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount4,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd,
|
||||
&hidUsagePageConsumerControl,
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication, // Report 2
|
||||
&hidReportId2,
|
||||
&(hidReportConsumer.item),
|
||||
&hidLogicalMaximum1,
|
||||
&hidReportCount1,
|
||||
&(hidUsageReport2Byte0Bit0.item),
|
||||
&hidInputDataVar,
|
||||
&(hidUsageReport2Byte0Bit1.item),
|
||||
&hidInputDataVar,
|
||||
&(hidUsageReport2Byte0Bit2.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidInputConstArray,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageReport2Byte0Bit4.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidInputConstArray,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageReport2Byte0Bit6.item),
|
||||
&hidInputDataVar,
|
||||
&(hidUsageReport2Byte0Bit7.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount7,
|
||||
&hidInputConstArray,
|
||||
&hidLogicalMaximum1,
|
||||
&hidReportCount1,
|
||||
&(hidUsageReport2Byte1Bit7.item),
|
||||
&hidInputDataVar,
|
||||
&hidCollectionEnd,
|
||||
&hidUsagePageTelephony,
|
||||
&hidUsageTelephonyHeadset,
|
||||
&hidCollectionApplication, // Report 3
|
||||
&hidReportId3,
|
||||
&(hidReportTelephony.item),
|
||||
&(hidUsageReport3Byte0Bit0.item),
|
||||
&hidInputDataVar,
|
||||
&(hidUsageReport3Byte0Bit1.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount6,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd,
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 3 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -0,0 +1,887 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xua_unit_tests.h"
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
// Test constants related to the report descriptor defined in hid_report_descriptor.h
|
||||
#define REPORT1_MAX_VALID_BIT ( 3 )
|
||||
#define REPORT1_MAX_VALID_BYTE ( 0 )
|
||||
#define REPORT1_MIN_VALID_BIT ( 0 )
|
||||
#define REPORT1_MIN_VALID_BYTE ( 0 )
|
||||
|
||||
#define REPORT2_MAX_VALID_BIT ( 7 )
|
||||
#define REPORT2_MAX_VALID_BYTE ( 1 )
|
||||
#define REPORT2_MIN_VALID_BIT ( 0 )
|
||||
#define REPORT2_MIN_VALID_BYTE ( 0 )
|
||||
|
||||
#define REPORT3_MAX_VALID_BIT ( 1 )
|
||||
#define REPORT3_MAX_VALID_BYTE ( 0 )
|
||||
#define REPORT3_MIN_VALID_BIT ( 0 )
|
||||
#define REPORT3_MIN_VALID_BYTE ( 0 )
|
||||
|
||||
#define HID_REPORT_LENGTH ( 3 )
|
||||
#define HID_REPORT_COUNT ( 3 )
|
||||
#define HID_REPORTID_LIMIT ( 4 )
|
||||
|
||||
// Constants from USB HID Usage Tables
|
||||
#define KEYBOARD_PAGE ( 0x07 )
|
||||
#define CONSUMER_PAGE ( 0x0C )
|
||||
#define TELEPHONY_DEVICE_PAGE ( 0x0B )
|
||||
#define LOUDNESS_CONTROL ( 0xE7 )
|
||||
#define PHONE_KEY_9 ( 0xB9 )
|
||||
#define KEYBOARD_X ( 0x1B )
|
||||
#define PHONE_HOST_HOLD ( 0x010A )
|
||||
|
||||
static unsigned construct_usage_header( unsigned size )
|
||||
{
|
||||
unsigned header = 0x00;
|
||||
|
||||
header |= ( HID_REPORT_ITEM_USAGE_TAG << HID_REPORT_ITEM_HDR_TAG_SHIFT ) & HID_REPORT_ITEM_HDR_TAG_MASK;
|
||||
header |= ( HID_REPORT_ITEM_USAGE_TYPE << HID_REPORT_ITEM_HDR_TYPE_SHIFT ) & HID_REPORT_ITEM_HDR_TYPE_MASK;
|
||||
|
||||
header |= ( size << HID_REPORT_ITEM_HDR_SIZE_SHIFT ) & HID_REPORT_ITEM_HDR_SIZE_MASK;
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
void setUp( void )
|
||||
{
|
||||
hidReportInit();
|
||||
hidResetReportDescriptor();
|
||||
}
|
||||
|
||||
void test_validate_report( void ) {
|
||||
unsigned retVal = hidReportValidate();
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_reportid_in_use( void ) {
|
||||
unsigned reportIdInUse = hidIsReportIdInUse();
|
||||
TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse );
|
||||
}
|
||||
|
||||
void test_get_next_valid_report_id( void ) {
|
||||
unsigned reportId = 0U;
|
||||
|
||||
reportId = hidGetNextValidReportId(reportId);
|
||||
TEST_ASSERT_EQUAL_UINT( 1, reportId );
|
||||
|
||||
reportId = hidGetNextValidReportId(reportId);
|
||||
TEST_ASSERT_EQUAL_UINT( 2, reportId );
|
||||
|
||||
reportId = hidGetNextValidReportId(reportId);
|
||||
TEST_ASSERT_EQUAL_UINT( 3, reportId );
|
||||
|
||||
reportId = hidGetNextValidReportId(reportId);
|
||||
TEST_ASSERT_EQUAL_UINT( 1, reportId );
|
||||
}
|
||||
|
||||
void test_is_report_id_valid( void ) {
|
||||
unsigned isValid = 0;
|
||||
|
||||
unsigned reportId = 0;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, isValid );
|
||||
|
||||
reportId = 1;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, isValid );
|
||||
|
||||
reportId = 2;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, isValid );
|
||||
|
||||
reportId = 3;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, isValid );
|
||||
|
||||
reportId = 4;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, isValid );
|
||||
}
|
||||
|
||||
// Basic report descriptor tests
|
||||
void test_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
|
||||
for (unsigned reportId = 1; reportId <= HID_REPORT_COUNT; reportId++)
|
||||
{
|
||||
unsigned reportLength = hidGetReportLength( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, reportLength );
|
||||
}
|
||||
}
|
||||
|
||||
void test_prepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned reportLength = hidGetReportLength( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, reportLength );
|
||||
|
||||
reportId = 2;
|
||||
reportLength = hidGetReportLength( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 2, reportLength );
|
||||
|
||||
reportId = 3;
|
||||
reportLength = hidGetReportLength( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, reportLength );
|
||||
}
|
||||
|
||||
void test_reset_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
hidResetReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_reset_prepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
hidResetReportDescriptor();
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_report_id_limit( void )
|
||||
{
|
||||
unsigned reportIdLimit = hidGetReportIdLimit();
|
||||
TEST_ASSERT_EQUAL_UINT( HID_REPORTID_LIMIT, reportIdLimit );
|
||||
}
|
||||
|
||||
// Basic item tests
|
||||
void test_max_loc_hidGetReportItem( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ];
|
||||
unsigned char header;
|
||||
unsigned char page;
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MAX_VALID_BIT;
|
||||
unsigned byte = REPORT1_MAX_VALID_BYTE;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( KEYBOARD_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x73, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MAX_VALID_BIT;
|
||||
byte = REPORT2_MAX_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( CONSUMER_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xE5, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MAX_VALID_BIT;
|
||||
byte = REPORT3_MAX_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( TELEPHONY_DEVICE_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x2F, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
}
|
||||
|
||||
|
||||
void test_min_loc_hidGetReportItem( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ];
|
||||
unsigned char header;
|
||||
unsigned char page;
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( KEYBOARD_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x17, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MIN_VALID_BIT;
|
||||
byte = REPORT2_MIN_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( CONSUMER_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x0A, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x26, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x02, data[ 1 ]);
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MIN_VALID_BIT;
|
||||
byte = REPORT3_MIN_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( TELEPHONY_DEVICE_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x20, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_invalid_report_id( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD2 };
|
||||
unsigned char header = 0x33;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned reportId = 0;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_ID, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x33, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD2, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_unused_report_id( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD2 };
|
||||
unsigned char header = 0x33;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned reportId = 8;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_ID, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x33, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD2, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_overflow_bit_hidGetReportItem( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MAX_VALID_BIT + 1;
|
||||
unsigned byte = REPORT1_MAX_VALID_BYTE;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MAX_VALID_BIT + 1;
|
||||
byte = REPORT2_MAX_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MAX_VALID_BIT + 1;
|
||||
byte = REPORT3_MAX_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_overflow_byte_hidGetReportItem( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MAX_VALID_BIT;
|
||||
unsigned byte = REPORT1_MAX_VALID_BYTE + 1;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MAX_VALID_BIT;
|
||||
byte = REPORT2_MAX_VALID_BYTE + 1;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MAX_VALID_BIT;
|
||||
byte = REPORT3_MAX_VALID_BYTE + 1;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_underflow_bit_hidGetReportItem( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT - 1;
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MIN_VALID_BIT - 1;
|
||||
byte = REPORT2_MIN_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MIN_VALID_BIT - 1;
|
||||
byte = REPORT3_MIN_VALID_BYTE;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_underflow_byte_hidGetReportItem( void )
|
||||
{
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE - 1;
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MIN_VALID_BIT;
|
||||
byte = REPORT2_MIN_VALID_BYTE - 1;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MIN_VALID_BIT;
|
||||
byte = REPORT3_MIN_VALID_BYTE - 1;
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
// Configurable and non-configurable item tests
|
||||
void test_configurable_item_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 1;
|
||||
const unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned char data[ 1 ] = { KEYBOARD_X };
|
||||
unsigned char header = construct_usage_header( sizeof( data ) / sizeof( unsigned char ));
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( KEYBOARD_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( KEYBOARD_X, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
}
|
||||
|
||||
// Testing that the high byte of the report gets correctly cleared
|
||||
void test_configurable_item_hidSetReportItem_multibyte_orig( void )
|
||||
{
|
||||
const unsigned reportId = 2;
|
||||
const unsigned bit = 1; // This byte&bit combo is originally set be 2 bytes long in the header
|
||||
const unsigned byte = 0;
|
||||
unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
unsigned char header = construct_usage_header( sizeof( data ) / sizeof( unsigned char ));
|
||||
unsigned char page = CONSUMER_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( CONSUMER_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( LOUDNESS_CONTROL, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_nonconfigurable_item_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 1;
|
||||
const unsigned bit = 1; // This bit and byte combination should not appear in the
|
||||
const unsigned byte = 0; // hidConfigurableElements list in hid_report_descriptors.c.
|
||||
const unsigned char data[ 1 ] = { KEYBOARD_X };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = KEYBOARD_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
// Bit range tests
|
||||
void test_max_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MAX_VALID_BIT; // See the hidConfigurableElements list in hid_report_descriptors.c.
|
||||
unsigned byte = REPORT1_MAX_VALID_BYTE;
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MAX_VALID_BIT;
|
||||
byte = REPORT2_MAX_VALID_BYTE;
|
||||
page = CONSUMER_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MAX_VALID_BIT;
|
||||
byte = REPORT3_MAX_VALID_BYTE;
|
||||
page = TELEPHONY_DEVICE_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_min_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT; // See the hidConfigurableElements list in hid_report_descriptors.c.
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MIN_VALID_BIT;
|
||||
byte = REPORT2_MIN_VALID_BYTE;
|
||||
page = CONSUMER_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MIN_VALID_BIT;
|
||||
byte = REPORT3_MIN_VALID_BYTE;
|
||||
page = TELEPHONY_DEVICE_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_overflow_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MAX_VALID_BIT + 1; // See the hidConfigurableElements list in hid_report_descriptors.c.
|
||||
unsigned byte = REPORT1_MAX_VALID_BYTE;
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MAX_VALID_BIT + 1;
|
||||
byte = REPORT2_MAX_VALID_BYTE;
|
||||
page = CONSUMER_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MAX_VALID_BIT + 1;
|
||||
byte = REPORT3_MAX_VALID_BYTE;
|
||||
page = TELEPHONY_DEVICE_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
void test_underflow_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT - 1; // See the hidConfigurableElements list in hid_report_descriptors.c.
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MIN_VALID_BIT - 1;
|
||||
byte = REPORT2_MIN_VALID_BYTE;
|
||||
page = CONSUMER_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MIN_VALID_BIT - 1;
|
||||
byte = REPORT3_MIN_VALID_BYTE;
|
||||
page = TELEPHONY_DEVICE_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
void test_overflow_byte_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MAX_VALID_BIT; // See the hidConfigurableElements list in hid_report_descriptors.c.
|
||||
unsigned byte = REPORT1_MAX_VALID_BYTE + 1;
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MAX_VALID_BIT;
|
||||
byte = REPORT2_MAX_VALID_BYTE + 1;
|
||||
page = CONSUMER_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MAX_VALID_BIT;
|
||||
byte = REPORT3_MAX_VALID_BYTE + 1;
|
||||
page = TELEPHONY_DEVICE_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
void test_underflow_byte_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
|
||||
unsigned reportId = 1;
|
||||
unsigned bit = REPORT1_MIN_VALID_BIT; // See the hidConfigurableElements list in hid_report_descriptors.c.
|
||||
unsigned byte = REPORT1_MIN_VALID_BYTE - 1;
|
||||
unsigned char page = KEYBOARD_PAGE;
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 2;
|
||||
bit = REPORT2_MIN_VALID_BIT;
|
||||
byte = REPORT2_MIN_VALID_BYTE - 1;
|
||||
page = CONSUMER_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
|
||||
reportId = 3;
|
||||
bit = REPORT3_MIN_VALID_BIT;
|
||||
byte = REPORT3_MIN_VALID_BYTE - 1;
|
||||
page = TELEPHONY_DEVICE_PAGE;
|
||||
retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
// Size range tests
|
||||
void test_max_size_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 1;
|
||||
const unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
const unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0x00 };
|
||||
const unsigned char header = construct_usage_header( HID_REPORT_ITEM_MAX_SIZE );
|
||||
const unsigned char page = KEYBOARD_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_min_size_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 1;
|
||||
const unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0x00 );
|
||||
const unsigned char page = KEYBOARD_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_unsupported_size_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = REPORT1_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT1_MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0x03 );
|
||||
const unsigned char page = KEYBOARD_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_HEADER, retVal );
|
||||
}
|
||||
|
||||
// Combined function tests
|
||||
void test_initial_modification_without_subsequent_preparation( void )
|
||||
{
|
||||
const unsigned reportId = 2;
|
||||
const unsigned bit = REPORT2_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT2_MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_initial_modification_with_subsequent_preparation( void )
|
||||
{
|
||||
const unsigned reportId = 2;
|
||||
const unsigned bit = REPORT2_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT2_MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_initial_modification_with_subsequent_verification_1( void )
|
||||
{
|
||||
const unsigned reportId = 2;
|
||||
const unsigned bit = REPORT2_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT2_MIN_VALID_BYTE;
|
||||
|
||||
unsigned char get_data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xFF, 0xFF };
|
||||
unsigned char get_header = 0xFF;
|
||||
unsigned char get_page = 0xFF;
|
||||
|
||||
const unsigned char set_data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char set_header = construct_usage_header( sizeof set_data / sizeof( unsigned char ));
|
||||
const unsigned char set_page = CONSUMER_PAGE;
|
||||
|
||||
unsigned setRetVal = hidSetReportItem( reportId, byte, bit, set_page, set_header, set_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, setRetVal );
|
||||
|
||||
unsigned getRetVal = hidGetReportItem( reportId, byte, bit, &get_page, &get_header, get_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, getRetVal );
|
||||
TEST_ASSERT_EQUAL_UINT( set_page, get_page );
|
||||
TEST_ASSERT_EQUAL_UINT( set_header, get_header );
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 0 ], get_data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0, get_data[ 1 ]); // Should be MSB of data from hidUsageByte0Bit0 in hid_report_descriptor.h
|
||||
}
|
||||
|
||||
void test_initial_modification_with_subsequent_verification_2( void )
|
||||
{
|
||||
const unsigned reportId = 3;
|
||||
const unsigned bit = REPORT3_MIN_VALID_BIT;
|
||||
const unsigned byte = REPORT3_MIN_VALID_BYTE;
|
||||
|
||||
{
|
||||
unsigned char get_data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xFF, 0xFF };
|
||||
unsigned char get_header = 0xFF;
|
||||
unsigned char get_page = 0xFF;
|
||||
|
||||
const unsigned char set_data[ 2 ] = {( PHONE_HOST_HOLD & 0x00FF ), (( PHONE_HOST_HOLD & 0xFF00 ) >> 8 )};
|
||||
const unsigned char set_header = construct_usage_header( sizeof set_data / sizeof( unsigned char ));
|
||||
const unsigned char set_page = TELEPHONY_DEVICE_PAGE;
|
||||
|
||||
unsigned setRetVal = hidSetReportItem( reportId, byte, bit, set_page, set_header, set_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, setRetVal );
|
||||
|
||||
unsigned getRetVal = hidGetReportItem( reportId, byte, bit, &get_page, &get_header, get_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, getRetVal );
|
||||
TEST_ASSERT_EQUAL_UINT( set_page, get_page );
|
||||
TEST_ASSERT_EQUAL_UINT( set_header, get_header );
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 0 ], get_data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 1 ], get_data[ 1 ]);
|
||||
}
|
||||
|
||||
{
|
||||
unsigned char get_data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xFF, 0xFF };
|
||||
unsigned char get_header = 0xFF;
|
||||
unsigned char get_page = 0xFF;
|
||||
|
||||
const unsigned char set_data[ 1 ] = { PHONE_KEY_9 };
|
||||
const unsigned char set_header = construct_usage_header( sizeof set_data / sizeof( unsigned char ));
|
||||
const unsigned char set_page = TELEPHONY_DEVICE_PAGE;
|
||||
|
||||
unsigned setRetVal = hidSetReportItem( reportId, byte, bit, set_page, set_header, set_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, setRetVal );
|
||||
|
||||
unsigned getRetVal = hidGetReportItem( reportId, byte, bit, &get_page, &get_header, get_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, getRetVal );
|
||||
TEST_ASSERT_EQUAL_UINT( set_page, get_page );
|
||||
TEST_ASSERT_EQUAL_UINT( set_header, get_header );
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 0 ], get_data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0, get_data[ 1 ]); // The call to hidSetReportItem with size 1 in the header should return the MSB to zero
|
||||
}
|
||||
}
|
||||
|
||||
//setIdle and associated timing functionality tests
|
||||
void test_set_idle( void )
|
||||
{
|
||||
unsigned reportId = 1;
|
||||
unsigned reportId2 = 2;
|
||||
|
||||
unsigned setIdle = hidIsIdleActive( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
|
||||
|
||||
setIdle = hidIsIdleActive( reportId2 );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
|
||||
|
||||
hidSetIdle( reportId, 1 );
|
||||
setIdle = hidIsIdleActive( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, setIdle );
|
||||
|
||||
setIdle = hidIsIdleActive( reportId2 );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
|
||||
}
|
||||
|
||||
void test_set_all_idle( void )
|
||||
{
|
||||
unsigned reportId = 1;
|
||||
unsigned reportId2 = 2;
|
||||
|
||||
unsigned setIdle = hidIsIdleActive( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
|
||||
|
||||
setIdle = hidIsIdleActive( reportId2 );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
|
||||
|
||||
for ( reportId = 1; reportId <= HID_REPORT_COUNT; ++reportId ) {
|
||||
hidSetIdle( reportId, 1 );
|
||||
setIdle = hidIsIdleActive( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, setIdle );
|
||||
}
|
||||
}
|
||||
|
||||
void test_change_pending( void )
|
||||
{
|
||||
unsigned reportId = 1;
|
||||
unsigned reportId2 = 2;
|
||||
|
||||
unsigned changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, changePending );
|
||||
|
||||
changePending = hidIsChangePending( reportId2 );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, changePending );
|
||||
|
||||
hidSetChangePending( reportId );
|
||||
changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, changePending );
|
||||
|
||||
changePending = hidIsChangePending( reportId2 );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, changePending );
|
||||
}
|
||||
|
||||
void test_change_pending_all( void )
|
||||
{
|
||||
unsigned reportId = 1;
|
||||
|
||||
unsigned changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, changePending );
|
||||
|
||||
for ( reportId = 1; reportId <= HID_REPORT_COUNT; ++reportId ) {
|
||||
hidSetChangePending( reportId );
|
||||
changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, changePending );
|
||||
}
|
||||
}
|
||||
|
||||
void test_report_time( void )
|
||||
{
|
||||
unsigned reportTime1 = 123;
|
||||
unsigned reportTime2 = 456;
|
||||
|
||||
hidCaptureReportTime(1, reportTime1);
|
||||
hidCaptureReportTime(2, reportTime2);
|
||||
reportTime1 = hidGetReportTime(1);
|
||||
reportTime2 = hidGetReportTime(2);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT(123, reportTime1);
|
||||
TEST_ASSERT_EQUAL_UINT(456, reportTime2);
|
||||
}
|
||||
|
||||
void test_report_time_calc( void )
|
||||
{
|
||||
unsigned reportTime1 = 123;
|
||||
unsigned reportTime2 = 456;
|
||||
unsigned reportPeriod1 = 10;
|
||||
unsigned reportPeriod2 = 5;
|
||||
|
||||
hidCaptureReportTime(1, reportTime1);
|
||||
hidCaptureReportTime(2, reportTime2);
|
||||
hidSetReportPeriod(1, reportPeriod1);
|
||||
hidSetReportPeriod(2, reportPeriod2);
|
||||
reportTime1 = hidGetReportTime(1);
|
||||
reportTime2 = hidGetReportTime(2);
|
||||
reportPeriod1 = hidGetReportPeriod(1);
|
||||
reportPeriod2 = hidGetReportPeriod(2);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT(123, reportTime1);
|
||||
TEST_ASSERT_EQUAL_UINT(456, reportTime2);
|
||||
TEST_ASSERT_EQUAL_UINT(10, reportPeriod1);
|
||||
TEST_ASSERT_EQUAL_UINT(5, reportPeriod2);
|
||||
|
||||
hidCalcNextReportTime(1);
|
||||
hidCalcNextReportTime(2);
|
||||
unsigned nextReportTime1 = hidGetNextReportTime(1);
|
||||
unsigned nextReportTime2 = hidGetNextReportTime(2);
|
||||
TEST_ASSERT_EQUAL_UINT( reportTime1 + reportPeriod1, nextReportTime1 );
|
||||
TEST_ASSERT_EQUAL_UINT( reportTime2 + reportPeriod2, nextReportTime2 );
|
||||
}
|
||||
145
tests/xua_unit_tests/src/test_simple/hid_report_descriptor.h
Normal file
145
tests/xua_unit_tests/src/test_simple/hid_report_descriptor.h
Normal file
@@ -0,0 +1,145 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
* (These are short items as the location field isn't relevant for them)
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionLogical = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount7 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x07, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Mute
|
||||
|
||||
static USB_HID_Report_Element_t hidUsageByte1Bit7 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 1, 7)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte1Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 1, 0)
|
||||
}; // Vol+
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte1Bit0,
|
||||
&hidUsageByte1Bit7
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidReportSize1,
|
||||
&hidLogicalMinimum0,
|
||||
&hidCollectionLogical, // Byte 0
|
||||
&hidLogicalMaximum1,
|
||||
&hidReportCount1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount7,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd,
|
||||
&hidCollectionLogical, // Byte 1
|
||||
&hidLogicalMaximum1,
|
||||
&hidReportCount1,
|
||||
&(hidUsageByte1Bit0.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount6,
|
||||
&hidInputConstArray,
|
||||
&hidReportCount1,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte1Bit7.item),
|
||||
&hidInputDataVar,
|
||||
&hidCollectionEnd,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
650
tests/xua_unit_tests/src/test_simple/test_hid.c
Normal file
650
tests/xua_unit_tests/src/test_simple/test_hid.c
Normal file
@@ -0,0 +1,650 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xua_unit_tests.h"
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
// Test constants related to the report descriptor defined in hid_report_descriptor.h
|
||||
#define MAX_VALID_BIT ( 7 )
|
||||
#define MAX_VALID_BYTE ( 1 )
|
||||
|
||||
#define MIN_VALID_BIT ( 0 )
|
||||
#define MIN_VALID_BYTE ( 0 )
|
||||
|
||||
#define HID_REPORT_LENGTH ( 2 )
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
#define HID_REPORTID_LIMIT ( 1 )
|
||||
|
||||
// Constants from the USB HID Usage Tables
|
||||
#define CONSUMER_CONTROL_PAGE ( 0x0C )
|
||||
#define LOUDNESS_CONTROL ( 0xE7 )
|
||||
#define AL_CONTROL_PANEL ( 0x019F )
|
||||
|
||||
static unsigned construct_usage_header( unsigned size )
|
||||
{
|
||||
unsigned header = 0x00;
|
||||
|
||||
header |= ( HID_REPORT_ITEM_USAGE_TAG << HID_REPORT_ITEM_HDR_TAG_SHIFT ) & HID_REPORT_ITEM_HDR_TAG_MASK;
|
||||
header |= ( HID_REPORT_ITEM_USAGE_TYPE << HID_REPORT_ITEM_HDR_TYPE_SHIFT ) & HID_REPORT_ITEM_HDR_TYPE_MASK;
|
||||
|
||||
header |= ( size << HID_REPORT_ITEM_HDR_SIZE_SHIFT ) & HID_REPORT_ITEM_HDR_SIZE_MASK;
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
void setUp( void )
|
||||
{
|
||||
hidReportInit();
|
||||
hidResetReportDescriptor();
|
||||
}
|
||||
|
||||
void test_validate_report( void ) {
|
||||
unsigned retVal = hidReportValidate();
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_reportid_in_use( void ) {
|
||||
unsigned reportIdInUse = hidIsReportIdInUse();
|
||||
TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse );
|
||||
}
|
||||
|
||||
void test_get_next_valid_report_id( void ) {
|
||||
unsigned reportId = 0U;
|
||||
|
||||
reportId = hidGetNextValidReportId(reportId);
|
||||
TEST_ASSERT_EQUAL_UINT( 0, reportId );
|
||||
|
||||
reportId = hidGetNextValidReportId(reportId);
|
||||
TEST_ASSERT_EQUAL_UINT( 0, reportId );
|
||||
}
|
||||
|
||||
void test_is_report_id_valid( void ) {
|
||||
unsigned isValid = 0;
|
||||
|
||||
unsigned reportId = 0;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, isValid );
|
||||
|
||||
reportId = 1;
|
||||
isValid = hidIsReportIdValid( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, isValid );
|
||||
}
|
||||
|
||||
// Basic report descriptor tests
|
||||
void test_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
|
||||
unsigned reportLength = hidGetReportLength( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, reportLength );
|
||||
}
|
||||
|
||||
void test_prepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
|
||||
unsigned reportLength = hidGetReportLength( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_REPORT_LENGTH, reportLength );
|
||||
}
|
||||
|
||||
void test_reset_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
hidResetReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_reset_prepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
hidResetReportDescriptor();
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_report_id_limit( void )
|
||||
{
|
||||
unsigned reportIdLimit = hidGetReportIdLimit();
|
||||
TEST_ASSERT_EQUAL_UINT( HID_REPORTID_LIMIT, reportIdLimit );
|
||||
}
|
||||
|
||||
// Basic item tests
|
||||
void test_max_loc_hidGetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MAX_VALID_BIT;
|
||||
const unsigned byte = MAX_VALID_BYTE;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ];
|
||||
unsigned char header;
|
||||
unsigned char page;
|
||||
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( CONSUMER_CONTROL_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xEA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_min_loc_hidGetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ];
|
||||
unsigned char header;
|
||||
unsigned char page;
|
||||
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( CONSUMER_CONTROL_PAGE, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x09, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xE2, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0x00, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_overflow_bit_hidGetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MAX_VALID_BIT + 1;
|
||||
const unsigned byte = MAX_VALID_BYTE;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_overflow_byte_hidGetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MAX_VALID_BIT;
|
||||
const unsigned byte = MAX_VALID_BYTE + 1;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_underflow_bit_hidGetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const int bit = MIN_VALID_BIT - 1;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned retVal = hidGetReportItem( reportId, byte, ( unsigned ) bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
void test_underflow_byte_hidGetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const int byte = MIN_VALID_BYTE - 1;
|
||||
unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xBA, 0xD1 };
|
||||
unsigned char header = 0xAA;
|
||||
unsigned char page = 0x44;
|
||||
|
||||
unsigned retVal = hidGetReportItem( reportId, ( unsigned ) byte, bit, &page, &header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
TEST_ASSERT_EQUAL_UINT( 0x44, page );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xAA, header );
|
||||
TEST_ASSERT_EQUAL_UINT( 0xBA, data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0xD1, data[ 1 ]);
|
||||
}
|
||||
|
||||
// Configurable and non-configurable item tests
|
||||
void test_configurable_item_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_nonconfigurable_item_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MAX_VALID_BIT; // This bit and byte combination should not appear in the
|
||||
const unsigned byte = MIN_VALID_BYTE; // hidConfigurableElements list in hid_report_descriptors.c.
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
// Bit range tests
|
||||
void test_max_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MAX_VALID_BIT; // Only byte 1 has bit 7 not reserved, See the
|
||||
const unsigned byte = MAX_VALID_BYTE; // hidConfigurableElements list in hid_report_descriptors.c.
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_min_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_overflow_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MAX_VALID_BIT + 1;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
void test_underflow_bit_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const int bit = MIN_VALID_BIT - 1;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, ( unsigned ) bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
// Byte range tests
|
||||
void test_max_byte_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MAX_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_min_byte_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_overflow_byte_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MAX_VALID_BYTE + 1;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
void test_underflow_byte_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const int byte = MIN_VALID_BYTE - 1;
|
||||
const unsigned char header = construct_usage_header( 0 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, ( unsigned ) byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_LOCATION, retVal );
|
||||
}
|
||||
|
||||
// Size range tests
|
||||
void test_max_size_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0x00 };
|
||||
const unsigned char header = construct_usage_header( HID_REPORT_ITEM_MAX_SIZE );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_min_size_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0x00 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_unsupported_size_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = construct_usage_header( 0x03 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_HEADER, retVal );
|
||||
}
|
||||
|
||||
// Header tag and type tests
|
||||
void test_bad_tag_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char good_header = construct_usage_header( 0x00 );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
for( unsigned tag = 0x01; tag <= 0x0F; ++tag ) {
|
||||
unsigned char bad_header = good_header | (( tag << HID_REPORT_ITEM_HDR_TAG_SHIFT ) & HID_REPORT_ITEM_HDR_TAG_MASK );
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, bad_header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_HEADER, retVal );
|
||||
}
|
||||
}
|
||||
|
||||
void test_global_type_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = ( construct_usage_header( 0x00 ) & ~HID_REPORT_ITEM_HDR_TYPE_MASK ) |
|
||||
(( HID_REPORT_ITEM_TYPE_GLOBAL << HID_REPORT_ITEM_HDR_TYPE_SHIFT ) & HID_REPORT_ITEM_HDR_TYPE_MASK );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_HEADER, retVal );
|
||||
}
|
||||
|
||||
void test_local_type_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = ( construct_usage_header( 0x00 ) & ~HID_REPORT_ITEM_HDR_TYPE_MASK ) |
|
||||
(( HID_REPORT_ITEM_TYPE_LOCAL << HID_REPORT_ITEM_HDR_TYPE_SHIFT ) & HID_REPORT_ITEM_HDR_TYPE_MASK );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_main_type_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = ( construct_usage_header( 0x00 ) & ~HID_REPORT_ITEM_HDR_TYPE_MASK ) |
|
||||
(( HID_REPORT_ITEM_TYPE_MAIN << HID_REPORT_ITEM_HDR_TYPE_SHIFT ) & HID_REPORT_ITEM_HDR_TYPE_MASK );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_HEADER, retVal );
|
||||
}
|
||||
|
||||
void test_reserved_type_hidSetReportItem( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char header = ( construct_usage_header( 0x00 ) & ~HID_REPORT_ITEM_HDR_TYPE_MASK ) |
|
||||
(( HID_REPORT_ITEM_TYPE_RESERVED << HID_REPORT_ITEM_HDR_TYPE_SHIFT ) & HID_REPORT_ITEM_HDR_TYPE_MASK );
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, NULL );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_BAD_HEADER, retVal );
|
||||
}
|
||||
|
||||
// Combined function tests
|
||||
void test_initial_modification_without_subsequent_preparation( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_initial_modification_with_subsequent_preparation( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_initial_modification_with_subsequent_verification_1( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
|
||||
unsigned char get_data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xFF, 0xFF };
|
||||
unsigned char get_header = 0xFF;
|
||||
unsigned char get_page = 0xFF;
|
||||
|
||||
const unsigned char set_data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char set_header = construct_usage_header( sizeof set_data / sizeof( unsigned char ));
|
||||
const unsigned char set_page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned setRetVal = hidSetReportItem( reportId, byte, bit, set_page, set_header, set_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, setRetVal );
|
||||
|
||||
unsigned getRetVal = hidGetReportItem( reportId, byte, bit, &get_page, &get_header, get_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, getRetVal );
|
||||
TEST_ASSERT_EQUAL_UINT( set_page, get_page );
|
||||
TEST_ASSERT_EQUAL_UINT( set_header, get_header );
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 0 ], get_data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0, get_data[ 1 ]); // Should be MSB of data from hidUsageByte0Bit0 in hid_report_descriptor.h
|
||||
}
|
||||
|
||||
void test_initial_modification_with_subsequent_verification_2( void )
|
||||
{
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
|
||||
{
|
||||
unsigned char get_data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xFF, 0xFF };
|
||||
unsigned char get_header = 0xFF;
|
||||
unsigned char get_page = 0xFF;
|
||||
|
||||
const unsigned char set_data[ 2 ] = {( AL_CONTROL_PANEL & 0x00FF ), (( AL_CONTROL_PANEL & 0xFF00 ) >> 8 )};
|
||||
const unsigned char set_header = construct_usage_header( sizeof set_data / sizeof( unsigned char ));
|
||||
const unsigned char set_page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned setRetVal = hidSetReportItem( reportId, byte, bit, set_page, set_header, set_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, setRetVal );
|
||||
|
||||
unsigned getRetVal = hidGetReportItem( reportId, byte, bit, &get_page, &get_header, get_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, getRetVal );
|
||||
TEST_ASSERT_EQUAL_UINT( set_page, get_page );
|
||||
TEST_ASSERT_EQUAL_UINT( set_header, get_header );
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 0 ], get_data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 1 ], get_data[ 1 ]);
|
||||
}
|
||||
|
||||
{
|
||||
unsigned char get_data[ HID_REPORT_ITEM_MAX_SIZE ] = { 0xFF, 0xFF };
|
||||
unsigned char get_header = 0xFF;
|
||||
unsigned char get_page = 0xFF;
|
||||
|
||||
const unsigned char set_data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char set_header = construct_usage_header( sizeof set_data / sizeof( unsigned char ));
|
||||
const unsigned char set_page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
unsigned setRetVal = hidSetReportItem( reportId, byte, bit, set_page, set_header, set_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, setRetVal );
|
||||
|
||||
unsigned getRetVal = hidGetReportItem( reportId, byte, bit, &get_page, &get_header, get_data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, getRetVal );
|
||||
TEST_ASSERT_EQUAL_UINT( set_page, get_page );
|
||||
TEST_ASSERT_EQUAL_UINT( set_header, get_header );
|
||||
TEST_ASSERT_EQUAL_UINT( set_data[ 0 ], get_data[ 0 ]);
|
||||
TEST_ASSERT_EQUAL_UINT( 0, get_data[ 1 ]); // The call to hidSetReportItem with size 1 in the header should return the MSB to zero
|
||||
}
|
||||
}
|
||||
|
||||
void test_modification_without_subsequent_preparation( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
hidResetReportDescriptor();
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
void test_modification_with_subsequent_preparation( void )
|
||||
{
|
||||
hidPrepareReportDescriptor();
|
||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
|
||||
const unsigned reportId = 0;
|
||||
const unsigned bit = MIN_VALID_BIT;
|
||||
const unsigned byte = MIN_VALID_BYTE;
|
||||
const unsigned char data[ 1 ] = { LOUDNESS_CONTROL };
|
||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||
|
||||
hidResetReportDescriptor();
|
||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
|
||||
hidPrepareReportDescriptor();
|
||||
reportDescPtr = hidGetReportDescriptor();
|
||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||
}
|
||||
|
||||
//setIdle functionality tests
|
||||
void test_set_idle( void )
|
||||
{
|
||||
unsigned reportId = 0;
|
||||
|
||||
unsigned setIdle = hidIsIdleActive( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
|
||||
|
||||
hidSetIdle( reportId, 1 );
|
||||
setIdle = hidIsIdleActive( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, setIdle );
|
||||
}
|
||||
|
||||
void test_change_pending( void )
|
||||
{
|
||||
unsigned reportId = 0;
|
||||
|
||||
unsigned changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, changePending );
|
||||
|
||||
hidSetChangePending( reportId );
|
||||
changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 1, changePending );
|
||||
|
||||
hidClearChangePending( reportId );
|
||||
changePending = hidIsChangePending( reportId );
|
||||
TEST_ASSERT_EQUAL_UINT( 0, changePending );
|
||||
}
|
||||
|
||||
void test_report_time( void )
|
||||
{
|
||||
unsigned reportTime = 123;
|
||||
unsigned reportPeriod = 10;
|
||||
|
||||
hidSetReportPeriod(0, reportPeriod);
|
||||
hidCaptureReportTime(0, reportTime);
|
||||
reportTime = hidGetReportTime(0);
|
||||
reportPeriod = hidGetReportPeriod(0);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT(123, reportTime);
|
||||
TEST_ASSERT_EQUAL_UINT(10, reportPeriod);
|
||||
|
||||
hidCalcNextReportTime(0);
|
||||
|
||||
unsigned nextReportTime = hidGetNextReportTime(0);
|
||||
TEST_ASSERT_EQUAL_UINT(133, nextReportTime);
|
||||
}
|
||||
37
tests/xua_unit_tests/src/xua_conf.h
Normal file
37
tests/xua_unit_tests/src/xua_conf.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#define NUM_USB_CHAN_OUT 2
|
||||
#define NUM_USB_CHAN_IN 2
|
||||
#define I2S_CHANS_DAC 2
|
||||
#define I2S_CHANS_ADC 2
|
||||
#define MCLK_441 (512 * 44100)
|
||||
#define MCLK_48 (512 * 48000)
|
||||
#define MIN_FREQ 48000
|
||||
#define MAX_FREQ 48000
|
||||
|
||||
#define EXCLUDE_USB_AUDIO_MAIN
|
||||
#define XUA_NUM_PDM_MICS 0
|
||||
|
||||
#define PDM_TILE 2
|
||||
#define XUD_TILE 1
|
||||
#define AUDIO_IO_TILE 1
|
||||
|
||||
#define MIXER 0
|
||||
|
||||
#define SPDIF_TX_INDEX 0
|
||||
#define VENDOR_STR "XMOS"
|
||||
#define VENDOR_ID 0x20B1
|
||||
#define PRODUCT_STR_A2 "XMOS USB Audio Class"
|
||||
#define PRODUCT_STR_A1 "XMOS USB Audio Class"
|
||||
#define PID_AUDIO_1 1
|
||||
#define PID_AUDIO_2 2
|
||||
#define AUDIO_CLASS 2
|
||||
#define AUDIO_CLASS_FALLBACK 0
|
||||
#define BCD_DEVICE 0x1234
|
||||
#define XUA_DFU_EN 0
|
||||
|
||||
/* TODO */
|
||||
#define XUA_DFU XUA_DFU_EN
|
||||
|
||||
#define FB_USE_REF_CLOCK 1
|
||||
28
tests/xua_unit_tests/src/xua_unit_test_helper.xc
Normal file
28
tests/xua_unit_tests/src/xua_unit_test_helper.xc
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifdef __XC__
|
||||
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
#include <xclib.h>
|
||||
|
||||
#endif // __XC__
|
||||
|
||||
|
||||
in port p_mclk_in = XS1_PORT_1D;
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_1; /* Bit clock */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_2; /* Master clock */
|
||||
|
||||
// Supply missing but unused function
|
||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
{
|
||||
; // nothing
|
||||
}
|
||||
|
||||
// Supply missing but unused function
|
||||
void AudioHwInit()
|
||||
{
|
||||
; // nothing
|
||||
}
|
||||
9
tests/xua_unit_tests/src/xua_unit_tests.h
Normal file
9
tests/xua_unit_tests/src/xua_unit_tests.h
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright 2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef XUA_UNIT_TESTS_H_
|
||||
#define XUA_UNIT_TESTS_H_
|
||||
|
||||
#include "unity.h"
|
||||
#include "xua_conf.h"
|
||||
|
||||
#endif /* XUA_UNIT_TESTS_H_ */
|
||||
259
tests/xua_unit_tests/wscript
Normal file
259
tests/xua_unit_tests/wscript
Normal file
@@ -0,0 +1,259 @@
|
||||
from __future__ import print_function
|
||||
import glob
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
from waflib import Options
|
||||
from waflib.Build import BuildContext, CleanContext
|
||||
|
||||
TARGETS = ['xcore200', 'xcoreai']
|
||||
|
||||
def get_ruby():
|
||||
"""
|
||||
Check ruby is avaliable and return the command to invoke it.
|
||||
"""
|
||||
interpreter_name = 'ruby'
|
||||
try:
|
||||
dev_null = open(os.devnull, 'w')
|
||||
# Call the version command to check the interpreter can be run
|
||||
subprocess.check_call([interpreter_name, '--version'],
|
||||
stdout=dev_null,
|
||||
close_fds=True)
|
||||
except OSError as e:
|
||||
print("Failed to run Ruby interpreter: {}".format(e), file=sys.stderr)
|
||||
exit(1) # TODO: Check this is the correct way to kill xwaf on error
|
||||
|
||||
return interpreter_name
|
||||
|
||||
|
||||
def get_unity_runner_generator(project_root_path):
|
||||
"""
|
||||
Check the Unity generate_test_runner script is avaliable, and return the
|
||||
path to it.
|
||||
"""
|
||||
unity_runner_generator = os.path.join(
|
||||
project_root_path, 'Unity', 'auto', 'generate_test_runner.rb')
|
||||
if not os.path.exists(unity_runner_generator):
|
||||
print("Unity repo not found in workspace", file=sys.stderr)
|
||||
exit(1) # TODO: Check this is the correct way to kill xwaf on error
|
||||
return unity_runner_generator
|
||||
|
||||
|
||||
def get_test_name(test_path):
|
||||
"""
|
||||
Return the test name by removing the extension from the filename.
|
||||
"""
|
||||
return os.path.splitext(os.path.basename(test_path))[0]
|
||||
|
||||
|
||||
def get_file_type(filename):
|
||||
"""
|
||||
Return the extension from the filename.
|
||||
"""
|
||||
return filename.rsplit('.')[-1:][0]
|
||||
|
||||
|
||||
def generate_unity_runner(project_root_path, unity_test_path, unity_runner_dir,
|
||||
unity_runner_suffix):
|
||||
"""
|
||||
Invoke the Unity runner generation script for the given test file, and
|
||||
return the path to the generated file. The output directory will be created
|
||||
if it does not already exist.
|
||||
"""
|
||||
runner_path = os.path.join(os.path.join(unity_runner_dir, get_test_name(unity_test_path)))
|
||||
if not os.path.exists(runner_path):
|
||||
os.makedirs(runner_path)
|
||||
|
||||
unity_runner_path = os.path.join(
|
||||
runner_path, get_test_name(unity_test_path) + unity_runner_suffix
|
||||
+ '.' + 'c')
|
||||
|
||||
try:
|
||||
subprocess.check_call([get_ruby(),
|
||||
get_unity_runner_generator(project_root_path),
|
||||
unity_test_path,
|
||||
unity_runner_path])
|
||||
except OSError as e:
|
||||
print("Ruby generator failed for {}\n\t{}".format(unity_test_path, e),
|
||||
file=sys.stderr)
|
||||
exit(1) # TODO: Check this is the correct way to kill xwaf on error
|
||||
|
||||
|
||||
def add_unity_runner_build_config(waf_conf, project_root_path, unity_test_path,
|
||||
unity_runner_build_flags, target):
|
||||
"""
|
||||
Add a config to xwaf to build each Unity test runner into an xCORE
|
||||
executable.
|
||||
"""
|
||||
print(f"get_test_name(unity_test_path) = {get_test_name(unity_test_path)}. target = {target}")
|
||||
waf_conf.setenv(get_test_name(unity_test_path) + '_' + target)
|
||||
waf_conf.load('xwaf.compiler_xcc')
|
||||
waf_conf.env.XCC_FLAGS = unity_runner_build_flags
|
||||
waf_conf.env.PROJECT_ROOT = project_root_path
|
||||
# TODO: can the xwaf boilerplate help here?
|
||||
|
||||
|
||||
def prepare_unity_test_for_build(waf_conf, project_root_path, unity_test_path,
|
||||
unity_runner_dir, unity_runner_suffix, target):
|
||||
print("unity_test_path: " + str(unity_test_path))
|
||||
generate_unity_runner(project_root_path, unity_test_path,
|
||||
unity_runner_dir, unity_runner_suffix)
|
||||
runner_build_flags = '' # Could extract flags from the test name
|
||||
add_unity_runner_build_config(waf_conf, project_root_path, unity_test_path,
|
||||
runner_build_flags, target)
|
||||
|
||||
|
||||
def find_unity_test_paths(unity_test_dir, unity_test_prefix):
|
||||
"""
|
||||
Return a list of all file paths with the unity_test_prefix found in the
|
||||
unity_test_dir.
|
||||
"""
|
||||
file_list = []
|
||||
for root, dirs, files in os.walk(unity_test_dir):
|
||||
for f in files:
|
||||
if f.startswith(unity_test_prefix):
|
||||
file_list.append(os.path.join(root,f))
|
||||
return file_list
|
||||
|
||||
|
||||
def find_unity_tests(unity_test_dir, unity_test_prefix):
|
||||
"""
|
||||
Return a dictionary of all {test names, test language} pairs with the
|
||||
unity_test_prefix found in the unity_test_dir.
|
||||
"""
|
||||
unity_test_paths = find_unity_test_paths(unity_test_dir, unity_test_prefix)
|
||||
return {get_test_name(path): {"language": get_file_type(path), "dir": os.path.dirname(path)}
|
||||
for path in unity_test_paths}
|
||||
|
||||
|
||||
def generate_all_unity_runners(waf_conf, project_root_path,
|
||||
unity_test_dir, unity_test_prefix,
|
||||
unity_runner_dir, unity_runner_suffix):
|
||||
"""
|
||||
Generate a runner and a build config for each test file in the
|
||||
unity_test_dir.
|
||||
"""
|
||||
# FIXME: pass unity_tests in?
|
||||
unity_test_paths = find_unity_test_paths(unity_test_dir, unity_test_prefix)
|
||||
for trgt in TARGETS:
|
||||
for unity_test_path in unity_test_paths:
|
||||
prepare_unity_test_for_build(waf_conf, project_root_path,
|
||||
unity_test_path,
|
||||
unity_runner_dir, unity_runner_suffix, trgt)
|
||||
|
||||
|
||||
# TODO: can the xwaf boilerplate help here?
|
||||
def create_waf_contexts(configs):
|
||||
for trgt in TARGETS:
|
||||
for test_name, params in configs.items():
|
||||
print(f"test_name {test_name}, test_language {params['language']}")
|
||||
for ctx in (BuildContext, CleanContext):
|
||||
raw_context = ctx.__name__.replace('Context', '').lower()
|
||||
|
||||
class tmp(ctx):
|
||||
cmd = raw_context + '_' + test_name + '_' + trgt
|
||||
variant = test_name + '_' + trgt
|
||||
#cmd = raw_context + '_' + test_name
|
||||
#variant = test_name
|
||||
language = params["language"]
|
||||
target = trgt
|
||||
runner = test_name
|
||||
directory = params["dir"]
|
||||
print(f"cmd {cmd}, variant {variant}, language {language}")
|
||||
|
||||
|
||||
UNITY_TEST_DIR = 'src'
|
||||
UNITY_TEST_PREFIX = 'test_'
|
||||
UNITY_RUNNER_DIR = 'runners'
|
||||
UNITY_RUNNER_SUFFIX = '_Runner'
|
||||
UNITY_TESTS = find_unity_tests(UNITY_TEST_DIR, UNITY_TEST_PREFIX)
|
||||
|
||||
print("UNITY_TESTS: " + str(UNITY_TESTS))
|
||||
|
||||
create_waf_contexts(UNITY_TESTS)
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--target', action='store', default='xcore200')
|
||||
opt.load('xwaf.xcommon')
|
||||
|
||||
def configure(conf):
|
||||
# TODO: move the call to generate_all_unity_runners() to build()
|
||||
project_root = os.path.join('..', '..', '..')
|
||||
generate_all_unity_runners(conf, project_root,
|
||||
UNITY_TEST_DIR, UNITY_TEST_PREFIX,
|
||||
UNITY_RUNNER_DIR, UNITY_RUNNER_SUFFIX)
|
||||
conf.load('xwaf.xcommon')
|
||||
|
||||
def build(bld):
|
||||
if not bld.variant:
|
||||
print('Adding test runners to build queue')
|
||||
trgt = [
|
||||
c for c in TARGETS if c == bld.options.target
|
||||
]
|
||||
|
||||
if len(trgt) == 0:
|
||||
bld.fatal('specify a target with --target.\nAvailable targets: {}'.format(', '.join(TARGETS)))
|
||||
return
|
||||
|
||||
for name in UNITY_TESTS:
|
||||
Options.commands.insert(0, 'build_' + name + '_' + trgt[0])
|
||||
#Options.commands.insert(0, 'build_' + name)
|
||||
print('Build queue {}'.format(Options.commands))
|
||||
else:
|
||||
print('Building runner {}'.format(bld.runner))
|
||||
bld.env.XSCOPE = bld.path.find_resource('config.xscope')
|
||||
|
||||
depends_on = ['lib_xua',
|
||||
'lib_xud',
|
||||
'lib_spdif',
|
||||
'lib_mic_array',
|
||||
'lib_logging',
|
||||
'lib_xassert',
|
||||
'Unity']
|
||||
|
||||
makefile_opts = {}
|
||||
makefile_opts['SOURCE_DIRS'] = ['src', bld.directory, os.path.join('runners',bld.runner)]
|
||||
if(bld.target == 'xcoreai'):
|
||||
print('TARGET XCOREAI')
|
||||
makefile_opts['TARGET'] = ['XCORE-AI-EXPLORER']
|
||||
else:
|
||||
print('TARGET XCORE200')
|
||||
makefile_opts['TARGET'] = ['XCORE-200-EXPLORER']
|
||||
|
||||
makefile_opts['INCLUDE_DIRS'] = ['src',
|
||||
bld.directory,
|
||||
'../../lib_xua/api',
|
||||
'../../lib_xua/src/core/pdm_mics',
|
||||
'../../lib_xua/src/hid',
|
||||
'../../../lib_xud/lib_xud/src/user/class']
|
||||
|
||||
makefile_opts['XCC_FLAGS'] = ['-O2',
|
||||
'-g',
|
||||
'-Wall',
|
||||
'-DUNITY_SUPPORT_64',
|
||||
'-DUNITY_INCLUDE_DOUBLE',
|
||||
'-DXUD_CORE_CLOCK=600',
|
||||
'-DXUD_SERIES_SUPPORT=4']
|
||||
|
||||
makefile_opts['APP_NAME'] = [bld.variant]
|
||||
makefile_opts['USED_MODULES'] = depends_on
|
||||
makefile_opts['XCOMMON_MAKEFILE'] = ['Makefile.common']
|
||||
bld.do_xcommon(makefile_opts)
|
||||
|
||||
|
||||
def test(bld):
|
||||
# Call pytest to run Unity tests inside axe or xsim
|
||||
try:
|
||||
test_output = subprocess.check_output(['pytest'])
|
||||
except subprocess.CalledProcessError as e:
|
||||
# pytest exits non-zero if an assertion fails
|
||||
test_output = e.output
|
||||
print(test_output)
|
||||
|
||||
|
||||
# TODO: ensure clean deletes the runners dir/
|
||||
def dist(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
|
||||
def distcheck(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
120
xpd.xml
120
xpd.xml
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<xpd>
|
||||
<components>
|
||||
<component description = "module_dfu" type = "demoCode" scope = "General Use" path = "module_dfu" local = "false" id = "module_dfu" name = "module_dfu">
|
||||
<board>XMOS USB Audio Reference Designes</board>
|
||||
<keyword>DFU</keyword>
|
||||
</component>
|
||||
<component description = "queue" type = "demoCode" scope = "General Use" path = "module_queue" local = "false" id = "module_queue" name = "Queuing Module For USB Audio Framework">
|
||||
<board></board>
|
||||
<keyword>UAC2</keyword>
|
||||
</component>
|
||||
<component description = "Core USB Audio Module" type = "demoCode" scope = "General Use" path = "module_usb_audio" local = "false" id = "module_usb_audio" name = "USB AUDIO MODULE">
|
||||
<board>XR-USB-AUDIO-20-MC</board>
|
||||
<keyword>USB Audio UAC2</keyword>
|
||||
</component>
|
||||
<component description = "MIDI" type = "demoCode" scope = "General Use" path = "module_usb_midi" local = "false" id = "module_usb_midi" name = "MIDI Module for USB Audio Framework">
|
||||
<board></board>
|
||||
<componentDependency version = "7.4.1">module_queue</componentDependency>
|
||||
<keyword>MIDI</keyword>
|
||||
</component>
|
||||
</components>
|
||||
<description>USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.</description>
|
||||
<docdir>module_dfu/doc</docdir>
|
||||
<git_export>False</git_export>
|
||||
<location>git://git/apps/sc_usb_audio</location>
|
||||
<name>USB Audio Shared Components</name>
|
||||
<maintainer>xross</maintainer>
|
||||
<partnumber>XM-004719-DH</partnumber>
|
||||
<release parenthash = "98b3bdba959bbaff0eba0e73f3b05d6adea82bbd" version = "1.0.0rc0" githash = "543155aaefc8f2b0109393c543429edd16eefa8c"></release>
|
||||
<release parenthash = "45f920c8adaad076c5e5f391094950a7de2fe8bb" version = "6.3.3alpha0" githash = "d07ec8f9a2f7fabbedd041c9a92c848de583c5b7"></release>
|
||||
<release parenthash = "cfe9f508f1f10d5d3a5bbfca96fb9e018c85e2f5" version = "6.3.3alpha1" githash = "5fb9a989355e40e709166629e1233ace1a0391ff"></release>
|
||||
<release parenthash = "055f05bfab5a4c31a7a32fc9a9acade5b747888c" version = "6.3.3alpha2" githash = "e4fd029d3de7bb3c33f80b6ffd94004d9a49d6a8"></release>
|
||||
<release parenthash = "6dffaa379b87011dd364aaaebbcf58f08e156fe1" version = "6.3.3alpha3" githash = "2b536a00da240d713f77114da393e6baa2857521"></release>
|
||||
<release parenthash = "62fc22ffc5ca39a5917277fcb97b8d3b7f05b311" version = "6.3.3alpha4" githash = "4c4cf162049902f3e532eaae88d48eff196981a2"></release>
|
||||
<release parenthash = "b2660cf04e4705b99d027061d7576afc03d7124c" version = "6.3.3alpha5" githash = "104c70b4021d9176f8d1ff7b27741efa63f0ca7d"></release>
|
||||
<release parenthash = "e90ed6b9ec4c366520bbc7546f463bd003f30c59" version = "6.4.0beta0" githash = "95a7caf8beb8afb74abe3323267710c0678dd32b"></release>
|
||||
<release parenthash = "90eacf1170afb807c0541704fb94acb722215255" version = "6.4.0beta1" githash = "92087a2d40da2276c06dffd2b616532e65ea002d"></release>
|
||||
<release parenthash = "fe3b0251da73729f957b1a5a766fe60b494d717a" version = "6.4.0beta2" githash = "432d39434a59418ef3449ae02005bf12e8f6fc61"></release>
|
||||
<release parenthash = "bbd02f157fba840d918838a4922ca5b1fa4cae21" version = "6.4.0beta3" githash = "c6ed243a82555bd3e2825dad48266e3a307db716"></release>
|
||||
<release parenthash = "486a19f54934e9eaa6662f316a4913b9af5db43b" version = "6.4.0beta4" githash = "80817b73ccbefa48819c70ec46b997af27de2ff7"></release>
|
||||
<release parenthash = "bee14703105874475756abeaefe2fbfc42f6b035" version = "6.5.0beta0" githash = "9c5e0a1dd8b18cad1b7394260d67bcfc5b290834"></release>
|
||||
<release parenthash = "0e120103c1b48d237420a462b68207fbd146acfa" version = "6.5.0beta1" githash = "1e31c9e51847fad9950d03d80dba86a9a8505bee"></release>
|
||||
<release parenthash = "acd4fb35da412a9fbba8776d32a6a7d6fe57d9b4" version = "6.5.0beta2" githash = "8a6be40889401c5fc5815f3075185819a21cf871"></release>
|
||||
<release parenthash = "64f42250848119c3ffddf41021a1a8edf6ab30f3" version = "6.5.1beta0" githash = "1488353b8d72e4dc0ed1b7975ec7df2460864fd9"></release>
|
||||
<release parenthash = "125d4e6eb199947ef868f22c6f4b9b280b69722c" version = "6.5.1beta1" githash = "092569f76b23ea361a311acade971db1235c7e33"></release>
|
||||
<release parenthash = "18073920cb2d1d6ca3ea0dfe6e8c65c98acab368" version = "6.5.1beta2" githash = "ae3db9b98d84a2dd2a00ef144e1434602c005fb0"></release>
|
||||
<release parenthash = "8966f5db59939aa6373c85162e868462e9afc3fd" version = "6.5.1beta3" githash = "ff4cd847811d541fd2cd80508a9ecf07047fa6da"></release>
|
||||
<release parenthash = "8f3067dcaaa34bd8fc0d3f64d2894c49b4efe056" version = "6.5.1beta4" githash = "d974daec508348baff08f5b51b5966b773f0a7b6"></release>
|
||||
<release parenthash = "6a0449e56872d96d13c33ffc39888bea0cd52cad" version = "6.5.1rc0" githash = "dcfc791b3e9f3bee50fab2cd7c5070ed24a1c3da"></release>
|
||||
<release parenthash = "16149f4746d69fdc7b811f4fc36bcea310d5375b" version = "6.5.1rc1" githash = "ed6bb50d26c3b588fa14ab4aac15a5204527954c"></release>
|
||||
<release parenthash = "ba1d9ffac27c667cae836824dee94d98bd5c6496" version = "6.5.1rc2" githash = "2bd20a2097ffdd029148cc3fd53cc05d6fcadc94"></release>
|
||||
<release parenthash = "6a3ec894175598c0efd7827590963bd63b0fd738" version = "6.5.1rc3" githash = "4044db7a28f55da1c7997c9994c08f7100f41091"></release>
|
||||
<release parenthash = "2fe1d3cbf25c7cedf614d8cb84d4ce60cc6fda10" version = "6.5.1rc4" githash = "92918706a3c2212335bd8d34b5b8c905884bf6f1"></release>
|
||||
<release parenthash = "24ddedc6927fe3f8dc081df71c01805a4a4e0792" version = "6.6.0beta0" githash = "555e001e071008d804f7a8d03f1837b0b810c074"></release>
|
||||
<release parenthash = "ccf7c66588501a090ab25003f3d646b22c03b243" version = "6.6.0beta1" githash = "91c7bcff7a403fc9638bd05fcb4b63f75b7eccca"></release>
|
||||
<release parenthash = "91c7bcff7a403fc9638bd05fcb4b63f75b7eccca" version = "6.6.0rc0" githash = "3a340d50732b31012b412d35598bbf311df2b914"></release>
|
||||
<release parenthash = "d7f0cdd4be780869137968f00f1d2a46663a1f33" version = "6.6.0rc1" githash = "a714e668020fe14128b213eae7ea3290d4ddf28a"></release>
|
||||
<release parenthash = "192b263d764650b2b498157b192dbda8882aba99" version = "6.6.0rc2" githash = "74d448097f79524c97fc2967bb227264a39be016"></release>
|
||||
<release parenthash = "9be1ef8d706be7027c3712a2fef15144767dfe55" version = "6.6.1rc0" githash = "6456645f423546b708db53aa5979967b3c8019aa"></release>
|
||||
<release parenthash = "7c17932c58c8e1d32a9002fe635672b95fff259d" version = "6.6.1rc1" githash = "9ce2f74146e6be516ed19cc767a03e52a6eb31a2"></release>
|
||||
<release parenthash = "f2b688b4cb1ff723c322ddea30ee4608bd1edb4e" version = "6.6.2rc0" githash = "2a11db1e567ccbd8a6c3da10c4a85262c1f31e1b"></release>
|
||||
<release parenthash = "1677eb49b0fec05c231727d6938643e0e7f07a10" version = "6.7.0alpha0" githash = "eea9122373f95302c67ce82749cb10ae8167ef83"></release>
|
||||
<release parenthash = "3a67e1ce52406dd1af8600a483b038e745f1f33a" version = "6.8.0alpha0" githash = "abd65222735d714aa4ca759f39811d41d10421da"></release>
|
||||
<release parenthash = "54c26602b86acb9dee6d18e6795a25da60300b96" version = "6.8.0alpha1" githash = "2f51ee286c387631e23258d5a1f702c7da754da3"></release>
|
||||
<release parenthash = "49cb1290c9aa58823ac893cef97d46b4f95799c5" version = "6.8.0alpha2" githash = "ae85f31e22e8651950b619b2930f39791b31f9f2"></release>
|
||||
<release parenthash = "085c444f40fd6189021b7d0bd5f131d40c0143e2" version = "6.9.0alpha0" githash = "b8819146cffb531fe9d044a78cce000da6d9c50c"></release>
|
||||
<release parenthash = "75d5b0d4574c1766113ed3781b6218a75188da94" version = "6.10.0alpha0" githash = "8f9c2b960bd0fd6b7567d51d232c13b40619b0bc"></release>
|
||||
<release parenthash = "d8939e38f70969a8312e27ac966f7a9ffe3267ee" version = "6.10.0alpha1" githash = "876e5a26068056a2cc2d52a6b543ce1f80a33e2e"></release>
|
||||
<release parenthash = "30f610d185606bd17061581debb6693369fcbb05" version = "6.10.0alpha2" githash = "517fe9667c43f2c5fe0d8e5dae06be716342a16a"></release>
|
||||
<release parenthash = "38958db165ea44a8db74abd0cf294fcb466e5172" version = "6.11.0alpha0" githash = "af925d59b69833c0ec8d970b667b4164833e5d4c"></release>
|
||||
<release parenthash = "a4af4fd0f27b117df1f6e7ff6a10299f2ea91349" version = "6.11.0alpha1" githash = "bed9f5314a0f7f2c952da24bd6efa18931b12b93"></release>
|
||||
<release parenthash = "66ce8f8a6e982c3de563205d12e0ed10725ef8c3" version = "6.11.0alpha2" githash = "7f8c3c687022e4664ba8f7d455ffcef8656911c0"></release>
|
||||
<release parenthash = "6eaa986eb9b385a4be9de719fd906daa8b36a6bf" version = "6.11.1beta0" githash = "fa12263ac6248aa95abcdb11eaa5d6b09cffff7f"></release>
|
||||
<release parenthash = "8335ef56cdc879e7e84a338534e10091b86b1e5a" version = "6.11.1beta1" githash = "3e61cee71c4aaa845908d5d9dfb9257a1000215d"></release>
|
||||
<release parenthash = "214c5c4f4287b2e0f78a397d5ae9edeaceefa3b2" version = "6.11.1beta2" githash = "1e963e8bc5e02fc4a03cc1b4059533a7734417e9"></release>
|
||||
<release parenthash = "575ee95714761eef35b2b59db4d09fe0bb311827" version = "6.11.2rc0" githash = "5bf4f147b1442ab7c682bb39cf9a159fe3770bf2"></release>
|
||||
<release parenthash = "67b217f48f3e37fc9c185f126d0ce78e1892203d" version = "6.11.2rc1" githash = "46faa608ccdc0b44eb00425d2eb381cc8920504b"></release>
|
||||
<release parenthash = "5eec2dd557d7d6c7e76643ad083879a24791e832" version = "6.11.2rc2" githash = "e1726efd172f52fe17e87687a59beeb0cc5dbd50"></release>
|
||||
<release parenthash = "2f528c3e59378b6c9dc95ff5dbd73a6944b417ca" version = "6.11.3rc0" githash = "f4d02b8fd8ced64c28977ba38175cc5d633e4ddf"></release>
|
||||
<release parenthash = "0c8cdd64a03f75d2c050ccadbb1bd8983534c7f7" version = "6.12.0alpha0" githash = "53c92345fc33bbdf6e8c2c42383755b4fb32350d"></release>
|
||||
<release parenthash = "3087293667911378dda568b8d6ce05473780cf41" version = "6.12.0alpha1" githash = "e193478f759ec597725daa58df48d40b816f60b0"></release>
|
||||
<release parenthash = "9be2eece00752df43d0d9ff3edf169407df30a72" version = "6.12.1alpha0" githash = "1d624b9a1f9cbbf262024abfc74c8dd8a0a16522"></release>
|
||||
<release parenthash = "cdc2d74016f26492cf444a6f14ee82e104275874" version = "6.12.2rc0" githash = "e0e70d46060cabfc333ed08ccccb5dee565d1db2"></release>
|
||||
<release parenthash = "53f819e748d25fdfd698303a48a7bfc51da77842" version = "6.12.2rc1" githash = "27e68d821d55560ac9d7b8878f2d77636864be1c"></release>
|
||||
<release parenthash = "a09ba027a29767686091dfda3c390431cac8cdca" version = "6.12.2rc2" githash = "346f5a704f1130274b88cf742de73239e54b3c7d"></release>
|
||||
<release parenthash = "cb6b3d3df25f5ee04577b9163f5ff2b7521919b3" version = "6.12.2rc3" githash = "d43c17a5c81724f880a001701669c5a00808a4e0"></release>
|
||||
<release parenthash = "3b7f63844d1ef9363d4ab23fc9b028eb7bd94f31" version = "6.12.2rc4" githash = "7bf28f0367a76070bffa1b45fd7420e3e10a0b0d"></release>
|
||||
<release parenthash = "c385fc2e1506b63b2a2440855a3b9d2503c76fa7" version = "6.12.3rc0" githash = "0b2696742e992a8031eeedb5226c1570705eedb1"></release>
|
||||
<release parenthash = "ee6fa86c6c20d12c1fac1db24c3c8136e69dd892" version = "6.12.3rc1" githash = "47db9e113163d14946cf7c6165687f1888f20806"></release>
|
||||
<release parenthash = "4d61773cf3919dd973d149c1ad2fa78d8f0502fe" version = "6.12.3rc2" githash = "c42d93f6a7975e7065a4edb5b86ac07baedf33c1"></release>
|
||||
<release parenthash = "2b8419d7fb9e95d87484ff96f6a4024b7fadbf85" version = "6.12.3rc3" githash = "85383c7463baada50b9ee80706508a58d5e511c5"></release>
|
||||
<release parenthash = "381e480cbc7385d32a5f003517ce8608e653c270" version = "6.12.4rc0" githash = "31b6b1f7f41584707a0ed761f03b80c28669af10"></release>
|
||||
<release parenthash = "f7af9f6132d619d7858ab16c728309f013f8472c" version = "6.12.4rc1" githash = "7f644a433a6ad3a2e323e4ae42ad0bfe7487090f"></release>
|
||||
<release parenthash = "ace38607b0adc325167d1eddab8c425e721451f1" version = "6.12.5rc0" githash = "23758e74f2ce9970b113e05084453c9596450622"></release>
|
||||
<release parenthash = "9344178fcc4dc9da49e08ae049dd3a933b8202a8" version = "6.13.0beta0" githash = "c53447546e337a40da0bc64238d80666b35b7336"></release>
|
||||
<release parenthash = "c53447546e337a40da0bc64238d80666b35b7336" version = "6.13.0beta1" githash = "2ae88301eb9f57f0556fad66e5350ef6b5c9a18d"></release>
|
||||
<release parenthash = "b279a2ec4c2c8f3dad6624e5c55e2d487be202a8" version = "6.13.0beta2" githash = "55f20f68aef5887daab829d3bea5eb6d5fadecab"></release>
|
||||
<release parenthash = "176cbeae28523b682ccdd7d92246edea0346634f" version = "6.14.0beta0" githash = "71dc9002456c5cdb6ae4a37887abaa8c3d08b5db"></release>
|
||||
<release parenthash = "348fead68f7eec1c26df13241c0f96397cff2c08" version = "6.14.0beta1" githash = "caed924d76ce9cd4e9c4febe9bd1ef7b598a04ee"></release>
|
||||
<release parenthash = "cfeb352d625de3d9e4208f8a32ed7b6c8974b024" version = "6.14.0beta2" githash = "216e8e3eee733c93d288826745850efbb3ebc4aa"></release>
|
||||
<release parenthash = "929437e7df13732b917c4bedc8f74166840c08b7" version = "6.14.1beta0" githash = "977044168b6ad1c24c666c4cdc535967e2a74c71"></release>
|
||||
<release parenthash = "95f44bf396ad9db3a98ed44811ebb3eda567b66e" version = "6.15.1rc0" githash = "577d68a08b45d6ef32d07fedfdb0d030daa2278c"></release>
|
||||
<release parenthash = "0ed22a04170f3b17dc5d471b6f5a2fb68ed71f4f" version = "6.15.1rc1" githash = "b24377ad993cec6ddfbccc867618fbb8812e466f"></release>
|
||||
<release parenthash = "136edf6bf7393d30e1f85197b72585c22611d94f" version = "6.15.2rc0" githash = "ef12c7afda6d448e22b7eb53c21d23e986db7b0d"></release>
|
||||
<release parenthash = "d0929ae0676896b94a119e4b7c44ffadec1471d8" version = "6.16.0alpha0" githash = "5f2fec1d2ab32999c69536635f21ca42312dc267"></release>
|
||||
<release parenthash = "60b6ca27825c4ab385fb945acf23089a4240a5ba" version = "6.18.0alpha0" githash = "37855df2f1b9a0c32d8c37e9c98853df4740e446"></release>
|
||||
<release parenthash = "f770595930dac7e19fce394908a5817c34a79cda" version = "6.18.1alpha0" githash = "084863d720a4175b7248d68edb13f0d853321142"></release>
|
||||
<release parenthash = "c3cae7fe525f1470ffae49e1f0955324924a1947" version = "6.19.0alpha0" githash = "e7c954ba63f496c41cbbd90bfcb7b9c3f14ee79c"></release>
|
||||
<release parenthash = "13f5bb313d5e6e4f8c40342137e9c18ebc6d8d3f" version = "7.4.0rc0" githash = "ffb8baba208cbf71248bb265d2599c20b76325b5"></release>
|
||||
<release parenthash = "25653fc08079eea48e63e440237db0359c9aa439" version = "7.4.1rc0" githash = "da927ba01ed5b970b1a7fd710249c44bc0adc7e8"></release>
|
||||
<release parenthash = "cce4104b3a7d3465722cd4d7580b4d7293e6248c" version = "7.4.1rc1"></release>
|
||||
<subpartnumber>XM-004720-SM</subpartnumber>
|
||||
<vendor>XMOS</vendor>
|
||||
<version_defines>
|
||||
<version_define name = "BCD_DEVICE_J" format = "%MAJOR%"></version_define>
|
||||
<version_define name = "BCD_DEVICE_M" format = "%MINOR%"></version_define>
|
||||
<version_define name = "BCD_DEVICE_N" format = "%POINT%"></version_define>
|
||||
</version_defines>
|
||||
<xpd_version>1.0</xpd_version>
|
||||
</xpd>
|
||||
Reference in New Issue
Block a user