From 3e9c1876e832569364419abbb6f71e8fbec71c98 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Mon, 5 Jun 2017 16:50:14 -0400 Subject: add gptp to cmake file list gPTP will get built twice in a Travis build test. Once from a makefile and again from cmake generated makefile. This change will support appveyor building gptp for windows as part of the standard sanity tests. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 555d9db3..a9244229 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,3 +7,4 @@ add_subdirectory("thirdparty/cpputest") add_subdirectory("daemons/common/tests") add_subdirectory("daemons/mrpd") add_subdirectory("daemons/maap") +add_subdirectory("daemons/gptp") -- cgit v1.2.1 From 100af70d13715791fa4e999f206f04a7c91069f6 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Tue, 20 Jun 2017 18:09:37 -0400 Subject: travis: use cmake 3.4 --- .travis.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8eb91588..a8749dac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,12 +21,23 @@ before_install: - sudo update-alternatives --set c++ /usr/bin/g++ compiler: - gcc -env: BUILD_KERNEL=4.4.0-75-generic +env: + - BUILD_KERNEL=4.4.0-75-generic + - DEPS_DIR=${TRAVIS_BUILD_DIR}/deps install: - sudo apt-get update -qq - - sudo apt-get install -y libpcap-dev libpci-dev libsndfile1-dev libjack-dev linux-headers-4.4.0-75-generic cmake + - sudo apt-get install -y libpcap-dev libpci-dev libsndfile1-dev libjack-dev linux-headers-4.4.0-75-generic - sudo apt-get install -y libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libasound2-dev - sudo cp /usr/src/linux-headers-4.4.0-75/include/uapi/linux/ethtool.h /usr/include/linux - sudo cp /usr/src/linux-headers-4.4.0-75/include/uapi/linux/ptp_clock.h /usr/include/linux + - | + if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then + CMAKE_URL="http://www.cmake.org/files/v3.4/cmake-3.4.3-Linux-x86_64.tar.gz" + mkdir -p ${DEPS_DIR}/cmake + travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}/cmake + export PATH=${DEPS_DIR}/cmake/bin:${PATH} + fi + + script: ./travis.sh -- cgit v1.2.1 From f81c86c5747ccbaa29f4b9ec993c0ee34a4a6265 Mon Sep 17 00:00:00 2001 From: Brant Thomsen Date: Fri, 29 Sep 2017 08:46:34 -0600 Subject: Added logging support AVTP Pipeline (openavb_host and openavb_harness) and AVDECC (openavb_avdecc) have a new "-l" option to specify the filename of the log file to use. If not specified, then the behavior is unchanged, and stderr is used for logging. --- .../platform/Linux/avb_avdecc/openavb_avdecc.c | 14 ++++++-- .../platform/Linux/avb_host/openavb_harness.c | 28 +++++++++++----- .../platform/Linux/avb_host/openavb_host.c | 28 +++++++++++----- lib/avtp_pipeline/platform/Linux/openavb_osal.c | 39 +++++++++++++++++----- .../platform/Linux/openavb_osal_avdecc.c | 25 ++++++++++++-- .../platform/Linux/openavb_osal_endpoint.c | 39 +++++++++++++++++----- .../platform/Linux/openavb_osal_pub.h | 18 +++++----- 7 files changed, 142 insertions(+), 49 deletions(-) diff --git a/lib/avtp_pipeline/platform/Linux/avb_avdecc/openavb_avdecc.c b/lib/avtp_pipeline/platform/Linux/avb_avdecc/openavb_avdecc.c index 885b06ea..c1d9e9a8 100644 --- a/lib/avtp_pipeline/platform/Linux/avb_avdecc/openavb_avdecc.c +++ b/lib/avtp_pipeline/platform/Linux/avb_avdecc/openavb_avdecc.c @@ -77,6 +77,7 @@ void openavbAvdeccHostUsage(char *programName) "\n" "Usage: %s [options] file...\n" " -I val Use given (val) interface globally, can be overriden by giving the ifname= option to the config line.\n" + " -l val Filename of the log file to use. If not specified, results will be logged to stderr.\n" "\n" "Examples:\n" " %s talker.ini\n" @@ -98,6 +99,7 @@ int main(int argc, char *argv[]) char *programName; char *optIfnameGlobal = NULL; + char *optLogFileName = NULL; programName = strrchr(argv[0], '/'); programName = programName ? programName + 1 : argv[0]; @@ -110,12 +112,15 @@ int main(int argc, char *argv[]) // Process command line bool optDone = FALSE; while (!optDone) { - int opt = getopt(argc, argv, "hI:"); + int opt = getopt(argc, argv, "hI:l:"); if (opt != EOF) { switch (opt) { case 'I': optIfnameGlobal = strdup(optarg); break; + case 'l': + optLogFileName = strdup(optarg); + break; case 'h': default: openavbAvdeccHostUsage(programName); @@ -130,7 +135,7 @@ int main(int argc, char *argv[]) int iniIdx = optind; int tlCount = argc - iniIdx; - if (!osalAvdeccInitialize(optIfnameGlobal, (const char **) (argv + iniIdx), tlCount)) { + if (!osalAvdeccInitialize(optLogFileName, optIfnameGlobal, (const char **) (argv + iniIdx), tlCount)) { osalAvdeccFinalize(); exit(-1); } @@ -173,6 +178,11 @@ int main(int argc, char *argv[]) osalAvdeccFinalize(); + if (optLogFileName) { + free(optLogFileName); + optLogFileName = NULL; + } + AVB_TRACE_EXIT(AVB_TRACE_HOST); exit(0); } diff --git a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c index 115d553b..4c89041d 100644 --- a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c +++ b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_harness.c @@ -2,16 +2,16 @@ Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Attributions: The inih library portion of the source code is licensed from -Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. -Complete license and copyright information can be found at + +Attributions: The inih library portion of the source code is licensed from +Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. +Complete license and copyright information can be found at https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. *************************************************************************************************************/ @@ -122,6 +122,7 @@ void openavbTlHarnessUsage(char *programName) " -s val Stream count. Starts 'val' number of streams for each configuration file. stream_uid will be overriden.\n" " -d val Last byte of destination address from static pool. Full address will be 91:e0:f0:00:fe:val.\n" " -I val Use given (val) interface globally, can be overriden by giving the ifname= option to the config line.\n" + " -l val Filename of the log file to use. If not specified, results will be logged to stderr.\n" "\n" "Examples:\n" " %s talker.ini\n" @@ -172,6 +173,7 @@ int main(int argc, char *argv[]) bool optDestAddrSet = FALSE; U8 destAddr[ETH_ALEN] = {0x91, 0xe0, 0xf0, 0x00, 0xfe, 0x00}; char *optIfnameGlobal = NULL; + char *optLogFileName = NULL; // Talker listener vars int iniIdx = 0; @@ -229,7 +231,7 @@ int main(int argc, char *argv[]) bool optDone = FALSE; while (!optDone) { - int opt = getopt(argc, argv, "a:his:d:I:"); + int opt = getopt(argc, argv, "a:his:d:I:l:"); if (opt != EOF) { switch (opt) { case 'a': @@ -249,6 +251,9 @@ int main(int argc, char *argv[]) case 'I': optIfnameGlobal = strdup(optarg); break; + case 'l': + optLogFileName = strdup(optarg); + break; case '?': default: openavbTlHarnessUsage(programName); @@ -260,7 +265,7 @@ int main(int argc, char *argv[]) } } - osalAVBInitialize(optIfnameGlobal); + osalAVBInitialize(optLogFileName, optIfnameGlobal); // Setup the talker listener counts and lists iniIdx = optind; @@ -554,6 +559,11 @@ int main(int argc, char *argv[]) optStreamAddr = NULL; } + if (optLogFileName) { + free(optLogFileName); + optLogFileName = NULL; + } + #ifdef AVB_FEATURE_GSTREAMER // If we're supporting the interface modules which use GStreamer, // De-initialize GStreamer to clean up resources. diff --git a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c index 324f54d2..dd03f4a8 100644 --- a/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c +++ b/lib/avtp_pipeline/platform/Linux/avb_host/openavb_host.c @@ -2,16 +2,16 @@ Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Attributions: The inih library portion of the source code is licensed from -Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. -Complete license and copyright information can be found at + +Attributions: The inih library portion of the source code is licensed from +Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. +Complete license and copyright information can be found at https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. *************************************************************************************************************/ @@ -111,6 +111,7 @@ void openavbTlHostUsage(char *programName) "\n" "Usage: %s [options] file...\n" " -I val Use given (val) interface globally, can be overriden by giving the ifname= option to the config line.\n" + " -l val Filename of the log file to use. If not specified, results will be logged to stderr.\n" "\n" "Examples:\n" " %s talker.ini\n" @@ -135,6 +136,7 @@ int main(int argc, char *argv[]) int iniIdx = 0; char *programName; char *optIfnameGlobal = NULL; + char *optLogFileName = NULL; programName = strrchr(argv[0], '/'); programName = programName ? programName + 1 : argv[0]; @@ -150,12 +152,15 @@ int main(int argc, char *argv[]) // Process command line bool optDone = FALSE; while (!optDone) { - int opt = getopt(argc, argv, "hI:"); + int opt = getopt(argc, argv, "hI:l:"); if (opt != EOF) { switch (opt) { case 'I': optIfnameGlobal = strdup(optarg); break; + case 'l': + optLogFileName = strdup(optarg); + break; case 'h': default: openavbTlHostUsage(programName); @@ -167,7 +172,7 @@ int main(int argc, char *argv[]) } } - osalAVBInitialize(optIfnameGlobal); + osalAVBInitialize(optLogFileName, optIfnameGlobal); iniIdx = optind; U32 tlCount = argc - iniIdx; @@ -300,6 +305,11 @@ int main(int argc, char *argv[]) openavbTLCleanup(); + if (optLogFileName) { + free(optLogFileName); + optLogFileName = NULL; + } + #ifdef AVB_FEATURE_GSTREAMER // If we're supporting the interface modules which use GStreamer, // De-initialize GStreamer to clean up resources. diff --git a/lib/avtp_pipeline/platform/Linux/openavb_osal.c b/lib/avtp_pipeline/platform/Linux/openavb_osal.c index 05259809..f2568c54 100644 --- a/lib/avtp_pipeline/platform/Linux/openavb_osal.c +++ b/lib/avtp_pipeline/platform/Linux/openavb_osal.c @@ -2,16 +2,16 @@ Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Attributions: The inih library portion of the source code is licensed from -Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. -Complete license and copyright information can be found at + +Attributions: The inih library portion of the source code is licensed from +Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. +Complete license and copyright information can be found at https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. *************************************************************************************************************/ @@ -37,9 +37,23 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #include "openavb_pub.h" #include "openavb_log.h" -extern DLL_EXPORT bool osalAVBInitialize(const char* ifname) +static FILE *s_logfile = NULL; + +extern DLL_EXPORT bool osalAVBInitialize(const char* logfilename, const char* ifname) { - avbLogInit(); + // Open the log file, if requested. + if (s_logfile) { + fclose(s_logfile); + s_logfile = NULL; + } + if (logfilename) { + s_logfile = fopen(logfilename, "w"); + if (s_logfile == NULL) { + fprintf(stderr, "Error opening log file: %s\n", logfilename); + } + } + + avbLogInitEx(s_logfile); osalAVBTimeInit(); openavbQmgrInitialize(FQTSS_MODE_HW_CLASS, 0, ifname, 0, 0, 0); return TRUE; @@ -50,6 +64,13 @@ extern DLL_EXPORT bool osalAVBFinalize(void) openavbQmgrFinalize(); osalAVBTimeClose(); avbLogExit(); + + // Done with the log file. + if (s_logfile) { + fclose(s_logfile); + s_logfile = NULL; + } + return TRUE; } diff --git a/lib/avtp_pipeline/platform/Linux/openavb_osal_avdecc.c b/lib/avtp_pipeline/platform/Linux/openavb_osal_avdecc.c index e566e1a2..b8f056a9 100644 --- a/lib/avtp_pipeline/platform/Linux/openavb_osal_avdecc.c +++ b/lib/avtp_pipeline/platform/Linux/openavb_osal_avdecc.c @@ -38,9 +38,23 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #include "openavb_pub.h" #include "openavb_log.h" -extern DLL_EXPORT bool osalAvdeccInitialize(const char* ifname, const char **inifiles, int numfiles) +static FILE *s_logfile = NULL; + +extern DLL_EXPORT bool osalAvdeccInitialize(const char* logfilename, const char* ifname, const char **inifiles, int numfiles) { - avbLogInit(); + // Open the log file, if requested. + if (s_logfile) { + fclose(s_logfile); + s_logfile = NULL; + } + if (logfilename) { + s_logfile = fopen(logfilename, "w"); + if (s_logfile == NULL) { + fprintf(stderr, "Error opening log file: %s\n", logfilename); + } + } + + avbLogInitEx(s_logfile); osalAVBTimeInit(); if (!osalAVBGrandmasterInit()) { return FALSE; } if (!startAvdecc(ifname, inifiles, numfiles)) { return FALSE; } @@ -53,6 +67,13 @@ extern DLL_EXPORT bool osalAvdeccFinalize(void) osalAVBGrandmasterClose(); osalAVBTimeClose(); avbLogExit(); + + // Done with the log file. + if (s_logfile) { + fclose(s_logfile); + s_logfile = NULL; + } + return TRUE; } diff --git a/lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c b/lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c index ef204d32..5e661167 100644 --- a/lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c +++ b/lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c @@ -2,16 +2,16 @@ Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Attributions: The inih library portion of the source code is licensed from -Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. -Complete license and copyright information can be found at + +Attributions: The inih library portion of the source code is licensed from +Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. +Complete license and copyright information can be found at https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. *************************************************************************************************************/ @@ -38,9 +38,23 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #include "openavb_pub.h" #include "openavb_log.h" -extern DLL_EXPORT bool osalAVBInitialize(const char* ifname) +static FILE *s_logfile = NULL; + +extern DLL_EXPORT bool osalAVBInitialize(const char* logfilename, const char* ifname) { - avbLogInit(); + // Open the log file, if requested. + if (s_logfile) { + fclose(s_logfile); + s_logfile = NULL; + } + if (logfilename) { + s_logfile = fopen(logfilename, "w"); + if (s_logfile == NULL) { + fprintf(stderr, "Error opening log file: %s\n", logfilename); + } + } + + avbLogInitEx(s_logfile); osalAVBTimeInit(); startEndpoint(FQTSS_MODE_HW_CLASS, 0, ifname, 0, 0, 0); return TRUE; @@ -51,6 +65,13 @@ extern DLL_EXPORT bool osalAVBFinalize(void) stopEndpoint(); osalAVBTimeClose(); avbLogExit(); + + // Done with the log file. + if (s_logfile) { + fclose(s_logfile); + s_logfile = NULL; + } + return TRUE; } diff --git a/lib/avtp_pipeline/platform/Linux/openavb_osal_pub.h b/lib/avtp_pipeline/platform/Linux/openavb_osal_pub.h index fcb8e778..843d192e 100644 --- a/lib/avtp_pipeline/platform/Linux/openavb_osal_pub.h +++ b/lib/avtp_pipeline/platform/Linux/openavb_osal_pub.h @@ -2,16 +2,16 @@ Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company Copyright (c) 2016-2017, Harman International Industries, Incorporated All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Attributions: The inih library portion of the source code is licensed from -Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. -Complete license and copyright information can be found at + +Attributions: The inih library portion of the source code is licensed from +Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt. +Complete license and copyright information can be found at https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. *************************************************************************************************************/ @@ -37,12 +37,12 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #include "openavb_os_services_osal_pub.h" -bool osalAVBInitialize(const char *ifname); +bool osalAVBInitialize(const char* logfilename, const char *ifname); bool osalAVBFinalize(void); -bool osalAvdeccInitialize(const char *ifname, const char **inifiles, int numfiles); +bool osalAvdeccInitialize(const char* logfilename, const char *ifname, const char **inifiles, int numfiles); bool osalAvdeccFinalize(void); -- cgit v1.2.1 From 54dfe1b807f5105b5e2af6d9b60694cd043788f6 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Mon, 5 Jun 2017 15:38:51 -0400 Subject: appveyor --- appveyor.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..be1355c1 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +version: '1.0.{build}' + +clone_folder: c:\oavb +clone_depth: 20 + +environment: + # Config for mrp Windows build + WPCAP_DIR: c:\oavb\WpdPack + +install: + - git submodule update --init --recursive + # download WinPcap developer module and unzip it + - ps: Start-FileDownload 'https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip' + - ps: 7z x WpdPack_4_1_2.zip + +before_build: + # cmake + - choco upgrade cmake + - set path=C:\Program Files\CMake\bin;%path% + +build_script: + - cd c:\oavb + - cmake CMakeLists.txt -G "Visual Studio 12 2013" + - cmake --build . --config Release -- cgit v1.2.1 From f9487e1721503f2d6d9e914f952106c3ad7d00e1 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Fri, 6 Oct 2017 15:53:54 -0400 Subject: gptp: use PLAT_snprintf() - fixes MSVC build --- daemons/gptp/common/gptp_cfg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemons/gptp/common/gptp_cfg.cpp b/daemons/gptp/common/gptp_cfg.cpp index fae8e6c0..8b9db0dc 100644 --- a/daemons/gptp/common/gptp_cfg.cpp +++ b/daemons/gptp/common/gptp_cfg.cpp @@ -253,7 +253,7 @@ void GptpIniParser::print_phy_delay( void ) tx = i->second.get_tx_delay(); rx = i->second.get_rx_delay(); - snprintf( phy_delay_desc, PHY_DELAY_DESC_LEN+1, + PLAT_snprintf( phy_delay_desc, PHY_DELAY_DESC_LEN+1, "TX: %hu | RX: %hu", tx, rx ); speed_name = findNameBySpeed( speed ); -- cgit v1.2.1 From d1055c51f3348578cef517660f9c77a185223f90 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 09:11:31 -0400 Subject: cpputest submodule - use AVnu fork of cpputest --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3254bb8a..6494de60 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "thirdparty/cpputest"] path = thirdparty/cpputest - url = ../../cpputest/cpputest.git + url = ../../AVnu/cpputest.git [submodule "avdecc-lib"] path = avdecc-lib url = ../../AVnu/avdecc-lib -- cgit v1.2.1 From dacb73188c865baa6d0b5f415cd2fba23581c473 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 09:12:04 -0400 Subject: MAAP: add dummy main() to Windows build --- daemons/maap/windows/src/maap_main.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/daemons/maap/windows/src/maap_main.c b/daemons/maap/windows/src/maap_main.c index 6c817d71..dce75312 100644 --- a/daemons/maap/windows/src/maap_main.c +++ b/daemons/maap/windows/src/maap_main.c @@ -1,3 +1,32 @@ +/************************************************************************************* +Copyright (c) 2016-2017, Harman International Industries, Incorporated +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS LISTED BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*************************************************************************************/ + /* * TODO: This code still needs to be added! */ + +int main(int argc, char *argv[]) +{ +} -- cgit v1.2.1 From 645bbe673be0c489168ab66e7efa3058530e177c Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 09:52:00 -0400 Subject: cpputest updates for MSVC2015, 64-bit builds --- thirdparty/cpputest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/cpputest b/thirdparty/cpputest index 69d1b24f..1d01e490 160000 --- a/thirdparty/cpputest +++ b/thirdparty/cpputest @@ -1 +1 @@ -Subproject commit 69d1b24fa92fc8c3cf5542bf44293c3e05cfbf08 +Subproject commit 1d01e4900a6a63d89678a278f9fde4c5949f98e8 -- cgit v1.2.1 From b60bd9d126ac9bfc47dc769248d0e172de15f9fd Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 11:32:10 -0400 Subject: travis updates for newer CMAKE --- .travis.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index a8749dac..ecc2b9d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,20 +23,16 @@ compiler: - gcc env: - BUILD_KERNEL=4.4.0-75-generic - - DEPS_DIR=${TRAVIS_BUILD_DIR}/deps install: - sudo apt-get update -qq - sudo apt-get install -y libpcap-dev libpci-dev libsndfile1-dev libjack-dev linux-headers-4.4.0-75-generic - sudo apt-get install -y libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libasound2-dev - sudo cp /usr/src/linux-headers-4.4.0-75/include/uapi/linux/ethtool.h /usr/include/linux - sudo cp /usr/src/linux-headers-4.4.0-75/include/uapi/linux/ptp_clock.h /usr/include/linux - - | - if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - CMAKE_URL="http://www.cmake.org/files/v3.4/cmake-3.4.3-Linux-x86_64.tar.gz" - mkdir -p ${DEPS_DIR}/cmake - travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}/cmake - export PATH=${DEPS_DIR}/cmake/bin:${PATH} - fi + - CMAKE_URL="https://cmake.org/files/v3.9/cmake-3.9.4-Linux-x86_64.tar.gz" + - mkdir -p ${TRAVIS_BUILD_DIR}/deps/cmake + - travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${TRAVIS_BUILD_DIR}/deps/cmake + - export PATH=${TRAVIS_BUILD_DIR}/deps/cmake/bin:${PATH} script: ./travis.sh -- cgit v1.2.1 From e03cf581cc8f7f025993cffcde3be8e52cad1f22 Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 12:25:33 -0400 Subject: gptp: fix Linux cmake build --- daemons/gptp/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/daemons/gptp/CMakeLists.txt b/daemons/gptp/CMakeLists.txt index 4935e665..ee362be5 100644 --- a/daemons/gptp/CMakeLists.txt +++ b/daemons/gptp/CMakeLists.txt @@ -7,6 +7,7 @@ file(GLOB GPTP_COMMON "./common/*.cpp" "./common/*.c") if(UNIX) include_directories( include "./linux/src" ) file(GLOB GPTP_OS "./linux/src/*.cpp") + add_executable (gptp ${GPTP_COMMON} ${GPTP_OS}) target_link_libraries(gptp pthread) elseif(WIN32) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) -- cgit v1.2.1 From 943cbe5e09b836b7805fdbd889c1c87953c39abe Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 12:52:55 -0400 Subject: root CMakeLists.txt update to C++11 support --- CMakeLists.txt | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9244229..eccb62eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,43 @@ cmake_minimum_required (VERSION 2.8) project (open-avb) enable_testing() -set(C++11 ON CACHE BOOL "Compile with C++11 support" FORCE) +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + add_subdirectory("thirdparty/cpputest") add_subdirectory("daemons/common/tests") add_subdirectory("daemons/mrpd") add_subdirectory("daemons/maap") add_subdirectory("daemons/gptp") + +message(" +------------------------------------------------------- +OpenAvnu Build information + +Current compiler options: + CC: ${CMAKE_C_COMPILER} + CXX: ${CMAKE_CXX_COMPILER} + OpenAvnu CFLAGS: ${CMAKE_C_FLAGS} + OpenAvnu CXXFLAGS: ${CMAKE_CXX_FLAGS} + OpenAvnu LDFLAGS: ${CMAKE_LD_FLAGS} + +Features configured in OpenAvnu root CMakeFile.txt: + Memory Leak Detection: ${MEMORY_LEAK_DETECTION} + Compiling Extensions: ${EXTENSIONS} + Support Long Long: ${LONGLONG} + Use OpenAvnu flags: ${CMAKE_FLAGS} + + Using Standard C library: ${STD_C} + Using Standard C++ library: ${STD_CPP} + Using C++11 library: ${C++11} + +------------------------------------------------------- +") -- cgit v1.2.1 From 67cee412de055c7a49a8e37f1ee870269d3f5abb Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Sat, 7 Oct 2017 13:21:08 -0400 Subject: gptp: CMakeLists.txt update --- daemons/gptp/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/daemons/gptp/CMakeLists.txt b/daemons/gptp/CMakeLists.txt index ee362be5..fb7d19b3 100644 --- a/daemons/gptp/CMakeLists.txt +++ b/daemons/gptp/CMakeLists.txt @@ -6,9 +6,16 @@ file(GLOB GPTP_COMMON "./common/*.cpp" "./common/*.c") if(UNIX) include_directories( include "./linux/src" ) - file(GLOB GPTP_OS "./linux/src/*.cpp") + file(GLOB GPTP_OS + "./linux/src/daemon_cl.cpp" + "./linux/src/linux_ipc.cpp" + "./linux/src/platform.cpp" + "./linux/src/linux_hal_persist_file.cpp" + "./linux/src/linux_hal_generic.cpp" + "./linux/src/linux_hal_generic_adj.cpp" + "./linux/src/linux_hal_common.cpp") add_executable (gptp ${GPTP_COMMON} ${GPTP_OS}) - target_link_libraries(gptp pthread) + target_link_libraries(gptp pthread rt) elseif(WIN32) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) link_directories($ENV{WPCAP_DIR}/Lib/x64) -- cgit v1.2.1 From e6aa0fc1d18719803194b3b13be6a4f2d0911eb9 Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Mon, 9 Oct 2017 12:24:06 -0400 Subject: Fixes for compile breakage encountered in Fedora 26 Fixes incorrect return type in LinuxLock::initialize() --- daemons/gptp/linux/src/linux_hal_common.cpp | 5 +++-- daemons/gptp/linux/src/linux_hal_generic_adj.cpp | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/daemons/gptp/linux/src/linux_hal_common.cpp b/daemons/gptp/linux/src/linux_hal_common.cpp index cd880ba9..3be16c86 100644 --- a/daemons/gptp/linux/src/linux_hal_common.cpp +++ b/daemons/gptp/linux/src/linux_hal_common.cpp @@ -704,9 +704,10 @@ bool LinuxLock::initialize( OSLockType type ) { lock_c = pthread_mutex_init(&_private->mutex,&_private->mta); if(lock_c != 0) { GPTP_LOG_ERROR("Mutex initialization failed - %s",strerror(errno)); - return oslock_fail; + return false; } - return oslock_ok; + + return true; } LinuxLock::~LinuxLock() { diff --git a/daemons/gptp/linux/src/linux_hal_generic_adj.cpp b/daemons/gptp/linux/src/linux_hal_generic_adj.cpp index f722ac4a..ff445f68 100644 --- a/daemons/gptp/linux/src/linux_hal_generic_adj.cpp +++ b/daemons/gptp/linux/src/linux_hal_generic_adj.cpp @@ -32,9 +32,12 @@ ******************************************************************************/ #include - // avoid indirect inclusion of time.h since this will clash with linux/timex.h +// linux_hal_generic.hpp pulls in redefinition of struct timespec and timeval +// Below are defines that prevent this: #define _TIME_H 1 #define _STRUCT_TIMEVAL 1 +#define __timeval_defined 1 +#define __timespec_defined 1 #include #include #include -- cgit v1.2.1 From a518779cef5ee67b071e226a03eed3477583c06a Mon Sep 17 00:00:00 2001 From: Andrew Elder Date: Mon, 9 Oct 2017 16:56:24 -0400 Subject: cpputest: use MSVC div-by-zero fix from parent cpputest repo --- thirdparty/cpputest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/cpputest b/thirdparty/cpputest index 1d01e490..1d95a390 160000 --- a/thirdparty/cpputest +++ b/thirdparty/cpputest @@ -1 +1 @@ -Subproject commit 1d01e4900a6a63d89678a278f9fde4c5949f98e8 +Subproject commit 1d95a3905413d99fddb5bcbd30be35a16dbf9119 -- cgit v1.2.1 From 3cd5b54b542e45912271c46274b049df93b6a7f8 Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Tue, 10 Oct 2017 06:57:57 -0400 Subject: Simplifies timeval & timespec redefinition fix --- daemons/gptp/linux/src/linux_hal_generic_adj.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/daemons/gptp/linux/src/linux_hal_generic_adj.cpp b/daemons/gptp/linux/src/linux_hal_generic_adj.cpp index ff445f68..7f1d59c8 100644 --- a/daemons/gptp/linux/src/linux_hal_generic_adj.cpp +++ b/daemons/gptp/linux/src/linux_hal_generic_adj.cpp @@ -31,13 +31,8 @@ ******************************************************************************/ -#include -// linux_hal_generic.hpp pulls in redefinition of struct timespec and timeval -// Below are defines that prevent this: -#define _TIME_H 1 -#define _STRUCT_TIMEVAL 1 -#define __timeval_defined 1 -#define __timespec_defined 1 +#include +#define ADJ_SETOFFSET 0x0100 // Missing from older header files #include #include #include -- cgit v1.2.1 From ba94f00b69e8f235fb4d8994e0db8ab04a5717f0 Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Tue, 10 Oct 2017 08:48:13 -0400 Subject: Fix incorrect return value check in lock initialize --- daemons/gptp/linux/src/linux_hal_common.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemons/gptp/linux/src/linux_hal_common.hpp b/daemons/gptp/linux/src/linux_hal_common.hpp index 28332f01..9eb3ddc9 100644 --- a/daemons/gptp/linux/src/linux_hal_common.hpp +++ b/daemons/gptp/linux/src/linux_hal_common.hpp @@ -306,7 +306,7 @@ public: OSLock * createLock( OSLockType type ) const { LinuxLock *lock = new LinuxLock(); - if (lock->initialize(type) != oslock_ok) { + if (!lock->initialize(type)) { delete lock; lock = NULL; } -- cgit v1.2.1 From 1721f76df9347cf22aea9f3e411a4b52d3d9f849 Mon Sep 17 00:00:00 2001 From: Rich Roussel Date: Fri, 20 Oct 2017 10:38:07 -0700 Subject: Add a note to the readme for the aPTP change fork. --- README.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rst b/README.rst index e9635b1b..7640f048 100644 --- a/README.rst +++ b/README.rst @@ -120,3 +120,10 @@ XMOS is a semiconductor company providing a reference design for AVB/TSN endpoints in pro audio and automotive. XMOS endpoint source code is open source and available on Github - https://github.com/xcore/sw_avb +apple vendor ptp profile +------------------------ +Support for the apple vendor ptp profile can be found on this fork of the OpenAvnu code within the branch ArtAndLogic-aPTP-changes. + ++ https://github.com/rroussel/OpenAvnu/tree/ArtAndLogic-aPTP-changes + +These changes allow interaction with apple proprietary ptp clocks. This implementation has been tested with the apple airplay SDK on a raspberry pi 3 running within a group of devices playing the same music stream. -- cgit v1.2.1 From 6bee1680c5713082295089ad06de6f8215a4a9d0 Mon Sep 17 00:00:00 2001 From: Rich Roussel Date: Tue, 31 Oct 2017 10:47:48 -0700 Subject: Update the README.rst file to make the case of specific words consistent with the rest of the file. --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 7640f048..b8fecdf1 100644 --- a/README.rst +++ b/README.rst @@ -120,10 +120,10 @@ XMOS is a semiconductor company providing a reference design for AVB/TSN endpoints in pro audio and automotive. XMOS endpoint source code is open source and available on Github - https://github.com/xcore/sw_avb -apple vendor ptp profile +Apple Vendor PTP Profile ------------------------ -Support for the apple vendor ptp profile can be found on this fork of the OpenAvnu code within the branch ArtAndLogic-aPTP-changes. +Support for the Apple Vendor PTP Profile can be found on this fork of the OpenAvnu code within the branch ArtAndLogic-aPTP-changes. + https://github.com/rroussel/OpenAvnu/tree/ArtAndLogic-aPTP-changes -These changes allow interaction with apple proprietary ptp clocks. This implementation has been tested with the apple airplay SDK on a raspberry pi 3 running within a group of devices playing the same music stream. +These changes allow interaction with Apple proprietary PTP clocks. This implementation has been tested with the Apple AirPlay SDK on a Raspberry Pi 3 running within a group of devices playing the same music stream. -- cgit v1.2.1 From b75d61ac40c8016a8786b900e3812faa0b7074c3 Mon Sep 17 00:00:00 2001 From: Brant Thomsen Date: Tue, 31 Oct 2017 14:59:19 -0600 Subject: Daemon scripts cleanup Added shaper_daemon to run_daemons.sh and stop_daemons.sh. Fixed the path and parameters for maap_daemon. IGB is now initialized separately, as the daemons can be run without it. Don't assume the name of the NIC, and don't include "sudo" in the script, to be consistent with the other run_*.sh scripts. --- run_daemons.sh | 30 ++++++++++++++---------------- stop_daemons.sh | 7 ++++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/run_daemons.sh b/run_daemons.sh index 30da552d..63645541 100755 --- a/run_daemons.sh +++ b/run_daemons.sh @@ -6,28 +6,26 @@ nic=$1 if [ "$1" == "-h" ]; then echo "Usage: $0 " echo " eg: $0 eth1" + echo "" + echo "If you are using IGB, call \"sudo ./run_igb.sh\" before running this script." + echo "" exit fi if [ "$1" == "" ]; then - nic="eth1" #edit as required - echo "Network interface not specified, assuming: $nic" + echo "Please enter network interface name as parameter. For example:" + echo "sudo $0 eth1" + echo "" + echo "If you are using IGB, call \"sudo ./run_igb.sh\" before running this script." + echo "" + exit -1 fi echo "Starting daemons on "$nic -#use false for silence -if true; then - sudo rmmod igb - sudo insmod kmod/igb/igb_avb.ko - sudo groupadd ptp -else - sudo rmmod igb > /dev/null 2>&1 - sudo insmod kmod/igb/igb_avb.ko > /dev/null 2>&1 - sudo groupadd ptp > /dev/null 2>&1 -fi - -sudo daemons/gptp/linux/build/obj/daemon_cl $nic & -sudo daemons/mrpd/mrpd -mvs -i $nic & -sudo daemons/maap/linux/maap_daemon -i $nic & +groupadd ptp > /dev/null 2>&1 +daemons/gptp/linux/build/obj/daemon_cl $1 & +daemons/mrpd/mrpd -mvs -i $1 & +daemons/maap/linux/build/maap_daemon -i $1 -d /dev/null +daemons/shaper/shaper_daemon -d & diff --git a/stop_daemons.sh b/stop_daemons.sh index 82598852..a1ae8bb0 100755 --- a/stop_daemons.sh +++ b/stop_daemons.sh @@ -1,9 +1,10 @@ #!/bin/bash # Stop all daemons -sudo killall maap_daemon -sudo killall mrpd -sudo killall daemon_cl +killall shaper_daemon +killall maap_daemon +killall mrpd +killall daemon_cl # possibly add rmmod igb_avb here -- cgit v1.2.1 From b7838d33ce504e2392d17517329e883dc05b2bc1 Mon Sep 17 00:00:00 2001 From: Brant Thomsen Date: Wed, 1 Nov 2017 08:22:48 -0600 Subject: More consistent about use of $nic variable. --- run_daemons.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/run_daemons.sh b/run_daemons.sh index 63645541..c8ed4996 100755 --- a/run_daemons.sh +++ b/run_daemons.sh @@ -1,8 +1,6 @@ #!/bin/bash # Start all daemons -nic=$1 - if [ "$1" == "-h" ]; then echo "Usage: $0 " echo " eg: $0 eth1" @@ -21,11 +19,11 @@ if [ "$1" == "" ]; then exit -1 fi +nic=$1 echo "Starting daemons on "$nic groupadd ptp > /dev/null 2>&1 -daemons/gptp/linux/build/obj/daemon_cl $1 & -daemons/mrpd/mrpd -mvs -i $1 & -daemons/maap/linux/build/maap_daemon -i $1 -d /dev/null +daemons/gptp/linux/build/obj/daemon_cl $nic & +daemons/mrpd/mrpd -mvs -i $nic & +daemons/maap/linux/build/maap_daemon -i $nic -d /dev/null daemons/shaper/shaper_daemon -d & - -- cgit v1.2.1 From 1c87ad9804f6bd33e395b81a4bd6dd99971b200f Mon Sep 17 00:00:00 2001 From: Mounesh Sutar Date: Thu, 2 Nov 2017 16:09:31 +0530 Subject: daemons: segmentation fault while executing maap_daemon on aarch64 platform. For aarch64 platforms PTHREAD_STACK_MIN is 128k, according to it setting THREAD_STACK_SIZE to value of PTHREAD_STACK_MIN instead of 64k. --- daemons/maap/linux/src/maap_log_linux.c | 17 ++++++++++++++--- daemons/shaper/src/shaper_log_linux.c | 16 +++++++++++++--- lib/avtp_pipeline/platform/Linux/openavb_tasks.h | 10 +++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/daemons/maap/linux/src/maap_log_linux.c b/daemons/maap/linux/src/maap_log_linux.c index 2d6f02b3..35dcfcbc 100644 --- a/daemons/maap/linux/src/maap_log_linux.c +++ b/daemons/maap/linux/src/maap_log_linux.c @@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "platform.h" #include "maap_log_queue.h" @@ -74,7 +75,14 @@ extern void *loggingThreadFn(void *pv); THREAD_TYPE(loggingThread); THREAD_DEFINITON(loggingThread); -#define THREAD_STACK_SIZE 65536 +#if !defined(PTHREAD_STACK_MIN) +#error "PTHREAD_STACK_MIN variable not defined" +#elif (PTHREAD_STACK_MIN > 65536) +#define THREAD_STACK_SIZE PTHREAD_STACK_MIN +#else +#define THREAD_STACK_SIZE 65536 +#endif + #define loggingThread_THREAD_STK_SIZE THREAD_STACK_SIZE static MUTEX_HANDLE_ALT(gLogMutex); @@ -211,13 +219,16 @@ void maapLogInit(void) loggingThreadRunning = TRUE; THREAD_CREATE(loggingThread, loggingThread, NULL, loggingThreadFn, NULL); THREAD_CHECK_ERROR(loggingThread, "Thread / task creation failed", errResult); - if (errResult); // Already reported + if (errResult) { + loggingThreadRunning = FALSE; + MAAP_LOG_ERROR("Could not log data: loggingThread create failure"); + } } } void maapLogExit() { - if (MAAP_LOG_FROM_THREAD) { + if (MAAP_LOG_FROM_THREAD && loggingThreadRunning ) { loggingThreadRunning = FALSE; THREAD_JOIN(loggingThread, NULL); } diff --git a/daemons/shaper/src/shaper_log_linux.c b/daemons/shaper/src/shaper_log_linux.c index d68a79a2..38017c38 100644 --- a/daemons/shaper/src/shaper_log_linux.c +++ b/daemons/shaper/src/shaper_log_linux.c @@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "platform.h" #include "shaper_log_queue.h" @@ -74,7 +75,13 @@ extern void *loggingThreadFn(void *pv); THREAD_TYPE(loggingThread); THREAD_DEFINITON(loggingThread); -#define THREAD_STACK_SIZE 65536 +#if !defined(PTHREAD_STACK_MIN) +#error "PTHREAD_STACK_MIN variable not defined" +#elif (PTHREAD_STACK_MIN > 65536) +#define THREAD_STACK_SIZE PTHREAD_STACK_MIN +#else +#define THREAD_STACK_SIZE 65536 +#endif #define loggingThread_THREAD_STK_SIZE THREAD_STACK_SIZE static MUTEX_HANDLE_ALT(gLogMutex); @@ -217,13 +224,16 @@ void shaperLogInit(void) loggingThreadRunning = TRUE; THREAD_CREATE(loggingThread, loggingThread, NULL, loggingThreadFn, NULL); THREAD_CHECK_ERROR(loggingThread, "Thread / task creation failed", errResult); - if (errResult) {} // Already reported + if (errResult) { + loggingThreadRunning = FALSE; + SHAPER_LOG_ERROR("Could not log data: loggingThread create failure"); + } } } void shaperLogExit() { - if (SHAPER_LOG_FROM_THREAD) { + if (SHAPER_LOG_FROM_THREAD && loggingThreadRunning) { loggingThreadRunning = FALSE; THREAD_JOIN(loggingThread, NULL); } diff --git a/lib/avtp_pipeline/platform/Linux/openavb_tasks.h b/lib/avtp_pipeline/platform/Linux/openavb_tasks.h index 01969f09..387fd985 100644 --- a/lib/avtp_pipeline/platform/Linux/openavb_tasks.h +++ b/lib/avtp_pipeline/platform/Linux/openavb_tasks.h @@ -32,7 +32,15 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175. #ifndef _EAVBTASKS_H #define _EAVBTASKS_H -#define THREAD_STACK_SIZE 65536 +#include + +#if !defined(PTHREAD_STACK_MIN) +#error "PTHREAD_STACK_MIN variable not defined" +#elif (PTHREAD_STACK_MIN > 65536) +#define THREAD_STACK_SIZE PTHREAD_STACK_MIN +#else +#define THREAD_STACK_SIZE 65536 +#endif /////////////////////////// // Platform code Tasks values -- cgit v1.2.1 From 5f2fea5cfe48bfd2f52a7f5163209aed3914af86 Mon Sep 17 00:00:00 2001 From: Fredrik Hallenberg Date: Thu, 16 Nov 2017 14:44:29 +0100 Subject: Fix mmrp parsing --- examples/mrp_client/mrpdhelper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/mrp_client/mrpdhelper.c b/examples/mrp_client/mrpdhelper.c index ddd5a958..a4026903 100644 --- a/examples/mrp_client/mrpdhelper.c +++ b/examples/mrp_client/mrpdhelper.c @@ -301,8 +301,8 @@ static int parse_mmrp(char *sz, size_t len, struct mrpdhelper_notify *n) if (parse_state(&sz[5], n) < 0) return -1; - n->attrib = mrpdhelper_attribtype_mvrp; - if (sscanf(&sz[8], "M=%" SCNx64, &n->u.m.mac) != 1) + n->attrib = mrpdhelper_attribtype_mmrp; + if (sscanf(&sz[4], "M=%" SCNx64, &n->u.m.mac) != 1) return -1; return parse_registrar(sz, n, NULL); } -- cgit v1.2.1 From adc779488a6a5305ea9159df11aed958145bfd79 Mon Sep 17 00:00:00 2001 From: Fredrik Hallenberg Date: Thu, 16 Nov 2017 14:47:36 +0100 Subject: Fix crash when enabling LOG_MVRP --- daemons/mrpd/mvrp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemons/mrpd/mvrp.c b/daemons/mrpd/mvrp.c index b36e3ace..fa14ac37 100644 --- a/daemons/mrpd/mvrp.c +++ b/daemons/mrpd/mvrp.c @@ -331,7 +331,8 @@ int mvrp_event(int event, struct mvrp_attribute *rattrib) } attrib = mvrp_conditional_reclaim(attrib); #if LOG_MVRP - mvrp_print_debug_info(event, attrib); + if (attrib != NULL) + mvrp_print_debug_info(event, attrib); #endif break; default: -- cgit v1.2.1 From fa0163d131885fab1c1f2c0954e453d0da93f93f Mon Sep 17 00:00:00 2001 From: Michal Galka Date: Mon, 27 Nov 2017 11:40:55 +0100 Subject: Fixing stale Tx timestamp fetch. --- daemons/gptp/linux/src/linux_hal_generic.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/daemons/gptp/linux/src/linux_hal_generic.cpp b/daemons/gptp/linux/src/linux_hal_generic.cpp index 5364fa6a..395e344f 100644 --- a/daemons/gptp/linux/src/linux_hal_generic.cpp +++ b/daemons/gptp/linux/src/linux_hal_generic.cpp @@ -33,6 +33,8 @@ #include #include +#include +#include #include #include #include @@ -285,6 +287,10 @@ int LinuxTimestamperGeneric::HWTimestamper_txtimestamp struct cmsghdr *cmsg; struct sockaddr_ll remote; struct iovec sgentry; + PTPMessageId reflectedMessageId; + uint8_t reflected_bytes[46]; + uint8_t *gptpCommonHeader; + uint16_t sequenceId; struct { struct cmsghdr cm; char control[256]; @@ -296,8 +302,10 @@ int LinuxTimestamperGeneric::HWTimestamper_txtimestamp msg.msg_iov = &sgentry; msg.msg_iovlen = 1; - sgentry.iov_base = NULL; - sgentry.iov_len = 0; + sgentry.iov_base = reflected_bytes; + sgentry.iov_len = sizeof(reflected_bytes); + + gptpCommonHeader = reflected_bytes + 14; memset( &remote, 0, sizeof(remote)); msg.msg_name = (caddr_t) &remote; @@ -316,6 +324,14 @@ int LinuxTimestamperGeneric::HWTimestamper_txtimestamp goto done; } } + sequenceId = PLAT_ntohs(*((uint16_t*)(PTP_COMMON_HDR_SEQUENCE_ID(gptpCommonHeader)))); + reflectedMessageId.setSequenceId(sequenceId); + reflectedMessageId.setMessageType((MessageType)(*gptpCommonHeader & 0xF)); + if (messageId != reflectedMessageId) { + GPTP_LOG_WARNING("Timestamp discarded due to wrong message id"); + ret = GPTP_EC_EAGAIN; + goto done; + } // Retrieve the timestamp cmsg = CMSG_FIRSTHDR(&msg); -- cgit v1.2.1 From 3fde53e712e70b48a5405fd286aef637df751d33 Mon Sep 17 00:00:00 2001 From: Michal Galka Date: Fri, 1 Dec 2017 10:22:57 +0100 Subject: Got rid of magic numbers. More self-explanatory code. --- daemons/gptp/common/ptptypes.hpp | 1 + daemons/gptp/linux/src/linux_hal_generic.cpp | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/daemons/gptp/common/ptptypes.hpp b/daemons/gptp/common/ptptypes.hpp index 03cd57be..f73c8f92 100644 --- a/daemons/gptp/common/ptptypes.hpp +++ b/daemons/gptp/common/ptptypes.hpp @@ -43,6 +43,7 @@ typedef double FrequencyRatio; /*!< Frequency Ratio */ typedef long double FrequencyRatio; /*!< Frequency Ratio */ #endif +#define ETHER_HDR_LEN (14) #define ETHER_ADDR_OCTETS 6 /*!< Number of octets in a link layer address*/ #define IP_ADDR_OCTETS 4 /*!< Number of octets in a ip address*/ #define PTP_ETHERTYPE 0x88F7 /*!< PTP ethertype */ diff --git a/daemons/gptp/linux/src/linux_hal_generic.cpp b/daemons/gptp/linux/src/linux_hal_generic.cpp index 395e344f..9eeba46f 100644 --- a/daemons/gptp/linux/src/linux_hal_generic.cpp +++ b/daemons/gptp/linux/src/linux_hal_generic.cpp @@ -30,7 +30,6 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ - #include #include #include @@ -288,7 +287,7 @@ int LinuxTimestamperGeneric::HWTimestamper_txtimestamp struct sockaddr_ll remote; struct iovec sgentry; PTPMessageId reflectedMessageId; - uint8_t reflected_bytes[46]; + uint8_t reflected_bytes[ETHER_HDR_LEN + PTP_COMMON_HDR_LENGTH]; uint8_t *gptpCommonHeader; uint16_t sequenceId; struct { @@ -305,7 +304,7 @@ int LinuxTimestamperGeneric::HWTimestamper_txtimestamp sgentry.iov_base = reflected_bytes; sgentry.iov_len = sizeof(reflected_bytes); - gptpCommonHeader = reflected_bytes + 14; + gptpCommonHeader = reflected_bytes + ETHER_HDR_LEN; memset( &remote, 0, sizeof(remote)); msg.msg_name = (caddr_t) &remote; @@ -326,7 +325,7 @@ int LinuxTimestamperGeneric::HWTimestamper_txtimestamp } sequenceId = PLAT_ntohs(*((uint16_t*)(PTP_COMMON_HDR_SEQUENCE_ID(gptpCommonHeader)))); reflectedMessageId.setSequenceId(sequenceId); - reflectedMessageId.setMessageType((MessageType)(*gptpCommonHeader & 0xF)); + reflectedMessageId.setMessageType((MessageType)(*PTP_COMMON_HDR_TRANSSPEC_MSGTYPE(gptpCommonHeader) & 0xF)); if (messageId != reflectedMessageId) { GPTP_LOG_WARNING("Timestamp discarded due to wrong message id"); ret = GPTP_EC_EAGAIN; -- cgit v1.2.1