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
d08690dd
Commit
d08690dd
authored
16 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Implemented alias and position for configs.
parent
ae546367
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
tool/Command.cpp
+63
-0
63 additions, 0 deletions
tool/Command.cpp
tool/Command.h
+2
-0
2 additions, 0 deletions
tool/Command.h
tool/CommandConfig.cpp
+4
-25
4 additions, 25 deletions
tool/CommandConfig.cpp
tool/CommandConfig.h
+0
-2
0 additions, 2 deletions
tool/CommandConfig.h
with
69 additions
and
28 deletions
TODO
+
0
−
1
View file @
d08690dd
...
@@ -14,7 +14,6 @@ Version 1.4.0:
...
@@ -14,7 +14,6 @@ Version 1.4.0:
* Get original driver for r8169.
* Get original driver for r8169.
* Race in jiffies frame timeout?
* Race in jiffies frame timeout?
* ethercat tool:
* ethercat tool:
- Implement Alias/Position selection for configs.
- Update help for --alias and --position.
- Update help for --alias and --position.
- Show Pdos in 'ethercat slave -v'.
- Show Pdos in 'ethercat slave -v'.
- Accept files from stdin.
- Accept files from stdin.
...
...
This diff is collapsed.
Click to expand it.
tool/Command.cpp
+
63
−
0
View file @
d08690dd
...
@@ -159,6 +159,69 @@ Command::SlaveList Command::selectedSlaves(MasterDevice &m)
...
@@ -159,6 +159,69 @@ Command::SlaveList Command::selectedSlaves(MasterDevice &m)
return
list
;
return
list
;
}
}
/*****************************************************************************/
bool
operator
<
(
const
ec_ioctl_config_t
&
a
,
const
ec_ioctl_config_t
&
b
)
{
return
a
.
alias
<
b
.
alias
||
(
a
.
alias
==
b
.
alias
&&
a
.
position
<
b
.
position
);
}
/*****************************************************************************/
Command
::
ConfigList
Command
::
selectedConfigs
(
MasterDevice
&
m
)
{
unsigned
int
i
;
int
effAlias
;
ec_ioctl_master_t
master
;
ec_ioctl_config_t
config
;
ConfigList
list
;
stringstream
err
;
m
.
getMaster
(
&
master
);
// Assume alias 0 if only position is given.
if
(
alias
==
-
1
&&
position
!=
-
1
)
{
effAlias
=
0
;
}
else
{
effAlias
=
alias
;
}
if
(
effAlias
==
-
1
)
{
// no alias given
if
(
position
==
-
1
)
{
// no alias and position given
// all items
for
(
i
=
0
;
i
<
master
.
config_count
;
i
++
)
{
m
.
getConfig
(
&
config
,
i
);
list
.
push_back
(
config
);
}
}
}
else
{
// alias given
if
(
position
==
-
1
)
{
// alias, but no position given
// take all items with a given alias
for
(
i
=
0
;
i
<
master
.
config_count
;
i
++
)
{
m
.
getConfig
(
&
config
,
i
);
if
(
config
.
alias
==
effAlias
)
{
list
.
push_back
(
config
);
}
}
}
else
{
// alias and position given
for
(
i
=
0
;
i
<
master
.
config_count
;
i
++
)
{
m
.
getConfig
(
&
config
,
i
);
if
(
config
.
alias
==
effAlias
&&
config
.
position
==
position
)
{
list
.
push_back
(
config
);
break
;
// there can be at most one matching
}
}
}
}
list
.
sort
();
return
list
;
}
/****************************************************************************/
/****************************************************************************/
string
Command
::
alStateString
(
uint8_t
state
)
string
Command
::
alStateString
(
uint8_t
state
)
...
...
This diff is collapsed.
Click to expand it.
tool/Command.h
+
2
−
0
View file @
d08690dd
...
@@ -91,6 +91,8 @@ class Command
...
@@ -91,6 +91,8 @@ class Command
typedef
list
<
ec_ioctl_slave_t
>
SlaveList
;
typedef
list
<
ec_ioctl_slave_t
>
SlaveList
;
SlaveList
selectedSlaves
(
MasterDevice
&
);
SlaveList
selectedSlaves
(
MasterDevice
&
);
typedef
list
<
ec_ioctl_config_t
>
ConfigList
;
ConfigList
selectedConfigs
(
MasterDevice
&
);
static
string
alStateString
(
uint8_t
);
static
string
alStateString
(
uint8_t
);
...
...
This diff is collapsed.
Click to expand it.
tool/CommandConfig.cpp
+
4
−
25
View file @
d08690dd
...
@@ -58,40 +58,19 @@ string CommandConfig::helpString() const
...
@@ -58,40 +58,19 @@ string CommandConfig::helpString() const
/*****************************************************************************/
/*****************************************************************************/
bool
operator
<
(
const
ec_ioctl_config_t
&
a
,
const
ec_ioctl_config_t
&
b
)
{
return
a
.
alias
<
b
.
alias
||
(
a
.
alias
==
b
.
alias
&&
a
.
position
<
b
.
position
);
}
/*****************************************************************************/
/** Lists the bus configuration.
/** Lists the bus configuration.
*/
*/
void
CommandConfig
::
execute
(
MasterDevice
&
m
,
const
StringVector
&
args
)
void
CommandConfig
::
execute
(
MasterDevice
&
m
,
const
StringVector
&
args
)
{
{
ec_ioctl_master_t
master
;
ConfigList
configs
;
unsigned
int
i
;
ec_ioctl_config_t
config
;
ConfigList
configList
;
m
.
open
(
MasterDevice
::
Read
);
m
.
open
(
MasterDevice
::
Read
);
m
.
getMaster
(
&
master
);
configs
=
selectedConfigs
(
m
);
for
(
i
=
0
;
i
<
master
.
config_count
;
i
++
)
{
m
.
getConfig
(
&
config
,
i
);
configList
.
push_back
(
config
);
}
configList
.
sort
();
if
(
getVerbosity
()
==
Verbose
)
{
if
(
getVerbosity
()
==
Verbose
)
{
showDetailedConfigs
(
m
,
config
List
);
showDetailedConfigs
(
m
,
config
s
);
}
else
{
}
else
{
listConfigs
(
m
,
config
List
);
listConfigs
(
m
,
config
s
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tool/CommandConfig.h
+
0
−
2
View file @
d08690dd
...
@@ -32,8 +32,6 @@ class CommandConfig:
...
@@ -32,8 +32,6 @@ class CommandConfig:
string
state
;
string
state
;
};
};
typedef
list
<
ec_ioctl_config_t
>
ConfigList
;
void
showDetailedConfigs
(
MasterDevice
&
,
const
ConfigList
&
);
void
showDetailedConfigs
(
MasterDevice
&
,
const
ConfigList
&
);
void
listConfigs
(
MasterDevice
&
m
,
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