versadac  1
versadac - Scalable Recorder Firmware
eips_proto.h
1 /*
2  * Copyright (c) 2002-2013 by Real Time Automation, Inc.
3  *
4  * This software is copyrighted by and is the sole property of
5  * Real Time Automation, Inc. (RTA). All rights, title, ownership,
6  * or other interests in the software remain the property of RTA.
7  * This software may only be used in accordance with the corresponding
8  * license agreement. Any unauthorized use, duplication, transmission,
9  * distribution, or disclosure of this software is expressly forbidden.
10  *
11  * This Copyright notice MAY NOT be removed or modified without prior
12  * written consent of RTA.
13  *
14  * RTA reserves the right to modify this software without notice.
15  *
16  * Real Time Automation
17  * 150 S. Sunny Slope Road USA 262.439.4999
18  * Suite 130 www.rtaautomation.com
19  * Brookfield, WI 53005 software@rtaautomation.com
20  *
21  *************************************************************************
22  *
23  * Version Date: 18APR2013
24  * Version: 2.33
25  * Conformed To: EtherNet/IP Protocol Conformance Test A-9 (16-NOV-2011)
26  * Module Name: eips_proto.h
27  * Author: Jamin D. Wendorf (jwendorf@rtaautomation.com)
28  * Language: Ansi C
29  * Compile Options: N/A
30  * Compile defines: N/A
31  * Libraries: N/A
32  * Link Options: N/A
33  *
34  * Description.
35  * =======================================================================
36  * This file contains EtherNet/IP Server funcion prototypes.
37  *
38  */
39 
40 #ifndef __EIPS_PROTO_H__
41 #define __EIPS_PROTO_H__
42 
43 #ifdef EIPS_TACL_OBJ_USED
44  void eips_TaCL_init (uint8 init_type);
45  uint8 eips_TaCL_procObject (EIPS_USER_MSGRTR_REQ_FMT *, EIPS_USER_MSGRTR_RSP_FMT *);
46  uint16 eips_userobj_TaCL_GetGroupings (uint8 inst_type, EIPS_TACL_GROUPING_STRUCT *group_ptr, uint16 max_num_inst);
47 #endif
48 
49 /* ******************************* */
50 /* Global Functions in eips_pccc.c */
51 /* ******************************* */
52 #ifdef EIPS_PCCC_USED /* OPTIONAL */
53  void eips_pccc_init (uint8 init_type);
54  void eips_pccc_execute (CPF_MESSAGE_STRUCT *);
55  void eips_pccc_build_error (uint8 gen_stat, uint16 ext_stat_size, uint16 * ext_stat);
56 
57  /* allow the user to dynamically change which integer (N) registers are used */
58  int8 eips_userobj_read_B_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, uint16 *reg_data);
59  int8 eips_userobj_read_N_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, uint16 *reg_data);
60  int8 eips_userobj_read_F_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, float *reg_data);
61  int8 eips_userobj_read_ST_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, EIPS_PCCC_STRING_TYPE *reg_data);
62 
63  int8 eips_userobj_write_B_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, uint16 *reg_data);
64  int8 eips_userobj_write_N_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, uint16 *reg_data);
65  int8 eips_userobj_write_F_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, float *reg_data);
66  int8 eips_userobj_write_ST_reg_pccc (uint16 file_num, uint16 file_offset, uint16 length, EIPS_PCCC_STRING_TYPE *reg_data);
67 #endif
68 
69 /* *********************************** */
70 /* Global Functions in eips_userdf1.c */
71 /* *********************************** */
72 #ifdef EIPS_PCCC_USED /* OPTIONAL */
73  void eips_userdf1_init (uint8 init_type);
74  uint16 eips_userdf1_proc_msg (uint8 * req_msg, uint16 req_msg_size, uint8 * rsp_msg, uint16 max_rsp_msg_size);
75 #endif
76 
77 /* ******************************* */
78 /* Global Functions in eips_cnxn.c */
79 /* ******************************* */
80 void eips_cnxn_init (uint8 init_type);
81 void eips_cnxn_free (EIPS_CONNECTION_DATA_STRUCT *cnxnptr);
82 void eips_cnxn_Process (void);
83 void eips_cnxn_fwdOpen (CPF_MESSAGE_STRUCT *);
84 void eips_cnxn_fwdClose (CPF_MESSAGE_STRUCT *);
85 void eips_cnxn_emTimeout (uint16 timer_num);
86 void eips_cnxn_errorFwdOpen (EIPS_CONNECTION_DATA_STRUCT *temp_cnxn, CPF_MESSAGE_STRUCT *cpf);
87 void eips_cnxn_validFwdOpen (EIPS_CONNECTION_DATA_STRUCT *temp_cnxn, CPF_MESSAGE_STRUCT *cpf);
88 void eips_cnxn_errorFwdClose (EIPS_CONNECTION_DATA_STRUCT *temp_cnxn, CPF_MESSAGE_STRUCT *cpf);
89 void eips_cnxn_validFwdClose (EIPS_CONNECTION_DATA_STRUCT *temp_cnxn, CPF_MESSAGE_STRUCT *cpf);
90 void eips_cnxn_structInit (EIPS_CONNECTION_DATA_STRUCT *temp_cnxn); /* used to free connection */
91 void eips_cnxn_structCopy (EIPS_CONNECTION_DATA_STRUCT *dst_cnxnptr, EIPS_CONNECTION_DATA_STRUCT *src_cnxnptr);
92 EIPS_CONNECTION_DATA_STRUCT * eips_cnxn_getUnusedCnxn(void);
93 uint16 eips_cnxn_getCnxnTmoMult (uint8);
94 uint32 eips_cnxn_getConnectionID (void);
95 uint32 EIPS_APIROUND (uint32 old_val);
96 #define eips_cnxn_api_round EIPS_APIROUND
97 uint32 EIPS_APITICKS (uint32 api);
98 #define eips_cnxn_api_ticks EIPS_APITICKS
99 void eips_cnxn_timeout (void); /* called when any connection times out (for LED processing) */
100 
101 /* ****************************** */
102 /* Global Functions in eips_cpf.c */
103 /* ****************************** */
104 void eips_cpf_init (uint8 init_type);
105 void eips_cpf_ProcessCPF (EIPS_ENCAP_MSG_STRUCT *EncapReq, EIPS_SOCKET_STRUCT *sock);
106 uint8 eips_cpf_o2tCnxnPtValid (uint8);
107 uint8 eips_cpf_t2oCnxnPtValid (uint8);
108 int16 eips_cpf_getAsmSize (uint16 instance);
109 uint8 eips_cpf_asmInstExists (uint16 instance);
110 uint16 eips_cpf_getIDObjStatus (void);
111 
112 /* ******************************** */
113 /* Global Functions in eips_encap.c */
114 /* ******************************** */
115 void eips_encap_init (uint8 init_type);
116 uint16 eips_encap_process (EIPS_SOCKET_STRUCT *sock, uint8 *msg, uint16 msg_siz);
117 void eips_encap_freeSessionIx (EIPS_USERSYS_SOCKTYPE socket_id);
118 void eips_encap_unSupEncapMsg (EIPS_ENCAP_MSG_STRUCT *EncapReq, EIPS_SOCKET_STRUCT *sock);
119 EIPS_SESSION_STRUCT * eips_encap_getSessionStruct (uint32 sessionID);
120 
121 /* ******************************** */
122 /* Global Functions in eips_iomsg.c */
123 /* ******************************** */
124 void eips_iomsg_init (uint8 init_type);
125 void eips_iomsg_process (void);
126 uint16 eips_iomsg_proc_o2t_iomsg (uint32 ipaddr, uint8 *msg, uint16 msg_siz);
127 void eips_iomsg_open (CPF_MESSAGE_STRUCT *cpf, EIPS_CONNECTION_DATA_STRUCT *temp_cnxn);
128 uint8 eips_iomsg_close (EIPS_CONNECTION_DATA_STRUCT *temp_cnxn);
129 uint8 eips_iomsg_allocated (uint16 o2t_inst_id);
130 uint8 eips_iomsg_outputs_valid (uint16 o2t_inst_id);
131 void eips_iomsg_t2o_cos (uint16 t2o_inst_id);
132 uint8 eips_iomsg_ValidMulticastAddr(uint32 addr);
133 uint32 eips_iomsg_get_io_connection_rpi (uint8 z_cnxn);
134 uint8 eips_iomsg_get_io_connection_type (uint8 z_cnxn);
135 
136 /* ********************************* */
137 /* Global Functions in eips_rtasys.c */
138 /* ********************************* */
139 void eips_rtasys_init (void);
140 void eips_rtasys_process (uint32 ticks_passed_since_last_call);
141 void eips_rtasys_set_inactivity_tmo (EIPS_USERSYS_SOCKTYPE socket_id, uint16 inactivity_tmo);
142 void eips_rtasys_setState (EIPS_USERSYS_SOCKTYPE socket_id, uint8 new_state);
143 void eips_rtasys_onTCPAccept (EIPS_USERSYS_SOCKTYPE socket_id);
144 void eips_rtasys_onTCPData (EIPS_USERSYS_SOCKTYPE socket_id, uint8 * socket_data, uint16 socket_data_size);
145 void eips_rtasys_onUDPData (uint32 src_addr, uint16 src_port, uint8 * socket_data, uint16 socket_data_size);
146 void eips_rtasys_onTCPSent (EIPS_USERSYS_SOCKTYPE socket_id);
147 void eips_rtasys_onTCPClose (EIPS_USERSYS_SOCKTYPE socket_id);
148 void eips_rtasys_onIOData (uint32 src_addr, uint8 * socket_data, uint16 socket_data_size);
149 
150 /* ******************************** */
151 /* Global Functions in eips_timer.c */
152 /* ******************************** */
153 void eips_timer_init (uint8 init_type);
154 void eips_timer_process (uint32 time_passed_in_ticks);
155 uint16 eips_timer_new (void);
156 void eips_timer_free (uint16 timer_num);
157 void eips_timer_reset (uint16 timer_num);
158 void eips_timer_newval (uint16 timer_num, uint32 newval);
159 void eips_timer_start (uint16 timer_num);
160 void eips_timer_stop (uint16 timer_num);
161 uint8 eips_timer_running (uint16 timer_num);
162 
163 void eips_timer_changeValues (uint16 timer_num, uint32 current, uint32 reload);
164 EIPS_TIMER_DATA_STRUCT * eips_timer_get_struct (uint16 timer_num);
165 
166 /* ********************************** */
167 /* Global Functions in eips_userobj.c */
168 /* ********************************** */
169 void eips_userobj_init (uint8 init_type);
170 void eips_userobj_process (void);
171 uint8 eips_userobj_procVendSpecObject (EIPS_USER_MSGRTR_REQ_FMT *, EIPS_USER_MSGRTR_RSP_FMT *);
172 #ifdef EIPS_USEROBJ_ID_OBJ_EXTENDED
173  uint16 eips_userobj_getIDObj_Attr05_Status (void);
174  uint32 eips_userobj_getIDObj_Attr06_SerialNumber (void);
175  uint8 eips_userobj_getIDObj_Attr08_State (void);
176  uint16 eips_userobj_getIDObj_Attr09_CCV (void);
177 #else
178  uint32 eips_userobj_getSerialNumber (void);
179 #endif
180 
181 uint8 eips_userobj_cfg_asm_process(uint16 cfg_inst_id, uint8 * config_data, uint16 config_data_size_in_bytes, uint8 *err_rsp_code, uint16 *add_err_rsp_code);
182 
183 /* make the assembly processing dynamic at startup (return number of used instances) */
184 uint16 eips_userobj_asmGetO2TInstList (uint16 *list_ptr, uint16 max_num_inst);
185 uint16 eips_userobj_asmGetT2OInstList (uint16 *list_ptr, uint16 max_num_inst);
186 
187 #if EIPS_USEROBJ_ASM_ELEMENT_SIZE == 4 /* DWORDS */
188  void eips_userobj_asmDataWrote (uint16 inst_id, uint16 dwords_written);
189 #elif EIPS_USEROBJ_ASM_ELEMENT_SIZE == 2 /* WORDS */
190  void eips_userobj_asmDataWrote (uint16 inst_id, uint16 words_written);
191 #else /* BYTES */
192  void eips_userobj_asmDataWrote (uint16 inst_id, uint16 bytes_written);
193 #endif
194 
195 #if EIPS_USEROBJ_ASM_ELEMENT_SIZE == 4 /* DWORDS */
196  uint32 * eips_userobj_getAsmPtr (uint16 inst_id, uint16 *size_in_dwords);
197 #elif EIPS_USEROBJ_ASM_ELEMENT_SIZE == 2 /* WORDS */
198  uint16 * eips_userobj_getAsmPtr (uint16 inst_id, uint16 *size_in_words);
199 #else /* BYTES */
200  uint8 * eips_userobj_getAsmPtr (uint16 inst_id, uint16 *size_in_bytes);
201 #endif
202 
203 #ifdef EIPS_USEROBJ_T2O_RUNTIME_HEADER_USED
204  uint32 eips_userobj_getT2ORuntimeHeader (uint16 inst_id);
205 #endif
206 
207 #ifdef EIPS_QOS_USED
208 int16 eips_userobj_readQoSObjFromNVRAM (EIPS_QOS_OBJ_STRUCT *qos_nvram);
209 int16 eips_userobj_writeQoSObjToNVRAM (EIPS_QOS_OBJ_STRUCT *qos_nvram);
210 #endif
211 
212 /* *********************************** */
213 /* Global Functions in eips_usersock.c */
214 /* *********************************** */
215 void eips_usersock_init (uint8 init_type);
216 void eips_usersock_process (void);
217 void eips_usersock_close_all_sockets (void);
218 
219 #ifdef EIPS_QOS_USED
220  extern EIPS_QOS_OBJ_STRUCT eips_QoSObj;
221  void eips_usersock_sendTCPData_QoS (EIPS_USERSYS_SOCKTYPE socket_id, uint8 * socket_data, uint16 socket_data_size, uint8 dscp_type, uint8 dscp_value);
222 
223  /* all TCP traffic has the same DSCP tag value, so remap the function to use tagging */
224  #define eips_usersock_sendTCPData(a,b,c) eips_usersock_sendTCPData_QoS(a,b,c,EIPS_QOS_DSCP_TYPE_EXPLICIT,eips_QoSObj.Inst.DSCP_Explicit)
225 #else
226  void eips_usersock_sendTCPData (EIPS_USERSYS_SOCKTYPE socket_id, uint8 * socket_data, uint16 socket_data_size);
227 #endif
228 
229 void eips_usersock_sendUDPData (uint32 ipaddr, uint16 port, uint8 * socket_data, uint16 socket_data_size);
230 
231 #ifdef EIPS_QOS_USED
232  void eips_usersock_sendIOMessage_QoS (uint32 ipaddr, uint8 *resp_msg, int16 resp_msg_siz, uint8 dscp_type, uint8 dscp_value);
233  #define eips_usersock_sendIOMessage(a,b,c) eips_usersock_sendIOMessage_QoS(a,b,c,EIPS_QOS_DSCP_TYPE_NOTUSED,0)
234 #else
235  void eips_usersock_sendIOMessage (uint32 ipaddr, uint8 *resp_msg, int16 resp_msg_siz);
236 #endif
237 
238 void eips_usersock_tcpClose (EIPS_USERSYS_SOCKTYPE socket_id);
239 uint32 eips_usersock_getSockInfo_sin_addr (EIPS_USERSYS_SOCKTYPE socket_id);
240 uint32 eips_usersock_getOurIPAddr (void);
241 
242 /* ------------- */
243 /* TCP/IP Object */
244 /* ------------- */
245 /* get attribute parameters */
246 uint8 eips_usersock_getTCPObj_Attr01_Status (uint32 *data_ptr);
247 uint8 eips_usersock_getTCPObj_Attr02_CfgCap (uint32 *data_ptr);
248 uint8 eips_usersock_getTCPObj_Attr03_CfgCtrl (uint32 *data_ptr);
249 uint8 eips_usersock_getTCPObj_Attr04_PhyLinkObj (EIPS_PHY_LINK_STRUCT *data_ptr);
250 uint8 eips_usersock_getTCPObj_Attr05_IntfCfg (EIPS_IPADDR_STRUCT *data_ptr);
251 uint8 eips_usersock_getTCPObj_Attr06_HostName (EIPS_TCPOBJ_BUF_STRUCT *data_ptr);
252 #ifdef EIPS_USEROBJ_TCP_OBJ_EXTENDED
253  uint8 eips_usersock_getTCPObj_Attr08_TTLVal (uint8 *data_ptr);
254  uint8 eips_usersock_getTCPObj_Attr09_McastCfg (EIPS_TCPOBJ_MCASTCFG_STRUCT *data_ptr);
255  uint8 eips_usersock_getTCPObj_Attr10_SelACD (uint8 *data_ptr);
256  uint8 eips_usersock_getTCPObj_Attr11_LastACDErr (EIPS_TCPOBJ_LAST_ACD_CONFLICT_STRUCT *data_ptr);
257  uint8 eips_usersock_getTCPObj_Attr12_EIPQC (uint8 *data_ptr);
258 #endif
259 
260 /* set attribute parameters */
261 uint8 eips_usersock_setTCPObj_Attr03_CfgCtrl (uint32 *data);
262 uint8 eips_usersock_setTCPObj_Attr05_IntfCfg (EIPS_IPADDR_STRUCT *data);
263 uint8 eips_usersock_setTCPObj_Attr06_HostName (EIPS_TCPOBJ_BUF_STRUCT *data);
264 #ifdef EIPS_USEROBJ_TCP_OBJ_EXTENDED
265  uint8 eips_usersock_setTCPObj_Attr08_TTLVal (uint8 *data_ptr);
266  uint8 eips_usersock_setTCPObj_Attr09_McastCfg (EIPS_TCPOBJ_MCASTCFG_STRUCT *data_ptr);
267  uint8 eips_usersock_setTCPObj_Attr10_SelACD (uint8 *data_ptr);
268  uint8 eips_usersock_setTCPObj_Attr11_LastACDErr (EIPS_TCPOBJ_LAST_ACD_CONFLICT_STRUCT *data_ptr);
269  uint8 eips_usersock_setTCPObj_Attr12_EIPQC (uint8 *data_ptr);
270 #endif
271 /* -------------------- */
272 /* Ethernet Link Object */
273 /* -------------------- */
274 /* get attribute parameters */
275 uint8 eips_usersock_getEthLinkObj_Attr01_IntfSpeed (uint32 *data_ptr);
276 uint8 eips_usersock_getEthLinkObj_Attr02_IntfFlags (uint32 *data_ptr);
277 uint8 eips_usersock_getEthLinkObj_Attr03_MacAddr (uint8 *byte6_string);
278 uint8 eips_usersock_getEthLinkObj_Attr04_IntfCnts (EIPS_ELINKOBJ_INTFCNTS_STRUCT *data_ptr);
279 uint8 eips_usersock_getEthLinkObj_Attr05_MediaCnts (EIPS_ELINKOBJ_MEDIACNTS_STRUCT *data_ptr);
280 uint8 eips_usersock_getEthLinkObj_Attr06_IntfCtrl (EIPS_ELINKOBJ_INTFCTRL_STRUCT *data_ptr);
281 #ifdef EIPS_USEROBJ_ELINK_OBJ_EXTENDED
282  uint8 eips_usersock_getEthLinkObj_Attr07_IntfType (uint8 *data_ptr);
283  uint8 eips_usersock_getEthLinkObj_Attr08_IntfState (uint8 *data_ptr);
284  uint8 eips_usersock_getEthLinkObj_Attr09_AdminState (uint8 *data_ptr);
285  uint8 eips_usersock_getEthLinkObj_Attr10_IntfLabel (uint8 *byte64_short_string);
286 #endif
287 
288 /* set attribute parameters */
289 uint8 eips_usersock_setEthLinkObj_Attr06_IntfCtrl (EIPS_ELINKOBJ_INTFCTRL_STRUCT *data_ptr);
290 #ifdef EIPS_USEROBJ_ELINK_OBJ_EXTENDED
291  uint8 eips_usersock_setEthLinkObj_Attr09_AdminState (uint8 *data_ptr);
292 #endif
293 /* ********************************** */
294 /* Global Functions in eips_usersys.c */
295 /* ********************************** */
296 void eips_usersys_init (uint8 init_type);
297 void eips_usersys_process (void);
298 void eips_usersys_fatalError (char *function_name, int16 error_num);
299 uint16 eips_usersys_getIncarnationID (void);
300 void eips_usersys_ledTest (void);
301 
302 #ifdef EIPS_USERSYS_HWRESET_SUPPORTED
303 void eips_usersys_noreturn_reboot (void);
304 #endif
305 
306 #ifdef EIPS_IO_LED_USED
307  void eips_usersys_ioLedUpdate (uint8 led_state);
308 #endif
309 
310 #ifdef EIPS_NTWK_LED_USED
311  void eips_usersys_nsLedUpdate (uint8 led_state);
312 #endif
313 
314 void eips_usersys_tagLedUpdate (uint8 led_state);
315 void eips_usersys_tagReadLedUpdate (uint8 led_state);
316 void eips_usersys_tagWriteLedUpdate (uint8 led_state);
317 /* ************************************************************ */
318 /* UTILITY FUNCTION PROTOTYPES */
319 /* ************************************************************ */
320 #if 1
321 void rta_PutBigEndian16 (uint16 value, uint8 *pos);
322 void rta_PutBigEndian32 (uint32 value, uint8 *pos);
323 void rta_PutLitEndian16 (uint16 value, uint8 *pos);
324 void rta_PutLitEndian32 (uint32 value, uint8 *pos);
325 void rta_PutLitEndianFloat (float value, uint8 *pos);
326 
327 uint16 rta_GetBigEndian16 (uint8 *pos);
328 uint32 rta_GetBigEndian32 (uint8 *pos);
329 uint16 rta_GetLitEndian16 (uint8 *pos);
330 uint32 rta_GetLitEndian32 (uint8 *pos);
331 float rta_GetLitEndianFloat (uint8 *pos);
332 
333 void rta_ByteMove (void *dst, void *src, uint32 len);
334 uint32 rta_Swap32 (uint32 passed_val);
335 #endif
336 
337 #endif /* __EIPS_PROTO_H__ */
Definition: eips_struct.h:51
Definition: eips_struct.h:158
Definition: eips_struct.h:365
Definition: eips_struct.h:503
Definition: eips_struct.h:343
Definition: eips_struct.h:396
Definition: eips_struct.h:411
Definition: eips_struct.h:372
Definition: eips_struct.h:355
Definition: eips_struct.h:349
Definition: eips_struct.h:66
Definition: eips_struct.h:219
Definition: eips_struct.h:189
Definition: eips_struct.h:168
Definition: eips_struct.h:427
Definition: eips_struct.h:198