Global definitions and macros.
More...
Go to the source code of this file.
|
| enum | ec_slave_state_t {
EC_SLAVE_STATE_UNKNOWN = 0x00
, EC_SLAVE_STATE_INIT = 0x01
, EC_SLAVE_STATE_PREOP = 0x02
, EC_SLAVE_STATE_BOOT = 0x03
,
EC_SLAVE_STATE_SAFEOP = 0x04
, EC_SLAVE_STATE_OP = 0x08
, EC_SLAVE_STATE_ACK_ERR = 0x10
} |
| | State of an EtherCAT slave. More...
|
| enum | {
EC_MBOX_AOE = 0x01
, EC_MBOX_EOE = 0x02
, EC_MBOX_COE = 0x04
, EC_MBOX_FOE = 0x08
,
EC_MBOX_SOE = 0x10
, EC_MBOX_VOE = 0x20
} |
| | Supported mailbox protocols. More...
|
| enum | ec_slave_dc_range_t { EC_DC_32
, EC_DC_64
} |
| | EtherCAT slave distributed clocks range. More...
|
| enum | { EC_SDO_ENTRY_ACCESS_PREOP
, EC_SDO_ENTRY_ACCESS_SAFEOP
, EC_SDO_ENTRY_ACCESS_OP
, EC_SDO_ENTRY_ACCESS_COUNT
} |
| | Access states for SDO entries. More...
|
| enum | ec_device_index_t { EC_DEVICE_MAIN
, EC_DEVICE_BACKUP
} |
| | Master devices. More...
|
| enum | ec_internal_request_state_t {
EC_INT_REQUEST_INIT
, EC_INT_REQUEST_QUEUED
, EC_INT_REQUEST_BUSY
, EC_INT_REQUEST_SUCCESS
,
EC_INT_REQUEST_FAILURE
} |
| | Generic request state. More...
|
| enum | ec_origin_t { EC_ORIG_INTERNAL
, EC_ORIG_EXTERNAL
} |
| | Origin type. More...
|
Global definitions and macros.
Definition in file globals.h.
◆ EC_IO_TIMEOUT
| #define EC_IO_TIMEOUT 500 |
Datagram timeout in microseconds.
Definition at line 38 of file globals.h.
◆ EC_BYTE_TRANSMISSION_TIME_NS
| #define EC_BYTE_TRANSMISSION_TIME_NS 80 |
Time to send a byte in nanoseconds.
t_ns = 1 / (100 MBit/s / 8 bit/byte) = 80 ns/byte
Definition at line 44 of file globals.h.
◆ EC_FSM_RETRIES
Number of state machine retries on datagram timeout.
Definition at line 47 of file globals.h.
◆ EC_WAIT_SDO_DICT
| #define EC_WAIT_SDO_DICT 3 |
Seconds to wait before fetching SDO dictionary after slave entered PREOP state.
Definition at line 51 of file globals.h.
◆ EC_STATE_STRING_SIZE
| #define EC_STATE_STRING_SIZE 32 |
◆ EC_MAX_SII_SIZE
| #define EC_MAX_SII_SIZE 4096 |
Maximum SII size in words, to avoid infinite reading.
Definition at line 57 of file globals.h.
◆ EC_RATE_COUNT
Number of statistic rate intervals to maintain.
Definition at line 60 of file globals.h.
◆ EC_FRAME_HEADER_SIZE
| #define EC_FRAME_HEADER_SIZE 2 |
Size of an EtherCAT frame header.
Definition at line 67 of file globals.h.
◆ EC_DATAGRAM_HEADER_SIZE
| #define EC_DATAGRAM_HEADER_SIZE 10 |
Size of an EtherCAT datagram header.
Definition at line 70 of file globals.h.
◆ EC_DATAGRAM_FOOTER_SIZE
| #define EC_DATAGRAM_FOOTER_SIZE 2 |
Size of an EtherCAT datagram footer.
Definition at line 73 of file globals.h.
◆ EC_ADDR_LEN
Size of the EtherCAT address field.
Definition at line 76 of file globals.h.
◆ EC_MAX_DATA_SIZE
Value:
#define EC_FRAME_HEADER_SIZE
Size of an EtherCAT frame header.
#define EC_DATAGRAM_HEADER_SIZE
Size of an EtherCAT datagram header.
#define EC_DATAGRAM_FOOTER_SIZE
Size of an EtherCAT datagram footer.
Resulting maximum data size of a single datagram in a frame.
Definition at line 79 of file globals.h.
◆ EC_MBOX_HEADER_SIZE
| #define EC_MBOX_HEADER_SIZE 6 |
Mailbox header size.
Definition at line 83 of file globals.h.
◆ EC_FIRST_SII_CATEGORY_OFFSET
| #define EC_FIRST_SII_CATEGORY_OFFSET 0x40 |
Word offset of first SII category.
Definition at line 86 of file globals.h.
◆ EC_SYNC_PAGE_SIZE
| #define EC_SYNC_PAGE_SIZE 8 |
Size of a sync manager configuration page.
Definition at line 89 of file globals.h.
◆ EC_MAX_FMMUS
Maximum number of FMMUs per slave.
Definition at line 92 of file globals.h.
◆ EC_FMMU_PAGE_SIZE
| #define EC_FMMU_PAGE_SIZE 16 |
Size of an FMMU configuration page.
Definition at line 95 of file globals.h.
◆ EC_SYNC_SIGNAL_COUNT
| #define EC_SYNC_SIGNAL_COUNT 2 |
Number of DC sync signals.
Definition at line 98 of file globals.h.
◆ EC_DATAGRAM_NAME_SIZE
| #define EC_DATAGRAM_NAME_SIZE 20 |
Size of the datagram description string.
This is also used as the maximum lenth of EoE device names.
Definition at line 104 of file globals.h.
◆ EC_MAX_HOSTNAME_SIZE
| #define EC_MAX_HOSTNAME_SIZE 32 |
Maximum hostname size.
Used inside the EoE set IP parameter request.
Definition at line 110 of file globals.h.
◆ EC_SLAVE_STATE_MASK
| #define EC_SLAVE_STATE_MASK 0x0F |
Slave state mask.
Apply this mask to a slave state byte to get the slave state without the error flag.
Definition at line 117 of file globals.h.
◆ EC_INFO
| #define EC_INFO |
( |
| fmt, |
|
|
| args... ) |
Value:printk(KERN_INFO "EtherCAT: " fmt, ##args)
Convenience macro for printing EtherCAT-specific information to syslog.
This will print the message in fmt with a prefixed "EtherCAT: ".
- Parameters
-
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 214 of file globals.h.
◆ EC_ERR
| #define EC_ERR |
( |
| fmt, |
|
|
| args... ) |
Value:printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args)
Convenience macro for printing EtherCAT-specific errors to syslog.
This will print the message in fmt with a prefixed "EtherCAT ERROR: ".
- Parameters
-
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 224 of file globals.h.
◆ EC_WARN
| #define EC_WARN |
( |
| fmt, |
|
|
| args... ) |
Value:printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args)
Convenience macro for printing EtherCAT-specific warnings to syslog.
This will print the message in fmt with a prefixed "EtherCAT WARNING: ".
- Parameters
-
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 234 of file globals.h.
◆ EC_DBG
| #define EC_DBG |
( |
| fmt, |
|
|
| args... ) |
Value:printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args)
Convenience macro for printing EtherCAT debug messages to syslog.
This will print the message in fmt with a prefixed "EtherCAT DEBUG: ".
- Parameters
-
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 244 of file globals.h.
◆ EC_ABS
Value:
Absolute value.
Definition at line 251 of file globals.h.
◆ ec_slave_t
◆ ec_slave_state_t
State of an EtherCAT slave.
| Enumerator |
|---|
| EC_SLAVE_STATE_UNKNOWN | unknown state
|
| EC_SLAVE_STATE_INIT | INIT state (no mailbox communication, no IO).
|
| EC_SLAVE_STATE_PREOP | PREOP state (mailbox communication, no IO).
|
| EC_SLAVE_STATE_BOOT | Bootstrap state (mailbox communication, firmware update).
|
| EC_SLAVE_STATE_SAFEOP | SAFEOP (mailbox communication and input update).
|
| EC_SLAVE_STATE_OP | OP (mailbox communication and input/output update).
|
| EC_SLAVE_STATE_ACK_ERR | Acknowledge/Error bit (no actual state).
|
Definition at line 121 of file globals.h.
◆ anonymous enum
Supported mailbox protocols.
Not to mix up with the mailbox type field in the mailbox header defined in master/mailbox.h.
| Enumerator |
|---|
| EC_MBOX_AOE | ADS over EtherCAT.
|
| EC_MBOX_EOE | Ethernet over EtherCAT.
|
| EC_MBOX_COE | CANopen over EtherCAT.
|
| EC_MBOX_FOE | File-Access over EtherCAT.
|
| EC_MBOX_SOE | Servo-Profile over EtherCAT.
|
| EC_MBOX_VOE | Vendor specific.
|
Definition at line 143 of file globals.h.
◆ ec_slave_dc_range_t
EtherCAT slave distributed clocks range.
| Enumerator |
|---|
| EC_DC_32 | 32 bit.
|
Definition at line 172 of file globals.h.
◆ anonymous enum
Access states for SDO entries.
The access rights are managed per AL state.
| Enumerator |
|---|
| EC_SDO_ENTRY_ACCESS_PREOP | Access rights in PREOP.
|
| EC_SDO_ENTRY_ACCESS_SAFEOP | Access rights in SAFEOP.
|
| EC_SDO_ENTRY_ACCESS_OP | Access rights in OP.
|
| EC_SDO_ENTRY_ACCESS_COUNT | Number of states.
|
Definition at line 189 of file globals.h.
◆ ec_device_index_t
Master devices.
| Enumerator |
|---|
| EC_DEVICE_MAIN | Main device.
|
| EC_DEVICE_BACKUP | Backup device.
|
Definition at line 198 of file globals.h.
◆ ec_internal_request_state_t
Generic request state.
- Attention
- If ever changing this, please be sure to adjust the state_table in master/sdo_request.c.
Definition at line 287 of file globals.h.
◆ ec_origin_t
Origin type.
| Enumerator |
|---|
| EC_ORIG_INTERNAL | Internal.
|
| EC_ORIG_EXTERNAL | External.
|
Definition at line 303 of file globals.h.
◆ ec_master_count()
| unsigned int ec_master_count |
( |
void | | ) |
|
Get the number of masters.
Definition at line 207 of file module.c.
◆ ec_print_data()
| void ec_print_data |
( |
const uint8_t * | data, |
|
|
size_t | size ) |
Outputs frame contents for debugging purposes.
If the data block is larger than 256 bytes, only the first 128 and the last 128 bytes will be shown
- Parameters
-
| data | pointer to data |
| size | number of bytes to output |
Definition at line 344 of file module.c.
◆ ec_print_data_diff()
| void ec_print_data_diff |
( |
const uint8_t * | d1, |
|
|
const uint8_t * | d2, |
|
|
size_t | size ) |
Outputs frame contents and differences for debugging purposes.
- Parameters
-
| d1 | first data |
| d2 | second data |
| size | number of bytes to output |
Definition at line 372 of file module.c.
◆ ec_state_string()
| size_t ec_state_string |
( |
uint8_t | states, |
|
|
char * | buffer, |
|
|
uint8_t | multi ) |
Prints slave states in clear text.
- Returns
- Size of the created string.
- Parameters
-
| states | slave states |
| buffer | target buffer (min. EC_STATE_STRING_SIZE bytes) |
| multi | Show multi-state mask. |
Definition at line 401 of file module.c.
◆ ec_mac_print()
| ssize_t ec_mac_print |
( |
const uint8_t * | mac, |
|
|
char * | buffer ) |
Print a MAC address to a buffer.
The buffer size must be at least EC_MAX_MAC_STRING_SIZE.
- Returns
- number of bytes written.
- Parameters
-
| mac | MAC address |
| buffer | Target buffer. |
Definition at line 245 of file module.c.
◆ ec_mac_is_zero()
| int ec_mac_is_zero |
( |
const uint8_t * | mac | ) |
|
- Returns
- true, if the MAC address is all-zero.
- Parameters
-
Definition at line 266 of file module.c.
◆ ecrt_request_master_err()
| ec_master_t * ecrt_request_master_err |
( |
unsigned int | master_index | ) |
|
Request a master.
Same as ecrt_request_master(), but with ERR_PTR() return value.
- Returns
- Requested master.
- Parameters
-
| master_index | Master index. |
Definition at line 537 of file module.c.
◆ ec_device_names
| const char* ec_device_names[2] |
|
extern |
◆ ec_master_version_str
| char* ec_master_version_str |
|
extern |
Version string.
Definition at line 68 of file module.c.
◆ ec_request_state_translation_table
Global request state type translation table.
Translates an internal request state to an external one.
Definition at line 658 of file module.c.