190 lines
4.9 KiB
C++
190 lines
4.9 KiB
C++
/*
|
|
* eth_ecat_sii.hpp
|
|
*
|
|
* Created on: Sep 18, 2023
|
|
* Author: algin
|
|
*/
|
|
|
|
#ifndef FREE_RTOS_ETHERNET_INDUSTRY_ETH_ECAT_SII_HPP_
|
|
#define FREE_RTOS_ETHERNET_INDUSTRY_ETH_ECAT_SII_HPP_
|
|
|
|
#include "free_rtos/ethernet_industry/eth_ecat_eeprom.hpp"
|
|
|
|
namespace free_rtos {
|
|
|
|
namespace sii {
|
|
|
|
enum class ECAT_MAILBOX_PROTOCOLS : uint16_t {
|
|
AOE = 0x0001,
|
|
EOE = 0x0002,
|
|
COE = 0x0004,
|
|
FOE = 0x0008,
|
|
SOE = 0x0010,
|
|
VOE = 0x0020
|
|
};
|
|
|
|
enum class ECAT_SII_ADDRESSES : uint16_t {
|
|
PDI_CONTROL = 0x0000,
|
|
PDI_CONFIGURATION = 0x0001,
|
|
SYNC_IMPULSE_LEN = 0x0002,
|
|
PDI_CONFIGURATION2 = 0x0003,
|
|
CONFIGURED_STATION_ALIAS = 0x0004,
|
|
RESERVED0 = 0x0005,
|
|
CHECKSUM = 0x0007,
|
|
VENDOR_ID = 0x0008,
|
|
PRODUCT_CODE = 0x000A,
|
|
REVISION_NUMBER = 0x000C,
|
|
SERIAL_NUMBER = 0x000E,
|
|
RESERVED1 = 0x0010,
|
|
BOOTSTRAP_RECEIVE_MAILBOX_OFFSET = 0x0014,
|
|
BOOTSTRAP_RECEIVE_MAILBOX_SIZE = 0x0015,
|
|
BOOTSTRAP_SEND_MAILBOX_OFFSET = 0x0016,
|
|
BOOTSTRAP_SEND_MAILBOX_SIZE = 0x0017,
|
|
STANDARD_RECEIVE_MAILBOX_OFFSET = 0x0018,
|
|
STANDARD_RECEIVE_MAILBOX_SIZE = 0x0019,
|
|
STANDARD_SEND_MAILBOX_OFFSET = 0x001A,
|
|
STANDARD_SEND_MAILBOX_SIZE = 0x001B,
|
|
MAILBOX_PROTOCOL = 0x001C,
|
|
RESERVED2 = 0x001D,
|
|
SIZE = 0x003E,
|
|
VERSION = 0x003F,
|
|
FIRST_CATEGORY_HEADER = 0x0040,
|
|
FIRST_CATEGORY_DATA = 0x0042
|
|
};
|
|
|
|
enum class CATEGORIES_TYPES : uint16_t {
|
|
NOP = 0,
|
|
DEVICE_SPECIFIC_FIRST = 1,
|
|
DEVICE_SPECIFIC_LAST = 9,
|
|
STRINGS = 10,
|
|
DATA_TYPES = 20,
|
|
GENERAL = 30,
|
|
FMMU = 40,
|
|
SYNCM = 41,
|
|
TXPDO = 50,
|
|
RXPDO = 51,
|
|
DC = 60,
|
|
RESERVED0_FIRST = 60,
|
|
RESERVED0_LAST = 2047,
|
|
VENDOR_SPECIFIC_FIRST = 0x0800,
|
|
VENDOR_SPECIFIC_LAST = 0x0FFF,
|
|
RESERVED1_FIRST = 0x1000,
|
|
RESERVED1_LAST = 0xFFFF,
|
|
END = 0xFFFF
|
|
};
|
|
|
|
struct EcatSIIArea {
|
|
uint16_t pdi_control;
|
|
uint16_t pdi_configuration;
|
|
uint16_t sync_impulse_len;
|
|
uint16_t pdi_configuration2;
|
|
uint16_t configured_station_alias;
|
|
uint8_t reserved0[4];
|
|
uint16_t checksum;
|
|
uint32_t vendor_id;
|
|
uint32_t product_code;
|
|
uint32_t revision_number;
|
|
uint32_t serial_number;
|
|
uint8_t reserved1[8];
|
|
uint16_t bootstrap_receive_mailbox_offset;
|
|
uint16_t bootstrap_receive_mailbox_size;
|
|
uint16_t bootstrap_send_mailbox_offset;
|
|
uint16_t bootstrap_send_mailbox_size;
|
|
uint16_t standard_receive_mailbox_offset;
|
|
uint16_t standard_receive_mailbox_size;
|
|
uint16_t standard_send_mailbox_offset;
|
|
uint16_t standard_send_mailbox_size;
|
|
uint16_t mailbox_protocol;
|
|
uint8_t reserved2[66];
|
|
uint16_t size;
|
|
uint16_t version;
|
|
} __attribute__ ((packed));
|
|
|
|
struct EcatCategoryHeader {
|
|
uint16_t type : 15;
|
|
uint16_t vendor_specific : 1;
|
|
uint16_t word_size;
|
|
} __attribute__ ((packed));
|
|
|
|
struct EcatString {
|
|
uint8_t length;
|
|
const char* data;
|
|
};
|
|
|
|
struct EcatStrings {
|
|
uint8_t nstrings;
|
|
} __attribute__ ((packed));
|
|
|
|
struct EcatGeneral {
|
|
uint8_t group_idx;
|
|
uint8_t img_idx;
|
|
uint8_t order_idx;
|
|
uint8_t name_idx;
|
|
uint8_t reserved0;
|
|
uint8_t coe_details;
|
|
uint8_t foe_details;
|
|
uint8_t eoe_details;
|
|
uint8_t soe_channels;
|
|
uint8_t ds402_channels;
|
|
uint8_t sysman_class;
|
|
uint8_t flags;
|
|
int16_t current_on_ebus;
|
|
uint8_t group_idx_dup;
|
|
uint8_t reserved1[1];
|
|
uint16_t physical_port;
|
|
uint16_t physical_memory_address;
|
|
uint8_t reserved2[12];
|
|
} __attribute__ ((packed));
|
|
|
|
struct EcatFMMU {
|
|
uint8_t fmmu0;
|
|
uint8_t fmmu1;
|
|
uint8_t fmmu2;
|
|
uint8_t fmmu3;
|
|
} __attribute__ ((packed));
|
|
|
|
template<typename WordT>
|
|
struct EcatSyncManager {
|
|
WordT physical_start_address;
|
|
WordT length;
|
|
uint8_t control_register;
|
|
uint8_t status_register;
|
|
uint8_t enable_synch_manager;
|
|
uint8_t sync_manager_type;
|
|
} __attribute__ ((packed));
|
|
|
|
template<typename WordT>
|
|
struct EcatPDOEntry {
|
|
uint16_t index;
|
|
uint8_t subindex;
|
|
uint8_t name_idx;
|
|
uint8_t datatype;
|
|
uint8_t length;
|
|
WordT flags;
|
|
} __attribute__ ((packed));
|
|
|
|
template<typename WordT>
|
|
struct EcatPDO {
|
|
uint16_t index;
|
|
uint8_t nentries;
|
|
uint8_t syncmanager;
|
|
uint8_t synchronization;
|
|
uint8_t name_idx;
|
|
WordT flags;
|
|
} __attribute__ ((packed));
|
|
|
|
class EcatSII {
|
|
public:
|
|
EcatSII() { }
|
|
|
|
private:
|
|
EcatSIIArea sii_area_;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* FREE_RTOS_ETHERNET_INDUSTRY_ETH_ECAT_SII_HPP_ */
|