From 6345a5433d5b2f6b8bc39d0e4eb1379cf52ec70b Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Thu, 4 Oct 2018 05:46:21 +0000 Subject: [PATCH] Refs #459. Added easy integration support for the master/slave gateway add-on module. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@627 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- Target/Source/boot.c | 8 ++++++++ Target/Source/boot.h | 3 +++ Target/Source/com.c | 19 ++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Target/Source/boot.c b/Target/Source/boot.c index 34df3bcb..77f85daa 100644 --- a/Target/Source/boot.c +++ b/Target/Source/boot.c @@ -54,6 +54,10 @@ void BootInit(void) #if (BOOT_COM_ENABLE > 0) /* initialize the communication module */ ComInit(); +#endif +#if (ADDON_GATEWAY_MOD_ENABLE > 0) + /* initialize the gateway module */ + GatewayInit(); #endif /* initialize the backdoor entry */ BackDoorInit(); @@ -78,6 +82,10 @@ void BootTask(void) #if (BOOT_COM_ENABLE > 0) /* process possibly pending communication data */ ComTask(); +#endif +#if (ADDON_GATEWAY_MOD_ENABLE > 0) + /* run the gateway */ + GatewayTask(); #endif /* control the backdoor */ BackDoorCheck(); diff --git a/Target/Source/boot.h b/Target/Source/boot.h index cd84f831..babaa492 100644 --- a/Target/Source/boot.h +++ b/Target/Source/boot.h @@ -63,6 +63,9 @@ #include "backdoor.h" /* backdoor entry module */ #include "file.h" /* file system module */ #include "com.h" /* communication interface */ +#if (ADDON_GATEWAY_MOD_ENABLE > 0) +#include "gateway.h" /* gateway add-on module */ +#endif /**************************************************************************************** diff --git a/Target/Source/com.c b/Target/Source/com.c index b5dc5ed7..84f89008 100644 --- a/Target/Source/com.c +++ b/Target/Source/com.c @@ -286,7 +286,24 @@ blt_int16u ComGetActiveInterfaceMaxTxLen(void) ****************************************************************************************/ blt_bool ComIsConnected(void) { - return XcpIsConnected(); + blt_bool result = BLT_FALSE; + + /* Is there an active XCP connection? This indicates that the communication interface + * is in the connection state. + */ + if (XcpIsConnected()) + { + result = BLT_TRUE; + } +#if (ADDON_GATEWAY_MOD_ENABLE > 0) + /* Is the gateway active? This indicates an XCP connection with a slave. */ + if (GatewayIsActive()) + { + result = BLT_TRUE; + } +#endif + /* give the result back to the caller. */ + return result; } /*** end of ComIsConnected ***/