dev(UML-1680): Начало работ по Slave Information Interface SII
This commit is contained in:
parent
39ef0906b7
commit
cc4ee9225c
@ -10,8 +10,9 @@
|
||||
|
||||
#include <kernel/dpl/ClockP.h>
|
||||
|
||||
#include <free_rtos/ethernet_industry/eth_ecat_datagram.hpp>
|
||||
#include "free_rtos/ethernet_industry/eth_ecat_datagram.hpp"
|
||||
#include "free_rtos/ethernet_industry/eth_ecat_telegram.hpp"
|
||||
#include "free_rtos/ethernet_industry/eth_ecat_custom_tuple.hpp"
|
||||
|
||||
namespace free_rtos {
|
||||
|
||||
@ -90,6 +91,24 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct Reader {
|
||||
template<typename DataT>
|
||||
void operator()(DataT& data) {
|
||||
free_rtos::RawData raw_data{};
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TypeT, typename... DataTypes>
|
||||
bool read_block(const datagram::TEcatWkc expected_wkc, typename TypeT::TSlaveAddress& slave_address, uint16_t eeprom_address, DataTypes&... data) {
|
||||
custom_tuple<DataTypes&...> data_tuple{data...};
|
||||
Reader functor{};
|
||||
|
||||
for_each(data_tuple, functor);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2 bytes (1 word) max
|
||||
template<typename TypeT, typename... DataTypes>
|
||||
bool write(const datagram::TEcatWkc expected_wkc, typename TypeT::TSlaveAddress& slave_address, uint16_t eeprom_address, DataTypes&... data) {
|
||||
|
||||
18
components/free_rtos/ethernet_industry/eth_ecat_sii.cpp
Normal file
18
components/free_rtos/ethernet_industry/eth_ecat_sii.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* eth_ecat_sii.cpp
|
||||
*
|
||||
* Created on: Sep 18, 2023
|
||||
* Author: algin
|
||||
*/
|
||||
|
||||
#include "free_rtos/ethernet_industry/eth_ecat_sii.hpp"
|
||||
|
||||
namespace free_rtos {
|
||||
|
||||
namespace sii {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
189
components/free_rtos/ethernet_industry/eth_ecat_sii.hpp
Normal file
189
components/free_rtos/ethernet_industry/eth_ecat_sii.hpp
Normal file
@ -0,0 +1,189 @@
|
||||
/*
|
||||
* 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_ */
|
||||
Loading…
Reference in New Issue
Block a user