Hello community,
here is the log from the commit of package libusb3380 for openSUSE:Factory checked in at 2018-12-28 12:36:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libusb3380 (Old)
and /work/SRC/openSUSE:Factory/.libusb3380.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libusb3380"
Fri Dec 28 12:36:09 2018 rev:2 rq:661729 version:0.0.0+git.20181025
Changes:
--------
--- /work/SRC/openSUSE:Factory/libusb3380/libusb3380.changes 2018-01-05 00:58:51.727061003 +0100
+++ /work/SRC/openSUSE:Factory/.libusb3380.new.28833/libusb3380.changes 2018-12-28 12:36:10.843927423 +0100
@@ -1,0 +2,9 @@
+Tue Dec 18 19:51:26 UTC 2018 - mardnh@gmx.de
+
+- Update to version 0.0.0+git.20181025:
+ * rework logging system
+ * add usb3380_context_init_ex() for creating specific device
+ * api: MSI interrupt handling
+ * add reconfiguration for IN fifo
+
+-------------------------------------------------------------------
Old:
----
libusb3380-0.0.0+git.20171214.tar.xz
New:
----
libusb3380-0.0.0+git.20181025.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libusb3380.spec ++++++
--- /var/tmp/diff_new_pack.0PECIf/_old 2018-12-28 12:36:11.227927155 +0100
+++ /var/tmp/diff_new_pack.0PECIf/_new 2018-12-28 12:36:11.227927155 +0100
@@ -1,6 +1,7 @@
#
# spec file for package libusb3380
#
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017, Martin Hauke
#
# All modifications and additions to the file contributed by third parties
@@ -19,12 +20,13 @@
%define sover 0
%define libname libusb3380-%{sover}
Name: libusb3380
-Version: 0.0.0+git.20171214
+Version: 0.0.0+git.20181025
Release: 0
Summary: USB3380 abstraction layer for libusb
-License: LGPL-2.1
+License: LGPL-2.1-only
Group: Development/Libraries/C and C++
URL: http://xtrx.io
+#Git-Clone: https://github.com/xtrx-sdr/libusb3380.git
Source: %{name}-%{version}.tar.xz
Patch0: libusb3380-cmake-fix-compiler-setup.patch
BuildRequires: cmake
@@ -70,7 +72,8 @@
%postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname}
-%doc LICENSE README.md
+%license LICENSE
+%doc README.md
%{_libdir}/libusb3380.so.%{sover}*
%files devel
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.0PECIf/_old 2018-12-28 12:36:11.255927135 +0100
+++ /var/tmp/diff_new_pack.0PECIf/_new 2018-12-28 12:36:11.255927135 +0100
@@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/xtrx-sdr/libusb3380.git</param>
- <param name="changesrevision">ed7c1433fe57f57da98fd2e074c716184287a8a7</param></service></servicedata>
\ No newline at end of file
+ <param name="changesrevision">acb94d4b3730bc252f528c8da1ece06930507986</param></service></servicedata>
\ No newline at end of file
++++++ libusb3380-0.0.0+git.20171214.tar.xz -> libusb3380-0.0.0+git.20181025.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/ORIG_HEAD new/libusb3380-0.0.0+git.20181025/.git/ORIG_HEAD
--- old/libusb3380-0.0.0+git.20171214/.git/ORIG_HEAD 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/ORIG_HEAD 2018-10-25 18:51:26.000000000 +0200
@@ -1 +1 @@
-ed7c1433fe57f57da98fd2e074c716184287a8a7
+acb94d4b3730bc252f528c8da1ece06930507986
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/hooks/fsmonitor-watchman.sample new/libusb3380-0.0.0+git.20181025/.git/hooks/fsmonitor-watchman.sample
--- old/libusb3380-0.0.0+git.20171214/.git/hooks/fsmonitor-watchman.sample 1970-01-01 01:00:00.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/hooks/fsmonitor-watchman.sample 2018-10-25 18:51:26.000000000 +0200
@@ -0,0 +1,114 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IPC::Open2;
+
+# An example hook script to integrate Watchman
+# (https://facebook.github.io/watchman/) with git to speed up detecting
+# new and modified files.
+#
+# The hook is passed a version (currently 1) and a time in nanoseconds
+# formatted as a string and outputs to stdout all files that have been
+# modified since the given time. Paths must be relative to the root of
+# the working tree and separated by a single NUL.
+#
+# To enable this hook, rename this file to "query-watchman" and set
+# 'git config core.fsmonitor .git/hooks/query-watchman'
+#
+my ($version, $time) = @ARGV;
+
+# Check the hook interface version
+
+if ($version == 1) {
+ # convert nanoseconds to seconds
+ $time = int $time / 1000000000;
+} else {
+ die "Unsupported query-fsmonitor hook version '$version'.\n" .
+ "Falling back to scanning...\n";
+}
+
+my $git_work_tree;
+if ($^O =~ 'msys' || $^O =~ 'cygwin') {
+ $git_work_tree = Win32::GetCwd();
+ $git_work_tree =~ tr/\\/\//;
+} else {
+ require Cwd;
+ $git_work_tree = Cwd::cwd();
+}
+
+my $retry = 1;
+
+launch_watchman();
+
+sub launch_watchman {
+
+ my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
+ or die "open2() failed: $!\n" .
+ "Falling back to scanning...\n";
+
+ # In the query expression below we're asking for names of files that
+ # changed since $time but were not transient (ie created after
+ # $time but no longer exist).
+ #
+ # To accomplish this, we're using the "since" generator to use the
+ # recency index to select candidate nodes and "fields" to limit the
+ # output to file names only. Then we're using the "expression" term to
+ # further constrain the results.
+ #
+ # The category of transient files that we want to ignore will have a
+ # creation clock (cclock) newer than $time_t value and will also not
+ # currently exist.
+
+ my $query = <<" END";
+ ["query", "$git_work_tree", {
+ "since": $time,
+ "fields": ["name"],
+ "expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
+ }]
+ END
+
+ print CHLD_IN $query;
+ close CHLD_IN;
+ my $response = do {local $/; };
+
+ die "Watchman: command returned no output.\n" .
+ "Falling back to scanning...\n" if $response eq "";
+ die "Watchman: command returned invalid output: $response\n" .
+ "Falling back to scanning...\n" unless $response =~ /^\{/;
+
+ my $json_pkg;
+ eval {
+ require JSON::XS;
+ $json_pkg = "JSON::XS";
+ 1;
+ } or do {
+ require JSON::PP;
+ $json_pkg = "JSON::PP";
+ };
+
+ my $o = $json_pkg->new->utf8->decode($response);
+
+ if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
+ print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
+ $retry--;
+ qx/watchman watch "$git_work_tree"/;
+ die "Failed to make watchman watch '$git_work_tree'.\n" .
+ "Falling back to scanning...\n" if $? != 0;
+
+ # Watchman will always return all files on the first query so
+ # return the fast "everything is dirty" flag to git and do the
+ # Watchman query just to get it over with now so we won't pay
+ # the cost in git to look up each individual file.
+ print "/\0";
+ eval { launch_watchman() };
+ exit 0;
+ }
+
+ die "Watchman: $o->{error}.\n" .
+ "Falling back to scanning...\n" if $o->{error};
+
+ binmode STDOUT, ":utf8";
+ local $, = "\0";
+ print @{$o->{files}};
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/hooks/pre-rebase.sample new/libusb3380-0.0.0+git.20181025/.git/hooks/pre-rebase.sample
--- old/libusb3380-0.0.0+git.20171214/.git/hooks/pre-rebase.sample 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/hooks/pre-rebase.sample 2018-10-25 18:51:26.000000000 +0200
@@ -58,7 +58,7 @@
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
- echo >&2 "$topic is already up-to-date with master"
+ echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/hooks/prepare-commit-msg.sample new/libusb3380-0.0.0+git.20181025/.git/hooks/prepare-commit-msg.sample
--- old/libusb3380-0.0.0+git.20171214/.git/hooks/prepare-commit-msg.sample 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/hooks/prepare-commit-msg.sample 2018-10-25 18:51:26.000000000 +0200
@@ -9,8 +9,8 @@
#
# To enable this hook, rename this file to "prepare-commit-msg".
-# This hook includes three examples. The first comments out the
-# "Conflicts:" part of a merge commit.
+# This hook includes three examples. The first one removes the
+# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
@@ -20,17 +20,23 @@
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
-case "$2,$3" in
- merge,)
- /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
+COMMIT_MSG_FILE=$1
+COMMIT_SOURCE=$2
+SHA1=$3
-# ,|template,)
-# /usr/bin/perl -i.bak -pe '
-# print "\n" . `git diff --cached --name-status -r`
-# if /^#/ && $first++ == 0' "$1" ;;
+/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
- *) ;;
-esac
+# case "$COMMIT_SOURCE,$SHA1" in
+# ,|template,)
+# /usr/bin/perl -i.bak -pe '
+# print "\n" . `git diff --cached --name-status -r`
+# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
+# *) ;;
+# esac
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
+# if test -z "$COMMIT_SOURCE"
+# then
+# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
+# fi
Binary files old/libusb3380-0.0.0+git.20171214/.git/index and new/libusb3380-0.0.0+git.20181025/.git/index differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/logs/HEAD new/libusb3380-0.0.0+git.20181025/.git/logs/HEAD
--- old/libusb3380-0.0.0+git.20171214/.git/logs/HEAD 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/logs/HEAD 2018-10-25 18:51:26.000000000 +0200
@@ -1,2 +1,2 @@
-0000000000000000000000000000000000000000 ed7c1433fe57f57da98fd2e074c716184287a8a7 Martin Hauke 1513278120 +0100 clone: from /var/cache/obs/tar_scm/74c0865730baae1870ab5e19929a71f23f49a6118715d89d9c72b0c28ad092a8/libusb3380
-ed7c1433fe57f57da98fd2e074c716184287a8a7 ed7c1433fe57f57da98fd2e074c716184287a8a7 Martin Hauke 1513278121 +0100 reset: moving to origin/master
+0000000000000000000000000000000000000000 acb94d4b3730bc252f528c8da1ece06930507986 Martin Hauke 1545162686 +0100 clone: from /var/cache/obs/tar_scm/74c0865730baae1870ab5e19929a71f23f49a6118715d89d9c72b0c28ad092a8/libusb3380
+acb94d4b3730bc252f528c8da1ece06930507986 acb94d4b3730bc252f528c8da1ece06930507986 Martin Hauke 1545162686 +0100 reset: moving to origin/master
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/logs/refs/heads/master new/libusb3380-0.0.0+git.20181025/.git/logs/refs/heads/master
--- old/libusb3380-0.0.0+git.20171214/.git/logs/refs/heads/master 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/logs/refs/heads/master 2018-10-25 18:51:26.000000000 +0200
@@ -1 +1 @@
-0000000000000000000000000000000000000000 ed7c1433fe57f57da98fd2e074c716184287a8a7 Martin Hauke 1513278120 +0100 clone: from /var/cache/obs/tar_scm/74c0865730baae1870ab5e19929a71f23f49a6118715d89d9c72b0c28ad092a8/libusb3380
+0000000000000000000000000000000000000000 acb94d4b3730bc252f528c8da1ece06930507986 Martin Hauke 1545162686 +0100 clone: from /var/cache/obs/tar_scm/74c0865730baae1870ab5e19929a71f23f49a6118715d89d9c72b0c28ad092a8/libusb3380
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/logs/refs/remotes/origin/HEAD new/libusb3380-0.0.0+git.20181025/.git/logs/refs/remotes/origin/HEAD
--- old/libusb3380-0.0.0+git.20171214/.git/logs/refs/remotes/origin/HEAD 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/logs/refs/remotes/origin/HEAD 2018-10-25 18:51:26.000000000 +0200
@@ -1 +1 @@
-0000000000000000000000000000000000000000 ed7c1433fe57f57da98fd2e074c716184287a8a7 Martin Hauke 1513278120 +0100 clone: from /var/cache/obs/tar_scm/74c0865730baae1870ab5e19929a71f23f49a6118715d89d9c72b0c28ad092a8/libusb3380
+0000000000000000000000000000000000000000 acb94d4b3730bc252f528c8da1ece06930507986 Martin Hauke 1545162686 +0100 clone: from /var/cache/obs/tar_scm/74c0865730baae1870ab5e19929a71f23f49a6118715d89d9c72b0c28ad092a8/libusb3380
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/0a/680c0f1e9881a381b264bf11f8de48370a74db and new/libusb3380-0.0.0+git.20181025/.git/objects/0a/680c0f1e9881a381b264bf11f8de48370a74db differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/0c/e4c12d064cc9754440ca0907ef35cc8a592a2b and new/libusb3380-0.0.0+git.20181025/.git/objects/0c/e4c12d064cc9754440ca0907ef35cc8a592a2b differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/objects/12/25b68ad2c665a75f8c71c5b35541b0cfeeef48 new/libusb3380-0.0.0+git.20181025/.git/objects/12/25b68ad2c665a75f8c71c5b35541b0cfeeef48
--- old/libusb3380-0.0.0+git.20171214/.git/objects/12/25b68ad2c665a75f8c71c5b35541b0cfeeef48 1970-01-01 01:00:00.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/objects/12/25b68ad2c665a75f8c71c5b35541b0cfeeef48 2018-10-25 18:51:26.000000000 +0200
@@ -0,0 +1 @@
+xλN1
aj?ÅôHÑìø¶Jz<ÙE^'·g' <_qôËz>·ñatUpÅvibN5q€ŽìæØP$K-6P@2_Üu`Qòd3qD¢(e7ËŸxŠdIÉ%ÃñŸvxÑþŠ?pZ·ÁKfœÂÓv§ÃÇ+·~ã«nYaòvö1ú á-¢{óÐÿy3µ}CÝÓ^ÛRÖÛùÒ>ùy±YŠ
\ No newline at end of file
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/12/eb48f3019962f36dd8fde65f0dac8db283c428 and new/libusb3380-0.0.0+git.20181025/.git/objects/12/eb48f3019962f36dd8fde65f0dac8db283c428 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/20/ada2c57af6a53bed89d85182906cbb879ea001 and new/libusb3380-0.0.0+git.20181025/.git/objects/20/ada2c57af6a53bed89d85182906cbb879ea001 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/22/d40e3e5dab6e389c8dc2da46c8c96cff21ecf9 and new/libusb3380-0.0.0+git.20181025/.git/objects/22/d40e3e5dab6e389c8dc2da46c8c96cff21ecf9 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/2b/1d582bc6d40520b580e3e83271b9b0bb3215ee and new/libusb3380-0.0.0+git.20181025/.git/objects/2b/1d582bc6d40520b580e3e83271b9b0bb3215ee differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/30/3f5dbb170572fe128331b6630e24b0910967e5 and new/libusb3380-0.0.0+git.20181025/.git/objects/30/3f5dbb170572fe128331b6630e24b0910967e5 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/30/cb13b2a70efcbd00ce2b48c70e4c5a2932e249 and new/libusb3380-0.0.0+git.20181025/.git/objects/30/cb13b2a70efcbd00ce2b48c70e4c5a2932e249 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/4d/56a491aa9f9a7282ed4d54a566dcbcfd362602 and new/libusb3380-0.0.0+git.20181025/.git/objects/4d/56a491aa9f9a7282ed4d54a566dcbcfd362602 differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/objects/59/11b0819a1bba6da72c734c79af41d22990bf11 new/libusb3380-0.0.0+git.20181025/.git/objects/59/11b0819a1bba6da72c734c79af41d22990bf11
--- old/libusb3380-0.0.0+git.20171214/.git/objects/59/11b0819a1bba6da72c734c79af41d22990bf11 1970-01-01 01:00:00.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/objects/59/11b0819a1bba6da72c734c79af41d22990bf11 2018-10-25 18:51:26.000000000 +0200
@@ -0,0 +1 @@
+xÎKjB1á³3$¯äH§Rè€+8
âMÉîŸâÀ8ý?µË¥ðÅŸ.ÞsŽdb<& eŠÂäc¢Bs"Uït6?Øe ÉÅTŠ¬Sf²#e\Ÿd,
^Çwëð%ý$ðÑÖËå»õ¶çgzW¬ýo²n©íÁMîî(É[ØØ`¡yÈkn¡µEëéÚqÔ¶Þ©OЪÍüG]§
\ No newline at end of file
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/62/d98e46fa05fd35281d9f7306c17724ac8c2432 and new/libusb3380-0.0.0+git.20181025/.git/objects/62/d98e46fa05fd35281d9f7306c17724ac8c2432 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/65/0cbda23267a3fd8f8cacae85e12d45217ed9b4 and new/libusb3380-0.0.0+git.20181025/.git/objects/65/0cbda23267a3fd8f8cacae85e12d45217ed9b4 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/7e/10eb39f92dcded73866538247438108ba072af and new/libusb3380-0.0.0+git.20181025/.git/objects/7e/10eb39f92dcded73866538247438108ba072af differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/93/94c853c3b8417af80218b6a698a8e573d95344 and new/libusb3380-0.0.0+git.20181025/.git/objects/93/94c853c3b8417af80218b6a698a8e573d95344 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/9e/555415e438d88a9c98087b946642b00b5f9edf and new/libusb3380-0.0.0+git.20181025/.git/objects/9e/555415e438d88a9c98087b946642b00b5f9edf differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/objects/ac/b94d4b3730bc252f528c8da1ece06930507986 new/libusb3380-0.0.0+git.20181025/.git/objects/ac/b94d4b3730bc252f528c8da1ece06930507986
--- old/libusb3380-0.0.0+git.20171214/.git/objects/ac/b94d4b3730bc252f528c8da1ece06930507986 1970-01-01 01:00:00.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/objects/ac/b94d4b3730bc252f528c8da1ece06930507986 2018-10-25 18:51:26.000000000 +0200
@@ -0,0 +1 @@
+xÎ;®Â0@Qj¯bz$4ñ/cé ÑS²3 $~²
Ý(Xí)®nÊË27Ð=nZÍÝàHsòE§¡!£û#³ÑQÿ±ÈÚ sΟÅbHzÖ{«ß1È0ªxkç\à$e'smqå(wø«Ú]Ÿtã\ñ.uò:gÑ×äaQ¥ÏsßÔTG.žæi× ê³6YÔoXXû
\ No newline at end of file
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/c4/976cb0d6875b6b97a3b67de20a6cb4bd9a80b0 and new/libusb3380-0.0.0+git.20181025/.git/objects/c4/976cb0d6875b6b97a3b67de20a6cb4bd9a80b0 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/d6/26c6868221b40d1c8df18b21c101835bbf5361 and new/libusb3380-0.0.0+git.20181025/.git/objects/d6/26c6868221b40d1c8df18b21c101835bbf5361 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/d7/c5f3ae5d4363c7224823d580b92d064be87d41 and new/libusb3380-0.0.0+git.20181025/.git/objects/d7/c5f3ae5d4363c7224823d580b92d064be87d41 differ
Binary files old/libusb3380-0.0.0+git.20171214/.git/objects/ea/e47660c5a1d594d2d53ace18befb76f8327e93 and new/libusb3380-0.0.0+git.20181025/.git/objects/ea/e47660c5a1d594d2d53ace18befb76f8327e93 differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/packed-refs new/libusb3380-0.0.0+git.20181025/.git/packed-refs
--- old/libusb3380-0.0.0+git.20171214/.git/packed-refs 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/packed-refs 2018-10-25 18:51:26.000000000 +0200
@@ -1,2 +1,2 @@
-# pack-refs with: peeled fully-peeled
-ed7c1433fe57f57da98fd2e074c716184287a8a7 refs/remotes/origin/master
+# pack-refs with: peeled fully-peeled sorted
+acb94d4b3730bc252f528c8da1ece06930507986 refs/remotes/origin/master
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/.git/refs/heads/master new/libusb3380-0.0.0+git.20181025/.git/refs/heads/master
--- old/libusb3380-0.0.0+git.20171214/.git/refs/heads/master 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/.git/refs/heads/master 2018-10-25 18:51:26.000000000 +0200
@@ -1 +1 @@
-ed7c1433fe57f57da98fd2e074c716184287a8a7
+acb94d4b3730bc252f528c8da1ece06930507986
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/CMakeLists.txt new/libusb3380-0.0.0+git.20181025/CMakeLists.txt
--- old/libusb3380-0.0.0+git.20171214/CMakeLists.txt 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/CMakeLists.txt 2018-10-25 18:51:26.000000000 +0200
@@ -56,7 +56,12 @@
include_directories(${LIBUSB_1_INCLUDE_DIRS})
include_directories(.)
-add_library(usb3380 SHARED libusb3380.c)
+set(USB3380_FILES libusb3380.c)
+if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+ set(USB3380_FILES ${USB3380_FILES} xtrx_port.c)
+endif()
+
+add_library(usb3380 SHARED ${USB3380_FILES})
target_link_libraries(usb3380 ${LIBUSB_1_LIBRARIES} ${SYSTEM_LIBS})
set_target_properties(usb3380 PROPERTIES VERSION ${LIBVER} SOVERSION ${MAJOR_VERSION})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/libusb3380.c new/libusb3380-0.0.0+git.20181025/libusb3380.c
--- old/libusb3380-0.0.0+git.20171214/libusb3380.c 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/libusb3380.c 2018-10-25 18:51:26.000000000 +0200
@@ -72,12 +72,6 @@
} libusb3380_pci_master_stage_t;
-typedef enum libusb3380_qtype {
- Q_PCIOUT,
- Q_GPEP,
- Q_MSI,
-} libusb3380_qtype_t;
-
/** Internal queue element */
typedef struct libusb3380_data_qbase {
union {
@@ -86,7 +80,6 @@
libusb3380_qpci_master_t *ppcims;
libusb3380_qmsi_int_t *pmsi;
} blk;
- libusb3380_qtype_t type;
} libusb3380_data_qbase_t;
@@ -95,7 +88,10 @@
typedef struct libusb3380_queue_header {
libusb3380_data_qbase_t queue;
- pthread_mutex_t qmutex;
+ union {
+ pthread_mutex_t qmutex;
+ unsigned gpep_idx[2];
+ };
struct libusb_transfer *transfer;
} libusb3380_queue_header_t;
@@ -106,9 +102,16 @@
/* currently we supports only one device */
struct libusb3380_pcidev *dev;
+ libusb3380_configuration_t cfg;
+ unsigned total_gpeps;
+ unsigned gpep_in_idx_st[LIBUSB3380_GPEP_COUNT];
+ unsigned gpep_out_idx_st[LIBUSB3380_GPEP_COUNT];
+
+ libusb3380_queue_header_t *q_gpep;
+ libusb3380_qgpep_t *gpep;
+
+
libusb3380_queue_header_t q_pciout;
- libusb3380_queue_header_t q_gpep_out[LIBUSB3380_GPEP_COUNT];
- libusb3380_queue_header_t q_gpep_in[LIBUSB3380_GPEP_COUNT];
libusb3380_queue_header_t q_msi;
@@ -122,11 +125,6 @@
libusb3380_qmsi_int_t msi;
sem_t msi_notify;
- /* GPEP OUT */
- libusb3380_qgpep_t gpep_out[LIBUSB3380_GPEP_COUNT];
- /* GPEP IN */
- libusb3380_qgpep_t gpep_in[LIBUSB3380_GPEP_COUNT];
-
libusb3380_qcsr_t csr;
sem_t csr_notify;
@@ -139,13 +137,25 @@
/* interrupt RCIN */
uint32_t msi_data[4];
+ on_msi_cb_t msi_cb;
+ void* msi_param;
+
bool stop;
} libusb3380_async_manager_t;
-static void def_log(libusb3380_loglevel_t level, void* obj,
- const char* message, ...) __attribute__ ((format (printf, 3, 4)));
-
-void def_log(libusb3380_loglevel_t level, void* obj, const char* message, ...)
+static void def_log(libusb3380_loglevel_t level,
+ void* obj,
+ const char* func,
+ const char* file,
+ int line,
+ const char* message, ...) __attribute__ ((format (printf, 6, 7)));
+
+void def_log(libusb3380_loglevel_t level,
+ void* obj,
+ const char* func,
+ const char* file,
+ int line,
+ const char* message, ...)
{
(void)obj;
@@ -165,7 +175,7 @@
vsnprintf(tmp_buf, sizeof(tmp_buf), message, ap);
va_end(ap);
- fprintf(stderr, "%s %s\n", sevirity, tmp_buf);
+ fprintf(stderr, "%s %-16s %s\n", sevirity, func, tmp_buf);
}
static usb3380_logfunc_t s_logfunc = def_log;
@@ -173,14 +183,14 @@
static libusb3380_loglevel_t s_loglevel = USB3380_LOG_INFO;
#define LOG(x, ...) do { \
- if (s_loglevel >= (x)) s_logfunc((x), s_logobj, __VA_ARGS__); \
+ if (s_loglevel >= (x)) s_logfunc((x), s_logobj, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__); \
} while(0)
-#define LOG_ERR(...) LOG(USB3380_LOG_ERROR, __VA_ARGS__)
-#define LOG_WARN(...) LOG(USB3380_LOG_WARNING, __VA_ARGS__)
-#define LOG_INFO(...) LOG(USB3380_LOG_INFO, __VA_ARGS__)
+#define LOG_ERR(...) LOG(USB3380_LOG_ERROR, __VA_ARGS__)
+#define LOG_WARN(...) LOG(USB3380_LOG_WARNING, __VA_ARGS__)
+#define LOG_INFO(...) LOG(USB3380_LOG_INFO, __VA_ARGS__)
#define LOG_DEBUG(...) LOG(USB3380_LOG_DEBUG, __VA_ARGS__)
-#define LOG_DUMP(...) LOG(USB3380_LOG_DUMP, __VA_ARGS__)
+#define LOG_DUMP(...) LOG(USB3380_LOG_DUMP, __VA_ARGS__)
void usb3380_set_logfunc(usb3380_logfunc_t func, void *param)
{
@@ -255,7 +265,22 @@
return -res;
q->transfer = libusb_alloc_transfer(0);
- if (res)
+ if (q->transfer == NULL)
+ return -ENOMEM;
+
+ q->queue.blk.pbase = NULL;
+ return 0;
+}
+
+
+static int usb3380_int_queue_gpep_init(libusb3380_queue_header_t *q,
+ unsigned gpepno, unsigned idx)
+{
+ q->gpep_idx[0] = gpepno;
+ q->gpep_idx[1] = idx;
+
+ q->transfer = libusb_alloc_transfer(0);
+ if (q->transfer == NULL)
return -ENOMEM;
q->queue.blk.pbase = NULL;
@@ -268,6 +293,12 @@
libusb_free_transfer(q->transfer);
}
+static void usb3380_int_queue_gpep_deinit(libusb3380_queue_header_t *q)
+{
+ libusb_free_transfer(q->transfer);
+}
+
+
static void* usb3380_io_thread(void *arg)
{
struct libusb3380_async_manager* mgr = (struct libusb3380_async_manager*)arg;
@@ -282,7 +313,7 @@
pthread_sigmask(SIG_SETMASK, &set, NULL);
struct sched_param shed;
- shed.sched_priority = 1;
+ shed.sched_priority = 2;
res = pthread_setschedparam(pthread_self(), SCHED_FIFO, &shed);
if (res) {
@@ -319,15 +350,31 @@
base->status = DQS_TIMEOUT;
break;
- case LIBUSB_TRANSFER_ERROR:
case LIBUSB_TRANSFER_CANCELLED:
+ base->status = DQS_CANCELLED;
+ break;
+
+ case LIBUSB_TRANSFER_STALL:
+ /* TODO clear EP */
+ LOG_ERR("GPEP 0x%02x ERROR: STALL", transfer->endpoint);
+ base->status = DQS_ABORT;
+ break;
- case LIBUSB_TRANSFER_STALL: /* TODO clear EP */
case LIBUSB_TRANSFER_NO_DEVICE:
+ LOG_ERR("GPEP 0x%02x ERROR: NO DEVICE", transfer->endpoint);
+ base->status = DQS_ABORT;
+ break;
case LIBUSB_TRANSFER_OVERFLOW:
- LOG_ERR("GPEP IN ERROR: %d", transfer->status);
+ LOG_ERR("GPEP 0x%02x ERROR: OVERFLOW", transfer->endpoint);
+ base->status = DQS_ABORT;
+ break;
+
+ default:
+ case LIBUSB_TRANSFER_ERROR:
+ LOG_ERR("GPEP 0x%02x ERROR: %d", transfer->endpoint, transfer->status);
base->status = DQS_ABORT;
+ break;
}
base->written = (unsigned)transfer->actual_length;
@@ -342,7 +389,7 @@
assert(res == 0);
}
-static void on_pciout_cb(struct libusb_transfer *transfer)
+static LIBUSB_CALL void on_pciout_cb(struct libusb_transfer *transfer)
{
libusb3380_async_manager_t* mgr = (libusb3380_async_manager_t*)transfer->user_data;
libusb3380_qpci_master_t* pciout = &mgr->pciout;
@@ -352,7 +399,7 @@
pciout->data[0],
pciout->data[1],
transfer->status);
-#if 1
+
if (transfer->status == LIBUSB_TRANSFER_COMPLETED &&
transfer->actual_length == transfer->length &&
pciout->type == RC_PCIE_READ &&
@@ -369,7 +416,7 @@
// Notify abortion
transfer->status = LIBUSB_TRANSFER_ERROR;
}
-#endif
+
// Notify waiting thread
notify_pciout(mgr);
}
@@ -388,7 +435,7 @@
mgr->q_pciout.transfer->flags = 0;
}
-static void on_rcin_cb(struct libusb_transfer *transfer)
+static LIBUSB_CALL void on_rcin_cb(struct libusb_transfer *transfer)
{
libusb3380_async_manager_t* mgr = (libusb3380_async_manager_t*)transfer->user_data;
int res;
@@ -416,16 +463,18 @@
assert(res == 0);
}
-static void prepare_ptransfer_rcin(libusb3380_async_manager_t* mgr)
+static void prepare_ptransfer_rcin(libusb3380_async_manager_t* mgr,
+ libusb_transfer_cb_fn callback,
+ unsigned timeout)
{
libusb_fill_interrupt_transfer(mgr->q_msi.transfer,
mgr->dev->ctx->handle,
EP_RCIN | LIBUSB_ENDPOINT_IN,
(uint8_t*)mgr->msi_data,
16,
- on_rcin_cb,
+ callback,
mgr,
- 100);
+ timeout);
mgr->q_msi.transfer->flags = 0;
}
@@ -475,23 +524,6 @@
if (res) {
goto failed_in_lock;
}
-#if 0
- if (type == RC_PCIE_READ &&
- mgr->q_pciout.transfer->actual_length == mgr->q_pciout.transfer->length) {
- mgr->q_pciout.transfer->endpoint = EP_PCIIN | LIBUSB_ENDPOINT_IN;
- mgr->q_pciout.transfer->length = dw_count * 4;
-
- res = libusb_submit_transfer(mgr->q_pciout.transfer);
- if (res) {
- goto failed_in_lock; // TODO error code
- }
-
- res = sem_wait(&mgr->pciout_notify);
- if (res) {
- goto failed_in_lock;
- }
- }
-#endif
if (pciout->base.status == DQS_PARTIAL) {
if (type == RC_PCIE_READ) {
@@ -547,6 +579,7 @@
return res;
}
+ prepare_ptransfer_rcin(mgr, on_rcin_cb, 100);
res = libusb_submit_transfer(mgr->q_msi.transfer);
if (res) {
goto failed_in_lock; // TODO error code
@@ -569,22 +602,72 @@
return res;
}
+static int libusb_to_errno(int libusberr)
+{
+ switch (libusberr) {
+ case LIBUSB_SUCCESS:
+ return 0;
+
+ case LIBUSB_ERROR_IO:
+ return -EIO;
+
+ case LIBUSB_ERROR_INVALID_PARAM:
+ return -EINVAL;
+
+ case LIBUSB_ERROR_ACCESS:
+ return -EPERM;
+
+ case LIBUSB_ERROR_NO_DEVICE:
+ return -ENODEV;
+
+ case LIBUSB_ERROR_NOT_FOUND:
+ return -ENXIO;
+
+ case LIBUSB_ERROR_BUSY:
+ return -EBUSY;
+
+ case LIBUSB_ERROR_TIMEOUT:
+ return -ETIMEDOUT;
+
+ case LIBUSB_ERROR_OVERFLOW:
+ return -EOVERFLOW;
+
+ case LIBUSB_ERROR_PIPE:
+ return -EPIPE;
+
+ case LIBUSB_ERROR_INTERRUPTED:
+ return -EINTR;
+
+ case LIBUSB_ERROR_NO_MEM:
+ return -ENOMEM;
+
+ case LIBUSB_ERROR_NOT_SUPPORTED:
+ return -EOPNOTSUPP;
+
+ case LIBUSB_ERROR_OTHER:
+ return -ESRCH; //TODO find better;
+ };
+ return -EFAULT;
+}
+
static int gpep_transfer_post(libusb3380_queue_header_t* q,
libusb3380_qgpep_t *d)
{
q->transfer->length = d->base.size;
q->transfer->buffer = d->pdata;
- return libusb_submit_transfer(q->transfer);
+ return libusb_to_errno(libusb_submit_transfer(q->transfer));
}
-static void on_gpep_cb(struct libusb_transfer *transfer)
+static LIBUSB_CALL void on_gpep_cb(struct libusb_transfer *transfer)
{
- LOG_DUMP("TransferCB EP:%02x done", transfer->endpoint);
-
libusb3380_queue_header_t* qh = (libusb3380_queue_header_t*)transfer->user_data;
+
+ LOG_DUMP("TransferCB EP:%02x [%d;%d] done", transfer->endpoint,
+ qh->gpep_idx[0], qh->gpep_idx[1]);
+
fill_base_in_cb(qh->queue.blk.pbase, qh->transfer);
- qh->queue.blk.pgpep->cb_done(qh->queue.blk.pgpep);
+ qh->queue.blk.pgpep->cb_done(qh->queue.blk.pgpep, qh->gpep_idx[0], qh->gpep_idx[1]);
}
static void prepare_ptransfer_gpep(libusb3380_async_manager_t* mgr,
@@ -594,7 +677,6 @@
unsigned int timeout)
{
hdr->queue.blk.pgpep = queue;
- hdr->queue.type = Q_GPEP;
libusb_fill_bulk_transfer(hdr->transfer,
mgr->dev->ctx->handle,
@@ -610,13 +692,17 @@
int usb3380_async_gpep_out_post(struct libusb3380_async_manager* mgr,
libusb3380_gpep_t ep_no,
+ unsigned idx,
const uint8_t* data, unsigned size,
on_gpep_cb_t cb, void* param)
{
if (ep_no > LIBUSB3380_GPEP3 || ep_no < LIBUSB3380_GPEP0)
return -EINVAL;
+ if (mgr->cfg.gp_out_cnts[ep_no] <= idx)
+ return -EINVAL;
- libusb3380_qgpep_t *gpep_out = &mgr->gpep_out[ep_no];
+ unsigned gidx = mgr->gpep_out_idx_st[ep_no] + idx;
+ libusb3380_qgpep_t *gpep_out = &mgr->gpep[gidx];
// TODO check multi thread access
gpep_out->base.size = size;
@@ -624,18 +710,22 @@
gpep_out->cb_done = cb;
gpep_out->param = param;
- return gpep_transfer_post(&mgr->q_gpep_out[ep_no], gpep_out);
+ return gpep_transfer_post(&mgr->q_gpep[gidx], gpep_out);
}
int usb3380_async_gpep_in_post(struct libusb3380_async_manager* mgr,
libusb3380_gpep_t ep_no,
+ unsigned idx,
uint8_t* data, unsigned size,
on_gpep_cb_t cb, void* param)
{
if (ep_no > LIBUSB3380_GPEP3 || ep_no < LIBUSB3380_GPEP0)
return -EINVAL;
+ if (mgr->cfg.gp_in_cnts[ep_no] <= idx)
+ return -EINVAL;
- libusb3380_qgpep_t *gpep_in = &mgr->gpep_in[ep_no];
+ unsigned gidx = mgr->gpep_in_idx_st[ep_no] + idx;
+ libusb3380_qgpep_t *gpep_in = &mgr->gpep[gidx];
// TODO check multi thread access
gpep_in->base.size = size;
@@ -643,66 +733,118 @@
gpep_in->cb_done = cb;
gpep_in->param = param;
- return gpep_transfer_post(&mgr->q_gpep_in[ep_no], gpep_in);
+ return gpep_transfer_post(&mgr->q_gpep[gidx], gpep_in);
+}
+
+int usb3380_async_gpep_cancel(struct libusb3380_async_manager* mgr,
+ bool ep_in,
+ libusb3380_gpep_t gpep,
+ unsigned idx)
+{
+ if (gpep > LIBUSB3380_GPEP3 || gpep < LIBUSB3380_GPEP0)
+ return -EINVAL;
+
+ unsigned gidx;
+ if (ep_in) {
+ if (mgr->cfg.gp_in_cnts[gpep] <= idx)
+ return -EINVAL;
+ gidx = mgr->gpep_in_idx_st[gpep] + idx;
+ } else {
+ if (mgr->cfg.gp_out_cnts[gpep] <= idx)
+ return -EINVAL;
+ gidx = mgr->gpep_out_idx_st[gpep] + idx;
+ }
+
+ return libusb_to_errno(libusb_cancel_transfer(mgr->q_gpep[gidx].transfer));
}
int usb3380_async_set_gpep_timeout(struct libusb3380_async_manager* mgr,
bool ep_in, libusb3380_gpep_t gpep,
+ unsigned idx,
unsigned to_ms)
{
if (gpep > LIBUSB3380_GPEP3 || gpep < LIBUSB3380_GPEP0)
return -EINVAL;
+ unsigned gidx;
if (ep_in) {
- mgr->q_gpep_in[gpep].transfer->timeout = to_ms;
+ if (mgr->cfg.gp_in_cnts[gpep] <= idx)
+ return -EINVAL;
+ gidx = mgr->gpep_in_idx_st[gpep] + idx;
} else {
- mgr->q_gpep_out[gpep].transfer->timeout = to_ms;
+ if (mgr->cfg.gp_out_cnts[gpep] <= idx)
+ return -EINVAL;
+ gidx = mgr->gpep_out_idx_st[gpep] + idx;
}
+ mgr->q_gpep[gidx].transfer->timeout = to_ms;
return 0;
}
-
int usb3380_async_start(struct libusb3380_pcidev *dev,
+ const struct libusb3380_configuration *configuration,
struct libusb3380_async_manager **out)
{
libusb3380_async_manager_t* mgr;
int res;
- unsigned ep_no;
const unsigned def_timeout = 1000;
-
+ unsigned idx;
mgr = (libusb3380_async_manager_t*)malloc(sizeof(libusb3380_async_manager_t));
if (!mgr)
return -ENOMEM;
+ memset(mgr, 0, sizeof(*mgr));
mgr->dev = dev;
mgr->stop = false;
-
- res = usb3380_int_queue_init(&mgr->q_gpep_out[LIBUSB3380_GPEP0]);
- if (res)
- goto failed_gpep_out_0;
- res = usb3380_int_queue_init(&mgr->q_gpep_out[LIBUSB3380_GPEP1]);
- if (res)
- goto failed_gpep_out_1;
- res = usb3380_int_queue_init(&mgr->q_gpep_out[LIBUSB3380_GPEP2]);
- if (res)
- goto failed_gpep_out_2;
- res = usb3380_int_queue_init(&mgr->q_gpep_out[LIBUSB3380_GPEP3]);
- if (res)
- goto failed_gpep_out_3;
-
- res = usb3380_int_queue_init(&mgr->q_gpep_in[LIBUSB3380_GPEP0]);
- if (res)
- goto failed_gpep_in_0;
- res = usb3380_int_queue_init(&mgr->q_gpep_in[LIBUSB3380_GPEP1]);
- if (res)
- goto failed_gpep_in_1;
- res = usb3380_int_queue_init(&mgr->q_gpep_in[LIBUSB3380_GPEP2]);
- if (res)
- goto failed_gpep_in_2;
- res = usb3380_int_queue_init(&mgr->q_gpep_in[LIBUSB3380_GPEP3]);
- if (res)
- goto failed_gpep_in_3;
+ mgr->cfg = *configuration;
+ for (unsigned k = 0; k < LIBUSB3380_GPEP_COUNT; k++) {
+ mgr->total_gpeps += configuration->gp_in_cnts[k];
+ mgr->total_gpeps += configuration->gp_out_cnts[k];
+ }
+
+ if (mgr->total_gpeps > 0) {
+ mgr->q_gpep = (libusb3380_queue_header_t*)malloc(sizeof(libusb3380_queue_header_t) * mgr->total_gpeps);
+ if (mgr->q_gpep == NULL) {
+ res = -ENOMEM;
+ goto q_gpep_alloc_fail;
+ }
+ mgr->gpep = (libusb3380_qgpep_t*)malloc(sizeof(libusb3380_qgpep_t) * mgr->total_gpeps);
+ if (mgr->gpep == NULL) {
+ res = -ENOMEM;
+ goto gpep_alloc_fail;
+ }
+ memset(mgr->q_gpep, 0, sizeof(libusb3380_queue_header_t) * mgr->total_gpeps);
+ memset(mgr->gpep, 0, sizeof(libusb3380_qgpep_t) * mgr->total_gpeps);
+
+ idx = 0;
+ for (unsigned l = 0; l < LIBUSB3380_GPEP_COUNT; l++) {
+ mgr->gpep_in_idx_st[l] = idx;
+ for (unsigned m = 0; m < mgr->cfg.gp_in_cnts[l]; m++, idx++) {
+ res = usb3380_int_queue_gpep_init(&mgr->q_gpep[idx], l, m);
+ if (res)
+ goto failed_pciout;
+ prepare_ptransfer_gpep(mgr,
+ &mgr->q_gpep[idx],
+ &mgr->gpep[idx],
+ convert_gpep_no(l) | LIBUSB_ENDPOINT_IN,
+ def_timeout);
+ }
+ }
+ for (unsigned l = LIBUSB3380_GPEP_COUNT; l < 2 * LIBUSB3380_GPEP_COUNT; l++) {
+ mgr->gpep_out_idx_st[l - LIBUSB3380_GPEP_COUNT] = idx;
+ for (unsigned m = 0; m < mgr->cfg.gp_out_cnts[l - LIBUSB3380_GPEP_COUNT]; m++, idx++) {
+ res = usb3380_int_queue_gpep_init(&mgr->q_gpep[idx], l, m);
+ if (res)
+ goto failed_pciout;
+ prepare_ptransfer_gpep(mgr,
+ &mgr->q_gpep[idx],
+ &mgr->gpep[idx],
+ convert_gpep_no(l - LIBUSB3380_GPEP_COUNT) | LIBUSB_ENDPOINT_OUT,
+ def_timeout);
+ }
+ }
+ assert(mgr->total_gpeps == idx);
+ }
res = usb3380_int_queue_init(&mgr->q_pciout);
if (res)
@@ -713,20 +855,6 @@
goto failed_msi;
prepare_ptransfer_pciout(mgr);
- prepare_ptransfer_rcin(mgr);
-
- for (ep_no = LIBUSB3380_GPEP0; ep_no < LIBUSB3380_GPEP_COUNT; ep_no++) {
- prepare_ptransfer_gpep(mgr,
- &mgr->q_gpep_out[ep_no],
- &mgr->gpep_out[ep_no],
- convert_gpep_no(ep_no) | LIBUSB_ENDPOINT_OUT,
- def_timeout);
- prepare_ptransfer_gpep(mgr,
- &mgr->q_gpep_in[ep_no],
- &mgr->gpep_in[ep_no],
- convert_gpep_no(ep_no) | LIBUSB_ENDPOINT_IN,
- def_timeout);
- }
res = sem_init(&mgr->pciout_notify, 0, 0);
if (res) {
@@ -757,30 +885,21 @@
failed_msi:
usb3380_int_queue_deinit(&mgr->q_pciout);
failed_pciout:
- usb3380_int_queue_deinit(&mgr->q_gpep_in[LIBUSB3380_GPEP3]);
-failed_gpep_in_3:
- usb3380_int_queue_deinit(&mgr->q_gpep_in[LIBUSB3380_GPEP2]);
-failed_gpep_in_2:
- usb3380_int_queue_deinit(&mgr->q_gpep_in[LIBUSB3380_GPEP1]);
-failed_gpep_in_1:
- usb3380_int_queue_deinit(&mgr->q_gpep_in[LIBUSB3380_GPEP0]);
-failed_gpep_in_0:
- usb3380_int_queue_deinit(&mgr->q_gpep_out[LIBUSB3380_GPEP3]);
-failed_gpep_out_3:
- usb3380_int_queue_deinit(&mgr->q_gpep_out[LIBUSB3380_GPEP2]);
-failed_gpep_out_2:
- usb3380_int_queue_deinit(&mgr->q_gpep_out[LIBUSB3380_GPEP1]);
-failed_gpep_out_1:
- usb3380_int_queue_deinit(&mgr->q_gpep_out[LIBUSB3380_GPEP0]);
-failed_gpep_out_0:
+ for (idx = 0; idx < mgr->total_gpeps; idx++) {
+ if (mgr->q_gpep[idx].transfer) {
+ usb3380_int_queue_gpep_deinit(&mgr->q_gpep[idx]);
+ }
+ }
+ free(mgr->q_gpep);
+gpep_alloc_fail:
+ free(mgr->gpep);
+q_gpep_alloc_fail:
free(mgr);
return res;
}
int usb3380_async_stop(struct libusb3380_async_manager* mgr)
{
- unsigned ep_no;
-
mgr->stop = true;
pthread_join(mgr->io_thread, NULL);
@@ -789,10 +908,11 @@
usb3380_int_queue_deinit(&mgr->q_msi);
usb3380_int_queue_deinit(&mgr->q_pciout);
- for (ep_no = LIBUSB3380_GPEP0; ep_no < LIBUSB3380_GPEP_COUNT; ep_no++) {
- usb3380_int_queue_deinit(&mgr->q_gpep_in[ep_no]);
- usb3380_int_queue_deinit(&mgr->q_gpep_out[ep_no]);
+ for (unsigned idx = 0; idx < mgr->total_gpeps; idx++) {
+ usb3380_int_queue_gpep_deinit(&mgr->q_gpep[idx]);
}
+ free(mgr->q_gpep);
+ free(mgr->gpep);
free(mgr);
return 0;
@@ -1044,7 +1164,7 @@
if (written != 4 * data_size_dw) {
LOG_ERR("Written %d != %d requested!", written, data_size_dw);
- return -EIO;
+ return LIBUSB_ERROR_IO;
}
return 0;
}
@@ -1056,7 +1176,8 @@
uint32_t flags = CSR_BYTE_EN_ALL | PCIMSTCTL_CMD_CONFIG |
PCIMSTCTL_MASTER_START | PCIMSTCTL_PCIE_READ |
(1 << PCIMSTCTL_PCIE_DW_LEN_OFF_BITS);
- return usb3380_int_pci_read(ctx, flags, addr, data, 1);
+ int res = usb3380_int_pci_read(ctx, flags, addr, data, 1);
+ return libusb_to_errno(res);
}
int usb3380_pci_cfg_write(libusb3380_context_t* ctx, uint32_t addr,
@@ -1065,12 +1186,18 @@
uint32_t flags = CSR_BYTE_EN_ALL | PCIMSTCTL_CMD_CONFIG |
PCIMSTCTL_MASTER_START | PCIMSTCTL_PCIE_WRITE |
(1 << PCIMSTCTL_PCIE_DW_LEN_OFF_BITS);
- return usb3380_int_pciout_sync(ctx, flags, addr, &data, 1);
+ int res = usb3380_int_pciout_sync(ctx, flags, addr, &data, 1);
+ return libusb_to_errno(res);
}
int usb3380_context_init(libusb3380_context_t** octx)
{
+ return usb3380_context_init_ex(octx, NULL, NULL);
+}
+
+int usb3380_context_init_ex(libusb3380_context_t** octx, libusb_device *dev, libusb_context *lctx)
+{
int res;
libusb3380_context_t* ctx;
@@ -1079,14 +1206,28 @@
return -ENOMEM;
memset(ctx, 0, sizeof(libusb3380_context_t));
- if (libusb_init(&ctx->context)) {
- LOG_ERR("Unable to initialize LIBUSB");
- res = -EFAULT;
- goto cleanup_mem;
+ ctx->context = lctx;
+
+ if (lctx == NULL) {
+ if (libusb_init(&ctx->context)) {
+ LOG_ERR("Unable to initialize LIBUSB");
+ res = -EFAULT;
+ goto cleanup_mem;
+ }
+ }
+
+ if (dev == NULL) {
+ ctx->handle = libusb_open_device_with_vid_pid(ctx->context,
+ LIBUSB3380_VID,
+ LIBUSB3380_PID);
+ } else {
+ res = libusb_open(dev, &ctx->handle);
+ if (res) {
+ LOG_ERR("Unable to initialize DEVICE: %d", res);
+ goto cleanup_mem;
+ }
}
- ctx->handle = libusb_open_device_with_vid_pid(ctx->context, LIBUSB3380_VID,
- LIBUSB3380_PID);
if (ctx->handle == NULL) {
LOG_ERR("Unable to open USB3380!");
res = -ENXIO;
@@ -1211,6 +1352,17 @@
if (res) {
return res;
}
+ res = usb3380_csr_mm_cfg_write(ctx, DEVINIT, reg);
+ if (res) {
+ return res;
+ }
+ do {
+ res = usb3380_csr_mm_cfg_read(ctx, DEVINIT, ®);
+ if (res) {
+ return res;
+ }
+ usleep(1000);
+ } while (reg & (1<<2));
#endif
#if 0
for (int i = 1; i < 5; i++) {
@@ -1285,24 +1437,22 @@
return res;
}
- /* 2M on BAR3, all quadrants to IN GPEP0 */
res = parse_bar_config(&cfg->bar2, ®);
if (res) {
return res;
}
- res = usb3380_csr_mm_cfg_write(ctx, BAR3CTL, reg);
+ res = usb3380_csr_mm_cfg_write(ctx, BAR2CTL, reg);
if (res) {
return res;
}
- /* 2M on BAR2, all quadrants to OUT GPEP2 */
res = parse_bar_config(&cfg->bar3, ®);
if (res) {
return res;
}
- res = usb3380_csr_mm_cfg_write(ctx, BAR2CTL, reg);
+ res = usb3380_csr_mm_cfg_write(ctx, BAR3CTL, reg);
if (res) {
return res;
}
@@ -1385,14 +1535,20 @@
if (res) {
return res;
}
-
+#if 0
// Include only GPEP0 in IN creadit calculation
res = usb3380_csr_pcie_cfg_read(ctx, PCIE_PORT_USBC | 0x9f0, ®);
if (res) {
return res;
}
LOG_DEBUG("INCH %8x", reg);
- reg |= 0xe0000000;
+#endif
+ // Enabgle credit calculation only for requested GPEPs
+ unsigned i;
+ for (reg = 0, i = 0; i < 4; i++) {
+ if (cfg->gpep_fifo_in_size[i] == 0)
+ reg |= (1U << (28 + i));
+ }
res = usb3380_csr_pcie_cfg_write(ctx, PCIE_PORT_USBC | 0x9f0, reg);
if (res) {
return res;
@@ -1435,7 +1591,6 @@
// Check EP states
const char* ep_names[6] = { "CSROUT", "CSRIN", "PCIOUT", "PCIIN", "STATIN",
"RCIN" };
- unsigned i;
for (i = 0; i < 6; i++) {
res = usb3380_csr_mm_cfg_read(ctx, DEP_RSP + i * 0x10, ®);
if (res) {
@@ -1508,27 +1663,34 @@
i_sz, i_st, i_st + i_sz);
}
- // Reconfigure GPEP0 & GPEP2 IN sizes to 4096 & 64
- res = usb3380_csr_mm_cfg_read(ctx, EP_FIFO_SIZE_BASE + EP_GPEP0_OFF, ®);
- if (res) {
- return res;
- }
- reg = (0xffff & reg) | (6 << (16)) | (9 << (6+16));
- res = usb3380_csr_mm_cfg_write(ctx, EP_FIFO_SIZE_BASE + EP_GPEP0_OFF, reg);
- if (res) {
- return res;
- }
+ const struct fifo_size_base {
+ uint16_t ep; uint8_t sz; uint16_t off;
+ } fifo_in_sz[] = {
+ { EP_EP0_OFF, EP_FIFO_512, 0 },
+ { EP_GPEP0_OFF, EP_FIFO_4096, 0 + 8 + 1 },
+ { EP_GPEP1_OFF, EP_FIFO_128, 0 + 8 + 1 + 64 + 1 },
+ { EP_GPEP2_OFF, EP_FIFO_4096, 384 },
+ { EP_GPEP3_OFF, EP_FIFO_128, 384 + 64 + 1 },
+ { EP_PCIINOUT_OFF, EP_FIFO_256, 384 + 64 + 1 + 4 + 1 },
+ { EP_RCIN_OFF, EP_FIFO_256, 384 + 64 + 1 + 4 + 1 + 4 + 1 },
+ };
- res = usb3380_csr_mm_cfg_read(ctx, EP_FIFO_SIZE_BASE + EP_GPEP2_OFF, ®);
- if (res) {
- return res;
- }
- reg = (0xffff & reg) | (0 << (16)) | (74 << (6+16));
- res = usb3380_csr_mm_cfg_write(ctx, EP_FIFO_SIZE_BASE + EP_GPEP2_OFF, reg);
- if (res) {
- return res;
- }
+ for (i = 0; i < sizeof(fifo_in_sz) / sizeof(fifo_in_sz[0]); i++) {
+ if (fifo_in_sz[i].sz > EP_FIFO_4096)
+ continue;
+
+ res = usb3380_csr_mm_cfg_read(ctx, EP_FIFO_SIZE_BASE + fifo_in_sz[i].ep, ®);
+ if (res) {
+ return res;
+ }
+ // preserve OUT settings and override IN
+ reg = (0xffff & reg) | (fifo_in_sz[i].sz << (16)) | (fifo_in_sz[i].off << (6+16));
+ res = usb3380_csr_mm_cfg_write(ctx, EP_FIFO_SIZE_BASE + fifo_in_sz[i].ep, reg);
+ if (res) {
+ return res;
+ }
+ }
for (i = 1; i < 5; i++) {
res = usb3380_csr_mm_cfg_read(ctx, EP_CFG + i * 0x20, ®);
@@ -1537,7 +1699,7 @@
}
LOG_DEBUG("EP %9s: %08x", ep_sizes[i], reg);
- reg |= 7U << 24;
+ reg |= 15U << 24;
res = usb3380_csr_mm_cfg_write(ctx, EP_CFG + i * 0x20, reg);
if (res) {
@@ -1859,7 +2021,8 @@
uint32_t flags = CSR_BYTE_EN_ALL | PCIMSTCTL_CMD_MEMORY |
PCIMSTCTL_MASTER_START | PCIMSTCTL_PCIE_READ |
(1 << PCIMSTCTL_PCIE_DW_LEN_OFF_BITS);
- return usb3380_int_pci_read(ctx, flags, addr, data, 1);
+ int res = usb3380_int_pci_read(ctx, flags, addr, data, 1);
+ return libusb_to_errno(res);
}
int usb3380_pci_dev_mem_read32_n(libusb3380_context_t* ctx, uint32_t addr,
@@ -1868,7 +2031,8 @@
uint32_t flags = CSR_BYTE_EN_ALL | PCIMSTCTL_CMD_MEMORY |
PCIMSTCTL_MASTER_START | PCIMSTCTL_PCIE_READ |
(count_dw << PCIMSTCTL_PCIE_DW_LEN_OFF_BITS);
- return usb3380_int_pci_read(ctx, flags, addr, data, count_dw);
+ int res = usb3380_int_pci_read(ctx, flags, addr, data, count_dw);
+ return libusb_to_errno(res);
}
int usb3380_pci_dev_mem_write32(libusb3380_context_t *ctx, uint32_t addr,
@@ -1877,7 +2041,8 @@
uint32_t flags = CSR_BYTE_EN_ALL | PCIMSTCTL_CMD_MEMORY |
PCIMSTCTL_MASTER_START | PCIMSTCTL_PCIE_WRITE |
(1 << PCIMSTCTL_PCIE_DW_LEN_OFF_BITS);
- return usb3380_int_pciout_sync(ctx, flags, addr, &data, 1);
+ int res = usb3380_int_pciout_sync(ctx, flags, addr, &data, 1);
+ return libusb_to_errno(res);
}
int usb3380_pci_dev_mem_write32_n(libusb3380_context_t* ctx, uint32_t addr,
@@ -1886,7 +2051,8 @@
uint32_t flags = CSR_BYTE_EN_ALL | PCIMSTCTL_CMD_MEMORY |
PCIMSTCTL_MASTER_START | PCIMSTCTL_PCIE_WRITE |
(count_dw << PCIMSTCTL_PCIE_DW_LEN_OFF_BITS);
- return usb3380_int_pciout_sync(ctx, flags, addr, data, count_dw);
+ int res = usb3380_int_pciout_sync(ctx, flags, addr, data, count_dw);
+ return libusb_to_errno(res);
}
int usb3380_pci_wait_interrupt(libusb3380_context_t *ctx, long timeoutms)
@@ -1900,7 +2066,7 @@
if (res) {
LOG_ERR("Unable to usb3380_int_rcin_sync! error=`%s` (%d)",
libusb_error_name(res), res);
- return res;
+ return libusb_to_errno(res);
}
LOG_DUMP("MSI %08x %08x %08x %08x", bufmsgs[0], bufmsgs[1], bufmsgs[2], bufmsgs[3]);
@@ -1911,7 +2077,7 @@
res = usb3380_int_statin_sync(ctx, bufmsgs, 2, &written, timeoutms);
if (res) {
- return res;
+ return libusb_to_errno(res);
}
LOG_DUMP("STAT %08x %08x", bufmsgs[0], bufmsgs[1]);
@@ -1930,7 +2096,7 @@
size,
written,
to);
- return res;
+ return libusb_to_errno(res);
}
@@ -1944,6 +2110,49 @@
size,
written,
to);
- return res;
+ return libusb_to_errno(res);
}
+
+static LIBUSB_CALL void on_async_msi_cb(struct libusb_transfer *transfer)
+{
+ libusb3380_async_manager_t* mgr = (libusb3380_async_manager_t*)transfer->user_data;
+ int msi_num = -1;
+
+ fill_base_in_cb(&mgr->msi.base, mgr->q_msi.transfer);
+
+ if (mgr->msi.base.status == DQS_SUCCESS) {
+ msi_num = mgr->msi_data[3] - MSI_DEF_DATA;
+
+ LOG_DUMP("on_async_msi_cb addr=%08x:%08x:%08x:%08x num=%d",
+ mgr->msi_data[0], mgr->msi_data[1], mgr->msi_data[2],
+ mgr->msi_data[3], msi_num);
+
+ if (msi_num < 0 || msi_num > 31) {
+ msi_num = -1;
+ }
+ }
+
+ mgr->msi_cb(mgr->msi_param, msi_num, mgr->msi.base.status == DQS_TIMEOUT);
+}
+
+
+int usb3380_msi_in_post(struct libusb3380_async_manager* mgr,
+ unsigned timeoutms,
+ on_msi_cb_t cb,
+ void* param)
+{
+ int res;
+ mgr->msi_cb = cb;
+ mgr->msi_param = param;
+
+ prepare_ptransfer_rcin(mgr, on_async_msi_cb, timeoutms);
+ res = libusb_submit_transfer(mgr->q_msi.transfer);
+
+ return libusb_to_errno(res);
+}
+
+int usb3380_msi_in_cancel(struct libusb3380_async_manager* mgr)
+{
+ return libusb_to_errno(libusb_cancel_transfer(mgr->q_msi.transfer));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/libusb3380.h new/libusb3380-0.0.0+git.20181025/libusb3380.h
--- old/libusb3380-0.0.0+git.20171214/libusb3380.h 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/libusb3380.h 2018-10-25 18:51:26.000000000 +0200
@@ -37,6 +37,7 @@
};
int usb3380_context_init(libusb3380_context_t** octx);
+int usb3380_context_init_ex(libusb3380_context_t** octx, libusb_device *dev, libusb_context *ctx);
void usb3380_context_free(libusb3380_context_t* ctx);
@@ -48,7 +49,11 @@
USB3380_LOG_DUMP,
} libusb3380_loglevel_t;
-typedef void (*usb3380_logfunc_t)(libusb3380_loglevel_t lvl, void* obj,
+typedef void (*usb3380_logfunc_t)(libusb3380_loglevel_t lvl,
+ void* obj,
+ const char* func,
+ const char* file,
+ int line,
const char* message, ...);
void usb3380_set_logfunc(usb3380_logfunc_t func, void *param);
@@ -218,6 +223,7 @@
DQS_TIMEOUT = 1,
DQS_ABORT = 2,
DQS_PARTIAL = 3,
+ DQS_CANCELLED = 4,
} libusb3380_status_t;
@@ -261,7 +267,9 @@
struct libusb3380_qgpep;
-typedef void (*on_gpep_cb_t)(const struct libusb3380_qgpep* gpep);
+typedef void (*on_gpep_cb_t)(const struct libusb3380_qgpep* gpep,
+ unsigned gpepno,
+ unsigned idx);
/* awaiting gpep data (device DMA in and out) */
typedef struct libusb3380_qgpep {
@@ -280,9 +288,14 @@
libusb3380_as_base_t base;
} libusb3380_qmsi_int_t;
+typedef struct libusb3380_configuration {
+ unsigned gp_in_cnts[LIBUSB3380_GPEP_COUNT];
+ unsigned gp_out_cnts[LIBUSB3380_GPEP_COUNT];
+} libusb3380_configuration_t;
struct libusb3380_async_manager;
int usb3380_async_start(struct libusb3380_pcidev *dev,
+ const struct libusb3380_configuration *configuration,
struct libusb3380_async_manager** out);
int usb3380_async_stop(struct libusb3380_async_manager* mgr);
@@ -301,6 +314,7 @@
int usb3380_async_set_gpep_timeout(struct libusb3380_async_manager* mgr,
bool ep_in, libusb3380_gpep_t gpep,
+ unsigned idx,
unsigned to_ms);
@@ -315,15 +329,31 @@
* full, otherwise it bolcks untill we get some space in the queue
*/
int usb3380_async_gpep_out_post(struct libusb3380_async_manager* mgr,
- libusb3380_gpep_t ep_no,
+ libusb3380_gpep_t ep_no, unsigned idx,
const uint8_t* data, unsigned size,
on_gpep_cb_t cb, void* param);
int usb3380_async_gpep_in_post(struct libusb3380_async_manager* mgr,
- libusb3380_gpep_t ep_no,
+ libusb3380_gpep_t ep_no, unsigned idx,
uint8_t* data, unsigned size,
on_gpep_cb_t cb, void* param);
+int usb3380_async_gpep_cancel(struct libusb3380_async_manager* mgr,
+ bool ep_in,
+ libusb3380_gpep_t ep_no,
+ unsigned idx);
+
+
+typedef void (*on_msi_cb_t)(void* param,
+ int msinum,
+ bool timedout);
+
+int usb3380_msi_in_post(struct libusb3380_async_manager* mgr,
+ unsigned timeoutms,
+ on_msi_cb_t cb,
+ void* param);
+int usb3380_msi_in_cancel(struct libusb3380_async_manager* mgr);
+
#ifdef __cplusplus
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/usb3380.h new/libusb3380-0.0.0+git.20181025/usb3380.h
--- old/libusb3380-0.0.0+git.20171214/usb3380.h 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/usb3380.h 2018-10-25 18:51:26.000000000 +0200
@@ -170,6 +170,8 @@
EP_GPEP1_OFF = 0x040,
EP_GPEP2_OFF = 0x060,
EP_GPEP3_OFF = 0x080,
+ EP_PCIINOUT_OFF = 0x0E0,
+ EP_RCIN_OFF = 0x100,
EP_CFG = 0x300,
EP_RSP = 0x304,
@@ -178,6 +180,16 @@
EP_AVAIL = 0x310,
};
+enum usb3380_ep_size {
+ EP_FIFO_64 = 0,
+ EP_FIFO_128 = 1,
+ EP_FIFO_256 = 2,
+ EP_FIFO_512 = 3,
+ EP_FIFO_1024 = 4,
+ EP_FIFO_2048 = 5,
+ EP_FIFO_4096 = 6,
+};
+
enum usb3380_pcictl_bits {
PCIBAR0 = 0,
PCIBAR1 = 1,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libusb3380-0.0.0+git.20171214/xtrx_port.h new/libusb3380-0.0.0+git.20181025/xtrx_port.h
--- old/libusb3380-0.0.0+git.20171214/xtrx_port.h 2017-12-14 17:04:58.000000000 +0100
+++ new/libusb3380-0.0.0+git.20181025/xtrx_port.h 2018-10-25 18:51:26.000000000 +0200
@@ -130,6 +130,10 @@
int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);
+int sem_trywait(sem_t *sem);
+
+int sem_getvalue(sem_t *sem, int *sval);
+
/** @ingroup dynamic
* Emulation of dl functions
*/
@@ -188,6 +192,7 @@
// TODO replace this constant
#define ENAVAIL 1000
+#define ENOSTR 1001
#else
#error Unknown platform