////////////////////////////////////////////////////////////////////////////////////////////
/// \file HwCom_Defines.h
/// \par Copyright
/// Copyright 2010-2019 STAR COOPERATION GmbH. All rights reserved.
/// \brief
/// This file contains the common PC HW structures and enumerations.
////////////////////////////////////////////////////////////////////////////////////////////

#ifndef _HWCOM_DEFINES_H_
#define _HWCOM_DEFINES_H_

/******************************************************************************
                    I N C L U D E S
******************************************************************************/
#include "HwCom_BasicTypes.h"

/******************************************************************************
					D E F I N E S
******************************************************************************/
#define UDPMAXPAYLOADLENGTH		            1440	/* Maximum UDP Payload length */
#define RBS_MANIPULATION_64_MAX_UID_COUNT   1000

/******************************************************************************
                    T Y P E S
******************************************************************************/

/// \brief Defines a handle to a PC->Hardware communication object.
typedef void* COM_Handle;

/// \brief Return values used by the interface functions. This type provides information about an error. A zero value means no error occured.
typedef enum COM_RETURNtag
{
    COM_RETURN_OK = 0,                  ///< Function executed successfully.
    COM_RETURN_Failed,                  ///< Function execution failed.
    COM_RETURN_InvalidHandle,           ///< The handle parameter was NULL or not a matching PC HW interface handle.
    COM_RETURN_InvalidParameter,        ///< One of the parameter was invalid.
    COM_RETURN_NullPointer,             ///< One of the paramter was a NULL pointer but should point to a stucture or variable.
    COM_RETURN_Timeout,                 ///< The hardware was not responding or not reachable.
    COM_RETURN_NotSupported,            ///< The command requested was not supported by the application on the hardware.
    COM_RETURN_AlreadyRunning,          ///< The function / application is already running.
    COM_RETURN_Locked                   ///< The function can not be executed while the HW/SW/region is locked.
} COM_RETURN;

/// \brief Possible hardware platforms for the PC HW interface.
typedef enum COM_HW_TYPEtag
{
    /* ID: 0-9 */
    COM_HW_TYPE_NotSpecified = 0,			  ///< Not known or unspecified hardware
    COM_HW_TYPE_Reserved1,				  ///< ID reserved for older device not existing any more
    COM_HW_TYPE_Reserved2,				  ///< ID reserved for older device not existing any more
    COM_HW_TYPE_FlexCard_APEX,			  ///< The hardware is a FlexCard APEX
    COM_HW_TYPE_FlexCard_cyclone,		  ///< The hardware is a FlexCard Cyclone
    COM_HW_TYPE_FlexCard_cycloneII,		  ///< The hardware is a FlexCard Cyclone II
    COM_HW_TYPE_FlexCard_PXI,			  ///< The hardware is a FlexCard PXI
    COM_HW_TYPE_FlexCard_PMC,			  ///< The hardware is a FlexCard PMC or PCI
    COM_HW_TYPE_FlexCard_cycloneIISE,	  ///< The hardware is a FlexCard Cyclone II SE
    COM_HW_TYPE_FlexCard_PMCII = 9,         ///< The hardware is a FlexCard PMC II
    COM_HW_TYPE_FL3X_Interface_PMC = 9,     ///< The hardware is a FL3X Interface-PMC

    /* ID: 10-19 */
    COM_HW_TYPE_FlexDevice_M_0P01 = 10,       ///< The hardware is a FlexDevice-M 0P01 (= FlexDevice_M with black case; Layout Version 1.1)
    COM_HW_TYPE_FlexXCon_midget_0P01 = 10,

    COM_HW_TYPE_FlexDevice_M_0P02 = 11,       ///< The hardware is a FlexDevice-M 0P02 (= FlexDevice_M with grey case; Layout Version 2.x; Binder connectors)
    COM_HW_TYPE_FlexXCon_midget_0P02 = 11,

    COM_HW_TYPE_FlexDevice_M_0R01 = 12,       ///< The hardware is a FlexDevice-M 0R01 (= FlexDevice_M with grey case; Layout Version 2.x; Lemo connectors)
    COM_HW_TYPE_FlexXCon_midget_0R01 = 12,

    COM_HW_TYPE_FlexXCon_expert = 13,         ///< The hardware is a FlexXCon expert

    COM_HW_TYPE_FlexCard_USB = 14,            ///< The hardware is a FlexCard USB

    COM_HW_TYPE_FlexXCon_compact = 15,        ///< The hardware is a FlexXCon compact

    COM_HW_TYPE_PCIeNGP = 16,                 ///< The hardware is a PCIeNGP

    COM_HW_TYPE_FlexDevice_L_0A01 = 17,                         ///< The hardware is a FlexDevice-L 0A01-01  
    COM_HW_TYPE_FL3X_Device_L_0A01 = 17,                        ///< The hardware is a FL3X Device-L 0A01-01  
    COM_HW_TYPE_FLEX_DEVICE_L_2SOC_0S01 = 18,                   ///< The hardware is a FlexDevice-L² 0S01-01 
    COM_HW_TYPE_FL3X_DEVICE_L_2SOC_0S01 = 18,                   ///< The hardware is a FL3X Device-L² 0S01-01 
    COM_HW_TYPE_FLEX_DEVICE_L_2SOC_HDSUB_AS_0S01 = 19,          ///< The hardware is a FlexDevice-L² 0S01-01 with other connectors (HDSUB) 
    COM_HW_TYPE_FLEX_DEVICE_L_0A02 = 20,                        ///< The hardware is a FlexDevice-L 0A02-01 (2nd gen)
    COM_HW_TYPE_FL3X_DEVICE_L_0A02 = 20,                        ///< The hardware is a FL3X Device-L 0A02-01 (2nd gen)
    COM_HW_TYPE_FLEX_DEVICE_L_2SOC_0S02 = 21,                   ///< The hardware is a FlexDevice-L² 0S02-01 (2nd gen)
    COM_HW_TYPE_FL3X_DEVICE_L_2SOC_0S02 = 21,                   ///< The hardware is a FL3X Device-L² 0S02-01 (2nd gen)
    COM_HW_TYPE_FLEX_DEVICE_L_2SOC_HDSUB_AS_0S02 = 22,          ///< The hardware is a FlexDevice-L² 0S02-01 (2nd gen) with other connectors (HDSUB) 
    COM_HW_TYPE_FLEX_DEVICE_S_0A01 = 23,                        ///< The hardware is a FlexDevice-S 0A01
    COM_HW_TYPE_FL3X_DEVICE_S_0A01 = 23,                        ///< The hardware is a FL3X Device-S 0A01
    COM_HW_TYPE_FlexCard_PXIe3_0A01 = 24,                       ///< The hardware is a FlexCard PXIe3
    COM_HW_TYPE_FL3X_DEVICE_PXIe_0A01 = 24,                     ///< The hardware is a FL3X Device PXIe 0A01
    COM_HW_TYPE_FlexCard_PCIe3_0A01 = 25,                       ///< The hardware is a FlexCard PCIe3
    COM_HW_TYPE_FL3X_DEVICE_PCIe_0A01 = 25,                     ///< The hardware is a FL3X Device PCIe 0A01
    COM_HW_TYPE_FLEX_DEVICE_L_3RD_GEN = 26,                     ///< The hardware is a FlexDevice-L 0A03-01 (3nd gen)
    COM_HW_TYPE_FL3X_DEVICE_L_3RD_GEN = 26,                     ///< The hardware is a FL3X Device-L 0A03-01 (3nd gen)
    COM_HW_TYPE_FLEX_DEVICE_L_2SOC_3RD_GEN = 27,                ///< The hardware is a FlexDevice-L² 0S03-01 (3nd gen)
    COM_HW_TYPE_FL3X_DEVICE_L_2SOC_3RD_GEN = 27,                ///< The hardware is a FL3X Device-L² 0S03-01 (3nd gen)

    COM_HW_TYPE_FLEX_SYSTEM_XS_0A01_01 = 28,                    ///< The hardware is a FlexSystem-XS 0A01-01 (1st gen)
    COM_HW_TYPE_FL3X_SYSTEM_XS_0A01_01 = 28,                    ///< The hardware is a FL3X System-XS 0A01-01 (1st gen)
    COM_HW_TYPE_FLEX_SYSTEM_XS_SQUARED_0C01_01 = 29,            ///< The hardware is a FlexSystem-XS² 0C01-01 (1st gen)
    COM_HW_TYPE_FL3X_SYSTEM_XS_SQUARED_0C01_01 = 29,            ///< The hardware is a FL3X System-XS² 0C01-01 (1st gen)
    COM_HW_TYPE_FLEX_SYSTEM_XS_CUBED_0D01_01 = 30,              ///< The hardware is a FlexSystem-XS³ 0D01-01 (1st gen)
    COM_HW_TYPE_FL3X_SYSTEM_XS_CUBED_0D01_01 = 30,              ///< The hardware is a FL3X System-XS³ 0D01-01 (1st gen)
    COM_HW_TYPE_FLEX_SYSTEM_M_0A01_01 = 31,                     ///< The hardware is a FlexSystem-M 0A01-01 (1st gen)
    COM_HW_TYPE_FL3X_SYSTEM_M_0A01_01 = 31,                     ///< The hardware is a FL3X System-M 0A01-01 (1st gen)

    COM_HW_TYPE_FL3X_INTERFACE_S_2A01 = 32,                     ///< The hardware is a FL3X Interface-S 2A01
    COM_HW_TYPE_FL3X_INTERFACE_L_2A01 = 33,                     ///< The hardware is a FL3X Interface-L 2A01
    COM_HW_TYPE_FL3X_INTERFACE_L_2SOC_2B01 = 34,                ///< The hardware is a FL3X Interface-L² 2B01
    COM_HW_TYPE_FL3X_INTERFACE_PXIe_2A01 = 35,                  ///< The hardware is a FL3X Interface-PXIe 2A01
    COM_HW_TYPE_FL3X_INTERFACE_PCIe_2A01 = 36,                  ///< The hardware is a FL3X Interface-PCIe 2A01
    COM_HW_TYPE_MINIPCIE_SFP_SINGLE_DELOCK_95267 = 37,          ///< The hardware is Mini PCIe SFP Single (DeLOCK 956267)
    COM_HW_TYPE_PCIE_SFP_QUAD_LREC9714HF_4SFP = 38,             ///< The hardware is PCIe SFP Quad (LREC9714HF-4SFP)
    COM_HW_TYPE_CMI_10G_DUAL_PORT_10GBASE_T_CMI_10GLAN03 = 39,  ///< The hardware is CMI 10G Dual Port 10GBASE - T(CMI - 10GLAN03)
    COM_HW_TYPE_8DI_8DO_CMI_DIO02_UB1018 = 40,                  ///< The hardware is CMI 8xDI 8xDO (CMI-DIO02/UB1018) 
    COM_HW_TYPE_FL3X_TAP_10GBASE_T1 = 41,                       ///< The hardware is a FL3X TAP 10GBASE-T1
    COM_HW_TYPE_FLEX_TAP_10GBASE_T1 = 41,                       ///< The hardware is a FL3X TAP 10GBASE-T1
    COM_HW_TYPE_FL3X_TAP_1000BASE_T1 = 42,                      ///< The hardware is a FL3X TAP 1000BASE-T1
    COM_HW_TYPE_FLEX_TAP_1000BASE_T1 = 42,                      ///< The hardware is a FL3X TAP 1000BASE-T1
    COM_HW_TYPE_FL3X_TAP_100BASE_T1 = 43,                       ///< The hardware is a FL3X TAP 100BASE-T1
    COM_HW_TYPE_FLEX_TAP_100BASE_T1 = 43,                       ///< The hardware is a FL3X TAP 100BASE-T1
    COM_HW_TYPE_FL3X_TAP_10GBASE_T1_PLUS = 44,                  ///< The hardware is a FL3X TAP 10GBASE-T1 Plus
    COM_HW_TYPE_FLEX_TAP_10GBASE_T1_PLUS = 44,                  ///< The hardware is a FL3X TAP 10GBASE-T1 Plus
    COM_HW_TYPE_FL3X_TAP_1000BASE_T1_PLUS = 45,                 ///< The hardware is a FL3X TAP 1000BASE-T1 Plus
    COM_HW_TYPE_FLEX_TAP_1000BASE_T1_PLUS = 45,                 ///< The hardware is a FL3X TAP 1000BASE-T1 Plus
    COM_HW_TYPE_FL3X_TAP_100BASE_T1_PLUS = 46,                  ///< The hardware is a FL3X TAP 100BASE-T1 Plus
    COM_HW_TYPE_FLEX_TAP_100BASE_T1_PLUS = 46,                   ///< The hardware is a FL3X TAP 100BASE-T1 Plus
    COM_HW_TYPE_PCIE_SFP_PLUS_10G_DUAL_LREC9812BF = 47,         ///< The hardware is PCIe 10G 2SFP+ (LREC9812BF-2SFP+)
    /* !!! Attention !!! */
    /* Extentions of the list should be made in agreement with the developers of all products. */
}COM_HW_TYPE;


/// \brief Possible bus types available as a channel in the hardware.
typedef enum COM_BUSTYPEtag
{
    COM_BUSTYPE_Unknown = 0,            ///< The bus type is Not known
    COM_BUSTYPE_FlexRay,                ///< The bus type is FlexRay
    COM_BUSTYPE_CAN,                    ///< The bus type is CAN
    COM_BUSTYPE_ETH,                    ///< The bus type is Ethernet (100BASE-TX/1000BASE-T)
    COM_BUSTYPE_RS232,                  ///< The bus type is a serial RS232 connection
    COM_BUSTYPE_CAN_LS,                 ///< The bus type is CAN_LS
    COM_BUSTYPE_CAN_HS,                 ///< The bus type is CAN_HS
    COM_BUSTYPE_LIN,                    ///< The bus type is LIN    
    COM_BUSTYPE_K_LINE,                 ///< The bus type is K-LINE 
    COM_BUSTYPE_FLEXRAY_ISO,            ///< The bus type is FlexRay Iso    
    COM_BUSTYPE_CAN_HS_ISO,             ///< The bus type is CAN_HS Iso 
    COM_BUSTYPE_CAN_LS_ISO,             ///< The bus type is CAN_LS Iso 
    COM_BUSTYPE_LIN_ISO,                ///< The bus type is LIN Iso    
    COM_BUSTYPE_RS232_ISO,              ///< The bus type is RS232 Iso  
    COM_BUSTYPE_CAN_FD,                 ///< The bus type is CAN-FD
    COM_BUSTYPE_CAN_FD_ISO,             ///< The bus type is CAN-FD Iso
    COM_BUSTYPE_USB,                    ///< The bus type is USB
    COM_BUSTYPE_BROADR_REACH,           ///< The bus type is Automotive Ethernet (100/1000BASE-T1)
    COM_BUSTYPE_BROADR_REACH_SWITCHED,  ///< The bus type is Automotive Ethernet (100/1000BASE-T1) switched
    COM_BUSTYPE_ETH_SWITCHED,           ///< The bus type is Ethernet (100BASE-TX/1000BASE-T) switched
    COM_BUSTYPE_SENT,			        ///< The bus type is SENT
    COM_BUSTYPE_SPI,                    ///< The bus type is SPI
    COM_BUSTYPE_UART,                   ///< The bus type is UART

}COM_BUSTYPE;

/// \brief Possible tiny types available for a channel in the hardware.
typedef enum COM_TINYTYPEtag
{
    COM_TINYTYPE_Unknown = 0,                       ///< The tiny type is Not known
    COM_TINYTYPE_FlexRay = 11,                      ///< FlexRay Tiny.
    COM_TINYTYPE_FlexRay_STAR = 12,					///< FlexRay Star.
    COM_TINYTYPE_FlexRay_BUSGUARDIAN = 13,			///< FlexRay Tiny with Busguardian.
    COM_TINYTYPE_FlexRay_ISO = 14,					///< FlexRay Tiny with isolated bus.
    COM_TINYTYPE_CAN_HS = 21,						///< CAN-HS Tiny.
    COM_TINYTYPE_CAN_LS = 22,						///< CAN-LS Tiny.
    COM_TINYTYPE_CAN_SW = 23,						///< CAN Single Wire Tiny.
    COM_TINYTYPE_CAN_HS_ISO = 24,					///< CAN-HS Tiny with isolated bus.
    COM_TINYTYPE_CAN_LS_ISO = 25,					///< CAN-LS Tiny with isolated bus.
    COM_TINYTYPE_CAN_FD = 26,						///< CAN-FD Tiny.
    COM_TINYTYPE_CAN_FD_ISO = 27,					///< CAN-FD Tiny with isolated bus. Supports also CAN-HS.
    COM_TINYTYPE_CAN_FD_4x = 28,					///< CAN-FD Tiny with four transceivers. Supports also CAN-HS. Works only with FlexDevice-L² Rev2 (with 0x10921080).
    COM_TINYTYPE_LIN = 31,							///< LIN Tiny.
    COM_TINYTYPE_LIN_ISO = 32,						///< LIN Tiny with isolated bus.
	COM_TINYTYPE_LIN_SENT = 33,						///< Tiny with 4 LIN and 2 SENT channels.	
	COM_TINYRYPE_TYPE_LIN_SENT_CAN_FD = 34,         ///< Tiny with 1xSENT, 1xLIN and 1xCAN-FD
    COM_TINYTYPE_RS232 = 41,						///< RS232 Tiny.
    COM_TINYTYPE_RS232_ISO = 42,					///< RS232 Tiny with isolated bus.
    COM_TINYTYPE_SPI = 43,                          ///< SPI Tiny.
    COM_TINYTYPE_K_LINE = 51,						///< K-Line Tiny.
    COM_TINYTYPE_K_LINE_UART_SPI = 52,              ///< K-Line / UART /SPI Tiny with one K-Line, one UART and one SPI channel.
    COM_TINYTYPE_ETHERNET_10MBit = 61,				///< Ethernet Tiny with 10BASE-T Ethernet support.
    COM_TINYTYPE_ETHERNET_1GBit = 62,				///< Ethernet Tiny with 1000BASE-T Ethernet support.
    COM_TINYTYPE_ETHERNET_100MBit = 63,				///< Ethernet Tiny with 100BASE-TX Ethernet support. Special case: the Tiny 0D01_FlexTiny2_Ethernet_DP83640 has the value 62.
    COM_TINYTYPE_USB = 71,							///< USB Tiny.
    COM_TINYTYPE_BROADR_REACH = 81,					///< 100BASE-T1 Tiny.
    COM_TINYTYPE_BROADR_REACH_SWITCH = 82,			///< 100BASE-T1 Tiny with a switch module.
    COM_TINYTYPE_BROADR_REACH_SWITCH_TRIPLE = 83,	///< 100BASE-T1 Tiny with 3 switch modules. This Tiny uses three tiny slots. Each slot will return this value.
    COM_TINYTYPE_BROADR_REACH_LIN = 84,             ///< 100BASE-T1 / LIN Tiny with one 100BASE-T1 and one LIN channel.
	COM_TINYTYPE_BROADR_REACH_1GB = 85,             ///< 1000BASE-T1 Tiny with 1GBit support.
	COM_TINYTYPE_MACSEC_1GB = 86,				    ///<  Automotive Ethernet MACsec Switch.
	COM_TINYTYPE_BROADR_REACH_10BASE_T1S = 87,      ///<  Automotive Ethernet 10BASE-T1S Dual Tiny.
    COM_TINYTYPE_MULTI_TRANSCEIVER = 99,            ///< A Tiny with multiple transceiver types.
    COM_TINYTYPE_PL_ADAPTER = 0xF1					///< Physical Layer Adapter Tiny to use Tiny v2 at Tiny v1 slots.
}COM_TINYTYPE;

/// \brief Possible FPGA firmware configurations in the hardware.
typedef enum COM_FPGATYPEtag
{
    COM_FPGATYPE_Unknown = 0,                       ///< The Firmware in the FPGA is unknown
    COM_FPGATYPE_None,                              ///< There is no Firmware in the FPGA
    COM_FPGATYPE_NotUsed,                           ///< The Firmware in the FPGA is not used
    
    COM_FPGATYPE_Cyclone_II_Analyse = 0x10,         ///< The Firmware in the FPGA is an analyzing application in a Cyclone II
    COM_FPGATYPE_Cyclone_II_RBS,                    ///< The Firmware in the FPGA is a remaining bus simulation application in a Cyclone II
    COM_FPGATYPE_Cyclone_II_FR_Extention,           ///< The Firmware in the FPGA is a FlexRay extention in a Cyclone II
    
	COM_FPGATYPE_FlexCard_PMCII_2ERAY_SELFSYNC_4MCAN = 0x20,    ///< The Firmware in the FPGA for FlexCard PMC-II with 2x1 E-Ray (SelfSync) and 4x1 M-CAN
    
    COM_FPGATYPE_FlexDevice_M_EEPROM = 0x30,
    COM_FPGATYPE_MIDGET_EEPROM = 0x30,
    COM_FPGATYPE_FlexDevice_M_0N01_EEPROM = 0x31,   ///< The Firmware in the FPGA is a EEPROM extension for FlexDevice-M 0P01
    COM_FPGATYPE_MIDGET_0N01_EEPROM = 0x31,         
    COM_FPGATYPE_FlexDevice_M_0N02_EEPROM = 0x32,   ///< The Firmware in the FPGA is a EEPROM extension for FlexDevice-M 0P02
    COM_FPGATYPE_MIDGET_0N02_EEPROM = 0x32,         
    COM_FPGATYPE_FlexDevice_M_0M01_EEPROM = 0x33,   ///< The Firmware in the FPGA is a EEPROM extension for FlexDevice-M 0R01
    COM_FPGATYPE_MIDGET_0M01_EEPROM = 0x33,         
    
    COM_FPGATYPE_FlexDevice_M_EEPROM_0M01_PROVETECH = 0x40,
    COM_FPGATYPE_MIDGET_EEPROM_0M01_PROVETECH = 0x40,
    COM_FPGATYPE_FlexDevice_M_0N01_EEPROM_PROVETECH = 0x41,     ///< The Firmware in the FPGA is designed for PROOVTECH
    COM_FPGATYPE_MIDGET_0N01_EEPROM_PROVETECH = 0x41,           
    COM_FPGATYPE_FlexDevice_M_0N02_EEPROM_PROVETECH = 0x42,     ///< The Firmware in the FPGA is designed for PROOVTECH
    COM_FPGATYPE_MIDGET_0N02_EEPROM_PROVETECH = 0x42,           
    COM_FPGATYPE_FlexDevice_M_0M01_EEPROM_PROVETECH = 0x43,     ///< The Firmware in the FPGA is designed for PROOVTECH
    COM_FPGATYPE_MIDGET_0M01_EEPROM_PROVETECH = 0x43,           
    
    COM_FPGATYPE_FlexDevice_M_EEPROM_0N02_0M01_ERAYS = 0x50,
    COM_FPGATYPE_MIDGET_EEPROM_0N02_0M01_ERAYS = 0x50,
    COM_FPGATYPE_FlexDevice_M_0N01_EEPROM_ERAYS = 0x51,         ///< The Firmware in the FPGA includes 2 E-Rays
    COM_FPGATYPE_MIDGET_0N01_EEPROM_ERAYS = 0x51,               
    COM_FPGATYPE_FlexDevice_M_0N02_0M01_EEPROM_ERAYS = 0x52,    ///< The Firmware in the FPGA includes 2 E-Rays
    COM_FPGATYPE_MIDGET_0N02_0M01_EEPROM_ERAYS = 0x52,          
    
    /*FlexDevice-L Rev1*/
    COM_FPGATYPE_FlexDevice_L_0C01_4ERAYS_2DCAN = 0x60,                 ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 2x1 E-Ray and 2x1 D-CAN
    COM_FPGATYPE_FlexDevice_L_0C01_2ERAYS_2ERAYS_2DCAN = 0x60,          ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 2x2 E-Ray and 2x1 D-CAN
    COM_FPGATYPE_FlexDevice_L_0C01_3ERAY_2MCAN_TS = 0x61,               ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1x2 and 1x1 E-Ray, 2x1 M-CAN (CANFD) and timestamp unit
    COM_FPGATYPE_FlexDevice_L_0C01_2ERAY_1ERAY_2MCAN_TS = 0x61,         ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1x2 and 1x1 E-Ray, 2x1 M-CAN (CANFD) and timestamp unit
    COM_FPGATYPE_FlexDevice_L_0C01_1ETH_8MCAN_TS = 0x62,                ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1 Ethernet, 8x1 M-CAN (CANFD) and timestamp unit
	COM_FPGATYPE_FlexDevice_L_0C01_1ETH_2MCAN_TS = 0x63,                ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1 Ethernet, 2x1 M-CAN (CANFD) and timestamp unit
	COM_FPGATYPE_FlexDevice_L_0C01_10MCAN_TS = 0x64,                    ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 10x1 M-CAN (CANFD) and timestamp unit
	COM_FPGATYPE_FlexDevice_L_0C01_2ERAYS_1ERAY_1ERAY_2DCAN = 0x65,     ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1x2 and 2x1 E-Ray, 2x1 D-CAN
    COM_FPGATYPE_FlexDevice_L_0C01_2ERAY_1ERAY_2MCAN_0PCETH_TS = 0x66,  ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1x2 and 1x1 E-Ray, 2x1 M-CAN (CANFD) and timestamp unit. The PC EHT connector is disabled to use it as second RBS channel.
    COM_FPGATYPE_FlexDevice_L_0C01_2ERAY_5MCAN_1DCAN = 0x68,            ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1x2 E-Ray, 5x1 M-CAN (CANFD) and 1x1 D-CAN (CANHS).
    COM_FPGATYPE_FlexDevice_L_0C01_7ETH_MUX = 0x69,                     ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 7 Ethernet channels (this FPGA image is actually not available).
    COM_FPGATYPE_FlexDevice_L_0C01_2ERAY_2MCAN_5ETH_MUX_TS = 0x6A,      ///< The Firmware in the FPGA for FlexDevice-L (Rev 1; 0A01) with 1x2 E-Ray, 2x1 M-CAN (CANFD), 5 Ethernet and timestamp unit.

    /*FlexDevice-L Rev2*/
    COM_FPGATYPE_FlexDevice_L_0C02_4ERAYS_2DCAN = 0x1060,                 ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 2x1 E-Ray and 2x1 D-CAN
    COM_FPGATYPE_FlexDevice_L_0C02_2ERAYS_2ERAYS_2DCAN = 0x1060,          ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 2x2 E-Ray and 2x1 D-CAN
    COM_FPGATYPE_FlexDevice_L_0C02_3ERAY_2MCAN_TS = 0x1061,               ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1x2 and 1x1 E-Ray, 2x1 M-CAN (CANFD) and timestamp unit
    COM_FPGATYPE_FlexDevice_L_0C02_2ERAY_1ERAY_2MCAN_TS = 0x1061,         ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1x2 and 1x1 E-Ray, 2x1 M-CAN (CANFD) and timestamp unit
    COM_FPGATYPE_FlexDevice_L_0C02_1ETH_8MCAN_TS = 0x1062,                ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1 Ethernet, 8x1 M-CAN (CANFD) and timestamp unit
	COM_FPGATYPE_FlexDevice_L_0C02_1ETH_2MCAN_TS = 0x1063,                ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1 Ethernet, 2x1 M-CAN (CANFD) and timestamp unit
	COM_FPGATYPE_FlexDevice_L_0C02_10MCAN_TS = 0x1064,                    ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 10x1 M-CAN (CANFD) and timestamp unit
	COM_FPGATYPE_FlexDevice_L_0C02_2ERAYS_1ERAY_1ERAY_2DCAN = 0x1065,     ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1x2 and 2x1 E-Ray, 2x1 D-CAN
    COM_FPGATYPE_FlexDevice_L_0C02_2ERAY_1ERAY_2MCAN_0PCETH_TS = 0x1066,  ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1x2 and 1x1 E-Ray, 2x1 M-CAN (CANFD) and timestamp unit. The PC EHT connector is disabled to use it as second RBS channel.
    COM_FPGATYPE_FlexDevice_L_0C02_2ERAY_5MCAN_1DCAN = 0x1068,            ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1x2 E-Ray, 5x1 M-CAN (CANFD) and 1x1 D-CAN (CANHS).
    COM_FPGATYPE_FlexDevice_L_0C02_7ETH_MUX = 0x1069,                     ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 7 Ethernet channels.
    COM_FPGATYPE_FlexDevice_L_0C02_2ERAY_2MCAN_5ETH_MUX_TS = 0x106A,      ///< The Firmware in the FPGA for FlexDevice-L (Rev 2; 0A02) with 1x2 E-Ray, 2x1 M-CAN (CANFD), 5 Ethernet and timestamp unit.

    /*FlexDevice-L² Rev1*/
    COM_FPGATYPE_FlexDevice_L_2SOC_2ERAYA_2ERAYA_TS = 0x80,                 ///< The Firmware in the FPGA for FlexDevice-L² (Rev 1; 0S01) with 2x2 E-Ray (A-Channel) and timestamp unit. This image is combined with the image 0x90 adn 0x92.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ERAY_TS = 0x81,                         ///< The Firmware in the FPGA for FlexDevice-L² (Rev 1; 0S01) with 1x2 E-Ray and timestamp unit. This image is combined with the image 0x91.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ERAY_4MCAN_TS = 0x90,                   ///< The Firmware in the FPGA for FlexDevice-L² (Rev 1; 0S01) with 1x2 E-Ray, 4x1 M-CAN (CANFD) and timestamp unit. This image is combined with the image 0x80.
    COM_FPGATYPE_FlexDevice_L_2SOC_6MCAN_TS = 0x91,                         ///< The Firmware in the FPGA for FlexDevice-L² (Rev 1; 0S01) with 6x1 M-CAN (CANFD) and timestamp unit. This image is combined with the image 0x81.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ERAY_2ERAYA_8MCAN_4LIN_2SENT_TS = 0x92, ///< The Firmware in the FPGA for FlexDevice-L² (Rev 1; 0S01) with 3x2 E-Ray, 8x1 M-CAN (CANFD), 4xLin, 2xSent and timestamp unit. This image is combined with the image 0x80.

    /*FlexDevice-L² Rev2*/
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_2ERAYA_2ERAYA_TS = 0x1080,                 ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 2x2 E-Ray (A-Channel) and timestamp unit. This image is combined with the image 0x1090 and 0x1092.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_2ERAY_TS = 0x1081,                         ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 1x2 E-Ray and timestamp unit. This image is combined with the image 0x1091.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_2ERAY_2ERAY_TS = 0x1082,                   ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 2x2 E-Ray and timestamp unit. This image is combined with the image 0x1093.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_1ERAY_1ERAY_3ETH_MUX_TS = 0x1083,          ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 2x1 E-Ray, 3xETH and timestamp unit. This image is combined with the image 0x1092 and 0x1094.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_2ERAY_4MCAN_TS = 0x1090,                   ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 1x2 E-Ray (A channel only), 4x1 M-CAN (CANFD) and timestamp unit. This image is combined with the image 0x1080.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_6MCAN_TS = 0x1091,                         ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 6x1 M-CAN (CANFD) and timestamp unit. This image is combined with the image 0x1081.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_2ERAY_2ERAYA_8MCAN_4LIN_2SENT_TS = 0x1092, ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 3x2 E-Ray, 8x1 M-CAN (CANFD), 4xLin, 2xSent and timestamp unit. This image is combined with the image 0x1080.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_2ERAYAB_4MCAN_TS = 0x1093,                 ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 1x2 E-Ray, 4x1 M-CAN (CANFD) and timestamp unit. This image is combined with the image 0x1082.
    COM_FPGATYPE_FlexDevice_L_2SOC_2ND_GEN_8MCAN_TS = 0x1094,                         ///< The Firmware in the FPGA for FlexDevice-L² (Rev 2; 0S02) with 8x1 M-CAN (CANFD) and timestamp unit. This image is combined with the image 0x1083.

    /*FlexDevice-S Rev1*/
	COM_FPGATYPE_FlexDevice_S_2ERAY_1ERAY_2MCAN_1LIN_TS = 0xB0,  ///< The Firmware in the FPGA for FlexDevice-S with 1x2 E-Ray and 1x1 E-Ray, 2x1 M-CAN (CANFD), 1x1 LIN and timestamp unit.

	/*FlexSystem-M Rev1*/
	COM_FPGATYPE_FlexSystem_No_Image = 0x02, 

}COM_FPGATYPE;

/// \brief Possible FPGA image category.
typedef enum CCOM_FPGAImageCategorytag
{
    COM_FPGA_IMAGE_TYPE_UNKNOWN = 0,                ///< The FPGA image is unknown
	COM_FPGA_IMAGE_TYPE_FALLBACK,                   ///< The FPGA image is a fallback image
	COM_FPGA_IMAGE_TYPE_DISTRIBUTION,               ///< The FPGA image is a distribution image
	COM_FPGA_IMAGE_TYPE_APPLICATION,                ///< The FPGA image is an application image
    
}COM_FPGAImageCategory;

/// \brief Defines the different states of an application.
typedef enum COM_APP_STATEtag
{
    COM_APP_STATE_NotSpecified=0,   ///< The state of has not been set yet.
    COM_APP_STATE_Reset,            ///< The application was resetted and is not initializing yet.
    COM_APP_STATE_Initializing,     ///< The application is initializing (configuring the communication controllers of the different channels for example).
    COM_APP_STATE_Ready,            ///< The application is initialized and waits for the application start command.
    COM_APP_STATE_Running,          ///< The application is running.
    COM_APP_STATE_Stopped,          ///< The execution of the application is stopped.
    COM_APP_STATE_Error,            ///< An error occurred during the execution of the application. It is not possible to proceed. A restart is necessary.
    COM_APP_STATE_Waiting           ///< The application is waiting for an user input or an event.
}COM_APP_STATE;

/// \brief Defines the different states of a Bus / Channel.
typedef enum COM_BUS_STATEtag
{
    COM_BUS_STATE_NotSpecified=0,   ///< The state of the bus has not been set yet.
    COM_BUS_STATE_None,             ///< The state of the bus is currently undefined.
    COM_BUS_STATE_Active,           ///< The bus is active (CAN / RS232 / LIN).
    COM_BUS_STATE_Stopped,          ///< The bus is inactive (CAN / RS232 / LIN).
    COM_BUS_STATE_Disabled,         ///< The bus is disabled in this application.
    COM_BUS_STATE_Normal_active,    ///< The bus is in normal active state (FlexRay).
    COM_BUS_STATE_Normal_passive,   ///< The bus is in normal passive state (FlexRay).
    COM_BUS_STATE_Startup,          ///< The bus is in startup state (FlexRay).
    COM_BUS_STATE_Halt,             ///< The bus is in halt state (FlexRay).
    COM_BUS_STATE_Fifo_Error        ///< An FIFO error occured (CAN / RS232 / LIN / FlexRay).
}COM_BUS_STATE;

/// \brief Defines Type of Entry in Contained Message of Analyzer
typedef enum COM_ANALYZER_ENTRY_TYPEtag
{
	COM_ANALYZER_ENTRY_TYPE_SPECIAL = 0, 			/**< Check first 16 bit of Special Entry to get the Special Entry Type*/
	COM_ANALYZER_ENTRY_TYPE_FLEXRAY, 				/**< FlexRay */
	COM_ANALYZER_ENTRY_TYPE_CAN, 					/**< CAN */
	COM_ANALYZER_ENTRY_TYPE_ETH, 					/**< Ethernet */
	COM_ANALYZER_ENTRY_TYPE_RS232, 					/**< a serial RS232 connection */
	COM_ANALYZER_ENTRY_TYPE_CAN_LS, 				/**< CAN_LS */
	COM_ANALYZER_ENTRY_TYPE_CAN_HS, 				/**< CAN_HS */
	COM_ANALYZER_ENTRY_TYPE_LIN, 					/**< LIN */
	COM_ANALYZER_ENTRY_TYPE_K_LINE, 				/**< K-LINE */
	COM_ANALYZER_ENTRY_TYPE_FLEXRAY_ISO, 			/**< FlexRay ISO */
	COM_ANALYZER_ENTRY_TYPE_CAN_HS_ISO, 			/**< CAN_HS ISO */
	COM_ANALYZER_ENTRY_TYPE_CAN_LS_ISO, 			/**< CAN_LS ISO */
	COM_ANALYZER_ENTRY_TYPE_LIN_ISO, 				/**< LIN ISO */
	COM_ANALYZER_ENTRY_TYPE_RS232_ISO, 				/**< RS232 ISO */
	COM_ANALYZER_ENTRY_TYPE_CAN_FD,					/**< CAN_FD */
	COM_ANALYZER_ENTRY_TYPE_CAN_FD_ISO,				/**< CAN_FD ISO */
	COM_ANALYZER_ENTRY_TYPE_USB,					/**< USB */
	COM_ANALYZER_ENTRY_TYPE_BROADR_REACH,			/**< Automotive Ethernet  */
	COM_ANALYZER_ENTRY_TYPE_BROADR_REACH_SWITCHED,	/**< Automotive Ethernet Switched */
	COM_ANALYZER_ENTRY_TYPE_ETHERNET_SWITCHED,		/**< Ethernet Switched */
	COM_ANALYZER_ENTRY_TYPE_SENT,					/**< SENT */
	COM_ANALYZER_ENTRY_TYPE_SPI,					/**< SPI */
	COM_ANALYZER_ENTRY_TYPE_UART					/**< UART */
}COM_ANALYZER_ENTRY_TYPE;

/**
 * Analyzer protocol formats
 */
typedef enum COM_ANALYZER_PROTOCOL_FORMATtag
{
	COM_ANALYZER_PROTOCOL_FORMAT_UNKNOWN = 0,
	COM_ANALYZER_PROTOCOL_FORMAT_LEGACY,
	COM_ANALYZER_PROTOCOL_FORMAT_SDK,
	COM_ANALYZER_PROTOCOL_FORMAT_SDK_TIMESTAMP64,
	COM_ANALYZER_PROTOCOL_FORMAT_MAX
}COM_ANALYZER_PROTOCOL_FORMAT;

/**
 * Analyzer Timestamp Base
 */
typedef enum COM_ANALYZER_TIMESTAMP_BASEtag
{
	COM_ANALYZER_TIMESTAMP_BASE_DEFAULT = 0,	//< Default Timestamp Option
	COM_ANALYZER_TIMESTAMP_BASE_DEVICE_TIME,	//< Timestamp is relative to 1.1.1970, 00:00 : 00 (FPGA time)
	COM_ANALYZER_TIMESTAMP_BASE_RTC_TIME,		//< Timestamp is relative to current RTC time
	COM_ANALYZER_TIMESTAMP_BASE_BUS_TIME		//< Timestamp is relative to configured time sync instance
}COM_ANALYZER_TIMESTAMP_BASE;

/// \brief Defines the data direction of a streaming message.
typedef enum COM_Direction
{
    COM_DirectionReceive=0,     ///< The message was received by the hardware.
    COM_DirectionTransmit,      ///< The message was sent by the hardware.
} COM_Direction;

/// \brief Defines transceiver states
typedef enum COM_Transceiver_State
{
	COM_TRANSCEIVER_STATE_UNKNOWN = 0,
	COM_TRANSCEIVER_STATE_OFF = 1,
	COM_TRANSCEIVER_STATE_NORMAL = 2,
	COM_TRANSCEIVER_STATE_STANDBY = 3,
	COM_TRANSCEIVER_STATE_SLEEP = 4
} COM_Transceiver_State;

/// \brief Defines transceiver sub state 1
typedef enum COM_Transceiver_Sub_State_1
{
	COM_TRANSCEIVER_SUB_STATE1_NO_STATE = 0,

	COM_TRANSCEIVER_SUB_STATE1_ETH_LINK_DOWN = 1,
	COM_TRANSCEIVER_SUB_STATE1_ETH_LINK_UP = 2
} COM_Transceiver_Sub_State_1;

/// \brief Defines transceiver sub state 2
typedef enum COM_Transceiver_Sub_State_2
{
	COM_TRANSCEIVER_SUB_STATE2_NO_STATE = 0,

	COM_TRANSCEIVER_SUB_STATE2_ETH_DISABLED = 1,
	COM_TRANSCEIVER_SUB_STATE2_ETH_100BASE_T1_MASTER = 2,
	COM_TRANSCEIVER_SUB_STATE2_ETH_100BASE_T1_SLAVE = 3,
	COM_TRANSCEIVER_SUB_STATE2_ETH_1000BASE_T1_MASTER_IEEE = 4,
	COM_TRANSCEIVER_SUB_STATE2_ETH_1000BASE_T1_SLAVE_IEEE = 5,
	COM_TRANSCEIVER_SUB_STATE2_ETH_1000BASE_T1_MASTER_LEGACY_A0 = 6,
	COM_TRANSCEIVER_SUB_STATE2_ETH_1000BASE_T1_SLAVE_LEGACY_A0 = 7,

	COM_TRANSCEIVER_SUB_STATE2_ETH_10BASE_TX_FIXED = 8,
	COM_TRANSCEIVER_SUB_STATE2_ETH_100BASE_TX_FIXED = 9,
	COM_TRANSCEIVER_SUB_STATE2_ETH_1000BASE_TX_FIXED = 10,
	COM_TRANSCEIVER_SUB_STATE2_ETH_AUTO_NEGOTIATION = 11
} COM_Transceiver_Sub_State_2;

/// \brief Represents a version number.
typedef struct COM_Version
{
    u08 Major;      ///< Major version number
    u08 Minor;      ///< Minor version number
    u08 Patch;      ///< Patch number (normally '0')
    u08 Build;      ///< Build number (normally '0')
} COM_Version;

/// \brief Represents a version number.
typedef struct COM_ExtendedVersion
{
	u16 Major;      ///< Major version number
	u16 Minor;      ///< Minor version number
	u16 Patch;      ///< Patch number (normally '0')
	u16 Build;      ///< Build number (normally '0')
} COM_ExtendedVersion;

/// \brief Represents a MAC address.
typedef struct COM_MacAddress
{
    u08 MAC0;           ///< Lowest byte of the Mac address of the hardware
    u08 MAC1;           ///< 2nd byte of the Mac address of the hardware
    u08 MAC2;           ///< 3rd byte of the Mac address of the hardware
    u08 MAC3;           ///< 4th byte of the Mac address of the hardware
    u08 MAC4;           ///< 5th byte of the Mac address of the hardware
    u08 MAC5;           ///< Highest byte of the Mac address of the hardware
} COM_MacAddress;

/// \brief Represents the License information including the encoded SerialNumber. This structure is used only by non public functions.
/// \remark deprecated -> serial is wrong. It must be 64 bit
typedef struct COM_Features
{
    u32 Feature0;           ///< Feature string 0
    u32 Feature1;           ///< Feature string 1
    u32 Feature2;           ///< Feature string 2
    u32 Feature3;           ///< Feature string 3
    u32 Feature4;           ///< Feature string 4
    u32 Feature5;           ///< Feature string 5
    u32 Serial;             ///< Serial number of the hardware
} COM_Features;

/// \brief Represents the License information. This structure is used only by non public functions.
typedef struct COM_License
{
    u64 LIC0;               ///< LIC string 0
    u64 LIC1;               ///< LIC string 1
    u64 LIC2;               ///< LIC string 2
    u64 LIC3;               ///< LIC string 3
} COM_License;


/// \brief Possible channel types for communication controllers
typedef enum COM_DEVICETYPEtag
{
	COM_DEVICETYPE_Unknown = 0,            ///< The device type is unknown
    COM_DEVICETYPE_FlexRay	,              ///< The device type is a FlexRay controller
    COM_DEVICETYPE_CAN,                    ///< The device type is a CAN controller
    COM_DEVICETYPE_CAN_FD,                 ///< The device type is a CAN-FD controller
	COM_DEVICETYPE_ETH,                    ///< The device type is a Ethernet controller
    COM_DEVICETYPE_CAN_TS,                 ///< The device type is the CAN time-stamping unit
	COM_DEVICETYPE_FLEXRAY_TS,             ///< The device type is the FlexRay time-stamping unit
	COM_DEVICETYPE_HS_BRIDGE,              ///< The device type is the internal HS-bridge
	COM_DEVICETYPE_HS_BRIDGE_CONTROL,      ///< The device type is the internal HS-bridge controller
	COM_DEVICETYPE_AES_CMAC_ENCRYPTION,    ///< The device type is the internal AES CMAC encryption unit
	COM_DEVICETYPE_LIN,                    ///< The device type is a LIN controller
	COM_DEVICETYPE_SENT,                   ///< The device type is a SENT controller
}COM_DEVICETYPE;


/// \brief Represents the Serial Number of the hardware.
typedef struct COM_SerialNumber
{
    u32 SerialNumberLow;                ///< Low DWord of the serial number of the hardware.
    u32 SerialNumberHigh;               ///< High DWord of the serial number of the hardware.
}COM_SerialNumber;

/// \brief Structure of a common status message.
typedef struct COM_Status
{
    COM_APP_STATE Application;          ///< State of the application.
    u08 NumberOfBusStates;              ///< Number of the channels of the device
    COM_BUS_STATE Bus[255];             ///< States of the channels.

}COM_Status;


/// \brief Structure of a FlexRay message.
typedef struct COM_FlexRayMessage
{
    u16 ID;                 ///< The frame id defines the slot in which the frame was transmitted. (FlexRay Protocol Specification: 'vRF!Header!FrameID').
    u08 PayloadLength;      ///< Defines the number of 16-bit words contain in pData (FlexRay Protocol Specification: 'vRF!Header!Length').
    u08 CycleCount;         ///< The cycle in which the frame was received. (FlexRay Protocol Specification: 'vRF!Header!CycleCount')
    u16 Status;             ///< Status of the received frame (i.e. Null-Frame, Valid-Frame, Syntax-Error,…). MFR4310 Notation.
    u16 Data[127];          ///< The pointer to the payload data. The payload is given in 16-bit words. (FlexRay Protocol Specification: 'vRF!Payload').
}COM_FlexRayMessage;

/// \brief Structure of a CAN message.
typedef struct COM_CanMessage
{
    u32 ID;                 ///< The CAN message identifier which was received or transmitted. If a standard header is used, the upper unused bits must be set to '0'.
    u08 ExtendedId;         ///< If this flag is 1 the CAN message is an extended frame. If set to 0 it is a standard frame.
    u08 DLC;                ///< Indicates the data length (in bytes).
    u08 ErrorFrame;         ///< Indicates that the message was not received correctly
    u08 Data[8];            ///< The received or transmitted data. All of the 8 data bytes can be read. The corresponding parameter DLC indicates the length of the valid values.
}COM_CanMessage;

/// \brief Structure of a streaming message.
typedef struct COM_StreamPacket
{
    u64 TimeStamp;              ///< 64-bit Timestamp of the message.
    COM_BUSTYPE BusType;        ///< Type of the bus on which the message was sent or received.
    u08 ChannelId;              ///< ID of the channel of the bus on which the message was sent or received.
    COM_Direction Direction;    ///< Specifies the direction of the message.

    /// \brief The content depends on used channel
    union
    {
        COM_CanMessage CAN;             ///< For CAN.
        COM_FlexRayMessage FlexRay;     ///< For FlexRay.
    };
} COM_StreamPacket;

/// \brief Structure of a RBS specific status message.
typedef struct COM_RBS_Statustag
{
    COM_APP_STATE State;            ///< State of the application.
    u08 NumberOfChannels;           ///< Number of used channels in the application.

    /// \brief Channel information.
    struct
    {
        u08 ChannelId;                          ///< Id of the channel of a certain bus type.
        COM_BUSTYPE ChannelType;                ///< The type of the bus of this channel.
        COM_Bool DeadLineViolationOverflow;     ///< Indicates that an overflow of the deadline violation counter appeared.
        u16 DeadlineViolations;                 ///< Number of deadline violations.
        u16 SkippedFrames;                      ///< Number of skipped frames.
    } Channels[255];                            ///< The channels object

}COM_RBS_Status;

/// \brief Structure of the GetHwConfig message.
typedef struct COM_HwConfigtag
{
    u32 SerialNumberLow;        ///< Low DWord of the 64-bit serial number of the hardware.
    u32 SerialNumberHigh;       ///< High DWord of the 64-bit serial number of the hardware.
    COM_Version Version;        ///< Version of the hardware.
    COM_FPGATYPE FPGA[16];      ///< Type of the FPGA installed.
    COM_BUSTYPE TINY[32];       ///< Type of the installed FlexTiny modules.
    COM_HW_TYPE Hw_Type;        ///< Type of the Hardware.
    u08 BE;                     ///< Big Endian. When set, the hardware uses big endian notation. It has no effect on the interface!!!
}COM_HwConfig;

/// \brief Structure of the TimeStamp
typedef struct COM_TimeStamptag
{
    u32 DateTimeLow;        ///< Low DWord of the DateTime.
    u32 DateTimeHigh;       ///< High DWord of the DateTime.
}COM_TimeStamp;

/// \brief Structure of the VersionString
typedef struct COM_VersionStringtag
{
    char UserString[16];    ///< User defined string.
}COM_VersionString;

/// \brief Structure of the GetLicenseConfig message.
typedef struct COM_LicenseConfigtag
{
    u08 FlexRay;        ///< License for FlexRay (number of interfaces)
    u08 CAN;            ///< License for CAN (number of interfaces)
    u08 OS;             ///< License for Operating System
    u08 LOG;            ///< License for Logging function
    u08 RBS;            ///< License for Remaining Bus Simulation
    u08 GW;             ///< License for Gateway function
    u08 ANA;            ///< License for Analyzing function
    u08 CTRL;           ///< License for FlexConfig Control
    u08 FLT;            ///< License for FlexConfig flat license handling
    u08 FWD;            ///< License for Firmware driver
    u08 WD;             ///< License for FlexCard Windows driver
    u08 XD;             ///< License for FlexCard Xenomai driver
    u08 LD;             ///< License for FlexCard Linux driver
	u08 MCPU;			///< License for Multiple CPU
	u08 XCP;			///< License for XCP
	u08 ETHI;           ///< License for the Ethernet interface
	u08 CFDI;           ///< License for the CAN FD interface
	u08 FRI;            ///< License for the FlexRay interface
	u08 FCSTD;		///< License for the FL3X Config Standard
	u08 FCEXT;			///< License for the FL3X Config Extended
	u16 FCSTDDATE;	///< Date for the FL3X Config Standard license
	u16 FCEXTDATE;		///< Date for the FL3X Config Extended license
	u08 Reserved[10];	///< Reserved for future extension
}COM_LicenseConfig;

/// \brief Structure of the GetSwConfig message.
typedef struct COM_SwConfigtag
{
    u08 OS;         ///< The downloaded software is a operating system
    u08 RBS;        ///< The downloaded software is a remaining bus simulation
    u08 GW;         ///< The downloaded software is a gateway
    u08 LOG;        ///< The downloaded software is a logging software
    u08 ANA;        ///< The downloaded software is a analyzing software
    u08 TST;        ///< The downloaded software is a test software
    u08 STR;        ///< The downloaded software is a streaming software
    u32 SWID_LOW;   ///< Software ID (low DWord)
    u32 SWID_HIGH;  ///< Software ID (high DWord)
	u08 Reserved[12];	///< Reserved for future extension
}COM_SwConfig;

/// \brief Structure of the GetFPGAConfig message
typedef struct COM_FPGAConfigtag
{
    u08 FPGA_Counter;   ///<The number of FPGA objects included in the Structure
    struct
    {
        COM_FPGATYPE FPGAType; ///<The current FPGA image type
        COM_Version Version; ///<The current FPGA image version
        COM_FPGATYPE FPGAType_Needed; ///<The needed FPGA image type
        COM_Version Version_Needed; ///<The needed FPGA image version
    }FPGA_Info[255];    ///<FPGA Info object    
}COM_FPGAConfig;

/// \brief Structure of the COM_FPGAImageConfig message
typedef struct COM_FPGAImageConfigtag
{
    u08 Image_Count;   ///<The number of FPGA Images
	u08 Empty1;		   ///<Empty byte	
    struct
    {
        COM_FPGAImageCategory FPGAImageCategory;	 ///<The current FPGA image category
        u08 ImagePage;								 ///<The current FPGA image position
        u08 IsActive;								 ///<Identify, whether the FPGA image is active.  Allowed values: 
												     ///<    0 = not active
													 ///<    1 = active    
		u08 FPGA_ID;								 ///<The null based index of the FPGA which uses this image.
        COM_FPGATYPE FPGA_Type;						 ///<The FPGA type
		COM_Version  FPGA_Version;		     ///<The FPGA version

    }FPGA_Images[255];								 ///<FPGA images object    
}COM_FPGAImageConfig;

/// \brief Structure of the NicConfig message<br>
/// \brief The IP Address is defined in network byte order MSB->LSB => 192.168.1.15<br>
/// \brief IP0 => 15<br>
/// \brief IP1 => 1<br>
/// \brief IP2 => 168<br>
/// \brief IP3 => 192
typedef struct COM_NicConfigtag
{
    u08 IP0;            ///< Byte 0 of the IP address of the hardware (192.168.1.[15])
    u08 IP1;            ///< Byte 1 of the IP address of the hardware (192.168.[1].15)
    u08 IP2;            ///< Byte 2 of the IP address of the hardware (192.[168].1.15)
    u08 IP3;            ///< Byte 3 of the IP address of the hardware ([192].168.1.15)
    u08 Subnet0;        ///< Byte 0 of the Subnet Mask of the hardware (255.255.255.[0])
    u08 Subnet1;        ///< Byte 1 of the Subnet Mask of the hardware (255.255.[255].0)
    u08 Subnet2;        ///< Byte 2 of the Subnet Mask of the hardware (255.[255].255.0)
    u08 Subnet3;        ///< Byte 3 of the Subnet Mask of the hardware ([255].255.255.0)
    u08 GW0;            ///< Byte 0 of the standard gateway IP address of the hardware (192.168.1.[1])
    u08 GW1;            ///< Byte 1 of the standard gateway IP address of the hardware (192.168.[1].1)
    u08 GW2;            ///< Byte 2 of the standard gateway IP address of the hardware (192.[168].1.1)
    u08 GW3;            ///< Byte 3 of the standard gateway IP address of the hardware ([192].168.1.1)
}COM_NicConfig;

/// \brief Structure of the SetRbsManipulation message
typedef struct COM_RbsManipulationtag
{
    u08 TriggerType_1;                  ///< Trigger 1: Identify whether the TriggerValue is an address or a value (0: trigger not active; 1: trigger at value; 2: trigger at address; 3: trigger at value cyclic; 4: trigger at address cyclic)
    u08 TriggerMode_1;                  ///< Trigger 1: Identify the trigger mode (1: '=='; 2: '!='; 3: '>'; 4: '<'; 5: '<='; 6: '>='; 7: 'edge')
    u32 TriggerSource_1;                ///< Trigger 1: The trigger source is the signal which value is used to trigger
    u32 TriggerValue_1;                 ///< Trigger 1: The trigger value to compare with the trigger source value
    u32 TriggerHysterese_1;             ///< Trigger 1: Trigger hysteresis identify the hysteresis at trigger mode "edge"

    u08 TriggerType_2;                  ///< Trigger 1: Identify whether the TriggerValue is an address or a value (0: trigger not active; 1: trigger at value; 2: trigger at address; 3: trigger at value cyclic; 4: trigger at address cyclic)
    u08 TriggerMode_2;                  ///< Trigger 2: Identify the trigger mode (1: '=='; 2: '!='; 3: '>'; 4: '<'; 5: '<='; 6: '>='; 7: 'edge')
    u32 TriggerSource_2;                ///< Trigger 2: The trigger source is the signal which value is used to trigger
    u32 TriggerValue_2;                 ///< Trigger 2: The trigger value to compare with the trigger source value
    u32 TriggerHysterese_2;             ///< Trigger 2: Trigger hysteresis identify the hysteresis at trigger mode "edge"

    u08 TriggerType_3;                  ///< Trigger 1: Identify whether the TriggerValue is an address or a value (0: trigger not active; 1: trigger at value; 2: trigger at address; 3: trigger at value cyclic; 4: trigger at address cyclic)
    u08 TriggerMode_3;                  ///< Trigger 3: Identify the trigger mode (1: '=='; 2: '!='; 3: '>'; 4: '<'; 5: '<='; 6: '>='; 7: 'edge')
    u32 TriggerSource_3;                ///< Trigger 3: The trigger source is the signal which value is used to trigger
    u32 TriggerValue_3;                 ///< Trigger 3: The trigger value to compare with the trigger source value
    u32 TriggerHysterese_3;             ///< Trigger 3: Trigger hysteresis identify the hysteresis at trigger mode "edge"

    u08 TriggerType_4;                  ///< Trigger 1: Identify whether the TriggerValue is an address or a value (0: trigger not active; 1: trigger at value; 2: trigger at address; 3: trigger at value cyclic; 4: trigger at address cyclic)
    u08 TriggerMode_4;                  ///< Trigger 4: Identify the trigger mode (1: '=='; 2: '!='; 3: '>'; 4: '<'; 5: '<='; 6: '>='; 7: 'edge')
    u32 TriggerSource_4;                ///< Trigger 4: The trigger source is the signal which value is used to trigger
    u32 TriggerValue_4;                 ///< Trigger 4: The trigger value to compare with the trigger source value
    u32 TriggerHysterese_4;             ///< Trigger 4: Trigger hysteresis identify the hysteresis at trigger mode "edge"

    u16 DelayValue;                     ///< Delay to start the manipulation
    u08 DelayType;                      ///< The delay value type (0: events since sequence start; 1: cycles since sequence start; 2: ms since sequence start; 3: events since last manipulation; 4: cycles since last manipulation; 5: ms since last manipulation)

    u08 BusId;                          ///< The BusId of the bus for which the manipulation should be performed (Not_Specified: 0; FR1A: 1; FR1B: 2; FR2A: 3; FR2B: 4; ...16; CAN1 = 30; ...44; ETH1: 60; ...62; LIN1: 70; ...73; RS232_1: 80; ...83; MOST1: 90; ...93; SPI1: 100; SPI2: 101; USB1: 110; ...114;)

    u08 SequenceNumber;                 ///< Identify the position of this manipulation in a sequence. For trigger manipulations the sequence number is '0'
    u08 ManipulationType;               ///< Identify the manipulation type (1: loss; 2: offset; 3: value; 4: factor; 5: drift - from n to m in p steps ; 6: ramp - from n to m in p steps ; 7: disable manipulation; 8: freeze; 9: ramp with hold final value - from n to m in p steps; 10: drift with hold final value - from n to m in p steps; 11: factor linear; 12: offset negative)
    u16 ManipulationDuration;           ///< Identify the duration of a manipulation (0 means infinite duration)
    u08 ManipulationDurationType;       ///< Identify the unit of the duration (0: duration is given in events; 1: duration is given in cycles; 1: duration is given in ms)
    u08 ManipulationMode;               ///< Identify the manipulation target type (1: frame; 2: PDU; 3: signal group; 4: signal; 5: ECU)
    u32 ManipulationTarget;             ///< Identify the address or identifier of the element to manipulate
    u16 ManipulationTargetValue;        ///< Sets a parameter for the manipulated target (e.g. ecu index number )
    u32 ManipulationValue1;             ///< The value one of the manipulation (n)
    u32 ManipulationValue2;             ///< The value two of the manipulation (m)
    u32 ManipulationValue3;              ///< The value three of the manipulation (p)

    u32 MinValue;                       ///< The lowest possible raw value of the manipulation
    u32 MaxValue;                       ///< The highest possible raw value of the manipulation
    u08 MinMaxMode;                     ///< Identify if the fields MinValue and MaxValue are used
    u08 BaseDataType;                   ///< The base data type of the value to manipulate (0: not defined; 1: UINT8; 2: INT8; 3: UINT16; 4: INT16; 5: UINT32; 6: INT32; 7: UINT64; 8: INT64; 9: FLOAT32; 10: FLOAT64; 11: ASCIISTRING; 12: UNICODE2STRING; 13: BYTEFIELD; 14: BITFIELD; 15: OTHER)

}COM_RbsManipulation;

/// \brief Structure of the WakeupSleepConfig message
typedef struct COM_WakeupSleepConfigtag
{
    u08 InfoCount;              ///< The number of WUP_Sleep_Info elements used.
    u08 Empty;                  ///< Currently not used 
    struct                      /// \brief Structure of the wakeup/sleep info structure
    {
        u08 ChannelID;          ///< The channel Id
        u08 Sleep;              ///< The sleep mode
        u08 Wakeup;             ///< The wakeup mode
		u08 SlotID;						 ///< The SlotID is used for FlexSystem-M
    } WUP_Sleep_Info[255];      ///< The wakeup/sleep info structure
} COM_WakeupSleepConfig;

/// \brief Structure of the TerminationConfig message
typedef struct COM_TerminationConfigtag
{
    u08 InfoCount;              ///< The number of Termination info elements used.
    u08 Empty;                  ///< Currently not used
    struct                      /// \brief Structure of the Termination info element
    {
        u08 ChannelID;          ///< The termination channel Id
        u08 Termination;        ///< The termination. Possible values:
                                ///< Disabled = 0
                                ///< Enabled = 1
                                ///< NotSupported = 2
                                ///< Failed = 3
    } Term_Info[255];           ///< The termination infos
} COM_TerminationConfig;

/// \brief Structure of the SwSleepConfig message
typedef struct COM_SwSleepConfigtag
{
    u08 SwSleep_Info;   ///< The state of the SoftwareSleep mode. 0 = disabled, 1 = enabled, 2 = not supported
    u08 Empty;          ///< Currently not used
} COM_SwSleepConfig;

enum {
    DOWNLOAD_ERROR_MSG_MAX = 1024, ///< The maximum length of a download error message.
    MAX_NUMBER_OF_ONLINE_DEVICES = 1024, ///< The maximum number of online devices which coud be returned.
};

/******************************************************************************
* ANALYZER SPECIFIC DEFINES
******************************************************************************/

/// \brief Possible baud rates per second
typedef enum COM_CANBAUDRATEtag
{
    COM_CANBAUDRATE_10K = 10000,    ///< Baudrate 10kBit/s
    COM_CANBAUDRATE_20K = 20000,    ///< Baudrate 20kBit/s
    COM_CANBAUDRATE_33K = 33000,    ///< Baudrate 33kBit/s
    COM_CANBAUDRATE_50K = 50000,    ///< Baudrate 50kBit/s
    COM_CANBAUDRATE_62K = 62000,    ///< Baudrate 62kBit/s
    COM_CANBAUDRATE_83K = 83000,    ///< Baudrate 83kBit/s
    COM_CANBAUDRATE_100K = 100000,  ///< Baudrate 100kBit/s
    COM_CANBAUDRATE_125K = 125000,  ///< Baudrate 125kBit/s
    COM_CANBAUDRATE_250K = 250000,  ///< Baudrate 250kBit/s
    COM_CANBAUDRATE_500K = 500000,  ///< Baudrate 500kBit/s
    COM_CANBAUDRATE_666K = 666000,  ///< Baudrate 666kBit/s
    COM_CANBAUDRATE_800K = 800000,  ///< Baudrate 800kBit/s
    COM_CANBAUDRATE_1000K = 1000000 ///< Baudrate 1000kBit/s
} COM_CANBAUDRATE;

/// \brief Possible CHI opcodes
typedef enum COM_CHIOPCODEtag
{
    COM_CHIOPCODE_NONE = 0,                 ///< None. Hint: Currently not used in PC-HW-Interface.
    COM_CHIOPCODE_SET_CONFIGMODE,           ///< Set configuration mode.
    COM_CHIOPCODE_CONFIG_COMPLETE,          ///< Configuration complete.
    COM_CHIOPCODE_CONFIG_COMPLETE_ASYNC,    ///< Configuration complete async.
    COM_CHIOPCODE_CHECK_CTRL_TYPE,          ///< Check controller type.
    COM_CHIOPCODE_WRITE32,                  ///< Set register.
    COM_CHIOPCODE_WAIT_TILL_CLEARED         ///< Wait till instruction.
} COM_CHIOPCODE;

enum {
    MAX_NUMBER_OF_CHI_DIRECTIVES_PER_PACKET = 102,			///< The maximum number of CHI directives per packet allowed.
    MAX_NUMBER_OF_SCHEDULE_TABLE_ENTRIES_PER_PACKET = 178, ///< The maximum number of LIN schedule table entries per packet allowed.
    MAX_NUMBER_OF_VLANS = 100,							  ///< The maximum number of VLANS
};

/// \brief Possible timestamp types
typedef enum COM_TIMESTAMP_TYPEtag
{
    COM_TIMESTAMP_TYPE_ERROR = 0,   ///< Failure
    COM_TIMESTAMP_TYPE_UNKNOWN,     ///< Unknown timestamp type
    COM_TIMESTAMP_TYPE_SOFTWARE,    ///< Software timestamp type
    COM_TIMESTAMP_TYPE_HARDWARE     ///< Hardware timestamp type
} COM_TIMESTAMP_TYPE;

/// \brief Possible timestamp types
typedef enum COM_PERSISTENCE_COMMANDtag
{
	COM_PERSISTENCE_CMD_UNKNOWN_COMMAND = 0,	///< Unknown Command, should not be used
	COM_PERSISTENCE_CMD_SAVE,					///< Save Analyzer Config persistent on Device
	COM_PERSISTENCE_CMD_SAVE_START,				///< Save Analyzer Config and start on start of Device
	COM_PERSISTENCE_CMD_DELETE					///< Delete saved Analyzer Config
} COM_PERSISTENCE_COMMAND;

/// \brief Structure of the bus specific FlexRay channel configuration
typedef struct COM_ConfigureChannelFlexRaytag
{
    u08 Count;  ///< The number of CHI directives. A maximum of 102 CHI directives could be transmitted at once. 
                ///< U can use the consecutive flag if u want to transmit more than 102 directives using another packet.
    u08 CF;     ///< The consecutive flag. Allowed values:
                ///<    0 = CHI configuration transmission complete
                ///<    1 = Another CHI configuration transmission follows
	u08 CS;     ///< The cold start flag. Allowed values:
				///< Is only valid if CF is set as 0.
				///< If CS is set as 1, Coldstart is enabled after a corresponding key slot configuration with CHI directives.

    

    struct      /// \brief Structure of a CHI directive
    {
        u08 Opcode;                                                 ///< The CHI opcode.
        u08 Empty;                                                  ///< Reserved
        u32 Address;                                                ///< The CHI address.
        u32 Value;                                                  ///< The CHI value.
    } CHIDirective[MAX_NUMBER_OF_CHI_DIRECTIVES_PER_PACKET];        ///< The CHI directives.
} COM_ConfigureChannelFlexRay;

/// \brief Structure of the bus specific CAN channel configuration
typedef struct COM_ConfigureChannelCANtag
{
    u32 Baudrate;   ///< The baudrate configuration. 
    u08 LO;                     ///< The List-Only-Modus configuration. Allowed values: 
                                ///<    0 = deactivate
                                ///<    1 = activate
} COM_ConfigureChannelCAN;

/// \brief Structure of the bus specific CAN FD channel configuration
typedef struct COM_ConfigureChannelCANFDtag
{
    u32 ArbitrationBaudrate;	///< The arbitration baudrate configuration. 
    u32 DataBaudrate;			///< The data baudrate configuration. 
	u08 LO;                     ///< The List-Only-Modus configuration. Allowed values: 
                                ///<    0 = deactivate
                                ///<    1 = activate
	u08 FD;						///< The CAN FD operation mode configuration. Allowed values: 
                                ///<    0 = deactivate
                                ///<    1 = activate

	u08 BRS;				    ///< Bitrate-Switching configuration. Allowed values:	
                                ///<    0 = deactivate
                                ///<    1 = activate
    u08 Protocol;	            ///< The CAN FD protocol specification. Allowed values: 
                                ///<    0 = CAN-FD ISO 11898-1
                                ///<    1 = Bosch CAN-FD Version 1.0   
} COM_ConfigureChannelCAN_FD;	

/// \brief Structure of the bus specific LIN channel configuration
typedef struct COM_ConfigureChannelLINtag
{
	u32 Baudrate;			///< The baudrate configuration in Bit/s e.g 19.2 kBit/s would be 19200. 
	union
	{
		u08 Flags;
		struct
		{
			u08 Master : 1;	///< The master mode flag. Allowed values:
							///<    0 = Node is a LIN slave
							///<    1 = Node is a LIN master
			u08 RX : 1;	///< Visualize transmitted frames
									///<    0 = Node doesn't receive own TX frames
									///<    1 = Node receives own TX frames
			u08 TimingTable : 1;	///< The configuration comman contain a timing table.
									///<    0 = no
									///<    1 = yes
			u08 CF : 1;	///< The consecutive flag. Allowed values:
									///<    0 = Timing table transmission complete
									///<    1 = Farther Timing Table configuration transmission follows
									///< You can use the consecutive flag if you want to transmit more than 178 directives using another packet.
			u08 Empty : 4;	///< Reserved
		}Flag;
	};
	u32 TimingBase;			///< Timing base of the schedule table in milliseconds. 
	u16 Count;				///< The number of Timing Table entries. A maximum of 178 Timing Table entries could be transmitted at once. 

	/// \brief Structure of a LIN schedule table entry
	struct				
	{
		u08 FrameID;														///< ID of thr frame header.
		u08 Empty;															///< Reserved
		u16 TimingOffset;													///< Timing offset of the entry in "TimingBase" periods.
		u16 TimingPeriod;													///< Timing period of the entry in "TimingBase" periods.
		u16 Empty_1;														///< Reserved
	} ScheduleTableEntry[MAX_NUMBER_OF_SCHEDULE_TABLE_ENTRIES_PER_PACKET];	///< The LIN schedule table entries.
} COM_ConfigureChannelLIN;

enum
{
    SENT_MIN_LENGTH_OF_TIME_TICKS_PER_NS = 3000,	///< The minimum length of SENT Time Ticks per Nano Seconds.
    SENT_MAX_LENGTH_OF_TIME_TICKS_PER_NS = 90000,  ///< The maximum length of SENT Time Ticks per Nano Seconds.
};

/// \brief Structure of the bus specific SENT channel configuration
typedef struct COM_ConfigureChannelSENTtag
{
	u08 Direction;			///< The SENT Channel Direction:
									///<    0 = Node is a SENT TX.
									///<    1 = Node is a SENT RX.
	u08	SlowMessage;		///< SENT Channel Slow Message Format Enable:
									///<    0 = Deactivated.
									///<	1 = Activated.
	u08 SlowMessageEnh;		///< SENT Channel Slow Message Enhanced Format Enable:
									///<	0 = Deactivated.
									///<	1 = Activated.
	u08 PausePulse;			///< SENT Pause Pulse between every TX/RX Frame Enable:
									///<	0 = Deactivated.
									///<	1 = Activated.
	u08 IdlePolHigh;		///< SENT Idle Polarity State:
									///<	0 = Polarity Low.
									///<	1 = Polarity High.
	u08 CRC;				///< SENT CRC Calculation[TX]/Validation[RX] depnding on Channel Direction Enable:
									///<	0 = Deactivated.
									///<	1 = Activated.
	u08 ContinuousMode;		///< SENT Asynchronous mode (Continuous mode) Enable:
									///<	0 = Deactivated.
									///<	1 = Activated.
	u08 SPCMode;	 		///< SENT Short PWM Code Protocol Enable
									///<	0 = Deactivated.
									///<	1 = Activated (Half Duplex Synchronous Communication).
	u08 DataNibbles;		///< SENT Number of expected data nibbles per frame.
	u16 TxID;				///< SENT Transmitter Identifier for the Module.
	u32 ClockTickLength;	///< SENT Clock Tick Length in [ns].
	u16 ClockTickCount;		///< SENT Clock Tick Count.
	u16 SPCPulseWidth;		///< SENT SPC Pulse Width.
} COM_ConfigureChannelSENT;

/// \brief Structure of the bus specific ETH channel configuration
typedef struct COM_ConfigureChannelETHtag
{
	/**
	 * ETH MODE (According to t_com_analyzer_eth_mode)
	 * 1 : 100BASE_T1_MASTER
	 * 2 : 100BASE_T1_SLAVE
	 * 3 : 1000BASE_T1_MASTER
	 * 4 : 1000BASE_T1_SLAVE
	 * 5 : AUTO
	 * 6 : 1000BASE_TX_FIXED
	 * 7 : 100BASE_TX_FIXED
	 * 8 : 10BASE_TX_FIXED
	 */
	u08 Mode;		
	u08 PM : 1;								///< Promiscous Mode: Allow Receiving Frames with MAC Address Check
	u08 MAC[6];								///< MAC Address
	u08 VLANCount;							///< Total Number of VLAN
	u16 VLAN[MAX_NUMBER_OF_VLANS];			///< VLAN Array
} COM_ConfigureChannelETH;

/// \brief Structure of the channel configuration
typedef struct COM_ConfigureChanneltag
{
    u08 ChannelId;              ///< ID of the channel of the bus on which the message was sent or received.
    COM_BUSTYPE BusType;        ///< Type of the bus on which the message was sent or received.
	COM_ANALYZER_TIMESTAMP_BASE TimestampBase;	///< Timestamp Based used for this channel.

    /// \brief The content depends on used channel
    union
    {
        COM_ConfigureChannelCAN CAN;                ///< For CAN.
		COM_ConfigureChannelCAN_FD CAN_FD;          ///< For CAN FD.
        COM_ConfigureChannelFlexRay FlexRay;        ///< For FlexRay.
		COM_ConfigureChannelLIN LIN;				///< For LIN.
		COM_ConfigureChannelETH ETH;				///< For ETH.
		COM_ConfigureChannelSENT SENT;				///< For SENT.
    };
} COM_ConfigureChannel;

/// \brief Structure of the ChannelConfig message
typedef struct COM_ChannelConfigtag
{
    u08 InfoCount;						 ///< The number of Channel info elements used.
    u08 Empty;							 ///< Currently not used
    struct								 /// \brief Structure of the Channel info element
    {
		u08 ChannelNr;					 ///< The channel number
        u08 ChannelID;					 ///< The channel Id
		COM_BUSTYPE BusType;			 ///< Type of the bus on the channel
		COM_TINYTYPE TinyType;			 ///< The tiny id (from the EEPROM of the tiny) for the channel
		COM_DEVICETYPE DeviceType;		 ///< Type of the communication controller
		u08 DeviceCount;				 ///< The count of the communication controller on the channel
		u08 DeviceChannel;				 ///< The communication channel of the communication controller
		u08 LinkedChannelNr;			 ///< The number of the next linked communication channel of the detected bus system
		u08 Sleep;						 ///< The sleep mode
        u08 Wakeup;						 ///< The wakeup mode
		u08 Termination;			     ///< The termination
		u08 TimeStampSource;			 ///< Type of the time source
		u08 AppType;					 ///< Type of the application, which is configured on the channel
		u08 AnalysingSupport;			 ///< Availableness of the analysing funtionality
		u08 SlotID;						 ///< The SlotID is used for FlexSystem-M
		u08 Empty;						 ///< Empty byte
    } Channel_Info[255];           ///< The channel infos
} COM_ChannelConfig;

/// \brief Change Application Type for Channels
typedef struct COM_ChannelAppTypestag
{
	u08 ChangeCount;				 ///< The number of Changes.
	u08 Empty;						 ///< Currently not used
	struct							 /// \brief Structure of the ChannelAppType element
	{
		u08 ChannelNr;					 ///< The channel number
		u08 AppType;					 ///< 0: App Read Request, !0: Change App Request
		u16 Empty;						 ///< Currently not used

	} ChannelAppType[255];           ///< The Channel App Type per channel
} COM_ChannelAppTypes;

enum
{
    MAX_NUMBER_OF_FILTERS_PER_PACKET = 32, ///< The maximum number of filters per packet allowed.
}; 

/// \brief Structure of the bus specific FlexRay filter configuration
typedef struct COM_ConfigureFilterFlexRaytag
{
    u16 FID;                ///< The frame id.
    u08 CycleOffset;        ///< The frame offset.
    u08 CycleRepetition;    ///< The frame repetition.
    u08 NF;                 ///< Transfer null frames flag. Allowed values: 
                            ///<    0 = don't transfer
                            ///<    1 = transfer
} COM_ConfigureFilterFlexRay;

/// \brief Structure of the bus specific CAN filter configuration
typedef struct COM_ConfigureFilterCANtag
{
    u32 ID;     ///< The message id. 
    u08 Ex;     ///< Indicates an extended id. Allowed values: 
                ///<    0 = not an extended id
                ///<    1 = an extended id
} COM_ConfigureFilterCAN;

/// \brief Structure of the bus specific CAN FD filter configuration
typedef struct COM_ConfigureFilterCANFDtag
{
    u32 ID;     ///< The message id. 
    u08 Ex;     ///< Indicates an extended id. Allowed values: 
                ///<    0 = not an extended id
                ///<    1 = an extended id
	u08 FD;     ///< Indicates an FD frame format. Allowed values: 
                ///<    0 = not a CAN FD frame
                ///<    1 = a CAN FD frame
} COM_ConfigureFilterCAN_FD;

/// \brief Structure of the bus specific LIN filter configuration
typedef struct COM_ConfigureFilterLINtag
{
	u08 ID;				///< The message id. 
	
	union
	{
		u08 Flags;
		struct
		{
			u08 Ex : 1;	///< Indicates an extended filter format. Allowed values: 
								///<    0 = classic filter format
								///<    1 = extended filter format
			u08 CHK : 1;	///< Indicates a checksum format. Allowed values: 
								///<    0 = classic checksum
								///<    1 = enhanced checksum
			u08 RX : 1;	///< Indicates a frame direction. Allowed values: 
								///<    0 = transmit frame
								///<    1 = receive frame
			u08 Empty : 1;	///< Reserved
			u08 Length : 4;	///< Payload length in bytes. Allowed values: 0 ... 8 bytes
		}Flag;
	};
} COM_ConfigureFilterLIN;

/// \brief Structure of the bus specific SENT filter configuration
typedef struct COM_ConfigureFilterSENTtag
{
	u08 MessageID;		///< SENT Slow Format messages ID.

	union
	{
		u08 Flags;
		struct
		{
			u08 Format : 1;				///< SENT Message Format:
											///< 0 = Fast Message Format.
											///< 1 = Slow Message Format.
			u08 IgnoreMessageID : 1;	///< Ignore SENT Slow Format Message ID:
											///< 0 = Message ID not Ignored .
											///< 1 = All Message IDs are ignored (if format is slow, then accept all messages).
			u08 Empty : 6;				///< Reserved.
		}Flag;
	};
}COM_ConfigureFilterSENT;

/// \brief Structure of the bus specific ETH filter configuration
typedef struct COM_ConfigureFilterETHtag
{
	union
	{
		u08 Flags; ///< Combined flags
		struct
		{
			u08 FlagDstMac : 1; ///< Flag if destination MAC filter should be set
			u08 FlagSrcMac : 1; ///< Flag if source MAC filter should be set
			u08 FlagVlanId : 1; ///< Flag if VLAN filter should be set
			u08 FlagEtherType : 1; ///< Flag if EtherType filter should be set
			u08 FlagDstIpv4 : 1; ///< Flag if destination IP filter should be set
			u08 FlagSrcIpv4 : 1; ///< Flag if source IP filter should be set
			u08 FlagDstPort : 1; ///< Flag if desination port filter should be set
			u08 FlagSrcPort : 1; ///< Flag if source IP filter should be set
		} Flag;
	};

	u08 Reserved;		///< Reserved must be set to 0
	u08 DstMac[6];		///< Detination MAC filter entry
	u08 SrcMac[6];		///< Source MAC filter entry
	u16 VlanId;			///< VLAN filter entry
	u16 EtherType;		///< EtherType filter entry
	u08 DstIpv4[4];		///< Destination IP filter entry
	u08 SrcIpv4[4];		///< Source IP filter entry
	u16 DstPort;		///< Destination port filter entry
	u16 SrcPort;		///< Source port filter entry
} COM_ConfigureFilterETH;

/// \brief Structure of the filter configuration
typedef struct COM_ConfigureFiltertag
{
    u08 ChannelId;              ///< ID of the channel of the bus on which the message was sent or received.
    COM_BUSTYPE BusType;        ///< Type of the bus on which the message was sent or received.
    u08 SF;                     ///< The set filter flag. Allowed values: 
                                ///<    0 = remove
                                ///<    1 = add
	u08 AA;                     ///< Accept All flag. Allowed values: 
								///<    0 = set individual filters
								///<    1 = Accept all
    u08 Count;                  ///< The number of filters defined. A maximum of MAX_NUMBER_OF_FILTERS_PER_PACKET is allowed per packet.

    /// \brief The content depends on used channel
    union
    {
        COM_ConfigureFilterCAN CAN[MAX_NUMBER_OF_FILTERS_PER_PACKET];           ///< For CAN.
		COM_ConfigureFilterCAN_FD CANFD[MAX_NUMBER_OF_FILTERS_PER_PACKET];      ///< For CAN FD.
        COM_ConfigureFilterFlexRay FlexRay[MAX_NUMBER_OF_FILTERS_PER_PACKET];   ///< For FlexRay.
        COM_ConfigureFilterLIN LIN[MAX_NUMBER_OF_FILTERS_PER_PACKET];   		///< For LIN.
		COM_ConfigureFilterETH ETH[MAX_NUMBER_OF_FILTERS_PER_PACKET];			///< For ETH.
		COM_ConfigureFilterSENT SENT[MAX_NUMBER_OF_FILTERS_PER_PACKET];			///< For SENT.
    };
} COM_ConfigureFilter;


/// \brief Structure of the bus specific CAN message configuration
typedef struct COM_SendMessageCANtag
{
    u32 CanID;                      ///< The message id (CAN).    
	u08 CanDLC;                     ///< The data length code (CAN).
	u08 CanEx;                      ///< Indicates an extended id (CAN). Allowed values: 
                                    ///<    0 = not an extended id
                                    ///<    1 = an extended id
    
    u08 CanData[8];                 ///< The payload (CAN).

} COM_SendMessageCAN;

/// \brief Structure of the bus specific CAN FD message configuration
typedef struct COM_SendMessageCANFDtag
{
    u32 CanFdID;                      ///< The message id (CAN FD).
	u08 CanFdDLC;                     ///< The data length code (CAN FD).
    u08 CanFdEx;                      ///< Indicates an extended id (CAN FD). Allowed values: 
								      ///<    0 = not an extended id
									  ///<    1 = an extended id    
	u08 CanFdFD;                      ///< Indicates a frame CAN FD Frame format. Allowed values: 
								      ///<    0 = not a CAN FD frame
									  ///<    1 = a CAN FD Frame    
	u08 CanFdBrs;                      ///< Indicates Baudrate switching. Allowed values: 
								      ///<    0 = disable baudrate switching
									  ///<    1 = enable  baudrate switching
    u08 CanFdData[64];                ///< The payload (CAN FD).

} COM_SendMessageCAN_FD;

/// \brief Structure of the bus specific CAN FD message configuration
typedef struct COM_SendMessageLINtag
{
	u08 ID;				///< The message id. 

	union
	{
		u08 Flags;
		struct
		{
			u08 CHK		: 1;	///< Indicates a checksum format. Allowed values: 
								///<    0 = classic checksum
								///<    1 = enhanced checksum
			u08 Sync	: 1;	///< Indicates whether a frame is sent in sync with the Timing Table. Allowed values: 
								///<    0 = transmit frame sporadic
								///<    1 = transmit frame synchronously
			u08 Empty	: 2;	///< Reserved
			u08 Length	: 4;	///< Payload length in bytes. Allowed values: 0 ... 8 bytes
		}Flag;
	};
	u08 LINData[8];             ///< The payload (LIN).

} COM_SendMessageLIN;


/// \brief Structure of a sporadic send message
typedef struct COM_SendMessageSporadictag
{
    u08 ChannelId;                  ///< ID of the channel of the bus on which the message was sent or received.
    COM_BUSTYPE BusType;            ///< Type of the bus on which the message was sent or received.
    
	/// \brief The content depends on used channel
        union
        {
            COM_SendMessageCAN CAN;               ///< For CAN.
            COM_SendMessageCAN_FD CANFD;          ///< For CAN FD.
			COM_SendMessageLIN LIN;				  ///< For LIN.
        };
		    
} COM_SendMessageSporadic;

enum {
    MAX_NUMBER_OF_TRACE_MESSAGES = 4096,			///< The maximum number of trace messages allowed.
    MAX_NUMBER_OF_CONTAINED_MESSAGES = 1490,		///< The maximum number of contained messages allowed (Ethernet MTU,
    /// should also be ok for Jumbo Frames).

    FLEXMEASURE_MAX_CONTAINER_LENGTH = 1490,		///< 1500 - HEADER
    MAX_RECEIVE_MESSAGE_BYTE_LENGTH = 254,			///< The maximum possible number of bytes allowed.
};

/// \brief Structure of the bus specific CAN filter configuration
typedef struct COM_ReceiveMessageCANtag
{
    u32 ID;     ///< The message id. 
    u08 Ex;     ///< Indicates an extended id. Allowed values: 
                ///<    0 = not an extended id
                ///<    1 = an extended id
    u08 Err;    ///< The error frame indicator.
    u08 DLC;    ///< The data length code.
} COM_ReceiveMessageCAN;

/// \brief Structure of the bus specific CAN filter configuration
typedef struct COM_ReceiveMessageFlexRaytag
{
    u16 FID;                ///< The frame id. 
    u08 NF;                 ///< The NULL frame indicator. Allowed values: 
                            ///<    0 = Frame is NULL frame
                            ///<    1 = Frame is not a NULL frame
    u08 PayloadLength;      ///< The payload length (max. 127).
    u08 CycleCount;         ///< The cycle count
} COM_ReceiveMessageFlexRay;

/// \brief Structure of received messages
typedef struct COM_ReceiveMessagesLegacytag
{
    u16 Count;      ///< The number of received messages.
    u08 OC;         ///< Overflow Client: Indicates an buffer overflow or blocking TCP/IP send command.
    u08 OB;         ///< Overflow Bus: Indicates an overflow while reading at least one bus channel.

    struct
    {
        u08 ChannelId;              ///< ID of the channel of the bus on which the message was sent or received.
        COM_BUSTYPE BusType;        ///< Type of the bus on which the message was sent or received.
        u08 Tx;                     ///< Indicates a transmitted frame instead of received one.

        /// \brief The content depends on used channel
        union
        {
            COM_ReceiveMessageCAN CAN;                  ///< For CAN.
            COM_ReceiveMessageFlexRay FlexRay;          ///< For FlexRay.
        } ReceiveMessagesType;

        u64 TimeStamp;                                  ///< The timestamp.
        u08 Data[MAX_RECEIVE_MESSAGE_BYTE_LENGTH];      ///< The payload (max. 127 Word FlexRay/254 Byte CAN).

    } COM_TraceMessage[MAX_NUMBER_OF_TRACE_MESSAGES];   ///< The trace message.

} COM_ReceiveMessagesLegacy;

/// \brief Structure of the main Analyzer Configuration
/// \cond HIDDEN_SYMBOLS
typedef struct COM_AnalyzerConfigtag
{
	u08 AnalyzerConfigVersion;	///< Version of this Command (AnalyzerConfigure)
	u08 TimeSourceChannel;		///< Default time source channel number
	u16 DataInterval;			///< Maximum Interval of Container Messages in ms. (Can be sent faster if Container is full)
	u16 StatisticInterval;		///< Maximum Interval of Statistic Messages (can be sent faster)
	u16 ThreasholdSize;			///< Max size of Container Message (should fit in one Ethernet Frame)
	u08 TransportProtocol;		///< Specifies Connection Protocol (TCP, UDP)
	u08 ProtocolFormat;			///< Format of PC HW Interface Analyzer Packets (Legacy, SDK,...)
	u16 TargetPort;				///< Target Port for Analyzing Container Messages (HW to PC)
	u16 TargetType;				///< Type of the Target Address (1 = Unicast, 2 = Multicast)

	// Target IP Address for Analyzing Container Messages (Network Byte Order) (HW -> PC)
	u08 IPv4_0;					///< Byte 0 (LSB)
	u08 IPv4_1;					///< Byte 1 
	u08 IPv4_2;					///< Byte 2 
	u08 IPv4_3;					///< Byte 3 (MSB)

}COM_AnalyzerConfig;
/// \endcond

/// \brief Structure of the Statistic CAN Message that can be contained in COM_EntryChannelStatistic
typedef struct COM_EntryCANStatistictag
{
	u32 tx_ack : 1;			///< Flag to indicate Send Acknowledge

}COM_EntryCANStatistic;
/// \brief Structure of the Statistic CAN FD Message that can be contained in COM_EntryChannelStatistic
typedef struct COM_EntryCANFDStatistictag
{
	u32 tx_ack : 1;			///< Flag to indicate Send Acknowledge
}COM_EntryCANFDStatistic;
/// \brief Structure of the Statistic FlexRay Message that can be contained in COM_EntryChannelStatistic
typedef struct COM_EntryFlexRayStatistictag
{
	u32 sync : 1;			///< Flag to indicate if the channel is synchornized
}COM_EntryFlexRayStatistic;
/// \brief Structure of the Statistic ETH Message that can be contained in COM_EntryChannelStatistic
typedef struct COM_EntryETHStatistictag
{
	u32 link_changes;		///< Number of link changes
}COM_EntryETHStatistic;

/// \brief Structure of the Statistic LIN Message that can be contained in COM_EntryChannelStatistic
typedef struct COM_EntryLINStatistictag
{
	u32 timeouts;			///< Number of Timeouts
}COM_EntryLINStatistic;

/// \brief Structure of the Statistic UDS Message that can be contained in COM_EntryChannelStatistic
typedef struct COM_EntryUDSStatistictag
{
	u32 uds_req_count;					///< Number of sent UDS request messages
	u32 uds_resp_count;					///< Number of received UDS response messages
	u32 uds_timeout_count;				///< Number of Timeouts
	u32 uds_cyclic_testerpresent_count; ///< Number of sent cyclic Tester Present
	u32 uds_error_count;				///< Number of error
}COM_EntryUDSStatistic;

/// \brief Structure of the Statistic Channel Message that can be contained in COM_EntryStatistic
typedef struct COM_EntryChannelStatistictag
{
	u32 BusType : 8;			///< Type of Bus of channel
	u32 ChannelID : 8;			///< ID of channel
	u32 ChannelState : 8;		///< State of channel
	u32 reserved : 8;			///< Reserved
	u32 Tx;						///< Number of sent messages
	u32 TxError;				///< Number of failed to send messages
	u32 TxBufOv;				///< Number of messages that couldn't take a place in send queue
	u32 Rx;						///< Number of received messages
	u32 RxError;				///< Number of failed to receive messages
	u32 RxBufOv;				///< Number of messages that couldn't take a place in receive queue
	union
	{
		COM_EntryCANStatistic CAN;
		COM_EntryCANFDStatistic CAN_FD;
		COM_EntryFlexRayStatistic FlexRay;
		COM_EntryETHStatistic ETH;
		COM_EntryLINStatistic LIN;
		COM_EntryUDSStatistic UDS;
	};
}COM_EntryChannelStatistic;

/// \brief Structure of the Statistic Message that can be contained in COM_EntrySdkSpecialEntry
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntryStatistictag
{
	//u16 ConfiguredCh : 8;	///< Number of configured Analyzer Channels
	u08 ConfiguredCh;		///< Number of configured Analyzer Channels
	u08 Reserved;			///< Reserved
	u32 RxBufOv;			///< Number of Overflows in RX Buffer (high bus load)
	u32 TxBufOv;			///< Number of Overflows in TX Buffer (slow Ethernet)
	u32 ContainerTxGood;	///< Number of successfully transmitted containers
	u32 ContainerTxBad;		///< Number of failed container transmissions
	u32 ContainerRxGood;	///< Number of successfully received containers
	u32 ContainerRxBad;		///< Number of failed container receptions
	u32 ContainerTxSizeMax : 16;	///< Size of biggest sent container
	u32 ContainerTxSizeMin : 16;	///< Size of smallest sent container
	COM_EntryChannelStatistic *ChanndelStatistics;
}COM_EntryStatistic;
/// \endcond

/// \brief Structure of the UDS Message that can be contained in COM_EntrySdkSpecialEntry
/// \cond HIDDEN_SYMBOLS
#pragma pack(push, 2)
typedef struct COM_EntryUdstag
{
	u08 Dir : 1;				///< Direction of UDS message. 0 = Tx (from PC to device), 1 = Rx (from device to PC)
	u08 TpType : 7;				///< Type of used transport protocol
	u08 TpReturn;			///< Return value of transport protocol
	u16 UdsMsgIdentifier;	///< UDS message identifier
	u16 PayloadLength;		///< UDS payload length
	u16 LogSrcAddr;			///< Logical source address
	u16 LogDestAddr;		///< Logical destination address
	u08* payload;			///< Point to UDS payload data
}COM_EntryUds;
/// \endcond

/// \brief Structure of the Communication Error Message that can be contained in COM_EntrySdkSpecialEntry
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntryCommunicationErrortag
{
	u08 BusType;					///< Type of the bus on the channel
	u08 ChannelID;					///< ID of channel
	u08 ChannelState;				///< State of channel
	u08 CommErrType;				///< Type of communication error
	u08 TimestampType : 1;			///< Type of used timestamp
	u08 Reserved : 7;				///< Reserved
	u08 Reserved2;					///< Reserved2
	u64 Timestamp;					///< Timestamp
}COM_EntryCommunicationError;
/// \endcond

/// \brief Structure which holds the different Special Entries e.g. Statistics (not bus messages)
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkSpecialEntrytag
{
	u16 SpecialEntrySubType;	///< Type of the special sub Entry. Distinction between special entries. 0 = statistic, 1 = UDS message, 2 = Communication error packet

	union
	{
		COM_EntryStatistic Entry_Statistic;			///< Special entry is Statistic
		COM_EntryUds Entry_Uds;						///< Special entry is UDS
		COM_EntryCommunicationError Entry_CommErr;	///< Special entry is packet with timestamp when communication error occured
	} SpecialSubEntrytag;							///< Union holding all different special entries
}COM_EntrySdkSpecialEntry;
#pragma pack(pop)
/// \endcond

/// \brief Structure that describes a Flexray Message that is transmitted in Structure "COM_ContainedMessageSDK"
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkFlexRaytag
{
	u32 ID : 11;				///< Frame ID
	u32 SU : 1;					///< Startup Frame
	u32 SYNC : 1;				///< SyncFrame
	u32 NF : 1;					///< Null-Frame-Indicator: 1 = Null Frame
	u32 PP : 1;					///< Payload-Preamble
	u32 R : 1;					///< Reserved in Flexray Specification
	u32 Payload_Length : 7;		///< Length of Payload in Bytes
	u32 Cycle_Count : 6;		///< Flexray Cycle of Message
	u32 Channel : 2;			///< Channel: A, B, A/B
	u32 Reserved1 : 1;			///< Reserved
	u32 Header_Crc : 11;		///< Header Checksum
	u32 Valid_Frame : 1;		///< Valid Frame
	u32 Syntax_Error : 1;		///< Syntax Error
	u32 Content_Error : 1;		///< Content Error
	u32 SBV : 1;				///< Slot Boundary Violation (only if "Direction" = RX)
	u32 ASYNC : 1;				///< Async Mode (only if "Direction" = RX)
	u32 Frame_Crc : 24;			///< Frame Checksum (only if "Direction" = RX)
	u32 Direction : 1;			///< Frame on Device received or transmitted from device?
								///< 0 = RX
								///< 1 = TX
	u32 TypeTimestamp : 1;		///< Type of used timestamp
								///< 0 = 32 Bits time stamp
								///< 1 = 64 Bits time stamp
	u32 Reserved2 : 6;			///< Reserved
	u32 Buffer_Id : 16;			///< ID of Transmit-Buffer on device (only if "Direction" = TX)
	u32 Timestamp;				///< Timestamp of Message RX/TX on device
	u08* payload;				///< Pointer to Payload Data
}COM_EntrySdkFlexRay;
/// \endcond

enum
{
    COM_EntrySdkFlexrayLength = 16,
}; // Can Fd Entry Length without payload in bytes

/// \brief Structure that describes a CAN Message that is transmitted in Structure "COM_ContainedMessageSDK"
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkCantag
{
	u32 Message_Id : 29;		///< CAN Message ID
	u32 Extended_Id : 1;		///< Indicator for Extended CAN ID
	u32 TypeTimestamp : 1;		///< Type of used timestamp
								///< 0 = 32 Bits time stamp
								///< 1 = 64 Bits time stamp
	u32 Reserved1 : 1;			///< Reserved
	u32 Timestamp;				///< Timestamp of Message RX/TX on device
	u32 Buffer_Id : 8;			///< ID of Transmit Message-Buffer
	u32 DLC : 4;				///< DLC (data length code)
	u32 Direction : 1;			///< Frame on Device received or transmitted from device?
								///< 0 = RX
								///< 1 = TX
	u32 Remote : 1;				///< Remote Frame Indicator
	u32 Loss : 1;				///< Message lost because of Buffer Overflow on device
	u32 Reserved2 : 1;			///< Reserved

	u08* payload;				///< Pointer to Payload Data
}COM_EntrySdkCan;
/// \endcond
enum
{
    COM_EntrySdkCanLength = 10, // Can Entry Length without payload in bytes
};

/// \brief Structure that describes a CAN-FD Message that is transmitted in Structure "COM_ContainedMessageSDK"
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkCanFdtag
{
	u32 Message_Id : 29;		///< CAN FD Message ID
	u32 Extended_Id : 1;		///< Indicator for Extended CAN ID
	u32 TypeTimestamp : 1;		///< Type of used timestamp
								///< 0 = 32 Bits time stamp
								///< 1 = 64 Bits time stamp
	u32 Reserved1 : 1;			///< Reserved
	u32 Timestamp;				///< Timestamp of Message RX/TX on device
	u32 Buffer_Id : 8;			///< ID of Transmit Message-Buffer
	u32 DLC : 4;				///< DLC (data length code)
	u32 Direction : 1;			///< Frame on Device received or transmitted from device?
								///< 0 = RX
								///< 1 = TX
	u32 Remote : 1;				///< Remote Frame Indicator
	u32 Loss : 1;				///< Message lost because of Buffer Overflow on device
	u32 Fd_Format : 1;			///< Indicator for FD Format
	u32 BRS : 1;				///< Indicator for Bitrate Switching
	u32 ESI : 1;				///< Indicator for an Error State
	u32 Reserved2 : 14;			///< Reserved

	u08* payload;				///< Pointer to Payload Data
}COM_EntrySdkCanFd;
/// \endcond
enum
{
    COM_EntrySdkCanFdLength = 12, // Can Fd Entry Length without payload in bytes
};

/// \brief Structure that describes a Ethernet Message that is transmitted in Structure "COM_ContainedMessageSDK"
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkEthtag
{
	u32 Last_Fragment : 1;		///< Flag if last fragment of Ethernet frame
	u32 Fragment_Counter : 4;	///< Number of fragment 
	u32 TypeTimestamp : 1;		///< Type of used timestamp
								///< 0 = 32 Bits time stamp
								///< 1 = 64 Bits time stamp
	u32 Reserved : 2;			///< Reserved
	u32 Indicator: 8;			///< Indicator number stays the same within fragments of same Ethernet frame

	struct
	{
	u32 Timestamp;				///< Timestamp of Message RX/TX on device
	u32 Direction : 1;			///< Frame on Device received or transmitted from device?
								///< 0 = RX
								///< 1 = TX
	u32 Payload_Length : 15;
	}First_Fragment;			///< This struct is only for the first frame



	u08* payload;				///< Pointer to Payload Data
}COM_EntrySdkEth;
/// \endcond
enum
{
    COM_EntrySdkEthFirstFragmentLength = 8, // Ethernet First Fragment Length without payload in bytes
    COM_EntrySdkEthFragmentLength = 2,		 // Ethernet Non-First Fragment Length without payload in bytes
};

/// \brief Structure that describes a CAN-FD Message that is transmitted in Structure "COM_ContainedMessageSDK"
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkLINtag
{
	u32 ID : 6;					///< LIN Message ID
	u32 Checksum : 1;				///< 0: Classic Checksum,  1 : Enhanced Checksum
	u32 Direction : 1;			///< Frame on Device received or transmitted from device?
								///< 0 = RX
								///< 1 = TX
	u32 Payload_Length : 4;		///< Payload Length in Bytes
	u32 TypeTimestamp : 1;		///< Type of used timestamp
								///< 0 = 32 Bits time stamp
								///< 1 = 64 Bits time stamp
	u32 Timestamp;				///< Timestamp of Message on device
	u08* payload;				///< Pointer to Payload Data
}COM_EntrySdkLIN;
/// \endcond
enum
{
    COM_EntrySdkLINLength = 8, // LIN Entry Length without payload in bytes
};

/// \brief Structure that describes a SENT Message that is transmitted in Structure "COM_ContainedMessageSDK"
/// \cond HIDDEN_SYMBOLS
typedef struct COM_EntrySdkSENTtag
{
	u32 Direction : 1;			///< SENT Device Message Direction:
									///< 0 = Tx Channel.
									///< 1 = Rx Channel.
	u32 Format : 3;				///< SENT Message Format:
									///< 0 = Unknown Format.
									///< 1 = Fast Message Format.
									///< 2 = Slow Short Message Format.
									///< 3 = Slow Enhanced 12/8 Message Format.
									///< 4 = Slow Enhanced 16/4 Message Format.
	u32 NibbleCount : 3;		///< Number of Data Nibbles Per Message Frame. 
	u32 TypeTimestamp : 1;		///< Type of used timestamp
								///< 0 = 32 Bits time stamp
								///< 1 = 64 Bits time stamp
	u32 Empty : 23;				///< Reserved.
	u32 Timestamp;				///< Timestamp of Message on device.
	u32 Status : 4;				///< Communication Status Nibble [Fast Messages].
	u32 DataNibble0 : 4;		///< Fast Message Data Nibbles [Max 6].
	u32 DataNibble1 : 4;
	u32 DataNibble2 : 4;
	u32 DataNibble3 : 4;
	u32 DataNibble4 : 4;
	u32 DataNibble5 : 4;
	u32 FastCRC : 4;			///< Fast Message CRC (Checksum).
	u32 MessageID : 8;			///< Slow Message ID.
	u32 SlowCRC : 8;			///< Slow Message CRC (Checksum).
	u32 SlowDataNibble : 16;	///< Slow Message Data Nibbles [8 - 16 Bits]
}COM_EntrySdkSENT;
/// \endcond
enum
{
    COM_EntrySdkSENTLength = 16, // SENT Entry Length in bytes
};


/// \brief Contained Message that holds an entry (Special Entry or bus specific message)
/// \cond HIDDEN_SYMBOLS
typedef struct COM_ContainedMessageSDKtag
{
	u08 EntryType;				///< Type of the Message specific structure
	u08 ChannelID;				///< ID of the concerning Device Channel
	u16 Length;					///< Length of this contained message

	union
	{
		COM_EntrySdkSpecialEntry SpecialEntry;	///< Entry is a Special Entry
		COM_EntrySdkFlexRay EntryFlexRay;		///< Entry is a FlexRay Message
		COM_EntrySdkCan EntryCan;				///< Entry is a CAN Message
		COM_EntrySdkCanFd EntryCanFd;			///< Entry is a CAN-FD Message
		COM_EntrySdkEth EntryEth;				///< Entry is a Ethernet Message
		COM_EntrySdkLIN EntryLIN;				///< Entry is a LIN Message
		COM_EntrySdkSENT EntrySENT;				///< Entry is a SENT Message
	} EntrySdk;									///< Enum with the entry type specific entries
}COM_ContainedMessageSDK;
/// \endcond

/// \cond HIDDEN_SYMBOLS
typedef struct COM_MessageContainerSDKtag
{
	// No header for SDK format
	u16 Count;																		///< Number of messages in the Container.
	u16 Length;																		///< Total Sum of contained messages length in bytes
	COM_ContainedMessageSDK** ContainedMessages;									///< The contained trace messages for SDK Container Format.
}COM_MessageContainerSDK;
/// \endcond

/// \brief The received mount point infos.
typedef struct COM_MountPointInfostag
{
    u16 InfoCount;						 ///< The number of MountPointInfo elements used.
    struct								 /// \brief Structure of the MountPointInfo element
    {
        char ID[32];					///< The mount point ID
        char DisplayName[32];			///< The mount point display name
		u64 Size;					    ///< The size of the mount point number
        u64 UsedSize;					///< The used size of the mount point       
    } MountPointInfo[255];				///< The infos about the mount points
} COM_MountPointInfos;

/// \brief Transceiver state
typedef struct COM_TransceiverStateInfo
{
	u08 ChannelNumber;						///< Channel number 1 - 255
	u08 State;			///< Main transceiver state
	u08 SubState1;	///< Transceiver Sub State 1
	u08 SubState2;	///< Transceiver Sub State 2
	u16 Reserved;							///< Reserved field
} COM_TransceiverStateInfo;

/// \brief Defines the states of the offest control module.
typedef enum COM_OFFSET_STATEtag
{
    COM_OFFSET_STATE_NotAvailable=0,    ///< An offset control module is not available.
    COM_OFFSET_STATE_NotUsed,           ///< The offset control module is not used.
    COM_OFFSET_STATE_OutOfRange,        ///< The offset control module is outside of the target range.
    COM_OFFSET_STATE_InRange,           ///< The offset control module is within of the target range.

}COM_OFFSET_STATE;

/// \brief The recieved offset controll state.
typedef struct COM_OffsetControlStatestag
{
    u08 StateCount;						 ///< The number of OffsetControlState elements used.
    u08 Empty;							 ///< Currently not used
    struct								 /// \brief Structure of the OffsetControlState element
    {
		u08 ChannelNr;					 ///< The channel number
        u08 ChannelID;					 ///< The channel Id
		COM_OFFSET_STATE OffsetState;	 ///< The state of the offset control mudule
		u08 Empty;						 ///< Empty word
        
    } OffsetControlState[255];           ///< The offset control infos per channel
} COM_OffsetControlStates;

/// \brief Defines the states of the logging module.
typedef enum COM_LOGGING_STATEtag
{
    COM_LOGGING_STATE_NotActive=0,		///< The logger module is not active.
    COM_LOGGING_STATE_Active,           ///< The logger module is active.

}COM_LOGGING_STATE;

/// \brief The recieved data
typedef struct COM_LoggingActivetag
{
    COM_LOGGING_STATE LoggingActive;              ///< The COM_LOGGING_STATE.
} COM_LoggingActive;

/// \brief WiFi modes
typedef enum COM_WIFIMODEtag
{
	COM_WIFI_MODE_DISABLED = 0,
	COM_WIFI_MODE_ACCESS_POINT,
	COM_WIFI_MODE_CLIENT,
	COM_WIFI_MODE_AD_HOC,
}COM_WIFIMODE;

/// \brief WiFi encryption type
typedef enum COM_WifiEncryptionTypetag
{
	COM_WIFI_ENCRYPTION_TYPE_NONE = 0,
	COM_WIFI_ENCRYPTION_TYPE_WPA,
	COM_WIFI_ENCRYPTION_TYPE_WPA2,
	COM_WIFI_ENCRYPTION_TYPE_ALLOW_WPA_AND_WPA2,
}COM_WifiEncryptionType;

/// \brief WiFi encryption parameters
typedef enum COM_WifiEncryptionParameterstag
{
	COM_WIFI_ENCRYPTION_PARAMETER_NONE = 0,
	COM_WIFI_ENCRYPTION_PARAMETER_TKIP,
	COM_WIFI_ENCRYPTION_PARAMETER_CCMP,
	COM_WIFI_ENCRYPTION_PARAMETER_ALLOW_TKIP_AND_CCMP,
}COM_WifiEncryptionParameters;


typedef struct COM_WifiConfigtag
{
	/**
	 * WiFi mode (allowed values defined by t_com_wifi_mode)
     * COM_HW_TYPE_FLEX_DEVICE_S_0A01 supports the types COM_WIFI_MODE_DISABLED and COM_WIFI_MODE_ACCESS_POINT
	 */
	u08 Mode;
	/**
	 * Enable DHCP:
	 * - if in access point mode:
	 *   - 0 = disable DHCP server
	 *   - 1 = enable DHCP server
	 * - if in client mode:
	 *   - 0 = disable DHCP client
	 *   - 1 = enable DHCP client
	 * otherwise, it should be set to or reported as 0
	 */
	u08 DhcpEnable;
	/**
	 * Address of access point
	 */
	union
	{
		u08 Ip08[4];
		u32 Ip32;
	} AccessPointAddr;
	/**
	 * Netmask
	 */
	union
	{
		u08 Ip08[4];
		u32 Ip32;
	} NetmaskAddr;
	/**
	 * SSID
	 * This parameter is supported by following devices:
     * COM_HW_TYPE_FLEX_DEVICE_S_0A01
     * COM_HW_TYPE_FLEX_DEVICE_L_3RD_GEN
     * COM_HW_TYPE_FLEX_DEVICE_L_2SOC_3RD_GEN
	 */
	u08 Ssid[32];
	/**
	 * Broadcast SSID:
	 * 0 = don't broadcast SSID
	 * 1 = broadcast SSID
	 * This parameter is supported by following devices:
     * COM_HW_TYPE_FLEX_DEVICE_S_0A01
     * COM_HW_TYPE_FLEX_DEVICE_L_3RD_GEN
     * COM_HW_TYPE_FLEX_DEVICE_L_2SOC_3RD_GEN
	 */
	u08 BroadcastSsid;
	/**
	 * Reserved
	 */
	u08 Reserved1;
	/**
	 * DHCP IP range start
	 */
	union
	{
		u08 Ip08[4];
		u32 Ip32;
	} DhcpStartAddr;
	/**
	 * DHCP IP range end
	 */
	union
	{
		u08 Ip08[4];
		u32 Ip32;
	} DhcpEndAddr;
	/**
	 * Address of DNS server published by the DHCP server
	 */
	union
	{
		u08 Ip08[4];
		u32 Ip32;
	} DnsAddr;
	/**
	 * Address of default gateway published by the DHCP server
	 */
	union
	{
		u08 Ip08[4];
		u32 Ip32;
	} DefaultGwAddr;
	/**
	 * Encryption type (allowed values defined by t_com_wifi_encryption_type)
	 */
	u08 EncryptionType;
	/**
	 * Encryption subtype/parameters (allowed values defined by t_com_wifi_encryption_parameters)
	 */
	u08 EncryptionParameters;
	/**
	 * Channel bandwidth selector; only allowed values:
	 * - 20000 (kHz)
	 * - 40000 (kHz)
	 */
	u16 ChannelBandwidth;
	/**
	 * Channel autoselect:
	 * 0 = don't use auto selection
	 * 1 = perform auto selection
	 */
	u08 ChannelAutoselect;
	/**
	 * Channel number
	 */
	u08 Channel;
	/**
	 * Signal power in mW
	 */
	u32 SignalPower;
	/**
	 * Country code (ASCII characters according to ISO 3166-1 alpha-2)
	 * This parameter is supported by following devices:
     * COM_HW_TYPE_FLEX_DEVICE_S_0A01
     * COM_HW_TYPE_FLEX_DEVICE_L_3RD_GEN
     * COM_HW_TYPE_FLEX_DEVICE_L_2SOC_3RD_GEN
	 */
	u08 CountryCode[2];
	/**
	 * Passphrase length (8 - 63)
	 * This parameter is supported by following devices:
     * COM_HW_TYPE_FLEX_DEVICE_S_0A01
     * COM_HW_TYPE_FLEX_DEVICE_L_3RD_GEN
     * COM_HW_TYPE_FLEX_DEVICE_L_2SOC_3RD_GEN
	 */
	u08 PassphraseLength;
	/**
	 * Reserved
	 */
	u08 Reserved2;
	/**
	 * Passphrase (length from 8 - 62 usable; 63 must be 0!)
	 *
	 * NOTE: to prevent that everybody with physical access to the device
	 *       can read the passphrase, the passphrase can only be set,
	 *       but not read back!
	 *
	 * This parameter is supported by following devices:
     * COM_HW_TYPE_FLEX_DEVICE_S_0A01
     * COM_HW_TYPE_FLEX_DEVICE_L_3RD_GEN
     * COM_HW_TYPE_FLEX_DEVICE_L_2SOC_3RD_GEN
	 */
	u08 Passphrase[64];
} COM_WifiConfig;

/**
 * \brief Information about the installed Wifi device (WLAN-Module).
 */
typedef struct COM_WifiInfotag
{
    /**
     * Type of Wifi device:
     * 0 = None
     * 1 = Connect Card
     * 2 = ESP32
     * 3 = USB-M2
     * 4 = CM4
     */
    u08 Type;

    /**
     * Indicates whether the firmware of the Wifi device is updatable:
     * 0 = Firmware is not updatable
     * 1 = Firmware is updatable
     */

    u08 Updatable;
    
    /**
     * Number of the currently active Firmware storage partition.
     */
    u08 Partition;

    /**
     * Reserved field.
     */
    u08 Reserved0;

    /**
     * Firmware - Version of the installed Wifi device.
     */
    COM_Version FirmwareVersion;

    /**
     * Reserved field.
     */
    u32 Reserved1;
}COM_WifiInfo;

typedef struct COM_PtpTimeSyncConfig
{
	/**
	* ID of the channel of the bus
	*/
	u08 channel_id;
	/**
	* Flag if PTP is running in master mode
	*/
	u08 master : 1;
	/**
	* Flag if Global Master Flag should be set in PTP messages
	*/
	u08 global_master : 1;
	/**
	* Flag if this PTP time instance should
	* act as a time source for all currently configured channels.
	*/
	u08 other_channels_source : 1;
	/**
	* Reserved bit
	*/
	u08 reserved_bit : 1;
	/**
	* Transmission layer (0 = ETH, 1 = IPv4)
	*/
	u08 layer : 4;
	/**
	* Alterantive TimeSync instance for mesage time stamp conversion
	*/
	u08 backup_time_source : 4;
	/**
	* Domain ID for PTP messages
	*/
	u08 domain : 4;
	/**
	* Reserved
	*/
	u08 reserved_1;
	/**
	* VLAN ID
	*/
	u16 vlan;
	/**
	* Transport Specific field
	*/
	u08 transport_specific;
	/**
	* Reserved
	*/
	u08 reserved_2;
	/**
	* Interval for sync frames
	*/
	u16 sync_period_ms;
	/**
	* Delay for FollowUp mesages in ms
	*/
	u16 follow_up_offset_ms;
	/**
	* Interval for PDelay messages or Delay for PDelay Response FollowUp mesages
	*/
	u16 pdelay_ms;
	/**
	* Static PDelay value in ns
	*/
	u16 pdelay_static_ns;
	/**
	* Interval for Announce messages in ms
	*/
	u16 announce_interval_ms;
	/**
	* Announce time source field
	*/
	u08 announce_time_source;
	/**
	* Announce clock class field
	*/
	u08 announce_clock_class;
	/**
	* Announce clock accurracy field
	*/
	u08 announce_clock_accurracy;
	/**
	* Reserved
	*/
	u08 reserved_3;
	/**
	* Announce clock variance field
	*/
	s16 announce_clock_variance;
	/**
	* Announce UTC offset field
	*/
	s16 announce_utc_offset;
	/**
	* Announce steps removed field
	*/
	u16 announce_steps_removed;
	/**
	* Announce Gradmaster Priority 1 field
	*/
	u08 announce_grandmaster_priority_1;
	/**
	* Announce Grandmaster Priority 2 field
	*/
	u08 announce_grandmaster_priority_2;
} COM_PtpTimeSyncConfig;

typedef struct COM_RbsServiceControl
{
	/**
	* ID of the channel of the bus
	*/
	u08 channel_id;
	/**
	* protocol. 1 = TCP, 2 = UDP
	*/
	u08 protocol;
	/**
	* VLAN ID
	*/
	u16 vlan;
	/**
	* Service ID
	*/
	u16 service_id;
	/**
	* Instance ID
	*/
	u16 instance_id;
	/**
	* Major version
	*/
	u08 major_nr;
	/**
	* Minor version
	*/
	u32 minor_nr;
} COM_RbsServiceControl;

typedef struct COM_RbsServiceStateReq
{
	/**
	* ID of the channel of the bus
	*/
	u08 channel_id;
	/**
	* protocol. 1 = TCP, 2 = UDP
	*/
	u08 protocol;
	/**
	* VLAN ID
	*/
	u16 vlan;
	/**
	* Service ID
	*/
	u16 service_id;
	/**
	* Instance ID
	*/
	u16 instance_id;
	/**
	* Major version
	*/
	u08 major_nr;
	/**
	* Empty
	*/
	u08 empty;
	/**
	* Minor version
	*/
	u32 minor_nr;
} COM_RbsServiceStateReq;

typedef struct COM_RbsServiceStateRes
{
	/**
	* ID of the channel of the bus
	*/
	u08 channel_id;
	/**
	* protocol. 1 = TCP, 2 = UDP
	*/
	u08 protocol;
	/**
	* VLAN ID
	*/
	u16 vlan;
	/**
	* Service ID
	*/
	u16 service_id;
	/**
	* Instance ID
	*/
	u16 instance_id;
	/**
	* Major version
	*/
	u08 major_nr;
	/**
	* Flag: Service is stopped
	*/
	u08 is_stopped : 1;
	/**
	* Flag: Service is ready
	*/
	u08 is_ready : 1;
	/**
	* Flag: Event groups partly consumed
	*/
	u08 is_egs_partly_consumed : 1;
	/**
	* Flag: Event groups totally consumed
	*/
	u08 is_egs_totally_consumed : 1;
	/**
	* Reserved
	*/
	u08 reserved : 4;
	/**
	* Minor version
	*/
	u32 minor_nr;
	/**
	* Number of subscribed event groups
	*/
	u08 egs_subscribed_count;
	/**
	* Number of not subscribed event groups
	*/
	u08 egs_not_subscribed_count;
	/**
	* Pointer to list of event groups IDs
	*/
	u16 event_group_ids[100];
} COM_RbsServiceStateRes;

typedef struct COM_RtcDateTimetag
{
	/**
	* Year
	*/
	u16 year;

	/**
	* Month
	*/
	u08 month;

	/**
	* Day
	*/
	u08 day;

	/**
	* Hour
	*/
	u08 hour;

	/**
	* Minutes
	*/
	u08 minutes;

	/**
	* Seconds
	*/
	u08 seconds;

	/**
	* Reserved
	*/
	u08 reserved;

	/**
	* Reserved2
	*/
	u16 reserved2;
	
} COM_RtcDateTime;

typedef struct COM_DiagnosticConfig
{
	/**
	* ID of the channel of the bus
	*/
	u08 channel_id;
	/**
	* Type of the bus. 
	*/
	COM_BUSTYPE BusType;
	/**
	* Flag to control start/stop send cyclic UDS message.
	* 1 = Sneding cyclic UDS message is started. 
	* 0 = Sending cyclic UDS message is not started. 
	*/
	u08 cyclic_send : 1;
	/**
	* Flag for Sub-Function
	* 1 = Sub-function will be used. 
	* 0 = Sub-function will not be used.
	*/
	u08 sub_func : 1;
	/**
	* Reserved
	*/
	u08 reserved;
	/**
	* Cycle time
	*/
	u16 cycle_time;
	/**
	* Timeout
	*/
	u16 timeout;
	/**
	* Source logical address
	*/
	u16 src_log_addr;
	/**
	* Destination logical address
	*/
	u16 dest_log_addr;
	/**
	* Diagnostic Service ID
	*/
	u08 service_id;
	/**
	* Sub-Function byte
	*/
	u08 sub_func_byte;
	/**
	* seconde parameter of sub-function
	*/
	u08 param;
	/**
	* Reserved2
	*/
	u08 reserved2;
}COM_DiagnosticConfig;

/// \brief Structure of the Analyzer Logging Configuration
typedef struct COM_AnalyzerConfigureLoggingtag
{
	/*
	* Channel ID 1 - 255
	*/
	u08 ChannelID;						
	/*
	* Reference Bus Channel Slot ID (used for specific time option)
	*/
    u08 ReferenceTimeChannelSlotID;
	/*
	* File Format (mf4,asc....etc)
	*/
	u08 FileFormat;						
	/*
	* Time Option Used
	*/
	u08 TimeOption;						
	/*
	* Reference Bus Channel ID (used for specific time option)
	*/
	u08 ReferenceTimeChannelID;			
	/*
	* File Path (Mount Path e.g. SD Card - Internal)
 	*/
	u08 FilePath;						
	/*
	* Startup Behaviour 
	*/
	u08 StartupBehaviour;				
	/*
	* Logging Behaviour (Only Logging, Logging & Streaming ... etc)
	*/
	u08 LoggingBehaviour;				
	/*
	* Max File Size before a new one is created (1 - 1000 MBytes)
	*/
	u16 MaxFileSize;					
	/*
	* Pre Logging Time Range in [ms]
	*/
	u32 PreLoggingRange;				
	/*
	* Post Logging Time Range in [ms]
	*/
	u32 PostLoggingRange;				
	/*
	* Reserved 16 Bytes (unused)
	*/
	u08 ReservedArray[16];				
	/*
	* String Array which holds both File name and Sub folder name (Max 255 Characters each)
	*/
	char StringArray[512];				
}COM_AnalyzerConfigureLogging;

/// \brief Command values used by the RBS Replay Module.
typedef enum COM_ReplayCommandtag
{
	/**
	* Unknown command
	*/
	COM_REPLAY_COMMAND_UNKNOWN = 0,
	/**
	* Start command
	*/
	COM_REPLAY_COMMAND_START = 1,
	/**
	* Stop command
	*/
	COM_REPLAY_COMMAND_STOP = 2,
	/**
	* Reset command
	*/
	COM_REPLAY_COMMAND_RESET = 3,
	/*
	* Max command
	*/
	COM_REPLAY_COMMAND_MAX,
} COM_ReplayCommand;

/// \brief Structure of the RBS Replay Module Configuration
typedef struct COM_ReplayConfiguretag
{
	/**
	* Max Buffer Entries
	*/
	u32 buffer_entries_limit;
	/**
	 * Max Buffer Size [Bytes]
	 * 0 = Device dependent maximum [5MBytes]
	 */
	u32 buffer_size_limit;
	/**
	 * The UDP Port on which the device receives COM_ReplayStream
	 * and transmits COM_ReplayStatisticsRes [0 = Default(9690)]
	 */
	u16 port;
	/**
	 * Cyclic UDP static packet transmit interval in [ms]
	 * 0 = disable
	 */
	u16 static_interval;
	/**
	 *  Channel IDs count
	 */
	u08 channel_count;
    /**
     * Flag Byte
     */
    union
    {
        struct
        {
            /**
             * Use sequence numbers to filter entries [Bit 0]
             * 0 = No sequence numbers used
             * 1 = Use sequence numbers to filter entries
             */
            u08 use_sequences : 1;
            /**
             * Reserved
             */
            u08 reserved : 7;
        } parts;
        /*
        * full flags byte
        */
        u08 full;
    } flags;
	/**
	 *  Hardware channel ID to configure
	 *	[Max is 255 IDs]
	 */
	u08 channel_id[255];
}COM_ReplayConfigure;

/// \brief Structure of the RBS Replay Module Control
typedef struct COM_ReplayControltag
{
	/**
	 *  Hardware channel ID which the replay module will be controled
	 *  0 = execute command for all configured channel ids
	 */
	u08 channel_id;
	/**
	 *  Command to be executed
	 */
	u08 command;
	/**
	* Pre - Start wait range before the replay module starts
	*/
	u16 pre_start_wait_range;
}COM_ReplayControl;

/// \brief Structure of the RBS Replay Module Stream 
typedef struct COM_ReplayStreamHeadertag
{
	/**
	 *  Hardware channel ID which the replay module is configured
	 */
	u08 channel_id;
	/**
	 * Flag Byte
	 */
	union
	{
		struct
		{
			/**
			 * Last Fragment [Bit 0]
			 * 0 = there are more fragments
			 * 1 = last fragment
			 */
			u08 lf : 1;

            /**
             * Extended Header fields [Bit 1]
             * 0 = no extended header fields
             * 1 = extended header fields are present
             */
            u08 ext : 1;

			/**
			 * Reserved
			 */
			u08 reserved : 6;
		} parts;
		/*
		* full flags byte
		*/
		u08 full;
	}flags;
	/**
	 * Fragment counter
	 * 0 = First fragment
	 */
	u08 counter;
	/**
	 * Unique frame indicator
	 * [Can't change during fragmented entry
	   until last fragment is streamed]
	 */
	u08 indicator;
	/**
	 * Current fragment length
	 * 1st fragment = 1st fragment header + payload length
	 * n fragment = payload length
	 */
	u16 fragment_length;
}COM_ReplayStreamHeader;

/// \brief Structure of the RBS Replay Module Stream 
typedef struct COM_ReplayExtendedStreamHeadertag
{
    /**
     * Sequence number in which this entry should be replayed, 0 = any sequence
     */
    u32 sequence_number;

    /**
     * Reserved
     */
    u16 reserved;

    /**
     * Set Element Length ID
     */
    u32 set_element_length_id;

    /**
     * New Element Length (as parameter for 'Set Element Length ID')
     */
    u32 new_element_length;

    /**
     * PreElementVoid ID
     */
    u32 pre_element_id;

    /**
     * PostElementVoid ID
     */
    u32 post_element_id;

    /**
     * Reserved
     */
    u16 reserved2[8];
}COM_ReplayExtendedStreamHeader;

/// \brief Structure of the RBS Replay Module First Fragment 
typedef struct COM_ReplayFirstFragmentHeadertag
{
	/**
	* Length of total fragments payload [Bytes]
	* 1st fragment header length + total payload length
	*/
	u32 total_frame_length;
	/**
	 * Set Element ID
	 */
	u32 set_element_id;
	/**
	 * Tx Event ID
	 */
	u32 tx_event_id;
	/**
	 * Measurement timestamp [ns]
	 */
	u64 timestamp;
}COM_ReplayFirstFragmentHeader;

/// \brief Structure of the RBS Replay Module Message Stream 
typedef struct COM_ReplayStreamtag
{
	/**
	 * Stream header
	 */
	COM_ReplayStreamHeader stream_header;
    /**
     * Extended Stream header
     */
    COM_ReplayExtendedStreamHeader extended_stream_header;
	/**
	 * First fragment Header (used only when 0 == counter)
	 */
	COM_ReplayFirstFragmentHeader first_fragment_header;
	/**
	 * Data payload, max = UDP payload (complete message 1454)
	 *  max payload length c.a. 1024 Bytes leaving some
	 *  reserved bytes
	 */
	u08 payload[1024];
}COM_ReplayStream;

/// \brief Structure of RBS Replay Module Contained messages stream
typedef struct COM_ReplayStreamContainedMessageTag
{
	/**
	 * Container count 
	 */
	u08 count;
	/*
	 * Container length
	 */
	u16 length;
	/**
	 * Contained Stream
	 */
	COM_ReplayStream contained_message[256];
}COM_ReplayStreamContainedMessage;

/// \brief Structure of the RBS Replay Module Channel Statistics
typedef struct COM_ReplayChannelStatisticstag
{
	/**
	 *  Hardware channel ID
	 */
	u08 channel_id;
	/**
	 * Channel replay module status
	 * 0 = Stoped
	 * 1 = Started
	 */
	u08 replay_status;
	/**
	 * Number of received entries stored in buffer "UDP full entry buffer store"
	 */
	u32 good_rx_count;
	/**
	 * Number of failed receives "Failed rx UDP messages"
	 */
	u32 bad_rx_count;
	/**
	 * Max number of buffer entries "full frames"
	 */
	u32 buffer_entries_limit;
	/**
	 * Max buffer size 
	 * 0 = Device dependent maximum [5MBytes]
	 */
	u32 buffer_size_limit;
	/**
	 * Current buffer entry count 
	 */
	u32 current_buffer_entries_count;
	/**
	 * Current buffer size in [Bytes]
	 */
	u32 current_buffer_size;
	/**
	 * Maximum number of entries stored in the buffer (since replay started)
	 */
	u32 max_fill_level_entries;
	/**
	 * Maximum number of bytes used for the buffer (since replay started)
	 */
	u32 max_fill_level_bytes;
	/**
	 * Minimum number of the entries stored in the buffer (since replay started)
	 */
	u32 min_fill_level_entries;
	/**
	 * Minimum number of bytes used for the buffer (since replay started)
	 */
	u32 min_fill_level_bytes;
	/**
	 * Number of times a frame couldn't be stored to the buffer because it was full
	 */
	u16 drop_count;
	/**
	 * Information about buffer level:
	 * 0: Buffer can store new entries
	 * 1: Buffer has reached maximum configured limit
	 */
	u08 buffer_information;
	/**
	 * reserved
	 */
	u08 reserved;
}COM_ReplayChannelStatistics;

/// \brief Structure of the RBS Replay Module Statistics
typedef struct COM_ReplayStatisticstag
{
	/*
	 * Number of configured channels
	 */
	u08 channel_count;
	/**
	 * Reserved
	 */
	u08 reserved;
	/**
	 * Seperate statistics for each configured channel	
	 * Device Max statistics transmit = 20 
	 */
	COM_ReplayChannelStatistics channel_statistics[20];
}COM_ReplayStatistics;

/// \brief Structure of Device applications (images)
typedef struct COM_Applicationtag
{
   /**
	* Type
	* 0 = Application
	* 1 = FPGA 1
	* 2 = FPGA 2
	*/
	u08 type;
   /**
	* Application slot
	* 0 = fallback
	* 1 = distribution 
	* 2-n = Application image
	*/
	u08 application_slot;
}COM_Application;

/// \brief Structure of Set/Get Active Application request/response
typedef struct COM_ActiveApplicationtag
{
	/**
	 * Application count 
	 */
	u08 count;
	/**
	 * Reserved
	 */
	u08 reserved;
	/**
	 * Applications 
	 */
	COM_Application applications[255];
}COM_ActiveApplication;

/// \brief Structure of Device applications (cpu) version 
typedef struct COM_ApplicationVersiontag
{
	/**
	* Type
	* 0 = Factory CPU
	* 1 = Distribution CPU
    * 2 = Embedded OS
	* N = Currently Unknown
	*/
	u08 type;
	/**
	* Reserved
	*/
	u08 reserved;
	/**
	* Version
	*/
	u08 version[4];
}COM_ApplicationVersion;

/// \brief Structure of Get application version request
typedef struct COM_GetApplicationsVersiontag
{
	/**
	 * Applications count
	 */
	u08 count;
	/**
	 * Reserved
	 */
	u08 reserved;
	/**
	 * Applications version
	 */
	COM_ApplicationVersion application_version[255];
}COM_GetApplicationsVersion;

/// \brief Structure of Slot Info 
typedef struct COM_SlotInfotag
{
    /**
    * Slot Index
    */
    u08 slotIndex;
    /**
    * Empty
    */
    u08 reserved1;
    /**
    * Device Type
    */
    u16 deviceType;
    /**
    * Device ID
    */
    u08 reserved2;
    /**
    * Project Compatibility
    */
    u08 projectCompatibility;
    /**
    * Empty
    */
    u16 emptyArray[4];
}COM_SlotInfo;

/// \brief Structure of Get application version request
typedef struct COM_SlotInfostag
{
    /**
     * Slot Info count
     */
    u08 count;
    /**
     * Reserved
     */
    u08 reserved;
    /**
     * Slot Infos
     */
    COM_SlotInfo slot_infos[16];
}COM_SlotInfos;

/// \brief Structure of manipulation status request information
typedef struct COM_ManipulationStatusReqtag
{
    /**
    * Manipulation target address
    */
    u32 manipulation_target;
    /**
     * Manipulation sequence number
     */
    u08 sequence_number;
    /**
     * Empty (1Byte)
     */
    u08 empty_u08;
    /**
     * Empty (8Bytes)
     */
    u64 empty_u64;
}COM_ManipulationStatusReq;

/// \brief Structure of Get active manipulations request
typedef struct COM_GetRbsActiveManipulationstag
{
    /**
     * Number of Active manipulations information
     */
    u08 count;
    /**
     * Reserved for alignment
     */
    u08 reserved_u08;
    /**
     * Reserved for further implementation
     */
    u16 reserved_u16;
    /**
     * Manipulation info array 
     */
    COM_ManipulationStatusReq manipulation_info[255]; 
}COM_GetRbsActiveManipulations;

/// \brief Structure of Get manipulation status request
typedef struct COM_GetRbsManipulationStatusReqtag
{   
    /**
     * Requested manipulation status count
     */
    u08 count;
    /**
     * Reserved for alignment
     */
    u08 reserved_u08;
    /**
     * Reserved for further implementation
     */
    u16 reserved_u16;
    /**
     * Manipulation info array
     */
    COM_ManipulationStatusReq manipulation_info[255];
}COM_GetRbsManipulationStatusReq;

/// \brief Structure of Get manipulation status request
typedef struct COM_ManipulationStatusRestag
{
    /**
     * Manipulation target address
     */
    u32 manipulation_target;
    /**
     * Manipulation sequence number
     */
    u08 sequence_number;
    /**
     * Manipulation Status
     */
    u08 status;
    /**
     * Empty (8Bytes)
     */
    u64 empty;
}COM_ManipulationStatusRes;

/// \brief Structure of Get manipulation status request
typedef struct COM_GetRbsManipulationStatusRestag
{
    /**
     * Manipulation status count
     */
    u08 count;
    /**
     * Reserved for alignment
     */
    u08 reserved_u08;
    /**
     * Reserved for further implementation
     */
    u16 reserved_u16;
    /**
     * Manipulation Status information array
     */
    COM_ManipulationStatusRes manipulation_status[255];
}COM_GetRbsManipulationStatusRes;

/// \brief Structure of the COM_AddRbsManipulation64Req message
typedef struct COM_AddRbsManipulation64Reqtag
{
    /**
     * Unique Identifier of Manipulation (set by user or 0 for device to decide)
     */
    u64 uid;
    /**
     * Trigger type 1
     */
    u08 trigger_type_1;
    /**
     * Trigger mode 1
     */
    u08 trigger_mode_1;
    /**
     * Trigger source 1
     */
    u64 trigger_source_1;
    /**
     * Trigger value 1
     */
    u64 trigger_value_1;
    /**
     * Trigger hysterese 1
     */
    u64 trigger_hysterese_1;
    /**
     * Trigger type 2
     */
    u08 trigger_type_2;
    /**
     * Trigger mode 2
     */
    u08 trigger_mode_2;
    /**
     * Trigger source 2
     */
    u64 trigger_source_2;
    /**
     * Trigger value 2
     */
    u64 trigger_value_2;
    /**
     * Trigger hysterese 2
     */
    u64 trigger_hysterese_2;
    /**
     * Trigger type 3
     */
    u08 trigger_type_3;
    /**
     * Trigger mode 3
     */
    u08 trigger_mode_3;
    /**
     * Trigger source 3
     */
    u64 trigger_source_3;
    /**
     * Trigger value 3
     */
    u64 trigger_value_3;
    /**
     * Trigger hysterese 3
     */
    u64 trigger_hysterese_3;
    /**
     * Trigger type 4
     */
    u08 trigger_type_4;
    /**
     * Trigger mode 4
     */
    u08 trigger_mode_4;
    /**
     * Trigger source 4
     */
    u64 trigger_source_4;
    /**
     * Trigger value 4
     */
    u64 trigger_value_4;
    /**
     * Trigger hysterese 4
     */
    u64 trigger_hysterese_4;
    /**
     * Delay value
     */
    u16 delay_value;
    /**
     * Delay type
     */
    u08 delay_type;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * Manipulation type
     */
    u08 manipulation_type;
    /**
     * Manipulation duration
     */
    u16 manipulation_duration;
    /**
     * Manipulation duration type
     */
    u08 manipulation_duration_type;
    /**
     * Manipulation mode
     */
    u08 manipulation_mode;
    /**
     * Manipulation target
     */
    u64 manipulation_target;
    /**
     * Manipulation target value
     */
    u16 manipulation_target_value;
    /**
     * Manipulation value 1
     */
    u64 manipulation_value1;
    /**
     * Manipulation value 2
     */
    u64 manipulation_value2;
    /**
     * Manipulation value 3
     */
    u64 manipulation_value3;
    /**
     * Minimal value
     */
    u64 min_value;
    /**
     * Maximal value
     */
    u64 max_value;
    /**
     * Min-Max mode
     */
    u08 min_max_mode;
    /**
     * Base data type
     */
    u08 base_data_type;
    /**
     * Reserved
     */
    u08 reserved[16];

} COM_AddRbsManipulation64;

/// \brief Structure of the COM_AddRbsManipulation64Res message
typedef struct COM_AddRbsManipulation64Restag
{
    /**
     * Unique Identifier of Manipulation
     */
    u64 uid;
    /**
     * Reserved
     */
    u64 reserved;

} COM_AddRbsManipulation64Res;

/// \brief Structure of the COM_StartRbsManipulation64Req message
typedef struct COM_StartRbsManipulation64Reqtag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_StartRbsManipulation64;

/// \brief Structure of the COM_StartRbsManipulation64Res message
typedef struct COM_StartRbsManipulation64Restag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_StartRbsManipulation64Res;

/// \brief Structure of the COM_StartRbsManipulationCyclic64Req message
typedef struct COM_StartRbsManipulationCyclic64Reqtag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_StartRbsManipulationCyclic64;

/// \brief Structure of the COM_StartRbsManipulationCyclic64Res message
typedef struct COM_StartRbsManipulationCyclic64Restag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_StartRbsManipulationCyclic64Res;

/// \brief Structure of the COM_StopRbsManipulation64Req message
typedef struct COM_StopRbsManipulation64Reqtag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_StopRbsManipulation64;

/// \brief Structure of the COM_StopRbsManipulation64Res message
typedef struct COM_StopRbsManipulation64Restag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_StopRbsManipulation64Res;

/// \brief Structure of the COM_RemoveRbsManipulation64Req message
typedef struct COM_RemoveRbsManipulation64Reqtag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_RemoveRbsManipulation64;

/// \brief Structure of the COM_RemoveRbsManipulation64Res message
typedef struct COM_RemoveRbsManipulation64Restag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_RemoveRbsManipulation64Res;

/// \brief Structure of the COM_GetRbsActiveManipulations64Res message
typedef struct COM_GetRbsActiveManipulations64Restag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_GetRbsActiveManipulations64Res;

/// \brief Structure of the COM_GetRbsManipulationStatus64Req message
typedef struct COM_GetRbsManipulationStatus64Reqtag
{
    /**
     * Number of UIDs in this message
     */
    u16 uid_count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of UIDs
     */
    u64 uid[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_GetRbsManipulationStatus64;

/// \brief Manipulation Status Struct used in COM_GetRbsManipulationStatus64Res
typedef struct COM_ManipulationStatus64tag
{
    /**
     * Unique Identifier of this Manipulation
     */
    u64 uid;
    /**
     * Reserved
     */
    u08 reserved_u08;
    /**
     * Status: 0 = not active, 1 = active, 2 = manipulation target invalid
    */
    u08 status;
    /**
     * Reserved
     */
    u64 reserved_u64;

} COM_ManipulationStatus64;

/// \brief Structure of the COM_GetRbsManipulationStatus64Res message
typedef struct COM_GetRbsManipulationStatus64Restag
{
    /**
     * Number of Manipulation Status in this message
     */
    u16 count;
    /**
     * Reserved
     */
    u16 reserved_u16;
    /**
     * List of Manipulation Status Structs
     */
    COM_ManipulationStatus64 manip_status[RBS_MANIPULATION_64_MAX_UID_COUNT];

} COM_GetRbsManipulationStatus64Res;

#endif /* _HWCOM_DEFINES_H_ */
