add three PLC test demo and readme

This commit is contained in:
Wien.b
2023-11-23 23:23:08 -08:00
parent b82bdaea6b
commit d3c7d7ce9f
42 changed files with 522 additions and 158 deletions

View File

@@ -14,3 +14,11 @@ if CONTROL_PROTOCOL_MODBUS_UART
source "$APP_DIR/Framework/control/ipc_protocol/modbus_uart/Kconfig"
endif
config CONTROL_PROTOCOL_ETHERCAT
bool "Using ethercat control protocol"
default n
select CONTROL_USING_SOCKET
if CONTROL_PROTOCOL_ETHERCAT
source "$APP_DIR/Framework/control/ipc_protocol/ethercat/Kconfig"
endif

View File

@@ -6,5 +6,9 @@ ifeq ($(CONFIG_CONTROL_PROTOCOL_MODBUS_UART), y)
SRC_DIR := modbus_uart
endif
ifeq ($(CONFIG_CONTROL_PROTOCOL_ETHERCAT), y)
SRC_DIR := ethercat
endif
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -33,5 +33,6 @@ config CONTROL_PROTOCOL_CIP
default n
select CONTROL_USING_SOCKET
if CONTROL_PROTOCOL_CIP
source "$APP_DIR/Framework/control/plc_protocol/cip/Kconfig"
source "$APP_DIR/Framework/control/plc_protocol/ethernet_ip_cip/Kconfig"
endif

View File

@@ -15,7 +15,7 @@ ifeq ($(CONFIG_CONTROL_PROTOCOL_S7), y)
endif
ifeq ($(CONFIG_CONTROL_PROTOCOL_CIP), y)
SRC_DIR := cip
SRC_DIR := ethernet_ip_cip
endif
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -1,2 +1,3 @@
SRC_FILES := $(wildcard ./*.c)
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -57,6 +57,7 @@ typedef enum
PROTOCOL_MELSEC_3C,
PROTOCOL_FREEMODBUS_TCP_SERVER,
PROTOCOL_CIP,
PROTOCOL_ETHERCAT,
PROTOCOL_END
}ProtocolType;
@@ -116,6 +117,7 @@ int ControlProtocolIoctl(struct ControlProtocol *control_protocol, int cmd, void
/*Control Framework new certain Protocol*/
ControlProtocolType control_protocol;
#ifdef __cplusplus
}
#endif

View File

@@ -57,6 +57,10 @@ extern int FreeModbusTcpServerInit(struct ControlRecipe *p_recipe);
extern int CipProtocolInit(struct ControlRecipe *p_recipe);
#endif
#ifdef CONTROL_PROTOCOL_ETHERCAT
extern int EthercatProtocolInit(struct ControlRecipe *p_recipe);
#endif
/*
CONTROL FRAMEWORK READ DATA FORMAT:
| HEAD |device_id|read data length|read item count| data |
@@ -103,6 +107,11 @@ static struct ControlProtocolInitParam protocol_init[] =
#ifdef CONTROL_PROTOCOL_CIP
{ PROTOCOL_CIP, CipProtocolInit },
#endif
#ifdef CONTROL_PROTOCOL_ETHERCAT
{ PROTOCOL_ETHERCAT, EthercatProtocolInit },
#endif
{ PROTOCOL_END, NULL },
};