Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebpfCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Teichmann
ebpfCAT
Compare revisions
a6bd832a4e0ae682da8d66ccf37d4b3924a3d5ec to cd6d83fc18953e708b41a87f68349e8ee58bcef2
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
teichman/ebpfcat
Select target project
No results found
cd6d83fc18953e708b41a87f68349e8ee58bcef2
Select Git revision
Swap
Target
teichman/ebpfcat
Select target project
teichman/ebpfcat
1 result
a6bd832a4e0ae682da8d66ccf37d4b3924a3d5ec
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (4)
do not send to big packets
· 1bd5250e
Martin Teichmann
authored
1 year ago
1bd5250e
an EL5042 output signed values
· b2dab47b
Martin Teichmann
authored
1 year ago
b2dab47b
improve error messages
· c930bf83
Martin Teichmann
authored
1 year ago
c930bf83
more information for inficon gauges
· cd6d83fc
Martin Teichmann
authored
1 year ago
cd6d83fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ebpfcat/ethercat.py
+29
-13
29 additions, 13 deletions
ebpfcat/ethercat.py
ebpfcat/terminals.py
+5
-1
5 additions, 1 deletion
ebpfcat/terminals.py
with
34 additions
and
14 deletions
ebpfcat/ethercat.py
View file @
cd6d83fc
...
...
@@ -215,7 +215,7 @@ class Packet:
packets. We implicitly add a datagram in the front which later serves
as an identifier for the packet.
"""
MAXSIZE
=
1
0
00
# maximum size we use for an EtherCAT packet
MAXSIZE
=
1
5
00
# maximum size we use for an EtherCAT packet
ETHERNET_HEADER
=
14
PACKET_HEADER
=
16
DATAGRAM_HEADER
=
10
...
...
@@ -236,8 +236,15 @@ class Packet:
Depending on the command, one or two more parameters represent the
address, either terminal and offset for position or node addressing,
or one value for logical addressing.
"""
newsize
=
self
.
size
+
len
(
data
)
+
self
.
DATAGRAM_HEADER
\
+
self
.
DATAGRAM_TAIL
if
newsize
>
self
.
MAXSIZE
:
raise
OverflowError
(
"
ethercat packet size too big
"
)
elif
len
(
self
.
data
)
>
14
:
raise
OverflowError
(
"
Too many datagrams per packet
"
)
self
.
data
.
append
((
cmd
,
data
,
idx
)
+
address
)
self
.
size
+
=
len
(
data
)
+
self
.
DATAGRAM_HEADER
+
self
.
DATAGRAM_TAIL
self
.
size
=
newsize
def
assemble
(
self
,
index
):
"""
Assemble the datagrams into a packet
...
...
@@ -306,17 +313,24 @@ class EtherCat(Protocol):
to be sent from a queue, packs them in a packet and ships them
out.
"""
try
:
packet
=
Packet
()
dgrams
=
[]
packet
=
Packet
()
sent
=
True
while
True
:
*
dgram
,
future
=
await
self
.
send_queue
.
get
()
lastsize
=
packet
.
size
packet
.
append
(
*
dgram
)
dgrams
.
append
((
lastsize
+
10
,
packet
.
size
-
2
,
future
))
if
packet
.
full
()
or
self
.
send_queue
.
empty
():
ensure_future
(
self
.
process_packet
(
dgrams
,
packet
))
dgrams
=
[]
packet
=
Packet
()
if
sent
:
*
dgram
,
future
=
await
self
.
send_queue
.
get
()
try
:
lastsize
=
packet
.
size
packet
.
append
(
*
dgram
)
dgrams
.
append
((
lastsize
+
10
,
packet
.
size
-
2
,
future
))
sent
=
True
if
not
self
.
send_queue
.
empty
():
continue
except
OverflowError
:
sent
=
False
ensure_future
(
self
.
process_packet
(
dgrams
,
packet
))
dgrams
=
[]
packet
=
Packet
()
except
CancelledError
:
raise
except
Exception
:
...
...
@@ -805,10 +819,12 @@ class Terminal:
index
,
subindex
,
data
)
type
,
data
=
await
self
.
mbx_recv
()
if
type
is
not
MBXType
.
COE
:
raise
EtherCatError
(
f
"
expected CoE, got
{
type
}
,
{
data
}
{
odata
}
{
index
:
x
}
{
subindex
}
"
)
raise
EtherCatError
(
f
"
expected CoE, got
{
type
}
,
{
data
}
"
f
"
{
odata
}
{
index
:
x
}
:
{
subindex
:
x
}
"
)
coecmd
,
sdocmd
,
idx
,
subidx
=
unpack
(
"
<HBHB
"
,
data
[:
6
])
if
idx
!=
index
or
subindex
!=
subidx
:
raise
EtherCatError
(
f
"
requested index
{
index
}
, got
{
idx
}
"
)
raise
EtherCatError
(
f
"
requested index
{
index
:
x
}
:
{
subindex
:
x
}
,
"
f
"
got
{
idx
:
x
}
:
{
subidx
:
x
}
"
)
if
coecmd
>>
12
!=
CoECmd
.
SDORES
.
value
:
raise
EtherCatError
(
f
"
expected CoE SDORES, got
{
coecmd
>>
12
:
x
}
"
)
else
:
...
...
This diff is collapsed.
Click to expand it.
ebpfcat/terminals.py
View file @
cd6d83fc
...
...
@@ -130,7 +130,7 @@ class EK1814(EBPFTerminal):
class
EL5042
(
EBPFTerminal
):
compatibility
=
{(
2
,
330444882
)}
class
Channel
(
Struct
):
position
=
ProcessDesc
(
0x6000
,
0x11
)
position
=
ProcessDesc
(
0x6000
,
0x11
,
'
q
'
)
warning
=
ProcessDesc
(
0x6000
,
1
)
error
=
ProcessDesc
(
0x6000
,
2
)
status
=
ProcessDesc
(
0x6000
,
1
,
"
H
"
)
...
...
@@ -199,7 +199,11 @@ class TurboVac(EBPFTerminal):
class
Inficon
(
EBPFTerminal
):
compatibility
=
{(
0x644
,
0x21
)}
valid
=
ProcessDesc
(
0xF640
,
1
)
overrange
=
ProcessDesc
(
0xF640
,
2
)
underrange
=
ProcessDesc
(
0xF640
,
3
)
value
=
ProcessDesc
(
0xF640
,
0x11
,
"
f
"
)
sensorNo
=
ProcessDesc
(
0xF640
,
0x12
,
"
f
"
)
class
Bronkhorst
(
EBPFTerminal
):
...
...
This diff is collapsed.
Click to expand it.