Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
etherlabmaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
ICS Control System Infrastructure
etherlabmaster
Commits
8a629c11
Commit
8a629c11
authored
15 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
'ethercat xml' creates <EtherCATInfoList> for more than one slave.
parent
4a91a023
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS
+2
-0
2 additions, 0 deletions
NEWS
tool/CommandXml.cpp
+44
-30
44 additions, 30 deletions
tool/CommandXml.cpp
tool/CommandXml.h
+2
-1
2 additions, 1 deletion
tool/CommandXml.h
with
48 additions
and
31 deletions
NEWS
+
2
−
0
View file @
8a629c11
...
...
@@ -40,6 +40,8 @@ Changes since 1.4.0:
an application transfer SDOs before activating the master. Thanks to Stefan
Weiser.
* Changed EC_MAX_SII_SIZE to 4096.
* 'ethercat xml' creates valid XML <EtherCATInfoList> for more than one slave
(thanks to E. Burgstaller).
Changes in 1.4.0:
...
...
This diff is collapsed.
Click to expand it.
tool/CommandXml.cpp
+
44
−
30
View file @
8a629c11
...
...
@@ -82,8 +82,17 @@ void CommandXml::execute(MasterDevice &m, const StringVector &args)
m
.
open
(
MasterDevice
::
Read
);
slaves
=
selectedSlaves
(
m
);
cout
<<
"<?xml version=
\"
1.0
\"
?>"
<<
endl
;
if
(
slaves
.
size
()
>
1
)
{
cout
<<
"<EtherCATInfoList>"
<<
endl
;
}
for
(
si
=
slaves
.
begin
();
si
!=
slaves
.
end
();
si
++
)
{
generateSlaveXml
(
m
,
*
si
);
generateSlaveXml
(
m
,
*
si
,
slaves
.
size
()
>
1
?
1
:
0
);
}
if
(
slaves
.
size
()
>
1
)
{
cout
<<
"</EtherCATInfoList>"
<<
endl
;
}
}
...
...
@@ -91,26 +100,30 @@ void CommandXml::execute(MasterDevice &m, const StringVector &args)
void
CommandXml
::
generateSlaveXml
(
MasterDevice
&
m
,
const
ec_ioctl_slave_t
&
slave
const
ec_ioctl_slave_t
&
slave
,
unsigned
int
indent
)
{
ec_ioctl_slave_sync_t
sync
;
ec_ioctl_slave_sync_pdo_t
pdo
;
string
pdoType
;
string
pdoType
,
in
;
ec_ioctl_slave_sync_pdo_entry_t
entry
;
unsigned
int
i
,
j
,
k
;
for
(
i
=
0
;
i
<
indent
;
i
++
)
{
in
+=
" "
;
}
cout
<<
"<?xml version=
\"
1.0
\"
?>"
<<
endl
<<
" <EtherCATInfo>"
<<
endl
<<
" <!-- Slave "
<<
slave
.
position
<<
" -->"
<<
endl
<<
" <Vendor>"
<<
endl
<<
" <Id>"
<<
slave
.
vendor_id
<<
"</Id>"
<<
endl
<<
" </Vendor>"
<<
endl
<<
" <Descriptions>"
<<
endl
<<
" <Devices>"
<<
endl
<<
" <Device>"
<<
endl
<<
" <Type ProductCode=
\"
#x"
<<
in
<<
"<EtherCATInfo>"
<<
endl
<<
in
<<
" <!-- Slave "
<<
slave
.
position
<<
" -->"
<<
endl
<<
in
<<
" <Vendor>"
<<
endl
<<
in
<<
" <Id>"
<<
slave
.
vendor_id
<<
"</Id>"
<<
endl
<<
in
<<
" </Vendor>"
<<
endl
<<
in
<<
" <Descriptions>"
<<
endl
<<
in
<<
" <Devices>"
<<
endl
<<
in
<<
" <Device>"
<<
endl
<<
in
<<
" <Type ProductCode=
\"
#x"
<<
hex
<<
setfill
(
'0'
)
<<
setw
(
8
)
<<
slave
.
product_code
<<
"
\"
RevisionNo=
\"
#x"
<<
hex
<<
setfill
(
'0'
)
<<
setw
(
8
)
<<
slave
.
revision_number
...
...
@@ -118,7 +131,7 @@ void CommandXml::generateSlaveXml(
if
(
strlen
(
slave
.
name
))
{
cout
<<
"
<Name><![CDATA["
<<
in
<<
"
<Name><![CDATA["
<<
slave
.
name
<<
"]]></Name>"
<<
endl
;
}
...
...
@@ -127,7 +140,7 @@ void CommandXml::generateSlaveXml(
m
.
getSync
(
&
sync
,
slave
.
position
,
i
);
cout
<<
"
<Sm Enable=
\"
"
<<
dec
<<
(
unsigned
int
)
sync
.
enable
<<
in
<<
"
<Sm Enable=
\"
"
<<
dec
<<
(
unsigned
int
)
sync
.
enable
<<
"
\"
StartAddress=
\"
"
<<
sync
.
physical_start_address
<<
"
\"
ControlByte=
\"
"
<<
(
unsigned
int
)
sync
.
control_register
<<
"
\"
DefaultSize=
\"
"
<<
sync
.
default_size
...
...
@@ -143,37 +156,37 @@ void CommandXml::generateSlaveXml(
pdoType
+=
"xPdo"
;
// last 2 letters lowercase in XML!
cout
<<
"
<"
<<
pdoType
<<
in
<<
"
<"
<<
pdoType
<<
" Sm=
\"
"
<<
i
<<
"
\"
Fixed=
\"
1
\"
Mandatory=
\"
1
\"
>"
<<
endl
<<
"
<Index>#x"
<<
in
<<
"
<Index>#x"
<<
hex
<<
setfill
(
'0'
)
<<
setw
(
4
)
<<
pdo
.
index
<<
"</Index>"
<<
endl
<<
"
<Name>"
<<
pdo
.
name
<<
"</Name>"
<<
endl
;
<<
in
<<
"
<Name>"
<<
pdo
.
name
<<
"</Name>"
<<
endl
;
for
(
k
=
0
;
k
<
pdo
.
entry_count
;
k
++
)
{
m
.
getPdoEntry
(
&
entry
,
slave
.
position
,
i
,
j
,
k
);
cout
<<
"
<Entry>"
<<
endl
<<
"
<Index>#x"
<<
in
<<
"
<Entry>"
<<
endl
<<
in
<<
"
<Index>#x"
<<
hex
<<
setfill
(
'0'
)
<<
setw
(
4
)
<<
entry
.
index
<<
"</Index>"
<<
endl
;
if
(
entry
.
index
)
cout
<<
"
<SubIndex>"
<<
in
<<
"
<SubIndex>"
<<
dec
<<
(
unsigned
int
)
entry
.
subindex
<<
"</SubIndex>"
<<
endl
;
cout
<<
"
<BitLen>"
<<
in
<<
"
<BitLen>"
<<
dec
<<
(
unsigned
int
)
entry
.
bit_length
<<
"</BitLen>"
<<
endl
;
if
(
entry
.
index
)
{
cout
<<
"
<Name>"
<<
entry
.
name
<<
in
<<
"
<Name>"
<<
entry
.
name
<<
"</Name>"
<<
endl
<<
"
<DataType>"
;
<<
in
<<
"
<DataType>"
;
if
(
entry
.
bit_length
==
1
)
{
cout
<<
"BOOL"
;
...
...
@@ -192,18 +205,19 @@ void CommandXml::generateSlaveXml(
cout
<<
"</DataType>"
<<
endl
;
}
cout
<<
"
</Entry>"
<<
endl
;
cout
<<
in
<<
"
</Entry>"
<<
endl
;
}
cout
<<
"
</"
<<
pdoType
<<
">"
<<
endl
;
<<
in
<<
"
</"
<<
pdoType
<<
">"
<<
endl
;
}
}
cout
<<
"
</Device>"
<<
endl
<<
"
</Devices>"
<<
endl
<<
" </Descriptions>"
<<
endl
<<
"</EtherCATInfo>"
<<
endl
;
<<
in
<<
"
</Device>"
<<
endl
<<
in
<<
" </Devices>"
<<
endl
<<
in
<<
" </Descriptions>"
<<
endl
<<
in
<<
"</EtherCATInfo>"
<<
endl
;
}
/*****************************************************************************/
This diff is collapsed.
Click to expand it.
tool/CommandXml.h
+
2
−
1
View file @
8a629c11
...
...
@@ -44,7 +44,8 @@ class CommandXml:
void
execute
(
MasterDevice
&
,
const
StringVector
&
);
protected:
void
generateSlaveXml
(
MasterDevice
&
,
const
ec_ioctl_slave_t
&
);
void
generateSlaveXml
(
MasterDevice
&
,
const
ec_ioctl_slave_t
&
,
unsigned
int
);
};
/****************************************************************************/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment