From ffe83b869ae803d8090fd14e4016bed3d02008cb Mon Sep 17 00:00:00 2001 From: "Wien.b" <18058767332@163.com> Date: Wed, 29 Nov 2023 00:54:15 -0800 Subject: [PATCH] move modbus slave test app to app_Framework --- .../Applications/connection_app/Makefile | 4 ++ .../freemodbus_tcp_slave/Makefile | 3 ++ .../freemodbus_tcp_slave/slave_sample.c} | 43 +------------------ Ubiquitous/XiZi_IIoT/path_app.mk | 2 + Ubiquitous/XiZi_IIoT/path_kernel.mk | 4 ++ 5 files changed, 15 insertions(+), 41 deletions(-) create mode 100644 APP_Framework/Applications/connection_app/freemodbus_tcp_slave/Makefile rename APP_Framework/{Framework/connection/industrial_network/freemodbus_tcp/tcpserver_sample.c => Applications/connection_app/freemodbus_tcp_slave/slave_sample.c} (88%) diff --git a/APP_Framework/Applications/connection_app/Makefile b/APP_Framework/Applications/connection_app/Makefile index 8aa357308..11c22f202 100755 --- a/APP_Framework/Applications/connection_app/Makefile +++ b/APP_Framework/Applications/connection_app/Makefile @@ -15,6 +15,10 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y) SRC_DIR += socket_demo endif + ifeq ($(CONFIG_CONNECTION_ADAPTER_FREEMODBUSTCP),y) + SRC_DIR += freemodbus_tcp_slave + endif + include $(KERNEL_ROOT)/compiler.mk endif diff --git a/APP_Framework/Applications/connection_app/freemodbus_tcp_slave/Makefile b/APP_Framework/Applications/connection_app/freemodbus_tcp_slave/Makefile new file mode 100644 index 000000000..849075937 --- /dev/null +++ b/APP_Framework/Applications/connection_app/freemodbus_tcp_slave/Makefile @@ -0,0 +1,3 @@ +SRC_FILES := tcpserver_sample.c + +include $(KERNEL_ROOT)/compiler.mk diff --git a/APP_Framework/Framework/connection/industrial_network/freemodbus_tcp/tcpserver_sample.c b/APP_Framework/Applications/connection_app/freemodbus_tcp_slave/slave_sample.c similarity index 88% rename from APP_Framework/Framework/connection/industrial_network/freemodbus_tcp/tcpserver_sample.c rename to APP_Framework/Applications/connection_app/freemodbus_tcp_slave/slave_sample.c index ed5d12369..47e122e99 100644 --- a/APP_Framework/Framework/connection/industrial_network/freemodbus_tcp/tcpserver_sample.c +++ b/APP_Framework/Applications/connection_app/freemodbus_tcp_slave/slave_sample.c @@ -70,7 +70,7 @@ static void* pvPollingThread( void *pvParameter ); int LWIPConnectSocket(uint16_t port); /* ----------------------- Start implementation -----------------------------*/ -int MBServer() +int MBSlave() { int iExitCode; CHAR cCh; @@ -115,7 +115,7 @@ int MBServer() return iExitCode; } -PRIV_SHELL_CMD_FUNCTION(MBServer, a Mtcp server Demo, PRIV_SHELL_CMD_MAIN_ATTR); +PRIV_SHELL_CMD_FUNCTION(MBSlave, a Mtcp server Demo, PRIV_SHELL_CMD_MAIN_ATTR); BOOL bCreatePollingThread( void ) @@ -257,42 +257,3 @@ eMBErrorCode eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT us { return MB_ENOREG; } - - - - -/** - * @description: Modbus Tcp Server Open - * @param control_protocol - control protocol pointer - * @return success : 0 error - */ -// int FreeModbusTcpOpen(struct ControlProtocol *control_protocol) -// { -// ControlProtocolOpenDef(control_protocol); -// return 0; -// } - -// static struct ControlDone FreeModbusTcp_protocol_done = -// { -// ._open = FreeModbusTcpOpen, -// ._close = NULL, -// ._read = NULL, -// ._write = NULL, -// ._ioctl = NULL, -// }; - -// void *ReceivePlcDataTask(void *parameter) -// { -// MBServer(); -// } - -/** - * @description: Modbus Tcp Server Init - * @param p_recipe - recipe pointer - * @return success : 0 error : -1 - */ -// int FreeModbusTcpServerInit(struct ControlRecipe *p_recipe) -// { -// p_recipe->done = &FreeModbusTcp_protocol_done; -// return 0; -// } \ No newline at end of file diff --git a/Ubiquitous/XiZi_IIoT/path_app.mk b/Ubiquitous/XiZi_IIoT/path_app.mk index a027e759a..09104f6e7 100644 --- a/Ubiquitous/XiZi_IIoT/path_app.mk +++ b/Ubiquitous/XiZi_IIoT/path_app.mk @@ -20,6 +20,7 @@ endif ifeq ($(CONFIG_SUPPORT_CONNECTION_FRAMEWORK), y) APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection # +APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection/industrial_network/freemodbus_tcp # endif ifeq ($(CONFIG_SUPPORT_KNOWING_FRAMEWORK), y) @@ -35,6 +36,7 @@ APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control # APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/plc/interoperability/opcua # endif + ifeq ($(CONFIG_CRYPTO), y) APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/security/crypto/include # endif diff --git a/Ubiquitous/XiZi_IIoT/path_kernel.mk b/Ubiquitous/XiZi_IIoT/path_kernel.mk index a793e8f0d..dd379581d 100755 --- a/Ubiquitous/XiZi_IIoT/path_kernel.mk +++ b/Ubiquitous/XiZi_IIoT/path_kernel.mk @@ -488,6 +488,7 @@ endif ifeq ($(CONFIG_SUPPORT_CONNECTION_FRAMEWORK), y) KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection/zigbee # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection/industrial_network/freemodbus_tcp # endif ifeq ($(CONFIG_ADAPTER_HFA21_ETHERCAT), y) @@ -529,6 +530,9 @@ KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protoc KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protocol/include # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protocol/modbus_tcp # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protocol/modbus_uart # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protocol/ethercat # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protocol/ethercat/comm # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/ipc_protocol/ethercat/soem # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/plc_protocol # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/plc_protocol/include # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/control/plc_protocol/fins #