General typedefs and defines for EtherCAT. More...
#include <osal.h>
Go to the source code of this file.
Classes | |
struct | ec_errort |
struct | PACKED |
struct | PACKED |
Macros | |
#define | EC_BUFSIZE EC_MAXECATFRAME |
#define | EC_CMDOFFSET EC_ELENGTHSIZE |
#define | EC_DATAGRAMFOLLOWS (1 << 15) |
#define | EC_DEFAULTRETRIES 3 |
#define | EC_ECATTYPE 0x1000 |
#define | EC_ELENGTHSIZE sizeof(uint16) |
#define | EC_ERROR -3 |
#define | EC_ESTAT_BUSY 0x8000 |
#define | EC_ESTAT_EMASK 0x7800 |
#define | EC_ESTAT_NACK 0x2000 |
#define | EC_ESTAT_R64 0x0040 |
#define | EC_FIRSTDCDATAGRAM 20 |
#define | EC_HEADERSIZE sizeof(ec_comt) |
#define | EC_LITTLE_ENDIAN |
#define | EC_MAXBUF 16 |
#define | EC_MAXECATFRAME 1518 |
#define | EC_MAXEEPBITMAP 128 |
#define | EC_MAXEEPBUF EC_MAXEEPBITMAP << 5 |
#define | EC_MAXLRWDATA (EC_MAXECATFRAME - 14 - 2 - 10 - 2 - 4) |
#define | EC_NOFRAME -1 |
#define | EC_OTHERFRAME -2 |
#define | EC_TIMEOUTEEP 20000 |
#define | EC_TIMEOUTRET 2000 |
#define | EC_TIMEOUTRET3 (EC_TIMEOUTRET * 3) |
#define | EC_TIMEOUTRXM 700000 |
#define | EC_TIMEOUTSAFE 20000 |
#define | EC_TIMEOUTSTATE 2000000 |
#define | EC_TIMEOUTTXM 20000 |
#define | EC_VER1 |
#define | EC_WKCSIZE sizeof(uint16) |
#define | ECT_SDO_PDOASSIGN 0x1c10 |
#define | ECT_SDO_RXPDOASSIGN 0x1c12 |
#define | ECT_SDO_SMCOMMTYPE 0x1c00 |
#define | ECT_SDO_TXPDOASSIGN 0x1c13 |
#define | ECT_SII_START 0x0040 |
#define | ETH_HEADERSIZE sizeof(ec_etherheadert) |
#define | ETH_P_ECAT 0x88A4 |
#define | etohl(A) (A) |
#define | etohll(A) (A) |
#define | etohs(A) (A) |
#define | get_unaligned(ptr) ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) |
#define | HI_BYTE(w) ((w) >> 8) |
#define | HI_WORD(l) ((l) >> 16) |
#define | htoel(A) (A) |
#define | htoell(A) (A) |
#define | htoes(A) (A) |
#define | LO_BYTE(w) ((w) & 0x00ff) |
#define | LO_WORD(l) ((l) & 0xffff) |
#define | MK_WORD(msb, lsb) ((((uint16)(msb))<<8) | (lsb)) |
#define | put_unaligned32(val, ptr) (memcpy((ptr), &(val), 4)) |
#define | put_unaligned64(val, ptr) (memcpy((ptr), &(val), 8)) |
#define | SWAP(w) ((((w)& 0xff00) >> 8) | (((w) & 0x00ff) << 8)) |
Typedefs | |
typedef uint8 | ec_bufT[EC_BUFSIZE] |
typedef PACKED_BEGIN struct PACKED | ec_comt |
typedef PACKED_BEGIN struct PACKED | ec_etherheadert |
General typedefs and defines for EtherCAT.
Defines that could need optimalisation for specific applications are the EC_TIMEOUTxxx. Assumptions for the standard settings are a standard linux PC or laptop and a wired connection to maximal 100 slaves. For use with wireless connections or lots of slaves the timouts need increasing. For fast systems running Xenomai and RT-net or alike the timeouts need to be shorter.
Definition in file ethercattype.h.
#define EC_BUFSIZE EC_MAXECATFRAME |
standard frame buffer size in bytes
Definition at line 84 of file ethercattype.h.
#define EC_CMDOFFSET EC_ELENGTHSIZE |
offset position of command in EtherCAT header
Definition at line 155 of file ethercattype.h.
#define EC_DATAGRAMFOLLOWS (1 << 15) |
definition of datagram follows bit in ec_comt.dlength
Definition at line 159 of file ethercattype.h.
#define EC_DEFAULTRETRIES 3 |
default number of retries if wkc <= 0
Definition at line 108 of file ethercattype.h.
#define EC_ECATTYPE 0x1000 |
datagram type EtherCAT
Definition at line 86 of file ethercattype.h.
#define EC_ELENGTHSIZE sizeof(uint16) |
size of ec_comt.elength item in EtherCAT header
Definition at line 153 of file ethercattype.h.
#define EC_ERROR -3 |
return value general error
Definition at line 71 of file ethercattype.h.
#define EC_ESTAT_BUSY 0x8000 |
EEprom state machine busy flag
Definition at line 295 of file ethercattype.h.
#define EC_ESTAT_EMASK 0x7800 |
EEprom state machine error flag mask
Definition at line 297 of file ethercattype.h.
#define EC_ESTAT_NACK 0x2000 |
EEprom state machine error acknowledge
Definition at line 299 of file ethercattype.h.
#define EC_ESTAT_R64 0x0040 |
EEprom state machine read size
Definition at line 293 of file ethercattype.h.
#define EC_FIRSTDCDATAGRAM 20 |
size of DC datagram used in first LRW frame
Definition at line 82 of file ethercattype.h.
#define EC_HEADERSIZE sizeof(ec_comt) |
EtherCAT header size
Definition at line 151 of file ethercattype.h.
#define EC_LITTLE_ENDIAN |
Define Little or Big endian target
Definition at line 62 of file ethercattype.h.
#define EC_MAXBUF 16 |
number of frame buffers per channel (tx, rx1 rx2)
Definition at line 88 of file ethercattype.h.
#define EC_MAXECATFRAME 1518 |
maximum EtherCAT frame length in bytes
Definition at line 77 of file ethercattype.h.
#define EC_MAXEEPBITMAP 128 |
size of EEPROM bitmap cache
Definition at line 104 of file ethercattype.h.
#define EC_MAXEEPBUF EC_MAXEEPBITMAP << 5 |
size of EEPROM cache buffer
Definition at line 106 of file ethercattype.h.
#define EC_MAXLRWDATA (EC_MAXECATFRAME - 14 - 2 - 10 - 2 - 4) |
maximum EtherCAT LRW frame length in bytes
Definition at line 80 of file ethercattype.h.
#define EC_NOFRAME -1 |
return value no frame returned
Definition at line 73 of file ethercattype.h.
#define EC_OTHERFRAME -2 |
return value unknown frame received
Definition at line 75 of file ethercattype.h.
#define EC_TIMEOUTEEP 20000 |
timeout value in us for EEPROM access
Definition at line 96 of file ethercattype.h.
#define EC_TIMEOUTRET 2000 |
timeout value in us for tx frame to return to rx
Definition at line 90 of file ethercattype.h.
#define EC_TIMEOUTRET3 (EC_TIMEOUTRET * 3) |
timeout value in us for safe data transfer, max. triple retry
Definition at line 92 of file ethercattype.h.
#define EC_TIMEOUTRXM 700000 |
timeout value in us for rx mailbox cycle
Definition at line 100 of file ethercattype.h.
#define EC_TIMEOUTSAFE 20000 |
timeout value in us for return "safe" variant (f.e. wireless)
Definition at line 94 of file ethercattype.h.
#define EC_TIMEOUTSTATE 2000000 |
timeout value in us for check statechange
Definition at line 102 of file ethercattype.h.
#define EC_TIMEOUTTXM 20000 |
timeout value in us for tx mailbox cycle
Definition at line 98 of file ethercattype.h.
#define EC_VER1 |
define EC_VER1 if version 1 default context and functions are needed comment if application uses only ecx_ functions and own context
Definition at line 66 of file ethercattype.h.
#define EC_WKCSIZE sizeof(uint16) |
size of workcounter item in EtherCAT datagram
Definition at line 157 of file ethercattype.h.
#define ECT_SDO_PDOASSIGN 0x1c10 |
standard SDO PDO assignment
Definition at line 468 of file ethercattype.h.
#define ECT_SDO_RXPDOASSIGN 0x1c12 |
standard SDO RxPDO assignment
Definition at line 470 of file ethercattype.h.
#define ECT_SDO_SMCOMMTYPE 0x1c00 |
standard SDO Sync Manager Communication Type
Definition at line 466 of file ethercattype.h.
#define ECT_SDO_TXPDOASSIGN 0x1c13 |
standard SDO TxPDO assignment
Definition at line 472 of file ethercattype.h.
#define ECT_SII_START 0x0040 |
Start address SII sections in Eeprom
Definition at line 304 of file ethercattype.h.
#define ETH_HEADERSIZE sizeof(ec_etherheadert) |
ethernet header size
Definition at line 127 of file ethercattype.h.
#define ETH_P_ECAT 0x88A4 |
Ethercat packet type
Definition at line 475 of file ethercattype.h.
#define etohl | ( | A | ) | (A) |
Definition at line 551 of file ethercattype.h.
#define etohll | ( | A | ) | (A) |
Definition at line 552 of file ethercattype.h.
#define etohs | ( | A | ) | (A) |
Definition at line 550 of file ethercattype.h.
#define get_unaligned | ( | ptr | ) | ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) |
Definition at line 536 of file ethercattype.h.
#define HI_BYTE | ( | w | ) | ((w) >> 8) |
Macro to get hi byte of a word
Definition at line 526 of file ethercattype.h.
#define HI_WORD | ( | l | ) | ((l) >> 16) |
Macro to get hi word of a dword
Definition at line 534 of file ethercattype.h.
#define htoel | ( | A | ) | (A) |
Definition at line 548 of file ethercattype.h.
#define htoell | ( | A | ) | (A) |
Definition at line 549 of file ethercattype.h.
#define htoes | ( | A | ) | (A) |
Definition at line 547 of file ethercattype.h.
#define LO_BYTE | ( | w | ) | ((w) & 0x00ff) |
Macro to get low byte of a word
Definition at line 528 of file ethercattype.h.
#define LO_WORD | ( | l | ) | ((l) & 0xffff) |
Macro to get hi word of a dword
Definition at line 532 of file ethercattype.h.
#define MK_WORD | ( | msb, | |
lsb | |||
) | ((((uint16)(msb))<<8) | (lsb)) |
Helper macros Macro to make a word from 2 bytes
Definition at line 524 of file ethercattype.h.
#define put_unaligned32 | ( | val, | |
ptr | |||
) | (memcpy((ptr), &(val), 4)) |
Definition at line 539 of file ethercattype.h.
#define put_unaligned64 | ( | val, | |
ptr | |||
) | (memcpy((ptr), &(val), 8)) |
Definition at line 542 of file ethercattype.h.
#define SWAP | ( | w | ) | ((((w)& 0xff00) >> 8) | (((w) & 0x00ff) << 8)) |
Macro to swap hi and low byte of a word
Definition at line 530 of file ethercattype.h.
typedef uint8 ec_bufT[EC_BUFSIZE] |
definition for frame buffers
Definition at line 111 of file ethercattype.h.
typedef PACKED_BEGIN struct PACKED ec_etherheadert |
ethernet header definition
anonymous enum |
Ethercat registers
Definition at line 413 of file ethercattype.h.
anonymous enum |
Enumerator | |
---|---|
ECT_SII_STRING |
SII category strings |
ECT_SII_GENERAL |
SII category general |
ECT_SII_FMMU |
SII category FMMU |
ECT_SII_SM |
SII category SM |
ECT_SII_PDO |
SII category PDO |
Definition at line 306 of file ethercattype.h.
anonymous enum |
Item offsets in SII general section
Enumerator | |
---|---|
ECT_SII_MANUF | |
ECT_SII_ID | |
ECT_SII_REV | |
ECT_SII_BOOTRXMBX | |
ECT_SII_BOOTTXMBX | |
ECT_SII_MBXSIZE | |
ECT_SII_TXMBXADR | |
ECT_SII_RXMBXADR | |
ECT_SII_MBXPROTO |
Definition at line 321 of file ethercattype.h.
anonymous enum |
Mailbox types definitions
Definition at line 335 of file ethercattype.h.
anonymous enum |
CoE mailbox types
Enumerator | |
---|---|
ECT_COES_EMERGENCY | |
ECT_COES_SDOREQ | |
ECT_COES_SDORES | |
ECT_COES_TXPDO | |
ECT_COES_RXPDO | |
ECT_COES_TXPDO_RR | |
ECT_COES_RXPDO_RR | |
ECT_COES_SDOINFO |
Definition at line 354 of file ethercattype.h.
anonymous enum |
CoE SDO commands
Enumerator | |
---|---|
ECT_SDO_DOWN_INIT | |
ECT_SDO_DOWN_EXP | |
ECT_SDO_DOWN_INIT_CA | |
ECT_SDO_UP_REQ | |
ECT_SDO_UP_REQ_CA | |
ECT_SDO_SEG_UP_REQ | |
ECT_SDO_ABORT |
Definition at line 367 of file ethercattype.h.
anonymous enum |
CoE Object Description commands
Enumerator | |
---|---|
ECT_GET_ODLIST_REQ | |
ECT_GET_ODLIST_RES | |
ECT_GET_OD_REQ | |
ECT_GET_OD_RES | |
ECT_GET_OE_REQ | |
ECT_GET_OE_RES | |
ECT_SDOINFO_ERROR |
Definition at line 379 of file ethercattype.h.
anonymous enum |
FoE opcodes
Enumerator | |
---|---|
ECT_FOE_READ | |
ECT_FOE_WRITE | |
ECT_FOE_DATA | |
ECT_FOE_ACK | |
ECT_FOE_ERROR | |
ECT_FOE_BUSY |
Definition at line 391 of file ethercattype.h.
anonymous enum |
SoE opcodes
Enumerator | |
---|---|
ECT_SOE_READREQ | |
ECT_SOE_READRES | |
ECT_SOE_WRITEREQ | |
ECT_SOE_WRITERES | |
ECT_SOE_NOTIFICATION | |
ECT_SOE_EMERGENCY |
Definition at line 402 of file ethercattype.h.
enum ec_bufstate |
Possible buffer states
Enumerator | |
---|---|
EC_BUF_EMPTY |
Empty |
EC_BUF_ALLOC |
Allocated, but not filled |
EC_BUF_TX |
Transmitted |
EC_BUF_RCVD |
Received, but not consumed |
EC_BUF_COMPLETE |
Cycle completed |
Definition at line 197 of file ethercattype.h.
enum ec_cmdtype |
Ethercat command types
Definition at line 244 of file ethercattype.h.
enum ec_datatype |
Ethercat data types
Definition at line 212 of file ethercattype.h.
enum ec_ecmdtype |
Ethercat EEprom command types
Enumerator | |
---|---|
EC_ECMD_NOP |
No operation |
EC_ECMD_READ |
Read |
EC_ECMD_WRITE |
Write |
EC_ECMD_RELOAD |
Reload |
Definition at line 280 of file ethercattype.h.
enum ec_err |
Possible error codes returned.
Definition at line 162 of file ethercattype.h.
enum ec_err_type |
Error types
Definition at line 478 of file ethercattype.h.
enum ec_state |
Possible EtherCAT slave states
Definition at line 179 of file ethercattype.h.