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 345 uint_least8_t val[1];
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) 721 uint_least8_t val[1];
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) 887 co_unsigned8_t msef[5];
987 co_unsigned16_t net, co_unsigned16_t rate,
void *data);
992 void *__co_gw_alloc(
void);
993 void __co_gw_free(
void *ptr);
995 void __co_gw_fini(
struct __co_gw *gw);
1104 #endif // !LELY_CO_GW_H_ size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
int srv
The service 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_EMCY_START or CO_GW_SRV_EMCY_STOP).
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
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...
co_unsigned8_t node
The node-ID.
The parameters of a CANopen gateway 'LSS inquire node-ID' confirmation.
size_t size
The size of this struct (in bytes).
co_unsigned16_t gt
The guard time (in milliseconds).
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
co_unsigned8_t subidx
The object sub-index.
co_unsigned32_t cobid
The COB-ID.
void * data
A pointer to user-specified data.
co_unsigned32_t nbyte
The transferred bytes.
The parameters of a CANopen gateway 'Set heartbeat producer' request.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
co_unsigned8_t ltf
The lifetime factor.
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__SYNC).
int srv
The service number (CO_GW_SRV_SET_RPDO).
size_t size
The size of this struct (in bytes).
co_unsigned8_t trans
The transmission type.
int srv
The service number (CO_GW_SRV_SDO).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Initialize gateway' request.
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
co_unsigned32_t n
The command size (in bytes).
co_unsigned16_t num
The PDO number.
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
void * data
A pointer to user-specified data.
co_unsigned8_t node
The node-ID.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
co_unsigned8_t mode
0 for waiting state, 1 for configuration state.
The parameters of a CANopen gateway 'Inquire LSS address' request.
int srv
The service number (CO_GW_SRV__LSS_SLOWSCAN or CO_GW_SRV__LSS_FASTSCAN).
The parameters of a CANopen gateway 'SDO download' request.
co_unsigned8_t node
The node-ID.
int srv
The service number (CO_GW_SRV_NMT_HB_ENABLE).
int srv
The service number (CO_GW_SRV_NMT_NG_ENABLE).
The parameters of a CANopen gateway 'SDO upload' confirmation.
unsigned int up
The transfer direction: download (0) or upload (1).
size_t size
The size of this struct (in bytes).
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...
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_LSS_SET_RATE).
The parameters of a CANopen gateway 'LSS switch state global' request.
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
co_unsigned8_t sync
The SYNC start value.
size_t size
The size of this struct (in bytes).
int co_gw_recv(co_gw_t *gw, const struct co_gw_req *req)
Receives and processes a request with a CANopen gateway.
int iec
The internal error code (0 on success).
co_unsigned8_t node
The node-ID.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_LSS_SWITCH).
size_t size
The size of this struct (in bytes).
int srv
The service number.
The parameters of a CANopen gateway 'Configure SDO time-out' request.
co_unsigned8_t bitidx
The bit timing index (in the range [0..9]).
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...
co_unsigned32_t ac
The SDO abort code (0 on success).
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
co_unsigned16_t num
The PDO number.
co_unsigned8_t bitidx
The bit timing index.
int srv
The service number (CO_GW_SRV_SET_TPDO).
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' confirmation.
The parameters of a CANopen gateway 'Read PDO' confirmation.
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Read PDO' request.
co_unsigned8_t gw_class
The gateway class.
The parameters of a CANopen gateway 'Error control event received' indication.
co_unsigned16_t num
The PDO number.
The parameters of a CANopen gateway 'Emergency event received' indication.
size_t size
The size of this struct (in bytes).
co_unsigned16_t ms
The heartbeat time (in milliseconds).
The parameters of a CANopen gateway 'Get version' confirmation.
size_t size
The size of this struct (in bytes).
co_unsigned16_t type
The data type.
co_unsigned16_t net
The network-ID.
co_unsigned32_t ac
The SDO abort code (0 on success).
int srv
The service number (CO_GW_SRV_SET_SDO_TIMEOUT).
void co_gw_destroy(co_gw_t *gw)
Destroys a CANopen gateway.
size_t size
The size of this struct (in bytes).
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_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
int co_gw_fini_net(co_gw_t *gw, co_unsigned16_t id)
Unregisters a CANopen network with a gateway.
int iec
The internal error code (0 on success).
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
co_unsigned8_t bitsel
The bit timing selector.
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Set command time-out' request.
int srv
The service number (CO_GW_SRV__BOOT).
co_unsigned8_t node
The node-ID.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'CiA 301 progress indication download' indication.
co_unsigned8_t st
The state of the node, or 0 in case of a boot-up event.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_SEL).
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
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...
The common parameters of a CANopen gateway confirmation.
void * data
A pointer to user-specified data.
The common parameters of a CANopen gateway node-level request.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
co_unsigned8_t cs
The command specifier (one of 0x5a, 0x5b, 0x5c or 0x5d).
size_t size
The size of this struct (in bytes).
size_t size
The size of this struct (in bytes).
size_t size
The size of this struct (in bytes).
co_unsigned32_t ac
The SDO abort code (0 on success).
co_unsigned8_t er
The error register.
co_unsigned32_t ac
The SDO abort code (0 on success).
int co_gw_init_net(co_gw_t *gw, co_unsigned16_t id, co_nmt_t *nmt)
Registers a CANopen network with a gateway.
size_t size
The size of this struct (in bytes).
co_unsigned8_t prot_lo
The protocol version (low number).
co_unsigned8_t subidx
The object sub-index.
co_unsigned16_t num
The PDO number.
size_t size
The size of this struct (in bytes).
co_unsigned32_t len
The length of the value (in bytes).
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
size_t size
The size of this struct (in bytes).
void * data
A pointer to user-specified data.
int srv
The service number.
co_unsigned16_t net
The network-ID.
int iec
The internal error code (0 on success).
co_unsigned32_t ac
The SDO abort code (0 on success).
co_unsigned16_t net
The network-ID.
co_unsigned16_t inhibit
The inhibit time.
The parameters of a CANopen gateway 'Inquire LSS address' confirmation.
int srv
The service number (CO_GW_SRV_PDO_READ).
co_unsigned32_t len
The length of the value (in bytes).
int srv
The service number (CO_GW_SRV_SDO_DN).
const char * co_gw_iec2str(int iec)
Returns a string describing an internal error code.
The parameters of a CANopen gateway 'Set command size' request.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
The common parameters of a CANopen gateway network-level request.
int srv
The service number (CO_GW_SRV_PDO_READ).
A CANopen NMT master/slave service.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Start heartbeat consumer' request.
size_t size
The size of this struct (in bytes).
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Enable node guarding' request.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (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_SET_HB).
co_unsigned32_t vendor_id
The vendor-ID.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_SDO_UP).
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
The parameters of a CANopen gateway 'LSS switch state selective' request.
The parameters of a CANopen gateway 'Configure TPDO' request.
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_LSS_GET_LSSID).
size_t size
The size of this struct (in bytes).
size_t size
The size of this struct (in bytes).
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.
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' request.
co_unsigned8_t cnt
The SYNC counter.
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_EMCY).
The parameters of a CANopen gateway 'Configure RPDO' request.
co_unsigned32_t serial_nr
The serial number.
The parameters of a CANopen gateway 'LSS identify remote slave' request.
The parameters of a CANopen gateway 'Start/Stop emergency consumer' request.
int timeout
The SDO timeout (in milliseconds).
The parameters of a Lely-specific gateway 'Boot slave process completed' indication.
co_unsigned16_t idx
The object index.
char es
The error status (in the range ['A'..'O'], or 0 on success).
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned32_t id
The LSS number.
int srv
The service number (CO_GW_SRV_SET_BOOTUP_IND).
co_unsigned16_t net
The network-ID.
co_unsigned8_t prot_hi
The protocol version (high number).
size_t size
The size of this struct (in bytes).
co_unsigned16_t delay
The delay (in milliseconds).
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
co_unsigned8_t trans
The transmission type.
The parameters of a CANopen gateway 'SDO upload' request.
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned32_t ac
The SDO abort code (0 on success).
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_INIT).
void * data
A pointer to user-specified data.
co_unsigned32_t cobid
The COB-ID.
int srv
The service number (CO_GW_SRV_LSS_GET_ID).
size_t size
The size of this struct (in bytes).
co_unsigned32_t revision
The revision number.
int srv
The service number (CO_GW_SRV__LSS_SLOWSCAN or CO_GW_SRV__LSS_FASTSCAN).
co_unsigned16_t num
The PDO number.
The parameters of a CANopen gateway 'LSS activate new bit-rate' request.
The parameters of a Lely-specific gateway 'Time stamp event received' indication. ...
This header file is part of the CANopen library; it contains the device description declarations...
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
co_unsigned32_t _size
The Lely-specific total value size (in bytes).
co_unsigned8_t node
The node-ID.
int iec
The internal error code (0 on success).
co_unsigned16_t net
The network-ID.
co_unsigned16_t idx
The object index.
void * data
A pointer to user-specified data.
The parameters of a Lely-specific gateway 'Synchronization event received' indication.
int srv
The service number (CO_GW_SRV_PDO_WRITE).
unsigned cs
A flag indicating whether "boot-up event received" commands should be forwarded (1) or not (0)...
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...
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
The parameters of a CANopen gateway 'Write PDO' request.
co_unsigned16_t ec
The emergency error code.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
co_unsigned8_t n
Number of mapped objects in PDO.
The common parameters of a CANopen gateway service.
The parameters of a CANopen gateway 'LSS configure bit-rate' request.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_RATE).
co_unsigned8_t n
Number of mapped objects in PDO.
int iec
The internal error code (0 on success).
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_SDO_UP).
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__TIME).
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
co_unsigned8_t st
The the state of the node (including the toggle bit).
void * data
A pointer to user-specified data of the SDO upload/download request.
co_unsigned32_t cobid
The COB-ID.
void * data
A pointer to user-specified data.
This header file is part of the C11 and POSIX compatibility library; it includes <time.h> and defines any missing functionality.
co_unsigned16_t event
The event timer.
int timeout
The command timeout (in milliseconds).
int srv
The service number (CO_GW_SRV_GET_VERSION).
void * data
A pointer to user-specified data.
The parameters of a CANopen gateway 'Boot-up forwarding' request.
int srv
The service number (CO_GW_SRV_RPDO).
The common parameters of a CANopen gateway request.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_EC).
int srv
The service number.
int srv
The service number.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'RPDO received' indication.
co_gw_t * co_gw_create(void)
Creates a new CANopen gateway.
co_unsigned8_t id
The node-ID.
co_unsigned8_t node
The node-ID.
int iec
The internal error code (0 on success).
int iec
The internal error code (0 on success).
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_LSS_ID_SLAVE).
int iec
The internal error code (0 on success).
co_unsigned8_t node
The node-ID.