Lely core libraries 1.9.2
nmt_srv.c
Go to the documentation of this file.
1
24#include "co.h"
25#include <lely/util/diag.h>
26#ifndef LELY_NO_CO_CSDO
27#include <lely/co/csdo.h>
28#endif
29#include <lely/co/dev.h>
30#ifndef LELY_NO_CO_EMCY
31#include <lely/co/emcy.h>
32#endif
33#ifndef LELY_NO_CO_LSS
34#include <lely/co/lss.h>
35#endif
36#ifndef LELY_NO_CO_RPDO
37#include <lely/co/rpdo.h>
38#endif
39#include <lely/co/ssdo.h>
40#ifndef LELY_NO_CO_SYNC
41#include <lely/co/sync.h>
42#endif
43#ifndef LELY_NO_CO_TIME
44#include <lely/co/time.h>
45#endif
46#ifndef LELY_NO_CO_TPDO
47#include <lely/co/tpdo.h>
48#endif
49#include "nmt_srv.h"
50
51#include <assert.h>
52#include <stdlib.h>
53
54#if !defined(LELY_NO_CO_RPDO) || !defined(LELY_NO_CO_TPDO)
56static void co_nmt_srv_init_pdo(
57 struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev);
59static void co_nmt_srv_fini_pdo(struct co_nmt_srv *srv);
60#ifndef LELY_NO_CO_RPDO
62static void co_nmt_srv_rpdo_err(co_rpdo_t *pdo, co_unsigned16_t eec,
63 co_unsigned8_t er, void *data);
64#endif
65#endif
66
68static void co_nmt_srv_init_sdo(
69 struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev);
71static void co_nmt_srv_fini_sdo(struct co_nmt_srv *srv);
72
73#ifndef LELY_NO_CO_SYNC
75static void co_nmt_srv_init_sync(
76 struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev);
78static void co_nmt_srv_fini_sync(struct co_nmt_srv *srv);
80static void co_nmt_srv_sync_ind(
81 co_sync_t *sync, co_unsigned8_t cnt, void *data);
83static void co_nmt_srv_sync_err(co_sync_t *sync, co_unsigned16_t eec,
84 co_unsigned8_t er, void *data);
85#endif
86
87#ifndef LELY_NO_CO_TIME
89static void co_nmt_srv_init_time(
90 struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev);
92static void co_nmt_srv_fini_time(struct co_nmt_srv *srv);
93#endif
94
95#ifndef LELY_NO_CO_EMCY
97static void co_nmt_srv_init_emcy(
98 struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev);
100static void co_nmt_srv_fini_emcy(struct co_nmt_srv *srv);
101#endif
102
103#ifndef LELY_NO_CO_LSS
105static void co_nmt_srv_init_lss(struct co_nmt_srv *srv, co_nmt_t *nmt);
107static void co_nmt_srv_fini_lss(struct co_nmt_srv *srv);
108#endif
109
111#define CO_NUM_PDO 512
112
114#define CO_NUM_SDO 128
115
116void
118{
119 assert(srv);
120 assert(nmt);
121
122 srv->nmt = nmt;
123
124 srv->set = 0;
125
126 srv->rpdos = NULL;
127 srv->nrpdo = 0;
128 srv->tpdos = NULL;
129 srv->ntpdo = 0;
130
131 srv->ssdos = NULL;
132 srv->nssdo = 0;
133 srv->csdos = NULL;
134 srv->ncsdo = 0;
135
136 srv->sync = NULL;
137 srv->time = NULL;
138 srv->emcy = NULL;
139
140 srv->lss = NULL;
141}
142
143void
145{
146 assert(srv);
147
148 co_nmt_srv_set(srv, NULL, 0);
149}
150
151void
152co_nmt_srv_set(struct co_nmt_srv *srv, co_nmt_t *nmt, int set)
153{
154 assert(srv);
155
156 can_net_t *net = nmt ? co_nmt_get_net(nmt) : NULL;
157 co_dev_t *dev = nmt ? co_nmt_get_dev(nmt) : NULL;
158
159#ifndef LELY_NO_CO_LSS
160 if ((srv->set & ~set) & CO_NMT_SRV_LSS)
162#endif
163#ifndef LELY_NO_CO_EMCY
164 if ((srv->set & ~set) & CO_NMT_SRV_EMCY)
166#endif
167#ifndef LELY_NO_CO_TIME
168 if ((srv->set & ~set) & CO_NMT_SRV_TIME)
170#endif
171#ifndef LELY_NO_CO_SYNC
172 if ((srv->set & ~set) & CO_NMT_SRV_SYNC)
174#endif
175 if ((srv->set & ~set) & CO_NMT_SRV_SDO)
177#if !defined(LELY_NO_CO_RPDO) || !defined(LELY_NO_CO_TPDO)
178 if ((srv->set & ~set) & CO_NMT_SRV_PDO)
180#endif
181
182#if !defined(LELY_NO_CO_RPDO) || !defined(LELY_NO_CO_TPDO)
183 if ((set & ~srv->set) & CO_NMT_SRV_PDO)
184 co_nmt_srv_init_pdo(srv, net, dev);
185#endif
186 if ((set & ~srv->set) & CO_NMT_SRV_SDO)
187 co_nmt_srv_init_sdo(srv, net, dev);
188#ifndef LELY_NO_CO_SYNC
189 if ((set & ~srv->set) & CO_NMT_SRV_SYNC)
190 co_nmt_srv_init_sync(srv, net, dev);
191#endif
192#ifndef LELY_NO_CO_TIME
193 if ((set & ~srv->set) & CO_NMT_SRV_TIME)
194 co_nmt_srv_init_time(srv, net, dev);
195#endif
196#ifndef LELY_NO_CO_EMCY
197 if ((set & ~srv->set) & CO_NMT_SRV_EMCY)
198 co_nmt_srv_init_emcy(srv, net, dev);
199#endif
200#ifdef LELY_NO_CO_LSS
201 (void)nmt;
202#else
203 if ((set & ~srv->set) & CO_NMT_SRV_LSS)
204 co_nmt_srv_init_lss(srv, nmt);
205#endif
206}
207
208#if !defined(LELY_NO_CO_RPDO) || !defined(LELY_NO_CO_TPDO)
209
210static void
212{
213 assert(srv);
214 assert(!(srv->set & CO_NMT_SRV_PDO));
215 assert(!srv->rpdos);
216 assert(!srv->nrpdo);
217 assert(!srv->tpdos);
218 assert(!srv->ntpdo);
219
220 srv->set |= CO_NMT_SRV_PDO;
221
222#ifndef LELY_NO_CO_RPDO
223 // Create the Receive-PDOs.
224 for (co_unsigned16_t i = 0; i < CO_NUM_PDO; i++) {
225 co_obj_t *obj_1400 = co_dev_find_obj(dev, 0x1400 + i);
226 co_obj_t *obj_1600 = co_dev_find_obj(dev, 0x1600 + i);
227 if (!obj_1400 || !obj_1600)
228 continue;
229
230 co_rpdo_t **rpdos =
231 realloc(srv->rpdos, (i + 1) * sizeof(*rpdos));
232 if (__unlikely(!rpdos)) {
233 set_errc(errno2c(errno));
234 goto error;
235 }
236 srv->rpdos = rpdos;
237
238 for (size_t j = srv->nrpdo; j < i; j++)
239 srv->rpdos[j] = NULL;
240 srv->rpdos[i] = co_rpdo_create(net, dev, i + 1);
241 if (__unlikely(!srv->rpdos[i]))
242 goto error;
244
245 srv->nrpdo = i + 1;
246 }
247#endif
248
249#ifndef LELY_NO_CO_TPDO
250 // Create the Transmit-PDOs.
251 for (co_unsigned16_t i = 0; i < CO_NUM_PDO; i++) {
252 co_obj_t *obj_1800 = co_dev_find_obj(dev, 0x1800 + i);
253 co_obj_t *obj_1a00 = co_dev_find_obj(dev, 0x1a00 + i);
254 if (!obj_1800 || !obj_1a00)
255 continue;
256
257 co_tpdo_t **tpdos =
258 realloc(srv->tpdos, (i + 1) * sizeof(*tpdos));
259 if (__unlikely(!tpdos)) {
260 set_errc(errno2c(errno));
261 goto error;
262 }
263 srv->tpdos = tpdos;
264
265 for (size_t j = srv->ntpdo; j < i; j++)
266 srv->tpdos[j] = NULL;
267 srv->tpdos[i] = co_tpdo_create(net, dev, i + 1);
268 if (__unlikely(!srv->tpdos[i]))
269 goto error;
270
271 srv->ntpdo = i + 1;
272 }
273#endif
274
275 return;
276
277error:
278 diag(DIAG_ERROR, get_errc(), "unable to initialize PDO services");
279}
280
281static void
283{
284 assert(srv);
285 assert(srv->set & CO_NMT_SRV_PDO);
286
287 srv->set &= ~CO_NMT_SRV_PDO;
288
289#ifndef LELY_NO_CO_TPDO
290 // Destroy the Transmit-PDOs.
291 for (size_t i = 0; i < srv->ntpdo; i++)
292 co_tpdo_destroy(srv->tpdos[i]);
293 free(srv->tpdos);
294 srv->tpdos = NULL;
295 srv->ntpdo = 0;
296#endif
297
298#ifndef LELY_NO_CO_RPDO
299 // Destroy the Receive-PDOs.
300 for (size_t i = 0; i < srv->nrpdo; i++)
301 co_rpdo_destroy(srv->rpdos[i]);
302 free(srv->rpdos);
303 srv->rpdos = NULL;
304 srv->nrpdo = 0;
305#endif
306}
307
308#ifndef LELY_NO_CO_RPDO
309static void
310co_nmt_srv_rpdo_err(co_rpdo_t *pdo, co_unsigned16_t eec, co_unsigned8_t er,
311 void *data)
312{
313 (void)pdo;
314 co_nmt_t *nmt = data;
315 assert(nmt);
316
317 co_nmt_on_err(nmt, eec, er, NULL);
318}
319#endif
320
321#endif // !LELY_NO_CO_RPDO || !LELY_NO_CO_TPDO
322
323static void
325{
326 assert(srv);
327 assert(!(srv->set & CO_NMT_SRV_SDO));
328 assert(!srv->ssdos);
329 assert(!srv->nssdo);
330 assert(!srv->csdos);
331 assert(!srv->ncsdo);
332
333 srv->set |= CO_NMT_SRV_SDO;
334
335 // Create the Server-SDOs.
336 for (co_unsigned8_t i = 0; i < CO_NUM_SDO; i++) {
337 co_obj_t *obj_1200 = co_dev_find_obj(dev, 0x1200 + i);
338 // The default Server-SDO does not have to exist in the object
339 // dictionary.
340 if (i && !obj_1200)
341 continue;
342
343 co_ssdo_t **ssdos =
344 realloc(srv->ssdos, (i + 1) * sizeof(*ssdos));
345 if (__unlikely(!ssdos)) {
346 set_errc(errno2c(errno));
347 goto error;
348 }
349 srv->ssdos = ssdos;
350
351 for (size_t j = srv->nssdo; j < i; j++)
352 srv->ssdos[j] = NULL;
353 srv->ssdos[i] = co_ssdo_create(net, dev, i + 1);
354 if (__unlikely(!srv->ssdos[i]))
355 goto error;
356
357 srv->nssdo = i + 1;
358 }
359
360#ifndef LELY_NO_CO_CSDO
361 // Create the Client-SDOs.
362 for (co_unsigned8_t i = 0; i < CO_NUM_SDO; i++) {
363 co_obj_t *obj_1280 = co_dev_find_obj(dev, 0x1280 + i);
364 if (!obj_1280)
365 continue;
366
367 co_csdo_t **csdos =
368 realloc(srv->csdos, (i + 1) * sizeof(*csdos));
369 if (__unlikely(!csdos)) {
370 set_errc(errno2c(errno));
371 goto error;
372 }
373 srv->csdos = csdos;
374
375 for (size_t j = srv->ncsdo; j < i; j++)
376 srv->csdos[j] = NULL;
377 srv->csdos[i] = co_csdo_create(net, dev, i + 1);
378 if (__unlikely(!srv->csdos[i]))
379 goto error;
380
381 srv->ncsdo = i + 1;
382 }
383#endif
384
385 return;
386
387error:
388 diag(DIAG_ERROR, get_errc(), "unable to initialize SDO services");
389}
390
391static void
393{
394 assert(srv);
395 assert(srv->set & CO_NMT_SRV_SDO);
396
397 srv->set &= ~CO_NMT_SRV_SDO;
398
399#ifndef LELY_NO_CO_CSDO
400 // Destroy the Client-SDOs.
401 for (size_t i = 0; i < srv->ncsdo; i++)
402 co_csdo_destroy(srv->csdos[i]);
403 free(srv->csdos);
404 srv->csdos = NULL;
405 srv->ncsdo = 0;
406#endif
407
408 // Destroy the Server-SDOs (skipping the default one).
409 for (size_t i = 0; i < srv->nssdo; i++)
410 co_ssdo_destroy(srv->ssdos[i]);
411 free(srv->ssdos);
412 srv->ssdos = NULL;
413 srv->nssdo = 0;
414}
415
416#ifndef LELY_NO_CO_SYNC
417
418static void
420{
421 assert(srv);
422 assert(!(srv->set & CO_NMT_SRV_SYNC));
423 assert(!srv->sync);
424
425 srv->set |= CO_NMT_SRV_SYNC;
426
427 co_obj_t *obj_1005 = co_dev_find_obj(dev, 0x1005);
428 if (!obj_1005)
429 return;
430
431 srv->sync = co_sync_create(net, dev);
432 if (__unlikely(!srv->sync)) {
434 "unable to initialize SYNC service");
435 return;
436 }
439}
440
441static void
443{
444 assert(srv);
445 assert(srv->set & CO_NMT_SRV_SYNC);
446
447 srv->set &= ~CO_NMT_SRV_SYNC;
448
449 co_sync_destroy(srv->sync);
450 srv->sync = NULL;
451}
452
453static void
454co_nmt_srv_sync_ind(co_sync_t *sync, co_unsigned8_t cnt, void *data)
455{
456 (void)sync;
457 co_nmt_t *nmt = data;
458 assert(nmt);
459
460 co_nmt_on_sync(nmt, cnt);
461}
462
463static void
464co_nmt_srv_sync_err(co_sync_t *sync, co_unsigned16_t eec, co_unsigned8_t er,
465 void *data)
466{
467 (void)sync;
468 co_nmt_t *nmt = data;
469 assert(nmt);
470
471 co_nmt_on_err(nmt, eec, er, NULL);
472}
473
474#endif // !LELY_NO_CO_SYNC
475
476#ifndef LELY_NO_CO_TIME
477
478static void
480{
481 assert(srv);
482 assert(!(srv->set & CO_NMT_SRV_TIME));
483 assert(!srv->time);
484
485 srv->set |= CO_NMT_SRV_TIME;
486
487 co_obj_t *obj_1012 = co_dev_find_obj(dev, 0x1012);
488 if (!obj_1012)
489 return;
490
491 srv->time = co_time_create(net, dev);
492 if (__unlikely(!srv->time))
494 "unable to initialize TIME service");
495}
496
497static void
499{
500 assert(srv);
501 assert(srv->set & CO_NMT_SRV_TIME);
502
503 srv->set &= ~CO_NMT_SRV_TIME;
504
505 co_time_destroy(srv->time);
506 srv->time = NULL;
507}
508
509#endif
510
511#ifndef LELY_NO_CO_EMCY
512
513static void
515{
516 assert(srv);
517 assert(!(srv->set & CO_NMT_SRV_EMCY));
518 assert(!srv->emcy);
519
520 srv->set |= CO_NMT_SRV_EMCY;
521
522 co_obj_t *obj_1001 = co_dev_find_obj(dev, 0x1001);
523 if (__unlikely(!obj_1001))
524 return;
525
526 srv->emcy = co_emcy_create(net, dev);
527 if (__unlikely(!srv->emcy))
529 "unable to initialize EMCY service");
530}
531
532static void
534{
535 assert(srv);
536 assert(srv->set & CO_NMT_SRV_EMCY);
537
538 srv->set &= ~CO_NMT_SRV_EMCY;
539
540 co_emcy_destroy(srv->emcy);
541 srv->emcy = NULL;
542}
543
544#endif
545
546#ifndef LELY_NO_CO_LSS
547
548static void
550{
551 assert(srv);
552 assert(!(srv->set & CO_NMT_SRV_LSS));
553 assert(!srv->lss);
554
556 return;
557
558 srv->set |= CO_NMT_SRV_LSS;
559
560 srv->lss = co_lss_create(nmt);
561 if (__unlikely(!srv->lss))
563 "unable to initialize LSS service");
564}
565
566static void
568{
569 assert(srv);
570 assert(srv->set & CO_NMT_SRV_LSS);
571
572 srv->set &= ~CO_NMT_SRV_LSS;
573
574 co_lss_destroy(srv->lss);
575 srv->lss = NULL;
576}
577
578#endif
This header file is part of the CANopen library; it contains the time stamp (TIME) object declaration...
co_time_t * co_time_create(can_net_t *net, co_dev_t *dev)
Creates a new CANopen TIME producer/consumer service.
Definition: time.c:223
void co_time_destroy(co_time_t *time)
Destroys a CANopen TIME producer/consumer service.
Definition: time.c:250
This header file is part of the CANopen library; it contains the Client-SDO declarations.
co_csdo_t * co_csdo_create(can_net_t *net, co_dev_t *dev, co_unsigned8_t num)
Creates a new CANopen Client-SDO service.
Definition: csdo.c:867
void co_csdo_destroy(co_csdo_t *sdo)
Destroys a CANopen Client-SDO service.
Definition: csdo.c:894
This header file is part of the CANopen library; it contains the device description declarations.
co_obj_t * co_dev_find_obj(const co_dev_t *dev, co_unsigned16_t idx)
Finds an object in the object dictionary of a CANopen device.
Definition: dev.c:279
int co_dev_get_lss(const co_dev_t *dev)
Returns 1 if LSS is supported and 0 if not.
Definition: dev.c:497
This header file is part of the utilities library; it contains the diagnostic declarations.
@ DIAG_ERROR
An error.
Definition: diag.h:49
void diag(enum diag_severity severity, int errc, const char *format,...)
Emits a diagnostic message.
Definition: diag.c:156
This header file is part of the CANopen library; it contains the emergency (EMCY) object declarations...
void co_emcy_destroy(co_emcy_t *emcy)
Destroys a CANopen EMCY producer/consumer service.
Definition: emcy.c:354
co_emcy_t * co_emcy_create(can_net_t *net, co_dev_t *dev)
Creates a new CANopen EMCY producer/consumer service.
Definition: emcy.c:327
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
Definition: errnum.c:947
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
Definition: errnum.c:957
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
Definition: errnum.c:43
#define __unlikely(x)
Indicates to the compiler that the expression is most-likely false.
Definition: features.h:286
This header file is part of the CANopen library; it contains the Layer Setting Services (LSS) and pro...
void co_lss_destroy(co_lss_t *lss)
Destroys a CANopen LSS master/slave service.
Definition: lss.c:733
co_lss_t * co_lss_create(co_nmt_t *nmt)
Creates a new CANopen LSS master/slave service.
Definition: lss.c:706
void co_nmt_on_sync(co_nmt_t *nmt, co_unsigned8_t cnt)
Implements the default behavior after a SYNC object is received or transmitted.
Definition: nmt.c:1345
void co_nmt_on_err(co_nmt_t *nmt, co_unsigned16_t eec, co_unsigned8_t er, const uint8_t msef[5])
Implements the default error handling behavior by generating an EMCY message with co_emcy_push() and ...
Definition: nmt.c:1371
can_net_t * co_nmt_get_net(const co_nmt_t *nmt)
Returns a pointer to the CAN network of an NMT master/slave service.
Definition: nmt.c:1036
co_dev_t * co_nmt_get_dev(const co_nmt_t *nmt)
Returns a pointer to the CANopen device of an NMT master/slave service.
Definition: nmt.c:1044
static void co_nmt_srv_fini_sync(struct co_nmt_srv *srv)
Finalizes the SYNC producer/consumer service.
Definition: nmt_srv.c:442
#define CO_NUM_PDO
The maximum number of Receive/Transmit-PDOs.
Definition: nmt_srv.c:111
void co_nmt_srv_set(struct co_nmt_srv *srv, co_nmt_t *nmt, int set)
Enables/disables the specified CANopen services.
Definition: nmt_srv.c:152
static void co_nmt_srv_init_lss(struct co_nmt_srv *srv, co_nmt_t *nmt)
Initializes the LSS master/slave service.
Definition: nmt_srv.c:549
void co_nmt_srv_fini(struct co_nmt_srv *srv)
Finalizes a CANopen NMT service manager.
Definition: nmt_srv.c:144
static void co_nmt_srv_init_pdo(struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev)
Initializes all Receive/Transmit-PDO services.
Definition: nmt_srv.c:211
static void co_nmt_srv_init_sync(struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev)
Initializes the SYNC producer/consumer service.
Definition: nmt_srv.c:419
static void co_nmt_srv_init_emcy(struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev)
Initializes the EMCY producer/consumer service.
Definition: nmt_srv.c:514
static void co_nmt_srv_init_sdo(struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev)
Initializes all Server/Client-SDO services.
Definition: nmt_srv.c:324
void co_nmt_srv_init(struct co_nmt_srv *srv, co_nmt_t *nmt)
Initializes a CANopen NMT service manager.
Definition: nmt_srv.c:117
static void co_nmt_srv_fini_pdo(struct co_nmt_srv *srv)
Finalizes all Receive/Transmit-PDO services.
Definition: nmt_srv.c:282
static void co_nmt_srv_fini_time(struct co_nmt_srv *srv)
Finalizes the TIME producer/consumer service.
Definition: nmt_srv.c:498
static void co_nmt_srv_fini_emcy(struct co_nmt_srv *srv)
Finalizes the EMCY producer/consumer service.
Definition: nmt_srv.c:533
static void co_nmt_srv_fini_sdo(struct co_nmt_srv *srv)
Finalizes all Server/Client-SDO services.
Definition: nmt_srv.c:392
static void co_nmt_srv_rpdo_err(co_rpdo_t *pdo, co_unsigned16_t eec, co_unsigned8_t er, void *data)
Invokes co_nmt_err() to handle Receive-PDO errors.
Definition: nmt_srv.c:310
static void co_nmt_srv_sync_err(co_sync_t *sync, co_unsigned16_t eec, co_unsigned8_t er, void *data)
Invokes co_nmt_err() to handle SYNC errors.
Definition: nmt_srv.c:464
static void co_nmt_srv_fini_lss(struct co_nmt_srv *srv)
Finalizes the EMCY master/slave service.
Definition: nmt_srv.c:567
static void co_nmt_srv_init_time(struct co_nmt_srv *srv, can_net_t *net, co_dev_t *dev)
Initializes the TIME producer/consumer service.
Definition: nmt_srv.c:479
static void co_nmt_srv_sync_ind(co_sync_t *sync, co_unsigned8_t cnt, void *data)
Invokes co_nmt_sync() to handle SYNC objects.
Definition: nmt_srv.c:454
#define CO_NUM_SDO
The maximum number of Client/Server-SDOs.
Definition: nmt_srv.c:114
This is the internal header file of the NMT service manager declarations.
#define CO_NMT_SRV_LSS
The LSS master/slave service.
Definition: nmt_srv.h:81
#define CO_NMT_SRV_SDO
The Server/Client-SDO services.
Definition: nmt_srv.h:69
#define CO_NMT_SRV_TIME
The TIME producer/consumer service.
Definition: nmt_srv.h:75
#define CO_NMT_SRV_EMCY
The EMCY producer/consumer service.
Definition: nmt_srv.h:78
#define CO_NMT_SRV_SYNC
The SYNC producer/consumer service.
Definition: nmt_srv.h:72
#define CO_NMT_SRV_PDO
The Receive/Transmit-PDO services.
Definition: nmt_srv.h:66
This header file is part of the CANopen library; it contains the Receive-PDO declarations.
void co_rpdo_set_err(co_rpdo_t *pdo, co_rpdo_err_t *err, void *data)
Sets the error handling function of a Receive-PDO service.
Definition: rpdo.c:386
void co_rpdo_destroy(co_rpdo_t *pdo)
Destroys a CANopen Receive-PDO service.
Definition: rpdo.c:305
co_rpdo_t * co_rpdo_create(can_net_t *net, co_dev_t *dev, co_unsigned16_t num)
Creates a new CANopen Receive-PDO service.
Definition: rpdo.c:278
This is the internal header file of the CANopen library.
This header file is part of the CANopen library; it contains the Server-SDO declarations.
void co_ssdo_destroy(co_ssdo_t *sdo)
Destroys a CANopen Server-SDO service.
Definition: ssdo.c:657
co_ssdo_t * co_ssdo_create(can_net_t *net, co_dev_t *dev, co_unsigned8_t num)
Creates a new CANopen Server-SDO service.
Definition: ssdo.c:630
This header file is part of the C11 and POSIX compatibility library; it includes <stdlib....
A CAN network interface.
Definition: net.c:37
A CANopen Client-SDO.
Definition: csdo.c:45
A CANopen device.
Definition: dev.c:38
A CANopen NMT master/slave service.
Definition: nmt.c:104
A CANopen object.
Definition: obj.h:32
A CANopen Receive-PDO.
Definition: rpdo.c:40
A CANopen Server-SDO.
Definition: ssdo.c:43
A CANopen SYNC producer/consumer service.
Definition: sync.c:39
A CANopen Transmit-PDO.
Definition: tpdo.c:41
A CANopen NMT service manager.
Definition: nmt_srv.h:30
co_tpdo_t ** tpdos
An array of pointers to the Transmit-PDO services.
Definition: nmt_srv.h:44
co_unsigned16_t ntpdo
The number of Transmit-PDO services.
Definition: nmt_srv.h:46
co_lss_t * lss
A pointer to the LSS master/slave service.
Definition: nmt_srv.h:62
co_ssdo_t ** ssdos
An array of pointers to the Server-SDO services.
Definition: nmt_srv.h:48
int set
The currently enabled CANopen services (any combination of CO_NMT_SRV_PDO, CO_NMT_SRV_SDO,...
Definition: nmt_srv.h:38
co_rpdo_t ** rpdos
An array of pointers to the Receive-PDO services.
Definition: nmt_srv.h:40
co_unsigned8_t ncsdo
The number of Client-SDO services.
Definition: nmt_srv.h:54
co_unsigned8_t nssdo
The number of Server-SDO services.
Definition: nmt_srv.h:50
co_nmt_t * nmt
A pointer to the NMT master/slave service.
Definition: nmt_srv.h:32
co_time_t * time
A pointer to the TIME producer/consumer service.
Definition: nmt_srv.h:58
co_csdo_t ** csdos
An array of pointers to the Client-SDO services.
Definition: nmt_srv.h:52
co_emcy_t * emcy
A pointer to the EMCY producer/consumer service.
Definition: nmt_srv.h:60
co_unsigned16_t nrpdo
The number of Receive-PDO services.
Definition: nmt_srv.h:42
co_sync_t * sync
A pointer to the SYNC producer/consumer service.
Definition: nmt_srv.h:56
This header file is part of the CANopen library; it contains the synchronization (SYNC) object declar...
void co_sync_destroy(co_sync_t *sync)
Destroys a CANopen SYNC producer/consumer service.
Definition: sync.c:256
void co_sync_set_err(co_sync_t *sync, co_sync_err_t *err, void *data)
Sets the error handling function of a SYNC consumer service.
Definition: sync.c:313
void co_sync_set_ind(co_sync_t *sync, co_sync_ind_t *ind, void *data)
Sets the indication function invoked after a CANopen SYNC message is received or transmitted.
Definition: sync.c:293
co_sync_t * co_sync_create(can_net_t *net, co_dev_t *dev)
Creates a new CANopen SYNC producer/consumer service.
Definition: sync.c:229
This header file is part of the CANopen library; it contains the Transmit-PDO declarations.
void co_tpdo_destroy(co_tpdo_t *pdo)
Destroys a CANopen Transmit-PDO service.
Definition: tpdo.c:325
co_tpdo_t * co_tpdo_create(can_net_t *net, co_dev_t *dev, co_unsigned16_t num)
Creates a new CANopen Transmit-PDO service.
Definition: tpdo.c:298