26#ifndef LELY_NO_CO_MASTER
32#ifndef LELY_NO_CO_EMCY
37#ifndef LELY_NO_CO_RPDO
41#ifndef LELY_NO_CO_TPDO
45#ifndef LELY_NO_CO_MASTER
59#ifndef LELY_NO_CO_MASTER
121#ifndef LELY_NO_CO_MASTER
133#ifndef LELY_NO_CO_MASTER
172#ifndef LELY_NO_CO_MASTER
179#ifndef LELY_NO_CO_LSS
254#ifndef LELY_NO_CO_MASTER
274#ifndef LELY_NO_CO_MASTER
297#ifndef LELY_NO_CO_MASTER
309#ifndef LELY_NO_CO_MASTER
327#ifndef LELY_NO_CO_MASTER
330 int reason,
void *data);
338 int reason,
void *data);
344#ifndef LELY_NO_CO_MASTER
348 co_unsigned8_t subidx,
size_t size,
size_t nbyte,
void *data);
352 co_unsigned8_t subidx,
size_t size,
size_t nbyte,
void *data);
373#ifndef LELY_NO_CO_MASTER
384 co_nmt_t *
nmt, co_unsigned8_t
id, co_unsigned8_t st,
char es);
403#ifndef LELY_NO_CO_MASTER
417 co_unsigned8_t st,
char es);
423#define LELY_CO_DEFINE_STATE(name, ...) \
424 static co_nmt_state_t *const name = &(co_nmt_state_t){ __VA_ARGS__ };
426#ifndef LELY_NO_CO_MASTER
429 co_nmt_t *nmt, co_unsigned8_t
id, co_unsigned8_t st,
char es);
493#ifndef LELY_NO_CO_MASTER
499 co_nmt_t *nmt, co_unsigned8_t
id, co_unsigned8_t st,
char es);
504#ifdef LELY_NO_CO_MASTER
526#ifdef LELY_NO_CO_MASTER
548#ifdef LELY_NO_CO_MASTER
562#undef LELY_CO_DEFINE_STATE
567#ifndef LELY_NO_CO_MASTER
607#ifndef LELY_NO_CO_MASTER
626#define CO_NMT_PREOP_SRV \
627 (CO_NMT_STOP_SRV | CO_NMT_SRV_SDO | CO_NMT_SRV_SYNC | CO_NMT_SRV_TIME \
631#define CO_NMT_START_SRV (CO_NMT_PREOP_SRV | CO_NMT_SRV_PDO)
634#define CO_NMT_STOP_SRV CO_NMT_SRV_LSS
645 co_unsigned8_t n = co_obj_get_val_u8(obj_1016, 0x00);
646 co_unsigned8_t i = 0;
650 for (i = 1; i <= n; i++) {
651 co_unsigned32_t val_i = co_obj_get_val_u32(obj_1016, i);
652 co_unsigned8_t id_i = (val_i >> 16) & 0xff;
660 for (i = 1; i <= n; i++) {
661 co_unsigned32_t val_i = co_obj_get_val_u32(obj_1016, i);
662 co_unsigned8_t id_i = (val_i >> 16) & 0xff;
674 co_unsigned32_t val = ((co_unsigned32_t)
id << 16) | ms;
682 case 'A':
return "The CANopen device is not listed in object 1F81.";
684 return "No response received for upload request of object 1000.";
686 return "Value of object 1000 from CANopen device is different to value in object 1F84 (Device type).";
688 return "Value of object 1018 sub-index 01 from CANopen device is different to value in object 1F85 (Vendor-ID).";
690 return "Heartbeat event. No heartbeat message received from CANopen device.";
692 return "Node guarding event. No confirmation for guarding request received from CANopen device.";
694 return "Objects for program download are not configured or inconsistent.";
696 return "Software update is required, but not allowed because of configuration or current status.";
698 return "Software update is required, but program download failed.";
699 case 'J':
return "Configuration download failed.";
701 return "Heartbeat event during start error control service. No heartbeat message received from CANopen device during start error control service.";
702 case 'L':
return "NMT slave was initially operational.";
704 return "Value of object 1018 sub-index 02 from CANopen device is different to value in object 1F86 (Product code).";
706 return "Value of object 1018 sub-index 03 from CANopen device is different to value in object 1F87 (Revision number).";
708 return "Value of object 1018 sub-index 04 from CANopen device is different to value in object 1F88 (Serial number).";
709 default:
return "Unknown error status";
716 void *ptr = malloc(
sizeof(
struct __co_nmt));
723__co_nmt_free(
void *ptr)
748 goto error_write_dcf_node;
757 goto error_write_dcf_comm;
765#ifndef LELY_NO_CO_MASTER
773 goto error_create_recv_000;
782#ifndef LELY_NO_CO_MASTER
807#ifndef LELY_NO_CO_MASTER
812#ifndef LELY_NO_CO_LSS
878#ifndef LELY_NO_CO_MASTER
891#ifndef LELY_NO_CO_MASTER
901#ifndef LELY_NO_CO_MASTER
907#ifndef LELY_NO_CO_MASTER
920error_create_recv_000:
935#ifndef LELY_NO_CO_MASTER
947#ifndef LELY_NO_CO_MASTER
977#ifndef LELY_NO_CO_MASTER
988#ifndef LELY_NO_CO_MASTER
1009 goto error_alloc_nmt;
1014 goto error_init_nmt;
1071#ifndef LELY_NO_CO_MASTER
1166#ifndef LELY_NO_CO_MASTER
1204#ifdef LELY_NO_CO_MASTER
1216#ifndef LELY_NO_CO_MASTER
1218#ifndef LELY_NO_CO_LSS
1353#ifndef LELY_NO_CO_TPDO
1354 for (co_unsigned16_t i = 0; i <
nmt->
srv.
ntpdo; i++) {
1359#ifndef LELY_NO_CO_RPDO
1360 for (co_unsigned16_t i = 0; i <
nmt->
srv.
nrpdo; i++) {
1372 const uint8_t msef[5])
1377#ifdef LELY_NO_CO_EMCY
1386 if ((eec & 0xff00) == 0x8100)
1419 return nmt->
st & ~CO_NMT_ST_TOGGLE;
1425#ifdef LELY_NO_CO_MASTER
1436#ifndef LELY_NO_CO_MASTER
1481 trace(
"NMT: sending command specifier %d to node %d", cs,
id);
1500#ifndef LELY_NO_CO_LSS
1543 trace(
"NMT: booting slave %d",
id);
1548 goto error_create_boot;
1556 goto error_boot_req;
1614 trace(
"NMT: starting update configuration process for node %d",
id);
1619 goto error_create_cfg;
1689 if (!slave->
timer) {
1720 trace(
"NMT: received command specifier %d", cs);
1733 switch (co_dev_get_val_u8(
nmt->
dev, 0x1029, 0x01)) {
1742#ifndef LELY_NO_CO_MASTER
1765 mandatory ?
"mandatory" :
"optional",
id);
1772 }
else if (mandatory && (
nmt->
startup & 0x10)) {
1862#ifndef LELY_NO_CO_MASTER
1875 slave->
est = st & ~CO_NMT_ST_TOGGLE;
1878 if (!slave->
est && (!
es ||
es ==
'L'))
1905 if (!
es ||
es ==
'L') {
1907 for (co_unsigned8_t i = 0; i <
nmt->
nhb; i++) {
1908 co_unsigned32_t val =
1909 co_obj_get_val_u32(obj_1016, i + 1);
1910 if (
id != ((val >> 16) & 0xff))
1918 co_unsigned16_t
gt = (slave->
assignment >> 16) & 0xffff;
1922 "unable to guard node %02X",
id);
1925 trace(
"NMT: slave %d finished booting with error status %c",
id,
1944 "skipping NMT update configuration process");
1960 trace(
"NMT: update configuration process completed for slave %d",
id);
1983static co_unsigned32_t
1992 co_unsigned32_t ac = 0;
2005 co_unsigned16_t gt = val.u16;
2006 co_unsigned16_t gt_old = co_sub_get_val_u16(sub);
2023static co_unsigned32_t
2032 co_unsigned32_t ac = 0;
2045 co_unsigned8_t ltf = val.u8;
2046 co_unsigned8_t ltf_old = co_sub_get_val_u8(sub);
2063static co_unsigned32_t
2072 co_unsigned32_t ac = 0;
2090 if (val.u32 == co_sub_get_val_u32(sub))
2093 co_unsigned8_t
id = (val.u32 >> 16) & 0xff;
2094 co_unsigned16_t ms = val.u32 & 0xffff;
2104 co_unsigned32_t val_i = co_obj_get_val_u32(obj_1016, i);
2105 co_unsigned8_t id_i = (val_i >> 16) & 0xff;
2106 co_unsigned16_t ms_i = val_i & 0xffff;
2127static co_unsigned32_t
2136 co_unsigned32_t ac = 0;
2149 co_unsigned16_t ms = val.u16;
2150 co_unsigned16_t ms_old = co_sub_get_val_u16(sub);
2167#ifndef LELY_NO_CO_MASTER
2168static co_unsigned32_t
2177 co_unsigned32_t ac = 0;
2191 co_unsigned8_t
id = subidx == 0x80 ? 0 : subidx;
2249static co_unsigned32_t
2257 co_unsigned32_t ac = 0;
2270 co_unsigned32_t startup = val.u32;
2271 co_unsigned32_t startup_old = co_sub_get_val_u32(sub);
2272 if (startup == startup_old)
2276 if (
__unlikely((startup ^ startup_old) != 0x5f)) {
2287#ifndef LELY_NO_CO_MASTER
2288static co_unsigned32_t
2297 co_unsigned32_t ac = 0;
2311 co_unsigned8_t
id = subidx == 0x80 ? 0 : subidx;
2355#ifndef LELY_NO_CO_MASTER
2363 co_unsigned8_t cs = msg->
data[0];
2364 co_unsigned8_t
id = msg->
data[1];
2379 assert(msg->
id > 0x700 && msg->
id <= 0x77f);
2384 assert(nmt->
gt && nmt->
ltf);
2401#ifndef LELY_NO_CO_MASTER
2406 co_unsigned8_t
id = (msg->
id - 0x700) & 0x7f;
2417 co_unsigned8_t st = msg->
data[0];
2429 if (!slave->
gt || !slave->
ltf)
2440 if (slave->
rtr >= slave->
ltf) {
2442 "NMT: node guarding time out resolved for node %d",
2454 "NMT: node guarding state change occurred for node %d",
2462 "NMT: node guarding state change resolved for node %d",
2470 if (st != slave->
rst)
2478#ifndef LELY_NO_CO_MASTER
2485 assert(slave->
gt && slave->
ltf);
2490 co_unsigned8_t
id = slave -
nmt->
slaves + 1;
2505 && ++slave->
rtr == slave->
ltf)) {
2508 "NMT: node guarding time out occurred for node %d",
2534 }
else if (nmt->
gt && nmt->
ltf) {
2544#ifndef LELY_NO_CO_MASTER
2553 co_unsigned16_t inhibit = co_dev_get_val_u16(nmt->
dev, 0x102a, 0x00);
2576 assert(msg.
len == 2);
2588 co_unsigned8_t st = 0;
2589 switch (msg.
data[0]) {
2594 co_unsigned8_t
id = msg.
data[1];
2624#ifndef LELY_NO_CO_MASTER
2638#ifndef LELY_NO_CO_MASTER
2674#ifndef LELY_NO_CO_MASTER
2678 size_t size,
size_t nbyte,
void *
data)
2690 size_t size,
size_t nbyte,
void *
data)
2728#ifndef LELY_NO_CO_MASTER
2742 co_nmt_t *nmt, co_unsigned8_t
id, co_unsigned8_t st,
char es)
2761 default:
return NULL;
2770 diag(
DIAG_INFO, 0,
"NMT: entering reset application state");
2772#ifndef LELY_NO_CO_MASTER
2796 "unable to reset application parameters");
2812 diag(
DIAG_INFO, 0,
"NMT: entering reset communication state");
2814#ifndef LELY_NO_CO_MASTER
2838 "unable to reset communication parameters");
2849 "unable to store communication parameters");
2853 nmt->
startup = co_dev_get_val_u32(nmt->
dev, 0x1f80, 0x00);
2854#ifndef LELY_NO_CO_MASTER
2875#if !defined(LELY_NO_CO_MASTER) && !defined(LELY_NO_CO_LSS)
2895 default:
return NULL;
2930 default:
return NULL;
2941#ifndef LELY_NO_CO_MASTER
2969 default:
return NULL;
2973#ifndef LELY_NO_CO_MASTER
2976 co_nmt_t *nmt, co_unsigned8_t
id, co_unsigned8_t st,
char es)
2989 int wait = nmt->
halt;
2990 for (co_unsigned8_t
id = 1; !wait &&
id <=
CO_NUM_NODES;
id++)
2994 trace(
"NMT: all mandatory slaves started successfully");
3014#ifndef LELY_NO_CO_MASTER
3021 for (co_unsigned8_t
id = 1; boot &&
id <=
CO_NUM_NODES;
id++) {
3035 for (co_unsigned8_t
id = 1;
id <=
CO_NUM_NODES;
id++) {
3047 && (!slave->
es || slave->
es ==
'L')
3071 default:
return NULL;
3104 default:
return NULL;
3113#ifndef LELY_NO_CO_MASTER
3120#ifndef LELY_NO_CO_MASTER
3132 for (co_unsigned8_t
id = 1; !keep &&
id <=
CO_NUM_NODES;
id++)
3139 for (co_unsigned8_t
id = 1;
id <=
CO_NUM_NODES;
id++) {
3160 trace(
"NMT: waiting for mandatory slaves to start");
3182 nmt->
gt = co_dev_get_val_u16(
nmt->
dev, 0x100c, 0x00);
3184 nmt->
ms = co_dev_get_val_u16(
nmt->
dev, 0x1017, 0x00);
3190 nmt->
ms ?
"heartbeat production"
3216#ifndef LELY_NO_CO_MASTER
3238 if (
nmt->
ms || lt) {
3249 struct timespec interval = { ms / 1000, (ms % 1000) * 1000000 };
3282 nmt->
nhb = co_obj_get_val_u8(obj_1016, 0x00);
3283 nmt->
hbs = calloc(nmt->
nhb,
sizeof(*nmt->
hbs));
3288 "unable to create heartbeat consumers");
3292 for (co_unsigned8_t i = 0; i < nmt->
nhb; i++) {
3296 "unable to create heartbeat consumer 0x%02X",
3297 (co_unsigned8_t)(i + 1));
3301 co_unsigned32_t val = co_obj_get_val_u32(obj_1016, i + 1);
3302 co_unsigned8_t
id = (val >> 16) & 0xff;
3303 co_unsigned16_t ms = val & 0xffff;
3314 for (
size_t i = 0; i < nmt->
nhb; i++)
3321#ifndef LELY_NO_CO_MASTER
3331 for (co_unsigned8_t
id = 1;
id <=
CO_NUM_NODES;
id++) {
3336 "unable to create CAN frame receiver");
3348 co_unsigned8_t n = co_obj_get_val_u8(obj_1f81, 0x00);
3358 for (co_unsigned8_t
id = 1;
id <=
CO_NUM_NODES;
id++) {
3364 slave->
timer = NULL;
3394 for (co_unsigned8_t
id = 1;
id <=
CO_NUM_NODES;
id++) {
3399 int mandatory = !!(slave->
assignment & 0x08);
3401 if (!res && mandatory)
This header file is part of the CAN library; it contains the CAN frame buffer declarations.
size_t can_buf_reserve(struct can_buf *buf, size_t n)
Resizes a CAN frame buffer, if necessary, to make room for at least n additional frames.
#define CAN_BUF_INIT
The static initializer for struct can_buf.
size_t can_buf_read(struct can_buf *buf, struct can_msg *ptr, size_t n)
Reads, and removes, frames from a CAN frame buffer.
size_t can_buf_peek(struct can_buf *buf, struct can_msg *ptr, size_t n)
Reads, but does not remove, frames from a CAN frame buffer.
void can_buf_fini(struct can_buf *buf)
Finalizes a CAN frame buffer.
size_t can_buf_write(struct can_buf *buf, const struct can_msg *ptr, size_t n)
Writes frames to a CAN frame buffer.
This header file is part of the CANopen library; it contains the Client-SDO declarations.
co_unsigned8_t co_csdo_get_num(const co_csdo_t *sdo)
Returns the SDO number of a Client-SDO.
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.
int co_dev_read_dcf(co_dev_t *dev, co_unsigned16_t *pmin, co_unsigned16_t *pmax, void *const *ptr)
Reads the values of a range of objects from a memory buffer, in the concise DCF format,...
co_unsigned8_t co_dev_get_id(const co_dev_t *dev)
Returns the node-ID of a CANopen device.
int co_dev_set_id(co_dev_t *dev, co_unsigned8_t id)
Sets the node-ID of a CANopen device.
co_sub_t * co_dev_find_sub(const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
Finds a sub-object in the object dictionary of a CANopen device.
#define CO_NUM_NODES
The maximum number of nodes in a CANopen network.
int co_dev_write_dcf(const co_dev_t *dev, co_unsigned16_t min, co_unsigned16_t max, void **ptr)
Loads the values of a range of objects in the object dictionary of a CANopen device,...
const void * co_dev_get_val(const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
Returns a pointer to the current value of a CANopen sub-object.
This header file is part of the utilities library; it contains the diagnostic declarations.
@ DIAG_INFO
An informational message.
void diag(enum diag_severity severity, int errc, const char *format,...)
Emits a diagnostic message.
This header file is part of the CANopen library; it contains the emergency (EMCY) object declarations...
int co_emcy_push(co_emcy_t *emcy, co_unsigned16_t eec, co_unsigned8_t er, const uint8_t msef[5])
Pushes a CANopen EMCY message to the stack and broadcasts it if the EMCY producer service is active.
int errnum2c(errnum_t errnum)
Transforms a platform-independent error number to a native error code.
@ ERRNUM_NOSYS
Function not supported.
@ ERRNUM_PERM
Operation not permitted.
@ ERRNUM_INVAL
Invalid argument.
@ ERRNUM_INPROGRESS
Operation in progress.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
void set_errnum(errnum_t errnum)
Sets the current (thread-specific) platform-independent error number to errnum.
#define __unlikely(x)
Indicates to the compiler that the expression is most-likely false.
This header file is part of the CANopen library; it contains the object dictionary declarations.
co_unsigned8_t co_sub_get_subidx(const co_sub_t *sub)
Returns the sub-index of a CANopen sub-object.
co_unsigned16_t co_obj_get_idx(const co_obj_t *obj)
Returns the index of a CANopen object.
co_unsigned32_t co_sub_dn_ind_val(co_sub_t *sub, co_unsigned16_t type, const void *val)
Invokes the download indication function of a CANopen sub-object, registered with co_sub_set_dn_ind()...
co_sub_t * co_obj_find_sub(const co_obj_t *obj, co_unsigned8_t subidx)
Finds a sub-object in a CANopen object.
int co_sub_dn(co_sub_t *sub, void *val)
Downloads (moves) a value into a CANopen sub-object if the refuse-write-on-download flag (CO_OBJ_FLAG...
void co_obj_set_dn_ind(co_obj_t *obj, co_sub_dn_ind_t *ind, void *data)
Sets the download indication function for a CANopen object.
co_obj_t * co_sub_get_obj(const co_sub_t *sub)
Returns the a pointer to the CANopen object containing the specified sub-object.
co_unsigned16_t co_sub_get_type(const co_sub_t *sub)
Returns the data type of a CANopen sub-object.
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
int co_sdo_req_dn_val(struct co_sdo_req *req, co_unsigned16_t type, void *val, co_unsigned32_t *pac)
Copies the next segment of the specified CANopen SDO download request to the internal buffer and,...
#define CO_SDO_AC_PARAM
SDO abort code: General parameter incompatibility reason.
#define CO_SDO_AC_DATA_DEV
SDO abort code: Data cannot be transferred or stored to the application because of the present device...
#define CO_SDO_AC_NO_OBJ
SDO abort code: Object does not exist in the object dictionary.
#define CO_SDO_AC_NO_DATA
SDO abort code: No data available.
#define CO_SDO_AC_NO_SUB
SDO abort code: Sub-index does not exist.
#define CO_SDO_AC_DATA_CTL
SDO abort code: Data cannot be transferred or stored to the application because of local control.
#define CO_SDO_AC_PARAM_VAL
SDO abort code: Invalid value for parameter (download only).
#define CO_SDO_AC_NO_WRITE
SDO abort code: Attempt to write a read only object.
#define MIN(a, b)
Returns the minimum of a and b.
#define CAN_FLAG_RTR
The Remote Transmission Request (RTR) flag (unavailable in CAN FD format frames).
#define CAN_MSG_INIT
The static initializer for can_msg.
void can_timer_stop(can_timer_t *timer)
Stops a CAN timer and unregisters it with a network interface.
int can_net_send(can_net_t *net, const struct can_msg *msg)
Sends a CAN frame from a network interface.
void can_timer_start(can_timer_t *timer, can_net_t *net, const struct timespec *start, const struct timespec *interval)
Starts a CAN timer and registers it with a network interface.
can_timer_t * can_timer_create(void)
Creates a new CAN timer.
void can_net_get_time(const can_net_t *net, struct timespec *tp)
Retrieves the current time of a CAN network interface.
void can_timer_set_func(can_timer_t *timer, can_timer_func_t *func, void *data)
Sets the callback function invoked when a CAN timer is triggered.
void can_recv_stop(can_recv_t *recv)
Stops a CAN frame receiver from processing frames and unregisters it with the network interface.
void can_recv_set_func(can_recv_t *recv, can_recv_func_t *func, void *data)
Sets the callback function used to process CAN frames with a receiver.
void can_recv_destroy(can_recv_t *recv)
Destroys a CAN frame receiver.
void can_timer_timeout(can_timer_t *timer, can_net_t *net, int timeout)
Starts a CAN timer and registers it with a network interface.
void can_recv_start(can_recv_t *recv, can_net_t *net, uint_least32_t id, uint_least8_t flags)
Registers a CAN frame receiver with a network interface and starts processing frames.
can_recv_t * can_recv_create(void)
Creates a new CAN frame receiver.
void can_timer_destroy(can_timer_t *timer)
Destroys a CAN timer.
void co_nmt_destroy(co_nmt_t *nmt)
Destroys a CANopen NMT master/slave service.
static int co_nmt_ec_timer(const struct timespec *tp, void *data)
The CAN timer callback function for life guarding or heartbeat production.
void co_nmt_set_sync_ind(co_nmt_t *nmt, co_nmt_sync_ind_t *ind, void *data)
Sets the indication function invoked by co_nmt_on_sync() after all PDOs have been transmitted/process...
void co_nmt_get_sync_ind(const co_nmt_t *nmt, co_nmt_sync_ind_t **pind, void **pdata)
Retrieves the indication function invoked by co_nmt_on_sync() after all PDOs have been transmitted/pr...
static co_nmt_state_t *const co_nmt_reset_node_state
The NMT 'reset application' state.
static int co_nmt_ec_update(co_nmt_t *nmt)
Updates and (de)activates the life guarding or heartbeat production services.
int co_nmt_cs_ind(co_nmt_t *nmt, co_unsigned8_t cs)
Processes an NMT command from the master or the application.
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.
static void co_nmt_ec_fini(co_nmt_t *nmt)
Finalizes the error control services.
void co_nmt_get_cs_ind(const co_nmt_t *nmt, co_nmt_cs_ind_t **pind, void **pdata)
Retrieves the indication function invoked when an NMT command is received.
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 ...
void co_nmt_get_up_ind(const co_nmt_t *nmt, co_nmt_sdo_ind_t **pind, void **pdata)
Retrieves the indication function used to notify the user of the progress of the current SDO upload r...
static co_unsigned32_t co_1f80_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for (all sub-objects of) CANopen object 1F80 (NMT startup).
static co_unsigned32_t co_100d_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for CANopen object 100D (Life time factor).
static co_nmt_state_t * co_nmt_start_on_cs(co_nmt_t *nmt, co_unsigned8_t cs)
The 'NMT command received' transition function of the 'operational' state.
const char * co_nmt_es2str(char es)
Returns a pointer to a string describing an NMT boot error status.
static void co_nmt_dn_ind(const co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, size_t size, size_t nbyte, void *data)
The SDO download progress indication function.
static co_nmt_state_t *const co_nmt_start_state
The NMT 'operational' state.
static void co_nmt_emit_cs(co_nmt_t *nmt, co_unsigned8_t cs)
Invokes the 'NMT command received' transition function of the current state of an NMT master/slave se...
static co_nmt_state_t *const co_nmt_preop_state
The NMT 'pre-operational' state.
void co_nmt_set_cfg_ind(co_nmt_t *nmt, co_nmt_cfg_ind_t *ind, void *data)
Sets the indication function invoked when a CANopen NMT 'configuration request' process is received.
void co_nmt_get_st_ind(const co_nmt_t *nmt, co_nmt_st_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a state change is detected.
#define CO_NMT_START_SRV
The services enabled in the NMT 'operational' state.
static int co_nmt_ng_timer(const struct timespec *tp, void *data)
The CAN timer callback function for node guarding.
static co_unsigned32_t co_1f25_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for (all sub-objects of) CANopen object 1F25 (Configuration request)...
static void default_st_ind(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, void *data)
The default state change event handler.
static co_nmt_state_t * co_nmt_bootup_on_cs(co_nmt_t *nmt, co_unsigned8_t cs)
The 'NMT command received' transition function of the 'boot-up' state.
void co_nmt_get_lss_req(const co_nmt_t *nmt, co_nmt_lss_req_t **pind, void **pdata)
Retrieves the request function invoked to perform LSS when booting an NMT master.
static int co_nmt_cs_timer(const struct timespec *tp, void *data)
The CAN timer callback function for sending buffered NMT messages.
void co_nmt_cfg_ind(co_nmt_t *nmt, co_unsigned8_t id, co_csdo_t *sdo)
The CANopen NMT 'update configuration' indication function, invoked when a configuration request is r...
#define CO_NMT_STOP_SRV
The services enabled in the NMT 'stopped' state.
static co_nmt_state_t *const co_nmt_stop_state
The NMT 'stopped' state.
static co_nmt_state_t * co_nmt_reset_comm_on_enter(co_nmt_t *nmt)
The entry function of the 'reset communication' state.
void co_nmt_set_up_ind(co_nmt_t *nmt, co_nmt_sdo_ind_t *ind, void *data)
Sets the indication function used to notify the user of the progress of the current SDO upload reques...
static void co_nmt_hb_fini(co_nmt_t *nmt)
Finalizes the heartbeat consumer services.
void co_nmt_on_lg(co_nmt_t *nmt, int state)
Implements the default behavior when a life guarding event occurs (see section 7.2....
co_ssdo_t * co_nmt_get_ssdo(const co_nmt_t *nmt, co_unsigned8_t n)
Returns a pointer to a Server-SDO service.
void co_nmt_on_st(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st)
Implements the default behavior when a state change is detected by the node guarding or heartbeat pro...
static co_unsigned32_t co_1017_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for CANopen object 1017 (Producer heartbeat time).
static co_nmt_state_t * co_nmt_preop_on_enter(co_nmt_t *nmt)
The entry function of the 'pre-operational' state.
void co_nmt_get_dn_ind(const co_nmt_t *nmt, co_nmt_sdo_ind_t **pind, void **pdata)
Retrieves the indication function used to notify the user of the progress of the current SDO download...
void co_nmt_set_hb_ind(co_nmt_t *nmt, co_nmt_hb_ind_t *ind, void *data)
Sets the indication function invoked when a heartbeat event occurs.
co_rpdo_t * co_nmt_get_rpdo(const co_nmt_t *nmt, co_unsigned16_t n)
Returns a pointer to a Receive-PDO service.
void co_nmt_get_ng_ind(const co_nmt_t *nmt, co_nmt_ng_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a node guarding event occurs.
static co_nmt_state_t * co_nmt_default_on_boot(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, char es)
The default 'boot slave completed' transition function.
static co_nmt_state_t *const co_nmt_init_state
The 'initializing' state.
void co_nmt_get_boot_ind(const co_nmt_t *nmt, co_nmt_boot_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a CANopen NMT 'boot slave' process completes.
co_nmt_t * co_nmt_create(can_net_t *net, co_dev_t *dev)
Creates a new CANopen NMT master/slave service.
void co_nmt_set_lss_req(co_nmt_t *nmt, co_nmt_lss_req_t *ind, void *data)
Sets the request function invoked to perform LSS when booting an NMT master.
int co_nmt_get_timeout(const co_nmt_t *nmt)
Returns the default SDO timeout used during the NMT 'boot slave' and 'check configuration' processes.
static int co_nmt_slaves_boot(co_nmt_t *nmt)
Starts the NMT 'boot slave' processes.
static co_nmt_state_t * co_nmt_startup_slave(co_nmt_t *nmt)
The NMT slave startup procedure.
int co_nmt_cfg_req(co_nmt_t *nmt, co_unsigned8_t id, int timeout, co_nmt_cfg_con_t *con, void *data)
Issues the NMT 'configuration request' for the specified node.
static co_nmt_state_t * co_nmt_bootup_on_enter(co_nmt_t *nmt)
The entry function of the 'boot-up' state.
co_lss_t * co_nmt_get_lss(const co_nmt_t *nmt)
Returns a pointer to the LSS master/slave service.
co_unsigned8_t co_nmt_get_id(const co_nmt_t *nmt)
Returns the pending node-ID.
static void co_nmt_slaves_init(co_nmt_t *nmt)
Initializes NMT slave management.
void co_nmt_cfg_con(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned32_t ac)
The CANopen NMT 'configuration request' confirmation function, invoked when a configuration request c...
static void co_nmt_up_ind(const co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, size_t size, size_t nbyte, void *data)
The SDO upload progress indication function.
void co_nmt_get_lg_ind(const co_nmt_t *nmt, co_nmt_lg_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a life guarding event occurs.
void co_nmt_set_boot_ind(co_nmt_t *nmt, co_nmt_boot_ind_t *ind, void *data)
Sets the indication function invoked when a CANopen NMT 'boot slave' process completes.
int co_nmt_is_booting(const co_nmt_t *nmt, co_unsigned8_t id)
Returns 1 if the NMT 'boot slave' process is currently running for the specified node,...
static int co_nmt_recv_700(const struct can_msg *msg, void *data)
The CAN receive callback function for NMT error control (node guarding RTR) messages.
static int co_nmt_ec_send_res(co_nmt_t *nmt, co_unsigned8_t st)
Sends an NMT error control response message.
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.
static co_nmt_state_t * co_nmt_start_on_enter(co_nmt_t *nmt)
The entry function of the 'operational' state.
void co_nmt_on_hb(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason)
Implements the default behavior when a heartbeat event occurs (see sections 7.2.8....
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.
static void default_lg_ind(co_nmt_t *nmt, int state, void *data)
The default life guarding event handler.
static void co_nmt_hb_init(co_nmt_t *nmt)
Initializes the heartbeat consumer services.
void co_nmt_get_cfg_ind(const co_nmt_t *nmt, co_nmt_cfg_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a CANopen NMT 'configuration request' is received.
int co_nmt_boot_req(co_nmt_t *nmt, co_unsigned8_t id, int timeout)
Requests the NMT 'boot slave' process for the specified node.
static int co_nmt_recv_000(const struct can_msg *msg, void *data)
The CAN receive callback function for NMT messages.
#define CO_NMT_PREOP_SRV
The services enabled in the NMT 'pre-operational' state.
static co_nmt_state_t * co_nmt_startup(co_nmt_t *nmt)
The NMT startup procedure (see Fig. 1 & 2 in CiA 302-2 version 4.1.0).
static void co_nmt_emit_boot(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, char es)
Invokes the 'boot slave completed' transition function of the current state of an NMT master service.
void co_nmt_set_lg_ind(co_nmt_t *nmt, co_nmt_lg_ind_t *ind, void *data)
Sets the indication function invoked when a life guarding event occurs.
co_unsigned8_t co_nmt_get_st(const co_nmt_t *nmt)
Returns the current state of a CANopen NMT service (one of CO_NMT_ST_BOOTUP, CO_NMT_ST_STOP,...
static co_nmt_state_t * co_nmt_reset_node_on_enter(co_nmt_t *nmt)
The entry function of the 'reset application' state.
int co_nmt_cfg_res(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned32_t ac)
Indicates the result of the 'update configuration' step of an NMT 'request configuration' request for...
static co_nmt_state_t *const co_nmt_bootup_state
The NMT 'boot-up' state.
static co_nmt_state_t * co_nmt_init_on_cs(co_nmt_t *nmt, co_unsigned8_t cs)
The 'NMT command received' transition function of the 'initializing' state.
static co_nmt_state_t * co_nmt_preop_on_boot(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, char es)
The 'boot slave completed' transition function of the 'pre-operational' state.
static co_nmt_state_t * co_nmt_preop_on_cs(co_nmt_t *nmt, co_unsigned8_t cs)
The 'NMT command received' transition function of the 'pre-operational' state.
void co_nmt_set_timeout(co_nmt_t *nmt, int timeout)
Sets the default SDO timeout used during the NMT 'boot slave' and 'check configuration' processes.
static void default_ng_ind(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason, void *data)
The default node guarding event handler.
co_emcy_t * co_nmt_get_emcy(const co_nmt_t *nmt)
Returns a pointer to the EMCY producer/consumer service.
int co_nmt_node_err_ind(co_nmt_t *nmt, co_unsigned8_t id)
Indicates the occurrence of an error event and triggers the error handling process (see Fig.
static co_nmt_state_t * co_nmt_reset_comm_on_cs(co_nmt_t *nmt, co_unsigned8_t cs)
The 'NMT command received' transition function of the 'reset communication' state.
int co_nmt_ng_req(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned16_t gt, co_unsigned8_t ltf)
Request the node guarding service for the specified node, even if it is not in the network list.
co_unsigned32_t co_dev_cfg_hb(co_dev_t *dev, co_unsigned8_t id, co_unsigned16_t ms)
Configures heartbeat consumption for the specified node by updating CANopen object 1016 (Consumer hea...
void co_nmt_set_ng_ind(co_nmt_t *nmt, co_nmt_ng_ind_t *ind, void *data)
Sets the indication function invoked when a node guarding event occurs.
static co_nmt_state_t * co_nmt_startup_master(co_nmt_t *nmt)
The NMT master startup procedure.
co_csdo_t * co_nmt_get_csdo(const co_nmt_t *nmt, co_unsigned8_t n)
Returns a pointer to a Client-SDO service.
void co_nmt_set_dn_ind(co_nmt_t *nmt, co_nmt_sdo_ind_t *ind, void *data)
Sets the indication function used to notify the user of the progress of the current SDO download requ...
void co_nmt_comm_err_ind(co_nmt_t *nmt)
Indicates the occurrence of a communication error and invokes the specified error behavior (object 10...
int co_nmt_cs_req(co_nmt_t *nmt, co_unsigned8_t cs, co_unsigned8_t id)
Submits an NMT request to a slave.
void co_nmt_set_cs_ind(co_nmt_t *nmt, co_nmt_cs_ind_t *ind, void *data)
Sets the indication function invoked when an NMT command is received.
int co_nmt_set_id(co_nmt_t *nmt, co_unsigned8_t id)
Sets the pending node-ID.
void co_nmt_on_ng(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason)
Implements the default behavior when a node guarding event occurs (see sections 7....
int co_nmt_is_master(const co_nmt_t *nmt)
Returns 1 if the specified CANopen NMT service is a master, and 0 if not.
void co_nmt_get_hb_ind(const co_nmt_t *nmt, co_nmt_hb_ind_t **pind, void **pdata)
Retrieves the indication function invoked when a heartbeat event occurs.
co_time_t * co_nmt_get_time(const co_nmt_t *nmt)
Returns a pointer to the TIME producer/consumer service.
static co_nmt_state_t * co_nmt_stop_on_cs(co_nmt_t *nmt, co_unsigned8_t cs)
The 'NMT command received' transition function of the 'stopped' state.
co_tpdo_t * co_nmt_get_tpdo(const co_nmt_t *nmt, co_unsigned16_t n)
Returns a pointer to a Transmit-PDO service.
static void co_nmt_st_ind(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st)
The indication function for state change events.
static void co_nmt_enter(co_nmt_t *nmt, co_nmt_state_t *next)
Enters the specified state of an NMT master/slave service and invokes the exit and entry functions.
co_sync_t * co_nmt_get_sync(const co_nmt_t *nmt)
Returns a pointer to the SYNC producer/consumer service.
void co_nmt_set_st_ind(co_nmt_t *nmt, co_nmt_st_ind_t *ind, void *data)
Sets the indication function invoked when a state change is detected.
void co_nmt_boot_con(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, char es)
The CANopen NMT 'boot slave' confirmation function, invoked when the 'boot slave' process completes.
int co_nmt_lss_con(co_nmt_t *nmt)
Confirms the completion of the process when booting an NMT master.
static void co_nmt_ec_init(co_nmt_t *nmt)
Initializes the error control services.
void co_nmt_hb_ind(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason, co_unsigned8_t st)
The CANopen NMT heartbeat indication function, invoked when a heartbeat event occurs.
static co_unsigned32_t co_100c_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for CANopen object 100C (Guard time).
static co_unsigned32_t co_1016_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for CANopen object 1016 (Consumer heartbeat time).
static co_unsigned32_t co_1f82_dn_ind(co_sub_t *sub, struct co_sdo_req *req, void *data)
The download indication function for (all sub-objects of) CANopen object 1F80 (Request NMT).
static void co_nmt_slaves_fini(co_nmt_t *nmt)
Finalizes NMT slave management.
static co_nmt_state_t * co_nmt_stop_on_enter(co_nmt_t *nmt)
The entry function of the 'stopped' state.
static co_nmt_state_t *const co_nmt_reset_comm_state
The NMT 'reset communication' state.
static void default_hb_ind(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason, void *data)
The default heartbeat event handler.
This header file is part of the CANopen library; it contains the network management (NMT) declaration...
@ CO_NMT_EC_OCCURRED
An NMT error control event occurred.
@ CO_NMT_EC_RESOLVED
An NMT error control event was resolved.
void co_nmt_lss_req_t(co_nmt_t *nmt, co_lss_t *lss, void *data)
The type of a CANopen LSS request function, invoked by an NMT master before booting the slaves (see F...
#define CO_NMT_ST_BOOTUP
The NMT state 'boot-up'.
#define CO_NMT_CS_START
The NMT command specifier 'start'.
void co_nmt_lg_ind_t(co_nmt_t *nmt, int state, void *data)
The type of a CANopen NMT life guarding indication function, invoked when a life guarding event occur...
#define CO_NMT_ST_PREOP
The NMT state 'pre-operational'.
#define CO_NMT_EC_CANID(id)
The CAN identifier used for both node guarding and heartbeat monitoring.
#define CO_NMT_CS_ENTER_PREOP
The NMT command specifier 'enter pre-operational'.
void co_nmt_ng_ind_t(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason, void *data)
The type of a CANopen NMT node guarding indication function, invoked when a node guarding event occur...
#define CO_NMT_CS_RESET_NODE
The NMT command specifier 'reset node'.
void co_nmt_st_ind_t(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, void *data)
The type of a CANopen NMT state change indication function, invoked when a state change is detected b...
#define LELY_CO_NMT_TIMEOUT
The default SDO timeout (in milliseconds) for the NMT 'boot slave' and 'check configuration' processe...
#define CO_NMT_CS_STOP
The NMT command specifier 'stop'.
void co_nmt_cfg_ind_t(co_nmt_t *nmt, co_unsigned8_t id, co_csdo_t *sdo, void *data)
The type of a CANopen NMT 'update configuration' indication function, invoked when a configuration re...
void co_nmt_boot_ind_t(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, char es, void *data)
The type of a CANopen NMT 'boot slave' indication function, invoked when the 'boot slave' process com...
void co_nmt_sync_ind_t(co_nmt_t *nmt, co_unsigned8_t cnt, void *data)
The type of a SYNC indication function, invoked by co_nmt_on_sync() after PDOs are transmitted/proces...
#define CO_NMT_ST_START
The NMT state 'operational'.
void co_nmt_hb_ind_t(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason, void *data)
The type of a CANopen NMT heartbeat indication function, invoked when a heartbeat event occurs (see s...
void co_nmt_cs_ind_t(co_nmt_t *nmt, co_unsigned8_t cs, void *data)
The type of a CANopen NMT command indication function, invoked when an NMT command is received (and a...
#define CO_NMT_ST_RESET_NODE
The NMT sub-state 'reset application'.
#define CO_NMT_ST_TOGGLE
The mask to get/set the toggle bit from an NMT state.
#define CO_NMT_CS_CANID
The CAN identifier used for NMT commands.
#define CO_NMT_ST_RESET_COMM
The NMT sub-state 'reset communication'.
@ CO_NMT_EC_STATE
An NMT error control state change event.
@ CO_NMT_EC_TIMEOUT
An NMT error control timeout event.
#define CO_NMT_ST_STOP
The NMT state 'stopped'.
#define CO_NMT_CS_RESET_COMM
The NMT command specifier 'reset communication'.
void co_nmt_sdo_ind_t(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned16_t idx, co_unsigned8_t subidx, size_t size, size_t nbyte, void *data)
The type of an SDO request progress indication function, invoked by a CANopen NMT master to notify th...
void co_nmt_cfg_con_t(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned32_t ac, void *data)
The type of a CANopen NMT 'configuration request' confirmation callback function, invoked when a conf...
void co_nmt_boot_destroy(co_nmt_boot_t *boot)
Destroys a CANopen NMT 'boot slave' service.
int co_nmt_boot_boot_req(co_nmt_boot_t *boot, co_unsigned8_t id, int timeout, co_csdo_ind_t *dn_ind, co_csdo_ind_t *up_ind, void *data)
Starts a CANopen NMT 'boot slave' service.
co_nmt_boot_t * co_nmt_boot_create(can_net_t *net, co_dev_t *dev, co_nmt_t *nmt)
Creates a new CANopen NMT 'boot slave' service.
This is the internal header file of the NMT 'boot slave' declarations.
void co_nmt_cfg_destroy(co_nmt_cfg_t *cfg)
Destroys a CANopen NMT 'configuration request'.
int co_nmt_cfg_cfg_req(co_nmt_cfg_t *cfg, co_unsigned8_t id, int timeout, co_csdo_ind_t *dn_ind, co_csdo_ind_t *up_ind, void *data)
Starts a CANopen NMT 'configuration request'.
co_nmt_cfg_t * co_nmt_cfg_create(can_net_t *net, co_dev_t *dev, co_nmt_t *nmt)
Creates a new CANopen NMT 'configuration request'.
int co_nmt_cfg_cfg_res(co_nmt_cfg_t *cfg, co_unsigned32_t ac)
Indicates the result of the 'update configuration' step of an NMT 'configuration request'.
This is the internal header file of the NMT 'configuration request' declarations.
void co_nmt_hb_destroy(co_nmt_hb_t *hb)
Destroys a CANopen NMT heartbeat consumer service.
void co_nmt_hb_set_1016(co_nmt_hb_t *hb, co_unsigned8_t id, co_unsigned16_t ms)
Processes the value of CANopen object 1016 (Consumer heartbeat time) for the specified heartbeat cons...
co_nmt_hb_t * co_nmt_hb_create(can_net_t *net, co_nmt_t *nmt)
Creates a new CANopen NMT heartbeat consumer service.
void co_nmt_hb_set_st(co_nmt_hb_t *hb, co_unsigned8_t st)
Sets the expected state of a remote NMT node.
This is the internal header file of the NMT heartbeat consumer declarations.
void co_nmt_srv_set(struct co_nmt_srv *srv, co_nmt_t *nmt, int set)
Enables/disables the specified CANopen services.
void co_nmt_srv_fini(struct co_nmt_srv *srv)
Finalizes a CANopen NMT service manager.
void co_nmt_srv_init(struct co_nmt_srv *srv, co_nmt_t *nmt)
Initializes a CANopen NMT service manager.
This is the internal header file of the NMT service manager declarations.
#define CO_NMT_SRV_LSS
The LSS master/slave service.
This header file is part of the CANopen library; it contains the Receive-PDO declarations.
int co_rpdo_sync(co_rpdo_t *pdo, co_unsigned8_t cnt)
Triggers the actuation of a received synchronous PDO.
This is the internal header file of the CANopen library.
This header file is part of the C11 and POSIX compatibility library; it includes <stdlib....
A CANopen EMCY producer/consumer service.
A CANopen LSS master/slave service.
A CANopen NMT 'boot slave' service.
A CANopen NMT 'configuration request' service.
A CANopen NMT heartbeat consumer.
co_nmt_state_t *(* on_enter)(co_nmt_t *nmt)
A pointer to the function invoked when a new state is entered.
void(* on_leave)(co_nmt_t *nmt)
A pointer to the function invoked when the current state is left.
co_nmt_state_t *(* on_boot)(co_nmt_t *nmt, co_unsigned8_t id, co_unsigned8_t st, char es)
A pointer to the transition function invoked when an 'boot slave' process completes.
co_nmt_state_t *(* on_cs)(co_nmt_t *nmt, co_unsigned8_t cs)
A pointer to the transition function invoked when an NMT command is received.
A CANopen NMT master/slave service.
co_nmt_st_ind_t * st_ind
A pointer to the state change event indication function.
struct timespec inhibit
The time at which the next NMT message may be sent.
co_nmt_hb_t ** hbs
An array of pointers to the heartbeat consumers.
can_timer_t * cs_timer
A pointer to the CAN timer for sending buffered NMT messages.
co_unsigned32_t startup
The NMT startup value (object 1F80).
void * up_data
A pointer to user-specified data for up_ind.
int halt
A flag indicating if the startup procedure was halted because of a mandatory slave boot failure.
co_nmt_sdo_ind_t * dn_ind
A pointer to the SDO download progress indication function.
co_nmt_hb_ind_t * hb_ind
A pointer to the heartbeat event indication function.
int timeout
The default SDO timeout (in milliseconds) used during the NMT 'boot slave' and 'check configuration' ...
void * dcf_comm
The concise DCF of the communication parameters.
co_nmt_boot_ind_t * boot_ind
A pointer to the NMT 'boot slave' indication function.
void * st_data
A pointer to user-specified data for st_ind.
void * cs_data
A pointer to user-specified data for cs_ind.
void * dcf_node
The concise DCF of the application parameters.
co_dev_t * dev
A pointer to a CANopen device.
co_nmt_sdo_ind_t * up_ind
A pointer to the SDO upload progress indication function.
co_unsigned8_t id
The pending node-ID.
void * hb_data
A pointer to user-specified data for hb_ind.
void * sync_data
A pointer to user-specified data for sync_ind.
void * cfg_data
A pointer to user-specified data for cfg_ind.
co_unsigned16_t gt
The guard time (in milliseconds).
co_nmt_lg_ind_t * lg_ind
A pointer to the life guarding event indication function.
struct can_buf buf
A pointer to the CAN frame buffer for NMT messages.
can_net_t * net
A pointer to a CAN network interface.
void * boot_data
A pointer to user-specified data for boot_ind.
co_nmt_ng_ind_t * ng_ind
A pointer to the node guarding event indication function.
can_recv_t * recv_700
A pointer to the CAN frame receiver for NMT error control messages.
void * lg_data
A pointer to user-specified data for lg_ind.
co_unsigned8_t ltf
The lifetime factor.
co_nmt_state_t * state
The current state.
co_unsigned8_t st
The state of the NMT service (including the toggle bit).
void * lss_data
A pointer to user-specified data for lss_req.
co_nmt_sync_ind_t * sync_ind
A pointer to the SYNC indication function.
int master
A flag specifying whether the NMT service is a master or a slave.
co_unsigned16_t ms
The producer heartbeat time (in milliseconds).
can_recv_t * recv_000
A pointer to the CAN frame receiver for NMT messages.
co_nmt_lss_req_t * lss_req
A pointer to the LSS request function.
int lg_state
Indicates whether a life guarding error occurred (CO_NMT_EC_OCCURRED or CO_NMT_EC_RESOLVED).
co_nmt_cfg_ind_t * cfg_ind
A pointer to the NMT 'configuration request' indication function.
struct co_nmt_srv srv
The NMT service manager.
void * ng_data
A pointer to user-specified data for ng_ind.
can_timer_t * ec_timer
A pointer to the CAN timer for life guarding or heartbeat production.
co_unsigned8_t nhb
The number of heartbeat consumers.
struct co_nmt_slave slaves[CO_NUM_NODES]
An array containing the state of each NMT slave.
co_nmt_cs_ind_t * cs_ind
A pointer to the NMT command indication function.
void * dn_data
A pointer to user-specified data for dn_ind.
A CANopen SYNC producer/consumer service.
A CANopen TIME producer/consumer service.
A CAN or CAN FD format frame.
uint_least8_t data[CAN_MSG_MAX_LEN]
The frame payload (in case of a data frame).
uint_least32_t id
The identifier (11 or 29 bits, depending on the CAN_FLAG_IDE flag).
uint_least8_t flags
The flags (any combination of CAN_FLAG_IDE, CAN_FLAG_RTR, CAN_FLAG_EDL, CAN_FLAG_BRS and CAN_FLAG_ESI...
uint_least8_t len
The number of bytes in data (or the requested number of bytes in case of a remote frame).
A struct containing the state of an NMT slave.
co_nmt_boot_t * boot
A pointer to the NMT 'boot slave' service.
void * cfg_data
A pointer to user-specified data for cfg_con.
can_timer_t * timer
A pointer to the CAN timer for node guarding.
co_unsigned8_t ltf
The lifetime factor.
co_unsigned8_t rst
The received state of the slave (including the toggle bit).
can_recv_t * recv
A pointer to the CAN frame receiver for the boot-up event and node guarding messages.
co_unsigned16_t gt
The guard time (in milliseconds).
int ng_state
Indicates whether a node guarding error occurred (CO_NMT_EC_OCCURRED or CO_NMT_EC_RESOLVED).
co_nmt_t * nmt
A pointer to the NMT master service.
co_nmt_cfg_t * cfg
A pointer to the NMT 'update configuration' service.
char es
The error status of the 'boot slave' process.
co_nmt_cfg_con_t * cfg_con
A pointer to the NMT 'configuration request' confirmation function.
co_unsigned32_t assignment
The NMT slave assignment (object 1F81).
co_unsigned8_t rtr
The number of unanswered node guarding RTRs.
int booted
A flag specifying whether the 'boot slave' process has ended.
co_unsigned8_t est
The expected state of the slave (excluding the toggle bit).
A CANopen NMT service manager.
co_tpdo_t ** tpdos
An array of pointers to the Transmit-PDO services.
co_unsigned16_t ntpdo
The number of Transmit-PDO services.
co_lss_t * lss
A pointer to the LSS master/slave service.
co_ssdo_t ** ssdos
An array of pointers to the Server-SDO services.
co_rpdo_t ** rpdos
An array of pointers to the Receive-PDO services.
co_unsigned8_t ncsdo
The number of Client-SDO services.
co_unsigned8_t nssdo
The number of Server-SDO services.
co_time_t * time
A pointer to the TIME producer/consumer service.
co_csdo_t ** csdos
An array of pointers to the Client-SDO services.
co_emcy_t * emcy
A pointer to the EMCY producer/consumer service.
co_unsigned16_t nrpdo
The number of Receive-PDO services.
co_sync_t * sync
A pointer to the SYNC producer/consumer service.
A CANopen SDO upload/download request.
A time type with nanosecond resolution.
This header file is part of the CANopen library; it contains the Transmit-PDO declarations.
int co_tpdo_sync(co_tpdo_t *pdo, co_unsigned8_t cnt)
Triggers the transmission of a synchronous PDO.
#define CO_DEFTYPE_UNSIGNED16
The data type (and object index) of a 16-bit unsigned integer.
#define CO_DEFTYPE_DOMAIN
The data type (and object index) of an arbitrary large block of data.
#define CO_DEFTYPE_UNSIGNED8
The data type (and object index) of an 8-bit unsigned integer.
#define CO_DEFTYPE_UNSIGNED32
The data type (and object index) of a 32-bit unsigned integer.
A union of the CANopen static data types.
This header file is part of the utilities library; it contains the time function declarations.
int timespec_cmp(const void *p1, const void *p2)
Compares two times.
void timespec_add_usec(struct timespec *tp, uint_least64_t usec)
Adds usec microseconds to the time at tp.
This header file is part of the CANopen library; it contains the CANopen value declarations.
void co_val_fini(co_unsigned16_t type, void *val)
Finalizes a value of the specified data type.