41#ifndef LIBETHERCAT_COE_H
42#define LIBETHERCAT_COE_H
44#include <libosal/types.h>
45#include <libosal/mutex.h>
112 DEFTYPE_NULL = 0x0000,
113 DEFTYPE_BOOLEAN = 0x0001,
114 DEFTYPE_INTEGER8 = 0x0002,
115 DEFTYPE_INTEGER16 = 0x0003,
116 DEFTYPE_INTEGER32 = 0x0004,
117 DEFTYPE_UNSIGNED8 = 0x0005,
118 DEFTYPE_UNSIGNED16 = 0x0006,
119 DEFTYPE_UNSIGNED32 = 0x0007,
120 DEFTYPE_REAL32 = 0x0008,
121 DEFTYPE_VISIBLESTRING = 0x0009,
122 DEFTYPE_OCTETSTRING = 0x000A,
123 DEFTYPE_UNICODE_STRING = 0x000B,
124 DEFTYPE_TIME_OF_DAY = 0x000C,
125 DEFTYPE_TIME_DIFFERENCE = 0x000D,
126 DEFTYPE_INTEGER24 = 0x0010,
127 DEFTYPE_REAL64 = 0x0011,
128 DEFTYPE_INTEGER40 = 0x0012,
129 DEFTYPE_INTEGER48 = 0x0013,
130 DEFTYPE_INTEGER56 = 0x0014,
131 DEFTYPE_INTEGER64 = 0x0015,
132 DEFTYPE_UNSIGNED24 = 0x0016,
133 DEFTYPE_UNSIGNED40 = 0x0018,
134 DEFTYPE_UNSIGNED48 = 0x0019,
135 DEFTYPE_UNSIGNED56 = 0x001A,
136 DEFTYPE_UNSIGNED64 = 0x001B,
137 DEFTYPE_GUID = 0x001D,
138 DEFTYPE_BYTE = 0x001E,
139 DEFTYPE_WORD = 0x001F,
140 DEFTYPE_DWORD = 0x0020,
141 DEFTYPE_PDOMAPPING = 0x0021,
142 DEFTYPE_IDENTITY = 0x0023,
143 DEFTYPE_COMMAND = 0x0025,
144 DEFTYPE_PDOCOMPAR = 0x0027,
145 DEFTYPE_ENUM = 0x0028,
146 DEFTYPE_SMPAR = 0x0029,
147 DEFTYPE_RECORD = 0x002A,
148 DEFTYPE_BACKUP = 0x002B,
149 DEFTYPE_MDP = 0x002C,
150 DEFTYPE_BITARR8 = 0x002D,
151 DEFTYPE_BITARR16 = 0x002E,
152 DEFTYPE_BITARR32 = 0x002F,
153 DEFTYPE_BIT1 = 0x0030,
154 DEFTYPE_BIT2 = 0x0031,
155 DEFTYPE_BIT3 = 0x0032,
156 DEFTYPE_BIT4 = 0x0033,
157 DEFTYPE_BIT5 = 0x0034,
158 DEFTYPE_BIT6 = 0x0035,
159 DEFTYPE_BIT7 = 0x0036,
160 DEFTYPE_BIT8 = 0x0037,
161 DEFTYPE_ARRAY_OF_INT = 0x0260,
162 DEFTYPE_ARRAY_OF_SINT = 0x0261,
163 DEFTYPE_ARRAY_OF_DINT = 0x0262,
164 DEFTYPE_ARRAY_OF_UDINT = 0x0263,
165 DEFTYPE_ERRORHANDLING = 0x0281,
166 DEFTYPE_DIAGHISTORY = 0x0282,
167 DEFTYPE_SYNCSTATUS = 0x0283,
168 DEFTYPE_SYNCSETTINGS = 0x0284,
169 DEFTYPE_FSOEFRAME = 0x0285,
170 DEFTYPE_FSOECOMMPAR = 0x0286,
191#define CANOPEN_MAXNAME (40u)
192#define CANOPEN_MAXDATA (128u)
212#define EC_COE_SDO_VALUE_INFO_ACCESS_RIGHTS (0x01)
213#define EC_COE_SDO_VALUE_INFO_OBJECT_CATEGORY (0x02)
214#define EC_COE_SDO_VALUE_INFO_MAPPABLE (0x04)
215#define EC_COE_SDO_VALUE_INFO_UNIT (0x08)
216#define EC_COE_SDO_VALUE_INFO_DEFAULT_VALUE (0x10)
217#define EC_COE_SDO_VALUE_INFO_MIN_VALUE (0x20)
218#define EC_COE_SDO_VALUE_INFO_MAX_VALUE (0x40)
275 osal_uint8_t sub_index,
int complete, osal_uint8_t *buf, osal_size_t *len,
276 osal_uint32_t *abort_code);
297 osal_uint8_t sub_index,
int complete, osal_uint8_t *buf, osal_size_t *len,
298 osal_uint32_t *abort_code);
323 osal_uint8_t sub_index,
int complete, osal_uint8_t *buf, osal_size_t len,
324 osal_uint32_t *abort_code);
342 osal_uint8_t sub_index,
int complete, osal_uint8_t *buf, osal_size_t len,
343 osal_uint32_t *abort_code);
403 osal_uint32_t *error_code);
421 osal_uint32_t *error_code);
ethercat master common stuff
#define LEC_MAX_COE_EMERGENCY_MSG_LEN
Maximum message length of CoE emergency messages.
Definition common.h:199
#define LEC_MAX_COE_EMERGENCIES
Maximum number of CoE emergency messages.
Definition common.h:191
int ec_coe_master_sdo_desc_read(const ec_t *pec, osal_uint16_t index, ec_coe_sdo_desc_t *desc, osal_uint32_t *error_code)
Read CoE SDO description of master.
int ec_coe_sdo_write(ec_t *pec, osal_uint16_t slave, osal_uint16_t index, osal_uint8_t sub_index, int complete, osal_uint8_t *buf, osal_size_t len, osal_uint32_t *abort_code)
Write CoE service data object (SDO)
void ec_coe_deinit(ec_t *pec, osal_uint16_t slave)
deinitialize CoE structure
int ec_coe_emergency_get_next(ec_t *pec, osal_uint16_t slave, ec_coe_emergency_message_t *msg)
Get next CoE emergency message.
#define CANOPEN_MAXDATA
CANOPEN maximum data length.
Definition coe.h:192
int ec_coe_master_odlist_read(ec_t *pec, osal_uint8_t *buf, osal_size_t *len)
Read CoE object dictionary list of master.
int ec_coe_master_sdo_write(ec_t *pec, osal_uint16_t index, osal_uint8_t sub_index, int complete, osal_uint8_t *buf, osal_size_t len, osal_uint32_t *abort_code)
Write CoE service data object (SDO) of master.
struct PACKED ec_coe_sdo_entry_desc ec_coe_sdo_entry_desc_t
CoE SDO entry description type.
int ec_coe_odlist_read(ec_t *pec, osal_uint16_t slave, osal_uint8_t *buf, osal_size_t *len)
Read CoE object dictionary list.
#define CANOPEN_MAXNAME
CANOPEN maximum name length.
Definition coe.h:191
struct PACKED ec_coe_sdo_desc ec_coe_sdo_desc_t
CanOpen over EtherCAT sdo descriptor.
struct ec_coe ec_coe_t
CoE type.
int ec_coe_master_sdo_read(ec_t *pec, osal_uint16_t index, osal_uint8_t sub_index, int complete, osal_uint8_t *buf, osal_size_t *len, osal_uint32_t *abort_code)
Read CoE service data object (SDO) of master.
void ec_coe_emergency_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
queue read mailbox content
int ec_coe_generate_mapping(ec_t *pec, osal_uint16_t slave)
generate sync manager process data mapping via coe
struct ec_coe_emergency_message ec_coe_emergency_message_t
Message queue qentry.
int ec_coe_master_sdo_entry_desc_read(const ec_t *pec, osal_uint16_t index, osal_uint8_t sub_index, osal_uint8_t value_info, ec_coe_sdo_entry_desc_t *desc, osal_uint32_t *error_code)
Read CoE SDO entry description of master.
int ec_coe_sdo_read(ec_t *pec, osal_uint16_t slave, osal_uint16_t index, osal_uint8_t sub_index, int complete, osal_uint8_t *buf, osal_size_t *len, osal_uint32_t *abort_code)
Read CoE service data object (SDO)
void ec_coe_init(ec_t *pec, osal_uint16_t slave)
Initialize CoE structure.
int ec_coe_sdo_desc_read(ec_t *pec, osal_uint16_t slave, osal_uint16_t index, ec_coe_sdo_desc_t *desc, osal_uint32_t *error_code)
Read CoE SDO description.
void ec_coe_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
Enqueue CoE message received from slave.
const osal_char_t * get_sdo_info_error_string(osal_uint32_t errorcode)
Get SDO INFO error string.
int ec_coe_sdo_entry_desc_read(ec_t *pec, osal_uint16_t slave, osal_uint16_t index, osal_uint8_t sub_index, osal_uint8_t value_info, ec_coe_sdo_entry_desc_t *desc, osal_uint32_t *error_code)
Read CoE SDO entry description.
@ EC_COE_SDORES
service data object response
Definition coe.h:83
@ EC_COE_SDOREQ
service data object request
Definition coe.h:82
@ EC_COE_TXPDO
transmit PDO
Definition coe.h:84
@ EC_COE_SDOINFO
service data object information
Definition coe.h:88
@ EC_COE_RXPDO
receive PDO
Definition coe.h:85
@ EC_COE_RXPDO_RR
receive PDO RR
Definition coe.h:87
@ EC_COE_EMERGENCY
emergency message
Definition coe.h:81
@ EC_COE_TXPDO_RR
transmit PDO RR
Definition coe.h:86
@ ACCESS_WRITE_PREOP
Write only in PreOP.
Definition coe.h:186
@ ACCESS_WRITE_OP
Write only in OP.
Definition coe.h:188
@ ACCESS_READ_OP
Read only in OP.
Definition coe.h:184
@ ACCESS_WRITE_SAFEOP
Write only in SafeOP.
Definition coe.h:187
@ ACCESS_READ_PREOP
Read only in PreOP.
Definition coe.h:182
@ ACCESS_WRITE
Write only in all states.
Definition coe.h:185
@ ACCESS_READ
Read only in all states.
Definition coe.h:181
@ ACCESS_READ_SAFEOP
Read only in SafeOP.
Definition coe.h:183
@ ACCESS_READWRITE
Read/write in all states.
Definition coe.h:180
@ EC_COE_SDO_INFO_ERROR_REQUEST
error request
Definition coe.h:107
@ EC_COE_SDO_INFO_ODLIST_RESP
object dict list response
Definition coe.h:102
@ EC_COE_SDO_INFO_ODLIST_REQ
object dict list request
Definition coe.h:101
@ EC_COE_SDO_INFO_GET_OBJECT_DESC_RESP
object description response
Definition coe.h:104
@ EC_COE_SDO_INFO_GET_ENTRY_DESC_REQ
entry description request
Definition coe.h:105
@ EC_COE_SDO_INFO_GET_ENTRY_DESC_RESP
entry description response
Definition coe.h:106
@ EC_COE_SDO_INFO_GET_OBJECT_DESC_REQ
object description request
Definition coe.h:103
@ OBJCODE_REC
Object code RECORD.
Definition coe.h:176
@ OBJCODE_VAR
Object code VARIABLE.
Definition coe.h:174
@ OBJCODE_ARR
Object code ARRAY.
Definition coe.h:175
@ EC_COE_SDO_UPLOAD_REQ
sdo upload request
Definition coe.h:95
@ EC_COE_SDO_ABORT_REQ
sdo abort request
Definition coe.h:96
@ EC_COE_SDO_DOWNLOAD_REQ
sdo download request
Definition coe.h:94
@ EC_COE_SDO_DOWNLOAD_SEQ_REQ
sdo download seq request
Definition coe.h:93
Data pool implementation.
Message queue qentry.
Definition coe.h:59
osal_timer_t timestamp
timestamp, when emergency was received
Definition coe.h:60
osal_size_t msg_len
length
Definition coe.h:61
osal_uint8_t msg[LEC_MAX_COE_EMERGENCY_MSG_LEN]
message itself
Definition coe.h:62
CanOpen over EtherCAT sdo descriptor.
Definition coe.h:195
osal_uint8_t obj_code
object type
Definition coe.h:197
osal_uint8_t max_subindices
maximum number of subindices
Definition coe.h:198
osal_size_t name_len
element name len
Definition coe.h:200
osal_uint16_t data_type
element data type
Definition coe.h:196
osal_size_t data_len
length of name
Definition coe.h:209
osal_uint8_t value_info
valueinfo, how to interpret data
Definition coe.h:204
osal_uint16_t data_type
entry data type
Definition coe.h:205
osal_uint16_t bit_length
entry bit length
Definition coe.h:206
osal_uint16_t obj_access
object access
Definition coe.h:207
pool_t recv_pool
receive CoE message pool
Definition coe.h:66
osal_mutex_t lock
CoE mailbox lock.
Definition coe.h:68
uint32_t emergency_next_read
next received emergency message in ring buffer
Definition coe.h:74
ec_coe_emergency_message_t emergencies[LEC_MAX_COE_EMERGENCIES]
emergency message ring buffer.
Definition coe.h:76
uint32_t emergency_next_write
next message in ring buffer to be written.
Definition coe.h:75
ethercat master structure
Definition ec.h:188
Pool queue entry.
Definition pool.h:67
the datagram pool itself
Definition pool.h:81