HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-sercosiii.c
blobc2783e5707a15a5741b8d211fe3f001f7ece1dff
1 /* packet-sercosiii.c
2 * Routines for SERCOS III dissection
4 * Initial plugin code by,
5 * Bosch Rexroth
6 * Hilscher
8 * Hans-Peter Bock <hpbock@avaapgh.de>
10 * Convert to built-in dissector
11 * Michael Mann * Copyright 2011
13 * $Id$
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
17 * Copyright 1998 Gerald Combs
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 #include "config.h"
36 #include <glib.h>
38 #include <epan/packet.h>
39 #include <epan/etypes.h>
41 #define MAX_SERCOS_DEVICES (512)
42 #define SERCOS_SLAVE_GROUP_SIZE (128)
44 #define COMMUNICATION_PHASE_0 (0x0)
45 #define COMMUNICATION_PHASE_1 (0x1)
46 #define COMMUNICATION_PHASE_2 (0x2)
47 #define COMMUNICATION_PHASE_3 (0x3)
48 #define COMMUNICATION_PHASE_4 (0x4)
51 /* Initialize the protocol and registered fields */
52 static gint proto_siii = -1;
54 /* Initialize the subtree pointers */
55 static gint ett_siii = -1;
56 static gint ett_siii_header = -1;
57 static gint ett_siii_mst = -1;
58 static gint ett_siii_mst_teltype = -1;
59 static gint ett_siii_mst_phase = -1;
60 static gint ett_siii_mdt = -1;
61 static gint ett_siii_mdt_svc = -1;
62 static gint ett_siii_mdt_devctrls = -1;
63 static gint ett_siii_mdt_version = -1;
64 static gint ett_siii_mdt_svc_channel = -1;
65 static gint ett_siii_mdt_dev_control = -1;
66 static gint ett_siii_mdt_devctrl = -1;
67 static gint ett_siii_mdt_svcctrl = -1;
68 static gint ett_siii_mdt_svcinfo = -1;
69 static gint ett_siii_at_svcstat = -1;
70 static gint ett_siii_at_svcinfo = -1;
71 static gint ett_siii_mdt_svch_data_error_info = -1;
72 static gint ett_siii_mdt_svch_data = -1;
73 static gint ett_siii_at_devstatus = -1;
74 static gint ett_siii_at = -1;
75 static gint ett_siii_at_svc = -1;
76 static gint ett_siii_at_devstats = -1;
77 static gint ett_siii_at_svc_channel = -1;
78 static gint ett_siii_at_dev_status = -1;
79 static gint ett_siii_mdt_hp = -1;
80 static gint ett_siii_at_hp = -1;
81 static gint ett_siii_mdt_hp_ctrl = -1;
82 static gint ett_siii_mdt_hp_info = -1;
83 static gint ett_siii_at_hp_stat = -1;
84 static gint ett_siii_at_hp_info = -1;
86 static gint hf_siii_mdt_version = -1;
87 static gint hf_siii_mdt_version_initprocvers = -1;
88 static gint hf_siii_mdt_version_num_mdt_at_cp1_2 = -1;
89 static gint hf_siii_mdt_version_revision = -1;
90 static gint hf_siii_mdt_dev_control_top_control = -1;
91 static gint hf_siii_at_dev_control_ident = -1;
92 static gint hf_siii_mdt_dev_control_change_topology = -1;
93 static gint hf_siii_mdt_dev_control = -1;
94 static gint hf_siii_mst_channel = -1;
95 static gint hf_siii_mst_type = -1;
96 static gint hf_siii_mst_cyclecntvalid = -1;
97 static gint hf_siii_mst_telno = -1;
98 static gint hf_siii_mst_phase = -1;
99 static gint hf_siii_mst_cyclecnt = -1;
100 static gint hf_siii_mst_crc32 = -1;
101 static gint hf_siii_mdt_svch_dbe = -1;
102 static gint hf_siii_mdt_svch_eot = -1;
103 static gint hf_siii_mdt_svch_rw = -1;
104 static gint hf_siii_mdt_svch_mhs = -1;
105 static gint hf_siii_mdt_svch_info = -1;
106 static gint hf_siii_at_svch_valid = -1;
107 static gint hf_siii_at_svch_error = -1;
108 static gint hf_siii_at_svch_busy = -1;
109 static gint hf_siii_at_svch_ahs = -1;
110 static gint hf_siii_at_svch_info = -1;
111 static gint hf_siii_mdt_svch_idn = -1;
112 static gint hf_siii_mdt_svch_ctrl = -1;
113 static gint hf_siii_at_svch_stat = -1;
114 /* static gint hf_siii_svch_data_telofs_telno = -1; */
115 /* static gint hf_siii_svch_data_telofs_mdt_at = -1; */
116 /* static gint hf_siii_svch_data_telofs_offset = -1; */
117 /* static gint hf_siii_svch_data_proccmd_proccmdexec = -1; */
118 /* static gint hf_siii_svch_data_proccmd_proccmd = -1; */
119 static gint hf_siii_at_dev_status = -1;
120 static gint hf_siii_at_dev_status_commwarning = -1;
121 static gint hf_siii_at_dev_status_change_topology = -1;
122 static gint hf_siii_at_dev_status_top_status = -1;
123 static gint hf_siii_at_dev_status_inactive_port_status = -1;
124 static gint hf_siii_at_dev_status_errorconnection = -1;
125 static gint hf_siii_at_dev_status_slave_valid = -1;
126 static gint hf_siii_at_dev_status_proc_command_change = -1;
127 static gint hf_siii_at_dev_status_parameterization_level_active = -1;
128 static gint hf_siii_mdt_hotplug_address = -1;
129 static gint hf_siii_mdt_hp_ctrl = -1;
130 static gint hf_siii_mdt_hp_info = -1;
131 static gint hf_siii_at_hotplug_address = -1;
132 static gint hf_siii_at_hp_stat = -1;
133 static gint hf_siii_at_hp_info = -1;
134 static gint hf_siii_mdt_hotplug_control_param = -1;
135 static gint hf_siii_mdt_hotplug_control_svc_switch = -1;
136 static gint hf_siii_at_hotplug_status_param = -1;
137 static gint hf_siii_at_hotplug_status_hp0_finished = -1;
138 static gint hf_siii_at_hotplug_status_error = -1;
140 /* Allow heuristic dissection */
141 static heur_dissector_list_t heur_subdissector_list;
143 static const value_string siii_mdt_version_num_mdtat_cp1_2_text[]=
145 {0x00, "2 MDTs/ATs in CP1/2"},
146 {0x01, "4 MDTs/ATs in CP1/2"},
147 {0, NULL}
150 static const value_string siii_mdt_version_initprocvers_text[]=
152 {0x00, "No remote address allocation"},
153 {0x01, "Remote address allocation"},
154 {0, NULL}
157 #if 0
158 static const value_string siii_svch_data_proccmd_proccmdexec_text[]=
160 {0, "Interrupt procedure command execution"},
161 {1, "Enable procedure command execution"},
162 {0, NULL}
165 static const value_string siii_svch_data_proccmd_proccmd_text[]=
167 {0, "Cancel procedure command"},
168 {1, "Set procedure command"},
169 {0, NULL}
172 static const value_string siii_svch_data_mdt_at_text[]=
174 {0, "AT-telegram"},
175 {1, "MDT-telegram"},
176 {0, NULL}
178 #endif
180 #define IDN(SI, SE, type, paramset, datablock) ((SI<<24)|(SE<<16)|(type<<15)|(paramset<<12)|(datablock))
182 static const value_string siii_mdt_idn_text[]=
184 {IDN(0,0,0,0, 0), "Dummy-Parameter"},
185 {IDN(0,0,0,0, 1), "Control unit cycle time (tNcyc)"},
186 {IDN(0,0,0,0, 2), "Communication cycle time (tScyc)"},
187 {IDN(0,0,0,0, 11), "Class 1 diagnostic"},
188 {IDN(0,0,0,0, 12), "Class 2 diagnostic"},
189 {IDN(0,0,0,0, 14), "Interface status"},
190 {IDN(0,0,0,0, 15), "Telegram Type"},
191 {IDN(0,0,0,0, 16), "Configuration list of AT"},
192 {IDN(0,0,0,0, 17), "IDN-list of all operation data"},
193 {IDN(0,0,0,0, 18), "IDN-list of operation data for CP2"},
194 {IDN(0,0,0,0, 19), "IDN-list of operation data for CP3"},
195 {IDN(0,0,0,0, 21), "IDN-list of invalid operation data for CP2"},
196 {IDN(0,0,0,0, 22), "IDN-list of invalid operation data for CP3"},
197 {IDN(0,0,0,0, 24), "Configuration list of MDT"},
198 {IDN(0,0,0,0, 25), "IDN-list of all procedure commands"},
199 {IDN(0,0,0,0, 26), "Configuration list for signal status word"},
200 {IDN(0,0,0,0, 27), "Configuration list for signal control word"},
201 {IDN(0,0,0,0, 28), "MST error counter"},
202 {IDN(0,0,0,0, 29), "MDT error counter"},
203 {IDN(0,0,0,0, 32), "Primary operation mode"},
204 {IDN(0,0,0,0, 36), "Velocity command value"},
205 {IDN(0,0,0,0, 37), "Additive velocity command value"},
206 {IDN(0,0,0,0, 38), "Positive velocity limit value"},
207 {IDN(0,0,0,0, 39), "Negative velocity limit value"},
208 {IDN(0,0,0,0, 40), "Velocity feedback value 1"},
209 {IDN(0,0,0,0, 41), "Homing velocity"},
210 {IDN(0,0,0,0, 42), "Homing acceleration"},
211 {IDN(0,0,0,0, 43), "Velocity polarity parameter"},
212 {IDN(0,0,0,0, 44), "Velocity data scaling type"},
213 {IDN(0,0,0,0, 45), "Velocity data scaling factor"},
214 {IDN(0,0,0,0, 46), "Velocity data scaling exponent"},
215 {IDN(0,0,0,0, 47), "Position command value"},
216 {IDN(0,0,0,0, 48), "Additive position command value"},
217 {IDN(0,0,0,0, 49), "Positive position limit value"},
218 {IDN(0,0,0,0, 50), "Negative position limit value"},
219 {IDN(0,0,0,0, 51), "Position feedback value 1 (motor feedback)"},
220 {IDN(0,0,0,0, 52), "Reference distance 1"},
221 {IDN(0,0,0,0, 53), "Position feedback value 2 (external feedback)"},
222 {IDN(0,0,0,0, 54), "Reference distance 2"},
223 {IDN(0,0,0,0, 55), "Position polarity parameter"},
224 {IDN(0,0,0,0, 57), "Position window"},
225 {IDN(0,0,0,0, 58), "Reversal clearance"},
226 {IDN(0,0,0,0, 59), "Position switch flag parameter"},
227 {IDN(0,0,0,0, 60), "Position switches (position switch points on 1-16)"},
228 {IDN(0,0,0,0, 76), "Position data scaling type"},
229 {IDN(0,0,0,0, 77), "Linear position data scaling factor"},
230 {IDN(0,0,0,0, 78), "Linear position data scaling exponent"},
231 {IDN(0,0,0,0, 79), "Rotational position resolution"},
232 {IDN(0,0,0,0, 80), "Torque command value"},
233 {IDN(0,0,0,0, 81), "Additive torque command value"},
234 {IDN(0,0,0,0, 82), "Positive torque limit value"},
235 {IDN(0,0,0,0, 83), "Negative torque limit value"},
236 {IDN(0,0,0,0, 84), "Torque feedback value"},
237 {IDN(0,0,0,0, 85), "Torque polarity parameter"},
238 {IDN(0,0,0,0, 86), "Torque/force data scaling type"},
239 {IDN(0,0,0,0, 91), "Bipolar velocity limit value"},
240 {IDN(0,0,0,0, 92), "Bipolar torque limit value"},
241 {IDN(0,0,0,0, 93), "Torque/force scaling data factor"},
242 {IDN(0,0,0,0, 94), "Torque/force scaling data exponent"},
243 {IDN(0,0,0,0, 95), "Diagnostic message"},
244 {IDN(0,0,0,0, 96), "Slave arrangement (SLKN)"},
245 {IDN(0,0,0,0, 97), "Mask class 2 diagnostic"},
246 {IDN(0,0,0,0, 98), "Mask class 3 diagnostic"},
247 {IDN(0,0,0,0, 99), "Reset class 1 diagnostic"},
248 {IDN(0,0,0,0, 100), "Velocity loop proportional gain"},
249 {IDN(0,0,0,0, 101), "Velocity loop integral action time"},
250 {IDN(0,0,0,0, 102), "Velocity loop differential time"},
251 {IDN(0,0,0,0, 103), "Modulo value"},
252 {IDN(0,0,0,0, 104), "Position loop KV-factor"},
253 {IDN(0,0,0,0, 105), "Position loop integral action time"},
254 {IDN(0,0,0,0, 106), "Current loop proportional gain 1"},
255 {IDN(0,0,0,0, 107), "Current loop integral action time 1"},
256 {IDN(0,0,0,0, 108), "Feedrate override"},
257 {IDN(0,0,0,0, 109), "Motor peak current"},
258 {IDN(0,0,0,0, 110), "Amplifier peak current"},
259 {IDN(0,0,0,0, 111), "Motor continuous stall current"},
260 {IDN(0,0,0,0, 112), "Amplifier rated current"},
261 {IDN(0,0,0,0, 113), "Maximum motor speed"},
262 {IDN(0,0,0,0, 114), "Load limit of the motor"},
263 {IDN(0,0,0,0, 115), "Position feedback 2 type"},
264 {IDN(0,0,0,0, 116), "Resolution of feedback 1"},
265 {IDN(0,0,0,0, 117), "Resolution of feedback 2"},
266 {IDN(0,0,0,0, 118), "Resolution of linear feedback"},
267 {IDN(0,0,0,0, 119), "Current loop proportional gain 2"},
268 {IDN(0,0,0,0, 120), "Current loop integral action time 2"},
269 {IDN(0,0,0,0, 121), "Input revolutions of load gear"},
270 {IDN(0,0,0,0, 122), "Output revolutions of load gear"},
271 {IDN(0,0,0,0, 123), "Feed constant"},
272 {IDN(0,0,0,0, 124), "Standstill window"},
273 {IDN(0,0,0,0, 125), "Velocity threshold (nx)"},
274 {IDN(0,0,0,0, 126), "Torque threshold (Tx)"},
275 {IDN(0,0,0,0, 127), "CP3 transition check"},
276 {IDN(0,0,0,0, 128), "CP4 transition check"},
277 {IDN(0,0,0,0, 129), "Manufacturer class 1 diagnostic"},
278 {IDN(0,0,0,0, 130), "Probe value 1 positive edge"},
279 {IDN(0,0,0,0, 131), "Probe value 1 negative edge"},
280 {IDN(0,0,0,0, 132), "Probe value 2 positive edge"},
281 {IDN(0,0,0,0, 133), "Probe value 2 negative edge"},
282 {IDN(0,0,0,0, 134), "Drive control"},
283 {IDN(0,0,0,0, 135), "Drive status"},
284 {IDN(0,0,0,0, 136), "Positive acceleration limit value"},
285 {IDN(0,0,0,0, 137), "Negative acceleration limit value"},
286 {IDN(0,0,0,0, 138), "Bipolar acceleration limit value"},
287 {IDN(0,0,0,0, 139), "Park axis procedure command"},
288 {IDN(0,0,0,0, 143), "SERCOS Interface version"},
289 {IDN(0,0,0,0, 144), "Signal status word"},
290 {IDN(0,0,0,0, 145), "Signal control word"},
291 {IDN(0,0,0,0, 146), "Control unit controlled homing procedure command"},
292 {IDN(0,0,0,0, 147), "Homing parameter"},
293 {IDN(0,0,0,0, 148), "Drive controlled homing procedure command"},
294 {IDN(0,0,0,0, 149), "Position drive stop procedure command"},
295 {IDN(0,0,0,0, 150), "Reference offset 1"},
296 {IDN(0,0,0,0, 151), "Reference offset 2"},
297 {IDN(0,0,0,0, 152), "Position spindle procedure command"},
298 {IDN(0,0,0,0, 153), "Spindle angle position"},
299 {IDN(0,0,0,0, 154), "Spindle positioning parameter"},
300 {IDN(0,0,0,0, 155), "Friction torque compensation"},
301 {IDN(0,0,0,0, 156), "Velocity feedback value 2"},
302 {IDN(0,0,0,0, 157), "Velocity window"},
303 {IDN(0,0,0,0, 158), "Power threshold (Px)"},
304 {IDN(0,0,0,0, 159), "Monitoring window"},
305 {IDN(0,0,0,0, 161), "Acceleration data scaling factor"},
306 {IDN(0,0,0,0, 162), "Acceleration data scaling exponent"},
307 {IDN(0,0,0,0, 163), "Weight counterbalance"},
308 {IDN(0,0,0,0, 164), "Acceleration feedback value 1"},
309 {IDN(0,0,0,0, 165), "Distance-coded reference marks A"},
310 {IDN(0,0,0,0, 166), "Distance-coded reference marks B"},
311 {IDN(0,0,0,0, 167), "Frequency limit of feedback 1"},
312 {IDN(0,0,0,0, 169), "Probe control"},
313 {IDN(0,0,0,0, 170), "Probing cycle procedure command"},
314 {IDN(0,0,0,0, 171), "Calculate displacement procedure command"},
315 {IDN(0,0,0,0, 172), "Displacement to the referenced system procedure command"},
316 {IDN(0,0,0,0, 173), "Marker position A"},
317 {IDN(0,0,0,0, 174), "Marker position B"},
318 {IDN(0,0,0,0, 175), "Displacement parameter 1"},
319 {IDN(0,0,0,0, 176), "Displacement parameter 2"},
320 {IDN(0,0,0,0, 177), "Absolute distance 1"},
321 {IDN(0,0,0,0, 178), "Absolute distance 2"},
322 {IDN(0,0,0,0, 179), "Probe status"},
323 {IDN(0,0,0,0, 180), "Spindle relative offset"},
324 {IDN(0,0,0,0, 181), "Manufacturer class 2 diagnostic"},
325 {IDN(0,0,0,0, 183), "Synchronization velocity window"},
326 {IDN(0,0,0,0, 184), "Synchronization velocity error limit"},
327 {IDN(0,0,0,0, 185), "Length of the configurable data record in the AT"},
328 {IDN(0,0,0,0, 186), "Length of the configurable data record in the MDT"},
329 {IDN(0,0,0,0, 187), "IDN list of configurable data in the AT"},
330 {IDN(0,0,0,0, 188), "IDN list of configurable data in the MDT"},
331 {IDN(0,0,0,0, 189), "Following distance"},
332 {IDN(0,0,0,0, 190), "Drive controlled gear engaging procedure command"},
333 {IDN(0,0,0,0, 191), "Cancel reference point procedure command"},
334 {IDN(0,0,0,0, 192), "IDN-list of all backup operation data"},
335 {IDN(0,0,0,0, 193), "Positioning jerk"},
336 {IDN(0,0,0,0, 194), "Acceleration command time"},
337 {IDN(0,0,0,0, 195), "Acceleration feedback value 2"},
338 {IDN(0,0,0,0, 196), "Motor rated current"},
339 {IDN(0,0,0,0, 197), "Set coordinate system procedure command"},
340 {IDN(0,0,0,0, 198), "Initial coordinate value"},
341 {IDN(0,0,0,0, 199), "Shift coordinate system procedure command"},
342 {IDN(0,0,0,0, 200), "Amplifier warning temperature"},
343 {IDN(0,0,0,0, 201), "Motor warning temperature"},
344 {IDN(0,0,0,0, 202), "Cooling error warning temperature"},
345 {IDN(0,0,0,0, 203), "Amplifier shut-down temperature"},
346 {IDN(0,0,0,0, 204), "Motor shut-down temperature"},
347 {IDN(0,0,0,0, 205), "Cooling error shut-down temperature"},
348 {IDN(0,0,0,0, 206), "Drive on delay time"},
349 {IDN(0,0,0,0, 207), "Drive off delay time"},
350 {IDN(0,0,0,0, 208), "Temperature data scaling type"},
351 {IDN(0,0,0,0, 209), "Lower adaptation limit"},
352 {IDN(0,0,0,0, 210), "Upper adaptation limit"},
353 {IDN(0,0,0,0, 211), "Adaptation proportional gain"},
354 {IDN(0,0,0,0, 212), "Adaptation integral action time"},
355 {IDN(0,0,0,0, 213), "Engaging dither amplitude"},
356 {IDN(0,0,0,0, 214), "Average engaging speed"},
357 {IDN(0,0,0,0, 215), "Engaging dither period"},
358 {IDN(0,0,0,0, 216), "Switch parameter set procedure command"},
359 {IDN(0,0,0,0, 217), "Parameter set preselection"},
360 {IDN(0,0,0,0, 218), "Gear-ration preselection"},
361 {IDN(0,0,0,0, 219), "IDN-list of parameter set"},
362 {IDN(0,0,0,0, 220), "Minimum spindle speed"},
363 {IDN(0,0,0,0, 221), "Maximum spindle speed"},
364 {IDN(0,0,0,0, 222), "Spindle positioning speed"},
365 {IDN(0,0,0,0, 223), "Drive controlled synchronous operation procedure command"},
366 {IDN(0,0,0,0, 224), "Lead Spindle Address"},
367 {IDN(0,0,0,0, 225), "Synchronous spindle revolutions"},
368 {IDN(0,0,0,0, 226), "Lead spindle revolutions"},
369 {IDN(0,0,0,0, 227), "Synchronous spindle revolutions"},
370 {IDN(0,0,0,0, 228), "Synchronization position window"},
371 {IDN(0,0,0,0, 229), "Synchronization position error limit"},
372 {IDN(0,0,0,0, 230), "Synchronization position offset"},
373 {IDN(0,0,0,0, 254), "Actual parameter set"},
374 {IDN(0,0,0,0, 255), "Actual gear ration"},
375 {IDN(0,0,0,0, 256), "Multiplication factor 1"},
376 {IDN(0,0,0,0, 257), "Multiplication factor 2"},
377 {IDN(0,0,0,0, 258), "Target position"},
378 {IDN(0,0,0,0, 259), "Positioning velocity"},
379 {IDN(0,0,0,0, 260), "Positioning acceleration"},
380 {IDN(0,0,0,0, 261), "Coarse position window"},
381 {IDN(0,0,0,0, 262), "Load defaults procedure command"},
382 {IDN(0,0,0,0, 263), "Load working memory procedure command"},
383 {IDN(0,0,0,0, 264), "Backup working memory procedure command"},
384 {IDN(0,0,0,0, 265), "Language selection"},
385 {IDN(0,0,0,0, 266), "List of available languages"},
386 {IDN(0,0,0,0, 267), "Password"},
387 {IDN(0,0,0,0, 268), "Angular setting"},
388 {IDN(0,0,0,0, 269), "Storage mode"},
389 {IDN(0,0,0,0, 270), "IDN-list of selected backup operation data"},
390 {IDN(0,0,0,0, 272), "Velocity window percentage"},
391 {IDN(0,0,0,0, 273), "Maximum drive off delay time"},
392 {IDN(0,0,0,0, 275), "Coordinate offset value"},
393 {IDN(0,0,0,0, 276), "Return to Modulo range procedure command"},
394 {IDN(0,0,0,0, 277), "Position feedback 1 type"},
395 {IDN(0,0,0,0, 278), "Maximum travel range"},
396 {IDN(0,0,0,0, 279), "IDN list of password protected data"},
397 {IDN(0,0,0,0, 280), "Underflow threshold"},
398 {IDN(0,0,0,0, 282), "Positioning command value"},
399 {IDN(0,0,0,0, 283), "Current coordinate offset"},
400 {IDN(0,0,0,0, 292), "List of supported operation modes"},
401 {IDN(0,0,0,0, 293), "Selectively backup working memory procedure command"},
402 {IDN(0,0,0,0, 294), "Divider modulo value"},
403 {IDN(0,0,0,0, 295), "Drive enable delay time"},
404 {IDN(0,0,0,0, 296), "Velocity feed forward gain"},
405 {IDN(0,0,0,0, 297), "Homing distance"},
406 {IDN(0,0,0,0, 298), "Suggest home switch distance"},
407 {IDN(0,0,0,0, 299), "Home switch offset 1"},
408 {IDN(0,0,0,0, 300), "Real-time control bit 1"},
409 {IDN(0,0,0,0, 301), "Allocation of real-time control bit 1",},
410 {IDN(0,0,0,0, 302), "Real-time control bit 2"},
411 {IDN(0,0,0,0, 303), "Allocation of real-time control bit 2"},
412 {IDN(0,0,0,0, 304), "Real-time status bit 1"},
413 {IDN(0,0,0,0, 305), "Allocation of real-time status bit 1"},
414 {IDN(0,0,0,0, 306), "Real-time status-bit 2"},
415 {IDN(0,0,0,0, 307), "Allocation of real-time status bit 2"},
416 {IDN(0,0,0,0, 308), "Synchronization operation status"},
417 {IDN(0,0,0,0, 309), "Synchronization error status"},
418 {IDN(0,0,0,0, 310), "Overload warning"},
419 {IDN(0,0,0,0, 311), "Amplifier overtemperature warning"},
420 {IDN(0,0,0,0, 312), "Motor overtemperature warning"},
421 {IDN(0,0,0,0, 313), "Cooling error warning"},
422 {IDN(0,0,0,0, 315), "Positioning velocity higher than n Limit"},
423 {IDN(0,0,0,0, 323), "Target position outside of travel range"},
424 {IDN(0,0,0,0, 326), "Parameter checksum"},
425 {IDN(0,0,0,0, 327), "IDN list of checksum parameter"},
426 {IDN(0,0,0,0, 328), "Bit number allocation list for signal status word"},
427 {IDN(0,0,0,0, 329), "Bit number allocation list for signal control word"},
428 {IDN(0,0,0,0, 330), "Status 'nfeedback = ncommand'"},
429 {IDN(0,0,0,0, 331), "Status 'nfeedback = 0'"},
430 {IDN(0,0,0,0, 332), "Status 'nfeedback less then nx'"},
431 {IDN(0,0,0,0, 333), "Status 'T higher than Tx'"},
432 {IDN(0,0,0,0, 334), "Status 'T greater than Tlimit '"},
433 {IDN(0,0,0,0, 335), "Status 'ncommand greater than nlimit'"},
434 {IDN(0,0,0,0, 336), "Status 'In position'"},
435 {IDN(0,0,0,0, 337), "Status 'P greater Px'"},
436 {IDN(0,0,0,0, 338), "Status 'Position feedback = active target position'"},
437 {IDN(0,0,0,0, 339), "Status 'nfeedback less than minimum spindle speed'"},
438 {IDN(0,0,0,0, 340), "Status 'nfeedback exceeds maximum spindle speed'"},
439 {IDN(0,0,0,0, 341), "Status 'In Coarse position'"},
440 {IDN(0,0,0,0, 342), "Status 'Target position attained'"},
441 {IDN(0,0,0,0, 343), "Status 'Interpolator halted'"},
442 {IDN(0,0,0,0, 346), "Positioning control"},
443 {IDN(0,0,0,0, 347), "Velocity error"},
444 {IDN(0,0,0,0, 348), "Acceleration feed forward gain"},
445 {IDN(0,0,0,0, 349), "Bipolar jerk limit"},
446 {IDN(0,0,0,0, 356), "Distance home switch - marker puls"},
447 {IDN(0,0,0,0, 357), "Marker pulse distance"},
448 {IDN(0,0,0,0, 358), "Home switch offset 2"},
449 {IDN(0,0,0,0, 359), "Positioning deceleration"},
450 {IDN(0,0,0,0, 360), "MDT data container"},
451 {IDN(0,0,0,0, 362), "MDT data container A list index"},
452 {IDN(0,0,0,0, 364), "AT data container A1"},
453 {IDN(0,0,0,0, 366), "AT data container A list index"},
454 {IDN(0,0,0,0, 368), "Data container A pointer"},
455 {IDN(0,0,0,0, 370), "MDT data container A/B configuration list"},
456 {IDN(0,0,0,0, 371), "AT data container A/B configuration list"},
457 {IDN(0,0,0,0, 372), "Drive Halt acceleration bipolar"},
458 {IDN(0,0,0,0, 377), "Velocity feedback monitoring window"},
459 {IDN(0,0,0,0, 378), "Absolute encoder range 1"},
460 {IDN(0,0,0,0, 379), "Absolute encoder range 2"},
461 {IDN(0,0,0,0, 380), "DC bus voltage"},
462 {IDN(0,0,0,0, 381), "DC bus current"},
463 {IDN(0,0,0,0, 382), "DC bus power"},
464 {IDN(0,0,0,0, 383), "Motor temperature"},
465 {IDN(0,0,0,0, 384), "Amplifier temperature"},
466 {IDN(0,0,0,0, 385), "Active power"},
467 {IDN(0,0,0,0, 386), "Active position feedback value"},
468 {IDN(0,0,0,0, 387), "Power overload"},
469 {IDN(0,0,0,0, 388), "Braking current limit"},
470 {IDN(0,0,0,0, 389), "Effective current"},
471 {IDN(0,0,0,0, 390), "DiagnosticNumber"},
472 {IDN(0,0,0,0, 391), "Position feedback monitoring window"},
473 {IDN(0,0,0,0, 392), "Velocity feedback filter"},
474 {IDN(0,0,0,0, 393), "Command value mode"},
475 {IDN(0,0,0,0, 398), "IDN list of configurable real-time/status bits"},
476 {IDN(0,0,0,0, 399), "IDN list of configurable real-time/control bits"},
477 {IDN(0,0,0,0, 400), "Home switch"},
478 {IDN(0,0,0,0, 401), "Probe 1"},
479 {IDN(0,0,0,0, 402), "Probe 2"},
480 {IDN(0,0,0,0, 403), "Position feedback value status"},
481 {IDN(0,0,0,0, 404), "Position command value status"},
482 {IDN(0,0,0,0, 405), "Probe 1 enable"},
483 {IDN(0,0,0,0, 406), "Probe 2 enable"},
484 {IDN(0,0,0,0, 407), "Homing enable"},
485 {IDN(0,0,0,0, 408), "Reference marker pulse registered"},
486 {IDN(0,0,0,0, 409), "Probe 1 positive latched"},
487 {IDN(0,0,0,0, 410), "Probe 1 negative latched"},
488 {IDN(0,0,0,0, 411), "Probe 2 positive latched"},
489 {IDN(0,0,0,0, 412), "Probe 2 negative latched"},
490 {IDN(0,0,0,0, 413), "Bit number allocation of real-time control bit 1"},
491 {IDN(0,0,0,0, 414), "Bit number allocation of real-time control bit 2"},
492 {IDN(0,0,0,0, 415), "Bit number allocation of real-time status bit 1"},
493 {IDN(0,0,0,0, 416), "Bit number allocation of real-time status bit 2"},
494 {IDN(0,0,0,0, 417), "Positioning velocity threshold in modulo mode"},
495 {IDN(0,0,0,0, 418), "Target position window in modulo mode"},
496 {IDN(0,0,0,0, 419), "Positioning acknowledge"},
497 {IDN(0,0,0,0, 420), "Activate parametrization level procedure command (PL)"},
498 {IDN(0,0,0,0, 422), "Exit parameterization level procedure command"},
499 {IDN(0,0,0,0, 423), "IDN-list of invalid data for parameterization level"},
500 {IDN(0,0,0,0, 426), "Measuring data allocation 1"},
501 {IDN(0,0,0,0, 427), "Measuring data allocation 2"},
502 {IDN(0,0,0,0, 428), "IDN list of configurable measuring data"},
503 {IDN(0,0,0,0, 429), "Emergency stop deceleration"},
504 {IDN(0,0,0,0, 430), "Active target position"},
505 {IDN(0,0,0,0, 431), "Spindle positioning acceleration bipolar"},
506 {IDN(0,0,0,0, 437), "Positioning status"},
507 {IDN(0,0,0,0, 446), "Ramp reference velocity"},
508 {IDN(0,0,0,0, 447), "Set absolute position procedure command"},
509 {IDN(0,0,0,0, 448), "Set absolute position control word"},
510 {IDN(0,0,0,0, 460), "Position switches (position switch points off 1-16)"},
511 {IDN(0,0,0,0, 476), "Position switch control"},
512 {IDN(0,0,0,0, 477), "Position switch hysteresis"},
513 {IDN(0,0,0,0, 478), "Limit switch status"},
514 {IDN(0,0,0,0, 509), "Extended probe control"},
515 {IDN(0,0,0,0, 510), "Difference value probe 1"},
516 {IDN(0,0,0,0, 511), "Difference value probe 2"},
517 {IDN(0,0,0,0, 512), "Start position probing window 1"},
518 {IDN(0,0,0,0, 513), "End position probing window 1"},
519 {IDN(0,0,0,0, 514), "Start position probing window 2"},
520 {IDN(0,0,0,0, 515), "End position probing window 2"},
521 {IDN(0,0,0,0, 516), "Marker losses probe 1"},
522 {IDN(0,0,0,0, 517), "Marker losses probe 2"},
523 {IDN(0,0,0,0, 518), "Maximum marker losses probe 1"},
524 {IDN(0,0,0,0, 519), "Maximum marker losses probe 2"},
525 {IDN(0,0,0,0, 520), "Axis control word"},
526 {IDN(0,0,0,0, 521), "Axis status word"},
527 {IDN(0,0,0,0, 522), "Difference value 1 latched"},
528 {IDN(0,0,0,0, 523), "Difference value 2 latched"},
529 {IDN(0,0,0,0, 524), "Probe 1 delay positive"},
530 {IDN(0,0,0,0, 525), "Delay Negative Edge, Probe 1"},
531 {IDN(0,0,0,0, 526), "Delay positive Edge, Probe 2"},
532 {IDN(0,0,0,0, 527), "Delay Negative Edge, Probe 2"},
533 {IDN(0,0,0,0, 530), "Clamping torque"},
534 {IDN(0,0,0,0, 531), "Checksum for backup operation data"},
535 {IDN(0,0,0,0, 532), "Limit switch control"},
536 {IDN(0,0,0,0, 533), "Motor continuous stall torque/force"},
537 {IDN(0,0,0,0,1000), "SCP Type & Version"},
538 {IDN(0,0,0,0,1001), "SERCOS III: Control unit cycle time (tNcyc)"},
539 {IDN(0,0,0,0,1002), "SERCOS III: Communication cycle time (tScyc)"},
540 {IDN(0,0,0,0,1003), "SERCOS III: Number of successive MDT errors"},
541 {IDN(0,0,0,0,1005), "SERCOS III: Feedback value computation time (t5)"},
542 {IDN(0,0,0,0,1006), "SERCOS III: AT transmission starting time (t1)"},
543 {IDN(0,0,0,0,1007), "SERCOS III: Synchronization time (t8)"},
544 {IDN(0,0,0,0,1008), "SERCOS III: Command value valid time (t3)"},
545 {IDN(0,0,0,0,1009), "SERCOS III: Device Control offset in MDT"},
546 {IDN(0,0,0,0,1010), "SERCOS III: Length of MDT"},
547 {IDN(0,0,0,0,1011), "SERCOS III: Device Status offset in AT"},
548 {IDN(0,0,0,0,1012), "SERCOS III: Length of AT"},
549 {IDN(0,0,0,0,1013), "SERCOS III: SVC offset in MDT"},
550 {IDN(0,0,0,0,1014), "SERCOS III: SVC offset in AT"},
551 {IDN(0,0,0,0,1015), "SERCOS III: Ring delay"},
552 {IDN(0,0,0,0,1016), "SERCOS III: Slave delay"},
553 {IDN(0,0,0,0,1017), "SERCOS III: Transmission starting time IP channel"},
554 {IDN(0,0,0,0,1018), "SERCOS III: SYNC delay"},
555 {IDN(0,0,0,0,1019), "SERCOS III: MAC address"},
556 {IDN(0,0,0,0,1020), "SERCOS III: IP address"},
557 {IDN(0,0,0,0,1021), "SERCOS III: Network mask"},
558 {IDN(0,0,0,0,1022), "SERCOS III: Gateway address"},
559 {IDN(0,0,0,0,1023), "SERCOS III: Sync jitter"},
560 {IDN(0,0,0,0,1024), "SERCOS III: Ring control - node control"},
561 {IDN(0,0,0,0,1025), "SERCOS III: Ring status - node status"},
562 {IDN(0,0,0,0,1026), "SERCOS III: Hardware identification"},
563 {IDN(1,0,0,0,1027), "Requested MTU"},
564 {IDN(2,0,0,0,1027), "Effective MTU"},
565 {IDN(0,0,0,0,1028), "SERCOS III: Error counter MDT0 MST"},
566 {IDN(0,0,0,0,1029), "SERCOS III: Error counter MDT0-3"},
567 {IDN(0,0,0,0,1030), "SERCOS III: Error counter AT0-3"},
568 {IDN(0,0,0,0,1031), "Signal assignment Port 1 & Port 2"},
569 {IDN(0,0,0,0,1035), "Error counter Port1 and Port2"},
570 {IDN(0,0,0,0,1040), "SERCOSAddress"},
571 {IDN(0,0,0,0,1041), "AT Command value valid time (t9)"},
572 {IDN(0,0,0,0,1044), "Device Control"},
573 {IDN(0,0,0,0,1045), "Device Status"},
574 {IDN(0,0,0,0,1046), "IDN-list of SERCOS addresses in device"},
575 {IDN(0,0,0,0,1134), "SERCOS III: Device control"},
576 {IDN(0,0,0,0,1135), "SERCOS III: Device status"},
577 {0, NULL}
580 static const value_string siii_mdt_svch_dbe_text[]=
582 {0x00, "Element 0: Closed SVC"},
583 {0x01, "Element 1: Opening IDN"},
584 {0x02, "Element 2: Name of operation data"},
585 {0x03, "Element 3: Attribute of operation data"},
586 {0x04, "Element 4: Unit of operation data"},
587 {0x05, "Element 5: Minimum value of operation data"},
588 {0x06, "Element 6: Maximum value of operation data"},
589 {0x07, "Element 7: Operation data"},
590 {0, NULL}
593 static const value_string siii_mdt_svch_eot_text[]=
595 {0x00, "Transmission in progress"},
596 {0x01, "Last transmission"},
597 {0, NULL}
600 static const value_string siii_mdt_svch_rw_text[]=
602 {0x00, "Read SVC INFO"},
603 {0x01, "Write SVC INFO"},
604 {0, NULL}
607 static const value_string siii_mdt_devcontrol_topcontrol_text[]=
609 {0x00, "Fast Forward on P/S-Channel"},
610 {0x01, "Loopback on P-Channel and Fast Forward"},
611 {0x02, "Loopback on S-Channel and Fast Forward"},
612 {0, NULL}
615 static const value_string siii_at_svch_valid_text[]=
617 {0x00, "SVC not valid"},
618 {0x01, "SVC valid"},
619 {0, NULL}
622 static const value_string siii_at_svch_error_text[]=
624 {0x00, "No error"},
625 {0x01, "Error in SVC"},
626 {0, NULL}
629 static const value_string siii_at_svch_busy_text[]=
631 {0x00, "Step finished, slave ready for new step"},
632 {0x01, "Step in process, new step not allowed"},
633 {0, NULL}
637 static const value_string siii_mst_phase_text[]=
639 {0x00, "CP0"},
640 {0x01, "CP1"},
641 {0x02, "CP2"},
642 {0x03, "CP3"},
643 {0x04, "CP4"},
644 {0x80, "CP0 (Phase Change)"},
645 {0x81, "CP1 (Phase Change)"},
646 {0x82, "CP2 (Phase Change)"},
647 {0x83, "CP3 (Phase Change)"},
648 {0x84, "CP4 (Phase Change)"},
649 {0, NULL}
652 #if 0
653 static const value_string siii_mst_teltype_text[]=
655 {0x00, "CP0"},
656 {0x01, "CP1"},
657 {0x02, "CP2"},
658 {0x03, "CP3"},
659 {0x04, "CP4"},
660 {0x80, "CP0 (Phase Change)"},
661 {0x81, "CP1 (Phase Change)"},
662 {0x82, "CP2 (Phase Change)"},
663 {0x83, "CP3 (Phase Change)"},
664 {0x84, "CP4 (Phase Change)"},
665 {0, NULL}
667 #endif
669 static const value_string siii_mst_channel_text[]=
671 {0x00, "P-Telegram"},
672 {0x01, "S-Telegram"},
673 {0, NULL}
676 static const value_string siii_mst_type_text[]=
678 {0x00, "MDT"},
679 {0x01, "AT"},
680 {0, NULL}
683 static const value_string siii_mst_cyclecntvalid_text[]=
685 {0x00, "Invalid"},
686 {0x01, "Valid"},
687 {0, NULL}
691 static const value_string siii_at_devstatus_errorconnection_text[]=
693 {0x00, "Error-free connection"},
694 {0x01, "Error in the connection occurs"},
695 {0, NULL}
698 static const value_string siii_at_devstatus_topstatus_text[]=
700 {0x00, "Fast Forward on P/S-Channel"},
701 {0x01, "Loopback on P-Channel and Fast Forward"},
702 {0x02, "Loopback on S-Channel and Fast Forward"},
703 {0, NULL}
706 static const value_string siii_at_devstatus_inactiveportstatus_text[]=
708 {0x00, "No link on port"},
709 {0x01, "Link on port"},
710 {0x02, "S III P-Telegram on port"},
711 {0x03, "S III S-Telegram on port"},
712 {0, NULL}
715 static const value_string siii_at_dev_status_proc_command_change_text[]=
717 {0x00, "No change in procedure command acknowledgement"},
718 {0x01, "Changing procedure command acknowledgement"},
719 {0, NULL}
723 static const value_string siii_mdt_hotplug_control_functioncode_text[]=
725 {0x00, "No data"},
726 {0x01, "tScyc"},
727 {0x02, "t1"},
728 {0x03, "t6"},
729 {0x04, "t7"},
730 {0x05, "Communication Version"},
731 {0x06, "Communication timeout"},
732 {0x10, "MDT0 Length"},
733 {0x11, "MDT1 Length"},
734 {0x12, "MDT2 Length"},
735 {0x13, "MDT3 Length"},
736 {0x20, "AT0 Length"},
737 {0x21, "AT1 Length"},
738 {0x22, "AT2 Length"},
739 {0x23, "AT3 Length"},
740 {0x80, "MDT-SVC pointer"},
741 {0x81, "MDT-RTD pointer"},
742 {0x82, "AT-SVC pointer"},
743 {0x83, "AT-RTD pointer"},
744 {0, NULL}
747 static const value_string siii_mdt_hotplug_control_svc_switch_text[]=
749 {0, "Transmission via HP-field"},
750 {1, "Switch to SVC"},
751 {0, NULL}
754 static const value_string siii_mdt_hotplug_status_ackcode_text[]=
756 {0x80, "MDT-SVC pointer"},
757 {0x81, "MDT-RTD pointer"},
758 {0x82, "AT-SVC pointer"},
759 {0x83, "AT-RTD pointer"},
760 {255, "Next Sercos Slave has same address"},
761 {0, NULL}
764 static const value_string siii_at_hotplug_status_error_text[]=
766 {0, "Acknowledgement in HP-1"},
767 {1, "Error in HP-1"},
768 {0, NULL}
775 void dissect_siii_mst(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
777 proto_item* ti;
778 proto_tree* subtree;
779 proto_tree* subtree2;
781 ti = proto_tree_add_text(tree, tvb, 0, 6, "MST");
782 subtree = proto_item_add_subtree(ti, ett_siii_mst);
784 ti = proto_tree_add_text(subtree, tvb, 0, 1, "Telegram Type");
785 subtree2 = proto_item_add_subtree(ti, ett_siii_mst_teltype);
787 proto_tree_add_item(subtree2, hf_siii_mst_channel, tvb, 0, 1, ENC_LITTLE_ENDIAN);
788 proto_tree_add_item(subtree2, hf_siii_mst_type, tvb, 0, 1, ENC_LITTLE_ENDIAN);
789 proto_tree_add_item(subtree2, hf_siii_mst_cyclecntvalid, tvb, 0, 1, ENC_LITTLE_ENDIAN);
790 proto_tree_add_item(subtree2, hf_siii_mst_telno, tvb, 0, 1, ENC_LITTLE_ENDIAN);
792 ti = proto_tree_add_text(subtree, tvb, 1, 1, "Phase Field");
793 subtree2 = proto_item_add_subtree(ti, ett_siii_mst_phase);
795 proto_tree_add_item(subtree2, hf_siii_mst_phase, tvb, 1, 1, ENC_LITTLE_ENDIAN);
796 proto_tree_add_item(subtree2, hf_siii_mst_cyclecnt, tvb, 1, 1, ENC_LITTLE_ENDIAN);
797 proto_tree_add_item(subtree, hf_siii_mst_crc32, tvb, 2, 4, ENC_LITTLE_ENDIAN);
801 void dissect_siii_mdt_hp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
803 proto_tree* subtree;
804 proto_tree* subtree2;
805 proto_item* ti;
807 ti = proto_tree_add_text(tree, tvb, 0, 8, "Hot-Plug");
808 subtree = proto_item_add_subtree(ti, ett_siii_mdt_hp);
810 proto_tree_add_item(subtree, hf_siii_mdt_hotplug_address, tvb, 2, 2, ENC_LITTLE_ENDIAN);
812 ti = proto_tree_add_item(subtree, hf_siii_mdt_hp_ctrl, tvb, 2, 2, ENC_LITTLE_ENDIAN);
813 subtree2 = proto_item_add_subtree(ti, ett_siii_mdt_hp_ctrl);
815 proto_tree_add_item(subtree2, hf_siii_mdt_hotplug_control_svc_switch, tvb, 2, 2, ENC_LITTLE_ENDIAN);
816 proto_tree_add_item(subtree2, hf_siii_mdt_hotplug_control_param, tvb, 2, 2, ENC_LITTLE_ENDIAN);
818 proto_tree_add_item(subtree, hf_siii_mdt_hp_info, tvb, 4, 4, ENC_NA);
821 void dissect_siii_mdt_devctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
823 proto_tree* subtree;
824 proto_item* ti;
826 ti = proto_tree_add_item(tree, hf_siii_mdt_dev_control, tvb, 0, 2, ENC_LITTLE_ENDIAN);
827 subtree = proto_item_add_subtree(ti, ett_siii_mdt_devctrl);
829 proto_tree_add_item(subtree, hf_siii_at_dev_control_ident, tvb, 0, 2, ENC_LITTLE_ENDIAN);
830 proto_tree_add_item(subtree, hf_siii_mdt_dev_control_change_topology, tvb, 0, 2, ENC_LITTLE_ENDIAN);
831 proto_tree_add_item(subtree, hf_siii_mdt_dev_control_top_control, tvb, 0, 2, ENC_LITTLE_ENDIAN);
834 void dissect_siii_mdt_svc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint devno _U_) /* devno will be needed in later versions */
836 proto_tree* subtree;
837 proto_item* ti;
839 guint16 svc_ctrl = tvb_get_letohs(tvb, 0); /* service channel header */
840 guint32 svc_info = tvb_get_letohl(tvb, 2); /* service channel data */
841 guint8 svc_dbe = (svc_ctrl>>3) & 7; /* accessed data block element */
843 ti = proto_tree_add_item(tree, hf_siii_mdt_svch_ctrl, tvb, 0, 2, ENC_LITTLE_ENDIAN);
844 subtree = proto_item_add_subtree(ti, ett_siii_mdt_svcctrl);
846 proto_tree_add_item(subtree, hf_siii_mdt_svch_dbe, tvb, 0, 2, ENC_LITTLE_ENDIAN); /* data block element */
847 proto_tree_add_item(subtree, hf_siii_mdt_svch_eot, tvb, 0, 2, ENC_LITTLE_ENDIAN); /* end of transmission */
848 proto_tree_add_item(subtree, hf_siii_mdt_svch_rw, tvb, 0, 2, ENC_LITTLE_ENDIAN); /* read or write */
849 proto_tree_add_item(subtree, hf_siii_mdt_svch_mhs, tvb, 0, 2, ENC_LITTLE_ENDIAN); /* master hand shake */
851 ti = proto_tree_add_item(tree, hf_siii_mdt_svch_info, tvb, 2, 4, ENC_NA);
853 if(1 == svc_dbe)
855 subtree = proto_item_add_subtree(ti, ett_siii_mdt_svcinfo);
856 proto_tree_add_text(subtree, tvb, 2, 4, "IDN code: %c-%u-%04d.%d.%d",
857 ((0xFFFF & svc_info)>>15)?'P':'S', /* private or sercos IDN */
858 (svc_info>>12)&7, /* parameter record */
859 (svc_info&4095), /* IDN */
860 (svc_info>>24) & 0xFF, /* structure index */
861 (svc_info>>16) & 0xFF); /* structure element */
862 proto_tree_add_item(subtree, hf_siii_mdt_svch_idn, tvb, 2, 4, ENC_LITTLE_ENDIAN);
866 static void dissect_siii_mdt_cp0(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
868 proto_item* ti;
869 proto_tree* subtree;
870 ti = proto_tree_add_item(tree, hf_siii_mdt_version, tvb, 0, 4, ENC_LITTLE_ENDIAN);
871 subtree = proto_item_add_subtree(ti, ett_siii_mdt_version);
873 proto_tree_add_item(subtree, hf_siii_mdt_version_num_mdt_at_cp1_2, tvb, 0, 4, ENC_LITTLE_ENDIAN);
874 proto_tree_add_item(subtree, hf_siii_mdt_version_initprocvers, tvb, 0, 4, ENC_LITTLE_ENDIAN);
875 proto_tree_add_item(subtree, hf_siii_mdt_version_revision, tvb, 0, 4, ENC_LITTLE_ENDIAN);
879 static void dissect_siii_mdt_cp1_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint telno)
881 guint devstart = telno * SERCOS_SLAVE_GROUP_SIZE; /* MDT0: slaves 0-127; MDT1: slaves 128-255; ... */
882 tvbuff_t* tvb_n;
884 guint idx;
886 proto_item* ti;
887 proto_tree* subtree;
888 proto_tree* subtree_svc;
889 proto_tree* subtree_devctrl;
891 ti = proto_tree_add_text(tree, tvb, 0, SERCOS_SLAVE_GROUP_SIZE * 6, "Service Channels");
892 subtree_svc = proto_item_add_subtree(ti, ett_siii_mdt_svc);
894 ti = proto_tree_add_text(tree, tvb, SERCOS_SLAVE_GROUP_SIZE * 6, 512, "Device Control");
895 subtree_devctrl = proto_item_add_subtree(ti, ett_siii_mdt_svc);
897 for(idx = 0; idx < SERCOS_SLAVE_GROUP_SIZE; ++idx) /* each MDT of CP1/2 has data for 128 different slaves */
899 tvb_n = tvb_new_subset(tvb, 6 * idx, 6, 6); /* subset for service channel data */
901 ti = proto_tree_add_text(subtree_svc, tvb_n, 0, 6, "Device %u", idx + devstart);
902 subtree = proto_item_add_subtree(ti, ett_siii_mdt_svc_channel);
903 dissect_siii_mdt_svc(tvb_n, pinfo, subtree, idx + devstart);
905 tvb_n = tvb_new_subset(tvb, SERCOS_SLAVE_GROUP_SIZE * 6 + 4 * idx, 2, 2); /* subset for device control information */
907 ti = proto_tree_add_text(subtree_devctrl, tvb_n, 0, 2, "Device %u", idx + devstart);
908 subtree = proto_item_add_subtree(ti, ett_siii_mdt_dev_control);
910 dissect_siii_mdt_devctrl(tvb_n, pinfo, subtree);
914 static void dissect_siii_mdt_cp3_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint telno)
916 guint devstart _U_ = telno * SERCOS_SLAVE_GROUP_SIZE;
918 if(0 == telno) /* dissect hotplug field in MDT0 only */
919 dissect_siii_mdt_hp(tvb, pinfo, tree);
921 /* offsets of service channel, device status and connections are unknown
922 * this data could be extracted from svc communication during CP2
924 proto_tree_add_text(tree, tvb, 0, 0, "Service Channels");
926 proto_tree_add_text(tree, tvb, 0, 0, "Device Controls");
929 void dissect_siii_mdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
931 proto_item* ti;
932 proto_tree* subtree;
933 tvbuff_t* tvb_n;
935 guint t_phase;
936 guint telno;
938 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SIII MDT");
940 t_phase = (tvb_get_guint8(tvb, 1)&0x8F); /* read communication phase out of SERCOS III header */
941 telno = (tvb_get_guint8(tvb, 0) & 0xF); /* read number of MDT out of SERCOS III header */
943 if(t_phase & 0x80) /* communication phase switching in progress */
945 col_append_fstr(pinfo->cinfo, COL_INFO, " Phase=CP?s -> CP%u",
946 (t_phase&0x0f));
948 else /* communication as usual */
950 col_append_fstr(pinfo->cinfo, COL_INFO, " Phase=CP%u",
951 (t_phase&0x0f));
954 ti = proto_tree_add_text(tree, tvb, 0, -1, "MDT%u", telno);
955 subtree = proto_item_add_subtree(ti, ett_siii_mdt);
957 dissect_siii_mst(tvb, pinfo, subtree); /* dissect SERCOS III header */
959 switch(t_phase) /* call the MDT dissector depending on the current communication phase */
961 case COMMUNICATION_PHASE_0: /* CP0 */
962 tvb_n = tvb_new_subset(tvb, 6, 40, 40);
963 dissect_siii_mdt_cp0(tvb_n, pinfo, subtree);
964 break;
966 case COMMUNICATION_PHASE_1: /* CP1 */
967 case COMMUNICATION_PHASE_2: /* CP2 */
968 tvb_n = tvb_new_subset(tvb, 6, 1280, 1280);
969 dissect_siii_mdt_cp1_2(tvb_n, pinfo, subtree, telno);
970 break;
972 case COMMUNICATION_PHASE_3: /* CP3 */
973 case COMMUNICATION_PHASE_4: /* CP4 */
974 tvb_n = tvb_new_subset_remaining(tvb, 6);
975 dissect_siii_mdt_cp3_4(tvb_n, pinfo, subtree, telno);
976 break;
978 default:
979 proto_tree_add_text(tree, tvb, 6, -1, "CP is unknown");
983 void dissect_siii_at_svc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint devno _U_) /* devno will be used in later versions */
985 proto_tree* subtree;
986 proto_item* ti;
988 ti = proto_tree_add_item(tree, hf_siii_at_svch_stat, tvb, 0, 2, ENC_LITTLE_ENDIAN);
989 subtree = proto_item_add_subtree(ti, ett_siii_at_svcstat);
991 proto_tree_add_item(subtree, hf_siii_at_svch_valid, tvb, 0, 2, ENC_LITTLE_ENDIAN);
992 proto_tree_add_item(subtree, hf_siii_at_svch_error, tvb, 0, 2, ENC_LITTLE_ENDIAN);
993 proto_tree_add_item(subtree, hf_siii_at_svch_busy, tvb, 0, 2, ENC_LITTLE_ENDIAN);
994 proto_tree_add_item(subtree, hf_siii_at_svch_ahs, tvb, 0, 2, ENC_LITTLE_ENDIAN);
996 proto_tree_add_item(tree, hf_siii_at_svch_info, tvb, 2, 4, ENC_NA);
999 void dissect_siii_at_devstat(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1001 proto_tree* subtree;
1002 proto_item* ti;
1004 ti = proto_tree_add_item(tree, hf_siii_at_dev_status, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1005 subtree = proto_item_add_subtree(ti, ett_siii_at_devstatus);
1007 proto_tree_add_item(subtree, hf_siii_at_dev_status_commwarning, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1008 proto_tree_add_item(subtree, hf_siii_at_dev_status_change_topology, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1009 proto_tree_add_item(subtree, hf_siii_at_dev_status_top_status, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1010 proto_tree_add_item(subtree, hf_siii_at_dev_status_inactive_port_status, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1011 proto_tree_add_item(subtree, hf_siii_at_dev_status_errorconnection, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1012 proto_tree_add_item(subtree, hf_siii_at_dev_status_slave_valid, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1013 proto_tree_add_item(subtree, hf_siii_at_dev_status_proc_command_change, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1014 proto_tree_add_item(subtree, hf_siii_at_dev_status_parameterization_level_active, tvb, 0, 2, ENC_LITTLE_ENDIAN);
1017 void dissect_siii_at_hp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1019 proto_tree* subtree;
1020 proto_tree* subtree2;
1021 proto_item* ti;
1023 ti = proto_tree_add_text(tree, tvb, 0, 8, "Hot-Plug");
1024 subtree = proto_item_add_subtree(ti, ett_siii_at_hp);
1026 proto_tree_add_item(subtree, hf_siii_at_hotplug_address, tvb, 2, 2, ENC_LITTLE_ENDIAN);
1028 ti = proto_tree_add_item(subtree, hf_siii_at_hp_stat, tvb, 2, 2, ENC_LITTLE_ENDIAN);
1029 subtree2 = proto_item_add_subtree(ti, ett_siii_at_hp_stat);
1031 proto_tree_add_item(subtree2, hf_siii_at_hotplug_status_error, tvb, 2, 2, ENC_LITTLE_ENDIAN);
1032 proto_tree_add_item(subtree2, hf_siii_at_hotplug_status_hp0_finished, tvb, 2, 2, ENC_LITTLE_ENDIAN);
1033 proto_tree_add_item(subtree2, hf_siii_at_hotplug_status_param, tvb, 2, 2, ENC_LITTLE_ENDIAN);
1035 proto_tree_add_item(subtree, hf_siii_at_hp_info, tvb, 4, 4, ENC_NA);
1038 static void dissect_siii_at_cp0(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1040 guint16 seqcnt; /* sequence counter */
1041 guint16 tfield; /* topology field for sercos addresses */
1042 guint16 i;
1043 char devices[]="Recognized Devices"; /* fixme: it would be nice to have this as subtree */
1044 static char outbuf[200];
1046 proto_tree_add_text(tree, tvb, 0, 1024, "%s", devices);
1048 /* check sequence count field */
1049 seqcnt = tvb_get_letohs(tvb, 0);
1050 g_snprintf(outbuf, sizeof(outbuf), "Number of Devices: %u", (0x1FF & seqcnt)-1);
1051 proto_tree_add_text(tree, tvb, 0, 2, "%s", outbuf);
1053 /* check SERCOS address of each topology field */
1054 for(i=1;i < MAX_SERCOS_DEVICES; ++i)
1056 tfield = tvb_get_letohs(tvb, i*2);
1058 if(tfield == 0)
1060 g_snprintf(outbuf, sizeof(outbuf), "Device Address %u: No SERCOS Address", i);
1062 else if(tfield == 0xFFFF)
1064 g_snprintf(outbuf, sizeof(outbuf), "Device Address %u: No Device", i);
1066 else
1068 g_snprintf(outbuf, sizeof(outbuf), "Device Address %u: %u", i, tfield);
1070 proto_tree_add_text(tree, tvb, i*2, 2, "%s", outbuf);
1074 static void dissect_siii_at_cp1_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint telno)
1076 guint devstart = telno * SERCOS_SLAVE_GROUP_SIZE; /* AT0: slaves 0-127; AT1: slaves 128-255; ... */
1077 tvbuff_t* tvb_n;
1079 guint idx;
1081 proto_item* ti; /* temporary item */
1082 proto_tree* subtree;
1083 proto_tree* subtree_svc;
1084 proto_tree* subtree_devstat;
1086 ti = proto_tree_add_text(tree, tvb, 0, SERCOS_SLAVE_GROUP_SIZE * 6, "Service Channel");
1087 subtree_svc = proto_item_add_subtree(ti, ett_siii_at_svc);
1089 ti = proto_tree_add_text(tree, tvb, SERCOS_SLAVE_GROUP_SIZE * 6, 512, "Device Status");
1090 subtree_devstat = proto_item_add_subtree(ti, ett_siii_at_devstats);
1092 for(idx = 0; idx < SERCOS_SLAVE_GROUP_SIZE; ++idx) /* each AT of CP1/2 has data of 128 different slaves */
1094 tvb_n = tvb_new_subset(tvb, 6 * idx, 6, 6); /* subset for service channel data */
1096 ti = proto_tree_add_text(subtree_svc, tvb_n, 0, 6, "Device %u", idx + devstart);
1097 subtree = proto_item_add_subtree(ti, ett_siii_at_svc_channel);
1098 dissect_siii_at_svc(tvb_n, pinfo, subtree, idx + devstart);
1100 tvb_n = tvb_new_subset(tvb, SERCOS_SLAVE_GROUP_SIZE * 6 + 4 * idx, 2, 2); /* subset for device status information */
1102 ti = proto_tree_add_text(subtree_devstat, tvb_n, 0, 2, "Device %u", idx + devstart);
1103 subtree = proto_item_add_subtree(ti, ett_siii_at_dev_status);
1104 dissect_siii_at_devstat(tvb_n, pinfo, subtree);
1108 static void dissect_siii_at_cp3_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint telno)
1110 if(0 == telno) /* dissect hotplug field in AT0 only */
1111 dissect_siii_at_hp(tvb, pinfo, tree);
1113 /* offsets of service channel, device status and connections are unknown
1114 * this data could be extracted from svc communication during CP2
1116 proto_tree_add_text(tree, tvb, 0, 0, "Service Channels");
1117 proto_tree_add_text(tree, tvb, 0, 0, "Device Status");
1121 void dissect_siii_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1123 proto_item* ti; /* temporary item */
1124 proto_tree* subtree;
1125 tvbuff_t* tvb_n;
1127 guint8 phase;
1128 guint telno;
1130 phase = (tvb_get_guint8(tvb, 1)&0x8F); /* read communication phase out of SERCOS III header*/
1131 telno = (tvb_get_guint8(tvb, 0) & 0xF); /* read number of AT out of SERCOS III header */
1133 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SIII AT");
1135 if(phase & 0x80) /* communication phase switching in progress */
1137 col_append_fstr(pinfo->cinfo, COL_INFO, " Phase=CP?s -> CP%u",
1138 (phase&0x0f));
1140 else /* communication as usual */
1142 col_append_fstr(pinfo->cinfo, COL_INFO, " Phase=CP%u",
1143 (phase&0x0f));
1146 ti = proto_tree_add_text(tree, tvb, 0, -1, "AT%u", telno);
1147 subtree = proto_item_add_subtree(ti, ett_siii_at);
1149 dissect_siii_mst(tvb, pinfo, subtree); /* dissect SERCOS III header */
1151 switch(phase) /* call the AT dissector depending on the current communication phase */
1153 case COMMUNICATION_PHASE_0: /* CP0 */
1154 tvb_n = tvb_new_subset(tvb, 6, 1024, 1024);
1155 dissect_siii_at_cp0(tvb_n, pinfo, subtree);
1156 break;
1158 case COMMUNICATION_PHASE_1: /* CP1 */
1159 case COMMUNICATION_PHASE_2: /* CP2 */
1160 tvb_n = tvb_new_subset(tvb, 6, 1280, 1280);
1161 dissect_siii_at_cp1_2(tvb_n, pinfo, subtree, telno);
1162 break;
1164 case COMMUNICATION_PHASE_3: /* CP3 */
1165 case COMMUNICATION_PHASE_4: /* CP4 */
1166 tvb_n = tvb_new_subset_remaining(tvb, 6);
1167 dissect_siii_at_cp3_4(tvb_n, pinfo, subtree, telno);
1168 break;
1170 default:
1171 proto_tree_add_text(tree, tvb, 6, -1, "CP is unknown");
1172 break;
1176 /* Main dissector entry */
1177 static void
1178 dissect_siii(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1180 proto_item* ti;
1181 proto_tree* siii_tree;
1182 guint type;
1183 const char* tel_ch="?";
1184 const char* tel_type="?";
1185 guint tel_no = 0;
1187 /* setup columns */
1188 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SERCOS III V1.1");
1189 col_clear(pinfo->cinfo, COL_INFO);
1192 * In case the packet is a protocol encoded in the basic SercosIII transport stream,
1193 * give that protocol a chance to make a heuristic dissection, before we continue
1194 * to dissect it as a normal SercosIII packet.
1196 if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree, NULL))
1197 return;
1199 /* check what we got on our hand */
1200 type = tvb_get_guint8(tvb, 0);
1201 if(type&0x80) /* primary or secondary channel */
1202 tel_ch="S";
1203 else
1204 tel_ch="P";
1206 if(type&0x40) /* master data telegram (mdt) or slave telegram (at) */
1207 tel_type="AT ";
1208 else
1209 tel_type="MDT";
1211 tel_no = type &0xF; /* even though it's reserved (the V1.1 spec states that it is reserved for additional MDT/AT) */
1213 col_append_fstr(pinfo->cinfo, COL_INFO, "%s%u Channel=%s", tel_type, tel_no, tel_ch);
1215 ti = proto_tree_add_item(tree, proto_siii, tvb, 0, -1, ENC_NA);
1217 siii_tree = proto_item_add_subtree(ti, ett_siii);
1219 /* enter the specific dissector for AT or MDT */
1220 if(type & 0x40)
1221 dissect_siii_at(tvb, pinfo, siii_tree);
1222 else
1223 dissect_siii_mdt(tvb, pinfo, siii_tree);
1226 void
1227 proto_register_sercosiii(void)
1229 static hf_register_info hf[] = {
1231 { &hf_siii_mdt_version,
1232 { "Communication Version", "siii.mdt.version",
1233 FT_UINT32, BASE_HEX, NULL, 0,
1234 NULL, HFILL }
1236 { &hf_siii_mdt_version_revision,
1237 { "Revision Number", "siii.mdt.version.revision",
1238 FT_UINT32, BASE_HEX, NULL, 0x7F,
1239 NULL, HFILL }
1241 { &hf_siii_mdt_version_num_mdt_at_cp1_2,
1242 { "Number of MDTs and ATS in CP1 and CP2", "siii.mdt.version.num_mdt_at_cp1_2",
1243 FT_UINT32, BASE_HEX, VALS(siii_mdt_version_num_mdtat_cp1_2_text), 0x30000,
1244 NULL, HFILL }
1246 { &hf_siii_mdt_version_initprocvers,
1247 { "Initialization Procedure Version Number", "siii.mdt.version.initprocvers",
1248 FT_UINT32, BASE_HEX, VALS(siii_mdt_version_initprocvers_text), 0xFF00,
1249 NULL, HFILL }
1252 { &hf_siii_mdt_dev_control_top_control,
1253 { "Topology Control", "siii.mdt.devcontrol.topcontrol",
1254 FT_UINT16, BASE_DEC, VALS(siii_mdt_devcontrol_topcontrol_text), 3<<(12),
1255 NULL, HFILL }
1257 { &hf_siii_at_dev_control_ident,
1258 { "Identification", "siii.mdt.devcontrol.identrequest",
1259 FT_UINT16, BASE_DEC, NULL, 0x8000,
1260 NULL, HFILL }
1262 { &hf_siii_mdt_dev_control_change_topology,
1263 { "Changing Topology", "siii.mdt.devcontrol.topologychange",
1264 FT_UINT16, BASE_DEC, NULL, 1<<14,
1265 NULL, HFILL }
1267 { &hf_siii_mdt_dev_control,
1268 { "Word", "siii.mdt.devcontrol",
1269 FT_UINT16, BASE_DEC, NULL, 0,
1270 NULL, HFILL }
1273 { &hf_siii_at_dev_status,
1274 { "Word", "siii.at.devstatus",
1275 FT_UINT16, BASE_HEX, NULL, 0,
1276 NULL, HFILL }
1279 { &hf_siii_at_dev_status_commwarning,
1280 { "Communication Warning", "siii.at.devstatus.commwarning",
1281 FT_UINT16, BASE_DEC, NULL, 1<<15,
1282 NULL, HFILL }
1285 { &hf_siii_at_dev_status_change_topology,
1286 { "Topology Change", "siii.at.devstatus.topologychanged",
1287 FT_UINT16, BASE_DEC, NULL, 1<<14,
1288 NULL, HFILL }
1290 { &hf_siii_at_dev_status_top_status,
1291 { "Topology Status", "siii.at.devstatus.topstatus",
1292 FT_UINT16, BASE_DEC, VALS(siii_at_devstatus_topstatus_text), 0x3<<(12),
1293 NULL, HFILL }
1295 { &hf_siii_at_dev_status_inactive_port_status,
1296 { "Port 1 Status", "siii.at.devstatus.inactportstatus",
1297 FT_UINT16, BASE_DEC, VALS(siii_at_devstatus_inactiveportstatus_text), 0x3<<(10),
1298 NULL, HFILL }
1300 { &hf_siii_at_dev_status_errorconnection,
1301 { "Topology Status", "siii.at.devstatus.errorconnection",
1302 FT_UINT16, BASE_DEC, VALS(siii_at_devstatus_errorconnection_text), 1<<9,
1303 NULL, HFILL }
1305 { &hf_siii_at_dev_status_slave_valid,
1306 { "Slave data valid", "siii.at.devstatus.slavevalid",
1307 FT_UINT16, BASE_DEC, NULL, 1<<8,
1308 NULL, HFILL }
1310 { &hf_siii_at_dev_status_proc_command_change,
1311 { "Procedure Command Change", "siii.at.devstatus.proccmdchange",
1312 FT_UINT16, BASE_DEC, VALS(siii_at_dev_status_proc_command_change_text), 1<<5,
1313 NULL, HFILL }
1315 { &hf_siii_at_dev_status_parameterization_level_active,
1316 { "Parameterization level active", "siii.at.devstatus.paralevelactive",
1317 FT_UINT16, BASE_DEC, NULL, 1<<4,
1318 NULL, HFILL }
1321 { &hf_siii_mdt_svch_ctrl,
1322 {"SvcCtrl", "siii.mdt.svch.ctrl",
1323 FT_UINT16, BASE_HEX, NULL, 0,
1324 NULL, HFILL }
1326 { &hf_siii_at_svch_stat,
1327 {"SvcStat", "siii.mdt.svch.stat",
1328 FT_UINT16, BASE_HEX, NULL, 0,
1329 NULL, HFILL }
1331 { &hf_siii_mdt_svch_info,
1332 {"Svc Info", "siii.mdt.svch.info",
1333 FT_BYTES, BASE_NONE, NULL, 0,
1334 NULL, HFILL }
1336 { &hf_siii_at_svch_info,
1337 {"Svc Info", "siii.at.svch.info",
1338 FT_BYTES, BASE_NONE, NULL, 0,
1339 NULL, HFILL }
1341 { &hf_siii_mdt_svch_idn,
1342 {"IDN", "siii.mdt.svch.idn",
1343 FT_UINT32, BASE_HEX, VALS(siii_mdt_idn_text), 0,
1344 NULL, HFILL }
1346 { &hf_siii_mdt_svch_dbe,
1347 { "Data block element", "siii.mdt.svch.dbe",
1348 FT_UINT16, BASE_DEC, VALS(siii_mdt_svch_dbe_text), 0x38,
1349 NULL, HFILL }
1351 { &hf_siii_mdt_svch_eot,
1352 {"End of element transmission", "siii.mdt.svch.eot",
1353 FT_UINT16, BASE_DEC, VALS(siii_mdt_svch_eot_text), 0x04,
1354 NULL, HFILL }
1356 { &hf_siii_mdt_svch_rw,
1357 {"Read/Write", "siii.mdt.svch.rw",
1358 FT_UINT16, BASE_DEC, VALS(siii_mdt_svch_rw_text), 0x02,
1359 NULL, HFILL }
1361 { &hf_siii_mdt_svch_mhs,
1362 {"Master Handshake", "siii.mdt.svch.mhs",
1363 FT_UINT16, BASE_DEC, NULL, 0x01,
1364 NULL, HFILL }
1366 { &hf_siii_at_svch_valid,
1367 { "SVC process", "siii.mdt.svch.proc",
1368 FT_UINT16, BASE_DEC, VALS(siii_at_svch_valid_text), 0x08,
1369 NULL, HFILL }
1371 { &hf_siii_at_svch_error,
1372 {"SVC Error", "siii.mdt.svch.error",
1373 FT_UINT16, BASE_DEC, VALS(siii_at_svch_error_text), 0x04,
1374 NULL, HFILL }
1376 { &hf_siii_at_svch_busy,
1377 {"Busy", "siii.mdt.svch.busy",
1378 FT_UINT16, BASE_DEC, VALS(siii_at_svch_busy_text), 0x02,
1379 NULL, HFILL }
1381 { &hf_siii_at_svch_ahs,
1382 {"Handshake", "siii.at.svch.ahs",
1383 FT_UINT16, BASE_DEC, NULL, 0x01,
1384 NULL, HFILL }
1386 #if 0
1387 { &hf_siii_svch_data_telofs_telno,
1388 {"Telegram Number", "siii.mdt.svch.data.telassign.telno",
1389 FT_UINT16, BASE_DEC, NULL, 0xF000,
1390 NULL, HFILL }
1392 #endif
1393 #if 0
1394 { &hf_siii_svch_data_telofs_mdt_at,
1395 {"Telegram Type", "siii.mdt.svch.data.telassign.mdt_at",
1396 FT_UINT16, BASE_DEC, VALS(siii_svch_data_mdt_at_text), 0x0800,
1397 NULL, HFILL }
1399 #endif
1400 #if 0
1401 { &hf_siii_svch_data_telofs_offset,
1402 {"Telegram Offset", "siii.mdt.svch.data.telassign.offset",
1403 FT_UINT16, BASE_DEC, NULL, 0x07FF,
1404 NULL, HFILL }
1406 #endif
1407 #if 0
1408 { &hf_siii_svch_data_proccmd_proccmdexec,
1409 {"Procedure Command Execution", "siii.mdt.svch.data.proccmd.interrupt",
1410 FT_UINT16, BASE_DEC, VALS(siii_svch_data_proccmd_proccmdexec_text), 0x0002,
1411 NULL, HFILL }
1413 #endif
1414 #if 0
1415 { &hf_siii_svch_data_proccmd_proccmd,
1416 {"Procedure Command", "siii.mdt.svch.data.proccmd.set",
1417 FT_UINT16, BASE_DEC, VALS(siii_svch_data_proccmd_proccmd_text), 0x0001,
1418 NULL, HFILL }
1420 #endif
1421 { &hf_siii_mst_channel,
1422 { "Channel", "siii.channel",
1423 FT_UINT8, BASE_DEC, VALS(siii_mst_channel_text), 0x80,
1424 NULL, HFILL }
1426 { &hf_siii_mst_type,
1427 { "Telegram Type" , "siii.type",
1428 FT_UINT8, BASE_DEC, VALS(siii_mst_type_text), 0x40,
1429 NULL, HFILL }
1431 { &hf_siii_mst_cyclecntvalid,
1432 { "Cycle Count Valid", "siii.cyclecntvalid",
1433 FT_UINT8, BASE_DEC, VALS(siii_mst_cyclecntvalid_text), 0x20,
1434 NULL, HFILL }
1436 { &hf_siii_mst_telno,
1437 { "Telegram Number", "siii.telno",
1438 FT_UINT8, BASE_DEC, NULL, 0x0F,
1439 NULL, HFILL }
1441 { &hf_siii_mst_phase,
1442 { "Phase", "siii.mst.phase",
1443 FT_UINT8, BASE_HEX, VALS(siii_mst_phase_text), 0x8F, /* CHANGED: SB: new value is 0x8F for masking out phase */
1444 NULL, HFILL }
1446 { &hf_siii_mst_cyclecnt,
1447 { "Cycle Cnt", "siii.mst.cyclecnt",
1448 FT_UINT8, BASE_DEC, NULL, 0x70, /* CHANGED: SB: new value is 0x70 for masking out cycle cnt */
1449 NULL, HFILL }
1451 { &hf_siii_mst_crc32,
1452 { "CRC32", "siii.mst.crc32",
1453 FT_UINT32, BASE_HEX, NULL, 0,
1454 NULL, HFILL }
1457 { &hf_siii_mdt_hotplug_address,
1458 {"Sercos address", "siii.mdt.hp.sercosaddress",
1459 FT_UINT16, BASE_HEX, NULL, 0,
1460 NULL, HFILL }
1462 { &hf_siii_mdt_hp_ctrl,
1463 {"HP control", "siii.mdt.hp.ctrl",
1464 FT_UINT16, BASE_HEX, NULL, 0,
1465 NULL, HFILL }
1467 { &hf_siii_mdt_hp_info,
1468 {"HP info", "siii.mdt.hp.info",
1469 FT_BYTES, BASE_NONE, NULL, 0,
1470 NULL, HFILL }
1472 { &hf_siii_at_hotplug_address,
1473 {"Sercos address", "siii.at.hp.sercosaddress",
1474 FT_UINT16, BASE_HEX, NULL, 0,
1475 NULL, HFILL }
1477 { &hf_siii_at_hp_stat,
1478 {"HP status", "siii.mdt.hp.stat",
1479 FT_UINT16, BASE_HEX, NULL, 0,
1480 NULL, HFILL }
1482 { &hf_siii_at_hp_info,
1483 {"HP info", "siii.at.hp.info",
1484 FT_BYTES, BASE_NONE, NULL, 0,
1485 NULL, HFILL }
1487 { &hf_siii_mdt_hotplug_control_param,
1488 {"Parameter", "siii.mdt.hp.parameter",
1489 FT_UINT16, BASE_DEC, VALS(siii_mdt_hotplug_control_functioncode_text), 0xFF,
1490 NULL, HFILL }
1492 { &hf_siii_mdt_hotplug_control_svc_switch,
1493 {"Switch to SVC", "siii.mdt.hp.switch",
1494 FT_UINT16, BASE_DEC, VALS(siii_mdt_hotplug_control_svc_switch_text), 0x100,
1495 NULL, HFILL }
1498 { &hf_siii_at_hotplug_status_param,
1499 {"Parameter Received", "siii.at.hp.parameter",
1500 FT_UINT16, BASE_DEC, VALS(siii_mdt_hotplug_status_ackcode_text), 0xFF,
1501 NULL, HFILL }
1503 { &hf_siii_at_hotplug_status_hp0_finished,
1504 {"HP/SVC", "siii.at.hp.hp0_finished",
1505 FT_UINT16, BASE_DEC, NULL, 0x100,
1506 NULL, HFILL }
1508 { &hf_siii_at_hotplug_status_error,
1509 {"Error", "siii.at.hp.error",
1510 FT_UINT16, BASE_DEC, VALS(siii_at_hotplug_status_error_text), 0x200,
1511 NULL, HFILL }
1515 /* Setup protocol subtree array */
1516 static gint *ett[] = {
1517 &ett_siii,
1518 &ett_siii_header,
1520 &ett_siii_mdt,
1521 &ett_siii_mdt_version,
1522 &ett_siii_mdt_svc,
1523 &ett_siii_mdt_devctrls,
1524 &ett_siii_mdt_svc_channel,
1525 &ett_siii_mdt_dev_control,
1527 &ett_siii_at,
1528 &ett_siii_at_svc,
1529 &ett_siii_at_devstats,
1530 &ett_siii_at_svc_channel,
1531 &ett_siii_at_dev_status,
1533 &ett_siii_mdt_devctrl,
1534 &ett_siii_at_devstatus,
1536 &ett_siii_mdt_svcctrl,
1537 &ett_siii_mdt_svcinfo,
1538 &ett_siii_at_svcstat,
1539 &ett_siii_at_svcinfo,
1540 &ett_siii_mdt_svch_data_error_info,
1541 &ett_siii_mdt_svch_data,
1543 &ett_siii_mst,
1544 &ett_siii_mst_teltype,
1545 &ett_siii_mst_phase,
1547 &ett_siii_mdt_hp,
1548 &ett_siii_at_hp,
1549 &ett_siii_mdt_hp_ctrl,
1550 &ett_siii_mdt_hp_info,
1551 &ett_siii_at_hp_stat,
1552 &ett_siii_at_hp_info
1556 /* Register the protocol name and description */
1557 proto_siii = proto_register_protocol("SERCOS III V1.1",
1558 "SERCOS III V1.1", "siii");
1560 register_dissector("sercosiii", dissect_siii, proto_siii);
1562 /* subdissector code */
1563 register_heur_dissector_list("sercosiii", &heur_subdissector_list);
1565 /* Required function calls to register the header fields and subtrees used */
1566 proto_register_field_array(proto_siii, hf, array_length(hf));
1567 proto_register_subtree_array(ett, array_length(ett));
1570 void
1571 proto_reg_handoff_sercosiii(void)
1573 dissector_handle_t siii_handle;
1575 siii_handle = create_dissector_handle(dissect_siii, proto_siii);
1576 dissector_add_uint("ethertype", ETHERTYPE_SERCOS, siii_handle);