29#define CO_GW_NUM_NET 127
32#define CO_GW_PROT_HI 2
35#define CO_GW_PROT_LO 0
38#define CO_GW_SRV_SDO_UP 0x11
41#define CO_GW_SRV_SDO_DN 0x13
44#define CO_GW_SRV_SET_SDO_TIMEOUT 0x14
47#define CO_GW_SRV_SET_RPDO 0x21
50#define CO_GW_SRV_SET_TPDO 0x22
53#define CO_GW_SRV_PDO_READ 0x23
56#define CO_GW_SRV_PDO_WRITE 0x24
59#define CO_GW_SRV_RPDO 0x25
62#define CO_GW_SRV_NMT_START 0x31
65#define CO_GW_SRV_NMT_STOP 0x32
68#define CO_GW_SRV_NMT_ENTER_PREOP 0x33
71#define CO_GW_SRV_NMT_RESET_NODE 0x34
74#define CO_GW_SRV_NMT_RESET_COMM 0x35
77#define CO_GW_SRV_NMT_NG_ENABLE 0x36
80#define CO_GW_SRV_NMT_NG_DISABLE 0x37
83#define CO_GW_SRV_NMT_HB_ENABLE 0x38
86#define CO_GW_SRV_NMT_HB_DISABLE 0x39
89#define CO_GW_SRV_EC 0x3a
92#define CO_GW_SRV_EMCY 0x42
95#define CO_GW_SRV_INIT 0x51
98#define CO_GW_SRV_SET_HB 0x54
101#define CO_GW_SRV_SET_ID 0x55
104#define CO_GW_SRV_EMCY_START 0x56
107#define CO_GW_SRV_EMCY_STOP 0x57
110#define CO_GW_SRV_SET_CMD_TIMEOUT 0x58
113#define CO_GW_SRV_SET_BOOTUP_IND 0x59
116#define CO_GW_SRV_SET_NET 0x61
119#define CO_GW_SRV_SET_NODE 0x62
122#define CO_GW_SRV_GET_VERSION 0x63
125#define CO_GW_SRV_SET_CMD_SIZE 0x64
128#define CO_GW_SRV_LSS_SWITCH 0x81
131#define CO_GW_SRV_LSS_SWITCH_SEL 0x82
134#define CO_GW_SRV_LSS_SET_ID 0x83
137#define CO_GW_SRV_LSS_SET_RATE 0x84
140#define CO_GW_SRV_LSS_SWITCH_RATE 0x85
143#define CO_GW_SRV_LSS_STORE 0x86
146#define CO_GW_SRV_LSS_GET_LSSID 0x87
149#define CO_GW_SRV_LSS_GET_ID 0x88
152#define CO_GW_SRV_LSS_ID_SLAVE 0x89
155#define CO_GW_SRV_LSS_ID_NON_CFG_SLAVE 0x8a
158#define CO_GW_SRV_SDO 0x93
161#define CO_GW_SRV__LSS_SLOWSCAN 0x101
164#define CO_GW_SRV__LSS_FASTSCAN 0x102
167#define CO_GW_SRV__SYNC 0x103
170#define CO_GW_SRV__TIME 0x104
173#define CO_GW_SRV__BOOT 0x105
176#define CO_GW_IEC_BAD_SRV 100
179#define CO_GW_IEC_SYNTAX 101
182#define CO_GW_IEC_INTERN 102
185#define CO_GW_IEC_TIMEOUT 103
188#define CO_GW_IEC_NO_DEF_NET 104
191#define CO_GW_IEC_NO_DEF_NODE 105
194#define CO_GW_IEC_BAD_NET 106
197#define CO_GW_IEC_BAD_NODE 107
200#define CO_GW_IEC_NG_OCCURRED 200
203#define CO_GW_IEC_LG_OCCURRED 201
206#define CO_GW_IEC_HB_RESOLVED 202
209#define CO_GW_IEC_HB_OCCURRED 203
212#define CO_GW_IEC_ST_OCCURRED 204
215#define CO_GW_IEC_BOOTUP 205
218#define CO_GW_IEC_CAN_PASSIVE 300
221#define CO_GW_IEC_CAN_BUSOFF 301
224#define CO_GW_IEC_CAN_OVERFLOW 303
227#define CO_GW_IEC_CAN_INIT 304
230#define CO_GW_IEC_CAN_ACTIVE 305
233#define CO_GW_IEC_PDO_INUSE 400
236#define CO_GW_IEC_PDO_LEN 401
239#define CO_GW_IEC_LSS 501
242#define CO_GW_IEC_LSS_ID 502
245#define CO_GW_IEC_LSS_RATE 503
248#define CO_GW_IEC_LSS_PARAM 504
251#define CO_GW_IEC_LSS_MEDIA 505
254#define CO_GW_IEC_NO_MEM 600
257#if !defined(__cplusplus) || LELY_NO_CXX
349#define CO_GW_REQ_SDO_DN_SIZE offsetof(struct co_gw_req_sdo_dn, val)
384 co_unsigned32_t
map[0x40];
388#define CO_GW_REQ_SET_RPDO_SIZE offsetof(struct co_gw_req_set_rpdo, map)
415 co_unsigned32_t
map[0x40];
419#define CO_GW_REQ_SET_TPDO_SIZE offsetof(struct co_gw_req_set_tpdo, map)
450 co_unsigned64_t
val[0x40];
454#define CO_GW_REQ_PDO_WRITE_SIZE offsetof(struct co_gw_req_pdo_write, val)
725#define CO_GW_CON_SDO_UP_SIZE offsetof(struct co_gw_con_sdo_up, val)
746 co_unsigned64_t
val[0x40];
750#define CO_GW_CON_PDO_READ_SIZE offsetof(struct co_gw_con_pdo_read, val)
847 co_unsigned64_t
val[0x40];
851#define CO_GW_IND_RPDO_SIZE offsetof(struct co_gw_ind_rpdo, val)
987 co_unsigned16_t net, co_unsigned16_t rate,
void *data);
992void *__co_gw_alloc(
void);
993void __co_gw_free(
void *ptr);
995void __co_gw_fini(
struct __co_gw *gw);
This header file is part of the CANopen library; it contains the device description declarations.
int co_gw_recv(co_gw_t *gw, const struct co_gw_req *req)
Receives and processes a request with a CANopen gateway.
void co_gw_set_rate_func(co_gw_t *gw, co_gw_rate_func_t *func, void *data)
Sets the callback function invoked when a baudrate switch is needed after an 'Initialize gateway' com...
co_gw_t * co_gw_create(void)
Creates a new CANopen gateway.
int co_gw_init_net(co_gw_t *gw, co_unsigned16_t id, co_nmt_t *nmt)
Registers a CANopen network with a gateway.
const char * co_gw_iec2str(int iec)
Returns a string describing an internal error code.
void co_gw_get_rate_func(const co_gw_t *gw, co_gw_rate_func_t **pfunc, void **pdata)
Retrieves the callback function invoked when a baudrate switch is needed after an 'Initialize gateway...
int co_gw_send_func_t(const struct co_gw_srv *srv, void *data)
The type of a CANopen gateway send callback function, invoked by a gateway when an indication or conf...
int co_gw_fini_net(co_gw_t *gw, co_unsigned16_t id)
Unregisters a CANopen network with a gateway.
void co_gw_destroy(co_gw_t *gw)
Destroys a CANopen gateway.
void co_gw_rate_func_t(co_unsigned16_t net, co_unsigned16_t rate, void *data)
The type of a CANopen gateway 'set bit timing' function, invoked when a baudrate switch is needed aft...
void co_gw_get_send_func(const co_gw_t *gw, co_gw_send_func_t **pfunc, void **pdata)
Retrieves the callback function used to send indications and confirmations from a CANopen gateway.
void co_gw_set_send_func(co_gw_t *gw, co_gw_send_func_t *func, void *data)
Sets the callback function used to send indications and confirmations from a CANopen gateway.
This header file is part of the C11 and POSIX compatibility library; it includes <time....
A CANopen NMT master/slave service.
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' confirmation.
int srv
The service number (CO_GW_SRV__LSS_SLOWSCAN or CO_GW_SRV__LSS_FASTSCAN).
int iec
The internal error code (0 on success).
void * data
A pointer to user-specified data.
struct co_id id
The LSS address.
co_unsigned32_t ac
The SDO abort code (0 on success).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Get version' confirmation.
size_t size
The size of this struct (in bytes).
co_unsigned32_t ac
The SDO abort code (0 on success).
co_unsigned32_t product_code
The product code.
int srv
The service number (CO_GW_SRV_GET_VERSION).
void * data
A pointer to user-specified data.
co_unsigned8_t gw_class
The gateway class.
co_unsigned8_t prot_hi
The protocol version (high number).
co_unsigned32_t revision
The revision number.
co_unsigned8_t prot_lo
The protocol version (low number).
int iec
The internal error code (0 on success).
co_unsigned32_t vendor_id
The vendor-ID.
co_unsigned32_t serial_nr
The serial number.
The parameters of a CANopen gateway 'LSS inquire node-ID' confirmation.
co_unsigned8_t id
The node-ID.
void * data
A pointer to user-specified data.
co_unsigned32_t ac
The SDO abort code (0 on success).
int iec
The internal error code (0 on success).
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_GET_ID).
The parameters of a CANopen gateway 'Inquire LSS address' confirmation.
int iec
The internal error code (0 on success).
co_unsigned32_t id
The LSS number.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
void * data
A pointer to user-specified data.
co_unsigned32_t ac
The SDO abort code (0 on success).
The parameters of a CANopen gateway 'Read PDO' confirmation.
void * data
A pointer to user-specified data.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_PDO_READ).
co_unsigned64_t val[0x40]
An array of object values.
co_unsigned16_t num
The PDO number.
co_unsigned32_t ac
The SDO abort code (0 on success).
int iec
The internal error code (0 on success).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'SDO upload' confirmation.
co_unsigned32_t len
The length of the value (in bytes).
co_unsigned16_t type
The data type.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_SDO_UP).
int iec
The internal error code (0 on success).
void * data
A pointer to user-specified data.
co_unsigned32_t ac
The SDO abort code (0 on success).
uint_least8_t val[1]
The (first byte in the) value.
The common parameters of a CANopen gateway confirmation.
void * data
A pointer to user-specified data.
int iec
The internal error code (0 on success).
int srv
The service number.
size_t size
The size of this struct (in bytes).
co_unsigned32_t ac
The SDO abort code (0 on success).
The parameters of a Lely-specific gateway 'Boot slave process completed' indication.
co_unsigned16_t net
The network-ID.
char es
The error status (in the range ['A'..'O'], or 0 on success).
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
int srv
The service number (CO_GW_SRV__BOOT).
co_unsigned8_t st
The the state of the node (including the toggle bit).
The parameters of a Lely-specific gateway 'Synchronization event received' indication.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
co_unsigned8_t cnt
The SYNC counter.
int srv
The service number (CO_GW_SRV__SYNC).
The parameters of a Lely-specific gateway 'Time stamp event received' indication.
size_t size
The size of this struct (in bytes).
struct timespec ts
The absolute time.
int srv
The service number (CO_GW_SRV__TIME).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Error control event received' indication.
co_unsigned8_t node
The node-ID.
int iec
The internal error code (0 on success).
int srv
The service number (CO_GW_SRV_EC).
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
co_unsigned8_t st
The state of the node, or 0 in case of a boot-up event.
The parameters of a CANopen gateway 'Emergency event received' indication.
int srv
The service number (CO_GW_SRV_EMCY).
co_unsigned16_t net
The network-ID.
co_unsigned16_t ec
The emergency error code.
co_unsigned8_t msef[5]
The manufacturer-specific error code.
co_unsigned8_t er
The error register.
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
The parameters of a CANopen gateway 'RPDO received' indication.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned64_t val[0x40]
An array of object values.
co_unsigned16_t num
The PDO number.
int srv
The service number (CO_GW_SRV_RPDO).
The parameters of a CANopen gateway 'CiA 301 progress indication download' indication.
void * data
A pointer to user-specified data of the SDO upload/download request.
size_t size
The size of this struct (in bytes).
co_unsigned32_t nbyte
The transferred bytes.
co_unsigned16_t net
The network-ID.
co_unsigned32_t _size
The Lely-specific total value size (in bytes).
int srv
The service number (CO_GW_SRV_SDO).
co_unsigned8_t node
The node-ID.
unsigned int up
The transfer direction: download (0) or upload (1).
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' request.
size_t size
The size of this struct (in bytes).
struct co_id id_2
In case of an LSS Slowscan request, the upper bound of the LSS address; in case of an LSS Fastscan re...
struct co_id id_1
In case of an LSS Slowscan request, the lower bound of the LSS address; in case of an LSS Fastscan re...
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV__LSS_SLOWSCAN or CO_GW_SRV__LSS_FASTSCAN).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Initialize gateway' request.
int srv
The service number (CO_GW_SRV_INIT).
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned8_t bitidx
The bit timing index (in the range [0..9]).
The parameters of a CANopen gateway 'Inquire LSS address' request.
co_unsigned8_t cs
The command specifier (one of 0x5a, 0x5b, 0x5c or 0x5d).
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'LSS identify remote slave' request.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_ID_SLAVE).
struct co_id lo
The lower bound of the LSS address.
co_unsigned16_t net
The network-ID.
struct co_id hi
The upper bound of the LSS address.
The parameters of a CANopen gateway 'LSS configure bit-rate' request.
co_unsigned8_t bitsel
The bit timing selector.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_SET_RATE).
co_unsigned16_t net
The network-ID.
co_unsigned8_t bitidx
The bit timing index.
The parameters of a CANopen gateway 'LSS activate new bit-rate' request.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_RATE).
co_unsigned16_t delay
The delay (in milliseconds).
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'LSS switch state selective' request.
struct co_id id
The LSS address of the slave to be configured.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_SEL).
The parameters of a CANopen gateway 'LSS switch state global' request.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_LSS_SWITCH).
co_unsigned8_t mode
0 for waiting state, 1 for configuration state.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The common parameters of a CANopen gateway network-level request.
int srv
The service number.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Start heartbeat consumer' request.
int srv
The service number (CO_GW_SRV_NMT_HB_ENABLE).
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned8_t node
The node-ID.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
The parameters of a CANopen gateway 'Enable node guarding' request.
co_unsigned8_t node
The node-ID.
co_unsigned16_t net
The network-ID.
co_unsigned8_t ltf
The lifetime factor.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned16_t gt
The guard time (in milliseconds).
int srv
The service number (CO_GW_SRV_NMT_NG_ENABLE).
The common parameters of a CANopen gateway node-level request.
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
co_unsigned8_t node
The node-ID.
size_t size
The size of this struct (in bytes).
int srv
The service number.
The parameters of a CANopen gateway 'Read PDO' request.
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_PDO_READ).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Write PDO' request.
co_unsigned8_t n
Number of mapped objects in PDO.
void * data
A pointer to user-specified data.
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_PDO_WRITE).
co_unsigned64_t val[0x40]
An array of object values.
The parameters of a CANopen gateway 'SDO download' request.
co_unsigned16_t net
The network-ID.
co_unsigned16_t idx
The object index.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned32_t len
The length of the value (in bytes).
co_unsigned8_t subidx
The object sub-index.
co_unsigned8_t node
The node-ID.
uint_least8_t val[1]
The (first byte in the) value.
int srv
The service number (CO_GW_SRV_SDO_DN).
The parameters of a CANopen gateway 'SDO upload' request.
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
void * data
A pointer to user-specified data.
co_unsigned8_t subidx
The object sub-index.
co_unsigned16_t idx
The object index.
int srv
The service number (CO_GW_SRV_SDO_UP).
co_unsigned16_t type
The data type.
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Boot-up forwarding' request.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_SET_BOOTUP_IND).
unsigned cs
A flag indicating whether "boot-up event received" commands should be forwarded (1) or not (0).
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Set command size' request.
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
co_unsigned32_t n
The command size (in bytes).
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Set command time-out' request.
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
void * data
A pointer to user-specified data.
int timeout
The command timeout (in milliseconds).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Start/Stop emergency consumer' request.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_EMCY_START or CO_GW_SRV_EMCY_STOP).
co_unsigned8_t node
The node-ID.
co_unsigned32_t cobid
The COB-ID.
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Set heartbeat producer' request.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_SET_HB).
The parameters of a CANopen gateway 'Configure RPDO' request.
size_t size
The size of this struct (in bytes).
co_unsigned8_t n
Number of mapped objects in PDO.
int srv
The service number (CO_GW_SRV_SET_RPDO).
co_unsigned32_t cobid
The COB-ID.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
co_unsigned8_t trans
The transmission type.
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Configure SDO time-out' request.
int timeout
The SDO timeout (in milliseconds).
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_SET_SDO_TIMEOUT).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Configure TPDO' request.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned8_t sync
The SYNC start value.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
co_unsigned8_t trans
The transmission type.
int srv
The service number (CO_GW_SRV_SET_TPDO).
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
co_unsigned16_t inhibit
The inhibit time.
co_unsigned32_t cobid
The COB-ID.
co_unsigned16_t event
The event timer.
co_unsigned16_t num
The PDO number.
size_t size
The size of this struct (in bytes).
The common parameters of a CANopen gateway request.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
int srv
The service number.
The common parameters of a CANopen gateway service.
size_t size
The size of this struct (in bytes).
int srv
The service number.