summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevi Pearson <levi.pearson@harman.com>2016-06-16 10:06:28 -0600
committerMarcin Miklas <marcin@miklas.pl>2016-09-12 21:37:11 +0200
commit05d838dfe7e33e3adf041879c3ca0f1bfdfab4d5 (patch)
tree7df6410cffe118417ee7fb74efb8134048c40587
parent4497d99c88d144a40adf38650388d6d78e1134c3 (diff)
downloadOpen-AVB-05d838dfe7e33e3adf041879c3ca0f1bfdfab4d5.tar.gz
avtp_pipeline: Change DOS line endings to UNIX line endings
-rw-r--r--lib/avtp_pipeline/include/openavb_log_pub.h492
-rw-r--r--lib/avtp_pipeline/include/openavb_platform_pub.h84
-rw-r--r--lib/avtp_pipeline/include/openavb_types_base_pub.h240
-rw-r--r--lib/avtp_pipeline/inih/ini.c584
-rw-r--r--lib/avtp_pipeline/inih/ini.h144
-rw-r--r--lib/avtp_pipeline/intf_logger/openavb_intf_logger.c402
-rw-r--r--lib/avtp_pipeline/intf_tonegen/openavb_intf_tonegen.c1048
-rwxr-xr-xlib/avtp_pipeline/intf_viewer/openavb_intf_viewer.c1040
-rw-r--r--lib/avtp_pipeline/mcr/openavb_mcr_hal_pub.h130
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_ether_osal.c78
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_ether_osal.h58
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_osal.c110
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c112
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_time_osal.c413
-rw-r--r--lib/avtp_pipeline/platform/Linux/openavb_time_osal.h60
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.c78
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.h74
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal_pub.h76
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_tcal_pub.h76
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_time_tcal_pub.h98
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_types_base_tcal_pub.h80
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/openavb_warnings_tcal.h74
-rw-r--r--lib/avtp_pipeline/platform/platTCAL/GNU/rawsock/openavb_rawsock_tcal.h118
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.c124
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.h74
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/openavb_hal.h76
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.c144
-rw-r--r--lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.h68
-rw-r--r--lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c160
-rw-r--r--lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c302
-rwxr-xr-xlib/avtp_pipeline/tl/openavb_tl.c1468
-rw-r--r--lib/avtp_pipeline/tl/openavb_tl_no_endpoint.c268
-rw-r--r--lib/avtp_pipeline/util/openavb_queue.c392
33 files changed, 4372 insertions, 4373 deletions
diff --git a/lib/avtp_pipeline/include/openavb_log_pub.h b/lib/avtp_pipeline/include/openavb_log_pub.h
index 92a93c98..9ae5f1e0 100644
--- a/lib/avtp_pipeline/include/openavb_log_pub.h
+++ b/lib/avtp_pipeline/include/openavb_log_pub.h
@@ -1,246 +1,246 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : A simple logging facility for use during
-* development.
-*/
-
-#ifndef OPENAVB_LOG_PUB_H
-#define OPENAVB_LOG_PUB_H 1
-
-// ********
-// Merge Issue
-// TODO: Restructure to remove #ifdef code.
-// ********
-
-#include "openavb_platform_pub.h"
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "openavb_types_pub.h"
-
-// Uncomment AVB_LOG_ON to enable logging.
-#define AVB_LOG_ON 1
-
-// Uncomment AVB_LOG_ON_OVERRIDE to override all AVB_LOG_ON usage in the stack to ensure all logs are off.
-//#define AVB_LOG_ON_OVERRIDE 1
-
-#ifdef AVB_LOG_ON_OVERRIDE
-#ifdef AVB_LOG_ON
-#undef AVB_LOG_ON
-#endif
-#endif
-
-#define AVB_LOG_LEVEL_NONE 0
-#define AVB_LOG_LEVEL_ERROR 1
-#define AVB_LOG_LEVEL_WARNING 2
-#define AVB_LOG_LEVEL_INFO 3
-#define AVB_LOG_LEVEL_STATUS 4
-#define AVB_LOG_LEVEL_DEBUG 5
-#define AVB_LOG_LEVEL_VERBOSE 6
-
-// Special case development logging levels for use with AVB_LOGF_DEV and AVB_LOG_DEV
-#define AVB_LOG_LEVEL_DEV_ON AVB_LOG_LEVEL_NONE
-#define AVB_LOG_LEVEL_DEV_OFF AVB_LOG_LEVEL_VERBOSE + 1
-
-// Default log level, can override in source files
-#ifndef AVB_LOG_LEVEL
-//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_ERROR
-//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_INFO
-#define AVB_LOG_LEVEL AVB_LOG_LEVEL_STATUS
-//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_DEBUG
-//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_VERBOSE
-#endif
-
-#ifndef AVB_LOG_COMPANY
-#define AVB_LOG_COMPANY "OPENAVB"
-#endif
-
-#ifndef AVB_LOG_COMPONENT
-#define AVB_LOG_COMPONENT "AVB Stack"
-#endif
-
-// Log format options and sizes. Uncomment to include the formatted info.
-#define LOG_MSG_LEN 1024
-
-// The length of the full message
-#define LOG_FULL_MSG_LEN 1024
-
-static const bool OPENAVB_LOG_TIME_INFO = FALSE;
-#define LOG_TIME_LEN 9
-//#define LOG_TIME_LEN 1
-
-static const bool OPENAVB_LOG_TIMESTAMP_INFO = TRUE;
-#define LOG_TIMESTAMP_LEN 32
-//#define LOG_TIMESTAMP_LEN 1
-
-static const bool OPENAVB_LOG_FILE_INFO = FALSE;
-//#define LOG_FILE_LEN 256
-#define LOG_FILE_LEN 1
-
-static const bool OPENAVB_LOG_PROC_INFO = FALSE;
-//#define LOG_PROC_LEN 64
-#define LOG_PROC_LEN 1
-
-static const bool OPENAVB_LOG_THREAD_INFO = FALSE;
-//#define LOG_THREAD_LEN 64
-#define LOG_THREAD_LEN 1
-
-#define LOG_RT_MSG_LEN 256
-//#define LOG_RT_MSG_LEN 1
-
-#define AVB_LOG_OUTPUT_FD stderr
-//#define AVB_LOG_OUTPUT_FD stdout
-
-// When OPENAVB_LOG_FROM_THREAD the message output will be output from a separate thread/task
-// Primary intended use is for debugging.
-// It is expected that OPENAVB_LOG_PULL_MODE will not be used at the same time as this optoin.
-static const bool OPENAVB_LOG_FROM_THREAD = TRUE;
-
-// When OPENAVB_LOG_PULL_MODE the messages will be queued and can be pulled using the
-// avbLogGetMsg() call. This could be from an logger interface module or host application.
-// It is expected that OPENAVB_LOG_FROM_THREAD will not be used at the same time as this option.
-static const bool OPENAVB_LOG_PULL_MODE = FALSE;
-
-// When using the OPENAVB_LOG_FROM_THREAD option. These defines control the behavior of the msg queue
-#define LOG_QUEUE_MSG_LEN 256
-#define LOG_QUEUE_MSG_SIZE (LOG_QUEUE_MSG_LEN + 1)
-#define LOG_QUEUE_MSG_CNT 82
-#define LOG_QUEUE_SLEEP_MSEC 100
-
-// RT (RealTime logging) related defines
-#define LOG_RT_QUEUE_CNT 128
-#define LOG_RT_BEGIN TRUE
-#define LOG_RT_ITEM TRUE
-#define LOG_RT_END TRUE
-typedef enum {
- LOG_RT_DATATYPE_NONE,
- LOG_RT_DATATYPE_CONST_STR,
- LOG_RT_DATATYPE_NOW_TS,
- LOG_RT_DATATYPE_U16,
- LOG_RT_DATATYPE_S16,
- LOG_RT_DATATYPE_U32,
- LOG_RT_DATATYPE_S32,
- LOG_RT_DATATYPE_U64,
- LOG_RT_DATATYPE_S64,
- LOG_RT_DATATYPE_FLOAT
-} log_rt_datatype_t;
-
-
-#define LOG_VARX(x, y) x ## y
-#define LOG_VAR(x, y) LOG_VARX(x, y)
-
-// Log a message once. Technically once every 4.2 billion attempts. Usage: LOG_ONCE AVB_LOG_INFO(...)
-#define IF_LOG_ONCE() static U32 LOG_VAR(logOnce,__LINE__); if (!LOG_VAR(logOnce,__LINE__)++)
-
-// Log a message at an interval. Usage: LOG_INTERVAL(100) AVB_LOG_INFO(...)
-#define IF_LOG_INTERVAL(x) static U32 LOG_VAR(logOnce,__LINE__); if (!(LOG_VAR(logOnce,__LINE__)++ % (x - 1)))
-
-
-#define ETH_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x"
-#define ETH_OCTETS(a) (a)[0],(a)[1],(a)[2],(a)[3],(a)[4],(a)[5]
-
-#define STREAMID_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x/%d"
-#define STREAMID_ARGS(s) (s)->addr[0],(s)->addr[1],(s)->addr[2],(s)->addr[3],(s)->addr[4],(s)->addr[5],(s)->uniqueID
-
-void avbLogInit(void);
-
-void avbLogExit(void);
-
-void avbLogFn(
- int level,
- const char *tag,
- const char *company,
- const char *component,
- const char *path,
- int line,
- const char *fmt,
- ...);
-
-void avbLogRT(int level, bool bBegin, bool bItem, bool bEnd, char *pFormat, log_rt_datatype_t dataType, void *pVar);
-
-
-#define avbLogFn2(level, tag, company, component, path, line, fmt, ...) \
- ({\
- if (level <= AVB_LOG_LEVEL) \
- avbLogFn(0, tag, company, component, path, line, fmt, __VA_ARGS__); \
- })
-
-#ifdef AVB_LOG_ON
-#define AVB_LOGF_DEV(LEVEL, FMT, ...) avbLogFn2(LEVEL, "DEV", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOGF_ERROR(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_ERROR, "ERROR", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOGF_WARNING(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_WARNING, "WARNING", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOGF_INFO(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_INFO, "INFO", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOGF_STATUS(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_STATUS, "STATUS", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOGF_DEBUG(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_DEBUG, "DEBUG", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOGF_VERBOSE(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_VERBOSE, "VERBOSE", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOG_DEV(LEVEL, FMT, ...) avbLogFn2(LEVEL, "DEV", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
-#define AVB_LOG_ERROR(MSG) avbLogFn2(AVB_LOG_LEVEL_ERROR, "ERROR", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
-#define AVB_LOG_WARNING(MSG) avbLogFn2(AVB_LOG_LEVEL_WARNING, "WARNING", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
-#define AVB_LOG_INFO(MSG) avbLogFn2(AVB_LOG_LEVEL_INFO, "INFO", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
-#define AVB_LOG_STATUS(MSG) avbLogFn2(AVB_LOG_LEVEL_STATUS, "STATUS", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
-#define AVB_LOG_DEBUG(MSG) avbLogFn2(AVB_LOG_LEVEL_DEBUG, "DEBUG", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
-#define AVB_LOG_VERBOSE(MSG) avbLogFn2(AVB_LOG_LEVEL_VERBOSE, "VERBOSE", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
-#define AVB_LOGRT_ERROR(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_ERROR, BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_WARNING(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_WARNING, BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_INFO(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_INFO, BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_STATUS(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_STATUS, BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_DEBUG(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_DEBUG, BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_VERBOSE(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_VERBOSE, BEGIN, ITEM, END, FMT, TYPE, VAL)
-#else
-#define AVB_LOGF_DEV(LEVEL, FMT, ...)
-#define AVB_LOGF_ERROR(FMT, ...)
-#define AVB_LOGF_WARNING(FMT, ...)
-#define AVB_LOGF_INFO(FMT, ...)
-#define AVB_LOGF_STATUS(FMT, ...)
-#define AVB_LOGF_DEBUG(FMT, ...)
-#define AVB_LOGF_VERBOSE(FMT, ...)
-#define AVB_LOG_DEV(LEVEL, FMT, ...)
-#define AVB_LOG_ERROR(MSG)
-#define AVB_LOG_WARNING(MSG)
-#define AVB_LOG_INFO(MSG)
-#define AVB_LOG_STATUS(MSG)
-#define AVB_LOG_DEBUG(MSG)
-#define AVB_LOG_VERBOSE(MSG)
-#define AVB_LOGRT_ERROR(BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_WARNING(BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_INFO(BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_STATUS(BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_DEBUG(BEGIN, ITEM, END, FMT, TYPE, VAL)
-#define AVB_LOGRT_VERBOSE(BEGIN, ITEM, END, FMT, TYPE, VAL)
-#endif // AVB_LOG_ON
-
-// Get a queued log message. Intended to be used with the OPENAVB_LOG_PULL_MODE option.
-// Message will not be null terminated.
-U32 avbLogGetMsg(U8 *pBuf, U32 bufSize);
-
-#endif // OPENAVB_LOG_PUB_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : A simple logging facility for use during
+* development.
+*/
+
+#ifndef OPENAVB_LOG_PUB_H
+#define OPENAVB_LOG_PUB_H 1
+
+// ********
+// Merge Issue
+// TODO: Restructure to remove #ifdef code.
+// ********
+
+#include "openavb_platform_pub.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "openavb_types_pub.h"
+
+// Uncomment AVB_LOG_ON to enable logging.
+#define AVB_LOG_ON 1
+
+// Uncomment AVB_LOG_ON_OVERRIDE to override all AVB_LOG_ON usage in the stack to ensure all logs are off.
+//#define AVB_LOG_ON_OVERRIDE 1
+
+#ifdef AVB_LOG_ON_OVERRIDE
+#ifdef AVB_LOG_ON
+#undef AVB_LOG_ON
+#endif
+#endif
+
+#define AVB_LOG_LEVEL_NONE 0
+#define AVB_LOG_LEVEL_ERROR 1
+#define AVB_LOG_LEVEL_WARNING 2
+#define AVB_LOG_LEVEL_INFO 3
+#define AVB_LOG_LEVEL_STATUS 4
+#define AVB_LOG_LEVEL_DEBUG 5
+#define AVB_LOG_LEVEL_VERBOSE 6
+
+// Special case development logging levels for use with AVB_LOGF_DEV and AVB_LOG_DEV
+#define AVB_LOG_LEVEL_DEV_ON AVB_LOG_LEVEL_NONE
+#define AVB_LOG_LEVEL_DEV_OFF AVB_LOG_LEVEL_VERBOSE + 1
+
+// Default log level, can override in source files
+#ifndef AVB_LOG_LEVEL
+//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_ERROR
+//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_INFO
+#define AVB_LOG_LEVEL AVB_LOG_LEVEL_STATUS
+//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_DEBUG
+//#define AVB_LOG_LEVEL AVB_LOG_LEVEL_VERBOSE
+#endif
+
+#ifndef AVB_LOG_COMPANY
+#define AVB_LOG_COMPANY "OPENAVB"
+#endif
+
+#ifndef AVB_LOG_COMPONENT
+#define AVB_LOG_COMPONENT "AVB Stack"
+#endif
+
+// Log format options and sizes. Uncomment to include the formatted info.
+#define LOG_MSG_LEN 1024
+
+// The length of the full message
+#define LOG_FULL_MSG_LEN 1024
+
+static const bool OPENAVB_LOG_TIME_INFO = FALSE;
+#define LOG_TIME_LEN 9
+//#define LOG_TIME_LEN 1
+
+static const bool OPENAVB_LOG_TIMESTAMP_INFO = TRUE;
+#define LOG_TIMESTAMP_LEN 32
+//#define LOG_TIMESTAMP_LEN 1
+
+static const bool OPENAVB_LOG_FILE_INFO = FALSE;
+//#define LOG_FILE_LEN 256
+#define LOG_FILE_LEN 1
+
+static const bool OPENAVB_LOG_PROC_INFO = FALSE;
+//#define LOG_PROC_LEN 64
+#define LOG_PROC_LEN 1
+
+static const bool OPENAVB_LOG_THREAD_INFO = FALSE;
+//#define LOG_THREAD_LEN 64
+#define LOG_THREAD_LEN 1
+
+#define LOG_RT_MSG_LEN 256
+//#define LOG_RT_MSG_LEN 1
+
+#define AVB_LOG_OUTPUT_FD stderr
+//#define AVB_LOG_OUTPUT_FD stdout
+
+// When OPENAVB_LOG_FROM_THREAD the message output will be output from a separate thread/task
+// Primary intended use is for debugging.
+// It is expected that OPENAVB_LOG_PULL_MODE will not be used at the same time as this optoin.
+static const bool OPENAVB_LOG_FROM_THREAD = TRUE;
+
+// When OPENAVB_LOG_PULL_MODE the messages will be queued and can be pulled using the
+// avbLogGetMsg() call. This could be from an logger interface module or host application.
+// It is expected that OPENAVB_LOG_FROM_THREAD will not be used at the same time as this option.
+static const bool OPENAVB_LOG_PULL_MODE = FALSE;
+
+// When using the OPENAVB_LOG_FROM_THREAD option. These defines control the behavior of the msg queue
+#define LOG_QUEUE_MSG_LEN 256
+#define LOG_QUEUE_MSG_SIZE (LOG_QUEUE_MSG_LEN + 1)
+#define LOG_QUEUE_MSG_CNT 82
+#define LOG_QUEUE_SLEEP_MSEC 100
+
+// RT (RealTime logging) related defines
+#define LOG_RT_QUEUE_CNT 128
+#define LOG_RT_BEGIN TRUE
+#define LOG_RT_ITEM TRUE
+#define LOG_RT_END TRUE
+typedef enum {
+ LOG_RT_DATATYPE_NONE,
+ LOG_RT_DATATYPE_CONST_STR,
+ LOG_RT_DATATYPE_NOW_TS,
+ LOG_RT_DATATYPE_U16,
+ LOG_RT_DATATYPE_S16,
+ LOG_RT_DATATYPE_U32,
+ LOG_RT_DATATYPE_S32,
+ LOG_RT_DATATYPE_U64,
+ LOG_RT_DATATYPE_S64,
+ LOG_RT_DATATYPE_FLOAT
+} log_rt_datatype_t;
+
+
+#define LOG_VARX(x, y) x ## y
+#define LOG_VAR(x, y) LOG_VARX(x, y)
+
+// Log a message once. Technically once every 4.2 billion attempts. Usage: LOG_ONCE AVB_LOG_INFO(...)
+#define IF_LOG_ONCE() static U32 LOG_VAR(logOnce,__LINE__); if (!LOG_VAR(logOnce,__LINE__)++)
+
+// Log a message at an interval. Usage: LOG_INTERVAL(100) AVB_LOG_INFO(...)
+#define IF_LOG_INTERVAL(x) static U32 LOG_VAR(logOnce,__LINE__); if (!(LOG_VAR(logOnce,__LINE__)++ % (x - 1)))
+
+
+#define ETH_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x"
+#define ETH_OCTETS(a) (a)[0],(a)[1],(a)[2],(a)[3],(a)[4],(a)[5]
+
+#define STREAMID_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x/%d"
+#define STREAMID_ARGS(s) (s)->addr[0],(s)->addr[1],(s)->addr[2],(s)->addr[3],(s)->addr[4],(s)->addr[5],(s)->uniqueID
+
+void avbLogInit(void);
+
+void avbLogExit(void);
+
+void avbLogFn(
+ int level,
+ const char *tag,
+ const char *company,
+ const char *component,
+ const char *path,
+ int line,
+ const char *fmt,
+ ...);
+
+void avbLogRT(int level, bool bBegin, bool bItem, bool bEnd, char *pFormat, log_rt_datatype_t dataType, void *pVar);
+
+
+#define avbLogFn2(level, tag, company, component, path, line, fmt, ...) \
+ ({\
+ if (level <= AVB_LOG_LEVEL) \
+ avbLogFn(0, tag, company, component, path, line, fmt, __VA_ARGS__); \
+ })
+
+#ifdef AVB_LOG_ON
+#define AVB_LOGF_DEV(LEVEL, FMT, ...) avbLogFn2(LEVEL, "DEV", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOGF_ERROR(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_ERROR, "ERROR", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOGF_WARNING(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_WARNING, "WARNING", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOGF_INFO(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_INFO, "INFO", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOGF_STATUS(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_STATUS, "STATUS", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOGF_DEBUG(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_DEBUG, "DEBUG", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOGF_VERBOSE(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_VERBOSE, "VERBOSE", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOG_DEV(LEVEL, FMT, ...) avbLogFn2(LEVEL, "DEV", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
+#define AVB_LOG_ERROR(MSG) avbLogFn2(AVB_LOG_LEVEL_ERROR, "ERROR", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
+#define AVB_LOG_WARNING(MSG) avbLogFn2(AVB_LOG_LEVEL_WARNING, "WARNING", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
+#define AVB_LOG_INFO(MSG) avbLogFn2(AVB_LOG_LEVEL_INFO, "INFO", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
+#define AVB_LOG_STATUS(MSG) avbLogFn2(AVB_LOG_LEVEL_STATUS, "STATUS", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
+#define AVB_LOG_DEBUG(MSG) avbLogFn2(AVB_LOG_LEVEL_DEBUG, "DEBUG", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
+#define AVB_LOG_VERBOSE(MSG) avbLogFn2(AVB_LOG_LEVEL_VERBOSE, "VERBOSE", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
+#define AVB_LOGRT_ERROR(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_ERROR, BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_WARNING(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_WARNING, BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_INFO(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_INFO, BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_STATUS(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_STATUS, BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_DEBUG(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_DEBUG, BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_VERBOSE(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_VERBOSE, BEGIN, ITEM, END, FMT, TYPE, VAL)
+#else
+#define AVB_LOGF_DEV(LEVEL, FMT, ...)
+#define AVB_LOGF_ERROR(FMT, ...)
+#define AVB_LOGF_WARNING(FMT, ...)
+#define AVB_LOGF_INFO(FMT, ...)
+#define AVB_LOGF_STATUS(FMT, ...)
+#define AVB_LOGF_DEBUG(FMT, ...)
+#define AVB_LOGF_VERBOSE(FMT, ...)
+#define AVB_LOG_DEV(LEVEL, FMT, ...)
+#define AVB_LOG_ERROR(MSG)
+#define AVB_LOG_WARNING(MSG)
+#define AVB_LOG_INFO(MSG)
+#define AVB_LOG_STATUS(MSG)
+#define AVB_LOG_DEBUG(MSG)
+#define AVB_LOG_VERBOSE(MSG)
+#define AVB_LOGRT_ERROR(BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_WARNING(BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_INFO(BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_STATUS(BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_DEBUG(BEGIN, ITEM, END, FMT, TYPE, VAL)
+#define AVB_LOGRT_VERBOSE(BEGIN, ITEM, END, FMT, TYPE, VAL)
+#endif // AVB_LOG_ON
+
+// Get a queued log message. Intended to be used with the OPENAVB_LOG_PULL_MODE option.
+// Message will not be null terminated.
+U32 avbLogGetMsg(U8 *pBuf, U32 bufSize);
+
+#endif // OPENAVB_LOG_PUB_H
diff --git a/lib/avtp_pipeline/include/openavb_platform_pub.h b/lib/avtp_pipeline/include/openavb_platform_pub.h
index 61233712..8be98866 100644
--- a/lib/avtp_pipeline/include/openavb_platform_pub.h
+++ b/lib/avtp_pipeline/include/openavb_platform_pub.h
@@ -1,42 +1,42 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE : Public interface for platform specific functionality
-*/
-
-#ifndef _OPENAVB_PLATFORM_PUB_H
-#define _OPENAVB_PLATFORM_PUB_H
-
-#include "openavb_types_pub.h"
-#include "openavb_osal_pub.h"
-#include "openavb_mem_tcal_pub.h"
-
-#endif // _OPENAVB_PLATFORM_PUB_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE : Public interface for platform specific functionality
+*/
+
+#ifndef _OPENAVB_PLATFORM_PUB_H
+#define _OPENAVB_PLATFORM_PUB_H
+
+#include "openavb_types_pub.h"
+#include "openavb_osal_pub.h"
+#include "openavb_mem_tcal_pub.h"
+
+#endif // _OPENAVB_PLATFORM_PUB_H
diff --git a/lib/avtp_pipeline/include/openavb_types_base_pub.h b/lib/avtp_pipeline/include/openavb_types_base_pub.h
index f568477a..1d03e80a 100644
--- a/lib/avtp_pipeline/include/openavb_types_base_pub.h
+++ b/lib/avtp_pipeline/include/openavb_types_base_pub.h
@@ -1,120 +1,120 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE : Public AVB Base Types (have no dependencies)
-*/
-
-#ifndef AVB_TYPES_BASE_PUB_H
-#define AVB_TYPES_BASE_PUB_H 1
-
-#include "openavb_types_base_tcal_pub.h"
-#include <stdbool.h>
-#include <inttypes.h>
-
-/** \file
- * Common Base AVB Types that are exposed outside of the AVB
- * stack.
- */
-
-/*
- * Useful types for OPENAVB AVB
- *
- */
-/// Number of nanoseconds in second
-#define NANOSECONDS_PER_SECOND (1000000000ULL)
-/// Number of nanoseconds in milisecond
-#define NANOSECONDS_PER_MSEC (1000000L)
-/// Number of nanoseconds in microsecond
-#define NANOSECONDS_PER_USEC (1000L)
-/// Number of microseconds in second
-#define MICROSECONDS_PER_SECOND (1000000L)
-/// Number of microseconds in milisecond
-#define MICROSECONDS_PER_MSEC (1000L)
-
-#ifndef TRUE // possible confict with gboolean
-/// True boolean value
-#define TRUE true
-/// False boolean value
-#define FALSE false
-#endif
-
-#ifndef NULL
-/// Null pointer value
-#define NULL 0
-#endif
-
-/// Signed 8 bit type
-typedef int8_t S8;
-/// Unsigned 8 bit type
-typedef uint8_t U8;
-/// Signed 16 bit type
-typedef int16_t S16;
-/// Unsigned 16 bit type
-typedef uint16_t U16;
-/// Signed 32 bit type
-typedef int32_t S32;
-/// Unsigned 32 bit type
-typedef uint32_t U32;
-/// Signed 64 bit type
-typedef int64_t S64;
-/// Unsigned 64 bit type
-typedef uint64_t U64;
-
-/// Describes role of the host
-typedef enum {
- /// Role undefined or wrong handle
- AVB_ROLE_UNDEFINED = 0,
- /// Host acts as a talker
- AVB_ROLE_TALKER,
- /// Host acts as a listener
- AVB_ROLE_LISTENER
-} avb_role_t;
-
-
-
-/// Supported AVB classes.
-typedef enum {
- /// Stream reservation class A. 8000 packets per second
- SR_CLASS_A,
- /// Stream reservation class B. 4000 packets per second
- SR_CLASS_B,
-// SR_CLASS_C,
-// SR_CLASS_D,
- /// Number of supported stream reservation classes
- MAX_AVB_SR_CLASSES
-} SRClassIdx_t;
-
-/// Regular
-#define SR_RANK_REGULAR 1
-/// Emergency
-#define SR_RANK_EMERGENCY 0
-
-#endif // AVB_TYPES_BASE_PUB_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE : Public AVB Base Types (have no dependencies)
+*/
+
+#ifndef AVB_TYPES_BASE_PUB_H
+#define AVB_TYPES_BASE_PUB_H 1
+
+#include "openavb_types_base_tcal_pub.h"
+#include <stdbool.h>
+#include <inttypes.h>
+
+/** \file
+ * Common Base AVB Types that are exposed outside of the AVB
+ * stack.
+ */
+
+/*
+ * Useful types for OPENAVB AVB
+ *
+ */
+/// Number of nanoseconds in second
+#define NANOSECONDS_PER_SECOND (1000000000ULL)
+/// Number of nanoseconds in milisecond
+#define NANOSECONDS_PER_MSEC (1000000L)
+/// Number of nanoseconds in microsecond
+#define NANOSECONDS_PER_USEC (1000L)
+/// Number of microseconds in second
+#define MICROSECONDS_PER_SECOND (1000000L)
+/// Number of microseconds in milisecond
+#define MICROSECONDS_PER_MSEC (1000L)
+
+#ifndef TRUE // possible confict with gboolean
+/// True boolean value
+#define TRUE true
+/// False boolean value
+#define FALSE false
+#endif
+
+#ifndef NULL
+/// Null pointer value
+#define NULL 0
+#endif
+
+/// Signed 8 bit type
+typedef int8_t S8;
+/// Unsigned 8 bit type
+typedef uint8_t U8;
+/// Signed 16 bit type
+typedef int16_t S16;
+/// Unsigned 16 bit type
+typedef uint16_t U16;
+/// Signed 32 bit type
+typedef int32_t S32;
+/// Unsigned 32 bit type
+typedef uint32_t U32;
+/// Signed 64 bit type
+typedef int64_t S64;
+/// Unsigned 64 bit type
+typedef uint64_t U64;
+
+/// Describes role of the host
+typedef enum {
+ /// Role undefined or wrong handle
+ AVB_ROLE_UNDEFINED = 0,
+ /// Host acts as a talker
+ AVB_ROLE_TALKER,
+ /// Host acts as a listener
+ AVB_ROLE_LISTENER
+} avb_role_t;
+
+
+
+/// Supported AVB classes.
+typedef enum {
+ /// Stream reservation class A. 8000 packets per second
+ SR_CLASS_A,
+ /// Stream reservation class B. 4000 packets per second
+ SR_CLASS_B,
+// SR_CLASS_C,
+// SR_CLASS_D,
+ /// Number of supported stream reservation classes
+ MAX_AVB_SR_CLASSES
+} SRClassIdx_t;
+
+/// Regular
+#define SR_RANK_REGULAR 1
+/// Emergency
+#define SR_RANK_EMERGENCY 0
+
+#endif // AVB_TYPES_BASE_PUB_H
diff --git a/lib/avtp_pipeline/inih/ini.c b/lib/avtp_pipeline/inih/ini.c
index 4fad5c51..0f32fa56 100644
--- a/lib/avtp_pipeline/inih/ini.c
+++ b/lib/avtp_pipeline/inih/ini.c
@@ -1,292 +1,292 @@
-/* inih -- simple .INI file parser
-
-inih is released under the New BSD license (see LICENSE.txt). Go to the project
-home page for more info:
-
-http://code.google.com/p/inih/
-
-*/
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include "ini.h"
-
-#if !INI_USE_STACK
-#include <stdlib.h>
-#endif
-
-#define MAX_SECTION 50
-#define MAX_NAME 50
-
-/* Strip whitespace chars off end of given string, in place. Return s. */
-static char* rstrip(char* s)
-{
- char* p = s + strlen(s);
- while (p > s && isspace(*--p))
- *p = '\0';
- return s;
-}
-
-/* Return pointer to first non-whitespace char in given string. */
-static char* lskip(const char* s)
-{
- while (*s && isspace(*s))
- s++;
- return (char*)s;
-}
-
-/* Return pointer to first char c or ';' comment in given string, or pointer to
- null at end of string if neither found. ';' must be prefixed by a whitespace
- character to register as a comment. */
-static char* find_char_or_comment(const char* s, char c)
-{
- int was_whitespace = 0;
- while (*s && *s != c && !(was_whitespace && *s == ';')) {
- was_whitespace = isspace(*s);
- s++;
- }
- return (char*)s;
-}
-
-/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
-static char* strncpy0(char* dest, const char* src, size_t size)
-{
- strncpy(dest, src, size);
- dest[size - 1] = '\0';
- return dest;
-}
-
-/* See documentation in header file. */
-int ini_parse_file(FILE* file,
- int (*handler)(void*, const char*, const char*,
- const char*),
- void* user)
-{
- /* Uses a fair bit of stack (use heap instead if you need to) */
-#if INI_USE_STACK
- char line[INI_MAX_LINE];
-#else
- char* line;
-#endif
- char section[MAX_SECTION] = "";
- char prev_name[MAX_NAME] = "";
-
- char* start;
- char* end;
- char* name;
- char* value;
- int lineno = 0;
- int error = 0;
-
-#if !INI_USE_STACK
- line = (char*)malloc(INI_MAX_LINE);
- if (!line) {
- return -2;
- }
-#endif
-
- /* Scan through file line by line */
- while (fgets(line, INI_MAX_LINE, file) != NULL) {
- lineno++;
-
- start = line;
-#if INI_ALLOW_BOM
- if (lineno == 1 && (unsigned char)start[0] == 0xEF &&
- (unsigned char)start[1] == 0xBB &&
- (unsigned char)start[2] == 0xBF) {
- start += 3;
- }
-#endif
- start = lskip(rstrip(start));
-
- if (*start == ';' || *start == '#') {
- /* Per Python ConfigParser, allow '#' comments at start of line */
- }
-#if INI_ALLOW_MULTILINE
- else if (*prev_name && *start && start > line) {
- /* Non-black line with leading whitespace, treat as continuation
- of previous name's value (as per Python ConfigParser). */
- if (!handler(user, section, prev_name, start) && !error)
- error = lineno;
- }
-#endif
- else if (*start == '[') {
- /* A "[section]" line */
- end = find_char_or_comment(start + 1, ']');
- if (*end == ']') {
- *end = '\0';
- strncpy0(section, start + 1, sizeof(section));
- *prev_name = '\0';
- }
- else if (!error) {
- /* No ']' found on section line */
- error = lineno;
- }
- }
- else if (*start && *start != ';') {
- /* Not a comment, must be a name[=:]value pair */
- end = find_char_or_comment(start, '=');
- if (*end != '=') {
- end = find_char_or_comment(start, ':');
- }
- if (*end == '=' || *end == ':') {
- *end = '\0';
- name = rstrip(start);
- value = lskip(end + 1);
- end = find_char_or_comment(value, '\0');
- if (*end == ';')
- *end = '\0';
- rstrip(value);
-
- /* Valid name[=:]value pair found, call handler */
- strncpy0(prev_name, name, sizeof(prev_name));
- if (!handler(user, section, name, value) && !error)
- error = lineno;
- }
- else if (!error) {
- /* No '=' or ':' found on name[=:]value line */
- error = lineno;
- }
- }
- }
-
-#if !INI_USE_STACK
- free(line);
-#endif
-
- return error;
-}
-
-#define NULL_CHAR '\0'
-#define COMMA ','
-
-int ini_parse_override(char *override,
- int (*handler)(void*, const char*, const char*,
- const char*),
- void* user)
-{
-#if INI_USE_STACK
- char line[INI_MAX_LINE];
-#else
- char* line;
-#endif
- char section[MAX_SECTION] = "";
- char *name, *value;
-
- char *src = override;
- int error = -1;
- int i, j;
-
-#if !INI_USE_STACK
- line = (char*)malloc(INI_MAX_LINE);
- if (!line) {
- return -2;
- }
-#endif
-
- while (*src != NULL_CHAR)
- {
- if (*src == COMMA) {
- src++;
- }
- else if (*src == '[') {
- // section
- src++; // skip opening delim
- for (i = 0; i < MAX_SECTION; i++) {
- section[i] = *src++;
- if (section[i] == NULL_CHAR) {
- // error, section not completed
- goto out;
- }
- else if (section[i] == ']') {
- section[i] = NULL_CHAR;
- break;
- }
- }
- if (i > MAX_SECTION)
- goto out; // error, overflowed buffer
- }
- else {
- // name/value
- name = &line[0];
- for (i = 0; i < MAX_NAME; i++) {
- line[i] = *src++;
- if (line[i] == NULL_CHAR) {
- // error, name not completed
- goto out;
- }
- else if (line[i] == COMMA) {
- // error, no value
- goto out;
- }
- else if (line[i] == '=') {
- line[i] = NULL_CHAR;
- break;
- }
- }
- if (i > MAX_NAME)
- goto out; // error, overflowed buffer
-
- value = &line[i + 1];
- for (j = i + 1; j < INI_MAX_LINE; j++) {
- line[j] = *src++;
- if (line[j] == ',') {
- line[j] = NULL_CHAR;
- break;
- }
- if (line[j] == NULL_CHAR) {
- src--; // oops!
- break;
- }
-
- }
- if (j > INI_MAX_LINE)
- goto out; // error, overflowed buffer
-
- if (!handler(user, section, name, value) && !error)
- error = -3;
- }
- }
-
- // all parsed!
- error = 0;
-
- out:
-#if !INI_USE_STACK
- free(line);
-#endif
- return error;
-}
-
-/* See documentation in header file. */
-int ini_parse(const char* filename,
- int (*handler)(void*, const char*, const char*, const char*),
- void* user)
-{
- FILE* file;
- int error;
- char *pvtFilename = strdup(filename);
- if (!pvtFilename) {
- return -1;
- }
-
- char *override = strchr(pvtFilename, COMMA);
- if (override)
- *override++ = '\0';
-
- file = fopen(pvtFilename, "r");
- if (!file) {
- free (pvtFilename);
- return -1;
- }
- error = ini_parse_file(file, handler, user);
-
- if (error == 0 && override)
- error = ini_parse_override(override, handler, user);
- fclose(file);
- free (pvtFilename);
-
- return error;
-}
+/* inih -- simple .INI file parser
+
+inih is released under the New BSD license (see LICENSE.txt). Go to the project
+home page for more info:
+
+http://code.google.com/p/inih/
+
+*/
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include "ini.h"
+
+#if !INI_USE_STACK
+#include <stdlib.h>
+#endif
+
+#define MAX_SECTION 50
+#define MAX_NAME 50
+
+/* Strip whitespace chars off end of given string, in place. Return s. */
+static char* rstrip(char* s)
+{
+ char* p = s + strlen(s);
+ while (p > s && isspace(*--p))
+ *p = '\0';
+ return s;
+}
+
+/* Return pointer to first non-whitespace char in given string. */
+static char* lskip(const char* s)
+{
+ while (*s && isspace(*s))
+ s++;
+ return (char*)s;
+}
+
+/* Return pointer to first char c or ';' comment in given string, or pointer to
+ null at end of string if neither found. ';' must be prefixed by a whitespace
+ character to register as a comment. */
+static char* find_char_or_comment(const char* s, char c)
+{
+ int was_whitespace = 0;
+ while (*s && *s != c && !(was_whitespace && *s == ';')) {
+ was_whitespace = isspace(*s);
+ s++;
+ }
+ return (char*)s;
+}
+
+/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
+static char* strncpy0(char* dest, const char* src, size_t size)
+{
+ strncpy(dest, src, size);
+ dest[size - 1] = '\0';
+ return dest;
+}
+
+/* See documentation in header file. */
+int ini_parse_file(FILE* file,
+ int (*handler)(void*, const char*, const char*,
+ const char*),
+ void* user)
+{
+ /* Uses a fair bit of stack (use heap instead if you need to) */
+#if INI_USE_STACK
+ char line[INI_MAX_LINE];
+#else
+ char* line;
+#endif
+ char section[MAX_SECTION] = "";
+ char prev_name[MAX_NAME] = "";
+
+ char* start;
+ char* end;
+ char* name;
+ char* value;
+ int lineno = 0;
+ int error = 0;
+
+#if !INI_USE_STACK
+ line = (char*)malloc(INI_MAX_LINE);
+ if (!line) {
+ return -2;
+ }
+#endif
+
+ /* Scan through file line by line */
+ while (fgets(line, INI_MAX_LINE, file) != NULL) {
+ lineno++;
+
+ start = line;
+#if INI_ALLOW_BOM
+ if (lineno == 1 && (unsigned char)start[0] == 0xEF &&
+ (unsigned char)start[1] == 0xBB &&
+ (unsigned char)start[2] == 0xBF) {
+ start += 3;
+ }
+#endif
+ start = lskip(rstrip(start));
+
+ if (*start == ';' || *start == '#') {
+ /* Per Python ConfigParser, allow '#' comments at start of line */
+ }
+#if INI_ALLOW_MULTILINE
+ else if (*prev_name && *start && start > line) {
+ /* Non-black line with leading whitespace, treat as continuation
+ of previous name's value (as per Python ConfigParser). */
+ if (!handler(user, section, prev_name, start) && !error)
+ error = lineno;
+ }
+#endif
+ else if (*start == '[') {
+ /* A "[section]" line */
+ end = find_char_or_comment(start + 1, ']');
+ if (*end == ']') {
+ *end = '\0';
+ strncpy0(section, start + 1, sizeof(section));
+ *prev_name = '\0';
+ }
+ else if (!error) {
+ /* No ']' found on section line */
+ error = lineno;
+ }
+ }
+ else if (*start && *start != ';') {
+ /* Not a comment, must be a name[=:]value pair */
+ end = find_char_or_comment(start, '=');
+ if (*end != '=') {
+ end = find_char_or_comment(start, ':');
+ }
+ if (*end == '=' || *end == ':') {
+ *end = '\0';
+ name = rstrip(start);
+ value = lskip(end + 1);
+ end = find_char_or_comment(value, '\0');
+ if (*end == ';')
+ *end = '\0';
+ rstrip(value);
+
+ /* Valid name[=:]value pair found, call handler */
+ strncpy0(prev_name, name, sizeof(prev_name));
+ if (!handler(user, section, name, value) && !error)
+ error = lineno;
+ }
+ else if (!error) {
+ /* No '=' or ':' found on name[=:]value line */
+ error = lineno;
+ }
+ }
+ }
+
+#if !INI_USE_STACK
+ free(line);
+#endif
+
+ return error;
+}
+
+#define NULL_CHAR '\0'
+#define COMMA ','
+
+int ini_parse_override(char *override,
+ int (*handler)(void*, const char*, const char*,
+ const char*),
+ void* user)
+{
+#if INI_USE_STACK
+ char line[INI_MAX_LINE];
+#else
+ char* line;
+#endif
+ char section[MAX_SECTION] = "";
+ char *name, *value;
+
+ char *src = override;
+ int error = -1;
+ int i, j;
+
+#if !INI_USE_STACK
+ line = (char*)malloc(INI_MAX_LINE);
+ if (!line) {
+ return -2;
+ }
+#endif
+
+ while (*src != NULL_CHAR)
+ {
+ if (*src == COMMA) {
+ src++;
+ }
+ else if (*src == '[') {
+ // section
+ src++; // skip opening delim
+ for (i = 0; i < MAX_SECTION; i++) {
+ section[i] = *src++;
+ if (section[i] == NULL_CHAR) {
+ // error, section not completed
+ goto out;
+ }
+ else if (section[i] == ']') {
+ section[i] = NULL_CHAR;
+ break;
+ }
+ }
+ if (i > MAX_SECTION)
+ goto out; // error, overflowed buffer
+ }
+ else {
+ // name/value
+ name = &line[0];
+ for (i = 0; i < MAX_NAME; i++) {
+ line[i] = *src++;
+ if (line[i] == NULL_CHAR) {
+ // error, name not completed
+ goto out;
+ }
+ else if (line[i] == COMMA) {
+ // error, no value
+ goto out;
+ }
+ else if (line[i] == '=') {
+ line[i] = NULL_CHAR;
+ break;
+ }
+ }
+ if (i > MAX_NAME)
+ goto out; // error, overflowed buffer
+
+ value = &line[i + 1];
+ for (j = i + 1; j < INI_MAX_LINE; j++) {
+ line[j] = *src++;
+ if (line[j] == ',') {
+ line[j] = NULL_CHAR;
+ break;
+ }
+ if (line[j] == NULL_CHAR) {
+ src--; // oops!
+ break;
+ }
+
+ }
+ if (j > INI_MAX_LINE)
+ goto out; // error, overflowed buffer
+
+ if (!handler(user, section, name, value) && !error)
+ error = -3;
+ }
+ }
+
+ // all parsed!
+ error = 0;
+
+ out:
+#if !INI_USE_STACK
+ free(line);
+#endif
+ return error;
+}
+
+/* See documentation in header file. */
+int ini_parse(const char* filename,
+ int (*handler)(void*, const char*, const char*, const char*),
+ void* user)
+{
+ FILE* file;
+ int error;
+ char *pvtFilename = strdup(filename);
+ if (!pvtFilename) {
+ return -1;
+ }
+
+ char *override = strchr(pvtFilename, COMMA);
+ if (override)
+ *override++ = '\0';
+
+ file = fopen(pvtFilename, "r");
+ if (!file) {
+ free (pvtFilename);
+ return -1;
+ }
+ error = ini_parse_file(file, handler, user);
+
+ if (error == 0 && override)
+ error = ini_parse_override(override, handler, user);
+ fclose(file);
+ free (pvtFilename);
+
+ return error;
+}
diff --git a/lib/avtp_pipeline/inih/ini.h b/lib/avtp_pipeline/inih/ini.h
index 9ebfd492..984d52b7 100644
--- a/lib/avtp_pipeline/inih/ini.h
+++ b/lib/avtp_pipeline/inih/ini.h
@@ -1,72 +1,72 @@
-/* inih -- simple .INI file parser
-
-inih is released under the New BSD license (see LICENSE.txt). Go to the project
-home page for more info:
-
-http://code.google.com/p/inih/
-
-*/
-
-#ifndef __INI_H__
-#define __INI_H__
-
-/* Make this header file easier to include in C++ code */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-
-/* Parse given INI-style file. May have [section]s, name=value pairs
- (whitespace stripped), and comments starting with ';' (semicolon). Section
- is "" if name=value pair parsed before any section heading. name:value
- pairs are also supported as a concession to Python's ConfigParser.
-
- For each name=value pair parsed, call handler function with given user
- pointer as well as section, name, and value (data only valid for duration
- of handler call). Handler should return nonzero on success, zero on error.
-
- Returns 0 on success, line number of first error on parse error (doesn't
- stop on first error), -1 on file open error, or -2 on memory allocation
- error (only when INI_USE_STACK is zero).
-*/
-int ini_parse(const char* filename,
- int (*handler)(void* user, const char* section,
- const char* name, const char* value),
- void* user);
-
-/* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't
- close the file when it's finished -- the caller must do that. */
-int ini_parse_file(FILE* file,
- int (*handler)(void* user, const char* section,
- const char* name, const char* value),
- void* user);
-
-/* Nonzero to allow multi-line value parsing, in the style of Python's
- ConfigParser. If allowed, ini_parse() will call the handler with the same
- name for each subsequent line parsed. */
-#ifndef INI_ALLOW_MULTILINE
-#define INI_ALLOW_MULTILINE 1
-#endif
-
-/* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of
- the file. See http://code.google.com/p/inih/issues/detail?id=21 */
-#ifndef INI_ALLOW_BOM
-#define INI_ALLOW_BOM 1
-#endif
-
-/* Nonzero to use stack, zero to use heap (malloc/free). */
-#ifndef INI_USE_STACK
-#define INI_USE_STACK 1
-#endif
-
-/* Maximum line length for any line in INI file. */
-#ifndef INI_MAX_LINE
-#define INI_MAX_LINE 512
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __INI_H__ */
+/* inih -- simple .INI file parser
+
+inih is released under the New BSD license (see LICENSE.txt). Go to the project
+home page for more info:
+
+http://code.google.com/p/inih/
+
+*/
+
+#ifndef __INI_H__
+#define __INI_H__
+
+/* Make this header file easier to include in C++ code */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+/* Parse given INI-style file. May have [section]s, name=value pairs
+ (whitespace stripped), and comments starting with ';' (semicolon). Section
+ is "" if name=value pair parsed before any section heading. name:value
+ pairs are also supported as a concession to Python's ConfigParser.
+
+ For each name=value pair parsed, call handler function with given user
+ pointer as well as section, name, and value (data only valid for duration
+ of handler call). Handler should return nonzero on success, zero on error.
+
+ Returns 0 on success, line number of first error on parse error (doesn't
+ stop on first error), -1 on file open error, or -2 on memory allocation
+ error (only when INI_USE_STACK is zero).
+*/
+int ini_parse(const char* filename,
+ int (*handler)(void* user, const char* section,
+ const char* name, const char* value),
+ void* user);
+
+/* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't
+ close the file when it's finished -- the caller must do that. */
+int ini_parse_file(FILE* file,
+ int (*handler)(void* user, const char* section,
+ const char* name, const char* value),
+ void* user);
+
+/* Nonzero to allow multi-line value parsing, in the style of Python's
+ ConfigParser. If allowed, ini_parse() will call the handler with the same
+ name for each subsequent line parsed. */
+#ifndef INI_ALLOW_MULTILINE
+#define INI_ALLOW_MULTILINE 1
+#endif
+
+/* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of
+ the file. See http://code.google.com/p/inih/issues/detail?id=21 */
+#ifndef INI_ALLOW_BOM
+#define INI_ALLOW_BOM 1
+#endif
+
+/* Nonzero to use stack, zero to use heap (malloc/free). */
+#ifndef INI_USE_STACK
+#define INI_USE_STACK 1
+#endif
+
+/* Maximum line length for any line in INI file. */
+#ifndef INI_MAX_LINE
+#define INI_MAX_LINE 512
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INI_H__ */
diff --git a/lib/avtp_pipeline/intf_logger/openavb_intf_logger.c b/lib/avtp_pipeline/intf_logger/openavb_intf_logger.c
index 38adaecc..91417d0c 100644
--- a/lib/avtp_pipeline/intf_logger/openavb_intf_logger.c
+++ b/lib/avtp_pipeline/intf_logger/openavb_intf_logger.c
@@ -1,201 +1,201 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* Usage Notes: It is expected that there will be at most only 1 logger
-* interface module running.
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include "openavb_types_pub.h"
-#include "openavb_trace_pub.h"
-#include "openavb_mediaq_pub.h"
-#include "openavb_intf_pub.h"
-
-#define AVB_LOG_COMPONENT "Logger Interface"
-#include "openavb_log_pub.h"
-
-typedef struct {
- /////////////
- // Config data
- /////////////
- // Ignore timestamp at listener.
- bool ignoreTimestamp;
-
- /////////////
- // Variable data
- /////////////
-} pvt_data_t;
-
-
-// Each configuration name value pair for this mapping will result in this callback being called.
-void openavbIntfLoggerCfgCB(media_q_t *pMediaQ, const char *name, const char *value)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- if (pMediaQ) {
- //char *pEnd;
- //long tmp;
-
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-void openavbIntfLoggerGenInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// A call to this callback indicates that this interface module will be
-// a talker. Any talker initialization can be done in this function.
-void openavbIntfLoggerTxInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// This callback will be called for each AVB transmit interval. Commonly this will be
-// 4000 or 8000 times per second.
-bool openavbIntfLoggerTxCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
- if (pMediaQ) {
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return FALSE;
- }
-
- media_q_item_t *pMediaQItem = openavbMediaQHeadLock(pMediaQ);
- if (pMediaQItem) {
- U32 dataLen = avbLogGetMsg(pMediaQItem->pPubData, pMediaQItem->itemSize);
- if (dataLen) {
- pMediaQItem->dataLen = dataLen;
- openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
- openavbMediaQHeadPush(pMediaQ);
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return TRUE;
- }
- else {
- openavbMediaQHeadUnlock(pMediaQ);
- }
- }
- else {
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE; // Media queue full
- }
- }
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE;
-}
-
-// A call to this callback indicates that this interface module will be
-// a listener. Any listener initialization can be done in this function.
-void openavbIntfLoggerRxInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// This callback is called when acting as a listener.
-bool openavbIntfLoggerRxCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE;
-}
-
-// This callback will be called when the stream is closing.
-void openavbIntfLoggerEndCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// General shutdown callback regardless if a talker or listener. Called once during openavbTLClose()
-void openavbIntfLoggerGenEndCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- if (pMediaQ) {
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
- }
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// Main initialization entry point into the interface module
-extern bool DLL_EXPORT openavbIntfLoggerInitialize(media_q_t *pMediaQ, openavb_intf_cb_t *pIntfCB)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
- pMediaQ->pPvtIntfInfo = calloc(1, sizeof(pvt_data_t)); // Memory freed by the media queue when the media queue is destroyed.
-
- if (!pMediaQ->pPvtIntfInfo) {
- AVB_LOG_ERROR("Unable to allocate memory for AVTP interface module.");
- return FALSE;
- }
-
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
-
- pIntfCB->intf_cfg_cb = openavbIntfLoggerCfgCB;
- pIntfCB->intf_gen_init_cb = openavbIntfLoggerGenInitCB;
- pIntfCB->intf_tx_init_cb = openavbIntfLoggerTxInitCB;
- pIntfCB->intf_tx_cb = openavbIntfLoggerTxCB;
- pIntfCB->intf_rx_init_cb = openavbIntfLoggerRxInitCB;
- pIntfCB->intf_rx_cb = openavbIntfLoggerRxCB;
- pIntfCB->intf_end_cb = openavbIntfLoggerEndCB;
- pIntfCB->intf_gen_end_cb = openavbIntfLoggerGenEndCB;
-
- pPvtData->ignoreTimestamp = FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
- return TRUE;
-}
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* Usage Notes: It is expected that there will be at most only 1 logger
+* interface module running.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include "openavb_types_pub.h"
+#include "openavb_trace_pub.h"
+#include "openavb_mediaq_pub.h"
+#include "openavb_intf_pub.h"
+
+#define AVB_LOG_COMPONENT "Logger Interface"
+#include "openavb_log_pub.h"
+
+typedef struct {
+ /////////////
+ // Config data
+ /////////////
+ // Ignore timestamp at listener.
+ bool ignoreTimestamp;
+
+ /////////////
+ // Variable data
+ /////////////
+} pvt_data_t;
+
+
+// Each configuration name value pair for this mapping will result in this callback being called.
+void openavbIntfLoggerCfgCB(media_q_t *pMediaQ, const char *name, const char *value)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ if (pMediaQ) {
+ //char *pEnd;
+ //long tmp;
+
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+void openavbIntfLoggerGenInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// A call to this callback indicates that this interface module will be
+// a talker. Any talker initialization can be done in this function.
+void openavbIntfLoggerTxInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// This callback will be called for each AVB transmit interval. Commonly this will be
+// 4000 or 8000 times per second.
+bool openavbIntfLoggerTxCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return FALSE;
+ }
+
+ media_q_item_t *pMediaQItem = openavbMediaQHeadLock(pMediaQ);
+ if (pMediaQItem) {
+ U32 dataLen = avbLogGetMsg(pMediaQItem->pPubData, pMediaQItem->itemSize);
+ if (dataLen) {
+ pMediaQItem->dataLen = dataLen;
+ openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
+ openavbMediaQHeadPush(pMediaQ);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return TRUE;
+ }
+ else {
+ openavbMediaQHeadUnlock(pMediaQ);
+ }
+ }
+ else {
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE; // Media queue full
+ }
+ }
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE;
+}
+
+// A call to this callback indicates that this interface module will be
+// a listener. Any listener initialization can be done in this function.
+void openavbIntfLoggerRxInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// This callback is called when acting as a listener.
+bool openavbIntfLoggerRxCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE;
+}
+
+// This callback will be called when the stream is closing.
+void openavbIntfLoggerEndCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// General shutdown callback regardless if a talker or listener. Called once during openavbTLClose()
+void openavbIntfLoggerGenEndCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+ }
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// Main initialization entry point into the interface module
+extern bool DLL_EXPORT openavbIntfLoggerInitialize(media_q_t *pMediaQ, openavb_intf_cb_t *pIntfCB)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+ pMediaQ->pPvtIntfInfo = calloc(1, sizeof(pvt_data_t)); // Memory freed by the media queue when the media queue is destroyed.
+
+ if (!pMediaQ->pPvtIntfInfo) {
+ AVB_LOG_ERROR("Unable to allocate memory for AVTP interface module.");
+ return FALSE;
+ }
+
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+
+ pIntfCB->intf_cfg_cb = openavbIntfLoggerCfgCB;
+ pIntfCB->intf_gen_init_cb = openavbIntfLoggerGenInitCB;
+ pIntfCB->intf_tx_init_cb = openavbIntfLoggerTxInitCB;
+ pIntfCB->intf_tx_cb = openavbIntfLoggerTxCB;
+ pIntfCB->intf_rx_init_cb = openavbIntfLoggerRxInitCB;
+ pIntfCB->intf_rx_cb = openavbIntfLoggerRxCB;
+ pIntfCB->intf_end_cb = openavbIntfLoggerEndCB;
+ pIntfCB->intf_gen_end_cb = openavbIntfLoggerGenEndCB;
+
+ pPvtData->ignoreTimestamp = FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+ return TRUE;
+}
diff --git a/lib/avtp_pipeline/intf_tonegen/openavb_intf_tonegen.c b/lib/avtp_pipeline/intf_tonegen/openavb_intf_tonegen.c
index d9b214a8..b2a1bf23 100644
--- a/lib/avtp_pipeline/intf_tonegen/openavb_intf_tonegen.c
+++ b/lib/avtp_pipeline/intf_tonegen/openavb_intf_tonegen.c
@@ -1,524 +1,524 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : Tone generator interface module. Talker only.
-*
-* - This interface module generates and audio tone for use with -6 and AAF mappings
-* - Requires an OSAL sin implementation of reasonable performance.
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "openavb_platform_pub.h"
-#include "openavb_osal_pub.h"
-#include "openavb_types_pub.h"
-#include "openavb_trace_pub.h"
-#include "openavb_mediaq_pub.h"
-#include "openavb_map_uncmp_audio_pub.h"
-#include "openavb_map_aaf_audio_pub.h"
-#include "openavb_intf_pub.h"
-
-#define AVB_LOG_COMPONENT "Tone Gen Interface"
-#include "openavb_log_pub.h"
-
-#define PI 3.14159265358979f
-
-typedef struct {
- /////////////
- // Config data
- /////////////
- // intf_nv_tone_hz: The tone hz to generate
- U32 toneHz;
-
- // intf_nv_on_off_interval_msec: Interval for turning tone on and off. A value of zero will keep the tone on.
- U32 onOffIntervalMSec;
-
- // Simple melody
- char *pMelodyString;
-
- // intf_nv_audio_rate
- avb_audio_rate_t audioRate;
-
- // intf_nv_audio_type
- avb_audio_bit_depth_t audioType;
-
- // intf_nv_audio_bit_depth
- avb_audio_bit_depth_t audioBitDepth;
-
- // intf_nv_audio_endian
- avb_audio_bit_depth_t audioEndian;
-
- // intf_nv_channels
- avb_audio_channels_t audioChannels;
-
- /////////////
- // Variable data
- /////////////
-
- // Packing interval
- U32 intervalCounter;
-
- // Keeps track of if the tone is currently on or off
- U32 freq;
-
- // Keeps track of how long before toggling the tone on / off
- U32 freqCountdown;
-
- // Ratio precalc
- float ratio;
-
- // Index to into the melody string
- U32 melodyIdx;
-
- // Length of the melody string
- U32 melodyLen;
-
-} pvt_data_t;
-
-#define MSEC_PER_COUNT 250
-static void xGetMelodyToneAndDuration(char note, char count, U32 *freq, U32 *sampleMSec)
-{
- switch (note) {
- case 'A':
- *freq = 220;
- break;
- case 'B':
- *freq = 246;
- break;
- case 'C':
- *freq = 261;
- break;
- case 'D':
- *freq = 293;
- break;
- case 'E':
- *freq = 329;
- break;
- case 'F':
- *freq = 349;
- break;
- case 'G':
- *freq = 391;
- break;
- case 'a':
- *freq = 440;
- break;
- case 'b':
- *freq = 493;
- break;
- case 'c':
- *freq = 523;
- break;
- case 'd':
- *freq = 587;
- break;
- case 'e':
- *freq = 659;
- break;
- case 'f':
- *freq = 698;
- break;
- case 'g':
- *freq = 783;
- break;
- case '-':
- default:
- *freq = 0;
- break;
- }
-
- switch (count) {
- case '1':
- *sampleMSec = MSEC_PER_COUNT * 1;
- break;
- case '2':
- *sampleMSec = MSEC_PER_COUNT * 2;
- break;
- case '3':
- *sampleMSec = MSEC_PER_COUNT * 3;
- break;
- case '4':
- *sampleMSec = MSEC_PER_COUNT * 4;
- break;
- default:
- *sampleMSec = MSEC_PER_COUNT * 4;
- break;
- }
-}
-
-static bool xSupportedMappingFormat(media_q_t *pMediaQ)
-{
- if (pMediaQ) {
- if (pMediaQ->pMediaQDataFormat) {
- if (strcmp(pMediaQ->pMediaQDataFormat, MapUncmpAudioMediaQDataFormat) == 0 || strcmp(pMediaQ->pMediaQDataFormat, MapAVTPAudioMediaQDataFormat) == 0) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-// Each configuration name value pair for this mapping will result in this callback being called.
-void openavbIntfToneGenCfgCB(media_q_t *pMediaQ, const char *name, const char *value)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- char *pEnd;
- U32 val;
-
- if (pMediaQ) {
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
-
- media_q_pub_map_uncmp_audio_info_t *pPubMapUncmpAudioInfo;
- pPubMapUncmpAudioInfo = (media_q_pub_map_uncmp_audio_info_t *)pMediaQ->pPubMapInfo;
- if (!pPubMapUncmpAudioInfo) {
- AVB_LOG_ERROR("Public map data for audio info not allocated.");
- return;
- }
-
- if (strcmp(name, "intf_nv_tone_hz") == 0) {
- pPvtData->toneHz = strtol(value, &pEnd, 10);
- }
-
- else if (strcmp(name, "intf_nv_on_off_interval_msec") == 0) {
- pPvtData->onOffIntervalMSec = strtol(value, &pEnd, 10);
- }
-
- else if (strcmp(name, "intf_nv_melody_string") == 0) {
- if (pPvtData->pMelodyString)
- free(pPvtData->pMelodyString);
- pPvtData->pMelodyString = strdup(value);
- if (pPvtData->pMelodyString) {
- pPvtData->melodyLen = strlen(pPvtData->pMelodyString);
- }
- }
-
- else if (strcmp(name, "intf_nv_audio_rate") == 0) {
- val = strtol(value, &pEnd, 10);
- // TODO: Should check for specific values
- if (val >= AVB_AUDIO_RATE_8KHZ && val <= AVB_AUDIO_RATE_192KHZ) {
- pPvtData->audioRate = (avb_audio_rate_t)val;
- }
- else {
- AVB_LOG_ERROR("Invalid audio rate configured for intf_nv_audio_rate.");
- pPvtData->audioRate = AVB_AUDIO_RATE_44_1KHZ;
- }
-
- // Give the audio parameters to the mapping module.
- if (xSupportedMappingFormat(pMediaQ)) {
- pPubMapUncmpAudioInfo->audioRate = pPvtData->audioRate;
- }
- }
-
- else if (strcmp(name, "intf_nv_audio_bit_depth") == 0) {
- val = strtol(value, &pEnd, 10);
- // TODO: Should check for specific values
- if (val >= AVB_AUDIO_BIT_DEPTH_1BIT && val <= AVB_AUDIO_BIT_DEPTH_64BIT) {
- pPvtData->audioBitDepth = (avb_audio_bit_depth_t)val;
- }
- else {
- AVB_LOG_ERROR("Invalid audio type configured for intf_nv_audio_bits.");
- pPvtData->audioBitDepth = AVB_AUDIO_BIT_DEPTH_24BIT;
- }
-
- // Give the audio parameters to the mapping module.
- if (xSupportedMappingFormat(pMediaQ)) {
- pPubMapUncmpAudioInfo->audioBitDepth = pPvtData->audioBitDepth;
- }
- }
-
- else if (strcmp(name, "intf_nv_audio_type") == 0) {
- if (strncasecmp(value, "float", 5) == 0)
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_FLOAT;
- else if (strncasecmp(value, "sign", 4) == 0 || strncasecmp(value, "int", 4) == 0)
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_INT;
- else if (strncasecmp(value, "unsign", 6) == 0 || strncasecmp(value, "uint", 4) == 0)
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_UINT;
- else {
- AVB_LOG_ERROR("Invalid audio type configured for intf_nv_audio_type.");
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_UNSPEC;
- }
-
- // Give the audio parameters to the mapping module.
- if (xSupportedMappingFormat(pMediaQ)) {
- pPubMapUncmpAudioInfo->audioType = (avb_audio_type_t)pPvtData->audioType;
- }
- }
-
- else if (strcmp(name, "intf_nv_audio_endian") == 0) {
- if (strncasecmp(value, "big", 3) == 0)
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_ENDIAN_BIG;
- else if (strncasecmp(value, "little", 6) == 0)
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_ENDIAN_LITTLE;
- else {
- AVB_LOG_ERROR("Invalid audio type configured for intf_nv_audio_endian.");
- pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_ENDIAN_UNSPEC;
- }
-
- // Give the audio parameters to the mapping module.
- if (xSupportedMappingFormat(pMediaQ)) {
- pPubMapUncmpAudioInfo->audioEndian = (avb_audio_endian_t)pPvtData->audioEndian;
- }
- }
-
- else if (strcmp(name, "intf_nv_audio_channels") == 0) {
- val = strtol(value, &pEnd, 10);
- // TODO: Should check for specific values
- if (val >= AVB_AUDIO_CHANNELS_1 && val <= AVB_AUDIO_CHANNELS_8) {
- pPvtData->audioChannels = (avb_audio_channels_t)val;
- }
- else {
- AVB_LOG_ERROR("Invalid audio channels configured for intf_nv_audio_channels.");
- pPvtData->audioChannels = (avb_audio_channels_t)AVB_AUDIO_CHANNELS_2;
- }
-
- // Give the audio parameters to the mapping module.
- if (xSupportedMappingFormat(pMediaQ)) {
- pPubMapUncmpAudioInfo->audioChannels = pPvtData->audioChannels;
- }
- }
-
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-void openavbIntfToneGenGenInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// A call to this callback indicates that this interface module will be
-// a talker. Any talker initialization can be done in this function.
-void openavbIntfToneGenTxInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
-
- // U8 b;
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
-
- media_q_pub_map_uncmp_audio_info_t *pPubMapUncmpAudioInfo;
- pPubMapUncmpAudioInfo = (media_q_pub_map_uncmp_audio_info_t *)pMediaQ->pPubMapInfo;
- if (!pPubMapUncmpAudioInfo) {
- AVB_LOG_ERROR("Public map data for audio info not allocated.");
- return;
- }
-
- // Will get toggle on at the first tx cb
- if (pPvtData->onOffIntervalMSec > 0) {
- pPvtData->freq = pPvtData->toneHz;
- pPvtData->freqCountdown = 0;
- }
- else {
- pPvtData->freq = 0;
- pPvtData->freqCountdown = 0;
- }
-
- pPvtData->melodyIdx = 0;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// This callback will be called for each AVB transmit interval. Commonly this will be
-// 4000 or 8000 times per second.
-bool openavbIntfToneGenTxCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
-
- if (pMediaQ) {
- media_q_pub_map_uncmp_audio_info_t *pPubMapUncmpAudioInfo = pMediaQ->pPubMapInfo;
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return FALSE;
- }
-
- if (pPvtData->intervalCounter++ % pPubMapUncmpAudioInfo->packingFactor != 0)
- return TRUE;
-
- media_q_item_t *pMediaQItem = openavbMediaQHeadLock(pMediaQ);
- if (pMediaQItem) {
- if (pMediaQItem->itemSize < pPubMapUncmpAudioInfo->itemSize) {
- AVB_LOG_ERROR("Media queue item not large enough for samples");
- }
-
- // Tone on
- static U32 runningFrameCnt = 0;
- U32 frameCnt;
- U32 channelCnt;
- U32 idx = 0;
- for (frameCnt = 0; frameCnt < pPubMapUncmpAudioInfo->framesPerItem; frameCnt++) {
-
- // Check for tone on / off toggle
- if (!pPvtData->freqCountdown) {
- if (pPvtData->pMelodyString) {
- // Melody logic
- U32 intervalMSec;
- xGetMelodyToneAndDuration(
- pPvtData->pMelodyString[pPvtData->melodyIdx],
- pPvtData->pMelodyString[pPvtData->melodyIdx + 1],
- &pPvtData->freq, &intervalMSec);
- pPvtData->melodyIdx += 2;
-
- pPvtData->freqCountdown = (pPubMapUncmpAudioInfo->audioRate / 1000) * intervalMSec;
- if (pPvtData->melodyIdx >= pPvtData->melodyLen)
- pPvtData->melodyIdx = 0;
- }
- else {
- // Fixed tone
- if (pPvtData->onOffIntervalMSec > 0) {
- if (pPvtData->freq == 0)
- pPvtData->freq = pPvtData->toneHz;
- else
- pPvtData->freq = 0;
- pPvtData->freqCountdown = (pPubMapUncmpAudioInfo->audioRate / 1000) * pPvtData->onOffIntervalMSec;
- }
- else {
- pPvtData->freqCountdown = pPubMapUncmpAudioInfo->audioRate; // Just run steady for 1 sec
- }
- }
- pPvtData->ratio = pPvtData->freq / (float)pPubMapUncmpAudioInfo->audioRate;
- }
- pPvtData->freqCountdown--;
-
-
- float value = SIN(2 * PI * (runningFrameCnt++ % pPubMapUncmpAudioInfo->audioRate) * pPvtData->ratio);
-
- if (pPubMapUncmpAudioInfo->itemSampleSizeBytes == 2) {
- // 16 bit audio
- S16 sample = (S16)(value * 15000);
- for (channelCnt = 0; channelCnt < pPubMapUncmpAudioInfo->audioChannels; channelCnt++) {
- unsigned char c;
- U8 *pData = pMediaQItem->pPubData;
- c = (unsigned)sample % 256;
- pData[idx++] = c;
- c = (unsigned)sample / 256 % 256;
- pData[idx++] = c;
- }
- }
- else {
- // CORE_TODO
- AVB_LOG_ERROR("Audio sample size format not implemented yet for tone generator interface module");
- }
- }
-
- pMediaQItem->dataLen = pPubMapUncmpAudioInfo->itemSize;
-
- openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
- openavbMediaQHeadPush(pMediaQ);
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return TRUE;
- }
- else {
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE; // Media queue full
- }
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE;
-}
-
-// A call to this callback indicates that this interface module will be
-// a listener. Any listener initialization can be done in this function.
-void openavbIntfToneGenRxInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// This callback is called when acting as a listener.
-bool openavbIntfToneGenRxCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE;
-}
-
-// This callback will be called when the interface needs to be closed. All shutdown should
-// occur in this function.
-void openavbIntfToneGenEndCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-void openavbIntfToneGenGenEndCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// Main initialization entry point into the interface module
-extern DLL_EXPORT bool openavbIntfToneGenInitialize(media_q_t *pMediaQ, openavb_intf_cb_t *pIntfCB)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
- pMediaQ->pPvtIntfInfo = calloc(1, sizeof(pvt_data_t)); // Memory freed by the media queue when the media queue is destroyed.
-
- if (!pMediaQ->pPvtIntfInfo) {
- AVB_LOG_ERROR("Unable to allocate memory for AVTP interface module.");
- return FALSE;
- }
-
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
-
- pIntfCB->intf_cfg_cb = openavbIntfToneGenCfgCB;
- pIntfCB->intf_gen_init_cb = openavbIntfToneGenGenInitCB;
- pIntfCB->intf_tx_init_cb = openavbIntfToneGenTxInitCB;
- pIntfCB->intf_tx_cb = openavbIntfToneGenTxCB;
- pIntfCB->intf_rx_init_cb = openavbIntfToneGenRxInitCB;
- pIntfCB->intf_rx_cb = openavbIntfToneGenRxCB;
- pIntfCB->intf_end_cb = openavbIntfToneGenEndCB;
- pIntfCB->intf_gen_end_cb = openavbIntfToneGenGenEndCB;
-
- pPvtData->intervalCounter = 0;
- pPvtData->melodyIdx = 0;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
- return TRUE;
-}
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : Tone generator interface module. Talker only.
+*
+* - This interface module generates and audio tone for use with -6 and AAF mappings
+* - Requires an OSAL sin implementation of reasonable performance.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "openavb_platform_pub.h"
+#include "openavb_osal_pub.h"
+#include "openavb_types_pub.h"
+#include "openavb_trace_pub.h"
+#include "openavb_mediaq_pub.h"
+#include "openavb_map_uncmp_audio_pub.h"
+#include "openavb_map_aaf_audio_pub.h"
+#include "openavb_intf_pub.h"
+
+#define AVB_LOG_COMPONENT "Tone Gen Interface"
+#include "openavb_log_pub.h"
+
+#define PI 3.14159265358979f
+
+typedef struct {
+ /////////////
+ // Config data
+ /////////////
+ // intf_nv_tone_hz: The tone hz to generate
+ U32 toneHz;
+
+ // intf_nv_on_off_interval_msec: Interval for turning tone on and off. A value of zero will keep the tone on.
+ U32 onOffIntervalMSec;
+
+ // Simple melody
+ char *pMelodyString;
+
+ // intf_nv_audio_rate
+ avb_audio_rate_t audioRate;
+
+ // intf_nv_audio_type
+ avb_audio_bit_depth_t audioType;
+
+ // intf_nv_audio_bit_depth
+ avb_audio_bit_depth_t audioBitDepth;
+
+ // intf_nv_audio_endian
+ avb_audio_bit_depth_t audioEndian;
+
+ // intf_nv_channels
+ avb_audio_channels_t audioChannels;
+
+ /////////////
+ // Variable data
+ /////////////
+
+ // Packing interval
+ U32 intervalCounter;
+
+ // Keeps track of if the tone is currently on or off
+ U32 freq;
+
+ // Keeps track of how long before toggling the tone on / off
+ U32 freqCountdown;
+
+ // Ratio precalc
+ float ratio;
+
+ // Index to into the melody string
+ U32 melodyIdx;
+
+ // Length of the melody string
+ U32 melodyLen;
+
+} pvt_data_t;
+
+#define MSEC_PER_COUNT 250
+static void xGetMelodyToneAndDuration(char note, char count, U32 *freq, U32 *sampleMSec)
+{
+ switch (note) {
+ case 'A':
+ *freq = 220;
+ break;
+ case 'B':
+ *freq = 246;
+ break;
+ case 'C':
+ *freq = 261;
+ break;
+ case 'D':
+ *freq = 293;
+ break;
+ case 'E':
+ *freq = 329;
+ break;
+ case 'F':
+ *freq = 349;
+ break;
+ case 'G':
+ *freq = 391;
+ break;
+ case 'a':
+ *freq = 440;
+ break;
+ case 'b':
+ *freq = 493;
+ break;
+ case 'c':
+ *freq = 523;
+ break;
+ case 'd':
+ *freq = 587;
+ break;
+ case 'e':
+ *freq = 659;
+ break;
+ case 'f':
+ *freq = 698;
+ break;
+ case 'g':
+ *freq = 783;
+ break;
+ case '-':
+ default:
+ *freq = 0;
+ break;
+ }
+
+ switch (count) {
+ case '1':
+ *sampleMSec = MSEC_PER_COUNT * 1;
+ break;
+ case '2':
+ *sampleMSec = MSEC_PER_COUNT * 2;
+ break;
+ case '3':
+ *sampleMSec = MSEC_PER_COUNT * 3;
+ break;
+ case '4':
+ *sampleMSec = MSEC_PER_COUNT * 4;
+ break;
+ default:
+ *sampleMSec = MSEC_PER_COUNT * 4;
+ break;
+ }
+}
+
+static bool xSupportedMappingFormat(media_q_t *pMediaQ)
+{
+ if (pMediaQ) {
+ if (pMediaQ->pMediaQDataFormat) {
+ if (strcmp(pMediaQ->pMediaQDataFormat, MapUncmpAudioMediaQDataFormat) == 0 || strcmp(pMediaQ->pMediaQDataFormat, MapAVTPAudioMediaQDataFormat) == 0) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+// Each configuration name value pair for this mapping will result in this callback being called.
+void openavbIntfToneGenCfgCB(media_q_t *pMediaQ, const char *name, const char *value)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ char *pEnd;
+ U32 val;
+
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+
+ media_q_pub_map_uncmp_audio_info_t *pPubMapUncmpAudioInfo;
+ pPubMapUncmpAudioInfo = (media_q_pub_map_uncmp_audio_info_t *)pMediaQ->pPubMapInfo;
+ if (!pPubMapUncmpAudioInfo) {
+ AVB_LOG_ERROR("Public map data for audio info not allocated.");
+ return;
+ }
+
+ if (strcmp(name, "intf_nv_tone_hz") == 0) {
+ pPvtData->toneHz = strtol(value, &pEnd, 10);
+ }
+
+ else if (strcmp(name, "intf_nv_on_off_interval_msec") == 0) {
+ pPvtData->onOffIntervalMSec = strtol(value, &pEnd, 10);
+ }
+
+ else if (strcmp(name, "intf_nv_melody_string") == 0) {
+ if (pPvtData->pMelodyString)
+ free(pPvtData->pMelodyString);
+ pPvtData->pMelodyString = strdup(value);
+ if (pPvtData->pMelodyString) {
+ pPvtData->melodyLen = strlen(pPvtData->pMelodyString);
+ }
+ }
+
+ else if (strcmp(name, "intf_nv_audio_rate") == 0) {
+ val = strtol(value, &pEnd, 10);
+ // TODO: Should check for specific values
+ if (val >= AVB_AUDIO_RATE_8KHZ && val <= AVB_AUDIO_RATE_192KHZ) {
+ pPvtData->audioRate = (avb_audio_rate_t)val;
+ }
+ else {
+ AVB_LOG_ERROR("Invalid audio rate configured for intf_nv_audio_rate.");
+ pPvtData->audioRate = AVB_AUDIO_RATE_44_1KHZ;
+ }
+
+ // Give the audio parameters to the mapping module.
+ if (xSupportedMappingFormat(pMediaQ)) {
+ pPubMapUncmpAudioInfo->audioRate = pPvtData->audioRate;
+ }
+ }
+
+ else if (strcmp(name, "intf_nv_audio_bit_depth") == 0) {
+ val = strtol(value, &pEnd, 10);
+ // TODO: Should check for specific values
+ if (val >= AVB_AUDIO_BIT_DEPTH_1BIT && val <= AVB_AUDIO_BIT_DEPTH_64BIT) {
+ pPvtData->audioBitDepth = (avb_audio_bit_depth_t)val;
+ }
+ else {
+ AVB_LOG_ERROR("Invalid audio type configured for intf_nv_audio_bits.");
+ pPvtData->audioBitDepth = AVB_AUDIO_BIT_DEPTH_24BIT;
+ }
+
+ // Give the audio parameters to the mapping module.
+ if (xSupportedMappingFormat(pMediaQ)) {
+ pPubMapUncmpAudioInfo->audioBitDepth = pPvtData->audioBitDepth;
+ }
+ }
+
+ else if (strcmp(name, "intf_nv_audio_type") == 0) {
+ if (strncasecmp(value, "float", 5) == 0)
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_FLOAT;
+ else if (strncasecmp(value, "sign", 4) == 0 || strncasecmp(value, "int", 4) == 0)
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_INT;
+ else if (strncasecmp(value, "unsign", 6) == 0 || strncasecmp(value, "uint", 4) == 0)
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_UINT;
+ else {
+ AVB_LOG_ERROR("Invalid audio type configured for intf_nv_audio_type.");
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_TYPE_UNSPEC;
+ }
+
+ // Give the audio parameters to the mapping module.
+ if (xSupportedMappingFormat(pMediaQ)) {
+ pPubMapUncmpAudioInfo->audioType = (avb_audio_type_t)pPvtData->audioType;
+ }
+ }
+
+ else if (strcmp(name, "intf_nv_audio_endian") == 0) {
+ if (strncasecmp(value, "big", 3) == 0)
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_ENDIAN_BIG;
+ else if (strncasecmp(value, "little", 6) == 0)
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_ENDIAN_LITTLE;
+ else {
+ AVB_LOG_ERROR("Invalid audio type configured for intf_nv_audio_endian.");
+ pPvtData->audioType = (avb_audio_bit_depth_t)AVB_AUDIO_ENDIAN_UNSPEC;
+ }
+
+ // Give the audio parameters to the mapping module.
+ if (xSupportedMappingFormat(pMediaQ)) {
+ pPubMapUncmpAudioInfo->audioEndian = (avb_audio_endian_t)pPvtData->audioEndian;
+ }
+ }
+
+ else if (strcmp(name, "intf_nv_audio_channels") == 0) {
+ val = strtol(value, &pEnd, 10);
+ // TODO: Should check for specific values
+ if (val >= AVB_AUDIO_CHANNELS_1 && val <= AVB_AUDIO_CHANNELS_8) {
+ pPvtData->audioChannels = (avb_audio_channels_t)val;
+ }
+ else {
+ AVB_LOG_ERROR("Invalid audio channels configured for intf_nv_audio_channels.");
+ pPvtData->audioChannels = (avb_audio_channels_t)AVB_AUDIO_CHANNELS_2;
+ }
+
+ // Give the audio parameters to the mapping module.
+ if (xSupportedMappingFormat(pMediaQ)) {
+ pPubMapUncmpAudioInfo->audioChannels = pPvtData->audioChannels;
+ }
+ }
+
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+void openavbIntfToneGenGenInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// A call to this callback indicates that this interface module will be
+// a talker. Any talker initialization can be done in this function.
+void openavbIntfToneGenTxInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+
+ // U8 b;
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+
+ media_q_pub_map_uncmp_audio_info_t *pPubMapUncmpAudioInfo;
+ pPubMapUncmpAudioInfo = (media_q_pub_map_uncmp_audio_info_t *)pMediaQ->pPubMapInfo;
+ if (!pPubMapUncmpAudioInfo) {
+ AVB_LOG_ERROR("Public map data for audio info not allocated.");
+ return;
+ }
+
+ // Will get toggle on at the first tx cb
+ if (pPvtData->onOffIntervalMSec > 0) {
+ pPvtData->freq = pPvtData->toneHz;
+ pPvtData->freqCountdown = 0;
+ }
+ else {
+ pPvtData->freq = 0;
+ pPvtData->freqCountdown = 0;
+ }
+
+ pPvtData->melodyIdx = 0;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// This callback will be called for each AVB transmit interval. Commonly this will be
+// 4000 or 8000 times per second.
+bool openavbIntfToneGenTxCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
+
+ if (pMediaQ) {
+ media_q_pub_map_uncmp_audio_info_t *pPubMapUncmpAudioInfo = pMediaQ->pPubMapInfo;
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return FALSE;
+ }
+
+ if (pPvtData->intervalCounter++ % pPubMapUncmpAudioInfo->packingFactor != 0)
+ return TRUE;
+
+ media_q_item_t *pMediaQItem = openavbMediaQHeadLock(pMediaQ);
+ if (pMediaQItem) {
+ if (pMediaQItem->itemSize < pPubMapUncmpAudioInfo->itemSize) {
+ AVB_LOG_ERROR("Media queue item not large enough for samples");
+ }
+
+ // Tone on
+ static U32 runningFrameCnt = 0;
+ U32 frameCnt;
+ U32 channelCnt;
+ U32 idx = 0;
+ for (frameCnt = 0; frameCnt < pPubMapUncmpAudioInfo->framesPerItem; frameCnt++) {
+
+ // Check for tone on / off toggle
+ if (!pPvtData->freqCountdown) {
+ if (pPvtData->pMelodyString) {
+ // Melody logic
+ U32 intervalMSec;
+ xGetMelodyToneAndDuration(
+ pPvtData->pMelodyString[pPvtData->melodyIdx],
+ pPvtData->pMelodyString[pPvtData->melodyIdx + 1],
+ &pPvtData->freq, &intervalMSec);
+ pPvtData->melodyIdx += 2;
+
+ pPvtData->freqCountdown = (pPubMapUncmpAudioInfo->audioRate / 1000) * intervalMSec;
+ if (pPvtData->melodyIdx >= pPvtData->melodyLen)
+ pPvtData->melodyIdx = 0;
+ }
+ else {
+ // Fixed tone
+ if (pPvtData->onOffIntervalMSec > 0) {
+ if (pPvtData->freq == 0)
+ pPvtData->freq = pPvtData->toneHz;
+ else
+ pPvtData->freq = 0;
+ pPvtData->freqCountdown = (pPubMapUncmpAudioInfo->audioRate / 1000) * pPvtData->onOffIntervalMSec;
+ }
+ else {
+ pPvtData->freqCountdown = pPubMapUncmpAudioInfo->audioRate; // Just run steady for 1 sec
+ }
+ }
+ pPvtData->ratio = pPvtData->freq / (float)pPubMapUncmpAudioInfo->audioRate;
+ }
+ pPvtData->freqCountdown--;
+
+
+ float value = SIN(2 * PI * (runningFrameCnt++ % pPubMapUncmpAudioInfo->audioRate) * pPvtData->ratio);
+
+ if (pPubMapUncmpAudioInfo->itemSampleSizeBytes == 2) {
+ // 16 bit audio
+ S16 sample = (S16)(value * 15000);
+ for (channelCnt = 0; channelCnt < pPubMapUncmpAudioInfo->audioChannels; channelCnt++) {
+ unsigned char c;
+ U8 *pData = pMediaQItem->pPubData;
+ c = (unsigned)sample % 256;
+ pData[idx++] = c;
+ c = (unsigned)sample / 256 % 256;
+ pData[idx++] = c;
+ }
+ }
+ else {
+ // CORE_TODO
+ AVB_LOG_ERROR("Audio sample size format not implemented yet for tone generator interface module");
+ }
+ }
+
+ pMediaQItem->dataLen = pPubMapUncmpAudioInfo->itemSize;
+
+ openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
+ openavbMediaQHeadPush(pMediaQ);
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return TRUE;
+ }
+ else {
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE; // Media queue full
+ }
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE;
+}
+
+// A call to this callback indicates that this interface module will be
+// a listener. Any listener initialization can be done in this function.
+void openavbIntfToneGenRxInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// This callback is called when acting as a listener.
+bool openavbIntfToneGenRxCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE;
+}
+
+// This callback will be called when the interface needs to be closed. All shutdown should
+// occur in this function.
+void openavbIntfToneGenEndCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+void openavbIntfToneGenGenEndCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// Main initialization entry point into the interface module
+extern DLL_EXPORT bool openavbIntfToneGenInitialize(media_q_t *pMediaQ, openavb_intf_cb_t *pIntfCB)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+ pMediaQ->pPvtIntfInfo = calloc(1, sizeof(pvt_data_t)); // Memory freed by the media queue when the media queue is destroyed.
+
+ if (!pMediaQ->pPvtIntfInfo) {
+ AVB_LOG_ERROR("Unable to allocate memory for AVTP interface module.");
+ return FALSE;
+ }
+
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+
+ pIntfCB->intf_cfg_cb = openavbIntfToneGenCfgCB;
+ pIntfCB->intf_gen_init_cb = openavbIntfToneGenGenInitCB;
+ pIntfCB->intf_tx_init_cb = openavbIntfToneGenTxInitCB;
+ pIntfCB->intf_tx_cb = openavbIntfToneGenTxCB;
+ pIntfCB->intf_rx_init_cb = openavbIntfToneGenRxInitCB;
+ pIntfCB->intf_rx_cb = openavbIntfToneGenRxCB;
+ pIntfCB->intf_end_cb = openavbIntfToneGenEndCB;
+ pIntfCB->intf_gen_end_cb = openavbIntfToneGenGenEndCB;
+
+ pPvtData->intervalCounter = 0;
+ pPvtData->melodyIdx = 0;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+ return TRUE;
+}
diff --git a/lib/avtp_pipeline/intf_viewer/openavb_intf_viewer.c b/lib/avtp_pipeline/intf_viewer/openavb_intf_viewer.c
index 3ad743ca..0e406dc6 100755
--- a/lib/avtp_pipeline/intf_viewer/openavb_intf_viewer.c
+++ b/lib/avtp_pipeline/intf_viewer/openavb_intf_viewer.c
@@ -1,520 +1,520 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : Viewer interface module.
-*
-* This interface module is only a listener and is used to simply display
-* contents recieved in a number of different formats. Additionally it is
-* mapping type aware and can display header values for different mappings
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include "openavb_platform_pub.h"
-#include "openavb_types_pub.h"
-#include "openavb_trace_pub.h"
-#include "openavb_mediaq_pub.h"
-#include "openavb_intf_pub.h"
-
-#define AVB_LOG_COMPONENT "Viewer Interface"
-#include "openavb_log_pub.h"
-
-typedef enum {
- VIEWER_MODE_DETAIL = 0,
- VIEWER_MODE_MAPPING_AWARE = 1,
- VIEWER_MODE_AVTP_TIMESTAMP = 2,
- VIEWER_MODE_LATENCY = 3,
- VIEWER_MODE_SELECTIVE_TIMESTAMP = 4,
- VIEWER_MODE_LATE = 5,
- VIEWER_MODE_GAP = 6,
-} viewer_mode_t;
-
-typedef struct {
- /////////////
- // Config data
- /////////////
- viewer_mode_t viewType;
-
- // Frequency of output
- U32 viewInterval;
-
- // Offest into the raw frame to output
- U32 rawOffset;
-
- // Length of the raw frame to output
- U32 rawLength;
-
- // Ignore timestamp at listener.
- bool ignoreTimestamp;
-
- /////////////
- // Variable data
- /////////////
- U32 servicedCount;
-
- S64 accumLateNS;
-
- S32 maxLateNS;
-
- U64 accumGapNS;
-
- U32 maxGapNS;
-
- U64 prevNowTime;
-
- S64 accumAvtpDeltaNS;
-
- S32 maxAvtpDeltaNS;
-
- U64 prevAvtpTimestampTime;
-
- U32 skipCountdown;
-
- float jitter;
-
- S32 avgForJitter;
-
-} pvt_data_t;
-
-// Each configuration name value pair for this mapping will result in this callback being called.
-void openavbIntfViewerCfgCB(media_q_t *pMediaQ, const char *name, const char *value)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
- char *pEnd;
- long tmp;
-
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
-
- // intf_nv_view_type: Type of viewing output. 0 = raw, 1 = mapping aware, 2 = timestamps only, 3 = latency output, 4 = Selective timestamp error reporting
- if (strcmp(name, "intf_nv_view_type") == 0) {
- pPvtData->viewType = (viewer_mode_t)strtol(value, &pEnd, 10);
- }
-
- else if (strcmp(name, "intf_nv_view_interval") == 0) {
- pPvtData->viewInterval = strtol(value, &pEnd, 10);
- if (pPvtData->viewInterval == 0) {
- pPvtData->viewInterval = 1000;
- }
- }
-
- else if (strcmp(name, "intf_nv_raw_offset") == 0) {
- pPvtData->rawOffset = strtol(value, &pEnd, 10);
- }
-
- else if (strcmp(name, "intf_nv_raw_length") == 0) {
- pPvtData->rawLength = strtol(value, &pEnd, 10);
- if (pPvtData->rawLength < 1)
- pPvtData->rawLength = 1000;
- }
-
- else if (strcmp(name, "intf_nv_ignore_timestamp") == 0) {
- tmp = strtol(value, &pEnd, 10);
- if (*pEnd == '\0' && tmp == 1) {
- pPvtData->ignoreTimestamp = (tmp == 1);
- }
- }
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-void openavbIntfViewerGenInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// No talker functionality in this interface
-void openavbIntfViewerTxInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// No talker functionality in this interface
-bool openavbIntfViewerTxCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return FALSE;
-}
-
-// A call to this callback indicates that this interface module will be
-// a listener. Any listener initialization can be done in this function.
-void openavbIntfViewerRxInitCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return;
- }
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// This callback is called when acting as a listener.
-bool openavbIntfViewerRxCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
- if (pMediaQ) {
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
- if (!pPvtData) {
- AVB_LOG_ERROR("Private interface module data not allocated.");
- return FALSE;
- }
-
- media_q_item_t *pMediaQItem = openavbMediaQTailLock(pMediaQ, pPvtData->ignoreTimestamp);
- if (pMediaQItem) {
-
- // The skip countdown allow the viewer modes to set a number of packets to ignore
- // after logging to reduce or eliminate the logging from affecting the stats.
- if (pPvtData->skipCountdown)
- pPvtData->skipCountdown--;
-
- if (pMediaQItem->dataLen && !pPvtData->skipCountdown) {
- pPvtData->servicedCount++;
-
- if (pPvtData->viewType == VIEWER_MODE_DETAIL) {
- U32 avtpTimestamp;
- U64 avtpTimestampTime;
- bool avtpTimestampValid;
- U32 nowTimestamp;
- U64 nowTimestampTime;
- bool nowTimestampValid;
- U64 nowTime;
- S32 lateNS = 0;
- U64 gapNS = 0;
-
- avtpTimestamp = openavbAvtpTimeGetAvtpTimestamp(pMediaQItem->pAvtpTime);
- avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
- nowTimestamp = openavbAvtpTimeGetAvtpTimestamp(pMediaQItem->pAvtpTime);
- nowTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- nowTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- CLOCK_GETTIME64(OPENAVB_CLOCK_REALTIME, &nowTime);
-
- if (avtpTimestampValid && nowTimestampValid) {
- lateNS = nowTimestampTime - avtpTimestampTime;
- if (lateNS > pPvtData->maxLateNS) {
- pPvtData->maxLateNS = lateNS;
- }
- pPvtData->accumLateNS += lateNS;
-
- if (pPvtData->servicedCount > 1) {
- gapNS = nowTime - pPvtData->prevNowTime;
- if (gapNS > pPvtData->maxGapNS) {
- pPvtData->maxGapNS = gapNS;
- }
- pPvtData->accumGapNS += gapNS;
- }
- pPvtData->prevNowTime = nowTime;
-
- if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
- S32 lateAvg = pPvtData->accumLateNS / pPvtData->servicedCount;
- S32 gapAvg = pPvtData->accumGapNS / (pPvtData->servicedCount - 1);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "****************************", LOG_RT_DATATYPE_CONST_STR, NULL);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Packets: %u", LOG_RT_DATATYPE_U32, &pPvtData->servicedCount);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "AVTP Timestamp: %u NS", LOG_RT_DATATYPE_U32, &avtpTimestamp);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Now Timestamp: %u NS", LOG_RT_DATATYPE_U32, &nowTimestamp);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Late: %d NS", LOG_RT_DATATYPE_S32, &lateNS);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Late Avg: %d NS", LOG_RT_DATATYPE_S32, &lateAvg);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Late Max: %d NS", LOG_RT_DATATYPE_S32, &pPvtData->maxLateNS);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Gap: %u NS", LOG_RT_DATATYPE_U32, &gapNS);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Gap Avg: %u NS", LOG_RT_DATATYPE_U32, &gapAvg);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Gap Max: %u NS", LOG_RT_DATATYPE_U32, &pPvtData->maxGapNS);
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Data length: %u", LOG_RT_DATATYPE_U32, &pMediaQItem->dataLen);
-
- pPvtData->accumLateNS = 0;
- pPvtData->maxLateNS = 0;
- pPvtData->accumGapNS = 0;
- pPvtData->maxGapNS = 0;
- pPvtData->prevNowTime = 0;
- pPvtData->servicedCount = 0;
- pPvtData->skipCountdown = 10;
- }
- }
- }
-
- else if (pPvtData->viewType == VIEWER_MODE_MAPPING_AWARE) {
- }
-
- else if (pPvtData->viewType == VIEWER_MODE_AVTP_TIMESTAMP) {
- U64 avtpTimestampTime;
- bool avtpTimestampValid;
- S32 deltaNS = 0;
-
- avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- if (avtpTimestampValid) {
- if (pPvtData->servicedCount > 1) {
- deltaNS = avtpTimestampTime - pPvtData->prevAvtpTimestampTime;
- if (deltaNS > pPvtData->maxAvtpDeltaNS) {
- pPvtData->maxAvtpDeltaNS = deltaNS;
- }
- pPvtData->accumAvtpDeltaNS += deltaNS;
-
- if (pPvtData->avgForJitter != 0) {
- S32 deltaJitter = pPvtData->avgForJitter - deltaNS;
- if (deltaJitter < 0) deltaJitter = -deltaJitter;
- pPvtData->jitter += (1.0/16.0) * ((float)deltaJitter - pPvtData->jitter);
- }
- }
- pPvtData->prevAvtpTimestampTime = avtpTimestampTime;
-
- if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
- S32 deltaAvg = pPvtData->accumAvtpDeltaNS / (pPvtData->servicedCount - 1);
- U32 jitter = (U32)(pPvtData->jitter);
-
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "AVTP Timestamp Delta: %d NS ", LOG_RT_DATATYPE_S32, &deltaNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "AVTP Timestamp Delta Avg: %d NS ", LOG_RT_DATATYPE_S32, &deltaAvg);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "AVTP Timestamp Delta Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxAvtpDeltaNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
-
- pPvtData->accumAvtpDeltaNS = 0;
- pPvtData->maxAvtpDeltaNS = 0;
- pPvtData->servicedCount = 0;
- pPvtData->prevAvtpTimestampTime = 0;
- pPvtData->skipCountdown = 10;
- pPvtData->jitter = 0.0;
- pPvtData->avgForJitter = deltaAvg;
- }
- }
- }
-
- else if (pPvtData->viewType == VIEWER_MODE_LATENCY) {
- U64 avtpTimestampTime;
- bool avtpTimestampValid;
- U64 nowTimestampTime;
- bool nowTimestampValid;
- S32 lateNS = 0;
-
- avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
- nowTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- nowTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- if (avtpTimestampValid && nowTimestampValid) {
- lateNS = nowTimestampTime - avtpTimestampTime;
- if (lateNS > pPvtData->maxLateNS) {
- pPvtData->maxLateNS = lateNS;
- }
- pPvtData->accumLateNS += lateNS;
-
- if (pPvtData->avgForJitter != 0) {
- S32 lateJitter = pPvtData->avgForJitter - lateNS;
- if (lateJitter < 0) lateJitter = -lateJitter;
- pPvtData->jitter += (1.0/16.0) * ((float)lateJitter - pPvtData->jitter);
- }
-
- if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
- S32 lateAvg = pPvtData->accumLateNS / pPvtData->servicedCount;
- U32 jitter = (U32)(pPvtData->jitter);
-
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "Latency: %d NS ", LOG_RT_DATATYPE_S32, &lateNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Latency Avg: %d NS ", LOG_RT_DATATYPE_S32, &lateAvg);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Latency Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxLateNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
-
- pPvtData->accumLateNS = 0;
- pPvtData->maxLateNS = 0;
- pPvtData->servicedCount = 0;
- pPvtData->skipCountdown = 10;
- pPvtData->jitter = 0.0;
- pPvtData->avgForJitter = lateAvg;
- }
- }
- }
-
- else if (pPvtData->viewType == VIEWER_MODE_SELECTIVE_TIMESTAMP) {
- }
-
- else if (pPvtData->viewType == VIEWER_MODE_LATE) {
- U64 avtpTimestampTime;
- bool avtpTimestampValid;
- U64 nowTimestampTime;
- bool nowTimestampValid;
- S32 lateNS = 0;
-
- avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
- nowTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
- nowTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
-
- if (avtpTimestampValid && nowTimestampValid) {
- lateNS = nowTimestampTime - avtpTimestampTime;
- if (lateNS > pPvtData->maxLateNS) {
- pPvtData->maxLateNS = lateNS;
- }
- pPvtData->accumLateNS += lateNS;
-
- if (pPvtData->avgForJitter != 0) {
- S32 lateJitter = pPvtData->avgForJitter - lateNS;
- if (lateJitter < 0) lateJitter = -lateJitter;
- pPvtData->jitter += (1.0/16.0) * ((float)lateJitter - pPvtData->jitter);
- }
-
- if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
- S32 lateAvg = pPvtData->accumLateNS / pPvtData->servicedCount;
- U32 jitter = (U32)(pPvtData->jitter);
-
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "Late: %d NS ", LOG_RT_DATATYPE_S32, &lateNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Late Avg: %d NS ", LOG_RT_DATATYPE_S32, &lateAvg);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Late Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxLateNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
-
- pPvtData->accumLateNS = 0;
- pPvtData->maxLateNS = 0;
- pPvtData->servicedCount = 0;
- pPvtData->skipCountdown = 10;
- pPvtData->jitter = 0.0;
- pPvtData->avgForJitter = lateAvg;
- }
- }
- }
-
- else if (pPvtData->viewType == VIEWER_MODE_GAP) {
- U64 nowTime;
- U64 gapNS = 0;
-
- CLOCK_GETTIME64(OPENAVB_CLOCK_REALTIME, &nowTime);
-
- if (pPvtData->servicedCount > 1) {
- gapNS = nowTime - pPvtData->prevNowTime;
- if (gapNS > pPvtData->maxGapNS) {
- pPvtData->maxGapNS = gapNS;
- }
- pPvtData->accumGapNS += gapNS;
-
- if (pPvtData->avgForJitter != 0) {
- S32 gapJitter = pPvtData->avgForJitter - gapNS;
- if (gapJitter < 0) gapJitter = -gapJitter;
- pPvtData->jitter += (1.0/16.0) * ((float)gapJitter - pPvtData->jitter);
- }
- }
- pPvtData->prevNowTime = nowTime;
-
- if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
- S32 gapAvg = pPvtData->accumGapNS / (pPvtData->servicedCount - 1);
- U32 jitter = (U32)(pPvtData->jitter);
-
- AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "Gap: %d NS ", LOG_RT_DATATYPE_S32, &gapNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Gap Avg: %d NS ", LOG_RT_DATATYPE_S32, &gapAvg);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Gap Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxGapNS);
- AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
-
- pPvtData->accumGapNS = 0;
- pPvtData->maxGapNS = 0;
- pPvtData->prevNowTime = 0;
- pPvtData->servicedCount = 0;
- pPvtData->skipCountdown = 10;
- pPvtData->jitter = 0.0;
- pPvtData->avgForJitter = gapAvg;
- }
- }
-
- }
- openavbMediaQTailPull(pMediaQ);
- }
- }
- AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
- return TRUE;
-}
-
-
-// This callback will be called when the interface needs to be closed. All shutdown should
-// occur in this function.
-void openavbIntfViewerEndCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-void openavbIntfViewerGenEndCB(media_q_t *pMediaQ)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
-}
-
-// Main initialization entry point into the interface module
-extern DLL_EXPORT bool openavbIntfViewerInitialize(media_q_t *pMediaQ, openavb_intf_cb_t *pIntfCB)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
-
- if (pMediaQ) {
- pMediaQ->pPvtIntfInfo = calloc(1, sizeof(pvt_data_t)); // Memory freed by the media queue when the media queue is destroyed.
-
- if (!pMediaQ->pPvtIntfInfo) {
- AVB_LOG_ERROR("Unable to allocate memory for AVTP interface module.");
- return FALSE;
- }
-
- pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
-
- pIntfCB->intf_cfg_cb = openavbIntfViewerCfgCB;
- pIntfCB->intf_gen_init_cb = openavbIntfViewerGenInitCB;
- pIntfCB->intf_tx_init_cb = openavbIntfViewerTxInitCB;
- pIntfCB->intf_tx_cb = openavbIntfViewerTxCB;
- pIntfCB->intf_rx_init_cb = openavbIntfViewerRxInitCB;
- pIntfCB->intf_rx_cb = openavbIntfViewerRxCB;
- pIntfCB->intf_end_cb = openavbIntfViewerEndCB;
- pIntfCB->intf_gen_end_cb = openavbIntfViewerGenEndCB;
-
- pPvtData->viewType = VIEWER_MODE_DETAIL;
- pPvtData->viewInterval = 1000;
- pPvtData->rawOffset = 0;
- pPvtData->rawLength = 20;
- pPvtData->ignoreTimestamp = FALSE;
- pPvtData->skipCountdown = 0;
- pPvtData->jitter = 0.0;
- pPvtData->avgForJitter = 0;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
- return TRUE;
-}
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : Viewer interface module.
+*
+* This interface module is only a listener and is used to simply display
+* contents recieved in a number of different formats. Additionally it is
+* mapping type aware and can display header values for different mappings
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include "openavb_platform_pub.h"
+#include "openavb_types_pub.h"
+#include "openavb_trace_pub.h"
+#include "openavb_mediaq_pub.h"
+#include "openavb_intf_pub.h"
+
+#define AVB_LOG_COMPONENT "Viewer Interface"
+#include "openavb_log_pub.h"
+
+typedef enum {
+ VIEWER_MODE_DETAIL = 0,
+ VIEWER_MODE_MAPPING_AWARE = 1,
+ VIEWER_MODE_AVTP_TIMESTAMP = 2,
+ VIEWER_MODE_LATENCY = 3,
+ VIEWER_MODE_SELECTIVE_TIMESTAMP = 4,
+ VIEWER_MODE_LATE = 5,
+ VIEWER_MODE_GAP = 6,
+} viewer_mode_t;
+
+typedef struct {
+ /////////////
+ // Config data
+ /////////////
+ viewer_mode_t viewType;
+
+ // Frequency of output
+ U32 viewInterval;
+
+ // Offest into the raw frame to output
+ U32 rawOffset;
+
+ // Length of the raw frame to output
+ U32 rawLength;
+
+ // Ignore timestamp at listener.
+ bool ignoreTimestamp;
+
+ /////////////
+ // Variable data
+ /////////////
+ U32 servicedCount;
+
+ S64 accumLateNS;
+
+ S32 maxLateNS;
+
+ U64 accumGapNS;
+
+ U32 maxGapNS;
+
+ U64 prevNowTime;
+
+ S64 accumAvtpDeltaNS;
+
+ S32 maxAvtpDeltaNS;
+
+ U64 prevAvtpTimestampTime;
+
+ U32 skipCountdown;
+
+ float jitter;
+
+ S32 avgForJitter;
+
+} pvt_data_t;
+
+// Each configuration name value pair for this mapping will result in this callback being called.
+void openavbIntfViewerCfgCB(media_q_t *pMediaQ, const char *name, const char *value)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+ char *pEnd;
+ long tmp;
+
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+
+ // intf_nv_view_type: Type of viewing output. 0 = raw, 1 = mapping aware, 2 = timestamps only, 3 = latency output, 4 = Selective timestamp error reporting
+ if (strcmp(name, "intf_nv_view_type") == 0) {
+ pPvtData->viewType = (viewer_mode_t)strtol(value, &pEnd, 10);
+ }
+
+ else if (strcmp(name, "intf_nv_view_interval") == 0) {
+ pPvtData->viewInterval = strtol(value, &pEnd, 10);
+ if (pPvtData->viewInterval == 0) {
+ pPvtData->viewInterval = 1000;
+ }
+ }
+
+ else if (strcmp(name, "intf_nv_raw_offset") == 0) {
+ pPvtData->rawOffset = strtol(value, &pEnd, 10);
+ }
+
+ else if (strcmp(name, "intf_nv_raw_length") == 0) {
+ pPvtData->rawLength = strtol(value, &pEnd, 10);
+ if (pPvtData->rawLength < 1)
+ pPvtData->rawLength = 1000;
+ }
+
+ else if (strcmp(name, "intf_nv_ignore_timestamp") == 0) {
+ tmp = strtol(value, &pEnd, 10);
+ if (*pEnd == '\0' && tmp == 1) {
+ pPvtData->ignoreTimestamp = (tmp == 1);
+ }
+ }
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+void openavbIntfViewerGenInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// No talker functionality in this interface
+void openavbIntfViewerTxInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// No talker functionality in this interface
+bool openavbIntfViewerTxCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return FALSE;
+}
+
+// A call to this callback indicates that this interface module will be
+// a listener. Any listener initialization can be done in this function.
+void openavbIntfViewerRxInitCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return;
+ }
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// This callback is called when acting as a listener.
+bool openavbIntfViewerRxCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF_DETAIL);
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+ if (!pPvtData) {
+ AVB_LOG_ERROR("Private interface module data not allocated.");
+ return FALSE;
+ }
+
+ media_q_item_t *pMediaQItem = openavbMediaQTailLock(pMediaQ, pPvtData->ignoreTimestamp);
+ if (pMediaQItem) {
+
+ // The skip countdown allow the viewer modes to set a number of packets to ignore
+ // after logging to reduce or eliminate the logging from affecting the stats.
+ if (pPvtData->skipCountdown)
+ pPvtData->skipCountdown--;
+
+ if (pMediaQItem->dataLen && !pPvtData->skipCountdown) {
+ pPvtData->servicedCount++;
+
+ if (pPvtData->viewType == VIEWER_MODE_DETAIL) {
+ U32 avtpTimestamp;
+ U64 avtpTimestampTime;
+ bool avtpTimestampValid;
+ U32 nowTimestamp;
+ U64 nowTimestampTime;
+ bool nowTimestampValid;
+ U64 nowTime;
+ S32 lateNS = 0;
+ U64 gapNS = 0;
+
+ avtpTimestamp = openavbAvtpTimeGetAvtpTimestamp(pMediaQItem->pAvtpTime);
+ avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
+ nowTimestamp = openavbAvtpTimeGetAvtpTimestamp(pMediaQItem->pAvtpTime);
+ nowTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ nowTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ CLOCK_GETTIME64(OPENAVB_CLOCK_REALTIME, &nowTime);
+
+ if (avtpTimestampValid && nowTimestampValid) {
+ lateNS = nowTimestampTime - avtpTimestampTime;
+ if (lateNS > pPvtData->maxLateNS) {
+ pPvtData->maxLateNS = lateNS;
+ }
+ pPvtData->accumLateNS += lateNS;
+
+ if (pPvtData->servicedCount > 1) {
+ gapNS = nowTime - pPvtData->prevNowTime;
+ if (gapNS > pPvtData->maxGapNS) {
+ pPvtData->maxGapNS = gapNS;
+ }
+ pPvtData->accumGapNS += gapNS;
+ }
+ pPvtData->prevNowTime = nowTime;
+
+ if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
+ S32 lateAvg = pPvtData->accumLateNS / pPvtData->servicedCount;
+ S32 gapAvg = pPvtData->accumGapNS / (pPvtData->servicedCount - 1);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "****************************", LOG_RT_DATATYPE_CONST_STR, NULL);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Packets: %u", LOG_RT_DATATYPE_U32, &pPvtData->servicedCount);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "AVTP Timestamp: %u NS", LOG_RT_DATATYPE_U32, &avtpTimestamp);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Now Timestamp: %u NS", LOG_RT_DATATYPE_U32, &nowTimestamp);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Late: %d NS", LOG_RT_DATATYPE_S32, &lateNS);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Late Avg: %d NS", LOG_RT_DATATYPE_S32, &lateAvg);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Late Max: %d NS", LOG_RT_DATATYPE_S32, &pPvtData->maxLateNS);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Gap: %u NS", LOG_RT_DATATYPE_U32, &gapNS);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Gap Avg: %u NS", LOG_RT_DATATYPE_U32, &gapAvg);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Gap Max: %u NS", LOG_RT_DATATYPE_U32, &pPvtData->maxGapNS);
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, LOG_RT_END, "Data length: %u", LOG_RT_DATATYPE_U32, &pMediaQItem->dataLen);
+
+ pPvtData->accumLateNS = 0;
+ pPvtData->maxLateNS = 0;
+ pPvtData->accumGapNS = 0;
+ pPvtData->maxGapNS = 0;
+ pPvtData->prevNowTime = 0;
+ pPvtData->servicedCount = 0;
+ pPvtData->skipCountdown = 10;
+ }
+ }
+ }
+
+ else if (pPvtData->viewType == VIEWER_MODE_MAPPING_AWARE) {
+ }
+
+ else if (pPvtData->viewType == VIEWER_MODE_AVTP_TIMESTAMP) {
+ U64 avtpTimestampTime;
+ bool avtpTimestampValid;
+ S32 deltaNS = 0;
+
+ avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ if (avtpTimestampValid) {
+ if (pPvtData->servicedCount > 1) {
+ deltaNS = avtpTimestampTime - pPvtData->prevAvtpTimestampTime;
+ if (deltaNS > pPvtData->maxAvtpDeltaNS) {
+ pPvtData->maxAvtpDeltaNS = deltaNS;
+ }
+ pPvtData->accumAvtpDeltaNS += deltaNS;
+
+ if (pPvtData->avgForJitter != 0) {
+ S32 deltaJitter = pPvtData->avgForJitter - deltaNS;
+ if (deltaJitter < 0) deltaJitter = -deltaJitter;
+ pPvtData->jitter += (1.0/16.0) * ((float)deltaJitter - pPvtData->jitter);
+ }
+ }
+ pPvtData->prevAvtpTimestampTime = avtpTimestampTime;
+
+ if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
+ S32 deltaAvg = pPvtData->accumAvtpDeltaNS / (pPvtData->servicedCount - 1);
+ U32 jitter = (U32)(pPvtData->jitter);
+
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "AVTP Timestamp Delta: %d NS ", LOG_RT_DATATYPE_S32, &deltaNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "AVTP Timestamp Delta Avg: %d NS ", LOG_RT_DATATYPE_S32, &deltaAvg);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "AVTP Timestamp Delta Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxAvtpDeltaNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
+
+ pPvtData->accumAvtpDeltaNS = 0;
+ pPvtData->maxAvtpDeltaNS = 0;
+ pPvtData->servicedCount = 0;
+ pPvtData->prevAvtpTimestampTime = 0;
+ pPvtData->skipCountdown = 10;
+ pPvtData->jitter = 0.0;
+ pPvtData->avgForJitter = deltaAvg;
+ }
+ }
+ }
+
+ else if (pPvtData->viewType == VIEWER_MODE_LATENCY) {
+ U64 avtpTimestampTime;
+ bool avtpTimestampValid;
+ U64 nowTimestampTime;
+ bool nowTimestampValid;
+ S32 lateNS = 0;
+
+ avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
+ nowTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ nowTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ if (avtpTimestampValid && nowTimestampValid) {
+ lateNS = nowTimestampTime - avtpTimestampTime;
+ if (lateNS > pPvtData->maxLateNS) {
+ pPvtData->maxLateNS = lateNS;
+ }
+ pPvtData->accumLateNS += lateNS;
+
+ if (pPvtData->avgForJitter != 0) {
+ S32 lateJitter = pPvtData->avgForJitter - lateNS;
+ if (lateJitter < 0) lateJitter = -lateJitter;
+ pPvtData->jitter += (1.0/16.0) * ((float)lateJitter - pPvtData->jitter);
+ }
+
+ if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
+ S32 lateAvg = pPvtData->accumLateNS / pPvtData->servicedCount;
+ U32 jitter = (U32)(pPvtData->jitter);
+
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "Latency: %d NS ", LOG_RT_DATATYPE_S32, &lateNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Latency Avg: %d NS ", LOG_RT_DATATYPE_S32, &lateAvg);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Latency Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxLateNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
+
+ pPvtData->accumLateNS = 0;
+ pPvtData->maxLateNS = 0;
+ pPvtData->servicedCount = 0;
+ pPvtData->skipCountdown = 10;
+ pPvtData->jitter = 0.0;
+ pPvtData->avgForJitter = lateAvg;
+ }
+ }
+ }
+
+ else if (pPvtData->viewType == VIEWER_MODE_SELECTIVE_TIMESTAMP) {
+ }
+
+ else if (pPvtData->viewType == VIEWER_MODE_LATE) {
+ U64 avtpTimestampTime;
+ bool avtpTimestampValid;
+ U64 nowTimestampTime;
+ bool nowTimestampValid;
+ S32 lateNS = 0;
+
+ avtpTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ avtpTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ openavbAvtpTimeSetToWallTime(pMediaQItem->pAvtpTime);
+ nowTimestampTime = openavbAvtpTimeGetAvtpTimeNS(pMediaQItem->pAvtpTime);
+ nowTimestampValid = openavbAvtpTimeTimestampIsValid(pMediaQItem->pAvtpTime);
+
+ if (avtpTimestampValid && nowTimestampValid) {
+ lateNS = nowTimestampTime - avtpTimestampTime;
+ if (lateNS > pPvtData->maxLateNS) {
+ pPvtData->maxLateNS = lateNS;
+ }
+ pPvtData->accumLateNS += lateNS;
+
+ if (pPvtData->avgForJitter != 0) {
+ S32 lateJitter = pPvtData->avgForJitter - lateNS;
+ if (lateJitter < 0) lateJitter = -lateJitter;
+ pPvtData->jitter += (1.0/16.0) * ((float)lateJitter - pPvtData->jitter);
+ }
+
+ if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
+ S32 lateAvg = pPvtData->accumLateNS / pPvtData->servicedCount;
+ U32 jitter = (U32)(pPvtData->jitter);
+
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "Late: %d NS ", LOG_RT_DATATYPE_S32, &lateNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Late Avg: %d NS ", LOG_RT_DATATYPE_S32, &lateAvg);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Late Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxLateNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
+
+ pPvtData->accumLateNS = 0;
+ pPvtData->maxLateNS = 0;
+ pPvtData->servicedCount = 0;
+ pPvtData->skipCountdown = 10;
+ pPvtData->jitter = 0.0;
+ pPvtData->avgForJitter = lateAvg;
+ }
+ }
+ }
+
+ else if (pPvtData->viewType == VIEWER_MODE_GAP) {
+ U64 nowTime;
+ U64 gapNS = 0;
+
+ CLOCK_GETTIME64(OPENAVB_CLOCK_REALTIME, &nowTime);
+
+ if (pPvtData->servicedCount > 1) {
+ gapNS = nowTime - pPvtData->prevNowTime;
+ if (gapNS > pPvtData->maxGapNS) {
+ pPvtData->maxGapNS = gapNS;
+ }
+ pPvtData->accumGapNS += gapNS;
+
+ if (pPvtData->avgForJitter != 0) {
+ S32 gapJitter = pPvtData->avgForJitter - gapNS;
+ if (gapJitter < 0) gapJitter = -gapJitter;
+ pPvtData->jitter += (1.0/16.0) * ((float)gapJitter - pPvtData->jitter);
+ }
+ }
+ pPvtData->prevNowTime = nowTime;
+
+ if ((pPvtData->servicedCount % pPvtData->viewInterval) == 0) {
+ S32 gapAvg = pPvtData->accumGapNS / (pPvtData->servicedCount - 1);
+ U32 jitter = (U32)(pPvtData->jitter);
+
+ AVB_LOGRT_INFO(LOG_RT_BEGIN, LOG_RT_ITEM, FALSE, "Gap: %d NS ", LOG_RT_DATATYPE_S32, &gapNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Gap Avg: %d NS ", LOG_RT_DATATYPE_S32, &gapAvg);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, FALSE, "Gap Max: %d NS ", LOG_RT_DATATYPE_S32, &pPvtData->maxGapNS);
+ AVB_LOGRT_INFO(FALSE, LOG_RT_ITEM, LOG_RT_END, "Jitter: %d", LOG_RT_DATATYPE_S32, &jitter);
+
+ pPvtData->accumGapNS = 0;
+ pPvtData->maxGapNS = 0;
+ pPvtData->prevNowTime = 0;
+ pPvtData->servicedCount = 0;
+ pPvtData->skipCountdown = 10;
+ pPvtData->jitter = 0.0;
+ pPvtData->avgForJitter = gapAvg;
+ }
+ }
+
+ }
+ openavbMediaQTailPull(pMediaQ);
+ }
+ }
+ AVB_TRACE_EXIT(AVB_TRACE_INTF_DETAIL);
+ return TRUE;
+}
+
+
+// This callback will be called when the interface needs to be closed. All shutdown should
+// occur in this function.
+void openavbIntfViewerEndCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+void openavbIntfViewerGenEndCB(media_q_t *pMediaQ)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+}
+
+// Main initialization entry point into the interface module
+extern DLL_EXPORT bool openavbIntfViewerInitialize(media_q_t *pMediaQ, openavb_intf_cb_t *pIntfCB)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_INTF);
+
+ if (pMediaQ) {
+ pMediaQ->pPvtIntfInfo = calloc(1, sizeof(pvt_data_t)); // Memory freed by the media queue when the media queue is destroyed.
+
+ if (!pMediaQ->pPvtIntfInfo) {
+ AVB_LOG_ERROR("Unable to allocate memory for AVTP interface module.");
+ return FALSE;
+ }
+
+ pvt_data_t *pPvtData = pMediaQ->pPvtIntfInfo;
+
+ pIntfCB->intf_cfg_cb = openavbIntfViewerCfgCB;
+ pIntfCB->intf_gen_init_cb = openavbIntfViewerGenInitCB;
+ pIntfCB->intf_tx_init_cb = openavbIntfViewerTxInitCB;
+ pIntfCB->intf_tx_cb = openavbIntfViewerTxCB;
+ pIntfCB->intf_rx_init_cb = openavbIntfViewerRxInitCB;
+ pIntfCB->intf_rx_cb = openavbIntfViewerRxCB;
+ pIntfCB->intf_end_cb = openavbIntfViewerEndCB;
+ pIntfCB->intf_gen_end_cb = openavbIntfViewerGenEndCB;
+
+ pPvtData->viewType = VIEWER_MODE_DETAIL;
+ pPvtData->viewInterval = 1000;
+ pPvtData->rawOffset = 0;
+ pPvtData->rawLength = 20;
+ pPvtData->ignoreTimestamp = FALSE;
+ pPvtData->skipCountdown = 0;
+ pPvtData->jitter = 0.0;
+ pPvtData->avgForJitter = 0;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_INTF);
+ return TRUE;
+}
diff --git a/lib/avtp_pipeline/mcr/openavb_mcr_hal_pub.h b/lib/avtp_pipeline/mcr/openavb_mcr_hal_pub.h
index ac2eca21..e1d19b43 100644
--- a/lib/avtp_pipeline/mcr/openavb_mcr_hal_pub.h
+++ b/lib/avtp_pipeline/mcr/openavb_mcr_hal_pub.h
@@ -1,65 +1,65 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE : Public interface for media clock recovery
-*/
-
-#ifndef OPENAVB_MCR_HAL_PUB_H
-#define OPENAVB_MCR_HAL_PUB_H
-
-#include "openavb_platform_pub.h"
-#include "openavb_types_base_pub.h"
-
-#define HAL_INIT_MCR_V2(packetRate, pushInterval, timestampInterval, recoveryInterval) halInitMCR(packetRate, pushInterval, timestampInterval, recoveryInterval)
-#define HAL_CLOSE_MCR_V2() halCloseMCR()
-#define HAL_PUSH_MCR_V2() halPushMCR()
-
-// Initialize HAL MCR
-bool halInitMCR(U32 packetRate, U32 pushInterval, U32 timeStampInterval, U32 recoveryInterval);
-
-// Close HAL MCR
-bool halCloseMCR(void);
-
-// Push MCR Event
-bool halPushMCR(void);
-
-// MCR timer adjustment. Negative value speed up the media clock. Positive values slow the media clock.
-// Will take effect during the next clock recovery interval. This is completely indepentant from pure MCR and
-// allows for adjustments based on media buffer levels. The value past in works as credit with each
-// MCR timer cycle bump up and down the clock temporarily.
-void halAdjustMCRNSec(S32 adjNSec);
-
-// The granularity is used to set coarseness of the values that will be passed into halAdjustMCRNSec.
-// This is used to balance if the timestamps or values from halAdjustMCRNSec are used to adjust the clock.
-void halAdjustMCRGranularityNSec(U32 adjGranularityNSec);
-
-
-#endif // OPENAVB_MCR_HAL_PUB_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE : Public interface for media clock recovery
+*/
+
+#ifndef OPENAVB_MCR_HAL_PUB_H
+#define OPENAVB_MCR_HAL_PUB_H
+
+#include "openavb_platform_pub.h"
+#include "openavb_types_base_pub.h"
+
+#define HAL_INIT_MCR_V2(packetRate, pushInterval, timestampInterval, recoveryInterval) halInitMCR(packetRate, pushInterval, timestampInterval, recoveryInterval)
+#define HAL_CLOSE_MCR_V2() halCloseMCR()
+#define HAL_PUSH_MCR_V2() halPushMCR()
+
+// Initialize HAL MCR
+bool halInitMCR(U32 packetRate, U32 pushInterval, U32 timeStampInterval, U32 recoveryInterval);
+
+// Close HAL MCR
+bool halCloseMCR(void);
+
+// Push MCR Event
+bool halPushMCR(void);
+
+// MCR timer adjustment. Negative value speed up the media clock. Positive values slow the media clock.
+// Will take effect during the next clock recovery interval. This is completely indepentant from pure MCR and
+// allows for adjustments based on media buffer levels. The value past in works as credit with each
+// MCR timer cycle bump up and down the clock temporarily.
+void halAdjustMCRNSec(S32 adjNSec);
+
+// The granularity is used to set coarseness of the values that will be passed into halAdjustMCRNSec.
+// This is used to balance if the timestamps or values from halAdjustMCRNSec are used to adjust the clock.
+void halAdjustMCRGranularityNSec(U32 adjGranularityNSec);
+
+
+#endif // OPENAVB_MCR_HAL_PUB_H
diff --git a/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.c b/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.c
index 95239bf0..753d3dfa 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.c
+++ b/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.c
@@ -1,39 +1,39 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include "openavb_ether_osal.h"
-
-// MAC address is retrieved differently for Linux
-bool osalGetMacAddr(U8 *macAddr)
-{
- return TRUE;
-}
-
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include "openavb_ether_osal.h"
+
+// MAC address is retrieved differently for Linux
+bool osalGetMacAddr(U8 *macAddr)
+{
+ return TRUE;
+}
+
+
diff --git a/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.h b/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.h
index a75d2ac6..95ddb88b 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.h
+++ b/lib/avtp_pipeline/platform/Linux/openavb_ether_osal.h
@@ -1,32 +1,32 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
#ifndef OPENAVB_ETHER_OSAL_H
#define OPENAVB_ETHER_OSAL_H 1
diff --git a/lib/avtp_pipeline/platform/Linux/openavb_osal.c b/lib/avtp_pipeline/platform/Linux/openavb_osal.c
index ba960ff6..94c42ab0 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_osal.c
+++ b/lib/avtp_pipeline/platform/Linux/openavb_osal.c
@@ -1,55 +1,55 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include "openavb_platform.h"
-#include "openavb_ether_hal.h"
-#include "openavb_osal.h"
-#include "openavb_qmgr.h"
-
-#define AVB_LOG_COMPONENT "osal"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-extern DLL_EXPORT bool osalAVBInitialize(const char* ifname)
-{
- avbLogInit();
- osalAVBTimeInit();
- openavbQmgrInitialize(FQTSS_MODE_HW_CLASS, 0, ifname, 0, 0, 0);
- return TRUE;
-}
-
-extern DLL_EXPORT bool osalAVBFinalize(void)
-{
- openavbQmgrFinalize();
- osalAVBTimeClose();
- avbLogExit();
- return TRUE;
-}
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include "openavb_platform.h"
+#include "openavb_ether_hal.h"
+#include "openavb_osal.h"
+#include "openavb_qmgr.h"
+
+#define AVB_LOG_COMPONENT "osal"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+extern DLL_EXPORT bool osalAVBInitialize(const char* ifname)
+{
+ avbLogInit();
+ osalAVBTimeInit();
+ openavbQmgrInitialize(FQTSS_MODE_HW_CLASS, 0, ifname, 0, 0, 0);
+ return TRUE;
+}
+
+extern DLL_EXPORT bool osalAVBFinalize(void)
+{
+ openavbQmgrFinalize();
+ osalAVBTimeClose();
+ avbLogExit();
+ 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 593155f4..5862c7d4 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c
+++ b/lib/avtp_pipeline/platform/Linux/openavb_osal_endpoint.c
@@ -1,56 +1,56 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include "openavb_platform.h"
-#include "openavb_ether_hal.h"
-#include "openavb_osal.h"
-#include "openavb_qmgr.h"
-#include "openavb_endpoint.h"
-
-#define AVB_LOG_COMPONENT "osal"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-extern DLL_EXPORT bool osalAVBInitialize(const char* ifname)
-{
- avbLogInit();
- osalAVBTimeInit();
- startEndpoint(FQTSS_MODE_HW_CLASS, 0, ifname, 0, 0, 0);
- return TRUE;
-}
-
-extern DLL_EXPORT bool osalAVBFinalize(void)
-{
- stopEndpoint();
- osalAVBTimeClose();
- avbLogExit();
- return TRUE;
-}
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include "openavb_platform.h"
+#include "openavb_ether_hal.h"
+#include "openavb_osal.h"
+#include "openavb_qmgr.h"
+#include "openavb_endpoint.h"
+
+#define AVB_LOG_COMPONENT "osal"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+extern DLL_EXPORT bool osalAVBInitialize(const char* ifname)
+{
+ avbLogInit();
+ osalAVBTimeInit();
+ startEndpoint(FQTSS_MODE_HW_CLASS, 0, ifname, 0, 0, 0);
+ return TRUE;
+}
+
+extern DLL_EXPORT bool osalAVBFinalize(void)
+{
+ stopEndpoint();
+ osalAVBTimeClose();
+ avbLogExit();
+ return TRUE;
+}
+
diff --git a/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c b/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c
index b287cf13..1ea07652 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c
+++ b/lib/avtp_pipeline/platform/Linux/openavb_time_osal.c
@@ -1,207 +1,206 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include <inttypes.h>
-#include <linux/ptp_clock.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-
-#include "igb.h"
-#include "avb.h"
-
-#include "openavb_platform.h"
-#include "openavb_time_osal.h"
-#include "openavb_time_hal.h"
-#include "openavb_trace.h"
-
-#define AVB_LOG_COMPONENT "osalTime"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-//#include "openavb_time_util_osal.h"
-
-static pthread_mutex_t gOSALTimeInitMutex = PTHREAD_MUTEX_INITIALIZER;
-#define LOCK() pthread_mutex_lock(&gOSALTimeInitMutex)
-#define UNLOCK() pthread_mutex_unlock(&gOSALTimeInitMutex)
-
-static bool bInitialized = FALSE;
-static int gIgbShmFd = -1;
-static char *gIgbMmap = NULL;
-gPtpTimeData gPtpTD;
-
-static bool x_timeInit(void) {
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
-
- if (!halTimeInitialize()) {
- AVB_LOG_ERROR("HAL Time Init failed");
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
- }
-
- if (gptpinit(&gIgbShmFd, &gIgbMmap) < 0) {
- AVB_LOG_ERROR("GPTP init failed");
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
- }
-
- if (gptpgetdata(gIgbMmap, &gPtpTD) < 0) {
- AVB_LOG_ERROR("GPTP data fetch failed");
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
- }
-
- AVB_LOGF_INFO("local_time = %" PRIu64, gPtpTD.local_time);
- AVB_LOGF_INFO("ml_phoffset = %" PRId64 ", ls_phoffset = %" PRId64, gPtpTD.ml_phoffset, gPtpTD.ls_phoffset);
- AVB_LOGF_INFO("ml_freqffset = %Lf, ls_freqoffset = %Lf", gPtpTD.ml_freqoffset, gPtpTD.ls_freqoffset);
-
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
-}
-
-static bool x_getPTPTime(U64 *timeNsec) {
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
-
- if (gptpgetdata(gIgbMmap, &gPtpTD) < 0) {
- AVB_LOG_ERROR("GPTP data fetch failed");
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
- }
-
- uint64_t now_local;
- uint64_t update_8021as;
- int64_t delta_8021as;
- int64_t delta_local;
-
- if (gptplocaltime(&gPtpTD, &now_local)) {
- update_8021as = gPtpTD.local_time - gPtpTD.ml_phoffset;
- delta_local = now_local - gPtpTD.local_time;
- delta_8021as = gPtpTD.ml_freqoffset * delta_local;
- *timeNsec = update_8021as + delta_8021as;
-
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
-}
-
-bool osalAVBTimeInit(void) {
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
-
- LOCK();
- if (!bInitialized) {
- if (x_timeInit())
- bInitialized = TRUE;
- }
- UNLOCK();
-
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
-}
-
-bool osalAVBTimeClose(void) {
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
-
- gptpdeinit(&gIgbShmFd, &gIgbMmap);
-
- halTimeFinalize();
-
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
-}
-
-bool osalClockGettime(openavb_clockId_t openavbClockId, struct timespec *getTime) {
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
-
- if (openavbClockId < OPENAVB_CLOCK_WALLTIME) {
- clockid_t clockId = CLOCK_MONOTONIC;
- switch (openavbClockId) {
- case OPENAVB_CLOCK_REALTIME:
- clockId = CLOCK_REALTIME;
- break;
- case OPENAVB_CLOCK_MONOTONIC:
- clockId = CLOCK_MONOTONIC;
- break;
- case OPENAVB_TIMER_CLOCK:
- clockId = CLOCK_MONOTONIC;
- break;
- case OPENAVB_CLOCK_WALLTIME:
- break;
- }
- if (!clock_gettime(clockId, getTime)) return TRUE;
- }
- else if (openavbClockId == OPENAVB_CLOCK_WALLTIME) {
- U64 timeNsec;
- if (!x_getPTPTime(&timeNsec)) {
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
- }
- getTime->tv_sec = timeNsec / NANOSECONDS_PER_SECOND;
- getTime->tv_nsec = timeNsec % NANOSECONDS_PER_SECOND;
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
- }
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
-}
-
-bool osalClockGettime64(openavb_clockId_t openavbClockId, U64 *timeNsec) {
- if (openavbClockId < OPENAVB_CLOCK_WALLTIME) {
- clockid_t clockId = CLOCK_MONOTONIC;
- switch (openavbClockId) {
- case OPENAVB_CLOCK_REALTIME:
- clockId = CLOCK_REALTIME;
- break;
- case OPENAVB_CLOCK_MONOTONIC:
- clockId = CLOCK_MONOTONIC;
- break;
- case OPENAVB_TIMER_CLOCK:
- clockId = CLOCK_MONOTONIC;
- break;
- case OPENAVB_CLOCK_WALLTIME:
- break;
- }
- struct timespec getTime;
- if (!clock_gettime(clockId, &getTime)) {
- *timeNsec = ((U64)getTime.tv_sec * (U64)NANOSECONDS_PER_SECOND) + (U64)getTime.tv_nsec;
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
- }
- }
- else if (openavbClockId == OPENAVB_CLOCK_WALLTIME) {
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return x_getPTPTime(timeNsec);
- }
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
-}
-
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include <inttypes.h>
+#include <linux/ptp_clock.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+
+#include "igb.h"
+#include "avb.h"
+
+#include "openavb_platform.h"
+#include "openavb_time_osal.h"
+#include "openavb_time_hal.h"
+#include "openavb_trace.h"
+
+#define AVB_LOG_COMPONENT "osalTime"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+//#include "openavb_time_util_osal.h"
+
+static pthread_mutex_t gOSALTimeInitMutex = PTHREAD_MUTEX_INITIALIZER;
+#define LOCK() pthread_mutex_lock(&gOSALTimeInitMutex)
+#define UNLOCK() pthread_mutex_unlock(&gOSALTimeInitMutex)
+
+static bool bInitialized = FALSE;
+static int gIgbShmFd = -1;
+static char *gIgbMmap = NULL;
+gPtpTimeData gPtpTD;
+
+static bool x_timeInit(void) {
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+
+ if (!halTimeInitialize()) {
+ AVB_LOG_ERROR("HAL Time Init failed");
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+ }
+
+ if (gptpinit(&gIgbShmFd, &gIgbMmap) < 0) {
+ AVB_LOG_ERROR("GPTP init failed");
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+ }
+
+ if (gptpgetdata(gIgbMmap, &gPtpTD) < 0) {
+ AVB_LOG_ERROR("GPTP data fetch failed");
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+ }
+
+ AVB_LOGF_INFO("local_time = %" PRIu64, gPtpTD.local_time);
+ AVB_LOGF_INFO("ml_phoffset = %" PRId64 ", ls_phoffset = %" PRId64, gPtpTD.ml_phoffset, gPtpTD.ls_phoffset);
+ AVB_LOGF_INFO("ml_freqffset = %Lf, ls_freqoffset = %Lf", gPtpTD.ml_freqoffset, gPtpTD.ls_freqoffset);
+
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+}
+
+static bool x_getPTPTime(U64 *timeNsec) {
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+
+ if (gptpgetdata(gIgbMmap, &gPtpTD) < 0) {
+ AVB_LOG_ERROR("GPTP data fetch failed");
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+ }
+
+ uint64_t now_local;
+ uint64_t update_8021as;
+ int64_t delta_8021as;
+ int64_t delta_local;
+
+ if (gptplocaltime(&gPtpTD, &now_local)) {
+ update_8021as = gPtpTD.local_time - gPtpTD.ml_phoffset;
+ delta_local = now_local - gPtpTD.local_time;
+ delta_8021as = gPtpTD.ml_freqoffset * delta_local;
+ *timeNsec = update_8021as + delta_8021as;
+
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+}
+
+bool osalAVBTimeInit(void) {
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+
+ LOCK();
+ if (!bInitialized) {
+ if (x_timeInit())
+ bInitialized = TRUE;
+ }
+ UNLOCK();
+
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+}
+
+bool osalAVBTimeClose(void) {
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+
+ gptpdeinit(&gIgbShmFd, &gIgbMmap);
+
+ halTimeFinalize();
+
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+}
+
+bool osalClockGettime(openavb_clockId_t openavbClockId, struct timespec *getTime) {
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+
+ if (openavbClockId < OPENAVB_CLOCK_WALLTIME) {
+ clockid_t clockId = CLOCK_MONOTONIC;
+ switch (openavbClockId) {
+ case OPENAVB_CLOCK_REALTIME:
+ clockId = CLOCK_REALTIME;
+ break;
+ case OPENAVB_CLOCK_MONOTONIC:
+ clockId = CLOCK_MONOTONIC;
+ break;
+ case OPENAVB_TIMER_CLOCK:
+ clockId = CLOCK_MONOTONIC;
+ break;
+ case OPENAVB_CLOCK_WALLTIME:
+ break;
+ }
+ if (!clock_gettime(clockId, getTime)) return TRUE;
+ }
+ else if (openavbClockId == OPENAVB_CLOCK_WALLTIME) {
+ U64 timeNsec;
+ if (!x_getPTPTime(&timeNsec)) {
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+ }
+ getTime->tv_sec = timeNsec / NANOSECONDS_PER_SECOND;
+ getTime->tv_nsec = timeNsec % NANOSECONDS_PER_SECOND;
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+ }
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+}
+
+bool osalClockGettime64(openavb_clockId_t openavbClockId, U64 *timeNsec) {
+ if (openavbClockId < OPENAVB_CLOCK_WALLTIME) {
+ clockid_t clockId = CLOCK_MONOTONIC;
+ switch (openavbClockId) {
+ case OPENAVB_CLOCK_REALTIME:
+ clockId = CLOCK_REALTIME;
+ break;
+ case OPENAVB_CLOCK_MONOTONIC:
+ clockId = CLOCK_MONOTONIC;
+ break;
+ case OPENAVB_TIMER_CLOCK:
+ clockId = CLOCK_MONOTONIC;
+ break;
+ case OPENAVB_CLOCK_WALLTIME:
+ break;
+ }
+ struct timespec getTime;
+ if (!clock_gettime(clockId, &getTime)) {
+ *timeNsec = ((U64)getTime.tv_sec * (U64)NANOSECONDS_PER_SECOND) + (U64)getTime.tv_nsec;
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+ }
+ }
+ else if (openavbClockId == OPENAVB_CLOCK_WALLTIME) {
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return x_getPTPTime(timeNsec);
+ }
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+}
+
diff --git a/lib/avtp_pipeline/platform/Linux/openavb_time_osal.h b/lib/avtp_pipeline/platform/Linux/openavb_time_osal.h
index 3fa07afd..293f7c3c 100644
--- a/lib/avtp_pipeline/platform/Linux/openavb_time_osal.h
+++ b/lib/avtp_pipeline/platform/Linux/openavb_time_osal.h
@@ -1,33 +1,33 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
#ifndef _OPENAVB_TIME_OSAL_H
#define _OPENAVB_TIME_OSAL_H
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.c b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.c
index deb113b9..260c69f2 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.c
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.c
@@ -1,39 +1,39 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include <malloc.h>
-
-void tcalGetHeapInfo(unsigned int *ttlMallocHeap, unsigned int *freeMallocHeap)
-{
- struct mallinfo minfo = mallinfo();
-
- *ttlMallocHeap = (minfo.arena + minfo.fordblks);
- *freeMallocHeap = minfo.fordblks;
-}
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include <malloc.h>
+
+void tcalGetHeapInfo(unsigned int *ttlMallocHeap, unsigned int *freeMallocHeap)
+{
+ struct mallinfo minfo = mallinfo();
+
+ *ttlMallocHeap = (minfo.arena + minfo.fordblks);
+ *freeMallocHeap = minfo.fordblks;
+}
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.h b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.h
index 046ab971..6060be93 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal.h
@@ -1,37 +1,37 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef OPENAVB_MEM_TCAL_H
-#define OPENAVB_MEM_TCAL_H 1
-
-void tcalGetHeapInfo(unsigned int *ttlMallocHeap, unsigned int *freeMallocHeap);
-
-#endif // OPENAVB_MEM_TCAL_H
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef OPENAVB_MEM_TCAL_H
+#define OPENAVB_MEM_TCAL_H 1
+
+void tcalGetHeapInfo(unsigned int *ttlMallocHeap, unsigned int *freeMallocHeap);
+
+#endif // OPENAVB_MEM_TCAL_H
+
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal_pub.h b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal_pub.h
index b6d3b239..d1624e77 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal_pub.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_mem_tcal_pub.h
@@ -1,38 +1,38 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef OPENAVB_MEM_TCAL_PUB_H
-#define OPENAVB_MEM_TCAL_PUB_H 1
-
-#include <stdlib.h>
-#include <stdint.h>
-
-#endif // OPENAVB_MEM_TCAL_PUB_H
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef OPENAVB_MEM_TCAL_PUB_H
+#define OPENAVB_MEM_TCAL_PUB_H 1
+
+#include <stdlib.h>
+#include <stdint.h>
+
+#endif // OPENAVB_MEM_TCAL_PUB_H
+
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_tcal_pub.h b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_tcal_pub.h
index f3bb489b..2193e4b1 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_tcal_pub.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_tcal_pub.h
@@ -1,38 +1,38 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef OPENAVB_TCAL_PUB_H
-#define OPENAVB_TCAL_PUB_H 1
-
-// Logging Extra Newline. Some platforms libraries require an extra newline
-static const bool OPENAVB_TCAL_LOG_EXTRA_NEWLINE = TRUE;
-
-#endif // OPENAVB_TCAL_PUB_H
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef OPENAVB_TCAL_PUB_H
+#define OPENAVB_TCAL_PUB_H 1
+
+// Logging Extra Newline. Some platforms libraries require an extra newline
+static const bool OPENAVB_TCAL_LOG_EXTRA_NEWLINE = TRUE;
+
+#endif // OPENAVB_TCAL_PUB_H
+
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_time_tcal_pub.h b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_time_tcal_pub.h
index 4afe007e..216adec0 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_time_tcal_pub.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_time_tcal_pub.h
@@ -1,49 +1,49 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef _OPENAVB_TIME_TCAL_PUB_H
-#define _OPENAVB_TIME_TCAL_PUB_H
-
-#if PROVIDED_BY_PLATFORM
-typedef int clockid_t;
-#endif
-
-#if PROVIDED_BY_PLATFORM
-struct timespec {
- long tv_sec; /* seconds */
- long tv_nsec; /* nanoseconds */
-};
-struct itimerspec {
- struct timespec it_interval; /* timer period */
- struct timespec it_value; /* timer expiration */
-};
-#endif
-
-#endif // _OPENAVB_TIME_TCAL_PUB_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef _OPENAVB_TIME_TCAL_PUB_H
+#define _OPENAVB_TIME_TCAL_PUB_H
+
+#if PROVIDED_BY_PLATFORM
+typedef int clockid_t;
+#endif
+
+#if PROVIDED_BY_PLATFORM
+struct timespec {
+ long tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+struct itimerspec {
+ struct timespec it_interval; /* timer period */
+ struct timespec it_value; /* timer expiration */
+};
+#endif
+
+#endif // _OPENAVB_TIME_TCAL_PUB_H
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_types_base_tcal_pub.h b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_types_base_tcal_pub.h
index 5f4da71e..64d7d6ba 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_types_base_tcal_pub.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_types_base_tcal_pub.h
@@ -1,40 +1,40 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef AVB_TYPES_BASE_TCAL_PUB_H
-#define AVB_TYPES_BASE_TCAL_PUB_H 1
-
-#define OPENAVB_PRAGMA(arg) _Pragma(#arg)
-
-#define OPENAVB_CODE_FUNCTION_PRI
-#define OPENAVB_CODE_MODULE_PRI
-#define OPENAVB_DATA_PRI
-
-#endif // AVB_TYPES_BASE_TCAL_PUB_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef AVB_TYPES_BASE_TCAL_PUB_H
+#define AVB_TYPES_BASE_TCAL_PUB_H 1
+
+#define OPENAVB_PRAGMA(arg) _Pragma(#arg)
+
+#define OPENAVB_CODE_FUNCTION_PRI
+#define OPENAVB_CODE_MODULE_PRI
+#define OPENAVB_DATA_PRI
+
+#endif // AVB_TYPES_BASE_TCAL_PUB_H
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_warnings_tcal.h b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_warnings_tcal.h
index 637910a2..8da12fd1 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_warnings_tcal.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/openavb_warnings_tcal.h
@@ -1,37 +1,37 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef OPENAVB_WARNINGS_TCAL_H
-#define OPENAVB_WARNINGS_TCAL_H 1
-
-#define OPENAVB_SUPPRESS_WARNING_UNREACHABLE_CODE()
-
-#endif // OPENAVB_WARNINGS_TCAL_H
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef OPENAVB_WARNINGS_TCAL_H
+#define OPENAVB_WARNINGS_TCAL_H 1
+
+#define OPENAVB_SUPPRESS_WARNING_UNREACHABLE_CODE()
+
+#endif // OPENAVB_WARNINGS_TCAL_H
+
diff --git a/lib/avtp_pipeline/platform/platTCAL/GNU/rawsock/openavb_rawsock_tcal.h b/lib/avtp_pipeline/platform/platTCAL/GNU/rawsock/openavb_rawsock_tcal.h
index 460cf50e..72934112 100644
--- a/lib/avtp_pipeline/platform/platTCAL/GNU/rawsock/openavb_rawsock_tcal.h
+++ b/lib/avtp_pipeline/platform/platTCAL/GNU/rawsock/openavb_rawsock_tcal.h
@@ -1,59 +1,59 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef OPENAVB_RAWSOCK_TCAL_H
-#define OPENAVB_RAWSOCK_TCAL_H 1
-
-
-// Ethernet header
-typedef struct {
- U8 dhost[ETH_ALEN];
- U8 shost[ETH_ALEN];
- uint16_t ethertype;
-}
-__attribute__ ((__packed__)) eth_hdr_t;
-
-// VLAN tag
-typedef struct {
- uint16_t tpip;
- uint16_t bits;
-}
-__attribute__ ((__packed__)) vlan_tag_t;
-
-// Ethernet header w/VLAN tag
-typedef struct {
- U8 dhost[ETH_ALEN];
- U8 shost[ETH_ALEN];
- vlan_tag_t vlan;
- uint16_t ethertype;
-}
-__attribute__ ((__packed__)) eth_vlan_hdr_t;
-
-#endif // OPENAVB_RAWSOCK_TCAL_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef OPENAVB_RAWSOCK_TCAL_H
+#define OPENAVB_RAWSOCK_TCAL_H 1
+
+
+// Ethernet header
+typedef struct {
+ U8 dhost[ETH_ALEN];
+ U8 shost[ETH_ALEN];
+ uint16_t ethertype;
+}
+__attribute__ ((__packed__)) eth_hdr_t;
+
+// VLAN tag
+typedef struct {
+ uint16_t tpip;
+ uint16_t bits;
+}
+__attribute__ ((__packed__)) vlan_tag_t;
+
+// Ethernet header w/VLAN tag
+typedef struct {
+ U8 dhost[ETH_ALEN];
+ U8 shost[ETH_ALEN];
+ vlan_tag_t vlan;
+ uint16_t ethertype;
+}
+__attribute__ ((__packed__)) eth_vlan_hdr_t;
+
+#endif // OPENAVB_RAWSOCK_TCAL_H
diff --git a/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.c b/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.c
index 5dee1f6f..6cdd873e 100644
--- a/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.c
+++ b/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.c
@@ -1,62 +1,62 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#define AVB_LOG_COMPONENT "MCR"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-#include "openavb_mcr_hal.h"
-
-
-bool halInitMCR(U32 packetRate, U32 pushInterval, U32 timestampInterval, U32 recoveryInterval)
-{
- return TRUE;
-}
-
-bool halCloseMCR(void)
-{
- return TRUE;
-}
-
-bool halPushMCR(void)
-{
- return TRUE;
-}
-
-void halAdjustMCRNSec(S32 adjNSec)
-{
-}
-
-void halAdjustMCRGranularityNSec(U32 adjGranularityNSec)
-{
-}
-
-
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#define AVB_LOG_COMPONENT "MCR"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+#include "openavb_mcr_hal.h"
+
+
+bool halInitMCR(U32 packetRate, U32 pushInterval, U32 timestampInterval, U32 recoveryInterval)
+{
+ return TRUE;
+}
+
+bool halCloseMCR(void)
+{
+ return TRUE;
+}
+
+bool halPushMCR(void)
+{
+ return TRUE;
+}
+
+void halAdjustMCRNSec(S32 adjNSec)
+{
+}
+
+void halAdjustMCRGranularityNSec(U32 adjGranularityNSec)
+{
+}
+
+
+
diff --git a/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.h b/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.h
index a458b262..85579122 100644
--- a/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.h
+++ b/lib/avtp_pipeline/platform/x86_i210/mcr/openavb_mcr_hal.h
@@ -1,37 +1,37 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef OPENAVB_MCR_HAL_H
-#define OPENAVB_MCR_HAL_H
-
-#include "openavb_platform.h"
-#include "openavb_mcr_hal_pub.h"
-
-#endif // OPENAVB_MCR_HAL_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef OPENAVB_MCR_HAL_H
+#define OPENAVB_MCR_HAL_H
+
+#include "openavb_platform.h"
+#include "openavb_mcr_hal_pub.h"
+
+#endif // OPENAVB_MCR_HAL_H
diff --git a/lib/avtp_pipeline/platform/x86_i210/openavb_hal.h b/lib/avtp_pipeline/platform/x86_i210/openavb_hal.h
index 58d077a0..a12e4dba 100644
--- a/lib/avtp_pipeline/platform/x86_i210/openavb_hal.h
+++ b/lib/avtp_pipeline/platform/x86_i210/openavb_hal.h
@@ -1,38 +1,38 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#ifndef _OPENAVB_HAL_H
-#define _OPENAVB_HAL_H
-
-// Note this remains for backwards compatabilty with older prots. See openavb_mcr_hall_pub.h for newer APIs
-// halPushMCR() API not defined
-#define HAL_PUSH_MCR(mcrTimeStampPtr) FALSE
-
-#endif // _OPENAVB_HAL_H
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#ifndef _OPENAVB_HAL_H
+#define _OPENAVB_HAL_H
+
+// Note this remains for backwards compatabilty with older prots. See openavb_mcr_hall_pub.h for newer APIs
+// halPushMCR() API not defined
+#define HAL_PUSH_MCR(mcrTimeStampPtr) FALSE
+
+#endif // _OPENAVB_HAL_H
diff --git a/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.c b/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.c
index 1a07a4bb..5b96224a 100644
--- a/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.c
+++ b/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.c
@@ -1,72 +1,72 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include "openavb_platform.h"
-#include "openavb_time_hal.h"
-#include "openavb_ether_hal.h"
-
-#include "openavb_trace.h"
-
-#define AVB_LOG_COMPONENT "halTime"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-static device_t *igb_dev = NULL;
-
-bool halTimeInitialize(void)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
- igb_dev = igbAcquireDevice();
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
-}
-
-bool halTimeFinalize(void)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
- igbReleaseDevice(igb_dev);
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
-}
-
-bool halTimeGetLocaltime(U64 *localTime64)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TIME);
-
- if (igb_get_wallclock(igb_dev, localTime64, NULL ) > 0) {
- IF_LOG_INTERVAL(1000) AVB_LOG_ERROR("Failed to get wallclock time");
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TIME);
- return TRUE;
-}
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include "openavb_platform.h"
+#include "openavb_time_hal.h"
+#include "openavb_ether_hal.h"
+
+#include "openavb_trace.h"
+
+#define AVB_LOG_COMPONENT "halTime"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+static device_t *igb_dev = NULL;
+
+bool halTimeInitialize(void)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+ igb_dev = igbAcquireDevice();
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+}
+
+bool halTimeFinalize(void)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+ igbReleaseDevice(igb_dev);
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+}
+
+bool halTimeGetLocaltime(U64 *localTime64)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TIME);
+
+ if (igb_get_wallclock(igb_dev, localTime64, NULL ) > 0) {
+ IF_LOG_INTERVAL(1000) AVB_LOG_ERROR("Failed to get wallclock time");
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TIME);
+ return TRUE;
+}
+
diff --git a/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.h b/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.h
index 9bd04048..a36b004e 100644
--- a/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.h
+++ b/lib/avtp_pipeline/platform/x86_i210/openavb_time_hal.h
@@ -1,38 +1,38 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
#ifndef _OPENAVB_TIME_HAL_H
#define _OPENAVB_TIME_HAL_H
-
-bool halTimeInitialize(void);
-bool halTimeFinalize(void);
-bool halTimeGetLocaltime(U64 *localTime64);
+
+bool halTimeInitialize(void);
+bool halTimeFinalize(void);
+bool halTimeGetLocaltime(U64 *localTime64);
#endif // _OPENAVB_TIME_HAL_H
diff --git a/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c b/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c
index 877d1c18..d60de0cb 100644
--- a/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c
@@ -1,80 +1,80 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : Listener implementation
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "openavb_platform.h"
-#include "openavb_tl.h"
-#include "openavb_avtp.h"
-#include "openavb_listener.h"
-#include "openavb_endpoint.h"
-
-#define AVB_LOG_COMPONENT "Listener"
-#include "openavb_log.h"
-#include "openavb_trace.h"
-
-bool openavbTLRunListenerInit(int hnd, AVBStreamID_t *streamID)
-{
- tl_state_t *pTLState = TLHandleListGet(hnd);
- openavb_tl_cfg_t *pCfg = &pTLState->cfg;
- listener_data_t *pListenerData = pTLState->pPvtListenerData;
-
- strncpy(pListenerData->ifname, pCfg->ifname, IFNAMSIZ);
- memcpy(&pListenerData->streamID.addr, &pCfg->stream_addr.mac->ether_addr_octet, ETH_ALEN);
- pListenerData->streamID.uniqueID = pCfg->stream_uid;
- memcpy(&pListenerData->destAddr, &pCfg->dest_addr.mac->ether_addr_octet, ETH_ALEN);
- pListenerData->tSpec.maxIntervalFrames = pCfg->max_interval_frames;
- pListenerData->tSpec.maxFrameSize = pCfg->max_frame_size;
-
- AVB_LOGF_INFO("Dest Addr: "ETH_FORMAT, ETH_OCTETS(pListenerData->destAddr));
- AVB_LOGF_INFO("Starting stream: "STREAMID_FORMAT, STREAMID_ARGS(streamID));
- listenerStartStream(pTLState);
-
- return TRUE;
-}
-
-
-void openavbEptClntNotifyLstnrOfSrpCb(int endpointHandle,
- AVBStreamID_t *streamID,
- char *ifname,
- U8 destAddr[],
- openavbSrpAttribType_t tlkrDecl,
- AVBTSpec_t *tSpec,
- U8 srClassID,
- U32 latency,
- openavbSrpFailInfo_t *failInfo)
-{
-}
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : Listener implementation
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "openavb_platform.h"
+#include "openavb_tl.h"
+#include "openavb_avtp.h"
+#include "openavb_listener.h"
+#include "openavb_endpoint.h"
+
+#define AVB_LOG_COMPONENT "Listener"
+#include "openavb_log.h"
+#include "openavb_trace.h"
+
+bool openavbTLRunListenerInit(int hnd, AVBStreamID_t *streamID)
+{
+ tl_state_t *pTLState = TLHandleListGet(hnd);
+ openavb_tl_cfg_t *pCfg = &pTLState->cfg;
+ listener_data_t *pListenerData = pTLState->pPvtListenerData;
+
+ strncpy(pListenerData->ifname, pCfg->ifname, IFNAMSIZ);
+ memcpy(&pListenerData->streamID.addr, &pCfg->stream_addr.mac->ether_addr_octet, ETH_ALEN);
+ pListenerData->streamID.uniqueID = pCfg->stream_uid;
+ memcpy(&pListenerData->destAddr, &pCfg->dest_addr.mac->ether_addr_octet, ETH_ALEN);
+ pListenerData->tSpec.maxIntervalFrames = pCfg->max_interval_frames;
+ pListenerData->tSpec.maxFrameSize = pCfg->max_frame_size;
+
+ AVB_LOGF_INFO("Dest Addr: "ETH_FORMAT, ETH_OCTETS(pListenerData->destAddr));
+ AVB_LOGF_INFO("Starting stream: "STREAMID_FORMAT, STREAMID_ARGS(streamID));
+ listenerStartStream(pTLState);
+
+ return TRUE;
+}
+
+
+void openavbEptClntNotifyLstnrOfSrpCb(int endpointHandle,
+ AVBStreamID_t *streamID,
+ char *ifname,
+ U8 destAddr[],
+ openavbSrpAttribType_t tlkrDecl,
+ AVBTSpec_t *tSpec,
+ U8 srClassID,
+ U32 latency,
+ openavbSrpFailInfo_t *failInfo)
+{
+}
+
diff --git a/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c b/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c
index d7e08225..042801e3 100644
--- a/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c
@@ -1,151 +1,151 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : Talker implementation for use without endpoint
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "openavb_tl.h"
-#include "openavb_avtp.h"
-#include "openavb_talker.h"
-#include "openavb_qmgr.h"
-#include "openavb_endpoint.h"
-
-#define AVB_LOG_COMPONENT "Talker"
-#include "openavb_log.h"
-#include "openavb_trace.h"
-
-// SR Class default Priority (PCP) values per IEEE 802.1Q-2011 Table 6-6
-#define SR_CLASS_A_DEFAULT_PRIORITY 3
-#define SR_CLASS_B_DEFAULT_PRIORITY 2
-
-// SR Class default VLAN Id values per IEEE 802.1Q-2011 Table 9-2
-#define SR_CLASS_A_DEFAULT_VID 2
-#define SR_CLASS_B_DEFAULT_VID 2
-
-// Returns TRUE, to say we're connected and registers tspec with FQTSS tspec should be initialized
-bool openavbTLRunTalkerInit(tl_state_t *pTLState)
-{
- openavb_tl_cfg_t *pCfg = &pTLState->cfg;
- talker_data_t *pTalkerData = pTLState->pPvtTalkerData;
- //avtp_stream_t *pStream = (avtp_stream_t *)(pTalkerData->avtpHandle);
-
- strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
-
- // CORE_TODO: It would be good to have some parts of endpoint moved into non-endpoint general code to handle some the stream
- // configuration values.
- // strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
- if (pCfg->stream_addr.mac) {
- memcpy(pTalkerData->streamID.addr, pCfg->stream_addr.mac, ETH_ALEN);
- }else {
- AVB_LOG_WARNING("Stream Address Not Set");
- }
-
- pTalkerData->streamID.uniqueID = pCfg->stream_uid;
- if (pCfg->sr_class == SR_CLASS_A) {
- pTalkerData->classRate = 8000;
- pTalkerData->vlanID = pCfg->vlan_id == VLAN_NULL ?
- SR_CLASS_A_DEFAULT_VID : pCfg->vlan_id;
- pTalkerData->vlanPCP = SR_CLASS_A_DEFAULT_PRIORITY;
- }
- else if (pCfg->sr_class == SR_CLASS_B) {
- pTalkerData->classRate = 4000;
- pTalkerData->vlanID = pCfg->vlan_id == VLAN_NULL ?
- SR_CLASS_B_DEFAULT_VID : pCfg->vlan_id;
- pTalkerData->vlanPCP = SR_CLASS_B_DEFAULT_PRIORITY;
- }
- memcpy(&pTalkerData->destAddr, &pCfg->dest_addr.mac->ether_addr_octet, ETH_ALEN);
-
- unsigned int maxBitrate = 0;
- if (pCfg->intf_cb.intf_get_src_bitrate_cb != NULL) {
- maxBitrate = pCfg->intf_cb.intf_get_src_bitrate_cb(pTLState->pMediaQ);
- }
- if (maxBitrate > 0) {
- if (pCfg->map_cb.map_set_src_bitrate_cb != NULL) {
- pCfg->map_cb.map_set_src_bitrate_cb(pTLState->pMediaQ, maxBitrate);
- }
-
- if (pCfg->map_cb.map_get_max_interval_frames_cb != NULL) {
- unsigned int map_intv_frames = pCfg->map_cb.map_get_max_interval_frames_cb(pTLState->pMediaQ, pTLState->cfg.sr_class);
- pCfg->max_interval_frames = map_intv_frames > 0 ? map_intv_frames : pCfg->max_interval_frames;
- }
- }
- pTalkerData->tSpec.maxIntervalFrames = pCfg->max_interval_frames;
- pTalkerData->tSpec.maxFrameSize = pCfg->map_cb.map_max_data_size_cb(pTLState->pMediaQ);
-
- // TODO_COREAVB : This wakeRate should also be set in the endpoint case and removed from the tasker.c start stream
- if (!pCfg->map_cb.map_transmit_interval_cb(pTLState->pMediaQ)) {
- pTalkerData->wakeRate = pTalkerData->classRate / pCfg->batch_factor;
- }
- else {
- // Override the class observation interval with the one provided by the mapping module.
- pTalkerData->wakeRate = pCfg->map_cb.map_transmit_interval_cb(pTLState->pMediaQ) / pCfg->batch_factor;
- }
-
- if_info_t ifinfo;
- openavbCheckInterface(pTalkerData->ifname, &ifinfo);
-
- pTalkerData->fwmark = openavbQmgrAddStream((SRClassIdx_t)pCfg->sr_class,
- pTalkerData->wakeRate,
- pTalkerData->tSpec.maxIntervalFrames,
- pTalkerData->tSpec.maxFrameSize);
-
- if (pTalkerData->fwmark == INVALID_FWMARK)
- return FALSE;
-
- AVB_LOGF_INFO("Dest Addr: "ETH_FORMAT, ETH_OCTETS(pTalkerData->destAddr));
- AVB_LOGF_INFO("Starting stream: "STREAMID_FORMAT, STREAMID_ARGS(&pTalkerData->streamID));
- talkerStartStream(pTLState);
-
- return TRUE;
-}
-
-void openavbTLRunTalkerFinish(tl_state_t *pTLState)
-{
- talker_data_t *pTalkerData = pTLState->pPvtTalkerData;
- openavbQmgrRemoveStream(pTalkerData->fwmark);
-}
-
-void openavbEptClntNotifyTlkrOfSrpCb(
-int endpointHandle,
-AVBStreamID_t *streamID,
-char *ifname,
-U8 destAddr[],
-openavbSrpLsnrDeclSubtype_t lsnrDecl,
-U32 classRate,
-U16 vlanID,
-U8 priority,
-U16 fwmark)
-{
-}
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : Talker implementation for use without endpoint
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "openavb_tl.h"
+#include "openavb_avtp.h"
+#include "openavb_talker.h"
+#include "openavb_qmgr.h"
+#include "openavb_endpoint.h"
+
+#define AVB_LOG_COMPONENT "Talker"
+#include "openavb_log.h"
+#include "openavb_trace.h"
+
+// SR Class default Priority (PCP) values per IEEE 802.1Q-2011 Table 6-6
+#define SR_CLASS_A_DEFAULT_PRIORITY 3
+#define SR_CLASS_B_DEFAULT_PRIORITY 2
+
+// SR Class default VLAN Id values per IEEE 802.1Q-2011 Table 9-2
+#define SR_CLASS_A_DEFAULT_VID 2
+#define SR_CLASS_B_DEFAULT_VID 2
+
+// Returns TRUE, to say we're connected and registers tspec with FQTSS tspec should be initialized
+bool openavbTLRunTalkerInit(tl_state_t *pTLState)
+{
+ openavb_tl_cfg_t *pCfg = &pTLState->cfg;
+ talker_data_t *pTalkerData = pTLState->pPvtTalkerData;
+ //avtp_stream_t *pStream = (avtp_stream_t *)(pTalkerData->avtpHandle);
+
+ strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
+
+ // CORE_TODO: It would be good to have some parts of endpoint moved into non-endpoint general code to handle some the stream
+ // configuration values.
+ // strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
+ if (pCfg->stream_addr.mac) {
+ memcpy(pTalkerData->streamID.addr, pCfg->stream_addr.mac, ETH_ALEN);
+ }else {
+ AVB_LOG_WARNING("Stream Address Not Set");
+ }
+
+ pTalkerData->streamID.uniqueID = pCfg->stream_uid;
+ if (pCfg->sr_class == SR_CLASS_A) {
+ pTalkerData->classRate = 8000;
+ pTalkerData->vlanID = pCfg->vlan_id == VLAN_NULL ?
+ SR_CLASS_A_DEFAULT_VID : pCfg->vlan_id;
+ pTalkerData->vlanPCP = SR_CLASS_A_DEFAULT_PRIORITY;
+ }
+ else if (pCfg->sr_class == SR_CLASS_B) {
+ pTalkerData->classRate = 4000;
+ pTalkerData->vlanID = pCfg->vlan_id == VLAN_NULL ?
+ SR_CLASS_B_DEFAULT_VID : pCfg->vlan_id;
+ pTalkerData->vlanPCP = SR_CLASS_B_DEFAULT_PRIORITY;
+ }
+ memcpy(&pTalkerData->destAddr, &pCfg->dest_addr.mac->ether_addr_octet, ETH_ALEN);
+
+ unsigned int maxBitrate = 0;
+ if (pCfg->intf_cb.intf_get_src_bitrate_cb != NULL) {
+ maxBitrate = pCfg->intf_cb.intf_get_src_bitrate_cb(pTLState->pMediaQ);
+ }
+ if (maxBitrate > 0) {
+ if (pCfg->map_cb.map_set_src_bitrate_cb != NULL) {
+ pCfg->map_cb.map_set_src_bitrate_cb(pTLState->pMediaQ, maxBitrate);
+ }
+
+ if (pCfg->map_cb.map_get_max_interval_frames_cb != NULL) {
+ unsigned int map_intv_frames = pCfg->map_cb.map_get_max_interval_frames_cb(pTLState->pMediaQ, pTLState->cfg.sr_class);
+ pCfg->max_interval_frames = map_intv_frames > 0 ? map_intv_frames : pCfg->max_interval_frames;
+ }
+ }
+ pTalkerData->tSpec.maxIntervalFrames = pCfg->max_interval_frames;
+ pTalkerData->tSpec.maxFrameSize = pCfg->map_cb.map_max_data_size_cb(pTLState->pMediaQ);
+
+ // TODO_COREAVB : This wakeRate should also be set in the endpoint case and removed from the tasker.c start stream
+ if (!pCfg->map_cb.map_transmit_interval_cb(pTLState->pMediaQ)) {
+ pTalkerData->wakeRate = pTalkerData->classRate / pCfg->batch_factor;
+ }
+ else {
+ // Override the class observation interval with the one provided by the mapping module.
+ pTalkerData->wakeRate = pCfg->map_cb.map_transmit_interval_cb(pTLState->pMediaQ) / pCfg->batch_factor;
+ }
+
+ if_info_t ifinfo;
+ openavbCheckInterface(pTalkerData->ifname, &ifinfo);
+
+ pTalkerData->fwmark = openavbQmgrAddStream((SRClassIdx_t)pCfg->sr_class,
+ pTalkerData->wakeRate,
+ pTalkerData->tSpec.maxIntervalFrames,
+ pTalkerData->tSpec.maxFrameSize);
+
+ if (pTalkerData->fwmark == INVALID_FWMARK)
+ return FALSE;
+
+ AVB_LOGF_INFO("Dest Addr: "ETH_FORMAT, ETH_OCTETS(pTalkerData->destAddr));
+ AVB_LOGF_INFO("Starting stream: "STREAMID_FORMAT, STREAMID_ARGS(&pTalkerData->streamID));
+ talkerStartStream(pTLState);
+
+ return TRUE;
+}
+
+void openavbTLRunTalkerFinish(tl_state_t *pTLState)
+{
+ talker_data_t *pTalkerData = pTLState->pPvtTalkerData;
+ openavbQmgrRemoveStream(pTalkerData->fwmark);
+}
+
+void openavbEptClntNotifyTlkrOfSrpCb(
+int endpointHandle,
+AVBStreamID_t *streamID,
+char *ifname,
+U8 destAddr[],
+openavbSrpLsnrDeclSubtype_t lsnrDecl,
+U32 classRate,
+U16 vlanID,
+U8 priority,
+U16 fwmark)
+{
+}
+
diff --git a/lib/avtp_pipeline/tl/openavb_tl.c b/lib/avtp_pipeline/tl/openavb_tl.c
index eb9ee145..256f7051 100755
--- a/lib/avtp_pipeline/tl/openavb_tl.c
+++ b/lib/avtp_pipeline/tl/openavb_tl.c
@@ -1,734 +1,734 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : Common implementation for the talker and listener
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "openavb_tl.h"
-#include "openavb_trace.h"
-#include "openavb_mediaq.h"
-#include "openavb_talker.h"
-#include "openavb_listener.h"
-// #include "openavb_avtp.h"
-#include "openavb_platform.h"
-
-#define AVB_LOG_COMPONENT "Talker / Listener"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-U32 gMaxTL;
-tl_handle_t *gTLHandleList;
-
-// We are accessed from multiple threads, so need a mutex
-MUTEX_HANDLE(gTLStateMutex);
-
-#define MATCH(A, B)(strcasecmp((A), (B)) == 0)
-//#define MATCH_LEFT(A, B, C)(strncasecmp((A), (B), (C)) == 0)
-#define MATCH_LEFT(A, B, C) (memcmp((A), (B), (C)) == 0)
-
-THREAD_TYPE(listenerThread);
-THREAD_TYPE(talkerThread);
-
-void* openavbTLThreadFn(void *pv);
-#define THREAD_CREATE_TALKER() THREAD_CREATE(talkerThread, pTLState->TLThread, NULL, openavbTLThreadFn, pTLState)
-#define THREAD_CREATE_LISTENER() THREAD_CREATE(listenerThread, pTLState->TLThread, NULL, openavbTLThreadFn, pTLState)
-
-void timespec_add_usec(struct timespec *t, unsigned long us)
-{
- t->tv_nsec += us * NANOSECONDS_PER_USEC;
- t->tv_sec += t->tv_nsec / NANOSECONDS_PER_SECOND;
- t->tv_nsec = t->tv_nsec % NANOSECONDS_PER_SECOND;
-}
-
-void timespec_sub_usec(struct timespec *t, unsigned long us)
-{
- t->tv_nsec -= us * NANOSECONDS_PER_USEC;
- t->tv_sec += t->tv_nsec / NANOSECONDS_PER_SECOND;
- t->tv_nsec = t->tv_nsec % NANOSECONDS_PER_SECOND;
- if (t->tv_nsec < 0) {
- t->tv_sec--;
- t->tv_nsec = NANOSECONDS_PER_SECOND + t->tv_nsec;
- }
-}
-
-unsigned long timespec_usec_diff(struct timespec *t1, struct timespec *t2)
-{
- return (t1->tv_sec - t2->tv_sec) * MICROSECONDS_PER_SECOND
- + (t1->tv_nsec - t2->tv_nsec) / NANOSECONDS_PER_USEC;
-}
-
-int timespec_cmp(struct timespec *a, struct timespec *b)
-{
- if (a->tv_sec > b->tv_sec)
- return 1;
- else if (a->tv_sec < b->tv_sec)
- return -1;
- else {
- if (a->tv_nsec > b->tv_nsec)
- return 1;
- else if (a->tv_nsec < b->tv_nsec)
- return -1;
- }
- return 0;
-}
-
-static bool TLHandleListAdd(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- if (!handle || !gTLHandleList) {
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- TL_LOCK();
- int i1;
- for (i1 = 0; i1 < gMaxTL; i1++) {
- if (!gTLHandleList[i1]) {
- gTLHandleList[i1] = handle;
- TL_UNLOCK();
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return TRUE;
- }
- }
- TL_UNLOCK();
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
-}
-
-bool TLHandleListRemove(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- if (!handle || !gTLHandleList) {
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- TL_LOCK();
- int i1;
- for (i1 = 0; i1 < gMaxTL; i1++) {
- if (gTLHandleList[i1] == handle) {
- gTLHandleList[i1] = NULL;
- TL_UNLOCK();
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return TRUE;
- }
- }
- TL_UNLOCK();
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
-}
-
-static bool checkIntfCallbacks(openavb_tl_cfg_t *pCfg)
-{
- bool validCfg = TRUE;
-
- if (!pCfg->intf_cb.intf_cfg_cb) {
- AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_cfg'.");
- // validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->intf_cb.intf_tx_init_cb) {
- AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_tx_init'.");
- // validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->intf_cb.intf_tx_cb) {
- AVB_LOG_ERROR("INI file doesn't specify inferface callback for '_tx'.");
- validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->intf_cb.intf_rx_init_cb) {
- AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_rx_init'.");
- // validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->intf_cb.intf_rx_cb) {
- AVB_LOG_ERROR("INI file doesn't specify inferface callback for '_rx'.");
- validCfg = FALSE;
- }
- if (!pCfg->intf_cb.intf_end_cb) {
- AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_end'.");
- // validCfg = FALSE;
- }
- if (!pCfg->intf_cb.intf_gen_init_cb) {
- AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_gen_init'.");
- // validCfg = FALSE;
- }
- if (!pCfg->intf_cb.intf_gen_end_cb) {
- AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_gen_end'.");
- // validCfg = FALSE;
- }
- if (!pCfg->intf_cb.intf_avdecc_init_cb) {
- // Optional callback
- // CORE_TODO: AVDECC not formally supported yet.
- // AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_avdecc_init'.");
- // validCfg = FALSE;
- }
-
- return validCfg;
-}
-
-static bool checkMapCallbacks(openavb_tl_cfg_t *pCfg)
-{
- bool validCfg = TRUE;
-
- if (!pCfg->map_cb.map_cfg_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_cfg'.");
- // validCfg = FALSE;
- }
- if (!pCfg->map_cb.map_subtype_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_subtype'.");
- // validCfg = FALSE;
- }
- if (!pCfg->map_cb.map_avtp_version_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_avtp_version'.");
- // validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->map_cb.map_tx_init_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_tx_init'.");
- // validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->map_cb.map_tx_cb) {
- AVB_LOG_ERROR("INI doesn't specify mapping callback for '_tx'.");
- validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->map_cb.map_rx_init_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_rx_init'.");
- // validCfg = FALSE;
- }
- if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->map_cb.map_rx_cb) {
- AVB_LOG_ERROR("INI doesn't specify mapping callback for '_rx'.");
- validCfg = FALSE;
- }
- if (!pCfg->map_cb.map_end_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_end'.");
- // validCfg = FALSE;
- }
- if (!pCfg->map_cb.map_gen_init_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_gen_init'.");
- // validCfg = FALSE;
- }
- if (!pCfg->map_cb.map_gen_end_cb) {
- AVB_LOG_WARNING("INI doesn't specify mapping callback for '_gen_end'.");
- // validCfg = FALSE;
- }
- if (!pCfg->map_cb.map_avdecc_init_cb) {
- // Optional callback
- // CORE_TODO: AVDECC not formally supported yet.
- // AVB_LOG_WARNING("INI doesn't specify mapping callback for '_avdecc_init'.");
- // validCfg = FALSE;
- }
-
- return validCfg;
-}
-
-void openavbTLUnconfigure(tl_state_t *pTLState)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- // CORE_TODO: Disable this functionality until updated to properly handle distinction between values point to static const char
- // and dynamically allocated strings.
-#if 0
- openavb_tl_cfg_t *pCfg = &pTLState->cfg;
-
- int i1;
- for (i1 = 0; i1 < pCfg->nLibCfgItems; i1++) {
- if (pCfg->libCfgNames[i1])
- free(pCfg->libCfgNames[i1]);
- if (pNVCfg->libCfgValues[i1])
- free(pNVCfg->libCfgValues[i1]);
- pCfg->libCfgNames[i1] = pNVCfg->libCfgValues[i1] = NULL;
- }
- pCfg->nLibCfgItems = 0;
-#endif
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
-}
-
-
-/* Public APIs
- */
-// General initizlization of the talker and listener library. Must be called prior to using any other TL APIs.
-EXTERN_DLL_EXPORT bool openavbTLInitialize(U32 maxTL)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
- LOG_EAVB_CORE_VERSION();
-
- // CORE_TODO : This can be used to AVB stack init functionality once such a thing exists in the reference implementation
- AVB_TIME_INIT();
-
- gMaxTL = maxTL;
-
- {
- MUTEX_ATTR_HANDLE(mta);
- MUTEX_ATTR_INIT(mta);
- MUTEX_ATTR_SET_TYPE(mta, MUTEX_ATTR_TYPE_DEFAULT);
- MUTEX_ATTR_SET_NAME(mta, "gTLStateMutex");
- MUTEX_CREATE_ERR();
- MUTEX_CREATE(gTLStateMutex, mta);
- MUTEX_LOG_ERR("Error creating mutex");
- }
-
- gTLHandleList = calloc(1, sizeof(tl_handle_t) * gMaxTL);
- if (gTLHandleList) {
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return TRUE;
- }
- else {
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-}
-
-// General cleanup of the talker and listener library. Should be called after all Talker and Listeners are closed.
-EXTERN_DLL_EXPORT bool openavbTLCleanup()
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
- if (gTLHandleList) {
- free(gTLHandleList);
- gTLHandleList = NULL;
- }
- else {
- return FALSE;
- }
-
- {
- MUTEX_CREATE_ERR();
- MUTEX_DESTROY(gTLStateMutex);
- MUTEX_LOG_ERR("Error destroying mutex");
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return TRUE;
-}
-
-EXTERN_DLL_EXPORT bool openavbGetVersion(U8 *major, U8 *minor, U8 *revision)
-{
- if (!major || !minor || !revision) {
- return FALSE;
- }
-
- *major = AVB_CORE_VER_MAJOR;
- *minor = AVB_CORE_VER_MINOR;
- *revision = AVB_CORE_VER_REVISION;
- return TRUE;
-}
-
-EXTERN_DLL_EXPORT tl_handle_t openavbTLOpen(void)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = calloc(1, sizeof(tl_state_t));
-
- if (!pTLState) {
- AVB_LOG_ERROR("Unable to allocate talker listener state data.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return NULL;
- }
-
- if (!TLHandleListAdd(pTLState)) {
- AVB_LOG_ERROR("To many talker listeners open.");
- free(pTLState);
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return NULL;
- }
-
- return pTLState;
-}
-
-EXTERN_DLL_EXPORT void openavbTLInitCfg(openavb_tl_cfg_t *pCfg)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- memset(pCfg, 0, sizeof(openavb_tl_cfg_t));
-
- // Set default values.
- pCfg->role = AVB_ROLE_UNDEFINED;
- //pCfg->map_cb;
- //pCfg->intf_cb;
- //pCfg->dest_addr;
- //pCfg->stream_addr;
- pCfg->stream_uid = -1;
- pCfg->max_interval_frames = 1;
- pCfg->max_frame_size = 1500;
- pCfg->max_transit_usec = 50000;
- pCfg->max_transmit_deficit_usec = 50000;
- pCfg->internal_latency = 0;
- pCfg->max_stale = MICROSECONDS_PER_SECOND;
- pCfg->batch_factor = 1;
- pCfg->report_seconds = 0;
- pCfg->start_paused = FALSE;
- pCfg->sr_class = SR_CLASS_B;
- pCfg->sr_rank = SR_RANK_REGULAR;
- pCfg->raw_tx_buffers = 8;
- pCfg->raw_rx_buffers = 100;
- pCfg->tx_blocking_in_intf = 0;
- pCfg->rx_signal_mode = 1;
- pCfg->pMapInitFn = NULL;
- pCfg->pIntfInitFn = NULL;
- pCfg->vlan_id = VLAN_NULL;
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
-}
-
-EXTERN_DLL_EXPORT bool openavbTLConfigure(tl_handle_t handle, openavb_tl_cfg_t *pCfgIn, openavb_tl_cfg_name_value_t *pNVCfg)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- // Create the mediaQ
- pTLState->pMediaQ = openavbMediaQCreate();
- if (!pTLState->pMediaQ) {
- AVB_LOG_ERROR("Unable to create media queue");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- // CORE_TODO: It's not safe to simply copy the openavb_tl_cfg_t since there are embedded pointers in the cfg_mac_t member.
- // Those pointers need to be updated after a copy. Longer term the cfg_mac_t should be changed to not contain the mac
- // member to remedy this issue and avoid further bugs.
- memcpy(&pTLState->cfg, pCfgIn, sizeof(openavb_tl_cfg_t));
- pTLState->cfg.dest_addr.mac = &pTLState->cfg.dest_addr.buffer;
- pTLState->cfg.stream_addr.mac = &pTLState->cfg.stream_addr.buffer;
-
- openavb_tl_cfg_t *pCfg = &pTLState->cfg;
-
- if (!((pCfg->role == AVB_ROLE_TALKER) || (pCfg->role == AVB_ROLE_LISTENER))) {
- AVB_LOG_ERROR("Talker - Listener Config Error: invalid role");
- return FALSE;
- }
-
- if ((pCfg->role == AVB_ROLE_TALKER) && (pCfg->max_interval_frames == 0)) {
- AVB_LOG_ERROR("Talker - Listener Config Error: talker role requires 'max_interval_frames'");
- return FALSE;
- }
-
- openavbMediaQSetMaxStaleTail(pTLState->pMediaQ, pCfg->max_stale);
-
- if (!openavbTLOpenLinkLibsOsal(pTLState)) {
- AVB_LOG_ERROR("Failed to open mapping / interface library");
- return FALSE;
- }
-
- if (pCfg->pMapInitFn && pCfg->pMapInitFn(pTLState->pMediaQ, &pCfg->map_cb, pCfg->max_transit_usec)) {
- checkMapCallbacks(&pTLState->cfg);
- }
- else {
- AVB_LOG_ERROR("Mapping initialize function error.");
- return FALSE;
- }
-
- if (pCfg->pIntfInitFn && pCfg->pIntfInitFn(pTLState->pMediaQ, &pCfg->intf_cb)) {
- checkIntfCallbacks(&pTLState->cfg);
- }
- else {
- AVB_LOG_ERROR("Interface initialize function error.");
- return FALSE;
- }
-
- // Submit configuration values to mapping and interface modules
- int i;
- for (i = 0; i < pNVCfg->nLibCfgItems; i++) {
- if (MATCH_LEFT(pNVCfg->libCfgNames[i], "intf_nv_", 8)) {
- if (pCfg->intf_cb.intf_cfg_cb) {
- pCfg->intf_cb.intf_cfg_cb(pTLState->pMediaQ, pNVCfg->libCfgNames[i], pNVCfg->libCfgValues[i]);
- }
- else {
- AVB_LOGF_ERROR("No interface module cfg function; ignoring %s", pNVCfg->libCfgNames[i]);
- }
- }
- else if (MATCH_LEFT(pNVCfg->libCfgNames[i], "map_nv_", 7)) {
- if (pCfg->map_cb.map_cfg_cb) {
- pCfg->map_cb.map_cfg_cb(pTLState->pMediaQ, pNVCfg->libCfgNames[i], pNVCfg->libCfgValues[i]);
- }
- else {
- AVB_LOGF_ERROR("No mapping module cfg function; ignoring %s", pNVCfg->libCfgNames[i]);
- }
- }
- else {
- assert(0);
- }
- } // for loop ends
-
- pTLState->cfg.map_cb.map_gen_init_cb(pTLState->pMediaQ);
- pTLState->cfg.intf_cb.intf_gen_init_cb(pTLState->pMediaQ);
-
- return TRUE;
-}
-
-EXTERN_DLL_EXPORT bool openavbTLRun(tl_handle_t handle)
-{
- bool retVal = FALSE;
-
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- do {
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- break;
- }
-
- pTLState->bRunning = TRUE;
- if (pTLState->cfg.role == AVB_ROLE_TALKER) {
- THREAD_CREATE_TALKER();
- }
- else if (pTLState->cfg.role == AVB_ROLE_LISTENER) {
- THREAD_CREATE_LISTENER();
- }
-
- retVal = TRUE;
-
- } while (0);
-
-
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return retVal;
-}
-
-extern DLL_EXPORT bool openavbTLStop(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- if (pTLState->bRunning) {
- // don't set bStreaming to false here, that's needed to track
- // that the streaming thread is running, so we can shut it down.
- //pTLState->bStreaming = FALSE;
- pTLState->bRunning = FALSE;
-
- THREAD_JOIN(pTLState->TLThread, NULL);
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return TRUE;
-}
-
-EXTERN_DLL_EXPORT bool openavbTLClose(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- if (pTLState->bRunning == TRUE) {
- // In case openavbTLStop wasn't called stop is now.
- openavbTLStop(handle);
- }
-
- pTLState->cfg.intf_cb.intf_gen_end_cb(pTLState->pMediaQ);
- pTLState->cfg.map_cb.map_gen_end_cb(pTLState->pMediaQ);
-
- TLHandleListRemove(handle);
-
- openavbTLUnconfigure(pTLState);
- openavbTLCloseLinkLibsOsal(pTLState);
-
- if (pTLState->pMediaQ) {
- openavbMediaQDelete(pTLState->pMediaQ);
- pTLState->pMediaQ = NULL;
- }
-
- // Free TLState
- free(pTLState);
- pTLState = NULL;
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return TRUE;
-}
-
-EXTERN_DLL_EXPORT void* openavbTLGetIntfHostCBList(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState->cfg.intf_cb.intf_host_cb_list;
-}
-
-EXTERN_DLL_EXPORT void* openavbTLGetIntfHandle(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState->pMediaQ;
-}
-
-EXTERN_DLL_EXPORT bool openavbTLIsRunning(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState->bRunning;
-}
-
-EXTERN_DLL_EXPORT bool openavbTLIsConnected(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState->bConnected;
-}
-
-EXTERN_DLL_EXPORT bool openavbTLIsStreaming(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return FALSE;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState->bStreaming;
-}
-
-EXTERN_DLL_EXPORT avb_role_t openavbTLGetRole(tl_handle_t handle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return AVB_ROLE_UNDEFINED;
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState->cfg.role;
-}
-
-
-EXTERN_DLL_EXPORT U64 openavbTLStat(tl_handle_t handle, tl_stat_t stat)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
- U64 val = 0;
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return 0;
- }
-
- if (pTLState->cfg.role == AVB_ROLE_TALKER) {
- val = openavbTalkerGetStat(pTLState, stat);
- }
- else if (pTLState->cfg.role == AVB_ROLE_LISTENER) {
- val = openavbListenerGetStat(pTLState, stat);
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return val;
-}
-
-EXTERN_DLL_EXPORT void openavbTLPauseStream(tl_handle_t handle, bool bPause)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)handle;
-
- if (!pTLState) {
- AVB_LOG_ERROR("Invalid handle.");
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return;
- }
-
- if (pTLState->cfg.role == AVB_ROLE_TALKER) {
- openavbTLPauseTalker(pTLState, bPause);
- }
- else if (pTLState->cfg.role == AVB_ROLE_LISTENER) {
- openavbTLPauseListener(pTLState, bPause);
- }
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
-}
-
-
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : Common implementation for the talker and listener
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "openavb_tl.h"
+#include "openavb_trace.h"
+#include "openavb_mediaq.h"
+#include "openavb_talker.h"
+#include "openavb_listener.h"
+// #include "openavb_avtp.h"
+#include "openavb_platform.h"
+
+#define AVB_LOG_COMPONENT "Talker / Listener"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+U32 gMaxTL;
+tl_handle_t *gTLHandleList;
+
+// We are accessed from multiple threads, so need a mutex
+MUTEX_HANDLE(gTLStateMutex);
+
+#define MATCH(A, B)(strcasecmp((A), (B)) == 0)
+//#define MATCH_LEFT(A, B, C)(strncasecmp((A), (B), (C)) == 0)
+#define MATCH_LEFT(A, B, C) (memcmp((A), (B), (C)) == 0)
+
+THREAD_TYPE(listenerThread);
+THREAD_TYPE(talkerThread);
+
+void* openavbTLThreadFn(void *pv);
+#define THREAD_CREATE_TALKER() THREAD_CREATE(talkerThread, pTLState->TLThread, NULL, openavbTLThreadFn, pTLState)
+#define THREAD_CREATE_LISTENER() THREAD_CREATE(listenerThread, pTLState->TLThread, NULL, openavbTLThreadFn, pTLState)
+
+void timespec_add_usec(struct timespec *t, unsigned long us)
+{
+ t->tv_nsec += us * NANOSECONDS_PER_USEC;
+ t->tv_sec += t->tv_nsec / NANOSECONDS_PER_SECOND;
+ t->tv_nsec = t->tv_nsec % NANOSECONDS_PER_SECOND;
+}
+
+void timespec_sub_usec(struct timespec *t, unsigned long us)
+{
+ t->tv_nsec -= us * NANOSECONDS_PER_USEC;
+ t->tv_sec += t->tv_nsec / NANOSECONDS_PER_SECOND;
+ t->tv_nsec = t->tv_nsec % NANOSECONDS_PER_SECOND;
+ if (t->tv_nsec < 0) {
+ t->tv_sec--;
+ t->tv_nsec = NANOSECONDS_PER_SECOND + t->tv_nsec;
+ }
+}
+
+unsigned long timespec_usec_diff(struct timespec *t1, struct timespec *t2)
+{
+ return (t1->tv_sec - t2->tv_sec) * MICROSECONDS_PER_SECOND
+ + (t1->tv_nsec - t2->tv_nsec) / NANOSECONDS_PER_USEC;
+}
+
+int timespec_cmp(struct timespec *a, struct timespec *b)
+{
+ if (a->tv_sec > b->tv_sec)
+ return 1;
+ else if (a->tv_sec < b->tv_sec)
+ return -1;
+ else {
+ if (a->tv_nsec > b->tv_nsec)
+ return 1;
+ else if (a->tv_nsec < b->tv_nsec)
+ return -1;
+ }
+ return 0;
+}
+
+static bool TLHandleListAdd(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ if (!handle || !gTLHandleList) {
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ TL_LOCK();
+ int i1;
+ for (i1 = 0; i1 < gMaxTL; i1++) {
+ if (!gTLHandleList[i1]) {
+ gTLHandleList[i1] = handle;
+ TL_UNLOCK();
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return TRUE;
+ }
+ }
+ TL_UNLOCK();
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+}
+
+bool TLHandleListRemove(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ if (!handle || !gTLHandleList) {
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ TL_LOCK();
+ int i1;
+ for (i1 = 0; i1 < gMaxTL; i1++) {
+ if (gTLHandleList[i1] == handle) {
+ gTLHandleList[i1] = NULL;
+ TL_UNLOCK();
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return TRUE;
+ }
+ }
+ TL_UNLOCK();
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+}
+
+static bool checkIntfCallbacks(openavb_tl_cfg_t *pCfg)
+{
+ bool validCfg = TRUE;
+
+ if (!pCfg->intf_cb.intf_cfg_cb) {
+ AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_cfg'.");
+ // validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->intf_cb.intf_tx_init_cb) {
+ AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_tx_init'.");
+ // validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->intf_cb.intf_tx_cb) {
+ AVB_LOG_ERROR("INI file doesn't specify inferface callback for '_tx'.");
+ validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->intf_cb.intf_rx_init_cb) {
+ AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_rx_init'.");
+ // validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->intf_cb.intf_rx_cb) {
+ AVB_LOG_ERROR("INI file doesn't specify inferface callback for '_rx'.");
+ validCfg = FALSE;
+ }
+ if (!pCfg->intf_cb.intf_end_cb) {
+ AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_end'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->intf_cb.intf_gen_init_cb) {
+ AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_gen_init'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->intf_cb.intf_gen_end_cb) {
+ AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_gen_end'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->intf_cb.intf_avdecc_init_cb) {
+ // Optional callback
+ // CORE_TODO: AVDECC not formally supported yet.
+ // AVB_LOG_WARNING("INI file doesn't specify inferface callback for '_avdecc_init'.");
+ // validCfg = FALSE;
+ }
+
+ return validCfg;
+}
+
+static bool checkMapCallbacks(openavb_tl_cfg_t *pCfg)
+{
+ bool validCfg = TRUE;
+
+ if (!pCfg->map_cb.map_cfg_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_cfg'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->map_cb.map_subtype_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_subtype'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->map_cb.map_avtp_version_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_avtp_version'.");
+ // validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->map_cb.map_tx_init_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_tx_init'.");
+ // validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_TALKER) && !pCfg->map_cb.map_tx_cb) {
+ AVB_LOG_ERROR("INI doesn't specify mapping callback for '_tx'.");
+ validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->map_cb.map_rx_init_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_rx_init'.");
+ // validCfg = FALSE;
+ }
+ if ((pCfg->role == AVB_ROLE_LISTENER) && !pCfg->map_cb.map_rx_cb) {
+ AVB_LOG_ERROR("INI doesn't specify mapping callback for '_rx'.");
+ validCfg = FALSE;
+ }
+ if (!pCfg->map_cb.map_end_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_end'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->map_cb.map_gen_init_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_gen_init'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->map_cb.map_gen_end_cb) {
+ AVB_LOG_WARNING("INI doesn't specify mapping callback for '_gen_end'.");
+ // validCfg = FALSE;
+ }
+ if (!pCfg->map_cb.map_avdecc_init_cb) {
+ // Optional callback
+ // CORE_TODO: AVDECC not formally supported yet.
+ // AVB_LOG_WARNING("INI doesn't specify mapping callback for '_avdecc_init'.");
+ // validCfg = FALSE;
+ }
+
+ return validCfg;
+}
+
+void openavbTLUnconfigure(tl_state_t *pTLState)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ // CORE_TODO: Disable this functionality until updated to properly handle distinction between values point to static const char
+ // and dynamically allocated strings.
+#if 0
+ openavb_tl_cfg_t *pCfg = &pTLState->cfg;
+
+ int i1;
+ for (i1 = 0; i1 < pCfg->nLibCfgItems; i1++) {
+ if (pCfg->libCfgNames[i1])
+ free(pCfg->libCfgNames[i1]);
+ if (pNVCfg->libCfgValues[i1])
+ free(pNVCfg->libCfgValues[i1]);
+ pCfg->libCfgNames[i1] = pNVCfg->libCfgValues[i1] = NULL;
+ }
+ pCfg->nLibCfgItems = 0;
+#endif
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+}
+
+
+/* Public APIs
+ */
+// General initizlization of the talker and listener library. Must be called prior to using any other TL APIs.
+EXTERN_DLL_EXPORT bool openavbTLInitialize(U32 maxTL)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+ LOG_EAVB_CORE_VERSION();
+
+ // CORE_TODO : This can be used to AVB stack init functionality once such a thing exists in the reference implementation
+ AVB_TIME_INIT();
+
+ gMaxTL = maxTL;
+
+ {
+ MUTEX_ATTR_HANDLE(mta);
+ MUTEX_ATTR_INIT(mta);
+ MUTEX_ATTR_SET_TYPE(mta, MUTEX_ATTR_TYPE_DEFAULT);
+ MUTEX_ATTR_SET_NAME(mta, "gTLStateMutex");
+ MUTEX_CREATE_ERR();
+ MUTEX_CREATE(gTLStateMutex, mta);
+ MUTEX_LOG_ERR("Error creating mutex");
+ }
+
+ gTLHandleList = calloc(1, sizeof(tl_handle_t) * gMaxTL);
+ if (gTLHandleList) {
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return TRUE;
+ }
+ else {
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+}
+
+// General cleanup of the talker and listener library. Should be called after all Talker and Listeners are closed.
+EXTERN_DLL_EXPORT bool openavbTLCleanup()
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+ if (gTLHandleList) {
+ free(gTLHandleList);
+ gTLHandleList = NULL;
+ }
+ else {
+ return FALSE;
+ }
+
+ {
+ MUTEX_CREATE_ERR();
+ MUTEX_DESTROY(gTLStateMutex);
+ MUTEX_LOG_ERR("Error destroying mutex");
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return TRUE;
+}
+
+EXTERN_DLL_EXPORT bool openavbGetVersion(U8 *major, U8 *minor, U8 *revision)
+{
+ if (!major || !minor || !revision) {
+ return FALSE;
+ }
+
+ *major = AVB_CORE_VER_MAJOR;
+ *minor = AVB_CORE_VER_MINOR;
+ *revision = AVB_CORE_VER_REVISION;
+ return TRUE;
+}
+
+EXTERN_DLL_EXPORT tl_handle_t openavbTLOpen(void)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = calloc(1, sizeof(tl_state_t));
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Unable to allocate talker listener state data.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return NULL;
+ }
+
+ if (!TLHandleListAdd(pTLState)) {
+ AVB_LOG_ERROR("To many talker listeners open.");
+ free(pTLState);
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return NULL;
+ }
+
+ return pTLState;
+}
+
+EXTERN_DLL_EXPORT void openavbTLInitCfg(openavb_tl_cfg_t *pCfg)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ memset(pCfg, 0, sizeof(openavb_tl_cfg_t));
+
+ // Set default values.
+ pCfg->role = AVB_ROLE_UNDEFINED;
+ //pCfg->map_cb;
+ //pCfg->intf_cb;
+ //pCfg->dest_addr;
+ //pCfg->stream_addr;
+ pCfg->stream_uid = -1;
+ pCfg->max_interval_frames = 1;
+ pCfg->max_frame_size = 1500;
+ pCfg->max_transit_usec = 50000;
+ pCfg->max_transmit_deficit_usec = 50000;
+ pCfg->internal_latency = 0;
+ pCfg->max_stale = MICROSECONDS_PER_SECOND;
+ pCfg->batch_factor = 1;
+ pCfg->report_seconds = 0;
+ pCfg->start_paused = FALSE;
+ pCfg->sr_class = SR_CLASS_B;
+ pCfg->sr_rank = SR_RANK_REGULAR;
+ pCfg->raw_tx_buffers = 8;
+ pCfg->raw_rx_buffers = 100;
+ pCfg->tx_blocking_in_intf = 0;
+ pCfg->rx_signal_mode = 1;
+ pCfg->pMapInitFn = NULL;
+ pCfg->pIntfInitFn = NULL;
+ pCfg->vlan_id = VLAN_NULL;
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+}
+
+EXTERN_DLL_EXPORT bool openavbTLConfigure(tl_handle_t handle, openavb_tl_cfg_t *pCfgIn, openavb_tl_cfg_name_value_t *pNVCfg)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ // Create the mediaQ
+ pTLState->pMediaQ = openavbMediaQCreate();
+ if (!pTLState->pMediaQ) {
+ AVB_LOG_ERROR("Unable to create media queue");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ // CORE_TODO: It's not safe to simply copy the openavb_tl_cfg_t since there are embedded pointers in the cfg_mac_t member.
+ // Those pointers need to be updated after a copy. Longer term the cfg_mac_t should be changed to not contain the mac
+ // member to remedy this issue and avoid further bugs.
+ memcpy(&pTLState->cfg, pCfgIn, sizeof(openavb_tl_cfg_t));
+ pTLState->cfg.dest_addr.mac = &pTLState->cfg.dest_addr.buffer;
+ pTLState->cfg.stream_addr.mac = &pTLState->cfg.stream_addr.buffer;
+
+ openavb_tl_cfg_t *pCfg = &pTLState->cfg;
+
+ if (!((pCfg->role == AVB_ROLE_TALKER) || (pCfg->role == AVB_ROLE_LISTENER))) {
+ AVB_LOG_ERROR("Talker - Listener Config Error: invalid role");
+ return FALSE;
+ }
+
+ if ((pCfg->role == AVB_ROLE_TALKER) && (pCfg->max_interval_frames == 0)) {
+ AVB_LOG_ERROR("Talker - Listener Config Error: talker role requires 'max_interval_frames'");
+ return FALSE;
+ }
+
+ openavbMediaQSetMaxStaleTail(pTLState->pMediaQ, pCfg->max_stale);
+
+ if (!openavbTLOpenLinkLibsOsal(pTLState)) {
+ AVB_LOG_ERROR("Failed to open mapping / interface library");
+ return FALSE;
+ }
+
+ if (pCfg->pMapInitFn && pCfg->pMapInitFn(pTLState->pMediaQ, &pCfg->map_cb, pCfg->max_transit_usec)) {
+ checkMapCallbacks(&pTLState->cfg);
+ }
+ else {
+ AVB_LOG_ERROR("Mapping initialize function error.");
+ return FALSE;
+ }
+
+ if (pCfg->pIntfInitFn && pCfg->pIntfInitFn(pTLState->pMediaQ, &pCfg->intf_cb)) {
+ checkIntfCallbacks(&pTLState->cfg);
+ }
+ else {
+ AVB_LOG_ERROR("Interface initialize function error.");
+ return FALSE;
+ }
+
+ // Submit configuration values to mapping and interface modules
+ int i;
+ for (i = 0; i < pNVCfg->nLibCfgItems; i++) {
+ if (MATCH_LEFT(pNVCfg->libCfgNames[i], "intf_nv_", 8)) {
+ if (pCfg->intf_cb.intf_cfg_cb) {
+ pCfg->intf_cb.intf_cfg_cb(pTLState->pMediaQ, pNVCfg->libCfgNames[i], pNVCfg->libCfgValues[i]);
+ }
+ else {
+ AVB_LOGF_ERROR("No interface module cfg function; ignoring %s", pNVCfg->libCfgNames[i]);
+ }
+ }
+ else if (MATCH_LEFT(pNVCfg->libCfgNames[i], "map_nv_", 7)) {
+ if (pCfg->map_cb.map_cfg_cb) {
+ pCfg->map_cb.map_cfg_cb(pTLState->pMediaQ, pNVCfg->libCfgNames[i], pNVCfg->libCfgValues[i]);
+ }
+ else {
+ AVB_LOGF_ERROR("No mapping module cfg function; ignoring %s", pNVCfg->libCfgNames[i]);
+ }
+ }
+ else {
+ assert(0);
+ }
+ } // for loop ends
+
+ pTLState->cfg.map_cb.map_gen_init_cb(pTLState->pMediaQ);
+ pTLState->cfg.intf_cb.intf_gen_init_cb(pTLState->pMediaQ);
+
+ return TRUE;
+}
+
+EXTERN_DLL_EXPORT bool openavbTLRun(tl_handle_t handle)
+{
+ bool retVal = FALSE;
+
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ do {
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ break;
+ }
+
+ pTLState->bRunning = TRUE;
+ if (pTLState->cfg.role == AVB_ROLE_TALKER) {
+ THREAD_CREATE_TALKER();
+ }
+ else if (pTLState->cfg.role == AVB_ROLE_LISTENER) {
+ THREAD_CREATE_LISTENER();
+ }
+
+ retVal = TRUE;
+
+ } while (0);
+
+
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return retVal;
+}
+
+extern DLL_EXPORT bool openavbTLStop(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ if (pTLState->bRunning) {
+ // don't set bStreaming to false here, that's needed to track
+ // that the streaming thread is running, so we can shut it down.
+ //pTLState->bStreaming = FALSE;
+ pTLState->bRunning = FALSE;
+
+ THREAD_JOIN(pTLState->TLThread, NULL);
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return TRUE;
+}
+
+EXTERN_DLL_EXPORT bool openavbTLClose(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ if (pTLState->bRunning == TRUE) {
+ // In case openavbTLStop wasn't called stop is now.
+ openavbTLStop(handle);
+ }
+
+ pTLState->cfg.intf_cb.intf_gen_end_cb(pTLState->pMediaQ);
+ pTLState->cfg.map_cb.map_gen_end_cb(pTLState->pMediaQ);
+
+ TLHandleListRemove(handle);
+
+ openavbTLUnconfigure(pTLState);
+ openavbTLCloseLinkLibsOsal(pTLState);
+
+ if (pTLState->pMediaQ) {
+ openavbMediaQDelete(pTLState->pMediaQ);
+ pTLState->pMediaQ = NULL;
+ }
+
+ // Free TLState
+ free(pTLState);
+ pTLState = NULL;
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return TRUE;
+}
+
+EXTERN_DLL_EXPORT void* openavbTLGetIntfHostCBList(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState->cfg.intf_cb.intf_host_cb_list;
+}
+
+EXTERN_DLL_EXPORT void* openavbTLGetIntfHandle(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState->pMediaQ;
+}
+
+EXTERN_DLL_EXPORT bool openavbTLIsRunning(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState->bRunning;
+}
+
+EXTERN_DLL_EXPORT bool openavbTLIsConnected(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState->bConnected;
+}
+
+EXTERN_DLL_EXPORT bool openavbTLIsStreaming(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return FALSE;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState->bStreaming;
+}
+
+EXTERN_DLL_EXPORT avb_role_t openavbTLGetRole(tl_handle_t handle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return AVB_ROLE_UNDEFINED;
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState->cfg.role;
+}
+
+
+EXTERN_DLL_EXPORT U64 openavbTLStat(tl_handle_t handle, tl_stat_t stat)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+ U64 val = 0;
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return 0;
+ }
+
+ if (pTLState->cfg.role == AVB_ROLE_TALKER) {
+ val = openavbTalkerGetStat(pTLState, stat);
+ }
+ else if (pTLState->cfg.role == AVB_ROLE_LISTENER) {
+ val = openavbListenerGetStat(pTLState, stat);
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return val;
+}
+
+EXTERN_DLL_EXPORT void openavbTLPauseStream(tl_handle_t handle, bool bPause)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)handle;
+
+ if (!pTLState) {
+ AVB_LOG_ERROR("Invalid handle.");
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return;
+ }
+
+ if (pTLState->cfg.role == AVB_ROLE_TALKER) {
+ openavbTLPauseTalker(pTLState, bPause);
+ }
+ else if (pTLState->cfg.role == AVB_ROLE_LISTENER) {
+ openavbTLPauseListener(pTLState, bPause);
+ }
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+}
+
+
+
diff --git a/lib/avtp_pipeline/tl/openavb_tl_no_endpoint.c b/lib/avtp_pipeline/tl/openavb_tl_no_endpoint.c
index 85173d2c..c3940d87 100644
--- a/lib/avtp_pipeline/tl/openavb_tl_no_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_tl_no_endpoint.c
@@ -1,134 +1,134 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-/*
-* MODULE SUMMARY : Common implementation for the talker and listener
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "openavb_tl.h"
-#include "openavb_trace.h"
-//#include "openavb_mediaq.h"
-#include "openavb_talker.h"
-#include "openavb_listener.h"
-#include "openavb_avtp.h"
-#include "openavb_endpoint.h"
-
-#include "openavb_platform.h"
-
-#define AVB_LOG_COMPONENT "Talker / Listener"
-#include "openavb_pub.h"
-#include "openavb_log.h"
-
-void openavbEptClntCheckVerMatchesSrvr(int endpointHandle, U32 AVBVersion)
-{
-}
-
-
-// Talker Listener thread function
-void* openavbTLThreadFn(void *pv)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- tl_state_t *pTLState = (tl_state_t *)pv;
-
- openavbTLThreadFnOsal(pTLState);
-
- TL_LOCK();
- // Assign a unique endpoint handle
- static int gEndpointHandle = 1;
- pTLState->endpointHandle = gEndpointHandle++;
- TL_UNLOCK();
-
- while (pTLState->bRunning) {
- AVB_TRACE_LINE(AVB_TRACE_TL_DETAIL);
-
- if (pTLState->cfg.role == AVB_ROLE_TALKER) {
- openavbTLRunTalker(pTLState);
- }
- else {
- openavbTLRunListener(pTLState);
- }
-
- // Close the endpoint connection. unless connection already gone in which case the socket could already be reused.
- if (pTLState->bConnected) {
- pTLState->bConnected = FALSE;
- pTLState->endpointHandle = 0;
- }
-
- if (pTLState->bRunning) {
- SLEEP(1);
- }
- }
-
- THREAD_JOINABLE(pTLState->TLThread);
-
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return NULL;
-}
-
-tl_handle_t TLHandleListGet(int endpointHandle)
-{
- AVB_TRACE_ENTRY(AVB_TRACE_TL);
-
- if (!endpointHandle || !gTLHandleList) {
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return NULL;
- }
-
- TL_LOCK();
- int i1;
- for (i1 = 0; i1 < gMaxTL; i1++) {
- if (gTLHandleList[i1]) {
- tl_state_t *pTLState = (tl_state_t *)gTLHandleList[i1];
- if (pTLState->endpointHandle == endpointHandle) {
- TL_UNLOCK();
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return pTLState;
- }
- }
- }
- TL_UNLOCK();
- AVB_TRACE_EXIT(AVB_TRACE_TL);
- return NULL;
-}
-
-bool openavbEptClntStopStream(int h, AVBStreamID_t *streamID)
-{
- return TRUE;
-}
-
-bool openavbEptClntService(int h, int timeout)
-{
- return TRUE;
-}
-
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+/*
+* MODULE SUMMARY : Common implementation for the talker and listener
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "openavb_tl.h"
+#include "openavb_trace.h"
+//#include "openavb_mediaq.h"
+#include "openavb_talker.h"
+#include "openavb_listener.h"
+#include "openavb_avtp.h"
+#include "openavb_endpoint.h"
+
+#include "openavb_platform.h"
+
+#define AVB_LOG_COMPONENT "Talker / Listener"
+#include "openavb_pub.h"
+#include "openavb_log.h"
+
+void openavbEptClntCheckVerMatchesSrvr(int endpointHandle, U32 AVBVersion)
+{
+}
+
+
+// Talker Listener thread function
+void* openavbTLThreadFn(void *pv)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ tl_state_t *pTLState = (tl_state_t *)pv;
+
+ openavbTLThreadFnOsal(pTLState);
+
+ TL_LOCK();
+ // Assign a unique endpoint handle
+ static int gEndpointHandle = 1;
+ pTLState->endpointHandle = gEndpointHandle++;
+ TL_UNLOCK();
+
+ while (pTLState->bRunning) {
+ AVB_TRACE_LINE(AVB_TRACE_TL_DETAIL);
+
+ if (pTLState->cfg.role == AVB_ROLE_TALKER) {
+ openavbTLRunTalker(pTLState);
+ }
+ else {
+ openavbTLRunListener(pTLState);
+ }
+
+ // Close the endpoint connection. unless connection already gone in which case the socket could already be reused.
+ if (pTLState->bConnected) {
+ pTLState->bConnected = FALSE;
+ pTLState->endpointHandle = 0;
+ }
+
+ if (pTLState->bRunning) {
+ SLEEP(1);
+ }
+ }
+
+ THREAD_JOINABLE(pTLState->TLThread);
+
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return NULL;
+}
+
+tl_handle_t TLHandleListGet(int endpointHandle)
+{
+ AVB_TRACE_ENTRY(AVB_TRACE_TL);
+
+ if (!endpointHandle || !gTLHandleList) {
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return NULL;
+ }
+
+ TL_LOCK();
+ int i1;
+ for (i1 = 0; i1 < gMaxTL; i1++) {
+ if (gTLHandleList[i1]) {
+ tl_state_t *pTLState = (tl_state_t *)gTLHandleList[i1];
+ if (pTLState->endpointHandle == endpointHandle) {
+ TL_UNLOCK();
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return pTLState;
+ }
+ }
+ }
+ TL_UNLOCK();
+ AVB_TRACE_EXIT(AVB_TRACE_TL);
+ return NULL;
+}
+
+bool openavbEptClntStopStream(int h, AVBStreamID_t *streamID)
+{
+ return TRUE;
+}
+
+bool openavbEptClntService(int h, int timeout)
+{
+ return TRUE;
+}
+
diff --git a/lib/avtp_pipeline/util/openavb_queue.c b/lib/avtp_pipeline/util/openavb_queue.c
index 4dbbf366..cc7ea21d 100644
--- a/lib/avtp_pipeline/util/openavb_queue.c
+++ b/lib/avtp_pipeline/util/openavb_queue.c
@@ -1,196 +1,196 @@
-/*************************************************************************************************************
-Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
-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.
-
-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.
-*************************************************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "openavb_debug.h"
-#include "openavb_queue.h"
-
-OPENAVB_CODE_MODULE_PRI
-
-struct openavb_queue_elem {
- bool setFlg;
- void *data;
-};
-
-struct openavb_queue {
- // Size of each element
- U32 elemSize;
-
- // Number of queue element slots
- U32 queueSize;
-
- // Next element to be filled
- int head;
-
- // Next element to be pulled
- int tail;
-
- openavb_queue_elem_t elemArray;
-};
-
-openavb_queue_t openavbQueueNewQueue(U32 elemSize, U32 queueSize)
-{
- if (elemSize < 1 || queueSize < 1)
- return NULL;
-
- openavb_queue_t retQueue = calloc(1, sizeof(struct openavb_queue));
- if (retQueue) {
- retQueue->elemArray = calloc(queueSize, sizeof(struct openavb_queue_elem));
- if (retQueue->elemArray) {
- U32 i1;
- for (i1 = 0; i1 < queueSize; i1++) {
- retQueue->elemArray[i1].data = calloc(1, elemSize);
- if (!retQueue->elemArray[i1].data) {
- openavbQueueDeleteQueue(retQueue);
- return NULL;
- }
- }
- }
- else {
- openavbQueueDeleteQueue(retQueue);
- return NULL;
- }
-
- retQueue->elemSize = elemSize;
- retQueue->queueSize = queueSize;
- retQueue->head = 0;
- retQueue->tail = 0;
- }
-
- return retQueue;
-}
-
-void openavbQueueDeleteQueue(openavb_queue_t queue)
-{
- if (queue) {
- U32 i1;
- for (i1 = 0; i1 < queue->queueSize; i1++) {
- free(queue->elemArray[i1].data);
- queue->elemArray[i1].data = NULL;
- }
- free(queue->elemArray);
- queue->elemArray = NULL;
- free(queue);
- }
-}
-
-U32 openavbQueueGetQueueSize(openavb_queue_t queue)
-{
- if (queue) {
- return queue->queueSize;
- }
- return 0;
-}
-
-U32 openavbQueueGetElemCount(openavb_queue_t queue)
-{
- U32 cnt = 0;
- if (queue) {
- if (queue->head > queue->tail) {
- cnt += queue->head - queue->tail - 1;
- }
- else if (queue->head < queue->tail) {
- cnt += queue->head + ((queue->queueSize - 1) - queue->tail);
- }
-
- if (queue->elemArray[queue->tail].setFlg) {
- cnt++;
- }
- }
- return cnt;
-}
-
-U32 openavbQueueGetElemSize(openavb_queue_t queue)
-{
- if (queue) {
- return queue->elemSize;
- }
- return 0;
-}
-
-void *openavbQueueData(openavb_queue_elem_t elem)
-{
- if (elem) {
- return elem->data;
- }
- return NULL;
-}
-
-openavb_queue_elem_t openavbQueueHeadLock(openavb_queue_t queue)
-{
- if (queue) {
- if (!queue->elemArray[queue->head].setFlg) {
- return &queue->elemArray[queue->head];
- }
- }
- return NULL;
-}
-
-void openavbQueueHeadUnlock(openavb_queue_t queue)
-{
-}
-
-void openavbQueueHeadPush(openavb_queue_t queue)
-{
- if (queue) {
- queue->elemArray[queue->head++].setFlg = TRUE;
- if (queue->head >= queue->queueSize) {
- queue->head = 0;
- }
- }
-}
-
-openavb_queue_elem_t openavbQueueTailLock(openavb_queue_t queue)
-{
- if (queue) {
- if (queue->elemArray[queue->tail].setFlg) {
- return &queue->elemArray[queue->tail];
- }
- }
- return NULL;
-}
-
-void openavbQueueTailUnlock(openavb_queue_t queue)
-{
-}
-
-void openavbQueueTailPull(openavb_queue_t queue)
-{
- if (queue) {
- queue->elemArray[queue->tail++].setFlg = FALSE;
- if (queue->tail >= queue->queueSize) {
- queue->tail = 0;
- }
- }
-}
+/*************************************************************************************************************
+Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+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.
+
+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.
+*************************************************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "openavb_debug.h"
+#include "openavb_queue.h"
+
+OPENAVB_CODE_MODULE_PRI
+
+struct openavb_queue_elem {
+ bool setFlg;
+ void *data;
+};
+
+struct openavb_queue {
+ // Size of each element
+ U32 elemSize;
+
+ // Number of queue element slots
+ U32 queueSize;
+
+ // Next element to be filled
+ int head;
+
+ // Next element to be pulled
+ int tail;
+
+ openavb_queue_elem_t elemArray;
+};
+
+openavb_queue_t openavbQueueNewQueue(U32 elemSize, U32 queueSize)
+{
+ if (elemSize < 1 || queueSize < 1)
+ return NULL;
+
+ openavb_queue_t retQueue = calloc(1, sizeof(struct openavb_queue));
+ if (retQueue) {
+ retQueue->elemArray = calloc(queueSize, sizeof(struct openavb_queue_elem));
+ if (retQueue->elemArray) {
+ U32 i1;
+ for (i1 = 0; i1 < queueSize; i1++) {
+ retQueue->elemArray[i1].data = calloc(1, elemSize);
+ if (!retQueue->elemArray[i1].data) {
+ openavbQueueDeleteQueue(retQueue);
+ return NULL;
+ }
+ }
+ }
+ else {
+ openavbQueueDeleteQueue(retQueue);
+ return NULL;
+ }
+
+ retQueue->elemSize = elemSize;
+ retQueue->queueSize = queueSize;
+ retQueue->head = 0;
+ retQueue->tail = 0;
+ }
+
+ return retQueue;
+}
+
+void openavbQueueDeleteQueue(openavb_queue_t queue)
+{
+ if (queue) {
+ U32 i1;
+ for (i1 = 0; i1 < queue->queueSize; i1++) {
+ free(queue->elemArray[i1].data);
+ queue->elemArray[i1].data = NULL;
+ }
+ free(queue->elemArray);
+ queue->elemArray = NULL;
+ free(queue);
+ }
+}
+
+U32 openavbQueueGetQueueSize(openavb_queue_t queue)
+{
+ if (queue) {
+ return queue->queueSize;
+ }
+ return 0;
+}
+
+U32 openavbQueueGetElemCount(openavb_queue_t queue)
+{
+ U32 cnt = 0;
+ if (queue) {
+ if (queue->head > queue->tail) {
+ cnt += queue->head - queue->tail - 1;
+ }
+ else if (queue->head < queue->tail) {
+ cnt += queue->head + ((queue->queueSize - 1) - queue->tail);
+ }
+
+ if (queue->elemArray[queue->tail].setFlg) {
+ cnt++;
+ }
+ }
+ return cnt;
+}
+
+U32 openavbQueueGetElemSize(openavb_queue_t queue)
+{
+ if (queue) {
+ return queue->elemSize;
+ }
+ return 0;
+}
+
+void *openavbQueueData(openavb_queue_elem_t elem)
+{
+ if (elem) {
+ return elem->data;
+ }
+ return NULL;
+}
+
+openavb_queue_elem_t openavbQueueHeadLock(openavb_queue_t queue)
+{
+ if (queue) {
+ if (!queue->elemArray[queue->head].setFlg) {
+ return &queue->elemArray[queue->head];
+ }
+ }
+ return NULL;
+}
+
+void openavbQueueHeadUnlock(openavb_queue_t queue)
+{
+}
+
+void openavbQueueHeadPush(openavb_queue_t queue)
+{
+ if (queue) {
+ queue->elemArray[queue->head++].setFlg = TRUE;
+ if (queue->head >= queue->queueSize) {
+ queue->head = 0;
+ }
+ }
+}
+
+openavb_queue_elem_t openavbQueueTailLock(openavb_queue_t queue)
+{
+ if (queue) {
+ if (queue->elemArray[queue->tail].setFlg) {
+ return &queue->elemArray[queue->tail];
+ }
+ }
+ return NULL;
+}
+
+void openavbQueueTailUnlock(openavb_queue_t queue)
+{
+}
+
+void openavbQueueTailPull(openavb_queue_t queue)
+{
+ if (queue) {
+ queue->elemArray[queue->tail++].setFlg = FALSE;
+ if (queue->tail >= queue->queueSize) {
+ queue->tail = 0;
+ }
+ }
+}