versadac  1
versadac - Scalable Recorder Firmware
eips_tag.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_usersys.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 user definitions specific to EtherNet/IP General
37  * behavior.
38  *
39  */
40 
41 #ifndef __EIPS_TAG_H__
42 #define __EIPS_TAG_H__
43 
44 /* User Defines */
45 #define EIPS_TAG_MAX_LEN_PER_STRING 40
46 #define EIPS_TAG_MAX_NUM_ELEMENT_LEVELS 5
47 #define EIPS_TAG_MAX_NUM_ARRAY_LEVELS 1
48 
49 /*
50  Tags can be simple
51  TestInt (elements_used=1; array_ix_used=0)
52 
53  Tags can be arrays
54  TestInt[3] (elements_used=1; array_ix_used=1)
55 
56  Tags can be complicated
57  Tag1[3].Tag2[1][2].Value (elements_used=3; array_ix_used=1,2,0)
58 */
59 
60 /* Structure Defines */
61 typedef struct
62 {
63  uint16 str_len;
64  char str[EIPS_TAG_MAX_LEN_PER_STRING];
65  uint8 array_ix_used;
66  uint16 array_ix[EIPS_TAG_MAX_NUM_ARRAY_LEVELS];
68 
69 typedef struct
70 {
71  uint8 elements_used;
72  EIPS_TAG_ELEMENT element[EIPS_TAG_MAX_NUM_ELEMENT_LEVELS];
73 }EIPS_TAG;
74 
75 #define MAX_STRING_TAGSIZE 82 /* we have 82 characters */
76 typedef struct
77 {
78  uint32 len; /* 0-82 */
79  char dat[(MAX_STRING_TAGSIZE+2)]; /* 82+2 pad (32-bit align) */
81 
82 /* Data Types (defined by ODVA) */
83 #define EIPS_CL_DATATYPE_BOOL 0x00C1
84 #define EIPS_CL_DATATYPE_SINT 0x00C2
85 #define EIPS_CL_DATATYPE_INT 0x00C3
86 #define EIPS_CL_DATATYPE_DINT 0x00C4
87 #define EIPS_CL_DATATYPE_REAL 0x00CA
88 #define EIPS_CL_DATATYPE_BITARRAY 0x00D3
89 #define EIPS_CL_DATATYPE_STRUCTURE 0x02A0
90 #define EIPS_CL_STRUCTHANDLE_STRING 0x0FCE
91 
92 /* function return codes */
93 #define EIPS_TAGERR_SUCCESS 0
94 #define EIPS_TAGERR_PASSED_PARAM -1
95 #define EIPS_TAGERR_TAG_NOT_FOUND -2
96 #define EIPS_TAGERR_TAG_READ_ONLY -3
97 #define EIPS_TAGERR_DATA_SIZE_ERROR -4 /* passed data pointer not big enough for request or mismatch */
98 #define EIPS_TAGERR_PARTIAL_XFER -5 /* partial transfer (used with fragmentation) */
99 #define EIPS_TAGERR_OFFSET 0x2105 /* num elements or byte offset error */
100 #define EIPS_TAGERR_DATA_TYPE 0x2107
101 
102 #define EIPS_FRAG_TAG_MAX_DATA_ON_READ 400
103 
104 /* ****************************** */
105 /* Global Functions in eips_tag.c */
106 /* ****************************** */
107 int16 eips_tag_reassemble_tagname (EIPS_TAG *tag, char *str, uint16 max_len_str);
108 
109 #ifdef EIPS_CIP_READ_WRITE_DATA_LOGIX
110  uint8 eips_tag_process_msg (EIPS_USER_MSGRTR_REQ_FMT *request, EIPS_USER_MSGRTR_RSP_FMT *response);
111 #endif
112 #ifdef EIPS_CIP_READ_WRITE_DATA_LOGIX_ADVANCED
113  uint8 eips_tag_process_msg_adv (EIPS_USER_MSGRTR_REQ_FMT *request, EIPS_USER_MSGRTR_RSP_FMT *response);
114 #endif
115 
116 /* ********************************** */
117 /* Global Functions in eips_usertag.c */
118 /* ********************************** */
119 #ifdef EIPS_CIP_READ_WRITE_DATA_LOGIX
120  int16 eips_usertag_get_read_data (EIPS_TAG *tag, uint16 size_in_elements, uint16 *data_type_from_user, void *data_ptr, uint16 max_data_ptr_len_in_bytes);
121  int16 eips_usertag_set_write_data (EIPS_TAG *tag, uint16 size_in_elements, uint16 data_type, void *data_ptr, uint16 data_ptr_len_in_bytes);
122 #endif
123 
124 /* ************************************** */
125 /* Global Functions in eips_usertag_adv.c */
126 /* ************************************** */
127 #ifdef EIPS_CIP_READ_WRITE_DATA_LOGIX_ADVANCED
128  /* data must fit */
129  int16 eips_usertag_get_read_data_formatted (EIPS_TAG *tag, uint16 size_in_elements, uint16 *data_type_from_user, uint16 *struct_handle_from_user, uint8 *data_ptr, uint16 *max_data_ptr_len_in_bytes);
130  int16 eips_usertag_set_write_data_formatted (EIPS_TAG *tag, uint16 size_in_elements, uint16 data_type, uint16 struct_handle, uint8 *data_ptr, uint16 data_ptr_len_in_bytes);
131 
132  /* partial transfer OK */
133  int16 eips_usertag_get_frag_read_data_formatted (EIPS_TAG *tag, uint16 size_in_elements, uint32 byte_data_offset, uint16 *data_type_from_user, uint16 *struct_handle_from_user, uint8 *data_ptr, uint16 *max_data_ptr_len_in_bytes);
134  int16 eips_usertag_set_frag_write_data_formatted (EIPS_TAG *tag, uint16 size_in_elements, uint32 byte_data_offset, uint16 data_type, uint16 struct_handle, uint8 *data_ptr, uint16 data_ptr_len_in_bytes);
135 #endif
136 
137 #endif /* __EIPS_TAG_H__ */
138 
139 /* *********** */
140 /* END OF FILE */
141 /* *********** */
Definition: eips_tag.h:69
Definition: eips_struct.h:189
Definition: eips_tag.h:76
Definition: eips_tag.h:61
Definition: eips_struct.h:198