From 7f1e9ca26174c0b8d23ced3413ddaeb284f1d593 Mon Sep 17 00:00:00 2001 From: RainerZ Date: Tue, 12 Nov 2024 13:34:23 +0100 Subject: [PATCH] Visual Studio project updated --- CPP_Demo/CPP_Demo.vcxproj | 7 +++++-- CPP_Demo/CPP_Demo.vcxproj.filters | 17 +++++++++++++++-- C_Demo/C_Demo.vcxproj | 7 +++++-- C_Demo/C_Demo.vcxproj.filters | 17 +++++++++++++++-- XCPlite/XCPlite.vcxproj | 7 +++++-- XCPlite/XCPlite.vcxproj.filters | 17 +++++++++++++++-- src/xcpEthTl.c | 10 +++++----- src/xcpLite.c | 16 +++++++++------- src/xcpTl.c | 2 +- src/xcpTl.h | 2 +- 10 files changed, 76 insertions(+), 26 deletions(-) diff --git a/CPP_Demo/CPP_Demo.vcxproj b/CPP_Demo/CPP_Demo.vcxproj index 55993bb..2c8d260 100644 --- a/CPP_Demo/CPP_Demo.vcxproj +++ b/CPP_Demo/CPP_Demo.vcxproj @@ -166,6 +166,8 @@ + + @@ -181,10 +183,11 @@ + + + - - diff --git a/CPP_Demo/CPP_Demo.vcxproj.filters b/CPP_Demo/CPP_Demo.vcxproj.filters index 553b471..f0b316a 100644 --- a/CPP_Demo/CPP_Demo.vcxproj.filters +++ b/CPP_Demo/CPP_Demo.vcxproj.filters @@ -29,11 +29,15 @@ src + + src + + + src + - - src @@ -73,6 +77,15 @@ src + + src + + + src + + + src + diff --git a/C_Demo/C_Demo.vcxproj b/C_Demo/C_Demo.vcxproj index 9356ead..edc7ed6 100644 --- a/C_Demo/C_Demo.vcxproj +++ b/C_Demo/C_Demo.vcxproj @@ -162,6 +162,8 @@ + + @@ -176,11 +178,12 @@ + + + - - diff --git a/C_Demo/C_Demo.vcxproj.filters b/C_Demo/C_Demo.vcxproj.filters index ed08c78..1ddd078 100644 --- a/C_Demo/C_Demo.vcxproj.filters +++ b/C_Demo/C_Demo.vcxproj.filters @@ -24,11 +24,16 @@ src + + src + + + src + - src @@ -47,7 +52,6 @@ src - src @@ -63,6 +67,15 @@ src + + src + + + src + + + src + diff --git a/XCPlite/XCPlite.vcxproj b/XCPlite/XCPlite.vcxproj index 1e5daa9..bd7c65e 100644 --- a/XCPlite/XCPlite.vcxproj +++ b/XCPlite/XCPlite.vcxproj @@ -162,6 +162,8 @@ + + @@ -174,9 +176,10 @@ + + + - - diff --git a/XCPlite/XCPlite.vcxproj.filters b/XCPlite/XCPlite.vcxproj.filters index a433a65..e5b348e 100644 --- a/XCPlite/XCPlite.vcxproj.filters +++ b/XCPlite/XCPlite.vcxproj.filters @@ -20,9 +20,14 @@ src + + src + + + src + - src @@ -36,7 +41,6 @@ src - src @@ -52,6 +56,15 @@ src + + src + + + src + + + src + diff --git a/src/xcpEthTl.c b/src/xcpEthTl.c index 75f4f3b..ecdc661 100644 --- a/src/xcpEthTl.c +++ b/src/xcpEthTl.c @@ -149,7 +149,7 @@ void XcpEthTlSendMulticastCrm(const uint8_t* packet, uint16_t packet_size, const //------------------------------------------------------------------------------ -static int handleXcpCommand(tXcpCtoMessage *p, uint8_t *srcAddr, uint16_t srcPort) { +static BOOL handleXcpCommand(tXcpCtoMessage *p, uint8_t *srcAddr, uint16_t srcPort) { int connected; @@ -175,7 +175,7 @@ static int handleXcpCommand(tXcpCtoMessage *p, uint8_t *srcAddr, uint16_t srcPor DBG_PRINTF_WARNING("WARNING: message from unknown new master %u.%u.%u.%u, disconnecting!\n", srcAddr[0], srcAddr[1], srcAddr[2], srcAddr[3]); XcpDisconnect(); gXcpTl.MasterAddrValid = FALSE; - return 1; // Disconnect + return TRUE; // Disconnect } // Check unicast master udp port, not allowed to change @@ -183,11 +183,11 @@ static int handleXcpCommand(tXcpCtoMessage *p, uint8_t *srcAddr, uint16_t srcPor DBG_PRINTF_WARNING("WARNING: master port changed from %u to %u, disconnecting!\n", gXcpTl.MasterPort, srcPort); XcpDisconnect(); gXcpTl.MasterAddrValid = FALSE; - return 1; // Disconnect + return TRUE; // Disconnect } } #endif // UDP - if (p->dlc>XCPTL_MAX_CTO_SIZE) return 0; + if (p->dlc>XCPTL_MAX_CTO_SIZE) return FALSE; XcpCommand((const uint32_t*)&p->packet[0], (uint8_t)p->dlc); // Handle command } @@ -222,7 +222,7 @@ static int handleXcpCommand(tXcpCtoMessage *p, uint8_t *srcAddr, uint16_t srcPor } // not connected before #endif // UDP - return 1; // Ok + return TRUE; // Ok } diff --git a/src/xcpLite.c b/src/xcpLite.c index 70347b8..e565b64 100644 --- a/src/xcpLite.c +++ b/src/xcpLite.c @@ -1047,7 +1047,7 @@ static void XcpSendResponse(const tXcpCto* crm, uint8_t crmLen) { } // Transmit multicast command response -#ifdef PLATFORM_ENABLE_GET_LOCAL_ADDR +#ifdef XCPTL_ENABLE_MULTICAST static void XcpSendMulticastResponse( const tXcpCto* crm, uint8_t crmLen, uint8_t *addr, uint16_t port) { XcpEthTlSendMulticastCrm((const uint8_t*)crm, crmLen, addr, port); @@ -2246,9 +2246,9 @@ static void XcpPrintCmd(const tXcpCto* cmdBuf) { #endif // >= 0x0104 +#ifdef XCP_ENABLE_DAQ_CLOCK_MULTICAST case CC_TRANSPORT_LAYER_CMD: switch (CRO_TL_SUBCOMMAND) { -#ifdef XCP_ENABLE_DAQ_CLOCK_MULTICAST case CC_TL_GET_DAQ_CLOCK_MULTICAST: { printf("GET_DAQ_CLOCK_MULTICAST counter=%u, cluster=%u\n", CRO_GET_DAQ_CLOCK_MCAST_COUNTER, CRO_GET_DAQ_CLOCK_MCAST_CLUSTER_IDENTIFIER); @@ -2258,9 +2258,9 @@ static void XcpPrintCmd(const tXcpCto* cmdBuf) { case CC_TL_GET_SERVER_ID: printf("GET_SERVER_ID %u:%u:%u:%u:%u\n", CRO_TL_GET_SERVER_ID_ADDR(0), CRO_TL_GET_SERVER_ID_ADDR(1), CRO_TL_GET_SERVER_ID_ADDR(2), CRO_TL_GET_SERVER_ID_ADDR(3), CRO_TL_GET_SERVER_ID_PORT ); break; -#endif // XCP_ENABLE_DAQ_CLOCK_MULTICAST default: printf("UNKNOWN TRANSPORT LAYER COMMAND %02X\n", CRO_TL_SUBCOMMAND); break; } // switch (CRO_TL_SUBCOMMAND) +#endif // XCP_ENABLE_DAQ_CLOCK_MULTICAST } // switch (CRO_CMD) } @@ -2397,9 +2397,10 @@ static void XcpPrintRes(const tXcpCto* crm) { break; #endif +#if defined(XCP_ENABLE_DAQ_CLOCK_MULTICAST) || defined(XCPTL_ENABLE_MULTICAST) case CC_TRANSPORT_LAYER_CMD: switch (gXcp.CmdLast1) { -#ifdef XCP_ENABLE_DAQ_CLOCK_MULTICAST + #ifdef XCP_ENABLE_DAQ_CLOCK_MULTICAST case CC_TL_GET_DAQ_CLOCK_MULTICAST: { if (isLegacyMode()) { @@ -2421,16 +2422,17 @@ static void XcpPrintRes(const tXcpCto* crm) { } break; -#endif // XCP_ENABLE_DAQ_CLOCK_MULTICAST + #endif // XCP_ENABLE_DAQ_CLOCK_MULTICAST -#ifdef XCPTL_ENABLE_MULTICAST + #ifdef XCPTL_ENABLE_MULTICAST case CC_TL_GET_SERVER_ID: printf("<- %u.%u.%u.%u:%u %s\n", CRM_TL_GET_SERVER_ID_ADDR(0), CRM_TL_GET_SERVER_ID_ADDR(1), CRM_TL_GET_SERVER_ID_ADDR(2), CRM_TL_GET_SERVER_ID_ADDR(3), CRM_TL_GET_SERVER_ID_PORT, &CRM_TL_GET_SERVER_ID_ID); break; -#endif + #endif } break; +#endif default: if (DBG_LEVEL >= 5) { diff --git a/src/xcpTl.c b/src/xcpTl.c index 7d02400..e1744ed 100644 --- a/src/xcpTl.c +++ b/src/xcpTl.c @@ -85,7 +85,7 @@ uint8_t XcpTlCommand( uint16_t msgLen, const uint8_t* msgBuf) { /* Connected */ if (connected) { if (p->dlc>XCPTL_MAX_CTO_SIZE) return CRC_CMD_SYNTAX; - return XcpCommand((const uint32_t*)&p->packet[0], p->dlc); // Handle command + return XcpCommand((const uint32_t*)&p->packet[0], (uint8_t)p->dlc); // Handle command } /* Not connected yet */ diff --git a/src/xcpTl.h b/src/xcpTl.h index a551a63..9b398ec 100644 --- a/src/xcpTl.h +++ b/src/xcpTl.h @@ -21,7 +21,7 @@ typedef struct { uint16_t dlc; // XCP TL header lenght uint16_t ctr; // XCP TL Header message counter - uint8_t data[]; + uint8_t data[1]; } tXcpDtoMessage; #pragma pack(pop)