1 | /*-----------------------------------------------------------------------------
|
---|
2 | mitop.h -- Top side (Host) of messaging interface to VMOD-ICAN
|
---|
3 |
|
---|
4 | Copyright (c) 1994 JANZ Computer AG
|
---|
5 | All Rights Reserved
|
---|
6 |
|
---|
7 | Created 95/06/16 by Soenke Hansen
|
---|
8 | Version 1.40 of 00/03/29
|
---|
9 |
|
---|
10 | Functions to fill messages which can be sent to VMOD-ICAN.
|
---|
11 | Functions to format the contents of messages for printing.
|
---|
12 |
|
---|
13 | The relevance of messages depends on the firmware on VMOD-ICAN.
|
---|
14 | The firmware discards messages which it does not understand.
|
---|
15 | Through preprocessor directives the set of messaging interface
|
---|
16 | functions are adapted to the firmware.
|
---|
17 |
|
---|
18 | This file contains prototype declarations for functions in mitop.c.
|
---|
19 |
|
---|
20 | -----------------------------------------------------------------------------*/
|
---|
21 |
|
---|
22 |
|
---|
23 | #ifndef mitop_DEFINED
|
---|
24 | #define mitop_DEFINED
|
---|
25 |
|
---|
26 | #ifdef __cplusplus
|
---|
27 | extern "C" {
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #include "defs.h"
|
---|
31 | #include "dpm.h"
|
---|
32 |
|
---|
33 | /* Classes of messages. */
|
---|
34 | #define MITOP_MGR 0x0001 /* module management */
|
---|
35 | #define MITOP_ICANOS 0x0002 /* raw CAN access, SW CAN filtering, timers */
|
---|
36 | #define MITOP_CAL 0x0004 /* CAL */
|
---|
37 |
|
---|
38 | #define MITOP (MITOP_CAL + MITOP_MGR + MITOP_ICANOS)
|
---|
39 | /* Adapt the mesaging interface to the firmware capabilities.
|
---|
40 | The default is ICANOS and VMOD-ICAN management. */
|
---|
41 | #ifndef MITOP
|
---|
42 | #define MITOP (MITOP_MGR + MITOP_ICANOS)
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | /* Formatting functions are implemented if and only if
|
---|
46 | MITOP_FORMAT is defined. */
|
---|
47 | #define MITOP_FORMAT
|
---|
48 |
|
---|
49 |
|
---|
50 | #if MITOP & MITOP_MGR
|
---|
51 |
|
---|
52 | /* Request identity and version from module */
|
---|
53 | extern void IdVersReq(Message *);
|
---|
54 | extern void IdVersSniffReq(Message *);
|
---|
55 |
|
---|
56 | /* Request free memory size */
|
---|
57 | extern void CheckFreeMem(Message *, int);
|
---|
58 |
|
---|
59 | /* Request host interface style */
|
---|
60 | extern void InquiryHostInterface(Message *);
|
---|
61 |
|
---|
62 | /* Request CANbus bit rate, HW acceptance code/mask and termination state */
|
---|
63 | extern void InquiryCANBitRateMasksTerm(Message *);
|
---|
64 |
|
---|
65 | /* Request CAN controllers / modules status */
|
---|
66 | extern void InquiryStatus(Message *);
|
---|
67 | extern void InquiryStatusSniff(Message *);
|
---|
68 | extern void InquiryControllerStatusSniff(Message *m);
|
---|
69 |
|
---|
70 | /* Request setting of software acceptance filter */
|
---|
71 | extern void InquiryAcceptanceFilter(Message *, WORD_t);
|
---|
72 |
|
---|
73 | #if MITOP & MITOP_CAL
|
---|
74 |
|
---|
75 | /* Install CAL master on module. By default the module implements
|
---|
76 | only CAL slave functionality. */
|
---|
77 | extern void InstallCalMaster(Message *);
|
---|
78 |
|
---|
79 | /* Some host-guarding stuff */
|
---|
80 | void InitHostGuarding(Message *, int, BYTE_t);
|
---|
81 | void HostIsAlive(Message *);
|
---|
82 |
|
---|
83 | #endif
|
---|
84 |
|
---|
85 |
|
---|
86 | void SwitchCanTermination(Message *, WORD_t);
|
---|
87 | void SwitchSYSClkTermination(Message *, WORD_t);
|
---|
88 |
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #if MITOP & MITOP_ICANOS
|
---|
92 |
|
---|
93 | /* format sja1000 error-code-capture to readable form. */
|
---|
94 | int sprintf_sja1000_ec(
|
---|
95 | char *dest, /* destination for description */
|
---|
96 | int ec, /* error code to format */
|
---|
97 | int n ); /* max length of description */
|
---|
98 |
|
---|
99 | /* Start periodical clock interrupt generation. */
|
---|
100 | extern void IcStartTimer(
|
---|
101 | Message *, /* message buffer */
|
---|
102 | WORD_t ); /* max. clock period in 100 usec units */
|
---|
103 |
|
---|
104 | /* Stop periodical clock interrupt generation. */
|
---|
105 | extern void IcStopTimer(
|
---|
106 | Message *); /* message buffer */
|
---|
107 |
|
---|
108 | /* Unset a user-defined timer. */
|
---|
109 | extern void IcClearTimer(
|
---|
110 | Message *, /* message buffer */
|
---|
111 | WORD_t ); /* timer Id as confirmed on set timer req. */
|
---|
112 |
|
---|
113 | /* Set a timer. The alarm time "tleft" is in units of 100 usecs. */
|
---|
114 | extern void IcSetTimer(
|
---|
115 | Message *, /* message buffer */
|
---|
116 | WORD_t , /* user request Id */
|
---|
117 | WORD_t ); /* time left until alarm */
|
---|
118 |
|
---|
119 | /* Issue request to send a CAN message. */
|
---|
120 | extern void IcSendReqBCAN(
|
---|
121 | Message *, /* message buffer */
|
---|
122 | int , /* pos. confirm. or echo required? */
|
---|
123 | WORD_t , /* application request Id */
|
---|
124 | WORD_t , /* CAN descriptor (id,rtr,dlc) */
|
---|
125 | const BYTE_t *); /* data bytes to transmit */
|
---|
126 |
|
---|
127 | /* Abort transmit request. */
|
---|
128 | extern void IcSendAbortBCAN(
|
---|
129 | Message *); /* message buffer */
|
---|
130 |
|
---|
131 | /* Switch CAN controller bus-on. */
|
---|
132 | extern void IcBusOnBCAN(
|
---|
133 | Message *); /* message buffer */
|
---|
134 |
|
---|
135 | /* Switch CAN controller bus-off. */
|
---|
136 | extern void IcBusOffBCAN(
|
---|
137 | Message *); /* message buffer */
|
---|
138 |
|
---|
139 | /* Set bit timing parameters in CAN controller. */
|
---|
140 | extern void IcWriteBtrBCAN(
|
---|
141 | Message *, /* message buffer */
|
---|
142 | WORD_t ); /* BTR0 and BTR1 */
|
---|
143 |
|
---|
144 | /* Set error-warining limit in CAN controller. */
|
---|
145 | void IcWriteEwlBCAN(
|
---|
146 | Message *m, /* message buffer */
|
---|
147 | BYTE_t ewl ); /* Error warning limit to set */
|
---|
148 |
|
---|
149 | /* Enable bus-error reporting. */
|
---|
150 | void IcSwitchBerrBCAN(
|
---|
151 | Message *m, /* message buffer */
|
---|
152 | BYTE_t state ); /* 0: disabled, 1: enabled */
|
---|
153 |
|
---|
154 | /* Configure self test mode */
|
---|
155 | void IcSwitchStmBCAN(
|
---|
156 | Message *m, /* message buffer */
|
---|
157 | BYTE_t state ); /* 0: disabled, 1: enabled */
|
---|
158 |
|
---|
159 | /* Configure listen-only mode */
|
---|
160 | void IcSwitchLomBCAN(
|
---|
161 | Message *m, /* message buffer */
|
---|
162 | BYTE_t state ); /* 0: disabled, 1: enabled */
|
---|
163 |
|
---|
164 | /* Set hardware acceptance filter in CAN controller. */
|
---|
165 | extern void IcWriteAcmBCAN(
|
---|
166 | Message *, /* message buffer */
|
---|
167 | WORD_t ); /* acceptance code and mask */
|
---|
168 |
|
---|
169 | /* Set extended hardware acceptance filter in CAN controller. */
|
---|
170 | void IcWriteExtAcmBCAN(
|
---|
171 | Message *m, /* message buffer */
|
---|
172 | int mode, /* 0: dual-, 1: single-filter-mode */
|
---|
173 | LWORD_t ac, /* acceptance code */
|
---|
174 | LWORD_t am ); /* acceptance mask */
|
---|
175 |
|
---|
176 | /* Change software acceptance filter: accept all CAN messages
|
---|
177 | with given Id. */
|
---|
178 | extern void IcOpenAfil(
|
---|
179 | Message *, /* message buffer */
|
---|
180 | WORD_t ); /* this Id passes the filter */
|
---|
181 |
|
---|
182 | /* Change software acceptance filter: reject all CAN messages
|
---|
183 | with given Id. */
|
---|
184 | extern void IcCloseAfil(
|
---|
185 | Message *, /* message buffer */
|
---|
186 | WORD_t ); /* messages with this Id are rejected */
|
---|
187 |
|
---|
188 | /* Change software acceptance filter: accept all CAN messages
|
---|
189 | with IDs in specified range. */
|
---|
190 | extern void IcRangeOpenAfil(
|
---|
191 | Message *, /* message buffer */
|
---|
192 | WORD_t , /* lower bound of Id range */
|
---|
193 | WORD_t ); /* upper bound of Id range */
|
---|
194 |
|
---|
195 | /* Change software acceptance filter: reject all CAN messages
|
---|
196 | with IDs in specified range. */
|
---|
197 | extern void IcRangeCloseAfil(
|
---|
198 | Message *, /* message buffer */
|
---|
199 | WORD_t , /* lower bound of Id range */
|
---|
200 | WORD_t ); /* upper bound of Id range */
|
---|
201 |
|
---|
202 | /* Set software acceptance filter mask. */
|
---|
203 | void IcSetAfil(
|
---|
204 | Message *m, /* message buffer */
|
---|
205 | WORD_t id, /* this Ids filter is set ... */
|
---|
206 | WORD_t mask /* ... to this value. */
|
---|
207 | );
|
---|
208 |
|
---|
209 | /* Set software acceptance filter mask for a range of Ids. */
|
---|
210 | void IcRangeSetAfil(
|
---|
211 | Message *m, /* message buffer */
|
---|
212 | WORD_t idl, /* this Ids filter is set ... */
|
---|
213 | WORD_t idh, /* this Ids filter is set ... */
|
---|
214 | WORD_t mask /* ... to this value. */
|
---|
215 | );
|
---|
216 |
|
---|
217 | void IcCreateCycSendList(
|
---|
218 | Message *m, /* message buffer */
|
---|
219 | WORD_t cyctim /* cycle-time to send data */
|
---|
220 | );
|
---|
221 |
|
---|
222 | void IcDeleteCycSendList(
|
---|
223 | Message *m, /* message buffer */
|
---|
224 | BYTE_t listNo /* number of list to delete */
|
---|
225 | );
|
---|
226 |
|
---|
227 | void IcAddMsgToCycSendList(
|
---|
228 | Message *m, /* message buffer */
|
---|
229 | BYTE_t listId, /* list number where the message should */
|
---|
230 | /* be added to */
|
---|
231 | WORD_t id, /* CANbus id */
|
---|
232 | BYTE_t len, /* CANbus message length */
|
---|
233 | BYTE_t rtr, /* rtr bit [0,1] */
|
---|
234 | BYTE_t *data /* pointer to data */
|
---|
235 | );
|
---|
236 |
|
---|
237 | /* Set priority boundaries. */
|
---|
238 | void IcSetPrioBnd(
|
---|
239 | Message *m, /* message buffer */
|
---|
240 | WORD_t hi_mid_boundary, /* boundary between hi and mid prior. */
|
---|
241 | WORD_t mid_low_boundary /* boundary between mid and low prior.*/
|
---|
242 | );
|
---|
243 |
|
---|
244 |
|
---|
245 | /* Set host endianess. */
|
---|
246 | void SetHostEndianess(
|
---|
247 | Message *m, /* message buffer */
|
---|
248 | BYTE_t endianess /* endianess */
|
---|
249 | );
|
---|
250 |
|
---|
251 | /* Init bulk buffer with timeout only */
|
---|
252 | void InitBulkBufferTimeout(
|
---|
253 | Message *m, /* message buffer */
|
---|
254 | WORD_t timeout /* time after bulk buffer message will be sent */
|
---|
255 | );
|
---|
256 |
|
---|
257 | /* Init bulk buffer with timeout and sizes */
|
---|
258 | void InitBulkBuffer(
|
---|
259 | Message *m, /* message buffer */
|
---|
260 | WORD_t timeout, /* time after bulk buffer message will be sent */
|
---|
261 | BYTE_t maxMsgInBulkMsg, /* max. number of bulk msgs. in one bulk message */
|
---|
262 | BYTE_t maxBulkMsgPreAlloc /* max. number of preallocated bulk messages */
|
---|
263 | );
|
---|
264 |
|
---|
265 | /* Init sniff buffer */
|
---|
266 | void InitSniffBufferTimeout(
|
---|
267 | Message *m, /* message buffer */
|
---|
268 | WORD_t timeout /* time after sniff buffer message will be sent */
|
---|
269 | );
|
---|
270 | void InitSniffBuffer(
|
---|
271 | Message *m, /* message buffer */
|
---|
272 | WORD_t timeout, /* time after bulk buffer message will be sent */
|
---|
273 | BYTE_t maxByteInSniffMsg, /* max. number of msg.-bytes in one sniff message */
|
---|
274 | BYTE_t maxSniffMsgPreAlloc /* max. number of preallocated sniff messages */
|
---|
275 | );
|
---|
276 |
|
---|
277 | /* Config sniff buffer */
|
---|
278 | void ConfigSniffBufferEcho(
|
---|
279 | Message *m, /* message buffer */
|
---|
280 | WORD_t echoFromQueue /* specifies the queues, a sent message should be echoed from */
|
---|
281 | );
|
---|
282 |
|
---|
283 | void ConfigSniffBufferAfilStd(
|
---|
284 | Message *m, /* message buffer */
|
---|
285 | WORD_t idl, /* lower bound of Id range */
|
---|
286 | WORD_t idh, /* upper bound of Id range */
|
---|
287 | BYTE_t mask /* filter mask to use ([0..1] */
|
---|
288 | );
|
---|
289 |
|
---|
290 | void ConfigSniffBufferAfilXtd(
|
---|
291 | Message *m, /* message buffer */
|
---|
292 | WORD_t idl, /* lower bound of Id range (13 MSB!) */
|
---|
293 | WORD_t idh, /* upper bound of Id range (13 MSB!) */
|
---|
294 | BYTE_t mask /* filter mask to use ([0..1] */
|
---|
295 | );
|
---|
296 |
|
---|
297 | void InitBusLoadStatistic(
|
---|
298 | Message *m, /* message buffer */
|
---|
299 | WORD_t intTime, /* integration time (in times of 10 ms) */
|
---|
300 | BYTE_t flags /* some flags */
|
---|
301 | );
|
---|
302 |
|
---|
303 | void InitSniffBusLoadStatistic(
|
---|
304 | Message *m, /* message buffer */
|
---|
305 | WORD_t intTime, /* integration time (in times of 10 ms) */
|
---|
306 | BYTE_t flags /* some flags */
|
---|
307 | );
|
---|
308 |
|
---|
309 | void RequestBusLoadStatistic(
|
---|
310 | Message *m, /* message buffer */
|
---|
311 | BYTE_t choice /* choose the kind of statistics */
|
---|
312 | );
|
---|
313 |
|
---|
314 | #endif /* MITOP & MITOP_ICANOS */
|
---|
315 |
|
---|
316 |
|
---|
317 | #if MITOP & MITOP_CAL
|
---|
318 |
|
---|
319 | /* Create Node request */
|
---|
320 | extern void NsCreateNodeReq(
|
---|
321 | Message *, /* message buffer */
|
---|
322 | int, /* module Id */
|
---|
323 | const char *, /* module name string (strlen==7) */
|
---|
324 | int); /* CAL node class */
|
---|
325 |
|
---|
326 | /* Create Node request */
|
---|
327 | extern void NsCreateCOPNodeReq(
|
---|
328 | Message *, /* message buffer */
|
---|
329 | int, /* module Id */
|
---|
330 | const char *, /* module name string (strlen==7) */
|
---|
331 | int); /* CAL node class */
|
---|
332 |
|
---|
333 | /* Config NMT of CANopen slave node request */
|
---|
334 | extern void NsConfigCOPNodeReq(
|
---|
335 | Message *m, /* message buffer */
|
---|
336 | WORD_t guard_time, /* guard time in ms */
|
---|
337 | int life_fac, /* life time factor */
|
---|
338 | int guard_start); /* timepoint of guarding start */
|
---|
339 |
|
---|
340 | /* Config CAL NMT slave node request */
|
---|
341 | extern void NsConfigNodeReq(
|
---|
342 | Message *m, /* message buffer */
|
---|
343 | WORD_t mux, /* multiplexor */
|
---|
344 | WORD_t flags); /* flags */
|
---|
345 |
|
---|
346 | /* Configuration download acknowledge response */
|
---|
347 | extern void NsConfigAck(
|
---|
348 | Message *m); /* message buffer */
|
---|
349 |
|
---|
350 | /* NMT slave configuration transfer abort request */
|
---|
351 | extern void NsConfigAbort(
|
---|
352 | Message *m, /* message buffer */
|
---|
353 | int failureReason, /* failure reason */
|
---|
354 | int applSpecificReason); /* appl. specific failure reason */
|
---|
355 |
|
---|
356 | /* NMT slave configuration transfer verify response */
|
---|
357 | extern void NsConfigVerify(
|
---|
358 | Message *m, /* message buffer */
|
---|
359 | int verificationResult, /* result of verification */
|
---|
360 | int reason); /* failure reason */
|
---|
361 |
|
---|
362 | /* Delete Node request */
|
---|
363 | extern void NsDeleteNodeReq(
|
---|
364 | Message *); /* message buffer */
|
---|
365 |
|
---|
366 | /* Identify Node request */
|
---|
367 | extern void NsIdentifyNodeReq(
|
---|
368 | Message *); /* message buffer */
|
---|
369 |
|
---|
370 | /* Connect Node request */
|
---|
371 | extern void NsConnectNodeReq(
|
---|
372 | Message *, /* message buffer */
|
---|
373 | int , /* download requested? */
|
---|
374 | WORD_t , /* guard time in ms */
|
---|
375 | int ); /* life time factor */
|
---|
376 |
|
---|
377 | /* Disconnect Node request */
|
---|
378 | extern void NsDisconnectNodeReq(
|
---|
379 | Message *); /* message buffer */
|
---|
380 |
|
---|
381 | /* Prepare Remote Node Response */
|
---|
382 | extern void NsPrepareRemoteNodeRes(
|
---|
383 | Message *, /* message buffer */
|
---|
384 | int ); /* 0 or error code of CAL protocol */
|
---|
385 |
|
---|
386 | /* Delete User Definition request */
|
---|
387 | extern void DsDeleteUserDefReq(
|
---|
388 | Message *, /* message buffer */
|
---|
389 | int ); /* node Id */
|
---|
390 |
|
---|
391 | /* Create all User Definitions request:
|
---|
392 | Initiate the Create User Definition service for the COB's
|
---|
393 | used by by the currently defined CMS objects. */
|
---|
394 | extern void DsCreateAllUserDefReq(
|
---|
395 | Message *); /* message buffer */
|
---|
396 |
|
---|
397 | /* Get Checksum request */
|
---|
398 | extern void DsGetChecksumReq(
|
---|
399 | Message *, /* message buffer */
|
---|
400 | int ); /* node Id */
|
---|
401 |
|
---|
402 | /* Delete User Definition request */
|
---|
403 | extern void DsVerifyCobClassReq(
|
---|
404 | Message *); /* message buffer */
|
---|
405 |
|
---|
406 | /* Set Bit Timing and Attach CAN controller to CAN bus */
|
---|
407 | extern void LsBusOnReq(
|
---|
408 | Message *, /* message buffer */
|
---|
409 | WORD_t ); /* Bit timing parameters */
|
---|
410 |
|
---|
411 | /* Detach CAN controller from CAN bus */
|
---|
412 | extern void LsBusOffReq(
|
---|
413 | Message *); /* message buffer */
|
---|
414 |
|
---|
415 | /* Control bus error generation */
|
---|
416 | void LsSwitchBerrReq(
|
---|
417 | Message *m, /* message buffer */
|
---|
418 | BYTE_t state ); /* 0: disabled, 1: enabled */
|
---|
419 |
|
---|
420 | /* Set Error warning limit threshold */
|
---|
421 | void LsSetEwlReq(
|
---|
422 | Message *m, /* message buffer */
|
---|
423 | BYTE_t ewl ); /* Error warning limit to set */
|
---|
424 |
|
---|
425 | /* Control self-test mode */
|
---|
426 | void LsSwitchStmReq(
|
---|
427 | Message *m, /* message buffer */
|
---|
428 | BYTE_t state ); /* 0: disabled, 1: enabled */
|
---|
429 |
|
---|
430 | /* Control listen-only mode */
|
---|
431 | void LsSwitchLomReq(
|
---|
432 | Message *m, /* message buffer */
|
---|
433 | BYTE_t state ); /* 0: disabled, 1: enabled */
|
---|
434 |
|
---|
435 | /* Add Remote Node request */
|
---|
436 | extern void NmAddRemoteNodeReq(
|
---|
437 | Message *, /* message buffer */
|
---|
438 | int, /* module Id */
|
---|
439 | const char *); /* module name string (strlen==7) */
|
---|
440 |
|
---|
441 | /* Add Remote CANopen Node request */
|
---|
442 | extern void NmAddRemoteCOPNodeReq(
|
---|
443 | Message *, /* message buffer */
|
---|
444 | int, /* module Id */
|
---|
445 | const char *, /* module name string (strlen==7) */
|
---|
446 | WORD_t, /* default guard time */
|
---|
447 | int ); /* default node class */
|
---|
448 |
|
---|
449 | /* Add Remote CANopen Node request with user given guarding IDs */
|
---|
450 | extern void NmAddRemoteCOPNodeGidReq(
|
---|
451 | Message *, /* message buffer */
|
---|
452 | int, /* module Id */
|
---|
453 | const char *, /* module name string (strlen==7) */
|
---|
454 | WORD_t, /* default guard time */
|
---|
455 | int, /* default node class */
|
---|
456 | WORD_t); /* user given guarding ID */
|
---|
457 |
|
---|
458 | /* Remove Remote Node request */
|
---|
459 | extern void NmRemoveRemoteNodeReq(
|
---|
460 | Message *, /* message buffer */
|
---|
461 | int , /* module Id */
|
---|
462 | const char *); /* module name string (strlen==7) */
|
---|
463 |
|
---|
464 | /* Connect Remote Node request */
|
---|
465 | extern void NmConnectRemoteNodeReq(
|
---|
466 | Message *, /* message buffer */
|
---|
467 | int , /* module Id */
|
---|
468 | const char *); /* module name string (strlen==7) */
|
---|
469 |
|
---|
470 | /* Prepare Remote Node request */
|
---|
471 | extern void NmPrepareRemoteNodeReq(
|
---|
472 | Message *, /* message buffer */
|
---|
473 | int ); /* node Id */
|
---|
474 |
|
---|
475 | /* Start Remote Node request */
|
---|
476 | extern void NmStartRemoteNodeReq(
|
---|
477 | Message *, /* message buffer */
|
---|
478 | int ); /* node Id */
|
---|
479 |
|
---|
480 | /* Stop Remote Node request */
|
---|
481 | extern void NmStopRemoteNodeReq(
|
---|
482 | Message *, /* message buffer */
|
---|
483 | int ); /* node Id */
|
---|
484 |
|
---|
485 | /* Disconnect Remote Node request */
|
---|
486 | extern void NmDisconnectRemoteNodeReq(
|
---|
487 | Message *, /* message buffer */
|
---|
488 | int ); /* node Id */
|
---|
489 |
|
---|
490 | /* Enter preoperational state request */
|
---|
491 | extern void NmEnterPreOperationalStateReq(
|
---|
492 | Message *, /* message buffer */
|
---|
493 | int ); /* node Id */
|
---|
494 |
|
---|
495 | /* Reset node request */
|
---|
496 | extern void NmResetNodeReq(
|
---|
497 | Message *, /* message buffer */
|
---|
498 | int ); /* node Id */
|
---|
499 |
|
---|
500 | void NmStartGuardRemoteCOPNodeReq(
|
---|
501 | Message *, /* message buffer */
|
---|
502 | int ); /* node Id */
|
---|
503 |
|
---|
504 | /* Reset communication request */
|
---|
505 | extern void NmResetCommunicationReq(
|
---|
506 | Message *, /* message buffer */
|
---|
507 | int ); /* node Id */
|
---|
508 |
|
---|
509 | /* Identify Remote Nodes request */
|
---|
510 | extern void NmIdentifyRemoteNodesReq(
|
---|
511 | Message *, /* message buffer */
|
---|
512 | int , /* min. node Id in range */
|
---|
513 | int ); /* max. node Id in range */
|
---|
514 |
|
---|
515 | /* Get NMT Remote Nodes request */
|
---|
516 | extern void NmGetRemNodes(
|
---|
517 | Message *, /* message buffer */
|
---|
518 | int ); /* node Id (0 to get all) */
|
---|
519 |
|
---|
520 | /* Configure NMT master behaviour */
|
---|
521 | extern void NmConfig(
|
---|
522 | Message *m, /* message buffer */
|
---|
523 | WORD_t timeout, /* service timeout (in milliseconds) */
|
---|
524 | WORD_t gt, /* guard time (in milliseconds) */
|
---|
525 | int lf, /* life time factor */
|
---|
526 | WORD_t flags /* configuration flags */
|
---|
527 | );
|
---|
528 |
|
---|
529 |
|
---|
530 | /* Start Nmt configuration download request */
|
---|
531 | extern void NmConfigDownloadStartReq(
|
---|
532 | Message *m, /* message buffer */
|
---|
533 | int nid, /* node ID of slave node to dwonload to */
|
---|
534 | int size, /* size of whole configuration data chunk */
|
---|
535 | int dblk, /* size of configuration data in this message */
|
---|
536 | int more, /* set to one if other datablocks will follow */
|
---|
537 | const void *data /* data block */
|
---|
538 | );
|
---|
539 |
|
---|
540 | /* Start subsequesnt Nmt configuration download continue response */
|
---|
541 | extern void NmConfigDownloadContRes(
|
---|
542 | Message *m, /* message buffer */
|
---|
543 | int nid, /* node ID of slave node to dwonload to */
|
---|
544 | int dblk, /* size of configuration data in this message */
|
---|
545 | int more, /* set to one if other datablocks will follow */
|
---|
546 | const void *data /* data block */
|
---|
547 | );
|
---|
548 |
|
---|
549 | /* NMT master configuration transfer abort request */
|
---|
550 | extern void NmConfigAbort(
|
---|
551 | Message *m, /* message buffer */
|
---|
552 | int nid, /* node id of peer node */
|
---|
553 | int failureReason, /* failure reason */
|
---|
554 | int applSpecificReason); /* appl. specific failure reason */
|
---|
555 |
|
---|
556 | extern void NmConfigVerify(
|
---|
557 | Message *m, /* message buffer */
|
---|
558 | int nid, /* remote node of interest */
|
---|
559 | int checksum); /* checksum */
|
---|
560 |
|
---|
561 | /* Create COB Definition request */
|
---|
562 | extern void DmCreateCobDefReq(
|
---|
563 | Message *, /* message buffer */
|
---|
564 | WORD_t , /* low COB-ID */
|
---|
565 | WORD_t , /* high COB-ID */
|
---|
566 | int ); /* min. inhibit time */
|
---|
567 |
|
---|
568 | /* Delete COB Definition request */
|
---|
569 | extern void DmDeleteCobDefReq(
|
---|
570 | Message *, /* message buffer */
|
---|
571 | WORD_t , /* low COB-ID */
|
---|
572 | WORD_t ); /* high COB-ID */
|
---|
573 |
|
---|
574 | /* Create Predefinition request */
|
---|
575 | extern void DmCreatePreDefReq(
|
---|
576 | Message *, /* message buffer */
|
---|
577 | WORD_t, /* COB-ID */
|
---|
578 | const char *); /* COB-Name string (strlen==14) */
|
---|
579 |
|
---|
580 | /* Delete Predefinition request */
|
---|
581 | extern void DmDeletePreDefReq(
|
---|
582 | Message *, /* message buffer */
|
---|
583 | const char *); /* COB-Name string (strlen==14) */
|
---|
584 |
|
---|
585 | /* Get COB Database request */
|
---|
586 | extern void DmGetCobDbReq(
|
---|
587 | Message *); /* message buffer */
|
---|
588 |
|
---|
589 | void DmConfig(
|
---|
590 | Message *m, /* message buffer */
|
---|
591 | WORD_t timeout, /* service timeout (in milliseconds) */
|
---|
592 | WORD_t flags /* configuration flags */
|
---|
593 | );
|
---|
594 |
|
---|
595 | void CmsPatchHostId(
|
---|
596 | Message *m, /* message buffer */
|
---|
597 | WORD_t hid /* ID to be assigned to object */
|
---|
598 | );
|
---|
599 |
|
---|
600 | /* Define a Domain */
|
---|
601 | extern void CmsDomain(
|
---|
602 | Message *, /* message buffer */
|
---|
603 | const char *, /* CMS name string (strlen==13) */
|
---|
604 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
605 | int , /* muxlen ? ? */
|
---|
606 | int /* priority */
|
---|
607 | );
|
---|
608 |
|
---|
609 | /* Define a multipexed Domain */
|
---|
610 | extern void CmsMultiplexedDomain(
|
---|
611 | Message *, /* message buffer */
|
---|
612 | const char *, /* CMS name string (strlen==13) */
|
---|
613 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
614 | int , /* muxlen ? ? */
|
---|
615 | int /* priority */
|
---|
616 | );
|
---|
617 |
|
---|
618 | /* Define a multipexed Domain for CANopen SDO */
|
---|
619 | extern void CmsMultiplexedDomainSDO(
|
---|
620 | Message *, /* message buffer */
|
---|
621 | const char *, /* CMS name string (strlen==13) */
|
---|
622 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
623 | int , /* muxlen ? ? */
|
---|
624 | int , /* priority */
|
---|
625 | WORD_t, /* Tx_SDO_ID as seen by node */
|
---|
626 | WORD_t, /* Rx_SDO ID as seen by node */
|
---|
627 | BYTE_t /* dbt_cap - DBT capibility of CANopen node */
|
---|
628 | );
|
---|
629 |
|
---|
630 | /* Change a multipexed Domain's ID for CANopen SDO */
|
---|
631 | extern void CmsMultiplexedDomainChangeIdSDO(
|
---|
632 | Message *, /* message buffer */
|
---|
633 | WORD_t , /* object id */
|
---|
634 | WORD_t, /* Tx_SDO_ID as seen by node */
|
---|
635 | WORD_t /* Rx_SDO ID as seen by node */
|
---|
636 | );
|
---|
637 |
|
---|
638 | /* Define a Basic Variable */
|
---|
639 | extern void CmsBasicVariable(
|
---|
640 | Message *, /* message buffer */
|
---|
641 | const char *, /* CMS name string (strlen==13) */
|
---|
642 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
643 | WORD_t , /* CMS_READ_ONLY,... (see: cms.h) */
|
---|
644 | int , /* length of data type */
|
---|
645 | int ); /* priority */
|
---|
646 |
|
---|
647 | /* Define a Basic Variable with predefined CobId */
|
---|
648 | extern void CmsBasicVariablePredefCobId(
|
---|
649 | Message *, /* message buffer */
|
---|
650 | const char *, /* CMS name string (strlen==13) */
|
---|
651 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
652 | WORD_t , /* CMS_READ_ONLY,... (see: cms.h) */
|
---|
653 | int , /* length of data type */
|
---|
654 | int , /* priority */
|
---|
655 | WORD_t ,
|
---|
656 | WORD_t ,
|
---|
657 | BYTE_t );
|
---|
658 |
|
---|
659 | /* Define a Multiplexed Variable */
|
---|
660 | extern void CmsMultiplexedVariable(
|
---|
661 | Message *, /* message buffer */
|
---|
662 | const char *, /* CMS name string (strlen==13) */
|
---|
663 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
664 | WORD_t , /* CMS_READ_ONLY,... (see: cms.h) */
|
---|
665 | int , /* length of data type */
|
---|
666 | int ); /* priority */
|
---|
667 |
|
---|
668 | /* Define an Uncontrolled Event */
|
---|
669 | extern void CmsUncontrolledEvent(
|
---|
670 | Message *, /* message buffer */
|
---|
671 | const char *, /* CMS name string (strlen==13) */
|
---|
672 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
673 | int , /* length of data type */
|
---|
674 | int ); /* priority */
|
---|
675 |
|
---|
676 | /* Define a Controlled Event */
|
---|
677 | extern void CmsControlledEvent(
|
---|
678 | Message *, /* message buffer */
|
---|
679 | const char *, /* CMS name string (strlen==13) */
|
---|
680 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
681 | int , /* length of data type */
|
---|
682 | int ); /* priority */
|
---|
683 |
|
---|
684 | /* Define a Stored Event */
|
---|
685 | extern void CmsStoredEvent(
|
---|
686 | Message *, /* message buffer */
|
---|
687 | const char *, /* CMS name string (strlen==13) */
|
---|
688 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
689 | int , /* length of data type */
|
---|
690 | int ); /* priority */
|
---|
691 |
|
---|
692 | /* Define a Stored Event with predefined CobId */
|
---|
693 | extern void CmsStoredEventPredefCobId(
|
---|
694 | Message *, /* message buffer */
|
---|
695 | const char *, /* CMS name string (strlen==13) */
|
---|
696 | WORD_t , /* CMS_CLIENT, CMS_SERVER (see: cms.h) */
|
---|
697 | int , /* length of data type */
|
---|
698 | int , /* priority */
|
---|
699 | WORD_t ,
|
---|
700 | WORD_t ,
|
---|
701 | BYTE_t );
|
---|
702 |
|
---|
703 | void ConfigDomainObject(
|
---|
704 | Message *m, /* message buffer */
|
---|
705 | WORD_t cid, /* object id */
|
---|
706 | WORD_t mux, /* multiplexor */
|
---|
707 | WORD_t flags /* parameter flags */
|
---|
708 | );
|
---|
709 |
|
---|
710 | void ConfigCmsObject(
|
---|
711 | Message *m, /* message buffer */
|
---|
712 | WORD_t cid, /* object id */
|
---|
713 | WORD_t mux, /* multiplexor */
|
---|
714 | WORD_t param /* parameter */
|
---|
715 | );
|
---|
716 |
|
---|
717 | void CmsConfig(
|
---|
718 | Message *m, /* message buffer */
|
---|
719 | WORD_t flags /* parameter flags */
|
---|
720 | );
|
---|
721 |
|
---|
722 | /* Update Variable in server of a Read-Only Variable */
|
---|
723 | extern void CmsUpdateVariable(
|
---|
724 | Message *, /* message buffer */
|
---|
725 | WORD_t , /* Id of CMS Variable */
|
---|
726 | int , /* length of data type */
|
---|
727 | const BYTE_t *); /* value matching data type */
|
---|
728 |
|
---|
729 | /* Write Variable request by client of a Basic Variable */
|
---|
730 | extern void CmsWriteVariable(
|
---|
731 | Message *, /* message buffer */
|
---|
732 | WORD_t , /* Id of CMS Variable */
|
---|
733 | int , /* length of data type */
|
---|
734 | const BYTE_t *); /* value matching data type */
|
---|
735 |
|
---|
736 | /* Read Variable request by client of a Basic Variable */
|
---|
737 | extern void CmsReadVariable(
|
---|
738 | Message *, /* message buffer */
|
---|
739 | WORD_t ); /* Id of CMS Variable */
|
---|
740 |
|
---|
741 | /* Write Multiplexed Variable request by client of a Basic Variable */
|
---|
742 | extern void CmsWriteMultiplexedVariable(
|
---|
743 | Message *, /* message buffer */
|
---|
744 | WORD_t , /* Id of CMS Variable */
|
---|
745 | int , /* length of data type */
|
---|
746 | int , /* multiplexor */
|
---|
747 | const BYTE_t *); /* value matching data type */
|
---|
748 |
|
---|
749 | /* Read Mulitplexed Variable request by client of a Basic Variable */
|
---|
750 | extern void CmsReadMultiplexedVariable(
|
---|
751 | Message *, /* message buffer */
|
---|
752 | WORD_t , /* Id of CMS Variable */
|
---|
753 | int ); /* multiplexor */
|
---|
754 |
|
---|
755 | void CmsWriteVariableRes(
|
---|
756 | Message *m, /* message buffer */
|
---|
757 | WORD_t cid, /* Id of CMS Variable */
|
---|
758 | int dlen, /* length of data type */
|
---|
759 | int stat, /* operation status */
|
---|
760 | const BYTE_t *value /* value matching data type */
|
---|
761 | );
|
---|
762 |
|
---|
763 | void CmsReadVariableRes(
|
---|
764 | Message *m, /* message buffer */
|
---|
765 | WORD_t cid, /* Id of CMS Variable */
|
---|
766 | int dlen, /* length of data type */
|
---|
767 | int stat, /* operation status */
|
---|
768 | const BYTE_t *value /* value matching data type */
|
---|
769 | );
|
---|
770 |
|
---|
771 |
|
---|
772 | /* Notify Event to clients */
|
---|
773 | extern void CmsNotifyEvent(
|
---|
774 | Message *, /* message buffer */
|
---|
775 | WORD_t , /* Id of CMS Variable */
|
---|
776 | int , /* length of data type */
|
---|
777 | const BYTE_t *); /* value matching data type */
|
---|
778 |
|
---|
779 | /* Store and Notify Eventy to clients */
|
---|
780 | extern void CmsStoreEvent(
|
---|
781 | Message *, /* message buffer */
|
---|
782 | WORD_t , /* Id of CMS Variable */
|
---|
783 | int , /* length of data type */
|
---|
784 | const BYTE_t *, /* value matching data type */
|
---|
785 | int ); /* !=0 for immediate notification */
|
---|
786 |
|
---|
787 | /* Read Event */
|
---|
788 | extern void CmsReadEvent(
|
---|
789 | Message *, /* message buffer */
|
---|
790 | WORD_t ); /* Id of CMS Variable */
|
---|
791 |
|
---|
792 | /* Set Event Control State Request */
|
---|
793 | extern void CmsSetControlEventReq(
|
---|
794 | Message *, /* message buffer */
|
---|
795 | WORD_t , /* Id of CMS Variable */
|
---|
796 | int ); /* !=0 to enable event in server */
|
---|
797 |
|
---|
798 | /* Set Event Control State Response */
|
---|
799 | extern void CmsSetControlEventRes(
|
---|
800 | Message *, /* message buffer */
|
---|
801 | WORD_t , /* Id of CMS Variable */
|
---|
802 | int , /* !=0 to indicate error */
|
---|
803 | int , /* !=0 to enable event in server */
|
---|
804 | const BYTE_t * /* reason in case of error */
|
---|
805 | );
|
---|
806 |
|
---|
807 |
|
---|
808 | extern void CmsDomDownloadStart(
|
---|
809 | Message *,
|
---|
810 | WORD_t , /* Id of CMS Domain */
|
---|
811 | int , /* option flags */
|
---|
812 | int , /* domain multiplexor */
|
---|
813 | int , /* whole data length */
|
---|
814 | int , /* data length of current message */
|
---|
815 | const void * /* data block */
|
---|
816 | );
|
---|
817 |
|
---|
818 | extern void CmsDomDownloadCont(
|
---|
819 | Message *,
|
---|
820 | WORD_t , /* Id of CMS Domain */
|
---|
821 | int , /* option flags */
|
---|
822 | int , /* data length of current message */
|
---|
823 | const void * /* data block */
|
---|
824 | );
|
---|
825 |
|
---|
826 | extern void CmsDomUploadStart(
|
---|
827 | Message *m,
|
---|
828 | WORD_t cid, /* Id of CMS Domain */
|
---|
829 | int mux /* Multiplexor type */
|
---|
830 | );
|
---|
831 |
|
---|
832 | void CmsDomUpload(
|
---|
833 | Message *m,
|
---|
834 | WORD_t cid, /* Id of CMS Domain */
|
---|
835 | int cs, /* option flags */
|
---|
836 | int size, /* whole data length */
|
---|
837 | int dblk, /* data length of current message */
|
---|
838 | const void *data /* data block */
|
---|
839 | );
|
---|
840 |
|
---|
841 | void CmsDomUploadCont(
|
---|
842 | Message *m,
|
---|
843 | WORD_t cid, /* Id of CMS Domain */
|
---|
844 | int cs, /* option flags */
|
---|
845 | int dblk, /* data length of current message */
|
---|
846 | const void *data /* data block */
|
---|
847 | );
|
---|
848 |
|
---|
849 | void CmsDomainAck(
|
---|
850 | Message *m,
|
---|
851 | WORD_t cid
|
---|
852 | );
|
---|
853 |
|
---|
854 | void CmsDomainRcptAck(
|
---|
855 | Message *m,
|
---|
856 | WORD_t cid
|
---|
857 | );
|
---|
858 |
|
---|
859 | void CmsDomAbort(
|
---|
860 | Message *m,
|
---|
861 | WORD_t cid, /* Id of CMS Domain */
|
---|
862 | const void *data /* data block pointer or zero */
|
---|
863 | );
|
---|
864 |
|
---|
865 | #endif /* MITOP & MITOP_CAL */
|
---|
866 |
|
---|
867 | #ifdef MITOP_FORMAT
|
---|
868 |
|
---|
869 | /* Format the contents of messages for display. */
|
---|
870 | #if MITOP & MITOP_MGR
|
---|
871 | extern void format_modulmgr(char *, int, const Message *);
|
---|
872 | #endif /* MITOP & MITOP_MGR */
|
---|
873 | #if MITOP & MITOP_ICANOS
|
---|
874 | extern void format_icanos(char *, int, const Message *);
|
---|
875 | #endif /* MITOP & MITOP_ICANOS */
|
---|
876 | #if MITOP & MITOP_CAL
|
---|
877 | extern void format_nmts(char *, int, const Message *);
|
---|
878 | extern void format_dbts(char *, int, const Message *);
|
---|
879 | extern void format_lmts(char *, int, const Message *);
|
---|
880 | extern void format_nmtm(char *, int, const Message *);
|
---|
881 | extern void format_dbtm(char *, int, const Message *);
|
---|
882 | extern void format_cmsdef(char *, int, const Message *);
|
---|
883 | extern void format_cmsdata(char *, int, const Message *);
|
---|
884 |
|
---|
885 | /* Formatted output */
|
---|
886 | extern void printf_cob_db(FILE *, int, const BYTE_t *);
|
---|
887 | extern void printf_nmtm(FILE *, int, const BYTE_t *);
|
---|
888 | #endif /* MITOP & MITOP_CAL */
|
---|
889 |
|
---|
890 | #endif /* MITOP_FORMAT */
|
---|
891 |
|
---|
892 |
|
---|
893 | void Cust1Init(Message *, int);
|
---|
894 | void Cust1StartTimestampPeriod(Message *, WORD_t);
|
---|
895 |
|
---|
896 | void COPStartPeriodical(Message *, BYTE_t, WORD_t);
|
---|
897 | void COPStartSingleShot(Message *, BYTE_t);
|
---|
898 | void COPMapHiResTimestamp(Message *, WORD_t);
|
---|
899 |
|
---|
900 | /*
|
---|
901 | * CANopen process picture interface
|
---|
902 | */
|
---|
903 | extern void COPDeleteAllPDOMappingEntries(Message *, WORD_t);
|
---|
904 | extern void COPAddPDOMappingEntry(Message *, WORD_t, WORD_t, BYTE_t, BYTE_t, LWORD_t);
|
---|
905 | extern void COPAddPDOLength(Message *, WORD_t, BYTE_t);
|
---|
906 | extern void COPAddPDOTransmType(Message *, WORD_t, BYTE_t);
|
---|
907 | extern void COPAddPDOInhibTime(Message *, WORD_t, WORD_t);
|
---|
908 | extern void COPControlPDO(Message *, WORD_t, BYTE_t);
|
---|
909 | extern void COPAdjustCobIdPDO(Message *, WORD_t, LWORD_t);
|
---|
910 | extern void COPSetSyncToHostSending(Message *, BYTE_t);
|
---|
911 | extern void COPTriggerTPDO(Message *, WORD_t);
|
---|
912 | extern void COPTriggerRPDO(Message *, WORD_t);
|
---|
913 |
|
---|
914 | #ifdef __cplusplus
|
---|
915 | }
|
---|
916 | #endif
|
---|
917 |
|
---|
918 | #endif /* mitop_DEFINED */
|
---|