├── .dockerignore ├── Dockerfile ├── LICENSE.txt ├── README.md ├── driver ├── includes │ ├── TLR_Types.h │ ├── cifXEndianess.h │ ├── cifXErrors.h │ ├── cifXUser.h │ ├── cifxlinux.h │ ├── netx_tap.h │ ├── rcX_Public.h │ └── rcX_User.h └── netx-docker-pi-drv-2.0.1-r0.deb ├── electronic-data-sheets ├── EtherCAT │ └── Hilscher ECS LFW Host Example Simple Config.xml ├── EtherNetIP │ └── SetConfigExample.EDS ├── ModbusTCP │ └── NotNecessary ├── POWERLINK │ └── 00000044_NETX_STATIC_MAP_DEMO.xdd └── PROFINET │ ├── GSDML-011E-0115-NETX51REPNS.bmp │ ├── GSDML-011E-0115-NETX51REPNS.ico │ └── GSDML-V2.33-HILSCHER-NETX 51-RE PNS-20170216.xml ├── examples ├── Makefile ├── includes │ ├── App.h │ ├── EtherCAT │ │ ├── EcatFoE_Public.h │ │ ├── EcsV4_Error.h │ │ ├── EcsV4_Public.h │ │ ├── OdV3_Defines.h │ │ ├── OdV3_Public.h │ │ └── objdict_error.h │ ├── EtherNetIP │ │ ├── EipAps_Public.h │ │ ├── EipAps_error.h │ │ ├── cip_as.h │ │ ├── cip_common.h │ │ ├── cip_id.h │ │ ├── cip_io.h │ │ ├── cip_mr.h │ │ ├── cip_object.h │ │ ├── cip_pdc.h │ │ ├── cip_timesync.h │ │ ├── eip_cm.h │ │ ├── eip_dlr.h │ │ ├── eip_dlr_error.h │ │ ├── eip_en.h │ │ ├── eip_error.h │ │ ├── eip_hw_adaption.h │ │ ├── eip_public.h │ │ ├── eip_qos.h │ │ └── eip_tcp.h │ ├── ModbusTCP │ │ ├── CmdTable_Configuration.h │ │ ├── CmdTable_Error.h │ │ ├── CmdTable_Public.h │ │ ├── OmbOmbApTask_Public.h │ │ ├── OmbOmbApTask_error.h │ │ ├── OmbOmbTask_Public.h │ │ ├── OmbOmbTask_error.h │ │ ├── OmbOmb_DiagStructDef.h │ │ ├── TcpipConfig.h │ │ ├── TcpipTcpTask_Public.h │ │ ├── rX_Macros.h │ │ └── rX_Version.h │ ├── POWERLINK │ │ ├── EplCn_Defines.h │ │ ├── EplCn_If_Public.h │ │ ├── EplCn_If_Results.h │ │ ├── EplCn_Nmt_Results.h │ │ ├── Epl_Common_Defines.h │ │ ├── Epl_Common_ObjDict.h │ │ ├── OdV3_Defines.h │ │ ├── OdV3_Public.h │ │ ├── SOCK_API.h │ │ ├── Sock_error.h │ │ └── objdict_error.h │ ├── PROFINET │ │ ├── EthIntf_Public.h │ │ ├── IOSignals_Public.h │ │ ├── IOSignals_error.h │ │ ├── LLDP_Application.h │ │ ├── PNIO_spec.h │ │ ├── PNIO_status.h │ │ ├── PNSIF_API.h │ │ ├── Pnio_errors.h │ │ ├── TcpipConfig.h │ │ ├── TcpipTcpTask_Public.h │ │ ├── TcpipTcpTask_error.h │ │ └── pns_error.h │ ├── PacketHandlerECS.h │ ├── PacketHandlerEIS.h │ ├── PacketHandlerOMB.h │ ├── PacketHandlerPLS.h │ ├── PacketHandlerPNS.h │ └── SystemPackets.h └── sources │ ├── ECS_simpleConfig.c │ ├── EIS_simpleConfig.c │ ├── OMB_simpleConfig.c │ ├── PLS_simpleConfig.c │ ├── PNS_simpleConfig.c │ ├── PacketHandlerECS.c │ ├── PacketHandlerEIS.c │ ├── PacketHandlerOMB.c │ ├── PacketHandlerPLS.c │ ├── PacketHandlerPNS.c │ └── SystemPackets.c ├── firmwares ├── netx-docker-pi-ecs-4.8.0.3.deb ├── netx-docker-pi-eis-2.14.0.2.deb ├── netx-docker-pi-omb-2.6.0.6.deb ├── netx-docker-pi-pls-3.3.0.0.deb └── netx-docker-pi-pns-4.5.0.5.deb ├── hooks ├── build ├── post_push └── pre_build └── manuals ├── EtherCAT Slave V4 Protocol API 11 EN.pdf ├── EtherNetIP Adapter Protocol API 20 EN.pdf ├── OpenModbusTCP Protocol API 10 EN.pdf ├── POWERLINK Controlled Node V3 Protocol API 05 EN.pdf ├── PROFINET IO-Device V3.14 Protocol API 19 EN.pdf └── cifX API PR 08 EN.pdf /.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | LICENSE.txt 3 | Readme.md 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | #use armv7hf compatible base image 2 | FROM balenalib/armv7hf-debian:buster-20191223 3 | 4 | #dynamic build arguments coming from the /hooks/build file 5 | ARG BUILD_DATE 6 | ARG VCS_REF 7 | 8 | #metadata labels 9 | LABEL org.label-schema.build-date=$BUILD_DATE \ 10 | org.label-schema.vcs-url="https://github.com/HilscherAutomation/netPI-netx-programming-examples" \ 11 | org.label-schema.vcs-ref=$VCS_REF 12 | 13 | #version 14 | ENV HILSCHERNETPI_NETX_PROGRAMMING_EXAMPLES_VERSION 1.1.4 15 | 16 | #labeling 17 | LABEL maintainer="netpi@hilscher.com" \ 18 | version=$HILSCHERNETPI_NETX_PROGRAMMING_EXAMPLES_VERSION \ 19 | description="netX real-time ethernet programming examples" 20 | 21 | #install ssh, gcc, create user "pi" and make him sudo 22 | RUN apt-get update \ 23 | && apt-get install -y openssh-server build-essential \ 24 | && mkdir /var/run/sshd \ 25 | && useradd --create-home --shell /bin/bash pi \ 26 | && echo 'pi:raspberry' | chpasswd \ 27 | && adduser pi sudo 28 | 29 | #create needed folders 30 | RUN mkdir /home/pi/manuals /home/pi/firmwares /home/pi/driver /home/pi/sources \ 31 | /home/pi/includes \ 32 | /home/pi/includes/EtherNetIP \ 33 | /home/pi/includes/PROFINET \ 34 | /home/pi/includes/EtherCAT \ 35 | /home/pi/includes/POWERLINK \ 36 | /home/pi/includes/ModbusTCP \ 37 | /home/pi/devicedescriptions/ \ 38 | /home/pi/devicedescriptions/PROFINET \ 39 | /home/pi/devicedescriptions/EtherNetIP \ 40 | /home/pi/devicedescriptions/EtherCAT \ 41 | /home/pi/devicedescriptions/POWERLINK \ 42 | /home/pi/objs 43 | 44 | #set the working directory 45 | WORKDIR /home/pi 46 | 47 | #copy the manuals 48 | COPY ./manuals/* manuals/ 49 | 50 | #copy the firmware packages 51 | COPY ./firmwares/* firmwares/ 52 | 53 | #copy the netx driver and include files 54 | COPY ./driver/* driver/ 55 | COPY ./driver/includes/* /usr/include/cifx/ 56 | 57 | #copy the include files 58 | COPY examples/includes/EtherCAT/* includes/EtherCAT/ 59 | COPY examples/includes/EtherNetIP/* includes/EtherNetIP/ 60 | COPY examples/includes/PROFINET/* includes/PROFINET/ 61 | COPY examples/includes/POWERLINK/* includes/POWERLINK/ 62 | COPY examples/includes/ModbusTCP/* includes/ModbusTCP/ 63 | COPY examples/includes/SystemPackets.h includes/ 64 | COPY examples/includes/App.h includes/ 65 | COPY examples/includes/PacketHandlerPNS.h includes/ 66 | COPY examples/includes/PacketHandlerEIS.h includes/ 67 | COPY examples/includes/PacketHandlerECS.h includes/ 68 | COPY examples/includes/PacketHandlerPLS.h includes/ 69 | COPY examples/includes/PacketHandlerOMB.h includes/ 70 | 71 | #copy the device description files such as GSDML, EDS 72 | COPY electronic-data-sheets/PROFINET/* devicedescriptions/PROFINET/ 73 | COPY electronic-data-sheets/EtherNetIP/* devicedescriptions/EtherNetIP/ 74 | COPY electronic-data-sheets/EtherCAT/* devicedescriptions/EtherCAT/ 75 | COPY electronic-data-sheets/POWERLINK/* devicedescriptions/POWERLINK/ 76 | 77 | #copy the makefile and the application source codes 78 | COPY examples/Makefile ./ 79 | COPY examples/sources/* sources/ 80 | 81 | #install the driver 82 | RUN dpkg -i ./driver/netx-docker-pi-drv-2.0.1-r0.deb 83 | 84 | #compile the applications 85 | RUN make 86 | 87 | #SSH port 88 | EXPOSE 22 89 | 90 | #the entrypoint shall start ssh 91 | ENTRYPOINT ["/usr/sbin/sshd", "-D"] 92 | 93 | #set STOPSGINAL 94 | STOPSIGNAL SIGTERM 95 | 96 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 - Hilscher Gesellschaft fuer Systemautomation mbH 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /driver/includes/cifXEndianess.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | 3 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 4 | 5 | *************************************************************************************** 6 | 7 | $Id: cifXEndianess.h 6598 2014-10-02 08:57:18Z stephans $: 8 | 9 | Description: 10 | Little/Big Endian conversion 11 | 12 | Changes: 13 | Date Description 14 | ----------------------------------------------------------------------------------- 15 | 2010-01-25 added additional braces to the macros 16 | 2009-01-20 initial version 17 | 18 | **************************************************************************************/ 19 | 20 | /*****************************************************************************/ 21 | /*! \file cifXEndianess.h 22 | * Little/Big Endian conversion */ 23 | /*****************************************************************************/ 24 | 25 | #ifndef __CIFX_ENDIANESS__H 26 | #define __CIFX_ENDIANESS__H 27 | 28 | /* Give the user the possibility to use own macros for 29 | endianess conversion */ 30 | #ifndef BIGENDIAN_MACROS_PROVIDED 31 | #ifndef CIFX_TOOLKIT_BIGENDIAN 32 | /* Little endian, so we don't need a conversion */ 33 | #define LE16_TO_HOST(a) (a) 34 | #define LE32_TO_HOST(a) (a) 35 | #define LE64_TO_HOST(a) (a) 36 | #define HOST_TO_LE16(a) (a) 37 | #define HOST_TO_LE32(a) (a) 38 | #define HOST_TO_LE64(a) (a) 39 | #else 40 | /* BIG endian, so we DO need a conversion */ 41 | #define LE16_TO_HOST(a) ( (((a) & 0x00FF) << 8) | \ 42 | (((a) & 0xFF00) >> 8) ) 43 | 44 | #define LE32_TO_HOST(a) ( (((a) & 0x000000FFUL) << 24) | \ 45 | (((a) & 0x0000FF00UL) << 8) | \ 46 | (((a) & 0x00FF0000UL) >> 8) | \ 47 | (((a) & 0xFF000000UL) >> 24) ) 48 | 49 | #define LE64_TO_HOST(a) ( (((a) & 0x00000000000000FFULL) << 56) | \ 50 | (((a) & 0x000000000000FF00ULL) << 40) | \ 51 | (((a) & 0x0000000000FF0000ULL) << 24) | \ 52 | (((a) & 0x00000000FF000000ULL) << 8) | \ 53 | (((a) & 0x000000FF00000000ULL) >> 8) | \ 54 | (((a) & 0x0000FF0000000000ULL) >> 24) | \ 55 | (((a) & 0x00FF000000000000ULL) >> 40) | \ 56 | (((a) & 0xFF00000000000000ULL) >> 56) ) 57 | 58 | #define HOST_TO_LE16(a) LE16_TO_HOST(a) 59 | #define HOST_TO_LE32(a) LE32_TO_HOST(a) 60 | #define HOST_TO_LE64(a) LE64_TO_HOST(a) 61 | #endif 62 | #endif 63 | 64 | typedef enum 65 | { 66 | eCIFX_ENDIANESS_WIDTH_8BIT, 67 | eCIFX_ENDIANESS_WIDTH_16BIT, 68 | eCIFX_ENDIANESS_WIDTH_32BIT, 69 | eCIFX_ENDIANESS_WIDTH_64BIT 70 | 71 | } CIFX_ENDIANESS_WIDTH; 72 | 73 | /*****************************************************************************/ 74 | /*! Structure definition for endianess conversion function. An array of this 75 | * this structure is used for automatically transforming a structure (which 76 | * is described by this structure) from/to host endianess */ 77 | /*****************************************************************************/ 78 | typedef struct CIFX_ENDIANESS_ENTRY_Ttag 79 | { 80 | int iOffset; /*!< Offset inside the buffer */ 81 | CIFX_ENDIANESS_WIDTH eWidth; /*!< Data width of structure */ 82 | int iElementCnt; /*!< Number of elements to convert */ 83 | 84 | } CIFX_ENDIANESS_ENTRY_T, *PCIFX_ENDIANESS_ENTRY_T; 85 | 86 | void cifXConvertEndianess(void* pvBuffer, int iBufferLen, 87 | const CIFX_ENDIANESS_ENTRY_T* atConv, int iConvLen); 88 | 89 | #endif /* __CIFX_ENDIANESS__H */ 90 | -------------------------------------------------------------------------------- /driver/includes/netx_tap.h: -------------------------------------------------------------------------------- 1 | #ifndef __NETX_TAP__H 2 | #define __NETX_TAP__H 3 | 4 | #ifdef CIFXETHERNET 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #define DEFAULT_POLL_TIMEOUT 10 /* polling interval of receiver thread in ms */ 14 | 15 | /* symbols used when requesting information of the extended status block (->cifXEthGetExentedStatusInformation()) */ 16 | #define EXT_INFO_INTF_CONFIG 1 /* request for interface configuration (returns EXT_INFO_MACADDR, EXT_INFO_IPADDR, EXT_INFO_NETMASK, EXT_INFO_GATEWAY) */ 17 | #define EXT_INFO_LINKSTATE 2 18 | #define EXT_INFO_MACADDR 3 19 | #define EXT_INFO_IPADDR 4 20 | #define EXT_INFO_NETMASK 5 21 | #define EXT_INFO_GATEWAY 6 22 | #define EXT_INFO_NO_RECVPKT 7 23 | #define EXT_INFO_NO_RCVPKT_DROP 8 24 | #define EXT_INFO_NO_SENDPKT 9 25 | #define EXT_INFO_NO_SENDPKT_DROP 10 26 | #define EXT_STATISTICS 11 27 | 28 | typedef struct NETX_ETH_DEV_CFG_Ttag 29 | { 30 | char cifx_name[16]; 31 | char eth_dev_name[IFNAMSIZ]; 32 | 33 | } NETX_ETH_DEV_CFG_T; 34 | 35 | #pragma pack(1) 36 | typedef struct IPCONFIG_Ttag /* configuration of the hardware, indicated by the ETH_INTF_RECV_IP_CONFIG_IND packet */ 37 | { 38 | uint32_t ulFlags; 39 | uint32_t ulIpAddr; 40 | uint32_t ulNetMask; 41 | uint32_t ulGateway; 42 | uint8_t abEthernetMACAddr[6]; 43 | 44 | } IPCONFIG_T, *PIPCONFIG_T; 45 | #pragma pack() 46 | 47 | typedef struct STATISTIC_Ttag /* ethernet statistic information structure (located in the extended information field) */ 48 | { 49 | uint64_t ullIfInPkts; /* the number of packets received */ 50 | uint64_t ullIfInDiscards; /* The number of received packets not passed to the host because of packet queue overflow */ 51 | uint64_t ullIfOutPkts; /* The number of sent ethernet frames */ 52 | uint64_t ullIfOutDiscards; /* The number of ethernet frames dropped because of no ethernet frame buffer available */ 53 | uint64_t ullIfInBytes; /* the number of bytes received */ 54 | uint64_t ullIfOutBytes; /* the number of bytes transmitted */ 55 | 56 | } STATISTIC_T, *PSTATISTIC_T; 57 | 58 | typedef struct LINK_STATE_Ttag 59 | { 60 | uint8_t bLinkState; 61 | } LINK_STATE_T, *PLINK_STATE_T; 62 | 63 | void* cifxeth_create_device( NETX_ETH_DEV_CFG_T* config); 64 | void cifxeth_remove_device( void* handle, NETX_ETH_DEV_CFG_T* config); 65 | void cifxeth_sys_cleanup(void); 66 | 67 | #endif //CIFXETHERNET 68 | 69 | #endif /* __NETX_TAP__H */ 70 | -------------------------------------------------------------------------------- /driver/netx-docker-pi-drv-2.0.1-r0.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/driver/netx-docker-pi-drv-2.0.1-r0.deb -------------------------------------------------------------------------------- /electronic-data-sheets/EtherNetIP/SetConfigExample.EDS: -------------------------------------------------------------------------------- 1 | $ EZ-EDS Version 3.11.1.20151008 Generated Electronic Data Sheet 2 | 3 | $ **************************************************************************** 4 | $ 5 | $ File: HILSCHER NETX52-RE_EIS.EDS 6 | $ 7 | $ Author: Kai Michel, Hilscher GmbH, Hattersheim, Germany 8 | $ hotline@hilscher.com 9 | $ Date: 02.10.15 10 | $ 11 | $ **************************************************************************** 12 | $ 13 | $ ATTENTION: 14 | $ 15 | $ Changes in this file can cause configuration or communication problems. 16 | $ 17 | $ **************************************************************************** 18 | $ 19 | $ Changes: 20 | $ 21 | $ Version Date Name Description 22 | $ ------------------------------------------------------------------------- 23 | $ 1.0 02.10.2015 NA - created 24 | $ 25 | $ **************************************************************************** 26 | 27 | [File] 28 | DescText = "EDS-File for netX 52-RE EtherNet/IP Adapter - Extended Config Example"; 29 | CreateDate = 10-02-2015; 30 | CreateTime = 08:40:07; 31 | ModDate = 10-02-2015; 32 | ModTime = 08:40:09; 33 | Revision = 1.1; 34 | HomeURL = "www.hilscher.com"; 35 | 36 | 37 | [Device] 38 | VendCode = 283; 39 | VendName = "Hilscher GmbH"; 40 | ProdType = 12; 41 | ProdTypeStr = "Communications Adapter"; 42 | ProdCode = 2; 43 | MajRev = 1; 44 | MinRev = 1; 45 | ProdName = "EIS_V3_SetConfigExample"; 46 | Catalog = "CatalogNumber"; 47 | 48 | [Device Classification] 49 | Class1 = EtherNetIP; 50 | 51 | 52 | [Params] 53 | Param1 = 54 | 0, 55 | ,, 56 | 0x0010, 57 | 0xC6, 58 | 1, 59 | "Produced Data", 60 | "", 61 | "", 62 | 0,0xFF,0, 63 | ,,,, 64 | ,,,, 65 | 0; 66 | Param2 = 67 | 0, 68 | ,, 69 | 0x0000, 70 | 0xC8, 71 | 4, 72 | "Consumed Data", 73 | "", 74 | "", 75 | 0,0xFFFFFFFF,0, 76 | ,,,, 77 | ,,,, 78 | 0; 79 | 80 | 81 | [Assembly] 82 | Assem100 = 83 | "Consuming Assembly (O2T)", 84 | , 85 | , 86 | 0x0000, 87 | ,, 88 | 32,Param2; 89 | 90 | 91 | Assem101 = 92 | "Producing Assembly (T2O)", 93 | , 94 | , 95 | 0x0000, 96 | ,, 97 | 8,Param1, 98 | 8,Param1, 99 | 8,Param1, 100 | 8,Param1, 101 | 8,Param1, 102 | 8,Param1, 103 | 8,Param1, 104 | 8,Param1, 105 | 8,Param1, 106 | 8,Param1; 107 | 108 | [Connection Manager] 109 | Connection1 = 110 | 0x04010002, $ Trigger and Transport 111 | 0x44640405, $ Point Multicast 112 | ,,Assem100, $ OT RPI Size format 113 | ,,Assem101, $ TO rpi size format 114 | ,, $ config 1 115 | 0,, $ config 2 116 | "Exclusive Owner ", $ connection name 117 | "", $ help string 118 | "20 04 24 01 2C 64 2C 65"; $ path 119 | 120 | Connection2 = 121 | 0x01010002, $ Trigger and Transport 122 | 0x44240305, $ Point Multicast 123 | ,0,, $ OT RPI Size format 124 | ,,Assem101, $ TO rpi size format 125 | ,, $ config 1 126 | 0,, $ config 2 127 | "Listen Only", $ connection name 128 | "", $ help string 129 | "20 04 24 01 2C C0 2C 65"; $ path 130 | 131 | Connection3 = 132 | 0x02010002, $ Trigger and Transport 133 | 0x44640305, $ Point Multicast 134 | ,0,, $ OT RPI Size format 135 | ,,Assem101, $ TO rpi size format 136 | ,, $ config 1 137 | 0,, $ config 2 138 | "Input Only", $ connection name 139 | "", $ help string 140 | "20 04 24 01 2C C1 2C 65"; $ path 141 | 142 | [Capacity] 143 | ConnOverhead = .004; $ Connection Overhead 144 | 145 | MaxIOConnections = 3; $ Maximum number of Class 1 Connections 146 | MaxMsgConnections = 6; $ Maximum number of Class 3 Connections 147 | TSpec1 = TxRx, 10, 2000; $ packets per sec @ 10 bytes 148 | TSpec2 = TxRx, 504, 1500; $ packets per sec @ 504 bytes 149 | 150 | [DLR Class] 151 | Revision = 3; 152 | MaxInst = 1; 153 | Number_Of_Static_Instances = 1; 154 | Max_Number_Of_Dynamic_Instances = 0; 155 | 156 | [TCP/IP Interface Class] 157 | Revision = 4; 158 | MaxInst = 1; 159 | Number_Of_Static_Instances = 1; 160 | Max_Number_Of_Dynamic_Instances = 0; 161 | 162 | [Ethernet Link Class] 163 | Revision = 4; 164 | MaxInst = 2; 165 | Number_Of_Static_Instances = 2; 166 | Max_Number_Of_Dynamic_Instances = 0; 167 | InterfaceLabel1 = "Port1"; 168 | InterfaceLabel2 = "Port2"; 169 | 170 | $ **************************************************************************** 171 | $ EOF 172 | $ **************************************************************************** 173 | -------------------------------------------------------------------------------- /electronic-data-sheets/ModbusTCP/NotNecessary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/electronic-data-sheets/ModbusTCP/NotNecessary -------------------------------------------------------------------------------- /electronic-data-sheets/PROFINET/GSDML-011E-0115-NETX51REPNS.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/electronic-data-sheets/PROFINET/GSDML-011E-0115-NETX51REPNS.bmp -------------------------------------------------------------------------------- /electronic-data-sheets/PROFINET/GSDML-011E-0115-NETX51REPNS.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/electronic-data-sheets/PROFINET/GSDML-011E-0115-NETX51REPNS.ico -------------------------------------------------------------------------------- /electronic-data-sheets/PROFINET/GSDML-V2.33-HILSCHER-NETX 51-RE PNS-20170216.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/electronic-data-sheets/PROFINET/GSDML-V2.33-HILSCHER-NETX 51-RE PNS-20170216.xml -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | GCC = gcc 2 | 3 | CFLAGS = 4 | 5 | SRCPATH = . 6 | 7 | LIBS = -lcifx 8 | 9 | OBJDIR = ./objs 10 | 11 | SOURCES = $(SRCPATH)/sources 12 | 13 | INCDIRS = -I/usr/include/cifx -Iincludes/ 14 | 15 | INCDIRS_PNS = -I/usr/include/cifx -Iincludes/PROFINET -Iincludes/ 16 | INCDIRS_EIS = -I/usr/include/cifx -Iincludes/EtherNetIP -Iincludes/ 17 | INCDIRS_ECS = -I/usr/include/cifx -Iincludes/EtherCAT -Iincludes/ 18 | INCDIRS_PLS = -I/usr/include/cifx -Iincludes/POWERLINK -Iincludes/ 19 | INCDIRS_OMB = -I/usr/include/cifx -Iincludes/ModbusTCP -Iincludes/ 20 | 21 | 22 | all: $(SRCPATH)/PNS_simpleConfig $(SRCPATH)/EIS_simpleConfig $(SRCPATH)/ECS_simpleConfig $(SRCPATH)/PLS_simpleConfig $(SRCPATH)/OMB_simpleConfig 23 | 24 | 25 | 26 | 27 | 28 | $(SRCPATH)/PNS_simpleConfig: $(OBJDIR)/PNS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerPNS.o 29 | 30 | $(GCC) $(LIBS) -o $(SRCPATH)/PNS_simpleConfig $(OBJDIR)/PNS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerPNS.o 31 | 32 | 33 | 34 | $(SRCPATH)/EIS_simpleConfig: $(OBJDIR)/EIS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerEIS.o 35 | 36 | $(GCC) $(LIBS) -o $(SRCPATH)/EIS_simpleConfig $(OBJDIR)/EIS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerEIS.o 37 | 38 | 39 | 40 | $(SRCPATH)/ECS_simpleConfig: $(OBJDIR)/ECS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerECS.o 41 | 42 | $(GCC) $(LIBS) -o $(SRCPATH)/ECS_simpleConfig $(OBJDIR)/ECS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerECS.o 43 | 44 | 45 | 46 | $(SRCPATH)/PLS_simpleConfig: $(OBJDIR)/PLS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerPLS.o 47 | 48 | $(GCC) $(LIBS) -o $(SRCPATH)/PLS_simpleConfig $(OBJDIR)/PLS_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerPLS.o 49 | 50 | 51 | 52 | $(SRCPATH)/OMB_simpleConfig: $(OBJDIR)/OMB_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerOMB.o 53 | 54 | $(GCC) $(LIBS) -o $(SRCPATH)/OMB_simpleConfig $(OBJDIR)/OMB_simpleConfig.o $(OBJDIR)/SystemPackets.o $(OBJDIR)/PacketHandlerOMB.o 55 | 56 | 57 | 58 | $(OBJDIR)/PNS_simpleConfig.o: $(SOURCES)/PNS_simpleConfig.c 59 | 60 | $(GCC) $(CFLAGS) -c $(SOURCES)/PNS_simpleConfig.c -o $(OBJDIR)/PNS_simpleConfig.o $(INCDIRS_PNS) 61 | 62 | 63 | 64 | $(OBJDIR)/EIS_simpleConfig.o: $(SOURCES)/EIS_simpleConfig.c 65 | 66 | $(GCC) $(CFLAGS) -c $(SOURCES)/EIS_simpleConfig.c -o $(OBJDIR)/EIS_simpleConfig.o $(INCDIRS_EIS) 67 | 68 | 69 | 70 | $(OBJDIR)/ECS_simpleConfig.o: $(SOURCES)/ECS_simpleConfig.c 71 | 72 | $(GCC) $(CFLAGS) -c $(SOURCES)/ECS_simpleConfig.c -o $(OBJDIR)/ECS_simpleConfig.o $(INCDIRS_ECS) 73 | 74 | 75 | 76 | $(OBJDIR)/PLS_simpleConfig.o: $(SOURCES)/PLS_simpleConfig.c 77 | 78 | $(GCC) $(CFLAGS) -c $(SOURCES)/PLS_simpleConfig.c -o $(OBJDIR)/PLS_simpleConfig.o $(INCDIRS_PLS) 79 | 80 | 81 | 82 | $(OBJDIR)/OMB_simpleConfig.o: $(SOURCES)/OMB_simpleConfig.c 83 | 84 | $(GCC) $(CFLAGS) -c $(SOURCES)/OMB_simpleConfig.c -o $(OBJDIR)/OMB_simpleConfig.o $(INCDIRS_OMB) 85 | 86 | 87 | 88 | $(OBJDIR)/SystemPackets.o: $(SOURCES)/SystemPackets.c 89 | 90 | $(GCC) $(CFLAGS) -c $(SOURCES)/SystemPackets.c -o $(OBJDIR)/SystemPackets.o $(INCDIRS) 91 | 92 | 93 | 94 | 95 | 96 | $(OBJDIR)/PacketHandlerPNS.o: $(SOURCES)/PacketHandlerPNS.c 97 | 98 | $(GCC) $(CFLAGS) -c $(SOURCES)/PacketHandlerPNS.c -o $(OBJDIR)/PacketHandlerPNS.o $(INCDIRS_PNS) 99 | 100 | 101 | 102 | $(OBJDIR)/PacketHandlerEIS.o: $(SOURCES)/PacketHandlerEIS.c 103 | 104 | $(GCC) $(CFLAGS) -c $(SOURCES)/PacketHandlerEIS.c -o $(OBJDIR)/PacketHandlerEIS.o $(INCDIRS_EIS) 105 | 106 | 107 | 108 | $(OBJDIR)/PacketHandlerECS.o: $(SOURCES)/PacketHandlerECS.c 109 | 110 | $(GCC) $(CFLAGS) -c $(SOURCES)/PacketHandlerECS.c -o $(OBJDIR)/PacketHandlerECS.o $(INCDIRS_ECS) 111 | 112 | 113 | 114 | $(OBJDIR)/PacketHandlerPLS.o: $(SOURCES)/PacketHandlerPLS.c 115 | 116 | $(GCC) $(CFLAGS) -c $(SOURCES)/PacketHandlerPLS.c -o $(OBJDIR)/PacketHandlerPLS.o $(INCDIRS_PLS) 117 | 118 | 119 | 120 | $(OBJDIR)/PacketHandlerOMB.o: $(SOURCES)/PacketHandlerOMB.c 121 | 122 | $(GCC) $(CFLAGS) -c $(SOURCES)/PacketHandlerOMB.c -o $(OBJDIR)/PacketHandlerOMB.o $(INCDIRS_OMB) 123 | 124 | 125 | 126 | clean: 127 | 128 | rm $(OBJDIR)/*.o 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /examples/includes/App.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | 17 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 18 | 19 | *************************************************************************************** 20 | $Id: App.h 2608 2017-06-28 11:35:17Z AB $: 21 | 22 | Description: 23 | Application Demo header file 24 | 25 | Changes: 26 | Date Description 27 | ----------------------------------------------------------------------------------- 28 | 2017-06-28 initial version 29 | 30 | **************************************************************************************/ 31 | 32 | /*****************************************************************************/ 33 | /*! \file App.h 34 | * Application Demo header file */ 35 | /*****************************************************************************/ 36 | 37 | 38 | /*****************************************************************************/ 39 | /*! typedef */ 40 | /*****************************************************************************/ 41 | typedef struct APP_INPUT_DATA_Ttag { 42 | uint8_t abApp_Inputdata[10]; 43 | } APP_INPUT_DATA_T; 44 | 45 | 46 | typedef struct APP_OUTPUT_DATA_Ttag { 47 | uint8_t abApp_Outputdata[4]; 48 | } APP_OUTPUT_DATA_T; 49 | 50 | 51 | typedef struct APP_DATA_Ttag { 52 | int fRunning; 53 | 54 | CIFXHANDLE hChannel[1]; /* handle to channel */ 55 | CIFX_PACKET tPkt; /** Buffer for mailbox packets, dual usage send and receive */ 56 | uint32_t ulSendPktCnt; /** global send packet counter*/ 57 | 58 | APP_INPUT_DATA_T tInputData; 59 | APP_OUTPUT_DATA_T tOutputData; 60 | } APP_DATA_T; 61 | 62 | uint32_t Protocol_SendFirstPacket(APP_DATA_T *ptAppData); 63 | uint32_t Protocol_SendLastPacket(APP_DATA_T *ptAppData); 64 | uint32_t Protocol_PacketHandler( APP_DATA_T *ptAppData ); 65 | 66 | 67 | -------------------------------------------------------------------------------- /examples/includes/EtherCAT/EcatFoE_Public.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | 3 | Copyright (c) Hilscher GmbH. All Rights Reserved. 4 | 5 | ************************************************************************************** 6 | 7 | @version $Id: EcatFoE_Public.h 43169 2014-02-21 10:47:19Z Sven $ 8 | 9 | **************************************************************************************/ 10 | 11 | #ifndef __ECATFOE_PUBLIC_H 12 | #define __ECATFOE_PUBLIC_H 13 | 14 | #define ECAT_FOE_PROCESS_QUEUE_NAME "ECAT_FOE_QUE" 15 | 16 | #define ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ 0x9500 17 | #define ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF 0x9501 18 | 19 | #define ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ 0x9502 20 | #define ECAT_FOE_UNREGISTER_FILE_INDICATIONS_CNF 0x9503 21 | 22 | #define ECAT_FOE_WRITE_FILE_IND 0x9510 23 | #define ECAT_FOE_WRITE_FILE_RES 0x9511 24 | 25 | #define ECAT_FOE_READ_FILE_IND 0x9512 26 | #define ECAT_FOE_READ_FILE_RES 0x9513 27 | 28 | #define ECAT_FOE_FILE_WRITTEN_IND 0x9520 29 | #define ECAT_FOE_FILE_WRITTEN_RES 0x9521 30 | 31 | #define ECAT_FOE_FILE_WRITE_ABORTED_IND 0x9530 32 | #define ECAT_FOE_FILE_WRITE_ABORTED_RES 0x9531 33 | 34 | #define ECAT_FOE_MAX_FILE_NAME_LENGTH 256 35 | 36 | /****************************************************************************** 37 | * Packet: ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ/ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF 38 | */ 39 | 40 | #define ECAT_FOE_INDICATION_TYPE_FILE_WRITTEN 1 41 | #define ECAT_FOE_INDICATION_TYPE_ANY_FILE_WRITTEN 2 42 | #define ECAT_FOE_INDICATION_TYPE_VIRTUAL_FILE 3 43 | #define ECAT_FOE_INDICATION_TYPE_ANY_VIRTUAL_FILE 4 /* used for rcX File Handler */ 44 | #define ECAT_FOE_INDICATION_TYPE_ANY_FILE_WRITE_ABORTED 5 45 | 46 | /* request packet */ 47 | typedef __TLR_PACKED_PRE struct ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ_DATA_Ttag 48 | { 49 | TLR_UINT8 bIndicationType; 50 | TLR_STR abFilename[ECAT_FOE_MAX_FILE_NAME_LENGTH]; 51 | } __TLR_PACKED_POST ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ_DATA_T; 52 | 53 | typedef __TLR_PACKED_PRE struct ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ_Ttag 54 | { 55 | TLR_PACKET_HEADER_T tHead; 56 | ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ_DATA_T tData; 57 | } __TLR_PACKED_POST ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ_T; 58 | 59 | 60 | /* confirmation packet */ 61 | typedef __TLR_PACKED_PRE struct ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF_DATA_Ttag 62 | { 63 | TLR_UINT8 bIndicationType; 64 | TLR_STR abFilename[ECAT_FOE_MAX_FILE_NAME_LENGTH]; 65 | } __TLR_PACKED_POST ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF_DATA_T; 66 | 67 | typedef __TLR_PACKED_PRE struct ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF_Ttag 68 | { 69 | TLR_PACKET_HEADER_T tHead; 70 | ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF_DATA_T tData; 71 | } __TLR_PACKED_POST ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF_T; 72 | 73 | 74 | /* packet union */ 75 | typedef union ECAT_FOE_REGISTER_FILE_INDICATIONS_PCK_Ttag 76 | { 77 | TLR_PACKET_HEADER_T tHead; 78 | ECAT_FOE_REGISTER_FILE_INDICATIONS_REQ_T tReq; 79 | ECAT_FOE_REGISTER_FILE_INDICATIONS_CNF_T tCnf; 80 | } ECAT_FOE_REGISTER_FILE_INDICATIONS_PCK_T; 81 | 82 | 83 | /****************************************************************************** 84 | * Packet: ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ/ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ 85 | */ 86 | 87 | /* request packet */ 88 | typedef __TLR_PACKED_PRE struct ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ_DATA_Ttag 89 | { 90 | TLR_UINT8 bIndicationType; 91 | TLR_STR abFilename[ECAT_FOE_MAX_FILE_NAME_LENGTH]; 92 | } __TLR_PACKED_POST ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ_DATA_T; 93 | 94 | typedef __TLR_PACKED_PRE struct ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ_Ttag 95 | { 96 | TLR_PACKET_HEADER_T tHead; 97 | ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ_DATA_T tData; 98 | } __TLR_PACKED_POST ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ_T; 99 | 100 | 101 | /* confirmation packet */ 102 | typedef __TLR_PACKED_PRE struct ECAT_FOE_UNREGISTER_FILE_INDICATIONS_CNF_Ttag 103 | { 104 | TLR_PACKET_HEADER_T tHead; 105 | } __TLR_PACKED_POST ECAT_FOE_UNREGISTER_FILE_INDICATIONS_CNF_T; 106 | 107 | 108 | /* packet union */ 109 | typedef union ECAT_FOE_UNREGISTER_FILE_INDICATIONS_PCK_Ttag 110 | { 111 | TLR_PACKET_HEADER_T tHead; 112 | ECAT_FOE_UNREGISTER_FILE_INDICATIONS_REQ_T tReq; 113 | ECAT_FOE_UNREGISTER_FILE_INDICATIONS_CNF_T tCnf; 114 | } ECAT_FOE_UNREGISTER_FILE_INDICATIONS_PCK_T; 115 | 116 | 117 | /****************************************************************************** 118 | * Packet: ECAT_FOE_WRITE_FILE_IND/ECAT_FOE_WRITE_FILE_RES 119 | */ 120 | 121 | /* request packet */ 122 | typedef __TLR_PACKED_PRE struct ECAT_FOE_WRITE_FILE_IND_DATA_Ttag 123 | { 124 | TLR_UINT8 abData[1024]; /* may be larger depending on foreign queue size */ 125 | /* first packet contains password and filename in abData, following packets have data */ 126 | /* last segment is signaled when ulExt.Seq is set to LAST, can have zero bytes of data */ 127 | /* middle segment is signaled when ulExt.Seq is set to MIDDLE */ 128 | } __TLR_PACKED_POST ECAT_FOE_WRITE_FILE_IND_DATA_T; 129 | 130 | typedef __TLR_PACKED_PRE struct ECAT_FOE_WRITE_FILE_IND_Ttag 131 | { 132 | TLR_PACKET_HEADER_T tHead; 133 | ECAT_FOE_WRITE_FILE_IND_DATA_T tData; 134 | } __TLR_PACKED_POST ECAT_FOE_WRITE_FILE_IND_T; 135 | 136 | 137 | /* confirmation packet */ 138 | typedef __TLR_PACKED_PRE struct ECAT_FOE_WRITE_FILE_RES_DATA_Ttag 139 | { 140 | TLR_UINT8 abText[1024]; /* only valid when packet status != 0 */ 141 | } __TLR_PACKED_POST ECAT_FOE_WRITE_FILE_RES_DATA_T; 142 | 143 | typedef __TLR_PACKED_PRE struct ECAT_FOE_WRITE_FILE_RES_Ttag 144 | { 145 | TLR_PACKET_HEADER_T tHead; 146 | ECAT_FOE_WRITE_FILE_RES_DATA_T tData; 147 | } __TLR_PACKED_POST ECAT_FOE_WRITE_FILE_RES_T; 148 | 149 | 150 | /* packet union */ 151 | typedef union ECAT_FOE_WRITE_FILE_PCK_Ttag 152 | { 153 | TLR_PACKET_HEADER_T tHead; 154 | ECAT_FOE_WRITE_FILE_IND_T tInd; 155 | ECAT_FOE_WRITE_FILE_RES_T tRes; 156 | } ECAT_FOE_WRITE_FILE_PCK_T; 157 | 158 | 159 | /****************************************************************************** 160 | * Packet: ECAT_FOE_READ_FILE_IND/ECAT_FOE_READ_FILE_RES 161 | */ 162 | 163 | /* indication packet */ 164 | typedef __TLR_PACKED_PRE struct ECAT_FOE_READ_FILE_IND_DATA_Ttag 165 | { 166 | TLR_UINT32 ulMaximumByteSizeOfFragment; /* each packet fragment that is not marked LAST has to use this amount of data in its response handling */ 167 | /* on MIDDLE segments, the packet will have ulLen set to 4 */ 168 | TLR_UINT32 ulPassword; /* only valid on first fragment */ 169 | TLR_UINT8 abFilename[ECAT_FOE_MAX_FILE_NAME_LENGTH]; /* only valid on first fragment */ 170 | } __TLR_PACKED_POST ECAT_FOE_READ_FILE_IND_DATA_T; 171 | 172 | typedef __TLR_PACKED_PRE struct ECAT_FOE_READ_FILE_IND_Ttag 173 | { 174 | TLR_PACKET_HEADER_T tHead; 175 | ECAT_FOE_READ_FILE_IND_DATA_T tData; /* only valid on first fragment, following fragments have ulLen set to 0 */ 176 | } __TLR_PACKED_POST ECAT_FOE_READ_FILE_IND_T; 177 | 178 | 179 | /* response packet */ 180 | typedef __TLR_PACKED_PRE struct ECAT_FOE_READ_FILE_RES_DATA_Ttag 181 | { 182 | TLR_UINT8 abData[1600]; /* actual size depends on ulLen */ 183 | /* last segment is signaled when length is smaller than ulMaximumByteSizeOfFragment and it is expected to have ulExt.Seq set to LAST */ 184 | /* middle segment is signaled when length is equal to ulMaximumByteSizeOfFragment and it is expected to have ulExt.Seq set to MIDDLE */ 185 | 186 | /* in case of error, this field is used for communicating the error string */ 187 | } __TLR_PACKED_POST ECAT_FOE_READ_FILE_RES_DATA_T; 188 | 189 | typedef __TLR_PACKED_PRE struct ECAT_FOE_READ_FILE_RES_Ttag 190 | { 191 | TLR_PACKET_HEADER_T tHead; 192 | ECAT_FOE_READ_FILE_RES_DATA_T tData; 193 | } __TLR_PACKED_POST ECAT_FOE_READ_FILE_RES_T; 194 | 195 | 196 | /* packet union */ 197 | typedef union ECAT_FOE_READ_FILE_PCK_Ttag 198 | { 199 | TLR_PACKET_HEADER_T tHead; 200 | ECAT_FOE_READ_FILE_IND_T tInd; 201 | ECAT_FOE_READ_FILE_RES_T tRes; 202 | } ECAT_FOE_READ_FILE_PCK_T; 203 | 204 | 205 | /****************************************************************************** 206 | * Packet: ECAT_FOE_FILE_WRITTEN_IND/ECAT_FOE_FILE_WRITTEN_RES 207 | */ 208 | 209 | /* indication packet */ 210 | typedef __TLR_PACKED_PRE struct ECAT_FOE_FILE_WRITTEN_IND_DATA_Ttag 211 | { 212 | TLR_UINT8 abFilename[ECAT_FOE_MAX_FILE_NAME_LENGTH]; 213 | } __TLR_PACKED_POST ECAT_FOE_FILE_WRITTEN_IND_DATA_T; 214 | 215 | typedef __TLR_PACKED_PRE struct ECAT_FOE_FILE_WRITTEN_IND_Ttag 216 | { 217 | TLR_PACKET_HEADER_T tHead; 218 | ECAT_FOE_FILE_WRITTEN_IND_DATA_T tData; 219 | } __TLR_PACKED_POST ECAT_FOE_FILE_WRITTEN_IND_T; 220 | 221 | 222 | /* response packet */ 223 | typedef __TLR_PACKED_PRE struct ECAT_FOE_FILE_WRITTEN_RES_Ttag 224 | { 225 | TLR_PACKET_HEADER_T tHead; 226 | } __TLR_PACKED_POST ECAT_FOE_FILE_WRITTEN_RES_T; 227 | 228 | 229 | /* packet union */ 230 | typedef union ECAT_FOE_FILE_WRITTEN_PCK_Ttag 231 | { 232 | TLR_PACKET_HEADER_T tHead; 233 | ECAT_FOE_FILE_WRITTEN_IND_T tInd; 234 | ECAT_FOE_FILE_WRITTEN_RES_T tRes; 235 | } ECAT_FOE_FILE_WRITTEN_PCK_T; 236 | 237 | /****************************************************************************** 238 | * Packet: ECAT_FOE_FILE_WRITTE_ABORTED_IND/ECAT_FOE_FILE_WRITTE_ABORTED_RES 239 | */ 240 | 241 | /* indication packet */ 242 | typedef __TLR_PACKED_PRE struct ECAT_FOE_FILE_WRITE_ABORTED_IND_DATA_Ttag 243 | { 244 | TLR_UINT8 abFilename[ECAT_FOE_MAX_FILE_NAME_LENGTH]; 245 | } __TLR_PACKED_POST ECAT_FOE_FILE_WRITE_ABORTED_IND_DATA_T; 246 | 247 | typedef __TLR_PACKED_PRE struct ECAT_FOE_FILE_WRITE_ABORTED_IND_Ttag 248 | { 249 | TLR_PACKET_HEADER_T tHead; 250 | ECAT_FOE_FILE_WRITE_ABORTED_IND_DATA_T tData; 251 | } __TLR_PACKED_POST ECAT_FOE_FILE_WRITE_ABORTED_IND_T; 252 | 253 | 254 | /* response packet */ 255 | typedef __TLR_PACKED_PRE struct ECAT_FOE_FILE_WRITE_ABORTED_RES_Ttag 256 | { 257 | TLR_PACKET_HEADER_T tHead; 258 | } __TLR_PACKED_POST ECAT_FOE_FILE_WRITE_ABORTED_RES_T; 259 | 260 | 261 | /* packet union */ 262 | typedef union ECAT_FOE_FILE_WRITE_ABORTED_PCK_Ttag 263 | { 264 | TLR_PACKET_HEADER_T tHead; 265 | ECAT_FOE_FILE_WRITE_ABORTED_IND_T tInd; 266 | ECAT_FOE_FILE_WRITE_ABORTED_RES_T tRes; 267 | } ECAT_FOE_FILE_WRITE_ABORTED_PCK_T; 268 | 269 | 270 | #endif //__ECATFOE_PUBLIC_H 271 | -------------------------------------------------------------------------------- /examples/includes/EtherCAT/OdV3_Defines.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: OdV3_Defines.h 62201 2016-07-14 09:45:18Z Sven $: 5 | 6 | 7 | Changes: 8 | Date Description 9 | ----------------------------------------------------------------------------------- 10 | yyyy-mm-dd created 11 | **************************************************************************************/ 12 | 13 | #ifndef _ODV3_DEFINES_H 14 | #define _ODV3_DEFINES_H 15 | 16 | 17 | /****************************************************************************** 18 | * Access flags 19 | * usAccessFlags field 20 | */ 21 | #define ODV3_ACCESS_FLAGS_SUBINDEX_0_WRITE_0_FIRST 0x0200 /* on writing all subindexes starting from subindex 0, write 0 to subindex 0 first */ 22 | #define ODV3_ACCESS_FLAGS_CREATE_SUBINDEX_0 0x0400 /* only on indexed objects, uses simple var bValueInfo fields (uses data type ODV3_DATATYPE_UNSIGNED8) */ 23 | #define ODV3_ACCESS_FLAGS_FORCE_INDEXED 0x0800 24 | #define ODV3_ACCESS_FLAGS_RXPDO_MAPPABLE 0x1000 25 | #define ODV3_ACCESS_FLAGS_TXPDO_MAPPABLE 0x2000 26 | #define ODV3_ACCESS_FLAGS_BACKUP 0x4000 27 | #define ODV3_ACCESS_FLAGS_SETTINGS 0x8000 28 | 29 | /****************************************************************************** 30 | * Value Info 31 | * bValueInfo field 32 | */ 33 | #define ODV3_VALUE_INFO_NAME 0x01 34 | #define ODV3_VALUE_INFO_INITIAL_VALUE 0x02 35 | #define ODV3_VALUE_INFO_VIRTUAL 0x04 /* make object/subobject virtual */ 36 | #define ODV3_VALUE_INFO_ECAT_UNIT 0x08 /* EtherCAT only */ 37 | #define ODV3_VALUE_INFO_DEFAULT_VALUE 0x10 38 | #define ODV3_VALUE_INFO_MINIMUM 0x20 39 | #define ODV3_VALUE_INFO_MAXIMUM 0x40 40 | #define ODV3_VALUE_INFO_VARIABLE_SIZE_VALUE 0x80 41 | 42 | /****************************************************************************** 43 | * Needed Data type definitions 44 | */ 45 | #define ODV3_DATATYPE_UNSIGNED8 0x0005 46 | 47 | /****************************************************************************** 48 | * Object Code definitions 49 | */ 50 | #define ODV3_OBJCODE_DOMAIN 0x02 51 | #define ODV3_OBJCODE_DEFTYPE 0x05 52 | #define ODV3_OBJCODE_DEFSTRUCT 0x06 53 | #define ODV3_OBJCODE_VAR 0x07 54 | #define ODV3_OBJCODE_ARRAY 0x08 55 | #define ODV3_OBJCODE_RECORD 0x09 56 | 57 | /****************************************************************************** 58 | * Multiple Parameter read/write access flags 59 | * bMultipleParaAccessFlags field 60 | */ 61 | #define ODV3_MULTIPLE_PARA_ACCESS_ALL_INDEXES 0x01 /* access all index starting at bSubIndex (0 or 1 allowed) (reserved for read/write multiple parameter) */ 62 | #define ODV3_MULTIPLE_PARA_ACCESS_BIT_TYPES_BIT_ALIGNED 0x02 /* access to bit types will be placed at bit boundaries */ 63 | #define ODV3_MULTIPLE_PARA_ACCESS_WRITE_SI0_TO_0_FIRST 0x04 /* write subindex 0 to zero first and final value as last transfer, object properties can enable it without having been set here */ 64 | #define ODV3_MULTIPLE_PARA_ACCESS_SUBINDEX_0_PADDED_TO_U16 0x08 /* on reading and writing all indexes, the subindex 0 is padded to 16bit integer (when object is not SimpleVar) */ 65 | #define ODV3_MULTIPLE_PARA_ACCESS_USE_NUM_SUBOBJS_ON_READ 0x10 /* read objects based on number of sub objects instead max of sub objects */ 66 | #define ODV3_MULTIPLE_PARA_ACCESS_EVAL_SUBINDEX_0_ON_WRITE 0x10 /* on writing all by indexes, subindex 0 will be evaluated if transferred */ 67 | #define ODV3_MULTIPLE_PARA_ACCESS_CHECK_ACCESS_RIGHTS 0x20 /* check access rights */ 68 | #define ODV3_MULTIPLE_PARA_ACCESS_REQUIRE_ALL_ACCESSIBLE 0x40 /* require all to be accessible by access rights when ODV3_MULTIPLE_PARA_ACCESS_CHECK_ACCESS_RIGHTS is set */ 69 | 70 | /****************************************************************************** 71 | * GetSubObjectInfo.ValueInfo 72 | */ 73 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_NAME 0x01 74 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_ECAT_UNIT 0x10 75 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_DEFAULT_VALUE 0x20 76 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_MINIMUM_VALUE 0x40 /* always uses max length */ 77 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_MAXIMUM_VALUE 0x80 /* always uses max length */ 78 | 79 | /****************************************************************************** 80 | * GetObjectProperties.Flags 81 | */ 82 | #define ODV3_OBJECT_PROP_FLAG_ALL_INDEXES_ARE_FIXED_SIZE 0x00000001 83 | #define ODV3_OBJECT_PROP_FLAG_IS_INDEXED 0x00000002 /* is not a simple variable */ 84 | #define ODV3_OBJECT_PROP_FLAG_WRITE_SI0_TO_0_FIRST_REQUIRED 0x00000004 /* require ODV3_MULTIPLE_PARA_ACCESS_WRITE_SI0_TO_0_FIRST, setting this bit will set the actual transfer control bit */ 85 | 86 | /****************************************************************************** 87 | * special value for ulTotalDataBytes in Write Requests 88 | */ 89 | #define ODV3_WRITE_OBJECT_TOTAL_DATA_BYTES_NOT_SPECIFIED 0xFFFFFFFF 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/EipAps_Public.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/examples/includes/EtherNetIP/EipAps_Public.h -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/EipAps_error.h: -------------------------------------------------------------------------------- 1 | #ifndef __EIP_APS_ERROR_H 2 | #define __EIP_APS_ERROR_H 3 | 4 | ///////////////////////////////////////////////////////////////////////////////////// 5 | // Ethernet/IP Application Task 6 | ///////////////////////////////////////////////////////////////////////////////////// 7 | // 8 | // MessageId: TLR_E_EIP_APS_COMMAND_INVALID 9 | // 10 | // MessageText: 11 | // 12 | // Invalid command received. 13 | // 14 | #define TLR_E_EIP_APS_COMMAND_INVALID ((TLR_RESULT)0xC0590001L) 15 | 16 | // 17 | // MessageId: TLR_E_EIP_APS_PACKET_LENGTH_INVALID 18 | // 19 | // MessageText: 20 | // 21 | // Invalid packet length. 22 | // 23 | #define TLR_E_EIP_APS_PACKET_LENGTH_INVALID ((TLR_RESULT)0xC0590002L) 24 | 25 | // 26 | // MessageId: TLR_E_EIP_APS_PACKET_PARAMETER_INVALID 27 | // 28 | // MessageText: 29 | // 30 | // Parameter of the packet are invalid. 31 | // 32 | #define TLR_E_EIP_APS_PACKET_PARAMETER_INVALID ((TLR_RESULT)0xC0590003L) 33 | 34 | // 35 | // MessageId: TLR_E_EIP_APS_TCP_CONFIG_FAIL 36 | // 37 | // MessageText: 38 | // 39 | // Configuration of TCP/IP failed. 40 | // 41 | #define TLR_E_EIP_APS_TCP_CONFIG_FAIL ((TLR_RESULT)0xC0590004L) 42 | 43 | // 44 | // MessageId: TLR_E_EIP_APS_CONNECTION_CLOSED 45 | // 46 | // MessageText: 47 | // 48 | // Existing connection is closed. 49 | // 50 | #define TLR_E_EIP_APS_CONNECTION_CLOSED ((TLR_RESULT)0xC0590005L) 51 | 52 | // 53 | // MessageId: TLR_E_EIP_APS_ALREADY_REGISTERED 54 | // 55 | // MessageText: 56 | // 57 | // A application is already registered. 58 | // 59 | #define TLR_E_EIP_APS_ALREADY_REGISTERED ((TLR_RESULT)0xC0590006L) 60 | 61 | // 62 | // MessageId: TLR_E_EIP_APS_ACCESS_FAIL 63 | // 64 | // MessageText: 65 | // 66 | // Command is not allowed. 67 | // 68 | #define TLR_E_EIP_APS_ACCESS_FAIL ((TLR_RESULT)0xC0590007L) 69 | 70 | // 71 | // MessageId: TLR_E_EIP_APS_STATE_FAIL 72 | // 73 | // MessageText: 74 | // 75 | // Command not allowed at this state. 76 | // 77 | #define TLR_E_EIP_APS_STATE_FAIL ((TLR_RESULT)0xC0590008L) 78 | 79 | // 80 | // MessageId: TLR_E_EIP_APS_IO_OFFSET_INVALID 81 | // 82 | // MessageText: 83 | // 84 | // Invalid offset for I/O data. 85 | // 86 | #define TLR_E_EIP_APS_IO_OFFSET_INVALID ((TLR_RESULT)0xC0590009L) 87 | 88 | // 89 | // MessageId: TLR_E_EIP_APS_FOLDER_NOT_FOUND 90 | // 91 | // MessageText: 92 | // 93 | // Folder for database not found. 94 | // 95 | #define TLR_E_EIP_APS_FOLDER_NOT_FOUND ((TLR_RESULT)0xC059000AL) 96 | 97 | // 98 | // MessageId: TLR_E_EIP_APS_CONFIG_DBM_INVALID 99 | // 100 | // MessageText: 101 | // 102 | // Configuration database invalid. 103 | // 104 | #define TLR_E_EIP_APS_CONFIG_DBM_INVALID ((TLR_RESULT)0xC059000BL) 105 | 106 | // 107 | // MessageId: TLR_E_EIP_APS_NO_CONFIG_DBM 108 | // 109 | // MessageText: 110 | // 111 | // Configuration database not found. 112 | // 113 | #define TLR_E_EIP_APS_NO_CONFIG_DBM ((TLR_RESULT)0xC059000CL) 114 | 115 | // 116 | // MessageId: TLR_E_EIP_APS_NWID_DBM_INVALID 117 | // 118 | // MessageText: 119 | // 120 | // network database invalid. 121 | // 122 | #define TLR_E_EIP_APS_NWID_DBM_INVALID ((TLR_RESULT)0xC059000DL) 123 | 124 | // 125 | // MessageId: TLR_E_EIP_APS_NO_NWID_DBM 126 | // 127 | // MessageText: 128 | // 129 | // network database not found. 130 | // 131 | #define TLR_E_EIP_APS_NO_NWID_DBM ((TLR_RESULT)0xC059000EL) 132 | 133 | // 134 | // MessageId: TLR_E_EIP_APS_NO_DBM 135 | // 136 | // MessageText: 137 | // 138 | // no database found. 139 | // 140 | #define TLR_E_EIP_APS_NO_DBM ((TLR_RESULT)0xC059000FL) 141 | 142 | // 143 | // MessageId: TLR_E_EIP_APS_NO_MAC_ADDRESS_AVAILABLE 144 | // 145 | // MessageText: 146 | // 147 | // no MAC address available. 148 | // 149 | #define TLR_E_EIP_APS_NO_MAC_ADDRESS_AVAILABLE ((TLR_RESULT)0xC0590010L) 150 | 151 | // 152 | // MessageId: TLR_E_EIP_APS_INVALID_FILESYSTEM 153 | // 154 | // MessageText: 155 | // 156 | // access to file system failed. 157 | // 158 | #define TLR_E_EIP_APS_INVALID_FILESYSTEM ((TLR_RESULT)0xC0590011L) 159 | 160 | // 161 | // MessageId: TLR_E_EIP_APS_NUM_AS_INSTANCE_EXCEEDS 162 | // 163 | // MessageText: 164 | // 165 | // maximum number of assembly instances exceeds. 166 | // 167 | #define TLR_E_EIP_APS_NUM_AS_INSTANCE_EXCEEDS ((TLR_RESULT)0xC0590012L) 168 | 169 | // 170 | // MessageId: TLR_E_EIP_APS_CONFIGBYDATABASE 171 | // 172 | // MessageText: 173 | // 174 | // stack is already configured via database. 175 | // 176 | #define TLR_E_EIP_APS_CONFIGBYDATABASE ((TLR_RESULT)0xC0590013L) 177 | 178 | 179 | 180 | 181 | #endif //__EIP_APS_ERROR_H 182 | 183 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/cip_as.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of EtherNet/IP Assembly Object 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2014-01-16 RH Created 20 | **************************************************************************************/ 21 | #ifndef CIP_AS_H 22 | #define CIP_AS_H 23 | 24 | #include 25 | 26 | /*#####################################################################################*/ 27 | 28 | /* 29 | ************************************************************ 30 | * Object specific defines 31 | ************************************************************ 32 | */ 33 | 34 | #define CIP_AS_CLASS_NUMBER 0x04 35 | #define CIP_AS_REVISION 0x02 36 | #define CIP_AS_MAX_INSTANCE 0xFFFFF 37 | #define CIP_AS_MAX_CLASS_ATTR 7 38 | #define CIP_AS_MAX_INSTANCE_ATTR 7 39 | 40 | 41 | /* attributes of identity object */ 42 | #define CIP_AS_ATTR_1_NUM_MEMBER 1 43 | #define CIP_AS_ATTR_2_MEMBER_LIST 2 44 | #define CIP_AS_ATTR_3_DATA 3 45 | #define CIP_AS_ATTR_4_SIZE 4 46 | 47 | #define CIP_AS_ATTR_300_MEMBER_DATA_LIST 300 48 | #define CIP_AS_ATTR_301_PARAMETER 301 49 | #define CIP_AS_ATTR_302_STATUS 302 50 | 51 | #define CIP_AS_MAX_MEMBER_PATH_SIZE 9 /* 3 segments a 9 bytes (support of 16bit segments) */ 52 | 53 | #define CIPHIL_CMD_AS_CREATE 0x0401 54 | #define CIPHIL_CMD_AS_DELETE 0x0402 55 | #define CIPHIL_CMD_AS_ADD_MEMBER 0x0403 56 | #define CIPHIL_CMD_AS_DEL_MEMBER 0x0404 57 | #define CIPHIL_CMD_AS_UPDATE_CONSUMING 0x0405 /* update consuming data to host application */ 58 | #define CIPHIL_CMD_AS_UPDATE_PRODUCING 0x0406 /* update producing data to host application */ 59 | #define CIPHIL_CMD_AS_GET_CONSUMING 0x0407 /* get consuming data from bus */ 60 | #define CIPHIL_CMD_AS_BIND 0x0408 /* bind assembly to a connection */ 61 | #define CIPHIL_CMD_AS_UNBIND 0x0409 /* unbind assembly to a connection */ 62 | #define CIPHIL_CMD_AS_CHANGE_RUNIDLE 0x040A /* Change state of assembly to RUN or IDLE */ 63 | 64 | #define CIP_AS_PARAM_FIX_SIZE 0x0001 65 | #define CIP_AS_PARAM_TYPE_MSK 0xF000 66 | #define CIP_AS_PARAM_TYPE_CONSUMER 0x0000 67 | #define CIP_AS_PARAM_TYPE_PRODUCER 0x1000 68 | #define CIP_AS_PARAM_TYPE_HB_LISTENONLY 0x2000 69 | #define CIP_AS_PARAM_TYPE_HB_INPUTONLY 0x3000 70 | #define CIP_AS_PARAM_TYPE_CONFIG 0x4000 71 | #define CIP_AS_PARAM_RT_FORMAT_MSK 0x0F00 72 | #define CIP_AS_PARAM_RT_FORMAT_PURE 0x0000 73 | #define CIP_AS_PARAM_RT_FORMAT_NULL 0x0100 74 | #define CIP_AS_PARAM_RT_FORMAT_HB 0x0300 75 | #define CIP_AS_PARAM_RT_FORMAT_RUNIDLE 0x0400 76 | #define CIP_AS_PARAM_RT_FORMAT_SAFETY 0x0500 77 | 78 | /*#####################################################################################*/ 79 | 80 | /* 81 | ************************************************************ 82 | * Object specific types 83 | ************************************************************ 84 | */ 85 | 86 | #pragma pack(1) 87 | 88 | 89 | typedef __PACKED_PRE struct CIPHIL_AS_RUNIDLE_REQ_Ttag 90 | { 91 | #define CIP_AS_IDLE 0x00 92 | #define CIP_AS_RUN 0x01 93 | 94 | uint8_t bRunIdle; 95 | 96 | }__PACKED_POST CIPHIL_AS_RUNIDLE_REQ_T; 97 | 98 | 99 | /*#####################################################################################*/ 100 | 101 | typedef void (* CIP_AS_EVENT_UPDATE_CB)( void* pvHandle, 102 | uint8_t* pbData, 103 | uint16_t usDataLen ); 104 | 105 | typedef __PACKED_PRE struct CIPHIL_AS_BIND_REQ_Ttag 106 | { 107 | void* pvHandle; /* Handle to the connection */ 108 | CIP_AS_EVENT_UPDATE_CB fnUpdate; /* Update function for process data . Used only for producing assemblies. */ 109 | uint16_t usParam; /* CIP_AS_PARAM_TYPE_... */ 110 | uint16_t usSize; /* Connection size for the assembly as requested from the network (including sequence count and run/idle size). */ 111 | }__PACKED_POST CIPHIL_AS_BIND_REQ_T; 112 | 113 | /*#####################################################################################*/ 114 | 115 | typedef __PACKED_PRE struct CIPHIL_AS_CREATE_REQ_Ttag 116 | { 117 | uint32_t ulInstanceId; 118 | uint16_t usMinSize; 119 | uint16_t usMaxSize; 120 | uint16_t usParam; 121 | }__PACKED_POST CIPHIL_AS_CREATE_REQ_T; 122 | 123 | /*#####################################################################################*/ 124 | 125 | typedef __PACKED_PRE struct CIPHIL_AS_ADD_MEMBER_REQ_Ttag 126 | { 127 | uint16_t usDataSize; 128 | uint16_t usPathSize; 129 | uint8_t abPath[CIP_AS_MAX_MEMBER_PATH_SIZE]; 130 | }__PACKED_POST CIPHIL_AS_ADD_MEMBER_REQ_T; 131 | 132 | /*#####################################################################################*/ 133 | 134 | typedef __PACKED_PRE struct CIPHIL_AS_DEL_MEMBER_REQ_Ttag 135 | { 136 | uint16_t usPathSize; 137 | uint8_t abPath[CIP_AS_MAX_MEMBER_PATH_SIZE]; 138 | }__PACKED_POST CIPHIL_AS_DEL_MEMBER_REQ_T; 139 | 140 | #pragma pack(0) 141 | 142 | /*#####################################################################################*/ 143 | 144 | typedef struct CIP_AS_CLASS_ATTR_Ttag 145 | { 146 | uint16_t usRevision; /* 1 */ 147 | uint16_t usMaxInstance; /* 2 */ 148 | uint16_t usNumInstance; /* 3 */ 149 | uint16_t usMaxClassAttr; /* 6 */ 150 | uint16_t usMaxInstanceAttr; /* 7 */ 151 | } CIP_AS_CLASS_ATTR_T; 152 | 153 | /*#####################################################################################*/ 154 | 155 | 156 | #pragma pack(1) 157 | typedef __PACKED_PRE struct CIP_AS_MEMBER_LIST_ENTRY_Ttag 158 | { 159 | uint16_t usDataSize; 160 | uint16_t usPathSize; 161 | uint8_t abPath[CIP_AS_MAX_MEMBER_PATH_SIZE]; 162 | }__PACKED_POST CIP_AS_MEMBER_LIST_ENTRY_T; 163 | #pragma pack(0) 164 | 165 | /*#####################################################################################*/ 166 | 167 | /* 168 | **************************************************************************** 169 | * Object specific macros 170 | **************************************************************************** 171 | */ 172 | 173 | 174 | /*#####################################################################################*/ 175 | 176 | /* 177 | ************************************************************ 178 | * Task Function Prototypes 179 | ************************************************************ 180 | */ 181 | 182 | typedef struct CIP_AS_INIT_PARAM_Ttag 183 | { 184 | uint16_t usMaxInstance; /* maximal number of assemblies */ 185 | uint16_t usMaxMembers; /* maximal number of members (sum of all members) */ 186 | uint16_t usMaxConnections; /* maximal number of IO connections */ 187 | }CIP_AS_INIT_PARAM_T; 188 | 189 | 190 | uint32_t 191 | CipAs_ObjectCreate( void* pvRsc, 192 | CIP_AS_INIT_PARAM_T* ptParam ); 193 | 194 | #endif /* CIP_AS_H */ 195 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/cip_id.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of CIP Identity Object 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2013-11-12 RH Created 20 | **************************************************************************************/ 21 | #ifndef CIP_ID_H 22 | #define CIP_ID_H 23 | 24 | #include 25 | 26 | 27 | /*#####################################################################################*/ 28 | 29 | /* 30 | ************************************************************ 31 | * Object specific defines 32 | ************************************************************ 33 | */ 34 | 35 | #define CIP_ID_SERIAL_NUMBER 0x12345678L 36 | #define CIP_ID_CLASS_NUMBER 0x01 37 | #define CIP_ID_REVISION 0x01 38 | #define CIP_ID_MAX_INSTANCE 0x01 39 | #define CIP_ID_MAX_CLASS_ATTR 7 40 | #define CIP_ID_MAX_INSTANCE_ATTR 10 41 | 42 | #define CIP_ID_MAX_PRODUKTNAME_LEN 32 43 | 44 | /* 45 | ** State defines 46 | */ 47 | 48 | #define CIP_ID_STATE_NONEXISTENT 0 49 | #define CIP_ID_STATE_DEVICESELFTEST 1 50 | #define CIP_ID_STATE_STANDBY 2 51 | #define CIP_ID_STATE_OPERATIONAL 3 52 | #define CIP_ID_STATE_MAJRECOVERFLT 4 53 | #define CIP_ID_STATE_MAJUNRECOVERFLT 5 54 | #define CIP_ID_STATE_DEFAULT 255 55 | 56 | /* 57 | ** Defines of the status bits 58 | */ 59 | 60 | #define CIP_ID_STATUS_OWNED_MASK 0x0001 61 | #define CIP_ID_STATUS_OWNED 0x0001 62 | #define CIP_ID_STATUS_UNOWNED 0x0000 63 | 64 | #define CIP_ID_STATUS_CONFIGURED_MASK 0x0004 65 | #define CIP_ID_STATUS_UNCONFIGURED 0x0000 66 | #define CIP_ID_STATUS_CONFIGURED 0x0004 67 | 68 | /* Device state bits.*/ 69 | #define CIP_ID_STATUS_STATE_MASK 0x00F0 70 | #define CIP_ID_STATUS_SELF_TESTING 0x0000 71 | #define CIP_ID_STATUS_NVS_UPDATE 0x0010 72 | #define CIP_ID_STATUS_COMM_FAULT 0x0020 73 | #define CIP_ID_STATUS_AWAIT_CONN 0x0030 74 | #define CIP_ID_STATUS_NVS_BAD_CONFIG 0x0040 75 | #define CIP_ID_STATUS_MAJOR_FAULT 0x0050 76 | #define CIP_ID_STATUS_CONNECTED 0x0060 77 | #define CIP_ID_STATUS_IDLE 0x0070 78 | #define CIP_ID_STATUS_IP_ADDRESS 0x0080 79 | #define CIP_ID_STATUS_IP_ADDRESS_CONFLICT 0x0090 80 | 81 | /* Fault bits.*/ 82 | #define CIP_ID_STATUS_FAULT_MASK 0x0F00 83 | #define CIP_ID_STATUS_MINOR_RECOVERABLE_FAULT 0x0100 84 | #define CIP_ID_STATUS_MINOR_UNRECOVERABLE_FAULT 0x0200 85 | #define CIP_ID_STATUS_MAJOR_RECOVERABLE_FAULT 0x0400 86 | #define CIP_ID_STATUS_MAJOR_UNRECOVERABLE_FAULT 0x0800 87 | 88 | /* attributes of identity object */ 89 | #define CIP_ID_ATTR_1_VENDOR_ID 1 90 | #define CIP_ID_ATTR_2_DEVICE_TYPE 2 91 | #define CIP_ID_ATTR_3_PRODUCT_CODE 3 92 | #define CIP_ID_ATTR_4_REVISION 4 93 | #define CIP_ID_ATTR_5_STATUS 5 94 | #define CIP_ID_ATTR_6_SERIAL_NUMBER 6 95 | #define CIP_ID_ATTR_7_PRODUCT_NAME 7 96 | #define CIP_ID_ATTR_8_STATE 8 97 | #define CIP_ID_ATTR_9_CFG_CONSIST_VALUE 9 98 | #define CIP_ID_ATTR_10_HEARTBEAT_INTERVAL 10 99 | 100 | /*#####################################################################################*/ 101 | 102 | /* 103 | ************************************************************ 104 | * Object specific types 105 | ************************************************************ 106 | */ 107 | 108 | typedef struct CIP_ID_CLASS_ATTR_Ttag 109 | { 110 | uint16_t usRevision; 111 | uint16_t usMaxInstance; 112 | uint16_t usMaxClassAttr; 113 | uint16_t usMaxInstanceAttr; 114 | uint16_t usNumInstance; 115 | } CIP_ID_CLASS_ATTR_T; 116 | 117 | /*#####################################################################################*/ 118 | 119 | #pragma pack(1) 120 | 121 | typedef __PACKED_PRE struct CIP_ID_INST_ATTR_Ttag 122 | { 123 | uint16_t usVendor; 124 | uint16_t usProductType; 125 | uint16_t usProductCode; 126 | struct 127 | { 128 | uint8_t bMajorRevision; 129 | uint8_t bMinorRevision; 130 | } tRevision; 131 | uint16_t usStatus; 132 | uint32_t ulSerialNumber; 133 | uint8_t abProductName[CIP_ID_MAX_PRODUKTNAME_LEN]; 134 | uint8_t abReserved[4]; /* reserved for get attribute all */ 135 | uint8_t bState; 136 | uint16_t usConfigConsistent; 137 | uint8_t bHeartBeatInterval; 138 | }__PACKED_POST CIP_ID_INST_ATTR_T; 139 | 140 | #pragma pack() 141 | 142 | /*#####################################################################################*/ 143 | 144 | typedef struct CIP_IDENTITY_Ttag 145 | { 146 | CIP_ID_CLASS_ATTR_T tClass; 147 | CIP_ID_INST_ATTR_T atInstance[1]; 148 | 149 | }CIP_IDENTITY_T; 150 | 151 | /*#####################################################################################*/ 152 | 153 | /* 154 | **************************************************************************** 155 | * Object specific macros 156 | **************************************************************************** 157 | */ 158 | #define CIPID_STATUS_MODIFY_OWNED( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x0001, value ); 159 | #define CIPID_STATUS_MODIFY_CONFIGURED( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x0004, value ); 160 | #define CIPID_STATUS_MODIFY_EXTDEVSTATUS( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x00F0, value ); 161 | #define CIPID_STATUS_MODIFY_MINORRECOV( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x0100, value ); 162 | #define CIPID_STATUS_MODIFY_MINORUNRECOV( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x0200, value ); 163 | #define CIPID_STATUS_MODIFY_MAJORRECOV( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x0400, value ); 164 | #define CIPID_STATUS_MODIFY_MAJORUNRECOV( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0x0800, value ); 165 | #define CIPID_STATUS_MODIFY_EXTDEVSTAT2( pvObjDir, value ) CipId_ModifyStatus( pvObjDir, 0xF000, value ); 166 | 167 | /*#####################################################################################*/ 168 | 169 | /* 170 | ************************************************************ 171 | * Task Function Prototypes 172 | ************************************************************ 173 | */ 174 | 175 | /** Short function description. 176 | * 177 | * \param pvRsc [in] Description 178 | * 179 | * \return Description of return value, if any 180 | */ 181 | uint32_t 182 | CipId_ObjectCreate( void* pvRsc ); 183 | 184 | 185 | /*#####################################################################################*/ 186 | 187 | /** Short function description. 188 | * 189 | * \param pvObjDir [in] Description 190 | * \param usMask [in] Description 191 | * \param usValue [in] Description 192 | * 193 | * \return Description of return value, if any 194 | */ 195 | void 196 | CipId_ModifyStatus( void* pvObjDir, 197 | uint16_t usMask, 198 | uint16_t usValue ); 199 | 200 | 201 | /*#####################################################################################*/ 202 | 203 | /** Short function description. 204 | * 205 | * \param pvObjDir [in] Description 206 | * \param bState [in] Description 207 | * 208 | * \return Description of return value, if any 209 | */ 210 | void 211 | CipId_SetState( void* pvObjDir, 212 | uint8_t bState ); 213 | 214 | /*#####################################################################################*/ 215 | 216 | #endif /* CIP_ID_H */ 217 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/cip_io.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of CIP Hischer Object Predefined Connections 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2013-11-12 RH Created 20 | **************************************************************************************/ 21 | #ifndef CIP_IO_H 22 | #define CIP_IO_H 23 | 24 | #include 25 | 26 | 27 | /*#####################################################################################*/ 28 | 29 | /* 30 | ************************************************************ 31 | * Object specific defines 32 | ************************************************************ 33 | */ 34 | 35 | 36 | #define CIP_IO_CLASS_NUMBER 0x402 37 | #define CIP_IO_REVISION 0x01 38 | #define CIP_IO_MAX_INSTANCE 0x01 39 | #define CIP_IO_MAX_CLASS_ATTR 7 40 | #define CIP_IO_MAX_INSTANCE_ATTR 10 41 | 42 | /* attributes of predefined connection object */ 43 | #define CIP_IO_ATTR_1_STATUS 1 44 | #define CIP_IO_ATTR_2_LEN 2 45 | #define CIP_IO_ATTR_3_DATA 3 46 | 47 | #define CIPHIL_IO_CMD_CREATE_MEMBER 0xFF01 48 | #define CIPHIL_IO_CMD_DELETE_MEMBER 0xFF02 49 | 50 | /*#####################################################################################*/ 51 | 52 | /* 53 | ************************************************************ 54 | * Object specific types 55 | ************************************************************ 56 | */ 57 | #pragma pack(1) 58 | typedef __PACKED_PRE struct CIP_IO_CREATE_MEMBER_REQ_Ttag 59 | { 60 | uint16_t usDataLen; 61 | uint8_t *pbData; 62 | 63 | uint8_t bDirection; 64 | #define CIP_IO_DIRECTION_PRODUCER 0x01 65 | #define CIP_IO_DIRECTION_CONSUMER 0x02 66 | 67 | }__PACKED_POST CIP_IO_CREATE_MEMBER_REQ_T; 68 | 69 | #pragma pack(0) 70 | 71 | /*#####################################################################################*/ 72 | 73 | typedef struct CIP_IO_CLASS_ATTR_Ttag 74 | { 75 | uint16_t usRevision; 76 | uint16_t usMaxInstance; 77 | uint16_t usMaxClassAttr; 78 | uint16_t usMaxInstanceAttr; 79 | uint16_t usNumInstance; 80 | } CIP_IO_CLASS_ATTR_T; 81 | 82 | /*#####################################################################################*/ 83 | 84 | #pragma pack(1) 85 | 86 | typedef __PACKED_PRE struct CIP_IO_INST_ATTR_Ttag 87 | { 88 | uint16_t usStatus; 89 | #define CIP_IO_STATUS_PRODUCER 0x01 90 | #define CIP_IO_STATUS_CONSUMER 0x02 91 | #define CIP_IO_STATUS_CONNECTED 0x10 92 | 93 | uint16_t usDataLen; 94 | uint8_t* pbData; 95 | }__PACKED_POST CIP_IO_INST_ATTR_T; 96 | #pragma pack() 97 | 98 | /*#####################################################################################*/ 99 | 100 | typedef struct CIP_IO_Ttag 101 | { 102 | CIP_IO_CLASS_ATTR_T tClass; 103 | CIP_IO_INST_ATTR_T* patInstance; 104 | }CIP_IO_T; 105 | 106 | /*#####################################################################################*/ 107 | 108 | /* 109 | **************************************************************************** 110 | * Object specific macros 111 | **************************************************************************** 112 | */ 113 | 114 | 115 | /*#####################################################################################*/ 116 | 117 | /* 118 | ************************************************************ 119 | * Task Function Prototypes 120 | ************************************************************ 121 | */ 122 | 123 | typedef struct CIP_IO_INIT_PARAM_Ttag 124 | { 125 | uint16_t usMaxInstance; 126 | }CIP_IO_INIT_PARAM_T; 127 | 128 | uint32_t 129 | CipIO_ObjectCreate( void* pvRsc, 130 | CIP_IO_INIT_PARAM_T* ptParam ); 131 | 132 | #endif /* CIP_IO_H */ 133 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/cip_mr.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of EtherNet/IP Message Router Object 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2013-11-12 RH Created 20 | **************************************************************************************/ 21 | #ifndef CIP_MR_H 22 | #define CIP_MR_H 23 | 24 | #include 25 | 26 | 27 | /*#####################################################################################*/ 28 | 29 | #define CIP_MR_MAX_SERVICES 10 /* number of parallel CIP services */ 30 | 31 | 32 | /************************************************************ 33 | * Object specific defines 34 | ************************************************************ 35 | */ 36 | #define CIP_MR_CLASS_NUMBER 0x02 37 | #define CIP_MR_REVISION 1 38 | #define CIP_MR_MAX_INSTANCE 1 39 | #define CIP_MR_MAX_CLASS_ATTR 7 40 | #define CIP_MR_MAX_INSTANCE_ATTR 0 41 | 42 | #define CIP_CMD_SYMBOLIC_TRANSLATION ( 0x4B ) 43 | 44 | 45 | /*#####################################################################################*/ 46 | 47 | typedef void(*CIP_MR_SENDRESP_FUNC)(void * pvParam, CIP_OBJ_RESPONSE_T *tCIPResponse); 48 | 49 | typedef struct CIP_MR_SERVICE_Ttag 50 | { 51 | CIP_OBJ_ASYNC_REQUEST_T tCIPRequest; 52 | CIP_OBJ_RESPONSE_T tCIPResponse; 53 | uint16_t ausAddErrCode[2]; 54 | CIP_MR_SENDRESP_FUNC pfCallback; 55 | void* pvParam; 56 | }CIP_MR_SERVICE_T; 57 | 58 | 59 | /*#####################################################################################*/ 60 | 61 | #pragma pack(1) 62 | 63 | typedef __PACKED_PRE struct __PACKED_POST CIP_MR_CLASS_ATTR_Ttag 64 | { 65 | uint16_t usRevision; 66 | uint16_t usMaxInstance; 67 | uint16_t usNumInstance; 68 | uint16_t usMaxClassAttr; 69 | uint16_t usMaxInstanceAttr; 70 | } CIP_MR_CLASS_ATTR_T; 71 | 72 | /*#####################################################################################*/ 73 | 74 | typedef __PACKED_PRE struct __PACKED_POST CIP_MR_INST_ATTR_Ttag 75 | { 76 | uint32_t ulDummy; 77 | } CIP_MR_INST_ATTR_T; 78 | 79 | #pragma pack() 80 | 81 | /*#####################################################################################*/ 82 | 83 | typedef struct CIP_MR_Ttag 84 | { 85 | CIP_MR_CLASS_ATTR_T tClass; 86 | CIP_MR_INST_ATTR_T atInstance[1]; 87 | }CIP_MR_T; 88 | 89 | /*#####################################################################################*/ 90 | 91 | 92 | typedef struct CIP_MR_RSC_Ttag 93 | { 94 | CIP_MR_T tObjData; 95 | CIP_OBJ_ENTRY_T tObjEntry; 96 | CIP_OBJECT_ATTRIBUTE_DIR_T atClassAttrDir[CIP_MR_MAX_CLASS_ATTR]; 97 | CIP_OBJECT_ATTRIBUTE_DIR_T atInstanceAttrDir[1][CIP_MR_MAX_INSTANCE_ATTR]; 98 | 99 | CIP_MR_SERVICE_T atActiveServices[CIP_MR_MAX_SERVICES]; 100 | void *ptObjRsc; 101 | } CIP_MR_RSC_T; 102 | 103 | 104 | /*#####################################################################################*/ 105 | 106 | 107 | uint32_t 108 | CipMRHandleRequest( CIP_MR_RSC_T* ptRsc, 109 | uint16_t usLength, 110 | uint8_t* pbData, 111 | CIP_MR_SENDRESP_FUNC pfCallback, 112 | void* pvParam ); 113 | 114 | uint32_t 115 | CipMR_ObjectCreate( void* pvRsc, 116 | CIP_MR_RSC_T* ptObjRsc ); 117 | 118 | #endif /* CIP_MR_H */ 119 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/cip_pdc.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of CIP Hischer Object Predefined Connections 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2013-11-12 RH Created 20 | **************************************************************************************/ 21 | #ifndef CIP_PDC_H 22 | #define CIP_PDC_H 23 | 24 | #include 25 | 26 | 27 | /*#####################################################################################*/ 28 | 29 | /* 30 | ************************************************************ 31 | * Object specific defines 32 | ************************************************************ 33 | */ 34 | 35 | #define CIP_PDC_CLASS_NUMBER 0x401 36 | #define CIP_PDC_REVISION 0x01 37 | #define CIP_PDC_MAX_INSTANCE 0x03 38 | #define CIP_PDC_MAX_CLASS_ATTR 7 39 | #define CIP_PDC_MAX_INSTANCE_ATTR 10 40 | 41 | /* attributes of predefined connection object */ 42 | #define CIP_PDC_ATTR_1_STATE 1 43 | #define CIP_PDC_ATTR_2_COUNT 2 44 | #define CIP_PDC_ATTR_3_CONFIG 3 45 | 46 | #define CIP_PDC_DUMMY_INSTANCE 0xFFFFFFFF 47 | 48 | #define CIPHIL_PDC_CMD_OPEN_CONNECTION 0xFF01 49 | #define CIPHIL_PDC_CMD_CLOSE_CONNECTION 0xFF02 50 | 51 | /*#####################################################################################*/ 52 | 53 | /* 54 | ************************************************************ 55 | * Object specific types 56 | ************************************************************ 57 | */ 58 | 59 | typedef struct CIP_PDC_CLASS_ATTR_Ttag 60 | { 61 | uint16_t usRevision; 62 | uint16_t usMaxInstance; 63 | uint16_t usMaxClassAttr; 64 | uint16_t usMaxInstanceAttr; 65 | uint16_t usNumInstance; 66 | } CIP_PDC_CLASS_ATTR_T; 67 | 68 | /*#####################################################################################*/ 69 | 70 | //#pragma pack(1) //AL 71 | 72 | typedef __PACKED_PRE struct CIP_PDC_CONNECTION_CFG_Ttag 73 | { 74 | uint32_t ulConsumerPoint; 75 | uint32_t ulProducerPoint; 76 | uint32_t ulConfigPoint; 77 | uint32_t ulMinOTRpi; 78 | uint32_t ulMaxOTRpi; 79 | uint32_t ulMinTORpi; 80 | uint32_t ulMaxTORpi; 81 | 82 | uint8_t bSuppTrigTypes; 83 | #define CIP_PDC_TTYPE_CYCLIC 0x01 84 | #define CIP_PDC_TTYPE_COS 0x02 85 | #define CIP_PDC_TTYPE_APPLICATION 0x04 86 | 87 | uint8_t bConnType; 88 | } __PACKED_POST CIP_PDC_CONNECTION_CFG_T; 89 | 90 | /*#####################################################################################*/ 91 | 92 | typedef __PACKED_PRE struct CIP_PDC_INST_ATTR_Ttag 93 | { 94 | uint8_t bState; /* State of the connection */ 95 | #define CIP_PDC_STATE_FREE 0 96 | #define CIP_PDC_STATE_UNCONNECTED 1 97 | #define CIP_PDC_STATE_CONNECTED 2 98 | #define CIP_PDC_STATE_TIMEOUT 3 99 | 100 | uint8_t bConnectionCnt; /* How many connection of these type exist 101 | (listen only/input only)*/ 102 | 103 | CIP_PDC_CONNECTION_CFG_T tConfig; 104 | 105 | }__PACKED_POST CIP_PDC_INST_ATTR_T; 106 | 107 | ///#pragma pack() //AL 108 | 109 | /*#####################################################################################*/ 110 | 111 | typedef struct CIP_PDC_Ttag 112 | { 113 | CIP_PDC_CLASS_ATTR_T tClass; 114 | CIP_PDC_INST_ATTR_T* patInstance; 115 | }CIP_PDC_T; 116 | 117 | 118 | 119 | /*#####################################################################################*/ 120 | 121 | /* 122 | **************************************************************************** 123 | * Object specific macros 124 | **************************************************************************** 125 | */ 126 | 127 | 128 | /*#####################################################################################*/ 129 | 130 | /* 131 | ************************************************************ 132 | * Task Function Prototypes 133 | ************************************************************ 134 | */ 135 | 136 | typedef struct CIP_PDC_INIT_PARAM_Ttag 137 | { 138 | uint16_t usMaxInstance; 139 | }CIP_PDC_INIT_PARAM_T; 140 | 141 | uint32_t 142 | CipPDC_ObjectCreate( void* pvRsc, 143 | CIP_PDC_INIT_PARAM_T* ptParam ); 144 | 145 | 146 | #endif /* CIP_PDC_H */ 147 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/eip_dlr.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of CIP DLR Object 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2014-05-22 RH Created 20 | **************************************************************************************/ 21 | #ifndef _EIP_DLR_H_ 22 | #define _EIP_DLR_H_ 23 | 24 | #include 25 | #include "PS_Toolbox_Public.h" 26 | #include "Drv_Eth_public.h" 27 | #include "Drv_Eth_Adapter_2ps_Public.h" 28 | 29 | /*#####################################################################################*/ 30 | 31 | /* 32 | ************************************************************ 33 | * Object specific defines 34 | ************************************************************ 35 | */ 36 | 37 | #define EIP_DLR_CLASS_NUMBER 0x47 38 | #define EIP_DLR_REVISION 0x03 39 | #define EIP_DLR_MAX_INSTANCE 0x01 40 | #define EIP_DLR_MAX_CLASS_ATTR 7 41 | #define EIP_DLR_MAX_INSTANCE_ATTR 12 42 | 43 | 44 | /* attributes of identity object */ 45 | #define EIP_DLR_ATTR_1_NETWORK_TOPOLOGY 1 46 | #define EIP_DLR_ATTR_2_NETWORK_STATUS 2 47 | #define EIP_DLR_ATTR_3_RING_SUPERVISOR_STATUS 3 48 | #define EIP_DLR_ATTR_4_RING_SUPERVISOR_CONFIG 4 49 | #define EIP_DLR_ATTR_5_RING_FAULTS_COUNT 5 50 | #define EIP_DLR_ATTR_6_LAST_ACTIVE_NODE_PORT1 6 51 | #define EIP_DLR_ATTR_7_LAST_ACTIVE_NODE_PORT2 7 52 | #define EIP_DLR_ATTR_8_PARTICIPANTS_COUNT 8 53 | #define EIP_DLR_ATTR_9_PARTICIPANTS_LIST 9 54 | #define EIP_DLR_ATTR_10_ACTIVE_SUPERVISOR_ADDRESS 10 55 | #define EIP_DLR_ATTR_11_ACTIVE_SUPERVISOR_PRECEDENCE 11 56 | #define EIP_DLR_ATTR_12_CAPABILITY_FLAGS 12 57 | #define EIP_DLR_ATTR_13_REDUNDANT_GATEWAY_CONFIG 13 58 | #define EIP_DLR_ATTR_14_REDUNDANT_GATEWAY_STATUS 14 59 | #define EIP_DLR_ATTR_15_ACTIVE_GATEWAY_ADDRESS 15 60 | #define EIP_DLR_ATTR_16_ACTIVE_GATEWAY_PRECEDENCE 16 61 | 62 | /*#####################################################################################*/ 63 | 64 | /* 65 | ************************************************************ 66 | * Object specific types 67 | ************************************************************ 68 | */ 69 | 70 | typedef struct EIP_DLR_CLASS_ATTR_Ttag 71 | { 72 | uint16_t usRevision; 73 | uint16_t usMaxInstance; 74 | uint16_t usMaxClassAttr; 75 | uint16_t usMaxInstanceAttr; 76 | uint16_t usNumInstance; 77 | } EIP_DLR_CLASS_ATTR_T; 78 | 79 | /*#####################################################################################*/ 80 | 81 | #pragma pack(1) 82 | 83 | #define EIP_DLR_TOPOLOGY_LINEAR 0 84 | #define EIP_DLR_TOPOLOGY_RING 1 85 | 86 | #define EIP_DLR_NETWORKSTATUS_NORMAL 0 87 | #define EIP_DLR_NETWORKSTATUS_RINGFAULT 1 88 | #define EIP_DLR_NETWORKSTATUS_UNEXPECTEDLOOP 2 89 | #define EIP_DLR_NETWORKSTATUS_PARTIALNETWORKFAULT 3 90 | #define EIP_DLR_NETWORKSTATUS_RAPIDFAULT_RESTORECYCLE 4 91 | 92 | #define EIP_DLR_RINGSUPERVISOR_BACKUP 0 93 | #define EIP_DLR_RINGSUPERVISOR_ACTIVE 1 94 | #define EIP_DLR_RINGSUPERVISOR_NORMALNODE 2 95 | #define EIP_DLR_RINGSUPERVISOR_NONDLR 3 96 | #define EIP_DLR_RINGSUPERVISOR_NOSUPPORT 4 97 | 98 | /* capability flags */ 99 | #define EIP_DLR_CAPABILITY_ANNOUNCE_BASED 0x01 100 | #define EIP_DLR_CAPABILITY_BEACON_BASED 0x02 101 | #define EIP_DLR_CAPABILITY_SUPERVISOR_POSSIBLE 0x20 102 | #define EIP_DLR_CAPABILITY_REDUNDANT_GATEWAY 0x40 103 | #define EIP_DLR_CAPABILITY_FLUSH_TABLE 0x80 104 | 105 | #define EIP_DLR_NEIGHBOR_STATUS_PORT1_UP 0x01 106 | #define EIP_DLR_NEIGHBOR_STATUS_PORT2_UP 0x02 107 | #define EIP_DLR_NEIGHBOR_STATUS_FLAGS 0x80 108 | 109 | 110 | typedef void ( * EIP_DLR_STATE_CHANGE_CALLBACK )( uint8_t bNetworkTopology, 111 | uint8_t bNetworkStatus, 112 | void* pvUserData); 113 | 114 | typedef struct EIP_DLR_NODE_Ttag 115 | { 116 | uint32_t ulIPAddress; 117 | uint8_t abMAC[6]; 118 | } EIP_DLR_NODE_T; 119 | 120 | typedef struct EIP_DLR_INST_ATTR_Ttag 121 | { 122 | uint8_t bNetworkTopology; 123 | uint8_t bNetworkStatus; 124 | #if 0 125 | uint8_t bRingSupervisorStatus; 126 | struct { 127 | bool fRingSupervisorEnable; 128 | uint8_t bRingSupervisiorPrecedence; 129 | uint32_t ulBeaconInterval; 130 | uint32_t ulBeaconTimeout; 131 | uint16_t usDLR_VLAN_ID; 132 | } tRingSupervisorConfig; 133 | uint16_t usRingFaultsCount; 134 | EIP_DLR_NODE_T atLastActiveNodePort[2]; 135 | uint16_t usParticipantsCount; 136 | EIP_DLR_NODE_T *ptParticipantList; 137 | #else 138 | uint8_t abReserved1[37]; 139 | #endif 140 | EIP_DLR_NODE_T tActiveSupervisorAddress; 141 | #if 0 142 | uint8_t bActiveSupervisorPrecedence; 143 | #else 144 | uint8_t abReserved2[1]; 145 | #endif 146 | uint32_t ulCapabilityFlags; 147 | } EIP_DLR_INST_ATTR_T; 148 | 149 | 150 | #pragma pack() 151 | 152 | /*#####################################################################################*/ 153 | 154 | typedef struct EIP_DLR_Ttag 155 | { 156 | EIP_DLR_CLASS_ATTR_T tClass; 157 | EIP_DLR_INST_ATTR_T atInstance[1]; 158 | 159 | }EIP_DLR_T; 160 | 161 | 162 | /* 163 | **************************************************************************** 164 | * Object specific macros 165 | **************************************************************************** 166 | */ 167 | 168 | typedef struct EIP_DLR_RSC_Ttag* EIP_DLR_H; 169 | 170 | /*#####################################################################################*/ 171 | 172 | /* 173 | ************************************************************ 174 | * Task Function Prototypes 175 | ************************************************************ 176 | */ 177 | typedef struct EIP_DLR_INIT_PARAM_Ttag 178 | { 179 | void* hDrvEth; 180 | void* hTimer; 181 | void* hTask; 182 | } EIP_DLR_INIT_PARAM_T; 183 | 184 | /** Creates the device ring layer object (DLR). 185 | * 186 | * \param pvRsc [in] Task Resources 187 | * ptParam [in] settings for DLR object 188 | * 189 | * \return Description of return value, if any 190 | */ 191 | uint32_t 192 | EipDlr_ObjectCreate( void* pvRsc, EIP_DLR_INIT_PARAM_T *ptParam ); 193 | 194 | 195 | /** Get a handle to the DLR component. 196 | * 197 | * \param pvObjDir [in] Pointer to CIP object dictionary 198 | * 199 | * \return Handle to DLR component 200 | */ 201 | EIP_DLR_H EipDLR_GetHandle( void* pvObjDir ); 202 | 203 | 204 | /** Register Callback function to signal state change of DLR. 205 | * 206 | * \param hDLR [in] Handle of DLR object 207 | * pfnCallback [in] callback for DLR state change 208 | * pvUserData [in] User data returned with callback 209 | * 210 | * \return Description of return value, if any 211 | */ 212 | uint32_t 213 | EipDLR_RegisterCallback_StateChange( EIP_DLR_H hDLR, 214 | EIP_DLR_STATE_CHANGE_CALLBACK pfnCallback, 215 | void* pvUserData); 216 | 217 | /*#####################################################################################*/ 218 | 219 | #endif /* _EIP_DLR_H_ */ 220 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/eip_dlr_error.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of CIP DLR Object 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2014-05-22 RH Created 20 | **************************************************************************************/ 21 | #ifndef _EIP_DLR_ERROR_H_ 22 | #define _EIP_DLR_ERROR_H_ 23 | 24 | #define EIP_DLR_OK (0x00000000L) 25 | #define EIP_DLR_X_COMMAND_INVALID (0xC0950001L) 26 | #define EIP_DLR_X_NOT_INITIALIZED (0xC0950002L) 27 | #define EIP_DLR_E_FNC_API_INVALID_HANDLE (0xC0950003L) 28 | #define EIP_DLR_X_INVALID_ATTRIBUTE (0xC0950004L) 29 | #define EIP_DLR_E_INVALID_PORT (0xC0950005L) 30 | #define EIP_DLR_E_LINK_DOWN (0xC0950006L) 31 | #define EIP_DLR_X_MAX_NUM_OF_TASK_INST_EXCEEDED (0xC0950007L) 32 | #define EIP_DLR_X_INVALID_TASK_INST (0xC0950008L) 33 | #define EIP_DLR_X_CALLBACK_NOT_REGISTERED (0xC0950009L) 34 | #define EIP_DLR_X_WRONG_DLR_STATE (0xC095000AL) 35 | #define EIP_DLR_X_NOT_CONFIGURED_AS_SUPERVISOR (0xC095000BL) 36 | #define EIP_DLR_X_INVALID_CONFIG_PARAM (0xC095000CL) 37 | #define EIP_DLR_X_NO_STARTUP_PARAM_AVAIL (0xC095000DL) 38 | #define EIP_DLR_E_NO_ETH_BUFFER (0xC095000EL) 39 | 40 | #endif /* _EIP_DLR_ERROR_H_ */ 41 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/eip_error.h: -------------------------------------------------------------------------------- 1 | #ifndef __EIP_OBJECT_ERROR_H 2 | #define __EIP_OBJECT_ERROR_H 3 | 4 | #ifndef TLR_RESULT 5 | #define TLR_RESULT uint32_t 6 | #endif 7 | 8 | ///////////////////////////////////////////////////////////////////////////////////// 9 | // Ethernet/IP Object 10 | ///////////////////////////////////////////////////////////////////////////////////// 11 | // 12 | // MessageId: TLR_E_EIP_OBJECT_COMMAND_INVALID 13 | // 14 | // MessageText: 15 | // 16 | // Invalid command received. 17 | // 18 | #define TLR_E_EIP_OBJECT_COMMAND_INVALID ((TLR_RESULT)0xC01F0001L) 19 | 20 | // 21 | // MessageId: TLR_E_EIP_OBJECT_OUT_OF_MEMORY 22 | // 23 | // MessageText: 24 | // 25 | // System is out of memory. 26 | // 27 | #define TLR_E_EIP_OBJECT_OUT_OF_MEMORY ((TLR_RESULT)0xC01F0002L) 28 | 29 | // 30 | // MessageId: TLR_E_EIP_OBJECT_OUT_OF_PACKETS 31 | // 32 | // MessageText: 33 | // 34 | // Task runs out of empty packets at the local packet pool. 35 | // 36 | #define TLR_E_EIP_OBJECT_OUT_OF_PACKETS ((TLR_RESULT)0xC01F0003L) 37 | 38 | // 39 | // MessageId: TLR_E_EIP_OBJECT_SEND_PACKET 40 | // 41 | // MessageText: 42 | // 43 | // Sending a packet failed. 44 | // 45 | #define TLR_E_EIP_OBJECT_SEND_PACKET ((TLR_RESULT)0xC01F0004L) 46 | 47 | // 48 | // MessageId: TLR_E_EIP_OBJECT_AS_ALLREADY_EXIST 49 | // 50 | // MessageText: 51 | // 52 | // Assembly instance already exist. 53 | // 54 | #define TLR_E_EIP_OBJECT_AS_ALLREADY_EXIST ((TLR_RESULT)0xC01F0010L) 55 | 56 | // 57 | // MessageId: TLR_E_EIP_OBJECT_AS_INVALID_INST 58 | // 59 | // MessageText: 60 | // 61 | // Invalid Assembly Instance. 62 | // 63 | #define TLR_E_EIP_OBJECT_AS_INVALID_INST ((TLR_RESULT)0xC01F0011L) 64 | 65 | // 66 | // MessageId: TLR_E_EIP_OBJECT_AS_INVALID_LEN 67 | // 68 | // MessageText: 69 | // 70 | // Invalid Assembly length. 71 | // 72 | #define TLR_E_EIP_OBJECT_AS_INVALID_LEN ((TLR_RESULT)0xC01F0012L) 73 | 74 | // 75 | // MessageId: TLR_E_EIP_OBJECT_CONN_OVERRUN 76 | // 77 | // MessageText: 78 | // 79 | // No free connection buffer available 80 | // 81 | #define TLR_E_EIP_OBJECT_CONN_OVERRUN ((TLR_RESULT)0xC01F0020L) 82 | 83 | // 84 | // MessageId: TLR_E_EIP_OBJECT_INVALID_CLASS 85 | // 86 | // MessageText: 87 | // 88 | // Object class is invalid. 89 | // 90 | #define TLR_E_EIP_OBJECT_INVALID_CLASS ((TLR_RESULT)0xC01F0021L) 91 | 92 | // 93 | // MessageId: TLR_E_EIP_OBJECT_SEGMENT_FAULT 94 | // 95 | // MessageText: 96 | // 97 | // Segment of the path is invalid. 98 | // 99 | #define TLR_E_EIP_OBJECT_SEGMENT_FAULT ((TLR_RESULT)0xC01F0022L) 100 | 101 | // 102 | // MessageId: TLR_E_EIP_OBJECT_CLASS_ALLREADY_EXIST 103 | // 104 | // MessageText: 105 | // 106 | // Object Class is already used. 107 | // 108 | #define TLR_E_EIP_OBJECT_CLASS_ALLREADY_EXIST ((TLR_RESULT)0xC01F0023L) 109 | 110 | // 111 | // MessageId: TLR_E_EIP_OBJECT_CONNECTION_FAIL 112 | // 113 | // MessageText: 114 | // 115 | // Connection failed. 116 | // 117 | #define TLR_E_EIP_OBJECT_CONNECTION_FAIL ((TLR_RESULT)0xC01F0024L) 118 | 119 | // 120 | // MessageId: TLR_E_EIP_OBJECT_CONNECTION_PARAM 121 | // 122 | // MessageText: 123 | // 124 | // Unknown format of connection parameter 125 | // 126 | #define TLR_E_EIP_OBJECT_CONNECTION_PARAM ((TLR_RESULT)0xC01F0025L) 127 | 128 | // 129 | // MessageId: TLR_E_EIP_OBJECT_UNKNOWN_CONNECTION 130 | // 131 | // MessageText: 132 | // 133 | // Invalid connection ID. 134 | // 135 | #define TLR_E_EIP_OBJECT_UNKNOWN_CONNECTION ((TLR_RESULT)0xC01F0026L) 136 | 137 | // 138 | // MessageId: TLR_E_EIP_OBJECT_NO_OBJ_RESSOURCE 139 | // 140 | // MessageText: 141 | // 142 | // No resource for creating a new class object available. 143 | // 144 | #define TLR_E_EIP_OBJECT_NO_OBJ_RESSOURCE ((TLR_RESULT)0xC01F0027L) 145 | 146 | // 147 | // MessageId: TLR_E_EIP_OBJECT_ID_INVALID_PARAMETER 148 | // 149 | // MessageText: 150 | // 151 | // Invalid request parameter. 152 | // 153 | #define TLR_E_EIP_OBJECT_ID_INVALID_PARAMETER ((TLR_RESULT)0xC01F0028L) 154 | 155 | // 156 | // MessageId: TLR_E_EIP_OBJECT_CONNECTION_FAILED 157 | // 158 | // MessageText: 159 | // 160 | // General connection failure. See also General Error Code and Extended Error Code for more details. 161 | // 162 | #define TLR_E_EIP_OBJECT_CONNECTION_FAILED ((TLR_RESULT)0xC01F0029L) 163 | 164 | // 165 | // MessageId: TLR_E_EIP_OBJECT_PACKET_LEN 166 | // 167 | // MessageText: 168 | // 169 | // Packet length of the request is invalid. 170 | // 171 | #define TLR_E_EIP_OBJECT_PACKET_LEN ((TLR_RESULT)0xC01F0030L) 172 | 173 | // 174 | // MessageId: TLR_E_EIP_OBJECT_READONLY_INST 175 | // 176 | // MessageText: 177 | // 178 | // Access denied. Instance is read only. 179 | // 180 | #define TLR_E_EIP_OBJECT_READONLY_INST ((TLR_RESULT)0xC01F0031L) 181 | 182 | // 183 | // MessageId: TLR_E_EIP_OBJECT_DPM_USED 184 | // 185 | // MessageText: 186 | // 187 | // DPM address is already used by an other instance. 188 | // 189 | #define TLR_E_EIP_OBJECT_DPM_USED ((TLR_RESULT)0xC01F0032L) 190 | 191 | // 192 | // MessageId: TLR_E_EIP_OBJECT_SET_OUTPUT_RUNNING 193 | // 194 | // MessageText: 195 | // 196 | // Set Output command is already runnning. 197 | // 198 | #define TLR_E_EIP_OBJECT_SET_OUTPUT_RUNNING ((TLR_RESULT)0xC01F0033L) 199 | 200 | // 201 | // MessageId: TLR_E_EIP_OBJECT_TASK_RESETING 202 | // 203 | // MessageText: 204 | // 205 | // Etthernet/IP Object Task is running a reset. 206 | // 207 | #define TLR_E_EIP_OBJECT_TASK_RESETING ((TLR_RESULT)0xC01F0034L) 208 | 209 | // 210 | // MessageId: TLR_E_EIP_OBJECT_SERVICE_ALLREADY_EXIST 211 | // 212 | // MessageText: 213 | // 214 | // The service that shall be registered already exists. 215 | // 216 | #define TLR_E_EIP_OBJECT_SERVICE_ALLREADY_EXIST ((TLR_RESULT)0xC01F0035L) 217 | 218 | // 219 | // MessageId: TLR_E_EIP_OBJECT_DUPLICATE_SERVICE 220 | // 221 | // MessageText: 222 | // 223 | // The service is rejected by the application due to a duplicate sequence count. 224 | // 225 | #define TLR_E_EIP_OBJECT_DUPLICATE_SERVICE ((TLR_RESULT)0xC01F0036L) 226 | 227 | #define TLR_E_EIP_TIMER_INVALID_HANDLE ((TLR_RESULT)0xC01F00FFL) 228 | 229 | #define TLR_E_EIP_OUT_OF_OS_RESOURCES ((TLR_RESULT)0xC01F00FEL) 230 | 231 | #define TLR_E_EIP_INVALID_MODE ((TLR_RESULT)0xC01F00FDL) 232 | 233 | #ifndef TLR_E_EVALUATION_TIME_EXPIRED 234 | #define TLR_E_EVALUATION_TIME_EXPIRED ((TLR_RESULT)0xC000F007L) 235 | #endif 236 | #endif //__EIP_OBJECT_ERROR_H 237 | 238 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/eip_hw_adaption.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of EtherNet/IP Timer 14 | 15 | 16 | Changes: 17 | 18 | Date Author Description 19 | ---------------------------------------------------------------------------------- 20 | 2013-11-12 RH Created 21 | **************************************************************************************/ 22 | #ifndef EIP_HW_ADAPTION_H 23 | #define EIP_HW_ADAPTION_H 24 | 25 | #include "eip_en.h" 26 | 27 | /* Callback function definitions */ 28 | typedef void (*EIP_HW_1MS_CB_FN) ( void* pvArg ); 29 | 30 | /* Handler types */ 31 | typedef struct EIP_HW_1MS_CBK_CONFIG_Ttag EIP_HW_1MS_CBK_CONFIG_T; 32 | typedef struct EIP_HW_1MS_CBK_RSC_Ttag EIP_HW_1MS_CBK_RSC_T; 33 | 34 | /*#####################################################################################*/ 35 | 36 | /** Initializes hardware dependent resources to allow for a precise function call every millisecond. 37 | * 38 | * \param pvHw [in] Parameter set used to initialize the resources 39 | * \param fnCyclicFct [in] Callback function that needs to be called every millisecond 40 | * \param pvArg [in] Parameter that must be passed with the call of fnCyclicFct 41 | * --> fnCyclicFct( pvArg ) 42 | * 43 | * \return Pointer to resources. 44 | * - NULL in case the initialization failed. 45 | */ 46 | 47 | EIP_HW_1MS_CBK_RSC_T* 48 | EipHw_1msCbk_Init( EIP_HW_1MS_CBK_CONFIG_T* ptConfig, 49 | EIP_HW_1MS_CB_FN fnCyclicFct, 50 | void* pvArg ); 51 | 52 | /*#####################################################################################*/ 53 | 54 | /** De-Initializes resources that have been initialized with EipHw_1msCbk_Init 55 | * 56 | * \param pvHwRsc [in] Pointer to resources privided by EipHw_1msCbk_Init 57 | */ 58 | 59 | void 60 | EipHw_1msCbk_DeInit( EIP_HW_1MS_CBK_RSC_T* pvHwRsc ); 61 | 62 | /*#####################################################################################*/ 63 | 64 | /** Retrieves hardware depending interface counters. 65 | * 66 | * \param ulPort [in] Port (1,2) for which the interface counters shall be read. 67 | * \param ptInterfaceCounters [out] Interface Counters 68 | * 69 | * \return true if retrieving counters has been successful, otherwise false. 70 | */ 71 | 72 | bool 73 | EipHw_GetInterfaceCounters( uint32_t ulPort, 74 | EIP_EN_INTERFACE_CNT_T* ptInterfaceCounters ); 75 | 76 | /*#####################################################################################*/ 77 | 78 | /** Retrieves hardware depending media counters. 79 | * 80 | * \param ulPort [in] Port (1,2) for which the interface counters shall be read. 81 | * \param ptMediaCounters [out] Media Counters 82 | * 83 | * \return true if retrieving counters has been successful, otherwise false. 84 | */ 85 | 86 | uint32_t 87 | EipHw_GetMediaCounters( uint32_t ulPort, 88 | EIP_EN_MEDIA_CNT_T* ptMediaCounters ); 89 | 90 | /*******************************************************************************/ 91 | 92 | #endif /* EIP_HW_ADAPTION_H */ 93 | -------------------------------------------------------------------------------- /examples/includes/EtherNetIP/eip_qos.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | 3 | Copyright (C) 2013 Hilscher Gesellschaft fuer Systemautomation mbH. 4 | This program can be used by everyone according the "industrialNETworX Public License INPL". 5 | The license can be downloaded under . 6 | 7 | *********************************************************************************************** 8 | 9 | Last Modification: 10 | @version $Id: $ 11 | 12 | Description: 13 | Header of CIP QoS Object 14 | 15 | Changes: 16 | 17 | Date Author Description 18 | ---------------------------------------------------------------------------------- 19 | 2014-05-22 RH Created 20 | **************************************************************************************/ 21 | #ifndef _EIP_QOS_H_ 22 | #define _EIP_QOS_H_ 23 | 24 | #include 25 | 26 | /*#####################################################################################*/ 27 | 28 | /* 29 | ************************************************************ 30 | * Object specific defines 31 | ************************************************************ 32 | */ 33 | 34 | #define EIP_QOS_CLASS_NUMBER 0x48 35 | #define EIP_QOS_REVISION 0x01 36 | #define EIP_QOS_MAX_INSTANCE 0x01 37 | #define EIP_QOS_MAX_CLASS_ATTR 7 38 | #define EIP_QOS_MAX_INSTANCE_ATTR 8 39 | 40 | 41 | /* attributes of identity object */ 42 | #define EIP_QOS_ATTR_1_TAG_ENABLE 1 43 | #define EIP_QOS_ATTR_2_DSCP_PTP_EVENT 2 44 | #define EIP_QOS_ATTR_3_DSCP_PTP_GENERAL 3 45 | #define EIP_QOS_ATTR_4_DSCP_URGENT 4 46 | #define EIP_QOS_ATTR_5_DSCP_SCHEDULED 5 47 | #define EIP_QOS_ATTR_6_DSCP_HIGH 6 48 | #define EIP_QOS_ATTR_7_DSCP_LOW 7 49 | #define EIP_QOS_ATTR_8_DSCP_EXPLICIT 8 50 | 51 | /*#####################################################################################*/ 52 | 53 | #define EIP_QOS_TAG_ENABLED 1 54 | #define EIP_QOS_TAG_DISABLED 0 55 | #define EIP_QOS_DSCP_PTP_EVENT_DEFAULT 59 56 | #define EIP_QOS_DSCP_PTP_GENERAL_DEFAULT 47 57 | #define EIP_QOS_DSCP_URGENT_DEFAULT 55 58 | #define EIP_QOS_DSCP_SCHEDULED_DEFAULT 47 59 | #define EIP_QOS_DSCP_HIGH_DEFAULT 43 60 | #define EIP_QOS_DSCP_LOW_DEFAULT 31 61 | #define EIP_QOS_DSCP_EXPLICIT_DEFAULT 27 62 | 63 | 64 | /* 65 | ************************************************************ 66 | * Object specific types 67 | ************************************************************ 68 | */ 69 | 70 | typedef struct EIP_QOS_CLASS_ATTR_Ttag 71 | { 72 | uint16_t usRevision; 73 | uint16_t usMaxInstance; 74 | uint16_t usMaxClassAttr; 75 | uint16_t usMaxInstanceAttr; 76 | uint16_t usNumInstance; 77 | } EIP_QOS_CLASS_ATTR_T; 78 | 79 | /*#####################################################################################*/ 80 | 81 | #pragma pack(1) 82 | 83 | 84 | typedef struct EIP_QOS_INST_ATTR_Ttag 85 | { 86 | uint8_t b802_1TagEnable; 87 | uint8_t bDSCP_PTP_Event; 88 | uint8_t bDSCP_PTP_General; 89 | uint8_t bDSCP_Urgent; 90 | uint8_t bDSCP_Scheduled; 91 | uint8_t bDSCP_High; 92 | uint8_t bDSCP_Low; 93 | uint8_t bDSCP_Explicit; 94 | } EIP_QOS_INST_ATTR_T; 95 | 96 | 97 | #pragma pack() 98 | 99 | /*#####################################################################################*/ 100 | 101 | typedef struct EIP_QOS_Ttag 102 | { 103 | EIP_QOS_CLASS_ATTR_T tClass; 104 | EIP_QOS_INST_ATTR_T atInstance[1]; 105 | 106 | }EIP_QOS_T; 107 | 108 | /*#####################################################################################*/ 109 | 110 | 111 | typedef struct EIP_QOS_RSC_Ttag* EIP_QOS_H; 112 | 113 | /*#####################################################################################*/ 114 | 115 | /* 116 | **************************************************************************** 117 | * Object specific macros 118 | **************************************************************************** 119 | */ 120 | 121 | 122 | /*#####################################################################################*/ 123 | 124 | /* 125 | ************************************************************ 126 | * Task Function Prototypes 127 | ************************************************************ 128 | */ 129 | typedef struct EIP_QOS_INIT_PARAM_Ttag 130 | { 131 | void* hDrvEth; 132 | void* hTimer; 133 | void* hTask; 134 | } EIP_QOS_INIT_PARAM_T; 135 | 136 | /** Creates the Quality of Service object (QoS). 137 | * 138 | * \param pvRsc [in] Task Resources 139 | * ptParam [in] settings for QoS object 140 | * 141 | * \return Description of return value, if any 142 | */ 143 | uint32_t 144 | EipQoS_ObjectCreate( void* pvRsc, EIP_QOS_INIT_PARAM_T *ptParam ); 145 | 146 | /*#####################################################################################*/ 147 | 148 | #endif /* _EIP_QOS_H_ */ 149 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/CmdTable_Configuration.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: CmdTable_Configuration.h 5600 2016-04-26 12:19:22Z Alexander.Ivanov $: 5 | 6 | Description: 7 | The header contains the common types definitions. 8 | 9 | Changes: 10 | 11 | ----------------------------------------------------------------------------------- 12 | 2016-02-10 created 13 | **************************************************************************************/ 14 | 15 | #ifndef __CMDTBL_CONFIGURATION_H 16 | #define __CMDTBL_CONFIGURATION_H 17 | 18 | 19 | #include 20 | 21 | 22 | typedef enum CMDTBL_PROTOCOL_TYPE_Etag 23 | { 24 | CMDTBL_PROTOCOL_TYPE_UNDEFINED = 0, 25 | CMDTBL_PROTOCOL_TYPE_MODBUS_RTU = 0x11, /* RCX_PROT_CLASS_MODBUS_RTU */ 26 | CMDTBL_PROTOCOL_TYPE_MODBUS_TCP = 0x12, /* RCX_PROT_CLASS_OPEN_MODBUS_TCP */ 27 | } 28 | CMDTBL_PROTOCOL_TYPE_E; 29 | 30 | 31 | typedef enum CMDTBL_TRIGGER_TYPE_Etag 32 | { 33 | CMDTBL_TRIGGER_TYPE_CYCLIC = 0, /* cyclicly depending on a configured interval. */ 34 | CMDTBL_TRIGGER_TYPE_ON_CHANGE = 1, /* only in case of data change. */ 35 | CMDTBL_TRIGGER_TYPE_ON_CHANGE_NON_ZERO = 2, /* only in case of data change to a non-zero value */ 36 | CMDTBL_TRIGGER_TYPE_ON_REQUEST = 3, /* on external trigger event only. 37 | Triggered by CMDTBL_TRIGGER_COMMAND_REQ */ 38 | } 39 | CMDTBL_TRIGGER_TYPE_E; 40 | 41 | typedef enum CMDTBL_TABLE_FLAGS_Etag 42 | { 43 | CMDTBL_TABLE_FLAGS_INACTIVE_BY_DEFAULT = 1, 44 | } 45 | CMDTBL_TABLE_FLAGS_E; 46 | 47 | typedef enum CMDTBL_COMMAND_FLAGS_Etag 48 | { 49 | CMDTBL_COMMAND_FLAGS_INACTIVE_BY_DEFAULT = 1, 50 | } 51 | CMDTBL_COMMAND_FLAGS_E; 52 | 53 | 54 | /* pragma pack */ 55 | #ifdef PRAGMA_PACK_ENABLE 56 | #pragma PRAGMA_PACK_1(__CMDTBL_PACKET_DATA) 57 | #endif 58 | 59 | typedef struct CMDTBL_TABLE_Ttag 60 | { 61 | uint32_t ulProtocolType; /*!< Protocol used for all commands within the table. */ 62 | uint32_t ulCycleTime; /*!< The cycle defines the interval at which the table is executed */ 63 | uint32_t ulInterCommandDelay; /*!< Timeout inserted between two commands to the same server */ 64 | uint32_t ulInterScanDelay; /*!< Timeout inserted between last and first commands of a cycle 65 | to the same server */ 66 | uint32_t ulFlags; /*!< Table flags - CMDTBL_TABLE_FLAGS_E. */ 67 | uint8_t abReserved[16]; 68 | } 69 | CMDTBL_TABLE_T; 70 | 71 | 72 | typedef struct CMDTBL_COMMAND_Ttag 73 | { 74 | uint32_t ulDeviceAddr; 75 | uint32_t ulUnitId; 76 | uint32_t ulFunctionCode; 77 | uint32_t ulRegisterWriteAddr; 78 | uint32_t ulRegisterWriteCount; 79 | uint32_t ulRegisterReadAddr; 80 | uint32_t ulRegisterReadCount; 81 | uint32_t ulDPMSrcOffset; 82 | uint32_t ulDPMDstOffset; 83 | uint32_t ulTriggerType; 84 | uint32_t ulCyclePeriod; 85 | uint32_t ulFlags; /*!< Command flags - CMDTBL_COMMAND_FLAGS_E. */ 86 | uint8_t abReserved[16]; 87 | } 88 | CMDTBL_COMMAND_T; 89 | 90 | /* pragma unpack */ 91 | #ifdef PRAGMA_PACK_ENABLE 92 | #pragma PRAGMA_UNPACK_1(__CMDTBL_PACKET_DATA) 93 | #endif 94 | 95 | 96 | #endif /* #ifndef __CMDTBL_CONFIGURATION_H */ 97 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/CmdTable_Error.h: -------------------------------------------------------------------------------- 1 | #ifndef __CMD_TABLE_ERROR_H 2 | #define __CMD_TABLE_ERROR_H 3 | 4 | ///////////////////////////////////////////////////////////////////////////////////// 5 | // Command Table ERROR codes 6 | ///////////////////////////////////////////////////////////////////////////////////// 7 | // 8 | // MessageId: TLR_E_CMD_TABLE_COMMAND_INVALID 9 | // 10 | // MessageText: 11 | // 12 | // Invalid command received. 13 | // 14 | #define TLR_E_CMD_TABLE_COMMAND_INVALID (0xC0E20001L) 15 | 16 | // 17 | // MessageId: TLR_E_CMDTBL_INVALID_PROTOCOL_TYPE 18 | // 19 | // MessageText: 20 | // 21 | // Not supported protocol. 22 | // 23 | #define TLR_E_CMDTBL_INVALID_PROTOCOL_TYPE (0xC0E20002L) 24 | 25 | // 26 | // MessageId: TLR_E_CMDTBL_INVALID_QUEUE_NAME 27 | // 28 | // MessageText: 29 | // 30 | // The Queue name is invalid. 31 | // 32 | #define TLR_E_CMDTBL_INVALID_QUEUE_NAME (0xC0E20003L) 33 | 34 | // 35 | // MessageId: TLR_E_CMDTBL_UNSUPPORTED_VERSION 36 | // 37 | // MessageText: 38 | // 39 | // The version is not supported. 40 | // 41 | #define TLR_E_CMDTBL_UNSUPPORTED_VERSION (0xC0E20004L) 42 | 43 | // 44 | // MessageId: TLR_E_CMDTBL_TABLE_NOT_AVAILABLE 45 | // 46 | // MessageText: 47 | // 48 | // The table is not configured. 49 | // 50 | #define TLR_E_CMDTBL_TABLE_NOT_AVAILABLE (0xC0E20005L) 51 | 52 | // 53 | // MessageId: TLR_E_CMDTBL_COMMAND_NOT_AVAILABLE 54 | // 55 | // MessageText: 56 | // 57 | // The command is not configured. 58 | // 59 | #define TLR_E_CMDTBL_COMMAND_NOT_AVAILABLE (0xC0E20006L) 60 | 61 | // 62 | // MessageId: TLR_E_CMDTBL_DEST_QUEUE_NOT_INITED 63 | // 64 | // MessageText: 65 | // 66 | // The destination queue is not initialized. 67 | // 68 | #define TLR_E_CMDTBL_DEST_QUEUE_NOT_INITED (0xC0E20007L) 69 | 70 | // 71 | // MessageId: TLR_E_CMDTBL_COMMAND_DOES_NOT_MATCH_TABLE 72 | // 73 | // MessageText: 74 | // 75 | // The requested command does not exist in the table. 76 | // 77 | #define TLR_E_CMDTBL_COMMAND_DOES_NOT_MATCH_TABLE (0xC0E20008L) 78 | 79 | // 80 | // MessageId: TLR_E_CMDTBL_COMMAND_NOT_TRIGGERABLE 81 | // 82 | // MessageText: 83 | // 84 | // The command is not defined as a triggerable one. 85 | // 86 | #define TLR_E_CMDTBL_COMMAND_NOT_TRIGGERABLE (0xC0E20009L) 87 | 88 | // 89 | // MessageId: TLR_E_CMDTBL_COMMAND_NOT_ACTIVE 90 | // 91 | // MessageText: 92 | // 93 | // The command is not active or belongs to inactive table. 94 | // 95 | #define TLR_E_CMDTBL_COMMAND_NOT_ACTIVE (0xC0E2000AL) 96 | 97 | // 98 | // MessageId: TLR_E_CMDTBL_UNSUPPORTED_PROTOCOL_TYPE 99 | // 100 | // MessageText: 101 | // 102 | // The command is not active or belongs to inactive table. 103 | // 104 | #define TLR_E_CMDTBL_UNSUPPORTED_PROTOCOL_TYPE (0xC0E2000BL) 105 | 106 | // 107 | // MessageId: TLR_E_CMDTBL_MAX_TABLES_REACHED 108 | // 109 | // MessageText: 110 | // 111 | // The maximum tables number has been reached. 112 | // 113 | #define TLR_E_CMDTBL_MAX_TABLES_REACHED (0xC0E2000CL) 114 | 115 | // 116 | // MessageId: TLR_E_CMDTBL_MAX_COMMANDS_REACHED 117 | // 118 | // MessageText: 119 | // 120 | // The maximum commands number has been reached. 121 | // 122 | #define TLR_E_CMDTBL_MAX_COMMANDS_REACHED (0xC0E2000DL) 123 | 124 | // 125 | // MessageId: TLR_E_CMDTBL_ALREADY_INITED 126 | // 127 | // MessageText: 128 | // 129 | // The Command Table has already been initialized. Performe a Deinitialization first. 130 | // 131 | #define TLR_E_CMDTBL_ALREADY_INITED (0xC0E2000EL) 132 | 133 | // 134 | // MessageId: TLR_E_CMDTBL_NOT_INITED 135 | // 136 | // MessageText: 137 | // 138 | // The Command Table has not been initialized. Performe a Initialization first. 139 | // 140 | #define TLR_E_CMDTBL_NOT_INITED (0xC0E2000FL) 141 | 142 | // 143 | // MessageId: TLR_E_CMDTBL_REQ_NOT_ALLOWED 144 | // 145 | // MessageText: 146 | // 147 | // The reguest is not allowed at this moment/state. 148 | // 149 | #define TLR_E_CMDTBL_REQ_NOT_ALLOWED (0xC0E20010L) 150 | 151 | // 152 | // MessageId: TLR_E_CMDTBL_INVALID_DEVICE_ADDRESS 153 | // 154 | // MessageText: 155 | // 156 | // An invalid Device Address has been detected. 157 | // 158 | #define TLR_E_CMDTBL_INVALID_DEVICE_ADDRESS (0xC0E20011L) 159 | 160 | // 161 | // MessageId: TLR_E_CMDTBL_INVALID_UNIT_ID 162 | // 163 | // MessageText: 164 | // 165 | // An invalid Unit Identifier has been detected. 166 | // 167 | #define TLR_E_CMDTBL_INVALID_UNIT_ID (0xC0E20012L) 168 | 169 | // 170 | // MessageId: TLR_E_CMDTBL_INVALID_FUNCTION_CODE 171 | // 172 | // MessageText: 173 | // 174 | // An invalid Function Code has been detected. 175 | // 176 | #define TLR_E_CMDTBL_INVALID_FUNCTION_CODE (0xC0E20013L) 177 | 178 | // 179 | // MessageId: TLR_E_CMDTBL_INVALID_DATA_COUNT 180 | // 181 | // MessageText: 182 | // 183 | // An invalid Data Size has been detected. 184 | // 185 | #define TLR_E_CMDTBL_INVALID_DATA_COUNT (0xC0E20014L) 186 | 187 | // 188 | // MessageId: TLR_E_CMDTBL_INVALID_COMMAND_OFFSET 189 | // 190 | // MessageText: 191 | // 192 | // An invalid Command Offset has been detected. 193 | // 194 | #define TLR_E_CMDTBL_INVALID_COMMAND_OFFSET (0xC0E20015L) 195 | 196 | // 197 | // MessageId: TLR_E_CMDTBL_INVALID_TRIGGER_TYPE 198 | // 199 | // MessageText: 200 | // 201 | // An invalid Trigger Type has been detected. 202 | // 203 | #define TLR_E_CMDTBL_INVALID_TRIGGER_TYPE (0xC0E20016L) 204 | 205 | // 206 | // MessageId: TLR_E_CMDTBL_INVALID_CYCLE_PERIOD 207 | // 208 | // MessageText: 209 | // 210 | // An invalid Cycle Period has been detected. 211 | // 212 | #define TLR_E_CMDTBL_INVALID_CYCLE_PERIOD (0xC0E20017L) 213 | 214 | // 215 | // MessageId: TLR_E_CMDTBL_INVALID_RESERVED_VALUE 216 | // 217 | // MessageText: 218 | // 219 | // An invalid Reserved Field has been detected. 220 | // 221 | #define TLR_E_CMDTBL_INVALID_RESERVED_VALUE (0xC0E20018L) 222 | 223 | // 224 | // MessageId: TLR_E_CMDTBL_ONE_TABLE_PER_DEVICE_ADDR 225 | // 226 | // MessageText: 227 | // 228 | // Each device address can be part of only one table. 229 | // 230 | #define TLR_E_CMDTBL_ONE_TABLE_PER_DEVICE_ADDR (0xC0E20019L) 231 | 232 | // 233 | // MessageId: TLR_E_CMDTBL_OFFSET_NOT_ALIGNED 234 | // 235 | // MessageText: 236 | // 237 | // The offset is not 4-byte alligned. 238 | // 239 | #define TLR_E_CMDTBL_OFFSET_NOT_ALIGNED (0xC0E2001AL) 240 | 241 | // 242 | // MessageId: TLR_E_CMDTBL_INVALID_DATA_ADDRESS 243 | // 244 | // MessageText: 245 | // 246 | // An invalid Data Address has been detected. 247 | // 248 | #define TLR_E_CMDTBL_INVALID_DATA_ADDRESS (0xC0E2001BL) 249 | 250 | // 251 | // MessageId: TLR_E_CMDTBL_INVALID_BITFIELD_OFFSET 252 | // 253 | // MessageText: 254 | // 255 | // An invalid Bitfield Offset has been detected. 256 | // 257 | #define TLR_E_CMDTBL_INVALID_BITFIELD_OFFSET (0xC0E2001CL) 258 | 259 | // 260 | // MessageId: TLR_E_CMDTBL_INVALID_COMMAND_DELAY 261 | // 262 | // MessageText: 263 | // 264 | // An invalid Command Dellay has been detected. 265 | // 266 | #define TLR_E_CMDTBL_INVALID_COMMAND_DELAY (0xC0E2001DL) 267 | 268 | // 269 | // MessageId: TLR_E_CMDTBL_INVALID_SCAN_DELAY 270 | // 271 | // MessageText: 272 | // 273 | // An invalid Interscan Dellay has been detected. 274 | // 275 | #define TLR_E_CMDTBL_INVALID_SCAN_DELAY (0xC0E2001EL) 276 | 277 | // 278 | // MessageId: TLR_E_CMDTBL_CYCLE_PERIOD_MUST_BE_ZERO 279 | // 280 | // MessageText: 281 | // 282 | // The command cycle period and the table cycle period can not be non-zero values at the same time. 283 | // 284 | #define TLR_E_CMDTBL_CYCLE_PERIOD_MUST_BE_ZERO (0xC0E2001FL) 285 | 286 | 287 | 288 | 289 | #endif //__CMD_TABLE_ERROR_H 290 | 291 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/OmbOmbApTask_Public.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: OmbOmbApTask_Public.h 3662 2015-09-30 07:23:53Z iborisov $: 5 | Description: 6 | Omb Application Task 7 | Includes following functions... 8 | **************************************************************************************/ 9 | 10 | /** 11 | * @file OmbOmbApTask_Public.h 12 | * Omb OmbApTask - public definition of task 13 | * 14 | * The header contains the public definition of task. 15 | * It has to be included by another task to get access of task specfic definition. 16 | * 17 | * @note 18 | * The structures for the services must be packed on 1 byte of boundary. 19 | * The #pragma instructions are already planned for Microsoft compiler. 20 | * For gnu's compiler and Realview compiler the macros __PACKED_PRE 21 | * and __PACKED_PRE have to be added with the structural definition 22 | * in addition. 23 | */ 24 | #ifndef __OMB_OMBAPTASK_PUBLIC_H 25 | #define __OMB_OMBAPTASK_PUBLIC_H 26 | 27 | 28 | /*************************************************************************************/ 29 | /** @name Queue Name 30 | * 31 | * Use the queue name to identify the process queue of task 'Omb OmbApTask'. 32 | * Example for internal identification:
33 | * @code 34 | * TLR_RESULT eRslt; 35 | * TLR_HANDLE hQue; 36 | * TLR_UINT uiInstance = 0; 37 | * 38 | * eRslt = TLR_QUE_IDENTIFY_INTERN( 39 | * OMB_OMBAPTASK_QUEUE_NAME, 40 | * uiInstance, 41 | * &hQue 42 | * ); 43 | * @endcode 44 | *
45 | * Example for external or normal identification:
46 | * @code 47 | * TLR_RESULT eRslt; 48 | * TLR_QUE_LINK_T tQue; 49 | * TLR_UINT uiInstance = 0; 50 | * 51 | * eRslt = TLR_QUE_IDENTIFY(OMB_OMBAPTASK_QUEUE_NAME, uiInstance, &tQue); 52 | * @endcode 53 | *
54 | * @{ 55 | */ 56 | /** queue name */ 57 | #define OMB_OMBAPTASK_QUEUE_NAME "QUE_OMBAPTASK" 58 | 59 | /** Task name */ 60 | #define OMB_AP_TASK_NAME "OMB_AP" 61 | 62 | 63 | /** @} */ 64 | 65 | 66 | /**************************************************************************************** 67 | * OMB OMBAPTASK, Public defines */ 68 | 69 | 70 | /**************************************************************************************** 71 | * OMB OMBAPTASK, command codes */ 72 | 73 | 74 | /**************************************************************************************** 75 | * OMB OMBAPTASK, Structs */ 76 | 77 | /* Compiler settings */ 78 | #if _MSC_VER >= 1000 79 | #define __OMBAP_PACKED_PRE 80 | #define __OMBAP_PACKED_POST 81 | #pragma once 82 | #pragma pack(1) /* Always align structures to byte boundery */ 83 | #ifndef STRICT /* Check Typdefinition */ 84 | #define STRICT 85 | #endif 86 | #endif /* _MSC_VER >= 1000 */ 87 | 88 | /* support for GNU compiler */ 89 | #ifdef __GNUC__ 90 | #define __OMBAP_PACKED_PRE 91 | #define __OMBAP_PACKED_POST __attribute__((__packed__)) 92 | #endif 93 | 94 | /* support for REALVIEW ARM compiler */ 95 | #if defined (__ADS__) || defined (__REALVIEW__) 96 | #define __OMBAP_PACKED_PRE __packed 97 | #define __OMBAP_PACKED_POST 98 | #endif 99 | 100 | 101 | /*************************************************************************************/ 102 | /* Omb OmbApTask public, packets */ 103 | 104 | 105 | /* 106 | * Structures of all Request/Confirmation commands the task is able to send and receive 107 | * 108 | * Request and Confirmation Packets __PREFIX___PACKET___TASKNAME___xx_REQ/CNF 109 | * (xx = Command) 110 | * 111 | * Use the same order as the commands in TLR_Commands.h 112 | * __PREFIX_____TASKNAME___xx_REQ/CNF (xx = Command)! 113 | */ 114 | 115 | 116 | 117 | 118 | /*** Definition of the packet types this Task is able to receive/send as server ***/ 119 | 120 | /* Set Bus on (command RCX_START_STOP_COMM_REQ) */ 121 | 122 | /* Request */ 123 | typedef __OMBAP_PACKED_PRE struct OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_REQ_Ttag 124 | { 125 | TLR_BOOLEAN32 fBusOn; /* Bus-on */ 126 | 127 | } __OMBAP_PACKED_POST OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_REQ_T; 128 | 129 | #define OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_REQ_SIZE \ 130 | (sizeof(OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_REQ_T)) 131 | 132 | typedef __OMBAP_PACKED_PRE struct OMB_OMBAPTASK_PACKET_CMD_SET_BUS_ON_REQ_Ttag 133 | { 134 | TLR_PACKET_HEADER_T tHead; 135 | OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_REQ_T tData; 136 | 137 | } __OMBAP_PACKED_POST OMB_OMBAPTASK_PACKET_CMD_SET_BUS_ON_REQ_T; 138 | 139 | 140 | /* Confirmation */ 141 | typedef __OMBAP_PACKED_PRE struct OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_CNF_Ttag 142 | { 143 | TLR_BOOLEAN32 fBusOn; /* Bus-on */ 144 | 145 | } __OMBAP_PACKED_POST OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_CNF_T; 146 | 147 | #define OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_CNF_SIZE \ 148 | (sizeof(OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_CNF_T)) 149 | 150 | typedef __OMBAP_PACKED_PRE struct OMB_OMBAPTASK_PACKET_CMD_SET_BUS_ON_CNF_Ttag 151 | { 152 | TLR_PACKET_HEADER_T tHead; 153 | OMB_OMBAPTASK_DATA_CMD_SET_BUS_ON_CNF_T tData; 154 | 155 | } __OMBAP_PACKED_POST OMB_OMBAPTASK_PACKET_CMD_SET_BUS_ON_CNF_T; 156 | 157 | 158 | /*---------------------------------------------------------------------------*/ 159 | /* Compiler settings */ 160 | #if _MSC_VER >= 1000 161 | #pragma pack() /* Always allign structures to compiler settings */ 162 | #endif /* _MSC_VER >= 1000 */ 163 | /*---------------------------------------------------------------------------*/ 164 | 165 | #undef __OMBAP_PACKED_PRE 166 | #undef __OMBAP_PACKED_POST 167 | 168 | /*************************************************************************************/ 169 | #endif /* #ifndef __OMB_OMBAPTASK_PUBLIC_H */ 170 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/OmbOmbApTask_error.h: -------------------------------------------------------------------------------- 1 | #ifndef __OMB_OMBAPTASK_ERROR_H 2 | #define __OMB_OMBAPTASK_ERROR_H 3 | 4 | ///////////////////////////////////////////////////////////////////////////////////// 5 | // OMB OmbApTask Packet Status codes (Open Modbus TCP AP Task) 6 | ///////////////////////////////////////////////////////////////////////////////////// 7 | //MessageId = 0x0001 8 | //Severity = Error 9 | //Facility = TLR_UNQ_NR_OMB_OMB_AP 10 | //SymbolicName = TLR_E_OMB_OMBAPTASK_COMMAND_INVALID 11 | //Language = English 12 | //Invalid command received. 13 | //. 14 | //Language = German 15 | //Ungultiges Kommando erhalten. 16 | //. 17 | //MessageId = 0x0002 18 | //Severity = Information 19 | //Facility = TLR_UNQ_NR_OMB_OMB_AP 20 | //SymbolicName = TLR_I_OMB_OMBAPTASK_CONFIG_LOCK 21 | //Language = English 22 | //Configuration is locked. 23 | //. 24 | //Language = German 25 | //Die Konfiguration ist gesperrt. 26 | //. 27 | // 28 | // MessageId: TLR_E_OMB_OMBAPTASK_WATCHDOG_PARAMETER 29 | // 30 | // MessageText: 31 | // 32 | // Invalid parameter for watchdog supervision. 33 | // 34 | #define TLR_E_OMB_OMBAPTASK_WATCHDOG_PARAMETER ((TLR_RESULT)0xC0610003L) 35 | 36 | // 37 | // MessageId: TLR_E_OMB_OMBAPTASK_WATCHDOG_ACTIVATE 38 | // 39 | // MessageText: 40 | // 41 | // Failed to activate watchdog supervision. 42 | // 43 | #define TLR_E_OMB_OMBAPTASK_WATCHDOG_ACTIVATE ((TLR_RESULT)0xC0610004L) 44 | 45 | //MessageId = 0x0005 46 | //Severity = Error 47 | //Facility = TLR_UNQ_NR_OMB_OMB_AP 48 | //SymbolicName = TLR_E_OMB_OMBAPTASK_REQUEST_RUNNING 49 | //Language = English 50 | //Request already running. 51 | //. 52 | //Language = German 53 | //Ein Befehl is bereits aktiv. 54 | //. 55 | // 56 | // MessageId: TLR_E_OMB_OMBAPTASK_SYS_FLAG_PARAMETER 57 | // 58 | // MessageText: 59 | // 60 | // Invalid parameter for system flags. 61 | // 62 | #define TLR_E_OMB_OMBAPTASK_SYS_FLAG_PARAMETER ((TLR_RESULT)0xC0610006L) 63 | 64 | // 65 | // MessageId: TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_QUE_ELEM_CNT 66 | // 67 | // MessageText: 68 | // 69 | // Invalid Startup Parameter ulQueElemCnt. 70 | // 71 | #define TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_QUE_ELEM_CNT ((TLR_RESULT)0xC0610007L) 72 | 73 | // 74 | // MessageId: TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_POOL_ELEM_CNT 75 | // 76 | // MessageText: 77 | // 78 | // Invalid Startup Parameter ulPoolElemCnt. 79 | // 80 | #define TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_POOL_ELEM_CNT ((TLR_RESULT)0xC0610008L) 81 | 82 | // 83 | // MessageId: TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_START_FLAGS 84 | // 85 | // MessageText: 86 | // 87 | // Invalid Startup Parameter ulStartFlags. 88 | // 89 | #define TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_START_FLAGS ((TLR_RESULT)0xC0610009L) 90 | 91 | // 92 | // MessageId: TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_CHN_INST 93 | // 94 | // MessageText: 95 | // 96 | // Invalid Startup Parameter ulChnInst. 97 | // 98 | #define TLR_E_OMB_OMBAPTASK_INVALID_STARTUP_PARAMETER_CHN_INST ((TLR_RESULT)0xC061000AL) 99 | 100 | // 101 | // MessageId: TLR_E_OMB_OMBAPTASK_FATAL_ERROR_OMB_TASK 102 | // 103 | // MessageText: 104 | // 105 | // The OMB task reports a fatal error. System has stopped. 106 | // See extended status tMidCodeDiag for further information. 107 | // 108 | #define TLR_E_OMB_OMBAPTASK_FATAL_ERROR_OMB_TASK ((TLR_RESULT)0xC061000BL) 109 | 110 | // 111 | // MessageId: TLR_E_OMB_OMBAPTASK_COMMAND_EXCEEDS_DPM_SIZE 112 | // 113 | // MessageText: 114 | // 115 | // The OMB task reports a fatal error. System has stopped. 116 | // See extended status tMidCodeDiag for further information. 117 | // 118 | #define TLR_E_OMB_OMBAPTASK_COMMAND_EXCEEDS_DPM_SIZE ((TLR_RESULT)0xC061000CL) 119 | 120 | // 121 | // MessageId: TLR_E_OMB_OMBAPTASK_COMMAND_OVERLAPED_DPM_OFFSET 122 | // 123 | // MessageText: 124 | // 125 | // The OMB task reports a fatal error. System has stopped. 126 | // See extended status tMidCodeDiag for further information. 127 | // 128 | #define TLR_E_OMB_OMBAPTASK_COMMAND_OVERLAPED_DPM_OFFSET ((TLR_RESULT)0xC061000DL) 129 | 130 | // 131 | // MessageId: TLR_E_OMBAPTASK_COMMAND_NOT_ALLOWED_IN_CURRENT_MODE 132 | // 133 | // MessageText: 134 | // 135 | // The OMB task reports a fatal error. The packet is not allowed to be sent. 136 | // 137 | #define TLR_E_OMBAPTASK_COMMAND_NOT_ALLOWED_IN_CURRENT_MODE ((TLR_RESULT)0xC061000EL) 138 | 139 | // 140 | // MessageId: TLR_E_OMBAPTASK_COMMAND_NOT_ALLOWED_IN_CURRENT_OMB_STATE 141 | // 142 | // MessageText: 143 | // 144 | // The OMB task reports a fatal error. The packet is not allowed to be sent at this state. 145 | // 146 | #define TLR_E_OMBAPTASK_COMMAND_NOT_ALLOWED_IN_CURRENT_OMB_STATE ((TLR_RESULT)0xC061000FL) 147 | 148 | 149 | 150 | 151 | #endif //__OMB_OMBAPTASK_ERROR_H 152 | 153 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/OmbOmb_DiagStructDef.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: OmbOmb_DiagStructDef.h 3661 2015-09-30 07:19:11Z iborisov $: 5 | Description: 6 | Omb Task 7 | Includes following functions... 8 | **************************************************************************************/ 9 | 10 | #ifndef __STRUCT_OMB_OMB_INFO_STATUS__ 11 | #define __STRUCT_OMB_OMB_INFO_STATUS__ 12 | 13 | #include "TLR_Types.h" 14 | 15 | typedef __PACKED_PRE struct __PACKED_POST OMB_OMB_INFO_STATUStag { 16 | /* Task State */ 17 | TLR_UINT32 ulTaskState; 18 | /* Error Count */ 19 | TLR_UINT32 ulErrorCount; 20 | /* Last Error */ 21 | TLR_UINT32 ulLastError; 22 | /* Socket Status */ 23 | TLR_UINT32 ulOpenSockets; 24 | /* Cyclic Event Count */ 25 | TLR_UINT32 ulCyclicCount; 26 | /* Idle Count */ 27 | TLR_UINT32 ulIdleCount; 28 | } OMB_OMB_INFO_STATUS; 29 | #endif 30 | #ifndef __STRUCT_OMB_OMB_CLIENT_STATUS__ 31 | #define __STRUCT_OMB_OMB_CLIENT_STATUS__ 32 | typedef __PACKED_PRE struct __PACKED_POST OMB_OMB_CLIENT_STATUStag { 33 | /* Messages Send to User */ 34 | TLR_UINT32 ulMsgSend; 35 | /* Messages Recv from User */ 36 | TLR_UINT32 ulMsgRecv; 37 | /* FC1 Count */ 38 | TLR_UINT32 ulFc1Cnt; 39 | /* FC2 Count */ 40 | TLR_UINT32 ulFc2Cnt; 41 | /* FC3 Count */ 42 | TLR_UINT32 ulFc3Cnt; 43 | /* FC4 Count */ 44 | TLR_UINT32 ulFc4Cnt; 45 | /* FC5 Count */ 46 | TLR_UINT32 ulFc5Cnt; 47 | /* FC6 Count */ 48 | TLR_UINT32 ulFc6Cnt; 49 | /* FC7 Count */ 50 | TLR_UINT32 ulFc7Cnt; 51 | /* FC15 Count */ 52 | TLR_UINT32 ulFc15Cnt; 53 | /* FC16 Count */ 54 | TLR_UINT32 ulFc16Cnt; 55 | /* FC23 Count */ 56 | TLR_UINT32 ulFc23Cnt; 57 | } OMB_OMB_CLIENT_STATUS; 58 | #endif 59 | #ifndef __STRUCT_OMB_OMB_SERVER_STATUS__ 60 | #define __STRUCT_OMB_OMB_SERVER_STATUS__ 61 | typedef __PACKED_PRE struct __PACKED_POST OMB_OMB_SERVER_STATUStag { 62 | /* Messages Send to TCP-Task */ 63 | TLR_UINT32 ulMsgSend; 64 | /* Messages Recv from TCP-Task */ 65 | TLR_UINT32 ulMsgRecv; 66 | /* FC1 Count */ 67 | TLR_UINT32 ulFc1Cnt; 68 | /* FC2 Count */ 69 | TLR_UINT32 ulFc2Cnt; 70 | /* FC3 Count */ 71 | TLR_UINT32 ulFc3Cnt; 72 | /* FC4 Count */ 73 | TLR_UINT32 ulFc4Cnt; 74 | /* FC5 Count */ 75 | TLR_UINT32 ulFc5Cnt; 76 | /* FC6 Count */ 77 | TLR_UINT32 ulFc6Cnt; 78 | /* FC7 Count */ 79 | TLR_UINT32 ulFc7Cnt; 80 | /* FC15 Count */ 81 | TLR_UINT32 ulFc15Cnt; 82 | /* FC16 Count */ 83 | TLR_UINT32 ulFc16Cnt; 84 | /* FC23 Count */ 85 | TLR_UINT32 ulFc23Cnt; 86 | } OMB_OMB_SERVER_STATUS; 87 | #endif 88 | #ifndef __STRUCT_OMB_OMB_IO_STATUS__ 89 | #define __STRUCT_OMB_OMB_IO_STATUS__ 90 | typedef __PACKED_PRE struct __PACKED_POST OMB_OMB_IO_STATUStag { 91 | /* Messages Send to TCP-Task */ 92 | TLR_UINT32 ulMsgSend; 93 | /* Messages Recv from TCP-Task */ 94 | TLR_UINT32 ulMsgRecv; 95 | /* FC1 Count */ 96 | TLR_UINT32 ulFc1Cnt; 97 | /* FC2 Count */ 98 | TLR_UINT32 ulFc2Cnt; 99 | /* FC3 Count */ 100 | TLR_UINT32 ulFc3Cnt; 101 | /* FC4 Count */ 102 | TLR_UINT32 ulFc4Cnt; 103 | /* FC5 Count */ 104 | TLR_UINT32 ulFc5Cnt; 105 | /* FC6 Count */ 106 | TLR_UINT32 ulFc6Cnt; 107 | /* FC7 Count */ 108 | TLR_UINT32 ulFc7Cnt; 109 | /* FC15 Count */ 110 | TLR_UINT32 ulFc15Cnt; 111 | /* FC16 Count */ 112 | TLR_UINT32 ulFc16Cnt; 113 | /* FC23 Count */ 114 | TLR_UINT32 ulFc23Cnt; 115 | /* Modbus address */ 116 | TLR_UINT16 usModbusAdr; 117 | /* Data count */ 118 | TLR_UINT16 usDataCnt; 119 | /* Function code */ 120 | TLR_UINT16 usFunction; 121 | /* Data */ 122 | TLR_UINT16 ausData[3]; 123 | /* Error Count */ 124 | TLR_UINT32 ulErrorCount; 125 | /* Last Error */ 126 | TLR_UINT32 ulLastError; 127 | /* Process data watchdog event counter */ 128 | TLR_UINT32 ulPdwEventCounter; 129 | } OMB_OMB_IO_STATUS; 130 | #endif 131 | #ifndef __STRUCT_MID_CDG_CODE_DIAG__ 132 | #define __STRUCT_MID_CDG_CODE_DIAG__ 133 | typedef __PACKED_PRE struct __PACKED_POST MID_CDG_CODE_DIAGtag { 134 | /* Info Count */ 135 | TLR_UINT32 ulInfoCnt; 136 | /* Warning Count */ 137 | TLR_UINT32 ulWarningCnt; 138 | /* Error Count */ 139 | TLR_UINT32 ulErrorCnt; 140 | /* Severity Level */ 141 | TLR_UINT32 ulDiagLevel; 142 | /* Code */ 143 | TLR_UINT32 ulErrorCode; 144 | /* Parameter */ 145 | TLR_UINT32 ulUserParam; 146 | /* Module */ 147 | TLR_CHAR abCodeDiagFilename[32]; 148 | /* Line Number */ 149 | TLR_INT32 lLine; 150 | /* Resource Pointer (hidden!!) */ 151 | TLR_UINT32 ulRsc; 152 | } MID_CDG_CODE_DIAG; 153 | #endif 154 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/TcpipConfig.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: TcpipConfig.h 63545 2016-08-29 09:04:12Z RalfH $: 5 | 6 | Description: 7 | Configurable parameters of TCP/UDP task 8 | **************************************************************************************/ 9 | 10 | 11 | #ifndef __TCPIP_CONFIG_H 12 | #define __TCPIP_CONFIG_H 13 | 14 | #include "rX_Version.h" 15 | 16 | /*-------------------------------------------------------------------------* 17 | * Program Options * 18 | *-------------------------------------------------------------------------*/ 19 | 20 | 21 | /*-------------------------------------------------------------------------* 22 | * Debug Options * 23 | *-------------------------------------------------------------------------*/ 24 | 25 | /* #define DEBUG_TCPIP_CONFIG Enable debug options, see details below */ 26 | 27 | #ifdef DEBUG_TCPIP_CONFIG 28 | 29 | #warning "!!!!!!!!!! Warning: Debug options DEBUG_TCPIP_CONFIG enabled !!!!!!!!!!" 30 | 31 | /* #define DEBUG_TCP_FSM_EVENT_COUNTER Enable TCP state machine event counters */ 32 | /* #define DEBUG_ETH_OUT_FRAME_PADDING_BY_SOFTWARE Circumvent automatic frame padding by controller */ 33 | /* #define DEBUG_TCP_SEND_CALL_TRACE Enable tcp_send call trace */ 34 | /* #define DEBUG_DHCP_EVENT_TRACE Enable DHCP event trace */ 35 | /* #define DEBUG_TCP_LED_LIVESIGN Enable LiveSign LED in cyclic event (packet) */ 36 | 37 | #endif /* #ifdef DEBUG_TCPIP_CONFIG */ 38 | 39 | 40 | /*-------------------------------------------------------------------------* 41 | * Constants * 42 | *-------------------------------------------------------------------------*/ 43 | 44 | /* Optional functionality */ 45 | #define CONFIG_MCAST /* Enable multicast functionality */ 46 | 47 | /* #define CONFIG_NID_SET_IP_ADDR_TIME_RESTRICTED Enable time restriction for NetIdent's SetIpAddress */ 48 | 49 | /* #define CONFIG_ARP_REQ_INTF Enable user interface for sending ARP requests */ 50 | #define CONFIG_ARP_REQ_INTF_DBLY /* Enable user interface for sending ARP requests (new version) */ 51 | 52 | 53 | /**************************************************************************************************************** 54 | * 55 | * TCP/IP stack configuration (memory consumption) 56 | * See also startup parameters TCPIP_TCP_TASK_STARTUPPARAMETER_T (TcpipTcpTask_Functionlist.h) 57 | * 58 | * Parameter Declaration Default 59 | * --------------------------------------------------------------------------------------------- 60 | * 61 | * TCP_RECV_BUF_SIZE Socket's receive buffer size 2048 62 | * 63 | * ETH_FRAME_MIN_LEN Min length of an Ethernet frame 60 64 | * 65 | * IP_MSS Maximum segment size for Ethernet 1400 66 | * 67 | * ARP_HASH_SIZE Number of entries in ARP hash table 16 68 | * ARP_TIMEOUT_xx See below.. 69 | * 70 | * ROUTE_CACHE_SIZE Number of entries in route cache 32 71 | * ROUTE_HASH_SIZE Number of entries in route hash table 16 72 | * ROUTE_TIMEOUT_CACHE Timeout for route cache entries (seconds) 900 73 | * 74 | * MCAST_TABLE_SIZE Number of entries multicast address table 96 75 | * MCAST_HASH_SIZE Number of entries in multicast address 76 | * hash table 16 77 | * 78 | * EMTY_QUE_DATA_SIZE Empty queue max. data size for receive data TCPIP_MAX_TCP_UDP_DATA_CNT 79 | * (1472 = max. UDP datagram size!, see TcpipTcpTask_Public.h) 80 | * 81 | ****************************************************************************************************************/ 82 | 83 | 84 | /* Size of socket's receive buffer */ 85 | #define TCP_RECV_BUF_SIZE (2048) /* Equals max. TCP receive window */ 86 | /* Note: TCP_RECV_BUF_SIZE must be a power of 2, else the ring */ 87 | /* buffer mechanism will fail */ 88 | /* TCP_RECV_BUF_SIZE must not exceed 32767, else some */ 89 | /* signed integer variables will overflow */ 90 | /* Don't forget to adjust the TMIF_ADJUST_RECV_BUF_OFFSET */ 91 | /* macro definition when changing TCP_RECV_BUF_SIZE */ 92 | 93 | /* Maximum segment size for Ethernet */ 94 | #define IP_MSS (1400) 95 | 96 | #define ETH_FRAME_MIN_LEN (60) /* Min length of an Ethernet frame = 6 + 6 + 2 + 46 ( = Dst MAC */ 97 | /* Adr + Src MAC Adr + Type field + min Ethernet data part */ 98 | /* (46 ... 1500 bytes) ) */ 99 | 100 | /* ARP cache sizes */ 101 | #define ARP_HASH_SIZE (16) /* Number of entries in ARP hash table, must be power of 2 */ 102 | 103 | #define ARP_TIMEOUT_RESOLVE (10) /* Timeout before removing resolving cache entries (seconds) */ 104 | #define ARP_TIMEOUT_RESOLVE_SILENT (1) /* Time between ARP requests for the same IP address (seconds) */ 105 | /* #define ARP_TIMEOUT_CACHE (600L) Timeout for ARP cache entries (seconds) - is now a startup */ 106 | /* parameter ulArpTimeoutCache */ 107 | 108 | #define ARP_TIMEOUT_CACHE_DIRECT (5L) /* Time "window" after ARP timeout ulArpTimeoutCache (startup */ 109 | /* parameter) is elapsed. Inside this window, we send a */ 110 | /* Direct ARP */ 111 | 112 | #define ARP_TIMEOUT_CACHE_HOLD (10) /* Timeout before removing old cache entries (seconds) */ 113 | #define ARP_TIMEOUT_DIRECT_ARP (ARP_TIMEOUT_RESOLVE_SILENT) /* Timeout for Direct ARP answer */ 114 | 115 | #define ARP_DIRECT_ARP_MAX_CNT (3) /* Max count of Direct ARP attempt after ARP timeout is elapsed */ 116 | #define ARP_MAX_RND_VALUE (2047L) /* Max random value (milliseconds) / RndGetRandom16(ptRsc)>>5 */ 117 | /* = (2^16-1)>>5 = 2047 / if change, consider the >>5 (search */ 118 | /* for ARP_MAX_RND_VALUE!) */ 119 | /* Route cache sizes */ 120 | #define ROUTE_CACHE_SIZE (32) /* Number of entries in route cache, must be multiple of 16 */ 121 | #define ROUTE_HASH_SIZE (16) /* Number of entries in route hash table, must be power of 2 */ 122 | 123 | #define ROUTE_TIMEOUT_CACHE (900) /* Timeout for route cache entries (seconds) */ 124 | 125 | 126 | /* IP multicast management table sizes */ 127 | #define MCAST_TABLE_SIZE (96) /* Number of entries multicast address table, must be multiple */ 128 | /* of 16 */ 129 | #define MCAST_HASH_SIZE (16) /* Number of entries in multicast address hash table, must be */ 130 | /* power of 2 */ 131 | 132 | 133 | /* Packet definitions */ 134 | #define EMTY_QUE_DATA_SIZE TCPIP_MAX_TCP_UDP_DATA_CNT /* Empty queue max. data size for receive */ 135 | /* data (request command TCPIP_TCP_UDP_CMD_RECEIVE_IND) */ 136 | 137 | 138 | /* Debug: DHCP event trace */ 139 | #define DHCP_EVENT_TRACE_BUFFER_SIZE (1000 * sizeof(DHCP_EVENT_TRACE_ENTRY)) 140 | 141 | 142 | /* Name of tasks */ 143 | #define TCP_TASK_NAME "TCP_UDP" 144 | 145 | 146 | /* Name of database (DBM/NXD file) */ 147 | #if RCX_VERSION < MAKE_RCX_VERSION(2,2,0) 148 | #define IP_DBM_FILENAME_DBM "CONFIG.DBM" 149 | #define IP_DBM_FILENAME_NXD "CONFIG.NXD" 150 | #else 151 | #define IP_DBM_FILENAME_DBM "SYSVOLUME:/PORT_0/CONFIG.DBM" 152 | #define IP_DBM_FILENAME_NXD "SYSVOLUME:/PORT_0/CONFIG.NXD" 153 | #endif 154 | #define IP_DBM_FILENAME_LEN 10 155 | 156 | /* Directory of database (DBM file) */ 157 | #define IP_DBM_DIR_NAME "PORT_0" /* Default = _0 = Task instance 0 - */ 158 | /* changed by software to _0 ... _3! */ 159 | #define IP_DBM_DIR_NAME_LEN 6 160 | 161 | 162 | /* Names of DBM tables */ 163 | #define IP_DBM_TABLE_NAME_ETHERNET "ETHERNET" 164 | #define IP_DBM_TABLE_NAME_SETUP "IP_SETUP" 165 | 166 | #define TCP_PACKET_TIMEOUT_SEND 10 167 | #define TCP_PACKET_TIMEOUT_WAIT 1000 168 | 169 | #endif /* #ifndef __TCPIP_CONFIG_H */ 170 | 171 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/rX_Macros.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | 3 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 4 | 5 | *************************************************************************************** 6 | 7 | $Id: rX_Macros.h 1892 2014-10-08 06:50:54Z stephans $: 8 | 9 | Description: 10 | rcX helper macros 11 | 12 | Changes: 13 | Date Description 14 | ----------------------------------------------------------------------------------- 15 | 2011-05-20 ported from rcX V2 16 | 17 | **************************************************************************************/ 18 | 19 | #ifndef __RX_MACROS_H 20 | #define __RX_MACROS_H 21 | 22 | /* 23 | ************************************************************ 24 | * Word manipulations 25 | ************************************************************ 26 | */ 27 | 28 | #define SWAP_UINT32(a) ((((UINT32)(a) & 0x000000FF)<<24) | \ 29 | (((UINT32)(a) & 0x0000FF00)<<8) | \ 30 | (((UINT32)(a) & 0x00FF0000)>>8) | \ 31 | (((UINT32)(a) & 0xFF000000)>>24)) 32 | 33 | /* 34 | ************************************************************ 35 | * Double-Link List manipulations 36 | ************************************************************ 37 | */ 38 | /* Unlink Element from Doubly Linked List */ 39 | #define RX_DBLY_REMOVE(Elmt) {(Elmt)->tDblyLnk.ptPrv->ptNxt = (Elmt)->tDblyLnk.ptNxt; \ 40 | (Elmt)->tDblyLnk.ptNxt->ptPrv = (Elmt)->tDblyLnk.ptPrv; \ 41 | } 42 | /* Link Element to End of Doubly Linked List */ 43 | #define RX_DBLY_APPEND(Elmt,Sntl) {(Elmt)->tDblyLnk.ptNxt = &(Sntl); \ 44 | (Elmt)->tDblyLnk.ptPrv = (Sntl).ptPrv; \ 45 | (Sntl).ptPrv->ptNxt = (RX_DOUBLE_LINK_T FAR*)(Elmt); \ 46 | (Sntl).ptPrv = (RX_DOUBLE_LINK_T FAR*)(Elmt); \ 47 | } 48 | /* Link Element ahead of destination Element */ 49 | #define RX_DBLY_INSERT_BEFORE(ElmtSrc,ElmtDst) {(ElmtSrc)->tDblyLnk.ptNxt = (RX_DOUBLE_LINK_T FAR*)(ElmtDst); \ 50 | (ElmtSrc)->tDblyLnk.ptPrv = (RX_DOUBLE_LINK_T FAR*)(ElmtDst)->tDblyLnk.ptPrv; \ 51 | (ElmtDst)->tDblyLnk.ptPrv->ptNxt = (RX_DOUBLE_LINK_T FAR*)(ElmtSrc); \ 52 | (ElmtDst)->tDblyLnk.ptPrv = (RX_DOUBLE_LINK_T FAR*)(ElmtSrc); \ 53 | } 54 | /* Link Element after the destination Element */ 55 | #define RX_DBLY_INSERT_AFTER(ElmtSrc,ElmtDst) {(ElmtSrc)->tDblyLnk.ptNxt = (RX_DOUBLE_LINK_T FAR*)(ElmtDst)->tDblyLnk.ptNxt; \ 56 | (ElmtSrc)->tDblyLnk.ptPrv = (RX_DOUBLE_LINK_T FAR*)(ElmtDst); \ 57 | (ElmtDst)->tDblyLnk.ptNxt->ptPrev = (RX_DOUBLE_LINK_T FAR*)ElmtSrc); \ 58 | (ElmtDst)->tDblyLnk.ptNxt = (RX_DOUBLE_LINK_T FAR*)(ElmtSrc); \ 59 | } 60 | 61 | 62 | /* Reset Doubly Linked List and make it empty */ 63 | #define RX_DBLY_RESET(Sntl) { (Sntl).ptPrv = &(Sntl); \ 64 | (Sntl).ptNxt = &(Sntl); \ 65 | } 66 | 67 | /* Tests if Sentinel is filled */ 68 | #define IS_DBLY_FILLED(Sntl) ((Sntl).ptNxt != &(Sntl)) 69 | 70 | /* 71 | ***************************************************** 72 | * MIN, MAX Macros 73 | ***************************************************** 74 | */ 75 | 76 | #ifndef MAX 77 | #define MAX(a,b) (((a) > (b)) ? (a) : (b)) 78 | #endif 79 | 80 | #ifndef MIN 81 | #define MIN(a,b) (((a) > (b)) ? (b) : (a)) 82 | #endif 83 | 84 | #ifndef MAX_CNT 85 | #define MAX_CNT(x) (sizeof(x) / sizeof(x[0])) 86 | #endif 87 | 88 | /* 89 | ***************************************************** 90 | * PEEK, POKE Macros 91 | ***************************************************** 92 | */ 93 | 94 | #define POKE(addr, val) (*(volatile UINT *)(addr) = (UINT)(val)) 95 | #define POKE_AND(addr, val) (*(volatile UINT *)(addr) &= (UINT)(val)) 96 | #define POKE_OR(addr, val) (*(volatile UINT *)(addr) |= (UINT)(val)) 97 | #define PEEK(addr) (*(volatile UINT *)(addr)) 98 | 99 | /* 100 | ***************************************************** 101 | * rcX Version Macro 102 | ***************************************************** 103 | */ 104 | #define MAKE_RCX_VERSION(major,minor,build) ( ((major&0xFF)<<24) | \ 105 | ((minor&0xFF)<<16) | \ 106 | (build&0xFFFF)) 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /examples/includes/ModbusTCP/rX_Version.h: -------------------------------------------------------------------------------- 1 | #ifndef __RX_VERSION_H 2 | #define __RX_VERSION_H 3 | 4 | /*****************************************************************************/ 5 | /* Include Files Required */ 6 | /*****************************************************************************/ 7 | #include "rX_Macros.h" 8 | 9 | /*****************************************************************************/ 10 | /* Symbol Definitions */ 11 | /*****************************************************************************/ 12 | #define RCX_VERSION_MAJOR 2 13 | #define RCX_VERSION_MINOR 1 14 | #define RCX_VERSION_BUILD 11 15 | #define RCX_VERSION_REVISION 10 16 | #define RCX_VERSION MAKE_RCX_VERSION(RCX_VERSION_MAJOR,RCX_VERSION_MINOR,RCX_VERSION_BUILD) 17 | #endif /* __RX_VERSION_H */ 18 | -------------------------------------------------------------------------------- /examples/includes/POWERLINK/EplCn_Defines.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: EplCn_Defines.h 3176 2017-07-05 15:26:30Z Ricky $: 5 | 6 | Description: 7 | Public definitions for Powerlink Controlled Node 8 | **************************************************************************************/ 9 | 10 | #ifndef EPLCN_DEFINES_H_ 11 | #define EPLCN_DEFINES_H_ 12 | 13 | /*************************************************************************************/ 14 | /* Error Entry */ 15 | /*************************************************************************************/ 16 | /* Error Entry Type */ 17 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_STATUS 0x8000 18 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_SEND 0x4000 19 | 20 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_MODE_MASK_IN_TYPE 0x3000 21 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_MODE_ERROR_STATUS_CLEARED 0x0000 22 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_MODE_ERROR_OCCURED_AND_ACTIVE 0x1000 23 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_MODE_ERROR_WAS_CLEARED 0x2000 24 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_MODE_ERROR_OCCURED 0x3000 25 | 26 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_PROFILE_MASK_IN_TYPE 0x0FFF 27 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_PROFILE_VENDOR_SPECIFIC 0x0001 28 | #define EPLCN_NMT_ERROR_ENTRY_TYPE_PROFILE_COMMUNICATION 0x0002 29 | 30 | /* Error Entry Code */ 31 | /* Triggered by IF-Task */ 32 | #define EPLCN_NMT_ERROR_ENTRY_E_PDO_SHORT_RX 0x8210 33 | #define EPLCN_NMT_ERROR_ENTRY_E_PDO_MAP_VERS 0x8211 34 | /* Triggered by Stack */ 35 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_COLLISION_TH 0x8163 36 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_CRC_TH 0x8164 37 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_LOSS_OF_LINK 0x8165 38 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_JITTER_TH 0x8235 39 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_LOSS_PREQ_TH 0x8242 40 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_LOSS_SOA_TH 0x8244 41 | #define EPLCN_NMT_ERROR_ENTRY_E_DLL_LOSS_SOC_TH 0x8245 42 | 43 | 44 | #endif /* EPLCN_DEFINES_H_ */ 45 | /*************************************************************************************/ 46 | /*-----------------------------------------------------------------------------------*/ 47 | /*------------------- EOF -----------------------------------------------------------*/ 48 | /*-----------------------------------------------------------------------------------*/ 49 | /*************************************************************************************/ 50 | -------------------------------------------------------------------------------- /examples/includes/POWERLINK/EplCn_If_Results.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: EplCn_If_Results.h 3176 2017-07-05 15:26:30Z Ricky $: 5 | 6 | Description: 7 | Powerlink Controlled Node result codes definitions for IF Task 8 | **************************************************************************************/ 9 | 10 | #ifndef __EPLCN_IF_RESULTS_H 11 | #define __EPLCN_IF_RESULTS_H 12 | 13 | #include 14 | 15 | ///////////////////////////////////////////////////////////////////////////////////// 16 | // POWERLINK Controlled Node result codes for IF Task 17 | ///////////////////////////////////////////////////////////////////////////////////// 18 | // 19 | // MessageId: ERR_EPLCN_IF_LEGACY_PARAMETER_NOT_SUPPORTED 20 | // 21 | // MessageText: 22 | // 23 | // Parameter of the current legacy service is not supported any more. 24 | // 25 | #define ERR_EPLCN_IF_LEGACY_PARAMETER_NOT_SUPPORTED ((uint32_t)0xC0E30001L) 26 | 27 | #endif /* __EPLCN_IF_RESULTS_H */ 28 | -------------------------------------------------------------------------------- /examples/includes/POWERLINK/EplCn_Nmt_Results.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: EplCn_Nmt_Results.h 3176 2017-07-05 15:26:30Z Ricky $: 5 | 6 | Description: 7 | Powerlink Controlled Node result codes definitions for NMT component 8 | **************************************************************************************/ 9 | 10 | #ifndef __EPLCN_NMT_RESULTS_H 11 | #define __EPLCN_NMT_RESULTS_H 12 | 13 | #include 14 | 15 | ///////////////////////////////////////////////////////////////////////////////////// 16 | // POWERLINK Controlled Node result codes for NMT component 17 | ///////////////////////////////////////////////////////////////////////////////////// 18 | // 19 | // MessageId: ERR_EPLCN_NMT_INVALID_STATE_CHANGE 20 | // 21 | // MessageText: 22 | // 23 | // Invalid state change. 24 | // 25 | #define ERR_EPLCN_NMT_INVALID_STATE_CHANGE ((uint32_t)0xC0E60001L) 26 | 27 | // 28 | // MessageId: ERR_EPLCN_NMT_STACK_NOT_CONFIGURED 29 | // 30 | // MessageText: 31 | // 32 | // Stack is not configured. 33 | // 34 | #define ERR_EPLCN_NMT_STACK_NOT_CONFIGURED ((uint32_t)0xC0E60002L) 35 | 36 | // 37 | // MessageId: ERR_EPLCN_NMT_NOT_ALLOWED_IN_ACT_STATE 38 | // 39 | // MessageText: 40 | // 41 | // Action not allowed in current NMT state. 42 | // 43 | #define ERR_EPLCN_NMT_NOT_ALLOWED_IN_ACT_STATE ((uint32_t)0xC0E60003L) 44 | 45 | // 46 | // MessageId: ERR_EPLCN_NMT_MAX_PDO_SIZE_EXCEEDED 47 | // 48 | // MessageText: 49 | // 50 | // Maximum allowed PDO exceeded. 51 | // 52 | #define ERR_EPLCN_NMT_MAX_PDO_SIZE_EXCEEDED ((uint32_t)0xC0E60004L) 53 | 54 | // 55 | // MessageId: ERR_EPLCN_NMT_ENTRY_TYPE_IS_NOT_ERROR_ENTRY 56 | // 57 | // MessageText: 58 | // 59 | // Entry type is not ErrorEntry. 60 | // 61 | #define ERR_EPLCN_NMT_ENTRY_TYPE_IS_NOT_ERROR_ENTRY ((uint32_t)0xC0E60005L) 62 | 63 | // 64 | // MessageId: ERR_EPLCN_NMT_ENTRY_TYPE_IS_NOT_STATUS_ENTRY 65 | // 66 | // MessageText: 67 | // 68 | // Entry type is not StatusEntry. 69 | // 70 | #define ERR_EPLCN_NMT_ENTRY_TYPE_IS_NOT_STATUS_ENTRY ((uint32_t)0xC0E60006L) 71 | 72 | // 73 | // MessageId: ERR_EPLCN_NMT_MAX_NUM_STATUS_ENTRIES_EXCEEDED 74 | // 75 | // MessageText: 76 | // 77 | // Maximum allowed number of StatusEntry exceeded. 78 | // 79 | #define ERR_EPLCN_NMT_MAX_NUM_STATUS_ENTRIES_EXCEEDED ((uint32_t)0xC0E60007L) 80 | 81 | // 82 | // MessageId: ERR_EPLCN_NMT_CONFIGURED_NUM_STATUS_ENTRIES_EXCEEDED 83 | // 84 | // MessageText: 85 | // 86 | // Entry number exceeds the configured maximum number of StatusEntry. 87 | // 88 | #define ERR_EPLCN_NMT_CONFIGURED_NUM_STATUS_ENTRIES_EXCEEDED ((uint32_t)0xC0E60008L) 89 | 90 | // 91 | // MessageId: ERR_EPLCN_NMT_INVALID_STATIC_FIELD_BIT_NUMBER 92 | // 93 | // MessageText: 94 | // 95 | // Invalid requested bit number for StaticFieldBit. 96 | // 97 | #define ERR_EPLCN_NMT_INVALID_STATIC_FIELD_BIT_NUMBER ((uint32_t)0xC0E60009L) 98 | 99 | // 100 | // MessageId: ERR_EPLCN_NMT_FSM_AUTO_RUN_ENABLED 101 | // 102 | // MessageText: 103 | // 104 | // The NMT state machine is running in auto mode. State changes cannot be triggered by the application. 105 | // 106 | #define ERR_EPLCN_NMT_FSM_AUTO_RUN_ENABLED ((uint32_t)0xC0E6000AL) 107 | 108 | // 109 | // MessageId: ERR_EPLCN_NMT_CONFIGURED_CYCLE_LENGTH_TOO_LOW 110 | // 111 | // MessageText: 112 | // 113 | // Configured cycle length is too low. 114 | // 115 | #define ERR_EPLCN_NMT_CONFIGURED_CYCLE_LENGTH_TOO_LOW ((uint32_t)0xC0E6000BL) 116 | 117 | // 118 | // MessageId: ERR_EPLCN_NMT_CONFIGURED_MIN_CYCLE_LENGTH_TOO_LOW 119 | // 120 | // MessageText: 121 | // 122 | // Configured minimum cycle length is too low for the current hardware/software combination. 123 | // 124 | #define ERR_EPLCN_NMT_CONFIGURED_MIN_CYCLE_LENGTH_TOO_LOW ((uint32_t)0xC0E6000CL) 125 | 126 | // 127 | // MessageId: ERR_EPLCN_NMT_INVALID_NODE_ID 128 | // 129 | // MessageText: 130 | // 131 | // The configured NodeId is Invalid. 132 | // 133 | #define ERR_EPLCN_NMT_INVALID_NODE_ID ((uint32_t)0xC0E6000DL) 134 | 135 | #endif /* __EPLCN_NMT_RESULTS_H */ 136 | -------------------------------------------------------------------------------- /examples/includes/POWERLINK/Epl_Common_ObjDict.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | 3 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 4 | 5 | *************************************************************************************** 6 | $Id: Epl_Common_ObjDict.h 3176 2017-07-05 15:26:30Z Ricky $: 7 | 8 | Description: 9 | Powerlink definitions used for Object Dictionary handling 10 | **************************************************************************************/ 11 | 12 | #ifndef EPL_COMMON_OBJDICT_H_ 13 | #define EPL_COMMON_OBJDICT_H_ 14 | 15 | /*************************************************************************************/ 16 | /* Access rights for ODV3 objects */ 17 | /*************************************************************************************/ 18 | #define EPL_OD_READ_PRE_OPERATIONAL_1 0x0001 19 | #define EPL_OD_READ_PRE_OPERATIONAL_2 0x0002 20 | #define EPL_OD_READ_READY_TO_OPERATE 0x0004 21 | #define EPL_OD_READ_OPERATIONAL 0x0008 22 | #define EPL_OD_READ_STOPPED 0x0010 23 | #define EPL_OD_READ_BASIC_ETHERNET 0x0020 24 | #define EPL_OD_READ_NOT_ACTIVE 0x0040 25 | #define EPL_OD_READ_DURING_RESET 0x0080 26 | 27 | #define EPL_OD_WRITE_PRE_OPERATIONAL_1 0x0100 28 | #define EPL_OD_WRITE_PRE_OPERATIONAL_2 0x0200 29 | #define EPL_OD_WRITE_READY_TO_OPERATE 0x0400 30 | #define EPL_OD_WRITE_OPERATIONAL 0x0800 31 | #define EPL_OD_WRITE_STOPPED 0x1000 32 | #define EPL_OD_WRITE_BASIC_ETHERNET 0x2000 33 | #define EPL_OD_WRITE_NOT_ACTIVE 0x4000 34 | #define EPL_OD_WRITE_DURING_RESET 0x8000 35 | 36 | #define EPL_OD_READ_ALL 0x00FF 37 | #define EPL_OD_WRITE_ALL 0xFF00 38 | 39 | #define EPL_OD_ACCESS_ALL 0xFFFF 40 | 41 | /*************************************************************************************/ 42 | /* Data types for Powerlink ODV3 objects */ 43 | /*************************************************************************************/ 44 | #define EPL_OD_DATA_TYPE_BOOLEAN 0x0001 45 | #define EPL_OD_DATA_TYPE_INTEGER8 0x0002 46 | #define EPL_OD_DATA_TYPE_INTEGER16 0x0003 47 | #define EPL_OD_DATA_TYPE_INTEGER32 0x0004 48 | #define EPL_OD_DATA_TYPE_UNSIGNED8 0x0005 49 | #define EPL_OD_DATA_TYPE_UNSIGNED16 0x0006 50 | #define EPL_OD_DATA_TYPE_UNSIGNED32 0x0007 51 | #define EPL_OD_DATA_TYPE_REAL32 0x0008 52 | #define EPL_OD_DATA_TYPE_VISIBLE_STRING 0x0009 53 | #define EPL_OD_DATA_TYPE_OCTET_STRING 0x000A 54 | #define EPL_OD_DATA_TYPE_UNICODE_STRING 0x000B 55 | #define EPL_OD_DATA_TYPE_TIME_OF_DAY 0x000C 56 | #define EPL_OD_DATA_TYPE_TIME_DIFFERENCE 0x000D 57 | #define EPL_OD_DATA_TYPE_DOMAIN 0x000F 58 | #define EPL_OD_DATA_TYPE_INTEGER24 0x0010 59 | #define EPL_OD_DATA_TYPE_REAL64 0x0011 60 | #define EPL_OD_DATA_TYPE_INTEGER40 0x0012 61 | #define EPL_OD_DATA_TYPE_INTEGER48 0x0013 62 | #define EPL_OD_DATA_TYPE_INTEGER56 0x0014 63 | #define EPL_OD_DATA_TYPE_INTEGER64 0x0015 64 | #define EPL_OD_DATA_TYPE_UNSIGNED24 0x0016 65 | #define EPL_OD_DATA_TYPE_UNSIGNED40 0x0018 66 | #define EPL_OD_DATA_TYPE_UNSIGNED48 0x0019 67 | #define EPL_OD_DATA_TYPE_UNSIGNED56 0x001A 68 | #define EPL_OD_DATA_TYPE_UNSIGNED64 0x001B 69 | #define EPL_OD_DATA_TYPE_IDENTITY 0x0023 70 | #define EPL_OD_DATA_TYPE_MAC_ADDRESS 0x0401 71 | #define EPL_OD_DATA_TYPE_IP_ADDRESS 0x0402 72 | #define EPL_OD_DATA_TYPE_NETTIME 0x0403 73 | #define EPL_OD_DATA_TYPE_PDO_COMM_PARAM_RECORD 0x0420 74 | #define EPL_OD_DATA_TYPE_DLL_ERROR_CNT_REC 0x0424 75 | #define EPL_OD_DATA_TYPE_NWL_IP_GROUP 0x0425 76 | #define EPL_OD_DATA_TYPE_NWL_IP_ADDR_TABLE 0x0426 77 | #define EPL_OD_DATA_TYPE_NMT_PARAMETER_STORAGE 0x0429 78 | #define EPL_OD_DATA_TYPE_NMT_INTERFACE_GROUP 0x042B 79 | #define EPL_OD_DATA_TYPE_NMT_CYCLE_TIMING 0x042C 80 | #define EPL_OD_DATA_TYPE_CFM_VERIFYCONFIGURATION 0x0435 81 | #define EPL_OD_DATA_TYPE_NMT_EPL_NODE_ID 0x0439 82 | 83 | 84 | #endif /* EPL_COMMON_OBJDICT_H_ */ 85 | 86 | /*************************************************************************************/ 87 | /*-----------------------------------------------------------------------------------*/ 88 | /*------------------- EOF -----------------------------------------------------------*/ 89 | /*-----------------------------------------------------------------------------------*/ 90 | /*************************************************************************************/ 91 | -------------------------------------------------------------------------------- /examples/includes/POWERLINK/OdV3_Defines.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: OdV3_Defines.h 3176 2017-07-05 15:26:30Z Ricky $: 5 | 6 | 7 | Changes: 8 | Date Description 9 | ----------------------------------------------------------------------------------- 10 | yyyy-mm-dd created 11 | **************************************************************************************/ 12 | 13 | #ifndef _ODV3_DEFINES_H 14 | #define _ODV3_DEFINES_H 15 | 16 | 17 | /****************************************************************************** 18 | * Access flags 19 | * usAccessFlags field 20 | */ 21 | #define ODV3_ACCESS_FLAGS_SUBINDEX_0_WRITE_0_FIRST 0x0200 /* on writing all subindexes starting from subindex 0, write 0 to subindex 0 first */ 22 | #define ODV3_ACCESS_FLAGS_CREATE_SUBINDEX_0 0x0400 /* only on indexed objects, uses simple var bValueInfo fields (uses data type ODV3_DATATYPE_UNSIGNED8) */ 23 | #define ODV3_ACCESS_FLAGS_FORCE_INDEXED 0x0800 24 | #define ODV3_ACCESS_FLAGS_RXPDO_MAPPABLE 0x1000 25 | #define ODV3_ACCESS_FLAGS_TXPDO_MAPPABLE 0x2000 26 | #define ODV3_ACCESS_FLAGS_BACKUP 0x4000 27 | #define ODV3_ACCESS_FLAGS_SETTINGS 0x8000 28 | 29 | /****************************************************************************** 30 | * Value Info 31 | * bValueInfo field 32 | */ 33 | #define ODV3_VALUE_INFO_NAME 0x01 34 | #define ODV3_VALUE_INFO_INITIAL_VALUE 0x02 35 | #define ODV3_VALUE_INFO_VIRTUAL 0x04 /* make object/subobject virtual */ 36 | #define ODV3_VALUE_INFO_ECAT_UNIT 0x08 /* EtherCAT only */ 37 | #define ODV3_VALUE_INFO_DEFAULT_VALUE 0x10 38 | #define ODV3_VALUE_INFO_MINIMUM 0x20 39 | #define ODV3_VALUE_INFO_MAXIMUM 0x40 40 | #define ODV3_VALUE_INFO_VARIABLE_SIZE_VALUE 0x80 41 | 42 | /****************************************************************************** 43 | * Needed Data type definitions 44 | */ 45 | #define ODV3_DATATYPE_UNSIGNED8 0x0005 46 | 47 | /****************************************************************************** 48 | * Object Code definitions 49 | */ 50 | #define ODV3_OBJCODE_DOMAIN 0x02 51 | #define ODV3_OBJCODE_DEFTYPE 0x05 52 | #define ODV3_OBJCODE_DEFSTRUCT 0x06 53 | #define ODV3_OBJCODE_VAR 0x07 54 | #define ODV3_OBJCODE_ARRAY 0x08 55 | #define ODV3_OBJCODE_RECORD 0x09 56 | 57 | /****************************************************************************** 58 | * Multiple Parameter read/write access flags 59 | * bMultipleParaAccessFlags field 60 | */ 61 | #define ODV3_MULTIPLE_PARA_ACCESS_ALL_INDEXES 0x01 /* access all index starting at bSubIndex (0 or 1 allowed) (reserved for read/write multiple parameter) */ 62 | #define ODV3_MULTIPLE_PARA_ACCESS_BIT_TYPES_BIT_ALIGNED 0x02 /* access to bit types will be placed at bit boundaries */ 63 | #define ODV3_MULTIPLE_PARA_ACCESS_WRITE_SI0_TO_0_FIRST 0x04 /* write subindex 0 to zero first and final value as last transfer, object properties can enable it without having been set here */ 64 | #define ODV3_MULTIPLE_PARA_ACCESS_SUBINDEX_0_PADDED_TO_U16 0x08 /* on reading and writing all indexes, the subindex 0 is padded to 16bit integer (when object is not SimpleVar) */ 65 | #define ODV3_MULTIPLE_PARA_ACCESS_USE_NUM_SUBOBJS_ON_READ 0x10 /* read objects based on number of sub objects instead max of sub objects */ 66 | #define ODV3_MULTIPLE_PARA_ACCESS_EVAL_SUBINDEX_0_ON_WRITE 0x10 /* on writing all by indexes, subindex 0 will be evaluated if transferred */ 67 | #define ODV3_MULTIPLE_PARA_ACCESS_CHECK_ACCESS_RIGHTS 0x20 /* check access rights */ 68 | #define ODV3_MULTIPLE_PARA_ACCESS_REQUIRE_ALL_ACCESSIBLE 0x40 /* require all to be accessible by access rights when ODV3_MULTIPLE_PARA_ACCESS_CHECK_ACCESS_RIGHTS is set */ 69 | 70 | /****************************************************************************** 71 | * GetSubObjectInfo.ValueInfo 72 | */ 73 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_NAME 0x01 74 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_ECAT_UNIT 0x10 75 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_DEFAULT_VALUE 0x20 76 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_MINIMUM_VALUE 0x40 /* always uses max length */ 77 | #define ODV3_GET_SUBOBJECT_INFO_VALUE_INFO_MAXIMUM_VALUE 0x80 /* always uses max length */ 78 | 79 | /****************************************************************************** 80 | * GetObjectProperties.Flags 81 | */ 82 | #define ODV3_OBJECT_PROP_FLAG_ALL_INDEXES_ARE_FIXED_SIZE 0x00000001 83 | #define ODV3_OBJECT_PROP_FLAG_IS_INDEXED 0x00000002 /* is not a simple variable */ 84 | #define ODV3_OBJECT_PROP_FLAG_WRITE_SI0_TO_0_FIRST_REQUIRED 0x00000004 /* require ODV3_MULTIPLE_PARA_ACCESS_WRITE_SI0_TO_0_FIRST, setting this bit will set the actual transfer control bit */ 85 | 86 | /****************************************************************************** 87 | * special value for ulTotalDataBytes in Write Requests 88 | */ 89 | #define ODV3_WRITE_OBJECT_TOTAL_DATA_BYTES_NOT_SPECIFIED 0xFFFFFFFF 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /examples/includes/POWERLINK/Sock_error.h: -------------------------------------------------------------------------------- 1 | #ifndef __SOCK_ERROR_H 2 | #define __SOCK_ERROR_H 3 | 4 | ///////////////////////////////////////////////////////////////////////////////////// 5 | // Socket Api Error Codes 6 | ///////////////////////////////////////////////////////////////////////////////////// 7 | // 8 | // MessageId: TLR_E_SOCK_UNSUPPORTED_SOCKET 9 | // 10 | // MessageText: 11 | // 12 | // Unsupport socket domain, type and protocol combination. 13 | // 14 | #define TLR_E_SOCK_UNSUPPORTED_SOCKET ((TLR_RESULT)0xC0C90001L) 15 | 16 | // 17 | // MessageId: TLR_E_SOCK_INVALID_SOCKET_HANDLE 18 | // 19 | // MessageText: 20 | // 21 | // Invalid socket handle. 22 | // 23 | #define TLR_E_SOCK_INVALID_SOCKET_HANDLE ((TLR_RESULT)0xC0C90002L) 24 | 25 | // 26 | // MessageId: TLR_E_SOCK_SOCKET_CLOSED 27 | // 28 | // MessageText: 29 | // 30 | // Socket was closed. 31 | // 32 | #define TLR_E_SOCK_SOCKET_CLOSED ((TLR_RESULT)0xC0C90003L) 33 | 34 | // 35 | // MessageId: TLR_E_SOCK_INVALID_OP 36 | // 37 | // MessageText: 38 | // 39 | // The command is invalid for the particular socket. 40 | // 41 | #define TLR_E_SOCK_INVALID_OP ((TLR_RESULT)0xC0C90004L) 42 | 43 | // 44 | // MessageId: TLR_E_SOCK_INVALID_ADDRESS_FAMILY 45 | // 46 | // MessageText: 47 | // 48 | // An invalid address family was used for this socket 49 | // 50 | #define TLR_E_SOCK_INVALID_ADDRESS_FAMILY ((TLR_RESULT)0xC0C90005L) 51 | 52 | // 53 | // MessageId: TLR_E_SOCK_IN_USE 54 | // 55 | // MessageText: 56 | // 57 | // The specified address is already in use. 58 | // 59 | #define TLR_E_SOCK_IN_USE ((TLR_RESULT)0xC0C90006L) 60 | 61 | // 62 | // MessageId: TLR_E_SOCK_HUP 63 | // 64 | // MessageText: 65 | // 66 | // The remote side closed the connection 67 | // 68 | #define TLR_E_SOCK_HUP ((TLR_RESULT)0xC0C90007L) 69 | 70 | // 71 | // MessageId: TLR_E_SOCK_WOULDBLOCK 72 | // 73 | // MessageText: 74 | // 75 | // The operation would block 76 | // 77 | #define TLR_E_SOCK_WOULDBLOCK ((TLR_RESULT)0xC0C90008L) 78 | 79 | 80 | 81 | 82 | #endif //__SOCK_ERROR_H 83 | 84 | -------------------------------------------------------------------------------- /examples/includes/PROFINET/IOSignals_Public.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: IOSignals_Public.h 48786 2014-10-22 11:06:36Z Benjamin $: 5 | 6 | Description: 7 | IO Signal Swap Component 8 | 9 | This module can be used to make a stack capable of swapping IO-data while copying 10 | it from source to destination without changing the stack. 11 | Out of a well defined, stack comprehensive configuration packet it 12 | generates an internal CopyCode which allows this TLR-module to swap IO-data. 13 | 14 | The module is also capable of copying IO-data without swapping. 15 | 16 | Usage: 17 | 18 | If this module shall be used for swapping and copying IO-data some steps have to be done. 19 | For every module which consists of several signals the ByteCode has to be generated. 20 | 21 | 1. Therefore first create the TLR_CONFIGURE_SIGNAL_REQ_T describing the signals. 22 | Note: For modules which have both, input and output signals two packets have to be sent. 23 | 2. Call TLR_IO_Signal_GetByteCodeLength() to get the required length of the ByteCode. 24 | 3. Reserve this amount of memory. 25 | 4. Call TLR_IO_Signal_GenerateBytecode() and hand over the pointer to the reserved memory. 26 | 5. Internally store the pointer. 27 | 6. Whenever the IO-data shall be copied and swapped call TLR_IO_Signal_CopyData(). 28 | 29 | 30 | If this module shall be used for only copying IO-data it is possible to directly call 31 | TLR_IO_Signal_CopyData() without handling over the ByteCode. 32 | In this case TLR_IO_Signal_CopyData() will simply perform a regular memcpy. 33 | 34 | 35 | Changes: 36 | Date Description 37 | ----------------------------------------------------------------------------------- 38 | 2010-02-03 some adjustments in naming 39 | 2010-01-26 initial version 40 | **************************************************************************************/ 41 | 42 | #ifndef IOSIGNALS_PUBLIC_H_ 43 | #define IOSIGNALS_PUBLIC_H_ 44 | 45 | 46 | /* command code definition */ 47 | enum { 48 | /* IO_SIGNALS_PACKET_COMMAND_START = 0x00006100 */ 49 | IO_SIGNALS_CONFIGURE_SIGNAL_REQ = 0x00006100, 50 | IO_SIGNALS_CONFIGURE_SIGNAL_CNF 51 | }; 52 | 53 | /*************************************************************************************/ 54 | /* packets */ 55 | /*************************************************************************************/ 56 | 57 | 58 | /* pragma pack */ 59 | #ifdef PRAGMA_PACK_ENABLE 60 | #pragma PRAGMA_PACK_1(__PNSIF_API_PACKET) 61 | #endif 62 | 63 | 64 | typedef enum 65 | { 66 | IO_SIGNALS_TYPE_BIT = 0, /* 0 */ 67 | IO_SIGNALS_TYPE_BOOLEAN, /* 1 */ 68 | IO_SIGNALS_TYPE_BYTE, /* 2 */ 69 | IO_SIGNALS_TYPE_SIGNED8, /* 3 */ 70 | IO_SIGNALS_TYPE_UNSIGNED8, /* 4 */ 71 | IO_SIGNALS_TYPE_WORD, /* 5 */ 72 | IO_SIGNALS_TYPE_SIGNED16, /* 6 */ 73 | IO_SIGNALS_TYPE_UNSIGNED16, /* 7 */ 74 | IO_SIGNALS_TYPE_SIGNED24, /* 8 */ 75 | IO_SIGNALS_TYPE_UNSIGNED24, /* 9 */ 76 | IO_SIGNALS_TYPE_DWORD, /* 10 */ 77 | IO_SIGNALS_TYPE_SIGNED32, /* 11 */ 78 | IO_SIGNALS_TYPE_UNSIGNED32, /* 12 */ 79 | IO_SIGNALS_TYPE_SIGNED40, /* 13 */ 80 | IO_SIGNALS_TYPE_UNSIGNED40, /* 14 */ 81 | IO_SIGNALS_TYPE_SIGNED48, /* 15 */ 82 | IO_SIGNALS_TYPE_UNSIGNED48, /* 16 */ 83 | IO_SIGNALS_TYPE_SIGNED56, /* 17 */ 84 | IO_SIGNALS_TYPE_UNSIGNED56, /* 18 */ 85 | IO_SIGNALS_TYPE_LWORD, /* 19 */ 86 | IO_SIGNALS_TYPE_SIGNED64, /* 20 */ 87 | IO_SIGNALS_TYPE_UNSIGNED64, /* 21 */ 88 | IO_SIGNALS_TYPE_REAL32, /* 22 */ 89 | IO_SIGNALS_TYPE_REAL64, /* 23*/ 90 | IO_SIGNALS_TYPE_STRING, /* 24 */ 91 | IO_SIGNALS_TYPE_WSTRING, /* 25 */ 92 | IO_SIGNALS_TYPE_STRING_UUID, /* 26 */ 93 | IO_SIGNALS_TYPE_STRING_VISIBLE, /* 27 */ 94 | IO_SIGNALS_TYPE_STRING_OCTET, /* 28 */ 95 | IO_SIGNALS_TYPE_REAL32_STATE8, /* 29 */ 96 | IO_SIGNALS_TYPE_DATE, /* 30 */ 97 | IO_SIGNALS_TYPE_DATE_BINARY, /* 31 */ 98 | IO_SIGNALS_TYPE_TIME_OF_DAY, /* 32 */ 99 | IO_SIGNALS_TYPE_TIME_OF_DAY_NODATE, /* 33 */ 100 | IO_SIGNALS_TYPE_TIME_DIFF, /* 34 */ 101 | IO_SIGNALS_TYPE_TIME_DIFF_NODATE, /* 35 */ 102 | IO_SIGNALS_TYPE_NETWORK_TIME, /* 36 */ 103 | IO_SIGNALS_TYPE_NETWORK_TIME_DIFF, /* 37 */ 104 | IO_SIGNALS_TYPE_F_MSGTRAILER4, /* 38 */ 105 | IO_SIGNALS_TYPE_F_MSGTRAILER5, /* 39 */ 106 | IO_SIGNALS_TYPE_ENGINEERING_UINT, /* 40 */ 107 | IO_SIGNALS_TYPE_MAX 108 | 109 | } IO_SIGNALS_TYPES_E; 110 | 111 | 112 | /* 113 | * CONFIGURE SIGNAL SERVICE 114 | * 115 | * This service can be used to configure signals inside the IO-data. 116 | * In case of e.g. PROFINET every submodule may contains different signals which have 117 | * to be configured separately. 118 | * 119 | */ 120 | 121 | #define IO_SIGNALS_DIRECTION_CONSUMER (1) 122 | #define IO_SIGNALS_DIRECTION_PROVIDER (2) 123 | 124 | /* Request packet */ 125 | typedef __PACKED_PRE struct IO_SIGNALS_CONFIGURE_SIGNAL_REQ_DATA_Ttag 126 | { 127 | /* see fieldbus specific API Manual for a definition how this */ 128 | /* fieldbus specific fields shall be filled. */ 129 | TLR_UINT32 ulFieldbusSpecific1; /* e.g. Slave Handle */ 130 | TLR_UINT32 ulFieldbusSpecific2; 131 | TLR_UINT32 ulFieldbusSpecific3; /* e.g. Slot */ 132 | TLR_UINT32 ulFieldbusSpecific4; /* e.g. SubSlot */ 133 | TLR_UINT32 ulFieldbusSpecific5; 134 | TLR_UINT32 ulFieldbusSpecific6; 135 | TLR_UINT32 ulFieldbusSpecific7; 136 | TLR_UINT32 ulFieldbusSpecific8; 137 | /* signal direction described in this packet */ 138 | TLR_UINT32 ulSignalsDirection; 139 | /* amount of signals contained in abSignals */ 140 | TLR_UINT32 ulTotalSignalCount; 141 | /* array of signals - packet definition only contains the first signal, all other follow */ 142 | __PACKED_PRE struct 143 | { 144 | /* type of signal - see IO_SIGNALS_TYPES_E */ 145 | TLR_UINT8 bSignalType; 146 | /* amount of signal (e.g. 16 for a "16 Byte Input module") */ 147 | TLR_UINT8 bSignalAmount; 148 | } __PACKED_POST atSignals[1]; 149 | } __PACKED_POST IO_SIGNALS_CONFIGURE_SIGNAL_REQ_DATA_T; 150 | 151 | typedef struct IO_SIGNALS_CONFIGURE_SIGNAL_REQ_Ttag 152 | { 153 | TLR_PACKET_HEADER_T tHead; 154 | IO_SIGNALS_CONFIGURE_SIGNAL_REQ_DATA_T tData; 155 | } IO_SIGNALS_CONFIGURE_SIGNAL_REQ_T; 156 | 157 | /* Confirmation packet */ 158 | typedef TLR_EMPTY_PACKET_T IO_SIGNALS_CONFIGURE_SIGNAL_CNF_T; 159 | 160 | /* packet union */ 161 | typedef union IO_SIGNALS_CONFIGURE_SIGNAL_PCK_Ttag 162 | { 163 | IO_SIGNALS_CONFIGURE_SIGNAL_REQ_T tReq; 164 | IO_SIGNALS_CONFIGURE_SIGNAL_CNF_T tCnf; 165 | } IO_SIGNALS_CONFIGURE_SIGNAL_PCK_T; 166 | 167 | 168 | /* pragma unpack */ 169 | #ifdef PRAGMA_PACK_ENABLE 170 | #pragma PRAGMA_UNPACK_1(__PNSIF_API_PACKET) 171 | #endif 172 | 173 | 174 | /*************************************************************************************/ 175 | /* usable functions of this module */ 176 | /*************************************************************************************/ 177 | 178 | /* call this function first to get the length of the bytecode which will be generated */ 179 | TLR_RESULT IO_Signal_GetByteCodeLength(CONST IO_SIGNALS_CONFIGURE_SIGNAL_REQ_T* ptPck, TLR_UINT32* pulLength); 180 | TLR_RESULT IO_Signal_GenerateBytecode(CONST IO_SIGNALS_CONFIGURE_SIGNAL_REQ_T* ptPck, TLR_VOID* pvCopycode); 181 | TLR_RESULT IO_Signal_CopyData(TLR_VOID* pvDest, TLR_VOID* pvSrc, TLR_UINT32 ulLength, TLR_VOID* pvCopyCode); 182 | 183 | 184 | 185 | #endif /* IOSIGNALS_PUBLIC_H_ */ 186 | -------------------------------------------------------------------------------- /examples/includes/PROFINET/IOSignals_error.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: IOSignals_error.h 48786 2014-10-22 11:06:36Z Benjamin $: 5 | 6 | Description: 7 | IO Signal Swap Component 8 | Includes IO Signal Swap error codes 9 | **************************************************************************************/ 10 | 11 | #ifndef __IO_SIGNALS_ERROR_H 12 | #define __IO_SIGNALS_ERROR_H 13 | 14 | ///////////////////////////////////////////////////////////////////////////////////// 15 | // IO Signal task ERROR codes 16 | ///////////////////////////////////////////////////////////////////////////////////// 17 | // 18 | // MessageId: TLR_E_IO_SIGNAL_COMMAND_INVALID 19 | // 20 | // MessageText: 21 | // 22 | // Invalid command received. 23 | // 24 | #define TLR_E_IO_SIGNAL_COMMAND_INVALID ((TLR_RESULT)0xC0910001L) 25 | 26 | // 27 | // MessageId: TLR_E_IO_SIGNAL_INVALID_SIGNAL_DIRECTION 28 | // 29 | // MessageText: 30 | // 31 | // The value of signal direction is invalid. 32 | // 33 | #define TLR_E_IO_SIGNAL_INVALID_SIGNAL_DIRECTION ((TLR_RESULT)0xC0910002L) 34 | 35 | // 36 | // MessageId: TLR_E_IO_SIGNAL_INVALID_SIGNAL_AMOUNT 37 | // 38 | // MessageText: 39 | // 40 | // The value of signal amountis is invalid. 41 | // 42 | #define TLR_E_IO_SIGNAL_INVALID_SIGNAL_AMOUNT ((TLR_RESULT)0xC0910003L) 43 | 44 | // 45 | // MessageId: TLR_E_IO_SIGNAL_INVALID_SIGNAL_TYPE 46 | // 47 | // MessageText: 48 | // 49 | // The value of signal type is invalid. 50 | // 51 | #define TLR_E_IO_SIGNAL_INVALID_SIGNAL_TYPE ((TLR_RESULT)0xC0910004L) 52 | 53 | // 54 | // MessageId: TLR_E_IO_SIGNAL_UNSUPPORTED_SIGNAL_TYPE 55 | // 56 | // MessageText: 57 | // 58 | // The value of signal type is unsupported. 59 | // 60 | #define TLR_E_IO_SIGNAL_UNSUPPORTED_SIGNAL_TYPE ((TLR_RESULT)0xC0910005L) 61 | 62 | 63 | 64 | 65 | #endif //__IO_SIGNALS_ERROR_H 66 | 67 | -------------------------------------------------------------------------------- /examples/includes/PROFINET/TcpipConfig.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 3 | *************************************************************************************** 4 | $Id: TcpipConfig.h 63545 2016-08-29 09:04:12Z RalfH $: 5 | 6 | Description: 7 | Configurable parameters of TCP/UDP task 8 | **************************************************************************************/ 9 | 10 | 11 | #ifndef __TCPIP_CONFIG_H 12 | #define __TCPIP_CONFIG_H 13 | 14 | /*-------------------------------------------------------------------------* 15 | * Program Options * 16 | *-------------------------------------------------------------------------*/ 17 | 18 | 19 | /*-------------------------------------------------------------------------* 20 | * Debug Options * 21 | *-------------------------------------------------------------------------*/ 22 | 23 | /* #define DEBUG_TCPIP_CONFIG Enable debug options, see details below */ 24 | 25 | #ifdef DEBUG_TCPIP_CONFIG 26 | 27 | #warning "!!!!!!!!!! Warning: Debug options DEBUG_TCPIP_CONFIG enabled !!!!!!!!!!" 28 | 29 | /* #define DEBUG_TCP_FSM_EVENT_COUNTER Enable TCP state machine event counters */ 30 | /* #define DEBUG_ETH_OUT_FRAME_PADDING_BY_SOFTWARE Circumvent automatic frame padding by controller */ 31 | /* #define DEBUG_TCP_SEND_CALL_TRACE Enable tcp_send call trace */ 32 | /* #define DEBUG_DHCP_EVENT_TRACE Enable DHCP event trace */ 33 | /* #define DEBUG_TCP_LED_LIVESIGN Enable LiveSign LED in cyclic event (packet) */ 34 | 35 | #endif /* #ifdef DEBUG_TCPIP_CONFIG */ 36 | 37 | 38 | /*-------------------------------------------------------------------------* 39 | * Constants * 40 | *-------------------------------------------------------------------------*/ 41 | 42 | /* Optional functionality */ 43 | #define CONFIG_MCAST /* Enable multicast functionality */ 44 | 45 | /* #define CONFIG_NID_SET_IP_ADDR_TIME_RESTRICTED Enable time restriction for NetIdent's SetIpAddress */ 46 | 47 | /* #define CONFIG_ARP_REQ_INTF Enable user interface for sending ARP requests */ 48 | #define CONFIG_ARP_REQ_INTF_DBLY /* Enable user interface for sending ARP requests (new version) */ 49 | 50 | 51 | /**************************************************************************************************************** 52 | * 53 | * TCP/IP stack configuration (memory consumption) 54 | * See also startup parameters TCPIP_TCP_TASK_STARTUPPARAMETER_T (TcpipTcpTask_Functionlist.h) 55 | * 56 | * Parameter Declaration Default 57 | * --------------------------------------------------------------------------------------------- 58 | * 59 | * TCP_RECV_BUF_SIZE Socket's receive buffer size 2048 60 | * 61 | * ETH_FRAME_MIN_LEN Min length of an Ethernet frame 60 62 | * 63 | * IP_MSS Maximum segment size for Ethernet 1400 64 | * 65 | * ARP_HASH_SIZE Number of entries in ARP hash table 16 66 | * ARP_TIMEOUT_xx See below.. 67 | * 68 | * ROUTE_CACHE_SIZE Number of entries in route cache 32 69 | * ROUTE_HASH_SIZE Number of entries in route hash table 16 70 | * ROUTE_TIMEOUT_CACHE Timeout for route cache entries (seconds) 900 71 | * 72 | * MCAST_TABLE_SIZE Number of entries multicast address table 96 73 | * MCAST_HASH_SIZE Number of entries in multicast address 74 | * hash table 16 75 | * 76 | * EMTY_QUE_DATA_SIZE Empty queue max. data size for receive data TCPIP_MAX_TCP_UDP_DATA_CNT 77 | * (1472 = max. UDP datagram size!, see TcpipTcpTask_Public.h) 78 | * 79 | ****************************************************************************************************************/ 80 | 81 | 82 | /* Size of socket's receive buffer */ 83 | #define TCP_RECV_BUF_SIZE (2048) /* Equals max. TCP receive window */ 84 | /* Note: TCP_RECV_BUF_SIZE must be a power of 2, else the ring */ 85 | /* buffer mechanism will fail */ 86 | /* TCP_RECV_BUF_SIZE must not exceed 32767, else some */ 87 | /* signed integer variables will overflow */ 88 | /* Don't forget to adjust the TMIF_ADJUST_RECV_BUF_OFFSET */ 89 | /* macro definition when changing TCP_RECV_BUF_SIZE */ 90 | 91 | /* Maximum segment size for Ethernet */ 92 | #define IP_MSS (1400) 93 | 94 | #define ETH_FRAME_MIN_LEN (60) /* Min length of an Ethernet frame = 6 + 6 + 2 + 46 ( = Dst MAC */ 95 | /* Adr + Src MAC Adr + Type field + min Ethernet data part */ 96 | /* (46 ... 1500 bytes) ) */ 97 | 98 | /* ARP cache sizes */ 99 | #define ARP_HASH_SIZE (16) /* Number of entries in ARP hash table, must be power of 2 */ 100 | 101 | #define ARP_TIMEOUT_RESOLVE (10) /* Timeout before removing resolving cache entries (seconds) */ 102 | #define ARP_TIMEOUT_RESOLVE_SILENT (1) /* Time between ARP requests for the same IP address (seconds) */ 103 | /* #define ARP_TIMEOUT_CACHE (600L) Timeout for ARP cache entries (seconds) - is now a startup */ 104 | /* parameter ulArpTimeoutCache */ 105 | 106 | #define ARP_TIMEOUT_CACHE_DIRECT (5L) /* Time "window" after ARP timeout ulArpTimeoutCache (startup */ 107 | /* parameter) is elapsed. Inside this window, we send a */ 108 | /* Direct ARP */ 109 | 110 | #define ARP_TIMEOUT_CACHE_HOLD (10) /* Timeout before removing old cache entries (seconds) */ 111 | #define ARP_TIMEOUT_DIRECT_ARP (ARP_TIMEOUT_RESOLVE_SILENT) /* Timeout for Direct ARP answer */ 112 | 113 | #define ARP_DIRECT_ARP_MAX_CNT (3) /* Max count of Direct ARP attempt after ARP timeout is elapsed */ 114 | #define ARP_MAX_RND_VALUE (2047L) /* Max random value (milliseconds) / RndGetRandom16(ptRsc)>>5 */ 115 | /* = (2^16-1)>>5 = 2047 / if change, consider the >>5 (search */ 116 | /* for ARP_MAX_RND_VALUE!) */ 117 | /* Route cache sizes */ 118 | #define ROUTE_CACHE_SIZE (32) /* Number of entries in route cache, must be multiple of 16 */ 119 | #define ROUTE_HASH_SIZE (16) /* Number of entries in route hash table, must be power of 2 */ 120 | 121 | #define ROUTE_TIMEOUT_CACHE (900) /* Timeout for route cache entries (seconds) */ 122 | 123 | 124 | /* IP multicast management table sizes */ 125 | #define MCAST_TABLE_SIZE (96) /* Number of entries multicast address table, must be multiple */ 126 | /* of 16 */ 127 | #define MCAST_HASH_SIZE (16) /* Number of entries in multicast address hash table, must be */ 128 | /* power of 2 */ 129 | 130 | 131 | /* Packet definitions */ 132 | #define EMTY_QUE_DATA_SIZE TCPIP_MAX_TCP_UDP_DATA_CNT /* Empty queue max. data size for receive */ 133 | /* data (request command TCPIP_TCP_UDP_CMD_RECEIVE_IND) */ 134 | 135 | 136 | /* Debug: DHCP event trace */ 137 | #define DHCP_EVENT_TRACE_BUFFER_SIZE (1000 * sizeof(DHCP_EVENT_TRACE_ENTRY)) 138 | 139 | 140 | /* Name of tasks */ 141 | #define TCP_TASK_NAME "TCP_UDP" 142 | 143 | 144 | /* Name of database (DBM/NXD file) */ 145 | #if RCX_VERSION < MAKE_RCX_VERSION(2,2,0) 146 | #define IP_DBM_FILENAME_DBM "CONFIG.DBM" 147 | #define IP_DBM_FILENAME_NXD "CONFIG.NXD" 148 | #else 149 | #define IP_DBM_FILENAME_DBM "SYSVOLUME:/PORT_0/CONFIG.DBM" 150 | #define IP_DBM_FILENAME_NXD "SYSVOLUME:/PORT_0/CONFIG.NXD" 151 | #endif 152 | #define IP_DBM_FILENAME_LEN 10 153 | 154 | /* Directory of database (DBM file) */ 155 | #define IP_DBM_DIR_NAME "PORT_0" /* Default = _0 = Task instance 0 - */ 156 | /* changed by software to _0 ... _3! */ 157 | #define IP_DBM_DIR_NAME_LEN 6 158 | 159 | 160 | /* Names of DBM tables */ 161 | #define IP_DBM_TABLE_NAME_ETHERNET "ETHERNET" 162 | #define IP_DBM_TABLE_NAME_SETUP "IP_SETUP" 163 | 164 | #define TCP_PACKET_TIMEOUT_SEND 10 165 | #define TCP_PACKET_TIMEOUT_WAIT 1000 166 | 167 | #endif /* #ifndef __TCPIP_CONFIG_H */ 168 | 169 | -------------------------------------------------------------------------------- /examples/includes/PROFINET/TcpipTcpTask_error.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/examples/includes/PROFINET/TcpipTcpTask_error.h -------------------------------------------------------------------------------- /examples/includes/PacketHandlerECS.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 17 | *************************************************************************************** 18 | $Id: PacketHandlerEIS.h 2458 2017-01-13 11:18:07Z Jin $: 19 | Description: 20 | Protocol PacketHandler header file 21 | Changes: 22 | Date Description 23 | ----------------------------------------------------------------------------------- 24 | 2016-10-21 initial version 25 | **************************************************************************************/ 26 | 27 | /*****************************************************************************/ 28 | /*! \file PacketHandlerECS.h 29 | * Protocol PacketHandler header file */ 30 | /*****************************************************************************/ 31 | 32 | #ifndef COMPONENTS_CIFXAPPLICATIONDEMOECS_INCLUDES_PACKETHANDLERECS_H_ 33 | #define COMPONENTS_CIFXAPPLICATIONDEMOECS_INCLUDES_PACKETHANDLERECS_H_ 34 | 35 | #define TX_TIMEOUT_ECS 1000 36 | 37 | #endif /* COMPONENTS_CIFXAPPLICATIONDEMOECS_INCLUDES_PACKETHANDLERECS_H_ */ -------------------------------------------------------------------------------- /examples/includes/PacketHandlerEIS.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | 17 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 18 | 19 | *************************************************************************************** 20 | $Id: PacketHandlerEIS.h 2458 2017-01-13 11:18:07Z Jin $: 21 | 22 | Description: 23 | Protocol PacketHandler header file 24 | 25 | Changes: 26 | Date Description 27 | ----------------------------------------------------------------------------------- 28 | 2016-10-21 initial version 29 | 30 | **************************************************************************************/ 31 | 32 | /*****************************************************************************/ 33 | /*! \file PacketHandlerEIS.h 34 | * Protocol PacketHandler header file */ 35 | /*****************************************************************************/ 36 | 37 | #ifndef COMPONENTS_CIFXAPPLICATIONDEMOEIS_INCLUDES_PACKETHANDLEREIS_H_ 38 | #define COMPONENTS_CIFXAPPLICATIONDEMOEIS_INCLUDES_PACKETHANDLEREIS_H_ 39 | 40 | #define TX_TIMEOUT_EIS 1000 41 | 42 | #endif /* COMPONENTS_CIFXAPPLICATIONDEMOEIS_INCLUDES_PACKETHANDLEREIS_H_ */ 43 | -------------------------------------------------------------------------------- /examples/includes/PacketHandlerOMB.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | 17 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 18 | 19 | *************************************************************************************** 20 | $Id: PacketHandlerOMB.h 2458 2017-01-13 11:18:07Z Jin $: 21 | 22 | Description: 23 | Protocol PacketHandler header file 24 | 25 | Changes: 26 | Date Description 27 | ----------------------------------------------------------------------------------- 28 | 2016-10-21 initial version 29 | 30 | **************************************************************************************/ 31 | 32 | /*****************************************************************************/ 33 | /*! \file PacketHandlerOMB.h 34 | * Protocol PacketHandler header file */ 35 | /*****************************************************************************/ 36 | 37 | #ifndef COMPONENTS_CIFXAPPLICATIONDEMOOMB_INCLUDES_PACKETHANDLEROMB_H_ 38 | #define COMPONENTS_CIFXAPPLICATIONDEMOOMB_INCLUDES_PACKETHANDLEROMB_H_ 39 | 40 | #define TX_TIMEOUT_OMB 1000 41 | 42 | #endif /* COMPONENTS_CIFXAPPLICATIONDEMOOMB_INCLUDES_PACKETHANDLEROMB_H_ */ 43 | -------------------------------------------------------------------------------- /examples/includes/PacketHandlerPLS.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 17 | *************************************************************************************** 18 | $Id: PacketHandlerPLS.h 2458 2019-02-18 13:01:07Z PST $: 19 | Description: 20 | Protocol PacketHandler header file 21 | Changes: 22 | Date Description 23 | ----------------------------------------------------------------------------------- 24 | 2019-02-18 initial version 25 | **************************************************************************************/ 26 | 27 | /*****************************************************************************/ 28 | /*! \file PacketHandlerECS.h 29 | * Protocol PacketHandler header file */ 30 | /*****************************************************************************/ 31 | 32 | #ifndef COMPONENTS_CIFXAPPLICATIONDEMOPLS_INCLUDES_PACKETHANDLERPLS_H_ 33 | #define COMPONENTS_CIFXAPPLICATIONDEMOPLS_INCLUDES_PACKETHANDLERPLS_H_ 34 | 35 | #endif /* COMPONENTS_CIFXAPPLICATIONDEMOPLS_INCLUDES_PACKETHANDLERPLS_H_ */ 36 | -------------------------------------------------------------------------------- /examples/includes/PacketHandlerPNS.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | 17 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 18 | 19 | *************************************************************************************** 20 | $Id: PacketHandlerPNS.h 2491 2017-01-19 09:07:26Z Jin $: 21 | 22 | Description: 23 | Protocol PacketHandler header file 24 | 25 | Changes: 26 | Date Description 27 | ----------------------------------------------------------------------------------- 28 | 2016-10-21 initial version 29 | 30 | **************************************************************************************/ 31 | 32 | /*****************************************************************************/ 33 | /*! \file PacketHandlerPNS.h 34 | * Protocol PacketHandler header file */ 35 | /*****************************************************************************/ 36 | 37 | #ifndef COMPONENTS_CIFXAPPLICATIONDEMOPNS_INCLUDES_PACKETHANDLERPNS_H_ 38 | #define COMPONENTS_CIFXAPPLICATIONDEMOPNS_INCLUDES_PACKETHANDLERPNS_H_ 39 | 40 | long SetConfigParams( void* pvPck, uint16_t usDeviceClass ); 41 | long SetModulConfig( void* pvPck ); 42 | 43 | int32_t Pns_SetConfigReq(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId); 44 | 45 | 46 | #endif /* COMPONENTS_CIFXAPPLICATIONDEMOPNS_INCLUDES_PACKETHANDLERPNS_H_ */ 47 | -------------------------------------------------------------------------------- /examples/includes/SystemPackets.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | 17 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 18 | 19 | *************************************************************************************** 20 | $Id: SystemPackets.h 2608 2017-02-03 11:35:17Z Ricky $: 21 | 22 | Description: 23 | System Packets header file 24 | 25 | Changes: 26 | Date Description 27 | ----------------------------------------------------------------------------------- 28 | 2016-11-23 initial version 29 | 30 | **************************************************************************************/ 31 | 32 | /*****************************************************************************/ 33 | /*! \file SystemPackets.h 34 | * System Packets header file */ 35 | /*****************************************************************************/ 36 | 37 | #ifndef COMPONENTS_CIFXAPPLICATIONDEMO_INCLUDES_SYSTEMPACKETS_H_ 38 | #define COMPONENTS_CIFXAPPLICATIONDEMO_INCLUDES_SYSTEMPACKETS_H_ 39 | 40 | #include 41 | #include 42 | #include "cifXUser.h" 43 | #include "cifXErrors.h" 44 | #include "rcX_Public.h" 45 | 46 | #define SYSTEM_CHANNEL 0x00 47 | #define CHANNEL0 0x01 48 | #define CHANNEL1 0x02 49 | #define CHANNEL2 0x03 50 | #define CHANNEL3 0x04 51 | #define LOCAL_CHANNEL 0x20 52 | 53 | #define TX_TIMEOUT 500 54 | #define RX_TIMEOUT 10 55 | 56 | /*****************************************************************************/ 57 | /*! FUNCTION PROTOTYPES */ 58 | /*****************************************************************************/ 59 | uint32_t Pkt_SendPacket(CIFXHANDLE hChannel, CIFX_PACKET* ptSendPkt, uint32_t ulId, uint32_t ulTimeout); 60 | uint32_t Pkt_ReturnPacket(CIFXHANDLE hChannel, CIFX_PACKET* ptSendPkt, uint32_t ulTimeout); 61 | uint32_t Pkt_ReceivePacket(CIFXHANDLE hChannel, CIFX_PACKET* ptRecvPkt, uint32_t ulTimeout); 62 | 63 | int32_t Sys_EmptyPacketReq(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId, uint32_t ulCmd); 64 | int32_t Sys_StartStopCommReq(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId, bool fStart); 65 | int32_t Sys_SetMacAddressReq(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId, uint8_t *abMacAddr); 66 | int32_t Sys_FirmwareIdentifyReq(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId, uint32_t ulChannelId); 67 | int32_t Sys_HardwareInfoReq(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId); 68 | 69 | int32_t Sys_LinkStatusChangeInd(CIFXHANDLE hChannel, CIFX_PACKET* ptPkt); 70 | 71 | int32_t Sys_RegisterAppCnf(CIFX_PACKET* ptRegisterAppCnf); 72 | int32_t Sys_SetMacAddressCnf(CIFX_PACKET* ptSetMacAddressCnf); 73 | int32_t Sys_FirmwareIdentifyCnf(CIFX_PACKET* ptFirmwareIdentifyCnf); 74 | int32_t Sys_HardwareInfoCnf(CIFX_PACKET* ptCnf); 75 | 76 | void DumpData(unsigned char* pbData, unsigned long ulDataLen); 77 | void DumpPacket(CIFX_PACKET* ptPacket); 78 | 79 | #endif /** COMPONENTS_CIFXAPPLICATIONDEMO_INCLUDES_SYSTEMPACKETS_H_ */ 80 | -------------------------------------------------------------------------------- /examples/sources/PacketHandlerOMB.c: -------------------------------------------------------------------------------- 1 | /************************************************************************************** 2 | Exclusion of Liability for this demo software: 3 | The following software is intended for and must only be used for reference and in an 4 | evaluation laboratory environment. It is provided without charge and is subject to 5 | alterations. There is no warranty for the software, to the extent permitted by 6 | applicable law. Except when otherwise stated in writing the copyright holders and/or 7 | other parties provide the software "as is" without warranty of any kind, either 8 | expressed or implied. 9 | Please refer to the Agreement in README_DISCLAIMER.txt, provided together with this file! 10 | By installing or otherwise using the software, you accept the terms of this Agreement. 11 | If you do not agree to the terms of this Agreement, then do not install or use the 12 | Software! 13 | **************************************************************************************/ 14 | 15 | /************************************************************************************** 16 | 17 | Copyright (c) Hilscher Gesellschaft fuer Systemautomation mbH. All Rights Reserved. 18 | 19 | *************************************************************************************** 20 | $Id: PacketHandlerOMB.c 2458 2019-03-27 11:18:07Z PST $: 21 | 22 | Description: 23 | Protocol PacketHandler 24 | 25 | Changes: 26 | Date Description 27 | ----------------------------------------------------------------------------------- 28 | 2019-03-27 example simplified 29 | 2019-03-08 initial version 30 | 31 | **************************************************************************************/ 32 | 33 | /*****************************************************************************/ 34 | /*! \file PacketHandlerOMB.c 35 | * Protocol PacketHandler */ 36 | /*****************************************************************************/ 37 | 38 | #include "SystemPackets.h" 39 | #include "PacketHandlerOMB.h" 40 | #include "OmbOmbTask_Public.h" 41 | #include "App.h" 42 | 43 | #include 44 | #include 45 | 46 | /******************************************************************************* 47 | * _ ___ _ _ _ 48 | * | | / __|_) (_)_ (_) 49 | * _ | | ____| |__ _ ____ _| |_ _ ___ ____ ___ 50 | * / || |/ _ ) __) | _ \| | _)| |/ _ \| _ \ /___) 51 | * ( (_| ( (/ /| | | | | | | | |__| | |_| | | | |___ | 52 | * \____|\____)_| |_|_| |_|_|\___)_|\___/|_| |_(___/ 53 | * 54 | * http://www.network-science.de/ascii/ font stop 55 | *******************************************************************************/ 56 | /* 57 | #define MAC_NOT_AVAILABLE 58 | */ 59 | /* Default static IP address */ 60 | #define STATIC_IP 0xC0A80002 /* 192.168.0.2 */ 61 | #define NETMASK 0xFFFFFF00 /* 255.255.255.0 */ 62 | #define GATEWAY 0xC0A800FE /* 192.168.0.254 */ 63 | 64 | 65 | /******************************************************************************* 66 | * _ 67 | * ____ ____ ____ _ _ ____ ___| |_ ___ 68 | * / ___) _ ) _ | | | |/ _ )/___) _) /___) 69 | * | | ( (/ / | | | |_| ( (/ /|___ | |__|___ | 70 | * |_| \____)_|| |\____|\____|___/ \___|___/ 71 | * |_| 72 | * http://www.network-science.de/ascii/ font stop 73 | ******************************************************************************/ 74 | 75 | /*****************************************************************************/ 76 | /*! set firmware confirmation data */ 77 | /*****************************************************************************/ 78 | static uint32_t Omb_SendConfig_req(CIFXHANDLE hChannel, CIFX_PACKET *ptPkt, uint32_t ulId) 79 | { 80 | uint32_t lRet = RCX_S_OK; 81 | OMB_OMBTASK_PACKET_CMD_SET_CONFIGURATION_REQ_T* ptConfigReq = (OMB_OMBTASK_PACKET_CMD_SET_CONFIGURATION_REQ_T*)ptPkt; 82 | 83 | memset(ptConfigReq, 0, sizeof(*ptConfigReq)); 84 | 85 | ptConfigReq->tHead.ulDest = LOCAL_CHANNEL; 86 | ptConfigReq->tHead.ulLen = OMB_OMBTASK_DATA_CMD_SET_CONFIGURATION_REQ_SIZE; 87 | ptConfigReq->tHead.ulCmd = OMB_OMBTASK_CMD_OMB_SET_CONFIGURATION_REQ; 88 | ptConfigReq->tHead.ulSta = 0; 89 | ptConfigReq->tHead.ulExt = 0; 90 | 91 | ptConfigReq->tData.ulSystemFlags = OMB_OMBTASK_SYS_FLAG_COM_CONTROLLED_RELEASE; 92 | ptConfigReq->tData.ulWdgTime = 2000; /* Host watchdog time in ms */ 93 | 94 | ptConfigReq->tData.tOmbConfig.ulOpenServerSockets = 16; 95 | ptConfigReq->tData.tOmbConfig.ulAnswerTimeout = 20; 96 | ptConfigReq->tData.tOmbConfig.ulOmbOpenTime = 10; 97 | ptConfigReq->tData.tOmbConfig.ulMode = OMB_IO_MODE; 98 | ptConfigReq->tData.tOmbConfig.ulSendTimeout = 31000; 99 | ptConfigReq->tData.tOmbConfig.ulConnectTimeout = 31000; 100 | ptConfigReq->tData.tOmbConfig.ulCloseTimeout = 13000; 101 | ptConfigReq->tData.tOmbConfig.ulSwap = 1; 102 | 103 | ptConfigReq->tData.tTcpConfig.ulFlags = IP_CFG_FLAG_IP_ADDR 104 | | IP_CFG_FLAG_NET_MASK | IP_CFG_FLAG_GATEWAY; 105 | ptConfigReq->tData.tTcpConfig.ulIpAddr = STATIC_IP; 106 | ptConfigReq->tData.tTcpConfig.ulNetMask = NETMASK; 107 | ptConfigReq->tData.tTcpConfig.ulGateway = GATEWAY; 108 | 109 | ptConfigReq->tData.ulFlags = 0; 110 | 111 | ptConfigReq->tData.tOmbConfigExt.ulProcessWatchdog = 0; 112 | ptConfigReq->tData.tOmbConfigExt.ulInactiveTimeout = 0; 113 | ptConfigReq->tData.tOmbConfigExt.usMaxRegisterNumber = 2880; 114 | ptConfigReq->tData.tOmbConfigExt.usMaxCoilsNumber = 46080; 115 | 116 | lRet = Pkt_SendPacket(hChannel, (CIFX_PACKET*)ptConfigReq, ulId, TX_TIMEOUT_OMB); 117 | return lRet; 118 | } 119 | 120 | 121 | /******************************************************************************* 122 | * ___ _ _ 123 | * / __|_) _ (_) 124 | * ____ ___ ____ | |__ _ ____ ____ ____| |_ _ ___ ____ ___ 125 | * / ___) _ \| _ \| __) |/ ___) \ / _ | _)| |/ _ \| _ \ /___) 126 | * ( (__| |_| | | | | | | | | | | | ( ( | | |__| | |_| | | | |___ | 127 | * \____)___/|_| |_|_| |_|_| |_|_|_|\_||_|\___)_|\___/|_| |_(___/ 128 | * 129 | * http://www.network-science.de/ascii/ font stop 130 | ******************************************************************************/ 131 | 132 | 133 | 134 | 135 | /******************************************************************************* 136 | * _ _ _ _ 137 | * (_) | (_) _ (_) 138 | * _ ____ _ | |_ ____ ____| |_ _ ___ ____ ___ 139 | * | | _ \ / || | |/ ___) _ | _)| |/ _ \| _ \ /___) 140 | * | | | | ( (_| | ( (__( ( | | |__| | |_| | | | |___ | 141 | * |_|_| |_|\____|_|\____)_||_|\___)_|\___/|_| |_(___/ 142 | * 143 | * http://www.network-science.de/ascii/ font stop 144 | ******************************************************************************/ 145 | 146 | 147 | /*******************************************************************/ 148 | uint32_t Protocol_SendFirstPacket(APP_DATA_T *ptAppData) 149 | { 150 | uint32_t lRet=RCX_S_OK; 151 | lRet = Omb_SendConfig_req(ptAppData->hChannel[0], 152 | &ptAppData->tPkt, 153 | ptAppData->ulSendPktCnt++); 154 | return lRet; 155 | } 156 | 157 | /*******************************************************************/ 158 | uint32_t Protocol_SendLastPacket(APP_DATA_T *ptAppData) 159 | { 160 | uint32_t lRet=RCX_S_OK; 161 | lRet = Sys_StartStopCommReq(ptAppData->hChannel[0], 162 | &ptAppData->tPkt, 163 | ptAppData->ulSendPktCnt++, 164 | false); 165 | 166 | return lRet; 167 | } 168 | 169 | 170 | /*******************************************************************/ 171 | uint32_t Protocol_PacketHandler( APP_DATA_T *ptAppData ) 172 | { 173 | static uint32_t lRet = CIFX_NO_ERROR; 174 | 175 | lRet = Pkt_ReceivePacket(ptAppData->hChannel[0], &ptAppData->tPkt, 0); 176 | 177 | if( CIFX_NO_ERROR == lRet ) 178 | { 179 | switch( ptAppData->tPkt.tHeader.ulCmd ) 180 | { 181 | case RCX_START_STOP_COMM_CNF: 182 | lRet = ptAppData->tPkt.tHeader.ulState; 183 | if(ptAppData->fRunning == false) 184 | { 185 | ptAppData->fRunning = true; 186 | } 187 | else 188 | { 189 | ptAppData->fRunning = false; 190 | } 191 | break; 192 | 193 | case OMB_OMBTASK_CMD_OMB_SET_CONFIGURATION_CNF: 194 | lRet = ptAppData->tPkt.tHeader.ulState; 195 | if(CIFX_NO_ERROR == lRet) 196 | { 197 | Sys_EmptyPacketReq(ptAppData->hChannel[0], 198 | &ptAppData->tPkt, 199 | ptAppData->ulSendPktCnt++, 200 | RCX_CHANNEL_INIT_REQ); 201 | } 202 | break; 203 | 204 | case RCX_CHANNEL_INIT_CNF: 205 | lRet = ptAppData->tPkt.tHeader.ulState; 206 | if(CIFX_NO_ERROR == lRet) 207 | { 208 | lRet = Sys_StartStopCommReq(ptAppData->hChannel[0], 209 | &ptAppData->tPkt, 210 | ptAppData->ulSendPktCnt++, 211 | true); 212 | } 213 | break; 214 | 215 | default: 216 | if( (ptAppData->tPkt.tHeader.ulCmd & 0x1) == 0 ) /* received an indication*/ 217 | { 218 | ptAppData->tPkt.tHeader.ulLen = 0; 219 | ptAppData->tPkt.tHeader.ulState = RCX_E_UNKNOWN_COMMAND; 220 | lRet = Pkt_ReturnPacket(ptAppData->hChannel[0], &ptAppData->tPkt, TX_TIMEOUT); 221 | } 222 | else{ /* received a confirmation */ 223 | #ifndef DEMO_QUIET 224 | printf("warning: unhandled confirmation packet\n\r"); 225 | #endif 226 | } 227 | break; 228 | 229 | } /*switch*/ 230 | 231 | } /* CIFX_NO_ERROR xChannelGetPacket */ 232 | else if( CIFX_DEV_GET_NO_PACKET == lRet ) 233 | { 234 | lRet = CIFX_NO_ERROR; 235 | } /* CIFX_DEV_NOT_READY is possible and acceptable in OMB */ 236 | else if( CIFX_DEV_NOT_READY == lRet) 237 | { 238 | lRet = CIFX_NO_ERROR; 239 | } 240 | else{} 241 | 242 | return lRet; 243 | } 244 | -------------------------------------------------------------------------------- /firmwares/netx-docker-pi-ecs-4.8.0.3.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/firmwares/netx-docker-pi-ecs-4.8.0.3.deb -------------------------------------------------------------------------------- /firmwares/netx-docker-pi-eis-2.14.0.2.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/firmwares/netx-docker-pi-eis-2.14.0.2.deb -------------------------------------------------------------------------------- /firmwares/netx-docker-pi-omb-2.6.0.6.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/firmwares/netx-docker-pi-omb-2.6.0.6.deb -------------------------------------------------------------------------------- /firmwares/netx-docker-pi-pls-3.3.0.0.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/firmwares/netx-docker-pi-pls-3.3.0.0.deb -------------------------------------------------------------------------------- /firmwares/netx-docker-pi-pns-4.5.0.5.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/firmwares/netx-docker-pi-pns-4.5.0.5.deb -------------------------------------------------------------------------------- /hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Build hook is running" 4 | docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ 5 | --build-arg VCS_REF=`git rev-parse --short HEAD` \ 6 | -t $IMAGE_NAME . 7 | 8 | -------------------------------------------------------------------------------- /hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Use manifest-tool to create the manifest, given the experimental 4 | # "docker manifest" command isn't available yet on Docker Hub. 5 | 6 | curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64 7 | chmod +x manifest-tool 8 | 9 | ./manifest-tool push from-args \ 10 | --platforms linux/arm \ 11 | --template "$IMAGE_NAME" \ 12 | --target "$IMAGE_NAME" 13 | 14 | -------------------------------------------------------------------------------- /hooks/pre_build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Register qemu-*-static for all supported processors except the 4 | # current one, but also remove all registered binfmt_misc before 5 | docker run --rm --privileged multiarch/qemu-user-static:register --reset 6 | 7 | -------------------------------------------------------------------------------- /manuals/EtherCAT Slave V4 Protocol API 11 EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/manuals/EtherCAT Slave V4 Protocol API 11 EN.pdf -------------------------------------------------------------------------------- /manuals/EtherNetIP Adapter Protocol API 20 EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/manuals/EtherNetIP Adapter Protocol API 20 EN.pdf -------------------------------------------------------------------------------- /manuals/OpenModbusTCP Protocol API 10 EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/manuals/OpenModbusTCP Protocol API 10 EN.pdf -------------------------------------------------------------------------------- /manuals/POWERLINK Controlled Node V3 Protocol API 05 EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/manuals/POWERLINK Controlled Node V3 Protocol API 05 EN.pdf -------------------------------------------------------------------------------- /manuals/PROFINET IO-Device V3.14 Protocol API 19 EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/manuals/PROFINET IO-Device V3.14 Protocol API 19 EN.pdf -------------------------------------------------------------------------------- /manuals/cifX API PR 08 EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HilscherAutomation/netPI-netx-programming-examples/74b165f0d988d047b2ee8339732e4733e33ef81f/manuals/cifX API PR 08 EN.pdf --------------------------------------------------------------------------------