forked from xuos/xiuos
				
			modify XiUOS DIR : (1.add plc_demo in APP_Framework/control_app; 2.add industrial_network、industrial_fieldbus and industrial_wlan; 3.add XiZi_AIoT and modify XiZi as XiZi_IIoT.)
This commit is contained in:
		
							parent
							
								
									dbca22a1a6
								
							
						
					
					
						commit
						e14fa6ff8e
					
				| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
SRC_DIR :=
 | 
			
		||||
SRC_DIR := plc_demo
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_RESOURCES_LWIP),y)
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_USING_CONTROL_PLC_OPCUA), y)
 | 
			
		||||
	SRC_DIR += opcua_demo plc_demo
 | 
			
		||||
	SRC_DIR += opcua_demo 
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,3 @@
 | 
			
		|||
SRC_FILES := plc_show_demo.c plc_control_demo.c
 | 
			
		||||
SRC_DIR := advantech beckhoff br delta mitsubishi omron schneider siemens
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,48 +0,0 @@
 | 
			
		|||
# PLC DEMO README
 | 
			
		||||
 | 
			
		||||
## 文件说明
 | 
			
		||||
 | 
			
		||||
用于PLC设备相关测试命令演示,目前支持OPCUA协议对PLC进行远程控制,该命令基于LWIP和OPCUA,需要开启相关开关。
 | 
			
		||||
 | 
			
		||||
多个PLC设备可以组成一个channel,用于一条相关业务线控制。
 | 
			
		||||
 | 
			
		||||
### 命令行
 | 
			
		||||
 | 
			
		||||
ShowChannel
 | 
			
		||||
 | 
			
		||||
显示注册到channel上的PLC设备,范例如下:
 | 
			
		||||
 | 
			
		||||
 ch_type        ch_name        drv_name       dev_name       cnt                 
 | 
			
		||||
-----------------------------------------------------------------
 | 
			
		||||
 PLC_Channel    PLC            OPCUA          PLC Demo 4      1   
 | 
			
		||||
                                              PLC Demo 3      2   
 | 
			
		||||
                                              PLC Demo 2      3   
 | 
			
		||||
                                              PLC Demo 1      4   
 | 
			
		||||
                                              PLC Demo 0      5  
 | 
			
		||||
 | 
			
		||||
ShowPLC
 | 
			
		||||
 | 
			
		||||
用于显示PLC,范例如下:
 | 
			
		||||
 | 
			
		||||
 device         vendor         model          product        id                  
 | 
			
		||||
-----------------------------------------------------------------
 | 
			
		||||
 PLC Demo 4     B&R            X20            X20 CP1381     5                   
 | 
			
		||||
 PLC Demo 3     B&R            X20            X20 CP1586     4                   
 | 
			
		||||
 PLC Demo 2     SIEMSNS        S7-200         CPU SR60       3                   
 | 
			
		||||
 PLC Demo 1     SIEMENS        S7-1200        CPU 1215C      2                   
 | 
			
		||||
 PLC Demo 0     SIEMENS        S7-1500        CPU 1512SP-1PN 1      
 | 
			
		||||
 
 | 
			
		||||
 PlcRead [NodeID] 
 | 
			
		||||
 
 | 
			
		||||
 用于读取PLC节点信息
 | 
			
		||||
 | 
			
		||||
 - [NodeID]: 如n4,1, 其中4代表namespace,1代表节点号
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
 PlcWrite
 | 
			
		||||
 
 | 
			
		||||
 用于写入PLC节点数值
 | 
			
		||||
 
 | 
			
		||||
 - [NodeID]: 如n4,1, 其中4代表namespace,1代表节点号
 | 
			
		||||
 | 
			
		||||
 - [value]: 为写入数值,目前支持bool类型,和int类型。bool型应为0b(代表false), 1b(代表true)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := advantech_ark_2250.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file beckhoff_c6920.c
 | 
			
		||||
 * @brief PLC BECKHOFF C6920 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := beckhoff_c6920.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file advantech_ark_2250.c
 | 
			
		||||
 * @brief PLC ADVANTECH ARK-2250 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := br_x20cp0410.c br_x20cp1381.c br_x20cp1586.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file br_x20cp0410.c
 | 
			
		||||
 * @brief PLC B&R X20CP0410 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file br_x20cp1381.c
 | 
			
		||||
 * @brief PLC B&R X20CP1381 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file br_x20cp1586.c
 | 
			
		||||
 * @brief PLC B&R X20CP1586 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := delta_as228t.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file delta_as228t.c
 | 
			
		||||
 * @brief PLC DELTA AS228T app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file delta_as332t.c
 | 
			
		||||
 * @brief PLC DELTA AS332T app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := mitsubishi_fx3u.c mitsubishi_fx5u.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file mitsubishi_fx3u.c
 | 
			
		||||
 * @brief PLC MITSUBISHI FX3U app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file mitsubishi_fx5u.c
 | 
			
		||||
 * @brief PLC MITSUBISHI FX5U app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := omron_cj2m.c omron_nj501.c omron_nx102.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file omron_cj2m.c
 | 
			
		||||
 * @brief PLC OMRON CJ2M app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file omron_nj501.c
 | 
			
		||||
 * @brief PLC OMRON NJ501 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file omron_nx102.c
 | 
			
		||||
 * @brief PLC OMRON NX102 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,321 +0,0 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file plc_control_demo.c
 | 
			
		||||
 * @brief Demo for PLC control
 | 
			
		||||
 * @version 1.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.2.22
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <transform.h>
 | 
			
		||||
#include <open62541.h>
 | 
			
		||||
#include <ua_api.h>
 | 
			
		||||
#include <sys_arch.h>
 | 
			
		||||
#include "plc_demo.h"
 | 
			
		||||
 | 
			
		||||
#define PLC_NS_FORMAT "n%d,%s"
 | 
			
		||||
 | 
			
		||||
struct PlcChannel plc_demo_ch;
 | 
			
		||||
struct PlcDriver plc_demo_drv;
 | 
			
		||||
struct PlcDevice plc_demo_dev;
 | 
			
		||||
 | 
			
		||||
int plc_test_flag = 0;
 | 
			
		||||
 | 
			
		||||
PlcCtrlParamType plc_ctrl_param;
 | 
			
		||||
 | 
			
		||||
UA_NodeId test_nodeid = {4, UA_NODEIDTYPE_NUMERIC, 5};
 | 
			
		||||
 | 
			
		||||
/******************************************************************************/
 | 
			
		||||
 | 
			
		||||
void PlcDelay(int sec)
 | 
			
		||||
{
 | 
			
		||||
    volatile uint32_t i = 0;
 | 
			
		||||
    for (i = 0; i < 100000000 * sec; ++i) {
 | 
			
		||||
        __asm("NOP"); /* delay */
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// get NodeId from str
 | 
			
		||||
void PlcGetTestNodeId(char *str, UA_NodeId *id)
 | 
			
		||||
{
 | 
			
		||||
    static char node_str[UA_NODE_LEN];
 | 
			
		||||
    memset(node_str, 0, sizeof(node_str));
 | 
			
		||||
 | 
			
		||||
    plc_print("plc: arg %s\n", str);
 | 
			
		||||
 | 
			
		||||
    if(sscanf(str, PLC_NS_FORMAT, &id->namespaceIndex, node_str) != EOF) {
 | 
			
		||||
        if(isdigit(node_str[0])) {
 | 
			
		||||
            id->identifierType = UA_NODEIDTYPE_NUMERIC;
 | 
			
		||||
            id->identifier.numeric = atoi(node_str);
 | 
			
		||||
            plc_print("ns %d num %d\n", id->namespaceIndex, id->identifier.numeric);
 | 
			
		||||
        } else {
 | 
			
		||||
            id->identifierType = UA_NODEIDTYPE_STRING;
 | 
			
		||||
            id->identifier.string.length = strlen(node_str);
 | 
			
		||||
            id->identifier.string.data = node_str;
 | 
			
		||||
            plc_print("ns %d str %s\n", id->namespaceIndex, id->identifier.string.data);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlcDemoChannelDrvInit(void)
 | 
			
		||||
{
 | 
			
		||||
    static uint8_t init_flag = 0;
 | 
			
		||||
    if(init_flag)
 | 
			
		||||
        return;
 | 
			
		||||
    init_flag = 1;
 | 
			
		||||
 | 
			
		||||
    lwip_config_tcp(lwip_ipaddr, lwip_netmask, test_ua_ip);
 | 
			
		||||
    PlcChannelInit(&plc_demo_ch, PLC_CH_NAME);
 | 
			
		||||
    if(PlcDriverInit(&plc_demo_drv, PLC_DRV_NAME) == 0) {
 | 
			
		||||
        PlcDriverAttachToChannel(PLC_DRV_NAME, PLC_CH_NAME);
 | 
			
		||||
    }
 | 
			
		||||
    memset(&plc_demo_dev, 0, sizeof(plc_demo_dev));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void PlcGetDemoDev(PlcDeviceType *dev, UA_NodeId *id)
 | 
			
		||||
{
 | 
			
		||||
    // register plc device
 | 
			
		||||
    dev->state = CHDEV_INIT;
 | 
			
		||||
    strcpy(dev->name, "UA Demo");
 | 
			
		||||
    dev->info.product = "CPU 1215C";
 | 
			
		||||
    dev->info.vendor = "SIEMENS";
 | 
			
		||||
    dev->info.model = "S7-1200";
 | 
			
		||||
    dev->info.id = 123;
 | 
			
		||||
    dev->net = PLC_IND_ENET_OPCUA;
 | 
			
		||||
 | 
			
		||||
    // register UA parameter
 | 
			
		||||
    if(!dev->priv_data) {
 | 
			
		||||
        dev->priv_data = (UaParamType*)malloc(sizeof(UaParamType));
 | 
			
		||||
    }
 | 
			
		||||
    UaParamType* ua_ptr = dev->priv_data;
 | 
			
		||||
    memset(ua_ptr, 0, sizeof(UaParamType));
 | 
			
		||||
    strcpy(ua_ptr->ua_remote_ip, opc_server_url);
 | 
			
		||||
    ua_ptr->act = UA_ACT_ATTR;
 | 
			
		||||
    memcpy(&ua_ptr->ua_id, id, sizeof(*id));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void PlcCtrlDemoInit(void)
 | 
			
		||||
{
 | 
			
		||||
    static uint8_t init_flag = 0;
 | 
			
		||||
 | 
			
		||||
    PlcDemoChannelDrvInit();
 | 
			
		||||
 | 
			
		||||
    // register plc device
 | 
			
		||||
    PlcGetDemoDev(&plc_demo_dev, &test_nodeid);
 | 
			
		||||
 | 
			
		||||
    if(init_flag){
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    init_flag = 1;
 | 
			
		||||
 | 
			
		||||
    if(PlcDevRegister(&plc_demo_dev, NULL, plc_demo_dev.name) != 0) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    PlcDeviceAttachToChannel(plc_demo_dev.name, PLC_CH_NAME);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlcReadUATask(void* arg)
 | 
			
		||||
{
 | 
			
		||||
    int ret = 0;
 | 
			
		||||
    struct PlcOps* ops = NULL;
 | 
			
		||||
    char buf[PLC_BUF_SIZE];
 | 
			
		||||
    memset(buf, 0, sizeof(buf));
 | 
			
		||||
    PlcCtrlDemoInit();
 | 
			
		||||
    ops = plc_demo_dev.ops;
 | 
			
		||||
    ret = ops->open(&plc_demo_dev);
 | 
			
		||||
 | 
			
		||||
    if(0 != ret) {
 | 
			
		||||
        plc_print("plc: [%s] open failed %#x\n", __func__, ret);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = ops->read(&plc_demo_dev, buf, PLC_BUF_SIZE);
 | 
			
		||||
 | 
			
		||||
    if(0 != ret) {
 | 
			
		||||
        plc_print("plc: [%s] read failed %x\n", __func__, ret);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ops->close(&plc_demo_dev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlcReadTestShell(int argc, char* argv[])
 | 
			
		||||
{
 | 
			
		||||
    static char node_str[UA_NODE_LEN];
 | 
			
		||||
    memset(node_str, 0, sizeof(node_str));
 | 
			
		||||
 | 
			
		||||
    if(argc > 1) {
 | 
			
		||||
        PlcGetTestNodeId(argv[1], &test_nodeid);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sys_thread_new("plc read", PlcReadUATask, NULL, PLC_STACK_SIZE, PLC_TASK_PRIO);
 | 
			
		||||
}
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(PlcReadTestShell, a plc read sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
 | 
			
		||||
void PlcWriteUATask(void* arg)
 | 
			
		||||
{
 | 
			
		||||
    int ret = 0;
 | 
			
		||||
    struct PlcOps* ops = NULL;
 | 
			
		||||
    char buf[PLC_BUF_SIZE];
 | 
			
		||||
    memset(buf, 0, sizeof(buf));
 | 
			
		||||
 | 
			
		||||
    PlcCtrlDemoInit();
 | 
			
		||||
    ops = plc_demo_dev.ops;
 | 
			
		||||
    ret = ops->open(&plc_demo_dev);
 | 
			
		||||
 | 
			
		||||
    if(0 != ret) {
 | 
			
		||||
        plc_print("plc: [%s] open failed %#x\n", __func__, ret);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = ops->write(&plc_demo_dev, arg, PLC_BUF_SIZE);
 | 
			
		||||
 | 
			
		||||
    if(0 != ret) {
 | 
			
		||||
        plc_print("plc: [%s] write failed\n", __func__);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ops->close(&plc_demo_dev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlcWriteTestShell(int argc, char* argv[])
 | 
			
		||||
{
 | 
			
		||||
    static char node_str[UA_NODE_LEN];
 | 
			
		||||
    static char val_param[UA_NODE_LEN];
 | 
			
		||||
    memset(node_str, 0, sizeof(node_str));
 | 
			
		||||
    memset(val_param, 0, sizeof(val_param));
 | 
			
		||||
 | 
			
		||||
    if(argc > 1) {
 | 
			
		||||
        PlcGetTestNodeId(argv[1], &test_nodeid);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(argc > 2) {
 | 
			
		||||
        strcpy(val_param, argv[2]);
 | 
			
		||||
        plc_print("write value %s\n", val_param);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sys_thread_new("plc write", PlcWriteUATask, val_param, PLC_STACK_SIZE, PLC_TASK_PRIO);
 | 
			
		||||
}
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(PlcWriteTestShell, a plc write sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
 | 
			
		||||
// test motor
 | 
			
		||||
// clear parameter
 | 
			
		||||
// PlcWrite n4,2 0b
 | 
			
		||||
// PlcWrite n4,3 0b
 | 
			
		||||
// PlcWrite n4,4 0b
 | 
			
		||||
// PlcWrite n4,5 0b
 | 
			
		||||
//
 | 
			
		||||
// enable
 | 
			
		||||
// PlcWrite n4,2 1b
 | 
			
		||||
//
 | 
			
		||||
// set rotate speed
 | 
			
		||||
// PlcWrite n4,3 50
 | 
			
		||||
//
 | 
			
		||||
// positive turn
 | 
			
		||||
// PlcWrite n4,4 1b
 | 
			
		||||
//
 | 
			
		||||
// reversal turn
 | 
			
		||||
// PlcWrite n4,5 1b
 | 
			
		||||
 | 
			
		||||
static int plc_test_speed = 50;
 | 
			
		||||
static int plc_test_dir = 1; // direction positive: 1 reversal: 0
 | 
			
		||||
 | 
			
		||||
void PlcMotorTestTask(void* arg)
 | 
			
		||||
{
 | 
			
		||||
    //support node id
 | 
			
		||||
    char *test_nodeid[] = {"n4,2", "n4,3", "n4,4", "n4,5", "n4,7"};
 | 
			
		||||
    // enable -> speed -> positive dir or inversal dir -> stop -> enable
 | 
			
		||||
    char test_sort[] = {0, 4, 2, 1, 0};
 | 
			
		||||
    char test_cmd[][4] = {"1b", "50", "1b", "1b", "0b"};
 | 
			
		||||
    char *test_notice[] = {"Enable Motor", "Set Speed", "Set Forward", "Set Reverse", "Stop Motor"};
 | 
			
		||||
 | 
			
		||||
    int ret = 0;
 | 
			
		||||
    struct PlcOps* ops = NULL;
 | 
			
		||||
    char buf[PLC_BUF_SIZE];
 | 
			
		||||
    memset(buf, 0, sizeof(buf));
 | 
			
		||||
 | 
			
		||||
    PlcCtrlDemoInit();
 | 
			
		||||
    ops = plc_demo_dev.ops;
 | 
			
		||||
    ret = ops->open(&plc_demo_dev);
 | 
			
		||||
 | 
			
		||||
    if(0 != ret) {
 | 
			
		||||
        plc_print("plc: [%s] open failed %#x\n", __func__, ret);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    UaParamType* ua_ptr = plc_demo_dev.priv_data;
 | 
			
		||||
 | 
			
		||||
    // initialize step
 | 
			
		||||
    for(int i = 0; i < 5; i++) {
 | 
			
		||||
        plc_print("###\n### Clear %s\n###\n", test_notice[i]);
 | 
			
		||||
        PlcGetTestNodeId(test_nodeid[i], &ua_ptr->ua_id);
 | 
			
		||||
        ret = ops->write(&plc_demo_dev, "0b", PLC_BUF_SIZE);
 | 
			
		||||
        if(0 != ret) {
 | 
			
		||||
            plc_print("plc: [%s] %d write failed\n", __func__, __LINE__);
 | 
			
		||||
        }
 | 
			
		||||
        PlcDelay(1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(plc_test_speed != 50) {
 | 
			
		||||
        snprintf(test_cmd[1], 4, "%d", plc_test_speed);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(plc_test_dir == 0) // if not postive, next running
 | 
			
		||||
        test_sort[2] = 3;
 | 
			
		||||
 | 
			
		||||
    for(int i = 0; i < sizeof(test_sort)/sizeof(test_sort[0]); i++) {
 | 
			
		||||
        PlcGetTestNodeId(test_nodeid[test_sort[i]], &ua_ptr->ua_id);
 | 
			
		||||
        plc_print("###\n### %s\n###\n", test_notice[i]);
 | 
			
		||||
        ret = ops->write(&plc_demo_dev, test_cmd[i], PLC_BUF_SIZE);
 | 
			
		||||
        if(0 != ret) {
 | 
			
		||||
            plc_print("plc: [%s] %d write failed\n", __func__, __LINE__);
 | 
			
		||||
        }
 | 
			
		||||
        PlcDelay(1);
 | 
			
		||||
        if(i == 2) {// postive 
 | 
			
		||||
            PlcDelay(10);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    ops->close(&plc_demo_dev);
 | 
			
		||||
    plc_test_flag = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// get parameter from
 | 
			
		||||
void PlcGetMotorParam(char *str)
 | 
			
		||||
{
 | 
			
		||||
    static char node_str[UA_NODE_LEN];
 | 
			
		||||
    memset(node_str, 0, sizeof(node_str));
 | 
			
		||||
 | 
			
		||||
    plc_print("plc: arg %s\n", str);
 | 
			
		||||
 | 
			
		||||
    sscanf(str, "speed=%d", &plc_test_speed);
 | 
			
		||||
    sscanf(str, "dir=%d", &plc_test_dir);
 | 
			
		||||
    plc_print("speed is %d\n", plc_test_speed);
 | 
			
		||||
    plc_print("dir is %d\n", plc_test_dir);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlcMotorTestShell(int argc, char* argv[])
 | 
			
		||||
{
 | 
			
		||||
    if(plc_test_flag) {
 | 
			
		||||
        plc_print("PLC Motor testing!\n");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    plc_test_flag = 1;
 | 
			
		||||
 | 
			
		||||
    if(argc > 1) {
 | 
			
		||||
        for(int i = 0; i < argc; i++) {
 | 
			
		||||
            PlcGetMotorParam(argv[i]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    sys_thread_new("plc motor", PlcMotorTestTask, NULL, PLC_STACK_SIZE, PLC_TASK_PRIO);
 | 
			
		||||
}
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(PlcMotorTestShell, a plc motor sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
| 
						 | 
				
			
			@ -1,222 +0,0 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file plc_show_demo.c
 | 
			
		||||
 * @brief Demo for PLC information show
 | 
			
		||||
 * @version 1.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.02.24
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <transform.h>
 | 
			
		||||
#include <list.h>
 | 
			
		||||
 | 
			
		||||
#include <open62541.h>
 | 
			
		||||
#include <ua_api.h>
 | 
			
		||||
#include <sys_arch.h>
 | 
			
		||||
#include <plc_demo.h>
 | 
			
		||||
 | 
			
		||||
#define PLC_DEMO_NUM 5
 | 
			
		||||
 | 
			
		||||
struct PlcDevice plc_demo_array[PLC_DEMO_NUM];
 | 
			
		||||
 | 
			
		||||
typedef struct PlcShowParam
 | 
			
		||||
{
 | 
			
		||||
    int id;
 | 
			
		||||
    char* vector;
 | 
			
		||||
    char* model;
 | 
			
		||||
    char* product;
 | 
			
		||||
} PlcShowParamType;
 | 
			
		||||
 | 
			
		||||
PlcShowParamType plc_demo_param[PLC_NAME_SIZE] =
 | 
			
		||||
{
 | 
			
		||||
    {1, "SIEMENS", "S7-1500", "CPU 1512SP-1PN"},
 | 
			
		||||
    {2, "SIEMENS", "S7-1200", "CPU 1215C"},
 | 
			
		||||
    {3, "SIEMSNS", "S7-200", "CPU SR60"},
 | 
			
		||||
    {4, "B&R", "X20", "X20 CP1586"},
 | 
			
		||||
    {5, "B&R", "X20", "X20 CP1381"}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static char* const channel_type_str[] =
 | 
			
		||||
{
 | 
			
		||||
    "PLC_Channel",
 | 
			
		||||
    "Unknown"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern DoublelistType plcdev_list;
 | 
			
		||||
extern DoublelistType ch_linklist;
 | 
			
		||||
 | 
			
		||||
/**********************************************************************************************************************/
 | 
			
		||||
 | 
			
		||||
void PlcShowTitle(const char* item_array[])
 | 
			
		||||
{
 | 
			
		||||
    int i = 0, max_len = 65;
 | 
			
		||||
    printf(" %-15s%-15s%-15s%-15s%-20s\n", item_array[0], item_array[1], item_array[2], item_array[3], item_array[4]);
 | 
			
		||||
 | 
			
		||||
    while(i < max_len) {
 | 
			
		||||
        i++;
 | 
			
		||||
 | 
			
		||||
        if(max_len == i) {
 | 
			
		||||
            printf("-\n");
 | 
			
		||||
        } else {
 | 
			
		||||
            printf("-");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ChDrvType ShowChannelFindDriver(struct Channel* ch)
 | 
			
		||||
{
 | 
			
		||||
    struct ChDrv* driver = NULL;
 | 
			
		||||
    DoublelistType* node = NULL;
 | 
			
		||||
    DoublelistType* head = &ch->ch_drvlink;
 | 
			
		||||
 | 
			
		||||
    for(node = head->node_next; node != head; node = node->node_next) {
 | 
			
		||||
        driver = DOUBLE_LIST_ENTRY(node, struct ChDrv, driver_link);
 | 
			
		||||
        return driver;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void PlcShowDemoInit(void)
 | 
			
		||||
{
 | 
			
		||||
    static uint8_t init_flag = 0;
 | 
			
		||||
    int i;
 | 
			
		||||
    PlcDemoChannelDrvInit();
 | 
			
		||||
 | 
			
		||||
    for(i = 0; i < PLC_DEMO_NUM; i++) {
 | 
			
		||||
        // register plc device
 | 
			
		||||
        plc_demo_array[i].state = CHDEV_INIT;
 | 
			
		||||
        snprintf(plc_demo_array[i].name, PLC_NAME_SIZE, "PLC Demo %d", i);
 | 
			
		||||
        plc_demo_array[i].info.vendor = plc_demo_param[i].vector;
 | 
			
		||||
        plc_demo_array[i].info.model = plc_demo_param[i].model;
 | 
			
		||||
        plc_demo_array[i].info.id = plc_demo_param[i].id;
 | 
			
		||||
        plc_demo_array[i].info.product = plc_demo_param[i].product;
 | 
			
		||||
        plc_demo_array[i].net = PLC_IND_ENET_OPCUA;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(init_flag)
 | 
			
		||||
        return;
 | 
			
		||||
    init_flag = 1;
 | 
			
		||||
 | 
			
		||||
    for(i = 0; i < PLC_DEMO_NUM; i++) {
 | 
			
		||||
        if(PlcDevRegister(&plc_demo_array[i], NULL, plc_demo_array[i].name) == 0) {
 | 
			
		||||
            PlcDeviceAttachToChannel(plc_demo_array[i].name, PLC_CH_NAME);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlcShowChannel(void)
 | 
			
		||||
{
 | 
			
		||||
    ChannelType ch;
 | 
			
		||||
    ChDrvType driver;
 | 
			
		||||
    ChDevType device;
 | 
			
		||||
    int dev_cnt;
 | 
			
		||||
    DoublelistType* ch_node = NULL;
 | 
			
		||||
    DoublelistType* ch_head = &ch_linklist;
 | 
			
		||||
    const char* item_array[] = {"ch_type", "ch_name", "drv_name", "dev_name", "cnt"};
 | 
			
		||||
    PlcShowDemoInit();
 | 
			
		||||
    PlcShowTitle(item_array);
 | 
			
		||||
    ch_node = ch_head->node_next;
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        ch = DOUBLE_LIST_ENTRY(ch_node, struct Channel, ch_link);
 | 
			
		||||
 | 
			
		||||
        if((ch) && (ch->ch_type == CH_PLC_TYPE)) {
 | 
			
		||||
            printf("%s", " ");
 | 
			
		||||
            printf("%-15s%-15s",
 | 
			
		||||
                    channel_type_str[ch->ch_type],
 | 
			
		||||
                    ch->ch_name);
 | 
			
		||||
 | 
			
		||||
            driver = ShowChannelFindDriver(ch);
 | 
			
		||||
 | 
			
		||||
            if(driver) {
 | 
			
		||||
                printf("%-15s", driver->drv_name);
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("%-15s", "nil");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if(ch->haldev_cnt) {
 | 
			
		||||
                DoublelistType* dev_node = NULL;
 | 
			
		||||
                DoublelistType* dev_head = &ch->ch_devlink;
 | 
			
		||||
                dev_node = dev_head->node_next;
 | 
			
		||||
                dev_cnt = 1;
 | 
			
		||||
 | 
			
		||||
                while(dev_node != dev_head) {
 | 
			
		||||
                    device = DOUBLE_LIST_ENTRY(dev_node, struct ChDev, dev_link);
 | 
			
		||||
 | 
			
		||||
                    if(1 == dev_cnt) {
 | 
			
		||||
                        if(device) {
 | 
			
		||||
                            printf("%-16s%-4d\n", device->dev_name, dev_cnt);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            printf("%-16s%-4d\n", "nil", dev_cnt);
 | 
			
		||||
                        }
 | 
			
		||||
                    } else {
 | 
			
		||||
                        printf("%46s", " ");
 | 
			
		||||
 | 
			
		||||
                        if(device) {
 | 
			
		||||
                            printf("%-16s%-4d\n", device->dev_name, dev_cnt);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            printf("%-16s%-4d\n", "nil", dev_cnt);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    dev_cnt++;
 | 
			
		||||
                    dev_node = dev_node->node_next;
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("\n");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ch_node = ch_node->node_next;
 | 
			
		||||
    }
 | 
			
		||||
    while(ch_node != ch_head);
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(PlcShowChannel, a plc show channel sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
 | 
			
		||||
void PlcShowDev(void)
 | 
			
		||||
{
 | 
			
		||||
    PlcDeviceType* plc_dev;
 | 
			
		||||
    ChDrvType driver;
 | 
			
		||||
    ChDevType device;
 | 
			
		||||
    DoublelistType* plc_node = NULL;
 | 
			
		||||
    DoublelistType* plc_head = &plcdev_list;
 | 
			
		||||
    const char* item_array[] = {"device", "vendor", "model", "product", "id"};
 | 
			
		||||
    PlcShowDemoInit();
 | 
			
		||||
    PlcShowTitle(item_array);
 | 
			
		||||
    plc_node = plc_head->node_next;
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        plc_dev = DOUBLE_LIST_ENTRY(plc_node, struct PlcDevice, link);
 | 
			
		||||
 | 
			
		||||
        if(plc_dev) {
 | 
			
		||||
            printf("%s", " ");
 | 
			
		||||
            printf("%-15s%-15s%-15s%-15s%-20d",
 | 
			
		||||
                    plc_dev->name,
 | 
			
		||||
                    plc_dev->info.vendor,
 | 
			
		||||
                    plc_dev->info.model,
 | 
			
		||||
                    plc_dev->info.product,
 | 
			
		||||
                    plc_dev->info.id);
 | 
			
		||||
            printf("\n");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        plc_node = plc_node->node_next;
 | 
			
		||||
    }
 | 
			
		||||
    while(plc_node != plc_head);
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(PlcShowDev, a plc show dev sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := schneider_m241.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file schneider_m241.c
 | 
			
		||||
 * @brief PLC SCHNEIDER M241 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := siemens_s7_200_cn.c siemens_s7_200_smart.c siemens_s7_300.c siemens_s7_1200.c siemens_s7_1500.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file siemens_s7_1200.c
 | 
			
		||||
 * @brief PLC SIEMENS S7-1200 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file siemens_s7_1500.c
 | 
			
		||||
 * @brief PLC SIEMENS S7-1500 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file siemens_s7_200_cn.c
 | 
			
		||||
 * @brief PLC SIEMENS S7-200CN app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file siemens_s7_200_smart.c
 | 
			
		||||
 * @brief PLC SIEMENS S7-200 SMART app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file siemens_s7_300.c
 | 
			
		||||
 * @brief PLC SIEMENS S7-300 app
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.9.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -8,11 +8,11 @@ if SUPPORT_CONNECTION_FRAMEWORK
 | 
			
		|||
        bool "Using connection framework debug log function"
 | 
			
		||||
        default y
 | 
			
		||||
 | 
			
		||||
        menuconfig CONNECTION_INDUSTRIAL_ETHERNET
 | 
			
		||||
                bool "Using industrial ethernet"
 | 
			
		||||
        menuconfig CONNECTION_INDUSTRIAL_NETWORK
 | 
			
		||||
                bool "Using industrial network"
 | 
			
		||||
                default n
 | 
			
		||||
        if CONNECTION_INDUSTRIAL_ETHERNET
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_ethernet/Kconfig"
 | 
			
		||||
        if CONNECTION_INDUSTRIAL_NETWORK
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_network/Kconfig"
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        menuconfig CONNECTION_INDUSTRIAL_FIELDBUS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,8 +9,8 @@ endif
 | 
			
		|||
ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
 | 
			
		||||
    SRC_FILES := adapter.c adapter_agent.c
 | 
			
		||||
 | 
			
		||||
    ifeq ($(CONFIG_CONNECTION_INDUSTRIAL_ETHERNET),y)
 | 
			
		||||
        SRC_DIR += industrial_ethernet
 | 
			
		||||
    ifeq ($(CONFIG_CONNECTION_INDUSTRIAL_NETWORK),y)
 | 
			
		||||
        SRC_DIR += industrial_network
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    ifeq ($(CONFIG_CONNECTION_INDUSTRIAL_FIELDBUS),y)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +0,0 @@
 | 
			
		|||
config CONNECTION_ADAPTER_ETHERCAT
 | 
			
		||||
    bool "Using ethercat on industrial_ethernet adapter device"
 | 
			
		||||
    default n
 | 
			
		||||
 | 
			
		||||
    if CONNECTION_ADAPTER_ETHERCAT
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_ethernet/ethercat/Kconfig"
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
menuconfig POWERLINK_MN
 | 
			
		||||
    bool "Using powerlink MN"
 | 
			
		||||
    default n
 | 
			
		||||
 | 
			
		||||
menuconfig POWERLINK_CN
 | 
			
		||||
    bool "Using powerlink CN"
 | 
			
		||||
    default n
 | 
			
		||||
| 
						 | 
				
			
			@ -1,14 +0,0 @@
 | 
			
		|||
#include <xizi.h>
 | 
			
		||||
#include <xsconfig.h>
 | 
			
		||||
 | 
			
		||||
#ifdef POWERLINK_MN
 | 
			
		||||
extern int OplkDemoMnConsole(int argc, char *argv[]);
 | 
			
		||||
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(OplkDemoMnConsole, a openPOWERLINK MN sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef POWERLINK_CN
 | 
			
		||||
extern int OplkDemoCnConsole(int argc, char *argv[]);
 | 
			
		||||
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(OplkDemoCnConsole, a openPOWERLINK CN sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -1,2 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
config CONNECTION_ADAPTER_ETHERCAT
 | 
			
		||||
    bool "Using EtherCAT on industrial network adapter device"
 | 
			
		||||
    default n
 | 
			
		||||
 | 
			
		||||
    if CONNECTION_ADAPTER_ETHERCAT
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_network/ethercat/Kconfig"
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
config CONNECTION_ADAPTER_POWERLINK
 | 
			
		||||
    bool "Using POWERLINK on industrial network adapter device"
 | 
			
		||||
    default n
 | 
			
		||||
 | 
			
		||||
    if CONNECTION_ADAPTER_POWERLINK
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_network/powerlink/Kconfig"
 | 
			
		||||
    endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_CONNECTION_ADAPTER_POWERLINK),y)
 | 
			
		||||
	SRC_DIR += powerlink
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_CONNECTION_ADAPTER_ETHERCAT),y)
 | 
			
		||||
	SRC_DIR += ethercat
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -2,10 +2,10 @@ config ADAPTER_HFA21_ETHERCAT
 | 
			
		|||
        depends on ADAPTER_HFA21_ETHERNET # ADAPTER_HFA21_WIFI
 | 
			
		||||
        help
 | 
			
		||||
            Ethercat is dependant on Ethernet. Please enable hfa21 ethernet first. And this is a software-defined experiment module, without supports on ECS and on-the-fly.
 | 
			
		||||
        bool "Using ethercat on ethernet adapter device HFA21"
 | 
			
		||||
        bool "Using ethercat on industrial network adapter device HFA21"
 | 
			
		||||
        default n
 | 
			
		||||
 | 
			
		||||
    if ADAPTER_HFA21_ETHERCAT
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_ethernet/ethercat/hfa21_ethercat/Kconfig"
 | 
			
		||||
        source "$APP_DIR/Framework/connection/industrial_network/ethercat/hfa21_ethercat/Kconfig"
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := 
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
config POWERLINK_MN
 | 
			
		||||
    bool "Using powerlink MN"
 | 
			
		||||
    default n
 | 
			
		||||
 | 
			
		||||
config POWERLINK_CN
 | 
			
		||||
    bool "Using powerlink CN"
 | 
			
		||||
    default n
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ LIBOPLKCN := $(LIBOPLKCN:$(CUR_DIR)/%=%)
 | 
			
		|||
OPLK_DEMO_MN_CONSOLE := $(OPLK_DEMO_MN_CONSOLE:$(CUR_DIR)/%=%)
 | 
			
		||||
OPLK_DEMO_CN_CONSOLE := $(OPLK_DEMO_CN_CONSOLE:$(CUR_DIR)/%=%)
 | 
			
		||||
 | 
			
		||||
SRC_FILES := powerlink_demo.c
 | 
			
		||||
SRC_FILES := adapter_powerlink.c
 | 
			
		||||
ifeq ($(CONFIG_POWERLINK_MN)_$(CONFIG_POWERLINK_CN),y_)
 | 
			
		||||
	SRC_FILES += $(OPLK_DEMO_MN_CONSOLE) $(LIBOPLKMN)
 | 
			
		||||
else ifeq ($(CONFIG_POWERLINK_MN)_$(CONFIG_POWERLINK_CN),_y)
 | 
			
		||||
| 
						 | 
				
			
			@ -50,8 +50,4 @@ else ifeq ($(CONFIG_POWERLINK_MN)_$(CONFIG_POWERLINK_CN),y_y)
 | 
			
		|||
	$(error CONFIG_POWERLINK_MN and CONFIG_POWERLINK_CN cannot be enabled simultaneously due to name conflict)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_CONNECTION_ADAPTER_ETHERCAT),y)
 | 
			
		||||
	SRC_DIR += ethercat
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2020 AIIT XUOS Lab
 | 
			
		||||
 * XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
 * You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
 *        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 * See the Mulan PSL v2 for more details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file adapter_powerlink.c
 | 
			
		||||
 * @brief Implement the connection powerlink adapter function
 | 
			
		||||
 * @version 3.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022.09.27
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <adapter.h>
 | 
			
		||||
 | 
			
		||||
#ifdef POWERLINK_MN
 | 
			
		||||
extern int OplkDemoMnConsole(int argc, char *argv[]);
 | 
			
		||||
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(OplkDemoMnConsole, a openPOWERLINK MN sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef POWERLINK_CN
 | 
			
		||||
extern int OplkDemoCnConsole(int argc, char *argv[]);
 | 
			
		||||
 | 
			
		||||
PRIV_SHELL_CMD_FUNCTION(OplkDemoCnConsole, a openPOWERLINK CN sample, PRIV_SHELL_CMD_MAIN_ATTR);
 | 
			
		||||
#endif
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB  | 
| 
		 Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB  | 
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue