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
a20461e0
Commit
a20461e0
authored
16 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Show attached slave position and state in 'ethercat config'.
parent
ca542003
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
TODO
+0
-1
0 additions, 1 deletion
TODO
master/cdev.c
+1
-3
1 addition, 3 deletions
master/cdev.c
master/ioctl.h
+1
-2
1 addition, 2 deletions
master/ioctl.h
tool/CommandConfig.cpp
+54
-23
54 additions, 23 deletions
tool/CommandConfig.cpp
tool/CommandConfig.h
+3
-3
3 additions, 3 deletions
tool/CommandConfig.h
with
59 additions
and
32 deletions
TODO
+
0
−
1
View file @
a20461e0
...
@@ -16,7 +16,6 @@ Version 1.4.0:
...
@@ -16,7 +16,6 @@ Version 1.4.0:
* ethercat tool:
* ethercat tool:
- Replace --slave by --position.
- Replace --slave by --position.
- Add --alias option.
- Add --alias option.
- Show attached slave position.
- Show Pdos in 'ethercat slave -v'.
- Show Pdos in 'ethercat slave -v'.
- Accept files from stdin.
- Accept files from stdin.
- Display attached device's MAC address instead of ff's.
- Display attached device's MAC address instead of ff's.
...
...
This diff is collapsed.
Click to expand it.
master/cdev.c
+
1
−
3
View file @
a20461e0
...
@@ -994,9 +994,7 @@ int ec_cdev_ioctl_config(
...
@@ -994,9 +994,7 @@ int ec_cdev_ioctl_config(
ec_pdo_list_count
(
&
sc
->
sync_configs
[
i
].
pdos
);
ec_pdo_list_count
(
&
sc
->
sync_configs
[
i
].
pdos
);
}
}
data
.
sdo_count
=
ec_slave_config_sdo_count
(
sc
);
data
.
sdo_count
=
ec_slave_config_sdo_count
(
sc
);
data
.
attached
=
sc
->
slave
!=
NULL
;
data
.
slave_position
=
sc
->
slave
?
sc
->
slave
->
ring_position
:
-
1
;
data
.
operational
=
sc
->
slave
&&
sc
->
slave
->
current_state
==
EC_SLAVE_STATE_OP
;
up
(
&
master
->
master_sem
);
up
(
&
master
->
master_sem
);
...
...
This diff is collapsed.
Click to expand it.
master/ioctl.h
+
1
−
2
View file @
a20461e0
...
@@ -301,8 +301,7 @@ typedef struct {
...
@@ -301,8 +301,7 @@ typedef struct {
uint32_t
pdo_count
;
uint32_t
pdo_count
;
}
syncs
[
EC_MAX_SYNC_MANAGERS
];
}
syncs
[
EC_MAX_SYNC_MANAGERS
];
uint32_t
sdo_count
;
uint32_t
sdo_count
;
uint8_t
attached
:
1
,
int32_t
slave_position
;
operational
:
1
;
}
ec_ioctl_config_t
;
}
ec_ioctl_config_t
;
/*****************************************************************************/
/*****************************************************************************/
...
...
This diff is collapsed.
Click to expand it.
tool/CommandConfig.cpp
+
54
−
23
View file @
a20461e0
...
@@ -33,11 +33,16 @@ string CommandConfig::helpString() const
...
@@ -33,11 +33,16 @@ string CommandConfig::helpString() const
<<
"Without the --verbose option, slave configurations are"
<<
endl
<<
"Without the --verbose option, slave configurations are"
<<
endl
<<
"output one-per-line. Example:"
<<
endl
<<
"output one-per-line. Example:"
<<
endl
<<
endl
<<
endl
<<
"1001:0 0x0000003b/0x02010000
-
-
"
<<
endl
<<
"1001:0 0x0000003b/0x02010000
3
OP
"
<<
endl
<<
"| | | |"
<<
endl
<<
"| | | |"
<<
endl
<<
"| | |
\\
- Slave is operational."
<<
"| | |
\\
- Application-layer"
<<
endl
<<
endl
<<
"| | | state of the attached"
<<
endl
<<
"| |
\\
- Slave has been found."
<<
endl
<<
"| | | slave, or '-', if no"
<<
endl
<<
"| | | slave is attached."
<<
endl
<<
"| |
\\
- Absolute decimal ring"
<<
endl
<<
"| | position of the attached"
<<
endl
<<
"| | slave, or '-' if none"
<<
endl
<<
"| | attached."
<<
endl
<<
"|
\\
- Vendor ID and product code (both"
<<
endl
<<
"|
\\
- Vendor ID and product code (both"
<<
endl
<<
"| hexadecimal)."
<<
endl
<<
"| hexadecimal)."
<<
endl
<<
"
\\
- Alias and relative position (both decimal)."
<<
endl
<<
"
\\
- Alias and relative position (both decimal)."
<<
endl
...
@@ -86,7 +91,7 @@ void CommandConfig::execute(MasterDevice &m, const StringVector &args)
...
@@ -86,7 +91,7 @@ void CommandConfig::execute(MasterDevice &m, const StringVector &args)
if
(
getVerbosity
()
==
Verbose
)
{
if
(
getVerbosity
()
==
Verbose
)
{
showDetailedConfigs
(
m
,
configList
);
showDetailedConfigs
(
m
,
configList
);
}
else
{
}
else
{
listConfigs
(
configList
);
listConfigs
(
m
,
configList
);
}
}
}
}
...
@@ -101,6 +106,7 @@ void CommandConfig::showDetailedConfigs(
...
@@ -101,6 +106,7 @@ void CommandConfig::showDetailedConfigs(
{
{
ConfigList
::
const_iterator
configIter
;
ConfigList
::
const_iterator
configIter
;
unsigned
int
j
,
k
,
l
;
unsigned
int
j
,
k
,
l
;
ec_ioctl_slave_t
slave
;
ec_ioctl_config_pdo_t
pdo
;
ec_ioctl_config_pdo_t
pdo
;
ec_ioctl_config_pdo_entry_t
entry
;
ec_ioctl_config_pdo_entry_t
entry
;
ec_ioctl_config_sdo_t
sdo
;
ec_ioctl_config_sdo_t
sdo
;
...
@@ -117,8 +123,15 @@ void CommandConfig::showDetailedConfigs(
...
@@ -117,8 +123,15 @@ void CommandConfig::showDetailedConfigs(
<<
setw
(
8
)
<<
configIter
->
vendor_id
<<
endl
<<
setw
(
8
)
<<
configIter
->
vendor_id
<<
endl
<<
"Product code: 0x"
<<
"Product code: 0x"
<<
setw
(
8
)
<<
configIter
->
product_code
<<
endl
<<
setw
(
8
)
<<
configIter
->
product_code
<<
endl
<<
"Attached: "
<<
(
configIter
->
attached
?
"yes"
:
"no"
)
<<
endl
<<
"Attached slave: "
;
<<
"Operational: "
<<
(
configIter
->
operational
?
"yes"
:
"no"
)
<<
endl
;
if
(
configIter
->
slave_position
!=
-
1
)
{
m
.
getSlave
(
&
slave
,
configIter
->
slave_position
);
cout
<<
configIter
->
slave_position
<<
" ("
<<
alStateString
(
slave
.
state
)
<<
")"
<<
endl
;
}
else
{
cout
<<
"none"
<<
endl
;
}
for
(
j
=
0
;
j
<
EC_MAX_SYNC_MANAGERS
;
j
++
)
{
for
(
j
=
0
;
j
<
EC_MAX_SYNC_MANAGERS
;
j
++
)
{
if
(
configIter
->
syncs
[
j
].
pdo_count
)
{
if
(
configIter
->
syncs
[
j
].
pdo_count
)
{
...
@@ -188,7 +201,10 @@ void CommandConfig::showDetailedConfigs(
...
@@ -188,7 +201,10 @@ void CommandConfig::showDetailedConfigs(
/** Lists the bus configuration.
/** Lists the bus configuration.
*/
*/
void
CommandConfig
::
listConfigs
(
const
ConfigList
&
configList
)
void
CommandConfig
::
listConfigs
(
MasterDevice
&
m
,
const
ConfigList
&
configList
)
{
{
ConfigList
::
const_iterator
configIter
;
ConfigList
::
const_iterator
configIter
;
stringstream
str
;
stringstream
str
;
...
@@ -197,7 +213,8 @@ void CommandConfig::listConfigs(const ConfigList &configList)
...
@@ -197,7 +213,8 @@ void CommandConfig::listConfigs(const ConfigList &configList)
InfoList
list
;
InfoList
list
;
InfoList
::
const_iterator
iter
;
InfoList
::
const_iterator
iter
;
unsigned
int
maxAliasWidth
=
0
,
maxPosWidth
=
0
,
unsigned
int
maxAliasWidth
=
0
,
maxPosWidth
=
0
,
maxAttWidth
=
0
,
maxOpWidth
=
0
;
maxSlavePosWidth
=
0
,
maxStateWidth
=
0
;
ec_ioctl_slave_t
slave
;
for
(
configIter
=
configList
.
begin
();
for
(
configIter
=
configList
.
begin
();
configIter
!=
configList
.
end
();
configIter
!=
configList
.
end
();
...
@@ -220,15 +237,29 @@ void CommandConfig::listConfigs(const ConfigList &configList)
...
@@ -220,15 +237,29 @@ void CommandConfig::listConfigs(const ConfigList &configList)
str
.
clear
();
str
.
clear
();
str
.
str
(
""
);
str
.
str
(
""
);
str
<<
(
configIter
->
attached
?
"attached"
:
"-"
);
if
(
configIter
->
slave_position
!=
-
1
)
{
info
.
att
=
str
.
str
();
m
.
getSlave
(
&
slave
,
configIter
->
slave_position
);
str
.
clear
();
str
.
str
(
""
);
str
<<
(
configIter
->
operational
?
"operational"
:
"-"
);
str
<<
configIter
->
slave_position
;
info
.
op
=
str
.
str
();
info
.
slavePos
=
str
.
str
();
str
.
clear
();
str
.
clear
();
str
.
str
(
""
);
str
.
str
(
""
);
str
<<
alStateString
(
slave
.
state
);
info
.
state
=
str
.
str
();
str
.
clear
();
str
.
str
(
""
);
}
else
{
str
<<
"-"
;
info
.
slavePos
=
str
.
str
();
str
.
clear
();
str
.
str
(
""
);
str
<<
"-"
;
info
.
state
=
str
.
str
();
str
.
clear
();
str
.
str
(
""
);
}
list
.
push_back
(
info
);
list
.
push_back
(
info
);
...
@@ -236,10 +267,10 @@ void CommandConfig::listConfigs(const ConfigList &configList)
...
@@ -236,10 +267,10 @@ void CommandConfig::listConfigs(const ConfigList &configList)
maxAliasWidth
=
info
.
alias
.
length
();
maxAliasWidth
=
info
.
alias
.
length
();
if
(
info
.
pos
.
length
()
>
maxPosWidth
)
if
(
info
.
pos
.
length
()
>
maxPosWidth
)
maxPosWidth
=
info
.
pos
.
length
();
maxPosWidth
=
info
.
pos
.
length
();
if
(
info
.
att
.
length
()
>
max
Att
Width
)
if
(
info
.
slavePos
.
length
()
>
max
SlavePos
Width
)
max
Att
Width
=
info
.
att
.
length
();
max
SlavePos
Width
=
info
.
slavePos
.
length
();
if
(
info
.
op
.
length
()
>
max
Op
Width
)
if
(
info
.
state
.
length
()
>
max
State
Width
)
max
Op
Width
=
info
.
op
.
length
();
max
State
Width
=
info
.
state
.
length
();
}
}
for
(
iter
=
list
.
begin
();
iter
!=
list
.
end
();
iter
++
)
{
for
(
iter
=
list
.
begin
();
iter
!=
list
.
end
();
iter
++
)
{
...
@@ -250,8 +281,8 @@ void CommandConfig::listConfigs(const ConfigList &configList)
...
@@ -250,8 +281,8 @@ void CommandConfig::listConfigs(const ConfigList &configList)
<<
" "
<<
" "
<<
iter
->
ident
<<
iter
->
ident
<<
" "
<<
" "
<<
setw
(
max
Att
Width
)
<<
iter
->
att
<<
" "
<<
setw
(
max
SlavePos
Width
)
<<
iter
->
slavePos
<<
" "
<<
setw
(
max
Op
Width
)
<<
iter
->
op
<<
" "
<<
setw
(
max
State
Width
)
<<
iter
->
state
<<
" "
<<
endl
;
<<
endl
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tool/CommandConfig.h
+
3
−
3
View file @
a20461e0
...
@@ -28,14 +28,14 @@ class CommandConfig:
...
@@ -28,14 +28,14 @@ class CommandConfig:
string
alias
;
string
alias
;
string
pos
;
string
pos
;
string
ident
;
string
ident
;
string
att
;
string
slavePos
;
string
op
;
string
state
;
};
};
typedef
list
<
ec_ioctl_config_t
>
ConfigList
;
typedef
list
<
ec_ioctl_config_t
>
ConfigList
;
void
showDetailedConfigs
(
MasterDevice
&
,
const
ConfigList
&
);
void
showDetailedConfigs
(
MasterDevice
&
,
const
ConfigList
&
);
void
listConfigs
(
const
ConfigList
&
);
void
listConfigs
(
MasterDevice
&
m
,
const
ConfigList
&
);
};
};
/****************************************************************************/
/****************************************************************************/
...
...
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