esi

package module
v0.0.0-...-3a5b6d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2024 License: GPL-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ESIData

type ESIData struct {
	EtherCATInfo xml.Name       `xml:"EtherCATInfo"`
	VendorID     string         `xml:"Vendor>Id"`
	VendorNames  []*ESILangName `xml:"Vendor>Name"`
	VendorName   string
	Groups       []*ESIGroup  `xml:"Descriptions>Groups>Group"`
	Devices      []*ESIDevice `xml:"Descriptions>Devices>Device"`
}

type ESIDataType

type ESIDataType struct {
	Name     string                `xml:"Name"`
	BitSize  int                   `xml:"BitSize"`
	SubItems []*ESIDataTypeSubItem `xml:"SubItem"`
}

type ESIDataTypeSubItem

type ESIDataTypeSubItem struct {
	SubIndex  int    `xml:"SubIdx"`
	Name      string `xml:"Name"`
	Type      string `xml:"Type"`
	BitSize   int    `xml:"BitSize"`
	BitOffset int    `xml:"BitOffs"`
	Access    string `xml:"Flags>Access"`
	Category  string `xml:"Flags>Category"`
}

type ESIDevice

type ESIDevice struct {
	Type struct {
		Type            string `xml:",chardata"`
		ProductCode     string `xml:"ProductCode,attr"`
		RevisionNo      string `xml:"RevisionNo,attr"`
		CheckRevisionNo string `xml:"CheckRevisionNo,attr"`
	} `xml:"Type" yaml:"-"`

	Names     []ESIName      `xml:"Name" yaml:",omitempty"`
	URLs      []ESIDeviceURL `xml:"URL" yaml:",omitempty"`
	Info      ESIDeviceInfo  `xml:"Info" yaml:"Info,omitempty"`
	GroupType string         `xml:"GroupType" yaml:",omitempty"` // maps to ESIGroup.Type

	ShortType   string         `yaml:"Type,omitempty"`
	ProductCode string         `yaml:"ProductCode,omitempty"`
	RevisionNo  string         `yaml:"RevisionNo,omitempty"`
	EnglishURL  string         `yaml:"URL,omitempty"`
	EnglishName string         `yaml:"Name,omitempty"`
	GroupName   string         `yaml:"DeviceGroup,omitempty"`
	Vendor      string         `yaml:"Vendor,omitempty"`
	VendorID    string         `yaml:"VendorID,omitempty"`
	Profile     ESIProfile     `yaml:"Profile,omitempty"`
	TxPDOs      []*ESIPDO      `xml:"TxPdo" yaml:"TxPDOs,omitempty"`
	RxPDOs      []*ESIPDO      `xml:"RxPdo" yaml:"RxPDOs,omitempty"`
	IDs         []*ESIDeviceID `yaml:"IDs"`
}

func MergeDevices

func MergeDevices(devices []*ESIDevice) ([]*ESIDevice, error)

Merge devices together if they have identical RxPDO/TxPDO/Object configurations. This should be a fairly conservative way to catch mostly-identical devices that can share the same driver.

This also *dramatically* reduces the side of the output, from 73M to 24M.

For example, this decides that the following are mostly identical:

- EJ2008 - EJ2128 - EL2008 - EL2008-0015 - EL2088 - EL2788 - EL2798 - EL2808 - EL2828 - ELX2008 - EP2008-0001 - EP2008-0002 - EP2008-0022 - EP2028-0001 - EP2028-0002 - EP2028-0032 - EPP2008-0001 - EPP2008-0002 - EPP2008-0022 - EPP2028-0001 - EPP2028-0002 - EQ2008-0002

Unfortunately, this is still a bit odd about different revisions of devices. For example, according to the current ESI files from Beckhoff, the EL7031 comes in multiple revisions:

- 0x00100000 "rev0" - 0x0010001e "rev0e" -- actually differnet HW? - 0x00110000 "rev1" -- identical to rev0 - 0x00120000 "rev2" -- adds a bunch of 0x6020 and 0x7020 PDOs which aren't in rev0 - 0x00130000 "rev3" -- similar to rev2, but names reformatted - 0x00140000 "rev4" -- identical to rev3 - 0x00150000 "rev5" -- identical to rev3 - 0x00160000 "rev6" -- identical to rev3 - 0x00170000 "rev7" -- similar to rev2, but deletes a bunch of PDOs from 'objects' - 0x00180000 "rev8" -- similar to rev7, but adds 0x7021 PDOs - 0x00190000 "rev9" -- identical to rev8 - 0x001a0000 "rev10" -- similar to rev8, but adds 0x6020:0x23

These are currently broken into 7 different blocks by this code, because (to some extent) these actually *are* several different devices. Attempting to access 0x6020 PDOs with a rev0 or rev1 device will fail, probably keeping LCEC from starting up at all.

Looking at our code, the el70x1 driver supports the EL7031 and the EL7041-0052. Amazingly, this code actually groups the "rev10" EL7031 together with all of the revs of the EL7041-0052.

func ParseESIFile

func ParseESIFile(filename string, emitPDOs, emitObjects bool) ([]*ESIDevice, error)

type ESIDeviceID

type ESIDeviceID struct {
	Type        string `yaml:"Type,omitempty"`
	ProductCode string `yaml:"ProductCode,omitempty"`
	RevisionNo  string `yaml:"RevisionNo,omitempty"`
	URL         string `yaml:"URL,omitempty"`
	Name        string `yaml:"Name,omitempty"`
	Vendor      string `yaml:"Vendor,omitempty"`
	VendorID    string `yaml:"VendorID,omitempty"`
}

type ESIDeviceInfo

type ESIDeviceInfo struct {
	Current         string              `xml:"Electrical>EBusCurrent" yaml:",omitempty"`
	RequestTimeout  int                 `xml:"Mailbox>Timeout>RequestTimeout" yaml:",omitempty"`
	ResponseTimeout int                 `xml:"Mailbox>Timeout>ResponseTimeout" yaml:",omitempty"`
	Ports           []ESIDeviceInfoPort `xml:"Port" yaml:",omitempty"`
}

type ESIDeviceInfoPort

type ESIDeviceInfoPort struct {
	Type  string
	Label string
}

type ESIDeviceURL

type ESIDeviceURL struct {
	URL        string `xml:",chardata"`
	LanguageID string `xml:"LcId,attr"`
}

type ESIGroup

type ESIGroup struct {
	Type        string    `xml:"Type"`
	Names       []ESIName `xml:"Name"`
	EnglishName string
}

type ESILangName

type ESILangName struct {
	Name       string `xml:",chardata"`
	LanguageID string `xml:"LcId,attr"`
}

type ESIName

type ESIName struct {
	Name       string `xml:",chardata"`
	LanguageID string `xml:"LcId,attr"`
}

type ESIObject

type ESIObject struct {
	Index    string              `xml:"Index" yaml:",omitempty"`
	Name     string              `xml:"Name" yaml:",omitempty"`
	TypeName string              `xml:"Type" yaml:",omitempty"`
	BitSize  int                 `xml:"BitSize" yaml:",omitempty"`
	SubItems []*ESIObjectSubItem `xml:"Info>SubItem" yaml:",omitempty"`
}

type ESIObjectSubItem

type ESIObjectSubItem struct {
	Name        string `xml:"Name"\ yaml:",omitempty"`
	DefaultData string `xml:"Info>DefaultData" yaml:",omitempty"`
	Type        string `yaml:"Type,omitempty"`
	BitSize     int    `yaml:"BitSize,omitempty"`
	BitOffset   int    `yaml:"BitOffs,omitempty"`
	Access      string `yaml:"Access,omitempty"`
	Category    string `yaml:"Category,omitempty"`
}

type ESIPDO

type ESIPDO struct {
	Index     string         `xml:"Index" yaml:"Index,omitempty"`
	PDOName   string         `yaml:"Name,omitempty"`
	LangNames []*ESILangName `xml:"Name"`
	Ref       string         `xml:"Ref,attr" yaml:"Ref,omitempty"`
	Chn       string         `xml:"Chn,attr" yaml:"Chn,omitempty"`
	Fixed     string         `xml:"Fixed,attr" yaml:"Fixed,omitempty"`
	Sm        string         `xml:"Sm,attr" yaml:"Sm,omitempty"`
	Entries   []*ESIPDOEntry `xml:"Entry" yaml:"Entry,omitempty"`
}

type ESIPDOEntry

type ESIPDOEntry struct {
	PDOName   string          `yaml:"Name,omitempty"`
	LangNames []*ESILangName  `xml:"Name" yaml:"Names,omitempty"`
	Index     string          `xml:"Index" yaml:"Index,omitempty"`
	SubIndex  string          `xml:"SubIndex" yaml:"SubIndex,omitempty"`
	BitLen    int             `xml:"BitLen" yaml:"BitLen,omitempty"`
	Dtype     ESIPDOEntryData `xml:"DataType" yaml:",omitempty"`
	DataType  string          `xml:"-" yaml:"DataType,omitempty"`
	DataScale string          `xml:"-" yaml:"DataScale,omitempty"`
	Comment   string          `xml:"Comment" yaml:"Comment,omitempty"`
}

type ESIPDOEntryData

type ESIPDOEntryData struct {
	DataType  string `xml:",chardata"`
	DataScale string `xml:"DScale,attr"`
}

type ESIProfile

type ESIProfile struct {
	ProfileNo   int            `xml:"ProfileNo" yaml:",omitempty"`
	Channels    int            `xml:"ChannelCount" yaml:",omitempty"`
	AddInfo     int            `xml:"AddInfo" yaml:",omitempty"` // what is "AddInfo?"
	DataTypes   []*ESIDataType `xml:"Dictionary>DataTypes>DataType"`
	DataTypeMap map[string]*ESIDataType
	Objects     []*ESIObject `xml:"Dictionary>Objects>Object" yaml:"Objects,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL