diff --git a/CPP_Demo/xcp_cfg.h b/CPP_Demo/xcp_cfg.h deleted file mode 100644 index 682b991..0000000 --- a/CPP_Demo/xcp_cfg.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once -#define __XCP_CFG_H__ - -/*---------------------------------------------------------------------------- -| File: -| xcp_cfg.h -| -| Description: -| User configuration file for XCP protocol layer parameters -| -| Code released into public domain, no attribution required -| - ----------------------------------------------------------------------------*/ - - - -/*----------------------------------------------------------------------------*/ -/* Version */ - -// Driver version (GET_COMM_MODE_INFO) -#define XCP_DRIVER_VERSION 0x01 - -// Enable Ethernet specific protocol layer commands -#define XCP_ENABLE_PROTOCOL_LAYER_ETH - -// Protocol layer version -// #define XCP_PROTOCOL_LAYER_VERSION 0x0101 -// #define XCP_PROTOCOL_LAYER_VERSION 0x0103 // GET_DAQ_CLOCK_MULTICAST, GET_TIME_CORRELATION_PROPERTIES -#define XCP_PROTOCOL_LAYER_VERSION 0x0104 // PACKED_MODE, CC_START_STOP_SYNCH prepare - - -/*----------------------------------------------------------------------------*/ -/* Adress, address extension coding */ - -// Use addr_ext XCP_ADDR_EXT_ABS to indicate absulute addr format (ApplXcpGetBaseAddr()+(uint32_t)addr) -#define XCP_ENABLE_ABS_ADDRESSING -#define XCP_ADDR_EXT_ABS 0x00 // Absolute address format - -// Use addr_ext XCP_ADDR_EXT_DYN to indicate relative addr format (event<<16)|offset -#ifdef OPTION_ENABLE_XCP_CLASS - #define XCP_ENABLE_DYN_ADDRESSING - #define XCP_ADDR_EXT_DYN 0x02 // Relative address format -#endif - -// Use addr_ext XCP_ADDR_EXT_APP to indicate application specific addr format and use ApplXcpReadMemory and ApplXcpWriteMemory -// #define XCP_ENABLE_APP_ADDRESSING -// #define XCP_ADDR_EXT_APP 0x00 // Address format handled by application - -// Internally used address extensions -// Use addr_ext XCP_ADDR_EXT_A2L to indicate A2L upload memory space -#define XCP_ADDR_EXT_A2L 0xFD -// Use addr_ext XCP_ADDR_EXT_PTR to indicate gXcp.MtaPtr is valid -#define XCP_ADDR_EXT_PTR 0xFE - -// Undefined address extension -#define XCP_ADDR_EXT_UNDEFINED 0xFF // Undefined address extension - -/*----------------------------------------------------------------------------*/ -/* Protocol features */ - -//#define XCP_ENABLE_INTERLEAVED -//#define XCP_INTERLEAVED_QUEUE_SIZE 16 - -#define XCP_ENABLE_CHECKSUM // Enable checksum calculation command - -#define XCP_ENABLE_CAL_PAGE // Enable cal page switch - - -/*----------------------------------------------------------------------------*/ -/* GET_ID command */ - -#ifdef OPTION_ENABLE_A2L_GEN -#define XCP_ENABLE_IDT_A2L_UPLOAD // Upload A2L via XCP UPLOAD -#endif - -/*----------------------------------------------------------------------------*/ -/* DAQ features and parameters */ - -// #define XCP_ENABLE_DAQ_EVENT_INFO // Enable XCP_GET_EVENT_INFO, if this is enabled, A2L file event information will be ignored -#define XCP_ENABLE_DAQ_EVENT_LIST // Enable event list -#define XCP_MAX_EVENT_COUNT 16 // Maximum number of events, size of event table -#define XCP_ENABLE_MULTITHREAD_EVENTS // Make XcpEvent thread safe also for same event from different thread -// #define XCP_ENABLE_PACKED_MODE // Enable packed mode emulation - -#define XCP_DAQ_MEM_SIZE (5*100) // Amount of memory for DAQ tables, each ODT entry (e.g. measurement variable) needs 5 bytes - -// CLOCK_USE_UTC_TIME_NS -// Settings for 64 bit ns since 1.1.1970 TAI clock (CLOCK_USE_UTC_TIME_NS) - -#define XCP_DAQ_CLOCK_64BIT // Use 64 Bit time stamps in GET_DAQ_CLOCK -#define XCP_DAQ_CLOCK_UIID { 0xdc,0xa6,0x32,0xFF,0xFE,0x7e,0x66,0xdc } - -// Server DAQ clock info (mandatory) -#define XCP_TIMESTAMP_UNIT DAQ_TIMESTAMP_UNIT_1NS // unit DAQ_TIMESTAMP_UNIT_xxx -#define XCP_TIMESTAMP_TICKS 1 // ticks per unit -#define XCP_TIMESTAMP_EPOCH XCP_EPOCH_TAI - -// Grandmaster clock (optional, use XcpSetGrandmasterClockInfo, implement ApplXcpGetClockInfoGrandmaster) -// #define XCP_ENABLE_PTP - - -//#define XCP_ENABLE_DAQ_CLOCK_MULTICAST // Enable GET_DAQ_CLOCK_MULTICAST -#ifdef XCP_ENABLE_DAQ_CLOCK_MULTICAST - // XCP default cluster id (multicast addr 239,255,0,1, group 127,0,1 (mac 01-00-5E-7F-00-01) -#define XCP_MULTICAST_CLUSTER_ID 1 -#endif - -#define XCP_TIMESTAMP_TICKS_S CLOCK_TICKS_PER_S // ticks per s (for debug output) - - -//------------------------------------------------------------------------------- -// Debug - -// Enable logging -#define OPTION_ENABLE_DBG_PRINTS - -// Enable extended error checks, performance penalty !!! -#define XCP_ENABLE_TEST_CHECKS - diff --git a/CPP_Demo/xcptl_cfg.h b/CPP_Demo/xcptl_cfg.h deleted file mode 100644 index 93f9993..0000000 --- a/CPP_Demo/xcptl_cfg.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -/*---------------------------------------------------------------------------- -| File: -| xcptl_cfg.h -| -| Description: -| User configuration file for XCP transport layer parameters -| -| Code released into public domain, no attribution required -| - ----------------------------------------------------------------------------*/ - -// Transport layer -#define XCP_TRANSPORT_LAYER_TYPE XCP_TRANSPORT_LAYER_ETH -#define XCP_TRANSPORT_LAYER_VERSION 0x0104 - -// TCP or/and UDP option enabled -#define XCPTL_ENABLE_TCP -#define XCPTL_ENABLE_UDP - -// Transmit mode -#define XCPTL_QUEUED_CRM // Use transmit queue for command responces -/* -Benefits: -- Unique transport layers message counters for CRM and DTO (CANape default transport layer option is "include command response") -- Transmit queue empty before DAQ is stopped (end of measurement consistent for all event channels) -- socketSendTo needs not to be thread safe for a socket -Drawbacks: -- Increased latency for GET_DAQ_CLOCK response during DAQ running, which impacts time sync quality if XCP 1.3 trigger initiator "sampled on reception" is not supported -- Impact on DAQ performance because transport layer packet is flushed for command responses -- DAQ queue overflow can happen on command responses, CANape aborts when response to GET_DAQ_CLOCK is missing -*/ - -// Transport layer header size -// This is fixed, no other options supported -#define XCPTL_TRANSPORT_LAYER_HEADER_SIZE 4 - -// TL segment size and DTO size -// Segment size is the maximum data buffer size given to send/sendTo, for UDP it is the MTU -#define XCPTL_MAX_SEGMENT_SIZE (OPTION_MTU-20-8) // UDP MTU (MTU - IP-header - UDP-header) -#define XCPTL_MAX_DTO_SIZE (XCPTL_MAX_SEGMENT_SIZE-XCPTL_TRANSPORT_LAYER_HEADER_SIZE) // Normal ETH frame MTU - IPhdr - UDPhdr- XCPhdr, DTO size must be mod 4 -#define XCPTL_PACKET_ALIGNMENT 4 // Packet alignment for multiple XCP transport layer packets in a XCP transport layer message - -// CTO size -// Maximum size of a XCP command -#define XCPTL_MAX_CTO_SIZE (248) -// CRO_SHORT_DOWNLOAD_MAX_SIZE = XCPTL_MAX_CTO_SIZE-8 should be %8==0 -// CRO_DOWNLOAD_MAX_SIZE = XCPTL_MAX_CTO_SIZE-2 - -// DAQ transmit queue -// Transmit queue size in segments, should at least be able to hold all data produced until the next call to HandleTransmitQueue -#define XCPTL_QUEUE_SIZE 64 // array[XCPTL_QUEUE_SIZE] of tXcpMessageBuffer (XCPTL_MAX_SEGMENT_SIZE+4) -// Maximum queue trigger event rate -#define XCPTL_QUEUE_TRANSMIT_CYCLE_TIME (1*CLOCK_TICKS_PER_MS) -// Flush cycle -#define XCPTL_QUEUE_FLUSH_CYCLE_MS 50 // Send a DTO packet at least every x ms, XCPTL_TIMEOUT_INFINITE to turn off - -// Transport layer header size -// This is fixed, no other options supported -#define XCPTL_TRANSPORT_LAYER_HEADER_SIZE 4 - -// Multicast (GET_DAQ_CLOCK_MULTICAST) -// Use multicast time synchronisation to improve synchronisation of multiple XCP slaves -// This is standard in XCP V1.3, but it needs to create an additional thread and socket for multicast reception -// Has no benefit with PTP time synchronized slave and is just unnesserary effort -// CANape expects this by default -> adjust setting in device/protocol/event/TIME_CORRELATION_GETDAQCLOCK from "multicast" to "extended response" to switch it of -//#define XCPTL_ENABLE_MULTICAST -#ifdef XCPTL_ENABLE_MULTICAST - #define XCPTL_MULTICAST_PORT 5557 -#endif - diff --git a/XCPlite/xcp_cfg.h b/XCPlite/xcp_cfg.h deleted file mode 100644 index 3e1abe4..0000000 --- a/XCPlite/xcp_cfg.h +++ /dev/null @@ -1,166 +0,0 @@ -#pragma once -#define __XCP_CFG_H__ - -#ifndef __MAIN_CFG_H__ -#error "Include dependency error! options not set" -#endif - -/*---------------------------------------------------------------------------- -| File: -| xcp_cfg.h -| -| Description: -| Parameter configuration for XCP protocol layer parameters - ----------------------------------------------------------------------------*/ - - -/*----------------------------------------------------------------------------*/ -/* Version */ - -// Driver version (GET_COMM_MODE_INFO) -#define XCP_DRIVER_VERSION 0x01 - -// Enable Ethernet specific protocol layer commands -#define XCP_ENABLE_PROTOCOL_LAYER_ETH - -// Protocol layer version -//#define XCP_PROTOCOL_LAYER_VERSION 0x0101 -//#define XCP_PROTOCOL_LAYER_VERSION 0x0103 // GET_DAQ_CLOCK_MULTICAST, GET_TIME_CORRELATION_PROPERTIES -#define XCP_PROTOCOL_LAYER_VERSION 0x0104 // PACKED_MODE, CC_START_STOP_SYNCH prepare - -/*----------------------------------------------------------------------------*/ -/* Adress, address extension coding */ - -// Use addr_ext XCP_ADDR_EXT_ABS to indicate absulute addr format (ApplXcpGetBaseAddr()+(uint32_t)addr) -#define XCP_ENABLE_ABS_ADDRESSING -#define XCP_ADDR_EXT_ABS 0x00 // Absolute address format - -// Use addr_ext XCP_ADDR_EXT_DYN to indicate relative addr format (event<<16)|offset -// #define XCP_ENABLE_DYN_ADDRESSING -// #define XCP_ADDR_EXT_DYN 0x02 // Relative address format - -// Use addr_ext XCP_ADDR_EXT_APP to indicate application specific addr format and use ApplXcpReadMemory and ApplXcpWriteMemory -// #define XCP_ENABLE_APP_ADDRESSING -// #define XCP_ADDR_EXT_APP 0x00 // Address format handled by application - -// Internally used address extensions -// Use addr_ext XCP_ADDR_EXT_A2L to indicate A2L upload memory space -#define XCP_ADDR_EXT_A2L 0xFD -// Use addr_ext XCP_ADDR_EXT_PTR to indicate gXcp.MtaPtr is valid -#define XCP_ADDR_EXT_PTR 0xFE - -// Undefined address extension -#define XCP_ADDR_EXT_UNDEFINED 0xFF // Undefined address extension - -// Make XcpEvent thread safe for same CAL event coming from different threads -// Needed for xcp-lite, because CalSeg cal sync events may come from different threads -#ifdef XCP_ENABLE_DYN_ADDRESSING - #define XCP_ENABLE_MULTITHREAD_CAL_EVENTS -#endif - -/*----------------------------------------------------------------------------*/ -/* Protocol features */ - -// #define XCP_ENABLE_CAL_PAGE // Enable cal page switch -#ifdef XCP_ENABLE_CAL_PAGE - #define XCP_ENABLE_COPY_CAL_PAGE // // Enable calibration page initialization (FLASH->RAM copy) - #define XCP_ENABLE_FREEZE_CAL_PAGE // Enable calibration freeze command -#endif - -// #define XCP_ENABLE_CHECKSUM // Enable checksum calculation command - -// #define XCP_ENABLE_SEED_KEY // Enable seed/key command - -// #define XCP_ENABLE_SERV_TEXT // Enable SERV_TEXT events - -/*----------------------------------------------------------------------------*/ -/* GET_ID command */ - -#ifdef OPTION_ENABLE_A2L_GEN -#define XCP_ENABLE_IDT_A2L_UPLOAD // Upload A2L via XCP UPLOAD -// Uses addr_ext=0xFF to indicate addr space to upload A2L -#endif - -/*----------------------------------------------------------------------------*/ -/* User defined command */ - -// Used for begin and end atomic calibration operation -// #define XCP_ENABLE_USER_COMMAND - - -/*----------------------------------------------------------------------------*/ -/* DAQ features and parameters */ - - -#define XCP_ENABLE_DAQ_EVENT_LIST // Enable event list -#ifdef XCP_ENABLE_DAQ_EVENT_LIST - - // #define XCP_ENABLE_DAQ_EVENT_INFO // Enable XCP_GET_EVENT_INFO, if this is enabled, A2L file event information will be ignored - - // Make XcpEventExt thread safe for same DAQ event coming from different threads - // #define XCP_ENABLE_MULTITHREAD_DAQ_EVENTS - // This should be very unusual, XcpEvent performance will be decreased - // Requires event list, additional mutex is located in XcpEvent - - #define XCP_MAX_EVENT_COUNT 16 - #define XCP_MAX_EVENT_NAME 16 - - // Enable checking for clock monotony (no decreasing timestamp), use for debugging only, performance and memory impact - // #define XCP_ENABLE_TIMESTAMP_CHECK - - -#endif - -// Enable packed mode -// #define XCP_ENABLE_PACKED_MODE - -// Overrun indication via PID -// Not needed for Ethernet, client detects data loss via transport layer counters -//#define XCP_ENABLE_OVERRUN_INDICATION_PID - -// Static allocated memory for DAQ tables -// Amount of memory for DAQ tables, each ODT entry (e.g. measurement variable) needs 5 bytes -#ifdef OPTION_DAQ_MEM_SIZE -#define XCP_DAQ_MEM_SIZE OPTION_DAQ_MEM_SIZE -#else -#define XCP_DAQ_MEM_SIZE (256*5) // Amount of memory for DAQ tables, each ODT entry (e.g. measurement variable or memory block) needs 5 bytes -#endif - -// Maximum number of DAQ lists -// Numbers smaller than 256 will switch to 2 byte transport layer header DAQ_HDR_ODT_DAQB -#define XCP_MAX_DAQ_COUNT 1024 - -// Clock resolution -//#define XCP_DAQ_CLOCK_32BIT // Use 32 Bit time stamps -#define XCP_DAQ_CLOCK_64BIT // Use 64 Bit time stamps -#if CLOCK_TICKS_PER_S == 1000000 // us - #define XCP_TIMESTAMP_UNIT DAQ_TIMESTAMP_UNIT_1US // unit - #define XCP_TIMESTAMP_TICKS 1 // ticks per unit -#endif -#if CLOCK_TICKS_PER_S == 1000000000 // ns - #define XCP_TIMESTAMP_UNIT DAQ_TIMESTAMP_UNIT_1NS // unit - #define XCP_TIMESTAMP_TICKS 1 // ticks per unit -#endif - -// Grandmaster clock (optional, use XcpSetGrandmasterClockInfo, implement ApplXcpGetClockInfoGrandmaster) -#define XCP_ENABLE_PTP -#define XCP_DAQ_CLOCK_UIID { 0xdc,0xa6,0x32,0xFF,0xFE,0x7e,0x66,0xdc } - -// Enable GET_DAQ_CLOCK_MULTICAST -// #define XCP_ENABLE_DAQ_CLOCK_MULTICAST -#ifdef XCP_ENABLE_DAQ_CLOCK_MULTICAST - // XCP default cluster id (multicast addr 239,255,0,1, group 127,0,1 (mac 01-00-5E-7F-00-01) - #define XCP_MULTICAST_CLUSTER_ID 1 -#endif - - -//------------------------------------------------------------------------------- -// Debug - -// Enable extended error checks, performance penalty !!! -#define XCP_ENABLE_TEST_CHECKS - - -// Enable extended error checks, performance penalty !!! -#define XCP_ENABLE_TEST_CHECKS - diff --git a/XCPlite/xcptl_cfg.h b/XCPlite/xcptl_cfg.h deleted file mode 100644 index 97563d6..0000000 --- a/XCPlite/xcptl_cfg.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -/*---------------------------------------------------------------------------- -| File: -| xcptl_cfg.h -| -| Description: -| User configuration file for XCP transport layer parameters -| -| Code released into public domain, no attribution required -| - ----------------------------------------------------------------------------*/ - -// Transport layer -#define XCP_TRANSPORT_LAYER_TYPE XCP_TRANSPORT_LAYER_ETH -#define XCP_TRANSPORT_LAYER_VERSION 0x0104 - -// TCP or/and UDP option enabled -#define XCPTL_ENABLE_TCP -#define XCPTL_ENABLE_UDP - -// Transmit mode -#define XCPTL_QUEUED_CRM // Use transmit queue for command responces -/* -Benefits: -- Unique transport layers message counters for CRM and DTO (CANape default transport layer option us "include command response") -- Transmit queue empty before DAQ is stopped (end of measurement consistent for all event channels) -- socketSendTo needs not to be thread safe for a socket -Drawbacks: -- Increased latency for GET_DAQ_CLOCK response during DAQ running, which impacts time sync quality if XCP 1.3 trigger initiator "sampled on reception" is not supported -- Impact on DAQ performance because transport layer packet is flushed for command responses -- DAQ queue overflow can happen on command responses, CANape aborts when response to GET_DAQ_CLOCK is missing -*/ - -// Transport layer header size -// This is fixed, no other options supported -#define XCPTL_TRANSPORT_LAYER_HEADER_SIZE 4 - -// TL segment size and DTO size -// Segment size is the maximum data buffer size given to send/sendTo, for UDP it is the MTU -#define XCPTL_MAX_SEGMENT_SIZE (OPTION_MTU-20-8) // UDP MTU (MTU - IP-header - UDP-header) -#define XCPTL_MAX_DTO_SIZE (XCPTL_MAX_SEGMENT_SIZE-XCPTL_TRANSPORT_LAYER_HEADER_SIZE) // Normal ETH frame MTU - IPhdr - UDPhdr- XCPhdr, DTO size must be mod 4 -#define XCPTL_PACKET_ALIGNMENT 4 // Packet alignment for multiple XCP transport layer packets in a XCP transport layer message - -// CTO size -// Maximum size of a XCP command -#define XCPTL_MAX_CTO_SIZE (248) -// CRO_SHORT_DOWNLOAD_MAX_SIZE = XCPTL_MAX_CTO_SIZE-8 should be %8==0 -// CRO_DOWNLOAD_MAX_SIZE = XCPTL_MAX_CTO_SIZE-2 - -// DAQ transmit queue -// Transmit queue size in segments, should at least be able to hold all data produced until the next call to HandleTransmitQueue -#define XCPTL_QUEUE_SIZE 64 // array[XCPTL_QUEUE_SIZE] of tXcpMessageBuffer (XCPTL_MAX_SEGMENT_SIZE+4) -// Maximum queue trigger event rate -#define XCPTL_QUEUE_TRANSMIT_CYCLE_TIME (1*CLOCK_TICKS_PER_MS) -// Flush cycle -#define XCPTL_QUEUE_FLUSH_CYCLE_MS 50 // Send a DTO packet at least every x ms, XCPTL_TIMEOUT_INFINITE to turn off - -// Multicast (GET_DAQ_CLOCK_MULTICAST) -// Use multicast time synchronisation to improve synchronisation of multiple XCP slaves -// This is standard in XCP V1.3, but it needs to create an additional thread and socket for multicast reception -// Has no benefit with PTP time synchronized slave and is just unnesserary effort -// CANape expects this by default -> adjust setting in device/protocol/event/TIME_CORRELATION_GETDAQCLOCK from "multicast" to "extended response" to switch it of -//#define XCPTL_ENABLE_MULTICAST -#ifdef XCPTL_ENABLE_MULTICAST - #define XCPTL_MULTICAST_PORT 5557 -#endif - diff --git a/C_Demo/xcp_cfg.h b/src/xcp_cfg.h similarity index 100% rename from C_Demo/xcp_cfg.h rename to src/xcp_cfg.h diff --git a/C_Demo/xcptl_cfg.h b/src/xcptl_cfg.h similarity index 100% rename from C_Demo/xcptl_cfg.h rename to src/xcptl_cfg.h