Lely core libraries 2.3.4
nmt.h File Reference

This header file is part of the CANopen library; it contains the network management (NMT) declarations. More...

#include <lely/can/net.h>
#include <lely/co/type.h>
Include dependency graph for nmt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LELY_CO_NMT_TIMEOUT   100
 The default SDO timeout (in milliseconds) for the NMT 'boot slave' and 'check configuration' processes.
 
#define CO_NMT_CS_CANID   0x000
 The CAN identifier used for NMT commands.
 
#define CO_NMT_CS_START   0x01
 The NMT command specifier 'start'.
 
#define CO_NMT_CS_STOP   0x02
 The NMT command specifier 'stop'.
 
#define CO_NMT_CS_ENTER_PREOP   0x80
 The NMT command specifier 'enter pre-operational'.
 
#define CO_NMT_CS_RESET_NODE   0x81
 The NMT command specifier 'reset node'.
 
#define CO_NMT_CS_RESET_COMM   0x82
 The NMT command specifier 'reset communication'.
 
#define CO_NMT_ST_BOOTUP   0x00
 The NMT state 'boot-up'.
 
#define CO_NMT_ST_STOP   0x04
 The NMT state 'stopped'.
 
#define CO_NMT_ST_START   0x05
 The NMT state 'operational'.
 
#define CO_NMT_ST_RESET_NODE   0x06
 The NMT sub-state 'reset application'.
 
#define CO_NMT_ST_RESET_COMM   0x07
 The NMT sub-state 'reset communication'.
 
#define CO_NMT_ST_PREOP   0x7f
 The NMT state 'pre-operational'.
 
#define CO_NMT_ST_TOGGLE   0x80
 The mask to get/set the toggle bit from an NMT state.
 
#define CO_NMT_EC_CANID(id)   (0x700 + ((id)&0x7f))
 The CAN identifier used for both node guarding and heartbeat monitoring.
 

Typedefs

typedef 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 after the state switch has occurred).
 
typedef 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 occurs (see sections 7.2.8.2.2.1 and 7.2.8.3.2.1 in CiA 301 version 4.2.0).
 
typedef 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 occurs (see section 7.2.8.2.2.2 in CiA 301 version 4.2.0).
 
typedef 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 sections 7.2.8.2.2.3 and 7.2.8.3.2.2 in CiA 301 version 4.2.0).
 
typedef 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 by the node guarding or heartbeat protocol.
 
typedef 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 Fig.
 
typedef 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 completes.
 
typedef 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 request is received.
 
typedef 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 configuration request completes (with success or failure).
 
typedef 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 the user of the progress of the an SDO upload/download request during the 'boot slave' process.
 
typedef 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/processed upon reception/transmission of a SYNC message.
 

Enumerations

enum  { CO_NMT_EC_OCCURRED , CO_NMT_EC_RESOLVED }
 
enum  { CO_NMT_EC_TIMEOUT , CO_NMT_EC_STATE }
 

Functions

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 heartbeat time).
 
const char * co_nmt_es2str (char es)
 Returns a pointer to a string describing an NMT boot error status.
 
co_nmt_tco_nmt_create (can_net_t *net, co_dev_t *dev)
 Creates a new CANopen NMT master/slave service.
 
void co_nmt_destroy (co_nmt_t *nmt)
 Destroys a CANopen NMT master/slave service.
 
can_net_tco_nmt_get_net (const co_nmt_t *nmt)
 Returns a pointer to the CAN network of an NMT master/slave service.
 
co_dev_tco_nmt_get_dev (const co_nmt_t *nmt)
 Returns a pointer to the CANopen device of an NMT master/slave service.
 
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_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.
 
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.
 
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.
 
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.2.8.2.2.1 and 7.2.8.3.2.1 in CiA 301 version 4.2.0).
 
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_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.
 
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.8.2.2.2 in CiA 301 version 4.2.0).
 
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.
 
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.
 
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.2.2.3 and 7.2.8.3.2.2 in CiA 301 version 4.2.0).
 
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.
 
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_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 protocol.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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_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 request during the CANopen NMT 'boot slave' process.
 
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 request during the CANopen NMT 'boot slave' process.
 
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 request during the CANopen NMT 'boot slave' process.
 
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 request during the CANopen NMT 'boot slave' 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/processed.
 
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/processed.
 
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.
 
void co_nmt_on_err (co_nmt_t *nmt, co_unsigned16_t eec, co_unsigned8_t er, const co_unsigned8_t msef[5])
 Implements the default error handling behavior by generating an EMCY message with co_emcy_push() and invoking co_nmt_comm_err_ind() in case of a communication error (emergency error code 0x81xx).
 
void co_nmt_on_tpdo_event (co_nmt_t *nmt, co_unsigned16_t n)
 Implements the default behavior when an event is indicated for an event-driven (asynchronous) Transmit-PDO by triggering the transmission of the PDO with co_tpdo_event().
 
void co_nmt_on_tpdo_event_lock (co_nmt_t *nmt)
 Postpones the transmission of PDOs triggered by co_nmt_on_tpdo_event() until a matching call to co_nmt_on_tpdo_event_unlock().
 
void co_nmt_on_tpdo_event_unlock (co_nmt_t *nmt)
 Undoes the effect of a single call to co_nmt_on_tpdo_event_lock() and possibly triggers the transmission of postponed PDOs.
 
void co_nmt_on_sam_mpdo_event (co_nmt_t *nmt, co_unsigned16_t n, co_unsigned16_t idx, co_unsigned8_t subidx)
 Implements the default behavior when an event is indicated for a source address mode multiplex PDO by triggering the transmission of the PDO with co_sam_mpdo_event().
 
co_unsigned8_t co_nmt_get_id (const co_nmt_t *nmt)
 Returns the pending node-ID.
 
int co_nmt_set_id (co_nmt_t *nmt, co_unsigned8_t id)
 Sets the pending node-ID.
 
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, CO_NMT_ST_START, CO_NMT_ST_RESET_NODE, CO_NMT_ST_RESET_COMM or CO_NMT_ST_PREOP).
 
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.
 
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.
 
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.
 
int co_nmt_cs_req (co_nmt_t *nmt, co_unsigned8_t cs, co_unsigned8_t id)
 Submits an NMT request to a slave.
 
int co_nmt_lss_con (co_nmt_t *nmt)
 Confirms the completion of the process when booting an NMT master.
 
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.
 
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, and 0 if not.
 
int co_nmt_chk_bootup (const co_nmt_t *nmt, co_unsigned8_t id)
 Checks if a boot-up message has been received from the specified node(s).
 
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.
 
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 the specified node (see Fig.
 
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.
 
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_comm_err_ind (co_nmt_t *nmt)
 Indicates the occurrence of a communication error and invokes the specified error behavior (object 1029:01).
 
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.
 
co_rpdo_tco_nmt_get_rpdo (const co_nmt_t *nmt, co_unsigned16_t n)
 Returns a pointer to a Receive-PDO service.
 
co_tpdo_tco_nmt_get_tpdo (const co_nmt_t *nmt, co_unsigned16_t n)
 Returns a pointer to a Transmit-PDO service.
 
co_ssdo_tco_nmt_get_ssdo (const co_nmt_t *nmt, co_unsigned8_t n)
 Returns a pointer to a Server-SDO service.
 
co_csdo_tco_nmt_get_csdo (const co_nmt_t *nmt, co_unsigned8_t n)
 Returns a pointer to a Client-SDO service.
 
co_sync_tco_nmt_get_sync (const co_nmt_t *nmt)
 Returns a pointer to the SYNC producer/consumer service.
 
co_time_tco_nmt_get_time (const co_nmt_t *nmt)
 Returns a pointer to the TIME producer/consumer service.
 
co_emcy_tco_nmt_get_emcy (const co_nmt_t *nmt)
 Returns a pointer to the EMCY producer/consumer service.
 
co_lss_tco_nmt_get_lss (const co_nmt_t *nmt)
 Returns a pointer to the LSS master/slave service.
 

Detailed Description

This header file is part of the CANopen library; it contains the network management (NMT) declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file nmt.h.

Typedef Documentation

◆ co_nmt_cs_ind_t

typedef 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 after the state switch has occurred).

Since the indication function is invoked during an NMT state transition, it is NOT safe to invoke co_nmt_cs_ind() (or co_nmt_cs_req() with the node-ID of the master) from this function.

Parameters
nmta pointer to an NMT master/slave service.
csthe NMT command specifier (one of CO_NMT_CS_START, CO_NMT_CS_STOP, CO_NMT_CS_ENTER_PREOP, CO_NMT_CS_RESET_NODE or CO_NMT_CS_RESET_COMM).
dataa pointer to user-specified data.

Definition at line 110 of file nmt.h.

◆ co_nmt_ng_ind_t

typedef 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 occurs (see sections 7.2.8.2.2.1 and 7.2.8.3.2.1 in CiA 301 version 4.2.0).

The default handler invokes co_nmt_on_ng().

Parameters
nmta pointer to an NMT master service.
idthe node-ID (in the range [1..127]).
stateindicates whether the event occurred (CO_NMT_EC_OCCURRED) or was resolved (CO_NMT_EC_RESOLVED).
reasonindicates whether the event occurred because of a timeout (CO_NMT_EC_TIMEOUT) or an unexpected state change (CO_NMT_EC_STATE).
dataa pointer to user-specified data.

Definition at line 126 of file nmt.h.

◆ co_nmt_lg_ind_t

typedef 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 occurs (see section 7.2.8.2.2.2 in CiA 301 version 4.2.0).

The default handler invokes co_nmt_on_lg().

Parameters
nmta pointer to an NMT slave service.
stateindicates whether the event occurred (CO_NMT_EC_OCCURRED) or was resolved (CO_NMT_EC_RESOLVED).
dataa pointer to user-specified data.

Definition at line 139 of file nmt.h.

◆ co_nmt_hb_ind_t

typedef 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 sections 7.2.8.2.2.3 and 7.2.8.3.2.2 in CiA 301 version 4.2.0).

The default handler invokes co_nmt_on_hb().

Parameters
nmta pointer to an NMT master/slave service.
idthe node-ID (in the range [1..127]).
stateindicates whether the event occurred (CO_NMT_EC_OCCURRED) or was resolved (CO_NMT_EC_RESOLVED). Note that heartbeat state change events only occur and are never resolved.
reasonindicates whether the event occurred because of a timeout (CO_NMT_EC_TIMEOUT) or a state change (CO_NMT_EC_STATE).
dataa pointer to user-specified data.

Definition at line 155 of file nmt.h.

◆ co_nmt_st_ind_t

typedef 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 by the node guarding or heartbeat protocol.

This indication is an extension of the boot-up event indication (sections 7.2.8.2.3.1 and 7.2.8.3.3 in CiA 301 version 4.2.0) since it reports all state changes, not just the boot-up event. The default handler invokes co_nmt_on_st().

This indication function is also invoked by an NMT master/slave service to notify the user of its own state changes. It that case it is NOT safe to invoke co_nmt_cs_ind() (or co_nmt_cs_req() with the node-ID of the master) from this function.

Parameters
nmta pointer to an NMT master/slave service.
idthe node-ID (in the range [1..127]).
stthe state of the node (excluding the toggle bit).
dataa pointer to user-specified data.

Definition at line 176 of file nmt.h.

◆ co_nmt_lss_req_t

typedef 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 Fig.

1 in CiA 302-2 version 4.1.0). This function MUST cause co_nmt_lss_con() to be invoked once the LSS process completes.

Parameters
nmta pointer to an NMT master service.
lssa pointer to an LSS master service.
dataa pointer to user-specified data.

Definition at line 188 of file nmt.h.

◆ co_nmt_boot_ind_t

typedef 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 completes.

Parameters
nmta pointer to an NMT master service.
idthe node-ID of the slave (in the range [1..127]).
stthe state of the node (including the toggle bit).
esthe error status (in the range ['A'..'O'], or 0 on success).
dataa pointer to user-specified data.

Definition at line 200 of file nmt.h.

◆ co_nmt_cfg_ind_t

typedef 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 request is received.

This function MUST cause co_nmt_cfg_res() to be invoked once the 'update configuration' step completes (with success or failure).

Parameters
nmta pointer to an NMT master service.
idthe node-ID of the slave (in the range [1..127]).
sdoa pointer to a Client-SDO connected to the slave.
dataa pointer to user-specified data.

Definition at line 214 of file nmt.h.

◆ co_nmt_cfg_con_t

typedef 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 configuration request completes (with success or failure).

Parameters
nmta pointer to an NMT master service.
idthe node-ID of the slave (in the range [1..127]).
acthe SDO abort code (0 on success).
dataa pointer to user-specified data.

Definition at line 227 of file nmt.h.

◆ co_nmt_sdo_ind_t

typedef 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 the user of the progress of the an SDO upload/download request during the 'boot slave' process.

Parameters
nmta pointer to an NMT master service.
idthe node-ID of the slave (in the range [1..127]).
idxthe object index.
subidxthe object sub-index.
sizeThe total size (in bytes) of the value being uploaded/downloaded.
nbyteThe number of bytes already uploaded/downloaded.
dataa pointer to user-specified data.
See also
co_csdo_ind_t

Definition at line 246 of file nmt.h.

◆ co_nmt_sync_ind_t

typedef 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/processed upon reception/transmission of a SYNC message.

Parameters
nmta pointer to an NMT master/slave service.
cntthe counter.
dataa pointer to user-specified data.
See also
co_sync_ind_t

Definition at line 260 of file nmt.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CO_NMT_EC_OCCURRED 

An NMT error control event occurred.

CO_NMT_EC_RESOLVED 

An NMT error control event was resolved.

Definition at line 78 of file nmt.h.

◆ anonymous enum

anonymous enum
Enumerator
CO_NMT_EC_TIMEOUT 

An NMT error control timeout event.

CO_NMT_EC_STATE 

An NMT error control state change event.

Definition at line 85 of file nmt.h.

Function Documentation

◆ co_dev_cfg_hb()

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 heartbeat time).

Parameters
deva pointer to a CANopen device.
idthe node-ID (in the range [1..127]).
msthe heartbeat time (in milliseconds). If ms is 0, the heartbeat consumer is disabled.
Returns
0 on success, or an SDO abort code on error.

Definition at line 744 of file nmt.c.

◆ co_nmt_create()

co_nmt_t * co_nmt_create ( can_net_t net,
co_dev_t dev 
)

Creates a new CANopen NMT master/slave service.

Parameters
neta pointer to a CAN network.
deva pointer to a CANopen device.
Returns
a pointer to a new NMT service, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
co_nmt_destroy()

Definition at line 1233 of file nmt.c.

◆ co_nmt_destroy()

void co_nmt_destroy ( co_nmt_t nmt)

Destroys a CANopen NMT master/slave service.

See also
co_nmt_create()

Definition at line 1258 of file nmt.c.

◆ co_nmt_get_cs_ind()

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.

Parameters
nmta pointer to an NMT master/slave service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_cs_ind()

Definition at line 1283 of file nmt.c.

◆ co_nmt_set_cs_ind()

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.

Parameters
nmta pointer to an NMT master/slave service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_cs_ind()

Definition at line 1294 of file nmt.c.

◆ co_nmt_get_ng_ind()

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.

Parameters
nmta pointer to an NMT master service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_ng_ind()

Definition at line 1307 of file nmt.c.

◆ co_nmt_set_ng_ind()

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.

Parameters
nmta pointer to an NMT master service.
inda pointer to the function to be invoked. If ind is NULL, the default indication function will be used (which invokes co_nmt_on_ng()).
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_ng_ind()

Definition at line 1318 of file nmt.c.

◆ co_nmt_on_ng()

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.2.8.2.2.1 and 7.2.8.3.2.1 in CiA 301 version 4.2.0).

This function invokes co_nmt_comm_err_ind() when an event occurs.

See also
co_nmt_ng_ind_t

Definition at line 1327 of file nmt.c.

◆ co_nmt_get_lg_ind()

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.

Parameters
nmta pointer to an NMT slave service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_lg_ind()

Definition at line 1342 of file nmt.c.

◆ co_nmt_set_lg_ind()

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.

Parameters
nmta pointer to an NMT slave service.
inda pointer to the function to be invoked. If ind is NULL, the default indication function will be used (which invokes co_nmt_on_lg()).
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_lg_ind()

Definition at line 1353 of file nmt.c.

◆ co_nmt_on_lg()

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.8.2.2.2 in CiA 301 version 4.2.0).

This function invokes co_nmt_comm_err_ind() when an event occurs.

See also
co_nmt_lg_ind_t

Definition at line 1362 of file nmt.c.

◆ co_nmt_get_hb_ind()

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.

Parameters
nmta pointer to an NMT master/slave service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_hb_ind()

Definition at line 1381 of file nmt.c.

◆ co_nmt_set_hb_ind()

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.

Parameters
nmta pointer to an NMT master/slave service.
inda pointer to the function to be invoked. If ind is NULL, the default indication function will be used (which invokes co_nmt_on_hb()).
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_hb_ind()

Definition at line 1392 of file nmt.c.

◆ co_nmt_on_hb()

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.2.2.3 and 7.2.8.3.2.2 in CiA 301 version 4.2.0).

This function invokes co_nmt_node_err_ind() or co_nmt_comm_err_ind() when a timeout event occurs, depending on whether the NMT service is a master or not (see co_nmt_is_master()).

See also
co_nmt_hb_ind_t

Definition at line 1401 of file nmt.c.

◆ co_nmt_get_st_ind()

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.

Parameters
nmta pointer to an NMT master/slave service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_st_ind()

Definition at line 1434 of file nmt.c.

◆ co_nmt_set_st_ind()

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.

Parameters
nmta pointer to an NMT master/slave service.
inda pointer to the function to be invoked. If ind is NULL, the default indication function will be used (which invokes co_nmt_on_st()).
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_st_ind()

Definition at line 1445 of file nmt.c.

◆ co_nmt_on_st()

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 protocol.

In case of a boot-up event (and the NMT service is a master), this function invokes co_nmt_boot_req() to boot the slave (see Fig. 13 in CiA 302-2).

See also
co_nmt_st_ind_t

Definition at line 1454 of file nmt.c.

◆ co_nmt_get_lss_req()

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.

Parameters
nmta pointer to an NMT master service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_lss_req()

Definition at line 1478 of file nmt.c.

◆ co_nmt_set_lss_req()

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.

Setting this function means LSS is required (see Fig. 1 in CiA 302-2 version 4.1.0).

Parameters
nmta pointer to an NMT master service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_lss_req()

Definition at line 1489 of file nmt.c.

◆ co_nmt_get_boot_ind()

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.

Parameters
nmta pointer to an NMT master service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_boot_ind()

Definition at line 1502 of file nmt.c.

◆ co_nmt_set_boot_ind()

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.

Parameters
nmta pointer to an NMT master service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_boot_ind()

Definition at line 1513 of file nmt.c.

◆ co_nmt_get_cfg_ind()

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.

Parameters
nmta pointer to an NMT master service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_cfg_ind()

Definition at line 1526 of file nmt.c.

◆ co_nmt_set_cfg_ind()

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.

Parameters
nmta pointer to an NMT master service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_cfg_ind()

Definition at line 1537 of file nmt.c.

◆ co_nmt_get_dn_ind()

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 request during the CANopen NMT 'boot slave' process.

Parameters
nmta pointer to an NMT master service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_dn_ind()

Definition at line 1548 of file nmt.c.

◆ co_nmt_set_dn_ind()

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 request during the CANopen NMT 'boot slave' process.

Parameters
nmta pointer to an NMT master service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_dn_ind()

Definition at line 1559 of file nmt.c.

◆ co_nmt_get_up_ind()

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 request during the CANopen NMT 'boot slave' process.

Parameters
nmta pointer to an NMT master service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_up_ind()

Definition at line 1568 of file nmt.c.

◆ co_nmt_set_up_ind()

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 request during the CANopen NMT 'boot slave' process.

Parameters
nmta pointer to an NMT master service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_up_ind()

Definition at line 1579 of file nmt.c.

◆ co_nmt_get_sync_ind()

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/processed.

Parameters
nmta pointer to an NMT master/slave service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_nmt_set_sync_ind()

Definition at line 1590 of file nmt.c.

◆ co_nmt_set_sync_ind()

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/processed.

Parameters
nmta pointer to an NMT master/slave service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_nmt_get_sync_ind()

Definition at line 1601 of file nmt.c.

◆ co_nmt_on_sync()

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.

First all synchronous Transmit-PDOs are sent with co_tpdo_sync(). Then all synchronous Receive-PDOs are actuated with co_rpdo_sync(). Finally the user-defined callback function set with co_nmt_set_sync_ind() is invoked.

See also
co_sync_ind_t, co_nmt_sync_ind_t

Definition at line 1610 of file nmt.c.

◆ co_nmt_on_err()

void co_nmt_on_err ( co_nmt_t nmt,
co_unsigned16_t  eec,
co_unsigned8_t  er,
const co_unsigned8_t  msef[5] 
)

Implements the default error handling behavior by generating an EMCY message with co_emcy_push() and invoking co_nmt_comm_err_ind() in case of a communication error (emergency error code 0x81xx).

See also
co_rpdo_err_t, co_sync_err_t

Definition at line 1636 of file nmt.c.

◆ co_nmt_on_tpdo_event()

void co_nmt_on_tpdo_event ( co_nmt_t nmt,
co_unsigned16_t  n 
)

Implements the default behavior when an event is indicated for an event-driven (asynchronous) Transmit-PDO by triggering the transmission of the PDO with co_tpdo_event().

The transmission of PDOs can be postponed with co_nmt_on_tpdo_event_lock().

Parameters
nmta pointer to an NMT master/slave service.
nthe PDO number (in the range [1..512]). If n is 0, the transmission of all PDOs is triggered.
See also
co_dev_tpdo_event_ind_t

Definition at line 1659 of file nmt.c.

◆ co_nmt_on_tpdo_event_lock()

void co_nmt_on_tpdo_event_lock ( co_nmt_t nmt)

Postpones the transmission of PDOs triggered by co_nmt_on_tpdo_event() until a matching call to co_nmt_on_tpdo_event_unlock().

This function can be invoked multiple times. PDO transmission will resume after an equal number of calls to co_nmt_on_tpdo_event_unlock().

Definition at line 1690 of file nmt.c.

◆ co_nmt_on_sam_mpdo_event()

void co_nmt_on_sam_mpdo_event ( co_nmt_t nmt,
co_unsigned16_t  n,
co_unsigned16_t  idx,
co_unsigned8_t  subidx 
)

Implements the default behavior when an event is indicated for a source address mode multiplex PDO by triggering the transmission of the PDO with co_sam_mpdo_event().

Parameters
nmta pointer to an NMT master/slave service.
nthe PDO number (in the range [1..512]).
idxthe object index.
subidxthe object sub-index.
See also
co_dev_sam_mpdo_event_ind_t

Definition at line 1729 of file nmt.c.

◆ co_nmt_get_id()

co_unsigned8_t co_nmt_get_id ( const co_nmt_t nmt)

Returns the pending node-ID.

See also
co_nmt_set_id()

Definition at line 1743 of file nmt.c.

◆ co_nmt_set_id()

int co_nmt_set_id ( co_nmt_t nmt,
co_unsigned8_t  id 
)

Sets the pending node-ID.

The node-ID of the device will be updated once the NMT 'reset communication command' is received. This is used for the LSS configure node-ID protocol.

Parameters
nmta pointer to an NMT master/slave service.
idthe node-ID of the device (in the range [1..127, 255]).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_nmt_get_id(), co_dev_set_id()

Definition at line 1751 of file nmt.c.

◆ co_nmt_get_timeout()

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.

See also
co_nmt_set_timeout()

Definition at line 1790 of file nmt.c.

◆ co_nmt_set_timeout()

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.

Parameters
nmta pointer to an NMT master service.
timeoutthe SDO timeout (in milliseconds). See co_csdo_set_timeout().
See also
co_nmt_get_timeout()

Definition at line 1798 of file nmt.c.

◆ co_nmt_cs_req()

int co_nmt_cs_req ( co_nmt_t nmt,
co_unsigned8_t  cs,
co_unsigned8_t  id 
)

Submits an NMT request to a slave.

If id equals the node-ID of the master, this is equivalent to co_nmt_cs_ind(nmt, cs).

Parameters
nmta pointer to an NMT master service.
csthe NMT command specifier (one of CO_NMT_CS_START, CO_NMT_CS_STOP, CO_NMT_CS_ENTER_PREOP, CO_NMT_CS_RESET_NODE or CO_NMT_CS_RESET_COMM).
idthe node-ID (0 for all nodes, [1..127] for a specific slave).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 1806 of file nmt.c.

◆ co_nmt_lss_con()

int co_nmt_lss_con ( co_nmt_t nmt)

Confirms the completion of the process when booting an NMT master.

The function specified to co_nmt_set_lss_req() MUST cause this function to be invoked.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 1853 of file nmt.c.

◆ co_nmt_boot_req()

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.

The function specified to co_nmt_set_boot_ind() is invoked on completion.

Parameters
nmta pointer to an NMT master service.
idthe node-ID (in the range [1..127]).
timeoutthe SDO timeout (in milliseconds). See co_csdo_set_timeout().
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 1871 of file nmt.c.

◆ co_nmt_chk_bootup()

int co_nmt_chk_bootup ( const co_nmt_t nmt,
co_unsigned8_t  id 
)

Checks if a boot-up message has been received from the specified node(s).

Parameters
nmta pointer to an NMT master service.
idthe node-ID (0 for all mandatory nodes, [1..127] for a specific slave).
Returns
1 if a boot-up message was received, 0 if not, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 1946 of file nmt.c.

◆ co_nmt_cfg_req()

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.

The function specified to co_nmt_set_cfg_ind() is invoked to complete the request.

Parameters
nmta pointer to an NMT master service.
idthe node-ID (0 for all nodes, [1..127] for a specific slave).
timeoutthe SDO timeout (in milliseconds). See co_csdo_set_timeout().
cona pointer to the confirmation function (can be NULL).
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to con.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 1979 of file nmt.c.

◆ co_nmt_cfg_res()

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 the specified node (see Fig.

8 in CiA 302-2 version 4.1.0). This function MUST be called upon completion.

Parameters
nmta pointer to an NMT master service.
idthe node-ID (in the range [1..127]).
acthe SDO abort code (0 on success).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 2040 of file nmt.c.

◆ co_nmt_ng_req()

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.

If the guard time or lifetime factor is 0, node guarding is disabled.

Parameters
nmta pointer to an NMT master service.
idthe node-ID (in the range [1..127]).
gtthe guard time (in milliseconds).
ltfthe lifetime factor.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 2061 of file nmt.c.

◆ co_nmt_cs_ind()

int co_nmt_cs_ind ( co_nmt_t nmt,
co_unsigned8_t  cs 
)

Processes an NMT command from the master or the application.

Note that this function MAY trigger a reset of one or more CANopen services and invalidate previously obtained results of co_nmt_get_rpdo(), co_nmt_get_tpdo(), co_nmt_get_ssdo(), co_nmt_get_csdo(), co_nmt_get_sync(), co_nmt_get_time() and/or co_nmt_get_emcy().

This function MUST NOT be invoked during an NMT state transition. It is therefore unsafe to call co_nmt_cs_ind() (or co_nmt_cs_req() with the node-ID of the master) from the co_nmt_cs_ind_t and co_nmt_st_ind_t indication functions.

Parameters
nmta pointer to an NMT master/slave service.
csthe NMT command specifier (one of CO_NMT_CS_START, CO_NMT_CS_STOP, CO_NMT_CS_ENTER_PREOP, CO_NMT_CS_RESET_NODE or CO_NMT_CS_RESET_COMM).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 2098 of file nmt.c.

◆ co_nmt_comm_err_ind()

void co_nmt_comm_err_ind ( co_nmt_t nmt)

Indicates the occurrence of a communication error and invokes the specified error behavior (object 1029:01).

Note that this function MAY invoke co_nmt_cs_ind().

Definition at line 2116 of file nmt.c.

◆ co_nmt_node_err_ind()

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.

12 in CiA 302-2 version 4.1.0). Note that this function MAY invoke co_nmt_cs_ind().

Parameters
nmta pointer to an NMT master service.
idthe node-ID (in the range [1..127]).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 2132 of file nmt.c.

◆ co_nmt_get_rpdo()

co_rpdo_t * co_nmt_get_rpdo ( const co_nmt_t nmt,
co_unsigned16_t  n 
)

Returns a pointer to a Receive-PDO service.

Parameters
nmta pointer to an NMT master/slave service.
nthe PDO number (in the range [1..512]).

Definition at line 2175 of file nmt.c.

◆ co_nmt_get_tpdo()

co_tpdo_t * co_nmt_get_tpdo ( const co_nmt_t nmt,
co_unsigned16_t  n 
)

Returns a pointer to a Transmit-PDO service.

Parameters
nmta pointer to an NMT master/slave service.
nthe PDO number (in the range [1..512]).

Definition at line 2193 of file nmt.c.

◆ co_nmt_get_ssdo()

co_ssdo_t * co_nmt_get_ssdo ( const co_nmt_t nmt,
co_unsigned8_t  n 
)

Returns a pointer to a Server-SDO service.

Parameters
nmta pointer to an NMT master/slave service.
nthe SDO number (in the range [1..128]).

Definition at line 2211 of file nmt.c.

◆ co_nmt_get_csdo()

co_csdo_t * co_nmt_get_csdo ( const co_nmt_t nmt,
co_unsigned8_t  n 
)

Returns a pointer to a Client-SDO service.

Parameters
nmta pointer to an NMT master/slave service.
nthe SDO number (in the range [1..128]).

Definition at line 2222 of file nmt.c.