libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
coe.h File Reference

EtherCAT coe functions. More...

#include <libosal/types.h>
#include <libosal/mutex.h>
#include "libethercat/common.h"
#include "libethercat/idx.h"
#include "libethercat/pool.h"

Go to the source code of this file.

Data Structures

struct  ec_coe_emergency_message
 Message queue qentry. More...
 
struct  ec_coe
 
struct  ec_coe_sdo_desc
 CanOpen over EtherCAT sdo descriptor. More...
 
struct  ec_coe_sdo_entry_desc
 

Macros

#define CANOPEN_MAXNAME   (40u)
 CANOPEN maximum name length.
 
#define CANOPEN_MAXDATA   (128u)
 CANOPEN maximum data length.
 
#define EC_COE_SDO_VALUE_INFO_ACCESS_RIGHTS   (0x01)
 SDO value info access rights.
 
#define EC_COE_SDO_VALUE_INFO_OBJECT_CATEGORY   (0x02)
 SDO info object category.
 
#define EC_COE_SDO_VALUE_INFO_MAPPABLE   (0x04)
 SDO info mappable.
 
#define EC_COE_SDO_VALUE_INFO_UNIT   (0x08)
 SDO info unit.
 
#define EC_COE_SDO_VALUE_INFO_DEFAULT_VALUE   (0x10)
 SDO info default value.
 
#define EC_COE_SDO_VALUE_INFO_MIN_VALUE   (0x20)
 SDO info minimum value.
 
#define EC_COE_SDO_VALUE_INFO_MAX_VALUE   (0x40)
 SDO info maximum value.
 

Typedefs

typedef struct ec_coe_emergency_message ec_coe_emergency_message_t
 Message queue qentry.
 
typedef struct ec_coe ec_coe_t
 CoE type.
 
typedef struct PACKED ec_coe_sdo_desc ec_coe_sdo_desc_t
 CanOpen over EtherCAT sdo descriptor.
 
typedef struct PACKED ec_coe_sdo_entry_desc ec_coe_sdo_entry_desc_t
 CoE SDO entry description type.
 
typedef struct ec ec_t
 typedef to ec struct.
 

Enumerations

enum  {
  EC_COE_EMERGENCY = 0x01 , EC_COE_SDOREQ , EC_COE_SDORES , EC_COE_TXPDO ,
  EC_COE_RXPDO , EC_COE_TXPDO_RR , EC_COE_RXPDO_RR , EC_COE_SDOINFO
}
 CoE mailbox types. More...
 
enum  { EC_COE_SDO_DOWNLOAD_SEQ_REQ = 0x00 , EC_COE_SDO_DOWNLOAD_REQ = 0x01 , EC_COE_SDO_UPLOAD_REQ = 0x02 , EC_COE_SDO_ABORT_REQ = 0x04 }
 service data object command More...
 
enum  {
  EC_COE_SDO_INFO_ODLIST_REQ = 0x01 , EC_COE_SDO_INFO_ODLIST_RESP , EC_COE_SDO_INFO_GET_OBJECT_DESC_REQ , EC_COE_SDO_INFO_GET_OBJECT_DESC_RESP ,
  EC_COE_SDO_INFO_GET_ENTRY_DESC_REQ , EC_COE_SDO_INFO_GET_ENTRY_DESC_RESP , EC_COE_SDO_INFO_ERROR_REQUEST
}
 service data object information type More...
 
enum  {
  DEFTYPE_NULL = 0x0000 , DEFTYPE_BOOLEAN = 0x0001 , DEFTYPE_INTEGER8 = 0x0002 , DEFTYPE_INTEGER16 = 0x0003 ,
  DEFTYPE_INTEGER32 = 0x0004 , DEFTYPE_UNSIGNED8 = 0x0005 , DEFTYPE_UNSIGNED16 = 0x0006 , DEFTYPE_UNSIGNED32 = 0x0007 ,
  DEFTYPE_REAL32 = 0x0008 , DEFTYPE_VISIBLESTRING = 0x0009 , DEFTYPE_OCTETSTRING = 0x000A , DEFTYPE_UNICODE_STRING = 0x000B ,
  DEFTYPE_TIME_OF_DAY = 0x000C , DEFTYPE_TIME_DIFFERENCE = 0x000D , DEFTYPE_INTEGER24 = 0x0010 , DEFTYPE_REAL64 = 0x0011 ,
  DEFTYPE_INTEGER40 = 0x0012 , DEFTYPE_INTEGER48 = 0x0013 , DEFTYPE_INTEGER56 = 0x0014 , DEFTYPE_INTEGER64 = 0x0015 ,
  DEFTYPE_UNSIGNED24 = 0x0016 , DEFTYPE_UNSIGNED40 = 0x0018 , DEFTYPE_UNSIGNED48 = 0x0019 , DEFTYPE_UNSIGNED56 = 0x001A ,
  DEFTYPE_UNSIGNED64 = 0x001B , DEFTYPE_GUID = 0x001D , DEFTYPE_BYTE = 0x001E , DEFTYPE_WORD = 0x001F ,
  DEFTYPE_DWORD = 0x0020 , DEFTYPE_PDOMAPPING = 0x0021 , DEFTYPE_IDENTITY = 0x0023 , DEFTYPE_COMMAND = 0x0025 ,
  DEFTYPE_PDOCOMPAR = 0x0027 , DEFTYPE_ENUM = 0x0028 , DEFTYPE_SMPAR = 0x0029 , DEFTYPE_RECORD = 0x002A ,
  DEFTYPE_BACKUP = 0x002B , DEFTYPE_MDP = 0x002C , DEFTYPE_BITARR8 = 0x002D , DEFTYPE_BITARR16 = 0x002E ,
  DEFTYPE_BITARR32 = 0x002F , DEFTYPE_BIT1 = 0x0030 , DEFTYPE_BIT2 = 0x0031 , DEFTYPE_BIT3 = 0x0032 ,
  DEFTYPE_BIT4 = 0x0033 , DEFTYPE_BIT5 = 0x0034 , DEFTYPE_BIT6 = 0x0035 , DEFTYPE_BIT7 = 0x0036 ,
  DEFTYPE_BIT8 = 0x0037 , DEFTYPE_ARRAY_OF_INT = 0x0260 , DEFTYPE_ARRAY_OF_SINT = 0x0261 , DEFTYPE_ARRAY_OF_DINT = 0x0262 ,
  DEFTYPE_ARRAY_OF_UDINT = 0x0263 , DEFTYPE_ERRORHANDLING = 0x0281 , DEFTYPE_DIAGHISTORY = 0x0282 , DEFTYPE_SYNCSTATUS = 0x0283 ,
  DEFTYPE_SYNCSETTINGS = 0x0284 , DEFTYPE_FSOEFRAME = 0x0285 , DEFTYPE_FSOECOMMPAR = 0x0286
}
 datatypes
 
enum  { OBJCODE_VAR = 0x07 , OBJCODE_ARR = 0x08 , OBJCODE_REC = 0x09 }
 
enum  {
  ACCESS_READWRITE = 0x003F , ACCESS_READ = 0x0007 , ACCESS_READ_PREOP = 0x0001 , ACCESS_READ_SAFEOP = 0x0002 ,
  ACCESS_READ_OP = 0x0004 , ACCESS_WRITE = 0x0038 , ACCESS_WRITE_PREOP = 0x0008 , ACCESS_WRITE_SAFEOP = 0x0010 ,
  ACCESS_WRITE_OP = 0x0020
}
 

Functions

void ec_coe_init (ec_t *pec, osal_uint16_t slave)
 Initialize CoE structure.
 
void ec_coe_deinit (ec_t *pec, osal_uint16_t slave)
 deinitialize CoE structure
 
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)
 
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.
 
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)
 
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.
 
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.
 
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_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.
 
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_odlist_read (ec_t *pec, osal_uint16_t slave, osal_uint8_t *buf, osal_size_t *len)
 Read CoE object dictionary list.
 
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_generate_mapping (ec_t *pec, osal_uint16_t slave)
 generate sync manager process data mapping via coe
 
void ec_coe_emergency_enqueue (ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
 queue read mailbox content
 
int ec_coe_emergency_get_next (ec_t *pec, osal_uint16_t slave, ec_coe_emergency_message_t *msg)
 Get next CoE emergency message.
 
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.
 

Detailed Description

EtherCAT coe functions.

Author
Robert Burger rober.nosp@m.t.bu.nosp@m.rger@.nosp@m.dlr..nosp@m.de
Date
22 Nov 2016

Implementaion of the CanOpen over EtherCAT mailbox protocol