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
31863f2d
Commit
31863f2d
authored
18 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Introduced DEVICE_MODULES variable in sysconfig file; enabled init
script to handle serveral device modules.
parent
4a317b3e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
script/init.d/ethercat
+43
-37
43 additions, 37 deletions
script/init.d/ethercat
script/sysconfig/ethercat
+13
-1
13 additions, 1 deletion
script/sysconfig/ethercat
with
56 additions
and
38 deletions
script/init.d/ethercat
+
43
−
37
View file @
31863f2d
...
...
@@ -56,7 +56,7 @@ XMLDEVICE='ecxml'
ETHERCAT_CONFIG
=
/etc/sysconfig/ethercat
if
[
!
-r
${
ETHERCAT_CONFIG
}
]
;
then
echo
"
${
ETHERCAT_CONFIG
}
not existing
"
;
echo
${
ETHERCAT_CONFIG
}
not existing
;
if
[
"
${
1
}
"
=
"stop"
]
;
then
exit
0
else
...
...
@@ -111,17 +111,6 @@ start)
MASTER_INDEX
=
$(
expr
${
MASTER_INDEX
}
+ 1
)
done
# unload conflicting modules at first
for
MODULE
in
8139too
;
do
if
lsmod |
grep
"^
${
MODULE
}
"
>
/dev/null
;
then
if
!
rmmod
${
MODULE
}
;
then
/bin/false
rc_status
-v
rc_exit
fi
fi
done
# load master module
if
!
modprobe ec_master
main
=
${
DEVICES
}
backup
=
${
BACKUPS
}
;
then
modprobe 8139too
...
...
@@ -139,14 +128,26 @@ start)
# create character device
mknod
/dev/
${
XMLDEVICE
}
0 c
${
MAJOR
}
0
# load device module
if
!
modprobe ec_8139too
;
then
rmmod ec_master
modprobe 8139too
/bin/false
rc_status
-v
rc_exit
fi
# check for modules to replace
for
MODULE
in
${
DEVICE_MODULES
}
;
do
ECMODULE
=
ec_
${
MODULE
}
if
!
modinfo
${
ECMODULE
}
>
/dev/null
;
then
continue
fi
if
lsmod |
grep
"^
${
MODULE
}
"
>
/dev/null
;
then
if
!
rmmod
${
MODULE
}
;
then
/bin/false
rc_status
-v
rc_exit
fi
fi
if
!
modprobe
${
ECMODULE
}
;
then
modprobe
${
MODULE
}
# try to restore module
/bin/false
rc_status
-v
rc_exit
fi
done
rc_status
-v
;;
...
...
@@ -154,14 +155,16 @@ start)
stop
)
echo
-n
"Shutting down EtherCAT master "
# unload modules
for
mod
in
ec_8139too ec_master
;
do
if
lsmod |
grep
"^
$mod
"
>
/dev/null
;
then
if
!
rmmod
$mod
;
then
/bin/false
rc_status
-v
rc_exit
fi
;
# unload EtherCAT device modules
for
MODULE
in
${
DEVICE_MODULES
}
master
;
do
ECMODULE
=
ec_
${
MODULE
}
if
!
lsmod |
grep
-q
"^
${
ECMODULE
}
"
;
then
continue
fi
if
!
rmmod
${
ECMODULE
}
;
then
/bin/false
rc_status
-v
rc_exit
fi
;
done
...
...
@@ -171,9 +174,11 @@ stop)
sleep
1
# reload previous modules
if
!
modprobe 8139too
;
then
echo
"Warning: Failed to restore 8139too module."
fi
for
MODULE
in
${
DEVICE_MODULES
}
;
do
if
!
modprobe
${
MODULE
}
;
then
echo
Warning: Failed to restore
${
MODULE
}
.
fi
done
rc_status
-v
;;
...
...
@@ -188,13 +193,14 @@ restart)
status
)
echo
-n
"Checking for EtherCAT "
lsmod |
grep
"^ec_master "
>
/dev/null
master_running
=
$?
lsmod |
grep
"^ec_8139too "
>
/dev/null
device_running
=
$?
lsmod |
grep
-q
"^ec_master "
MASTERS_RUNNING
=
$?
!
grep
-q
"(WAITING)"
/sys/ethercat/master
*
/info
MASTERS_IDLE
=
$?
# master module
and device module loaded
?
test
$
master_running
-eq
0
-a
$device_running
-eq
0
# master module
loaded and masters not waiting for devices
?
test
$
{
MASTERS_RUNNING
}
-eq
0
-a
${
MASTERS_IDLE
}
-eq
0
rc_status
-v
;;
...
...
This diff is collapsed.
Click to expand it.
script/sysconfig/ethercat
+
13
−
1
View file @
31863f2d
...
...
@@ -14,7 +14,7 @@
# redundancy purposes.
#
# There are three formats for specifying ethernet devices:
# 1) MAC address (example: "00:00:08:44:
55
:66"). Specify the MAC address of
# 1) MAC address (example: "00:00:08:44:
ab
:66"). Specify the MAC address of
# the ethernet card to use.
# 2) PCI bus address (example: "01:1c.0"). Specify the PCU bis address of the
# ethernet card to use.
...
...
@@ -29,4 +29,16 @@
MASTER0_DEVICE=
MASTER0_BACKUP=
#
# Ethernet driver modules to replace with EtherCAT-capable ones.
#
# The init script will try to unload the ethernet driver modules in the list
# and replace them with the EtherCAT-capable ones, respectively. If a certain
# (EtherCAT-capable) driver is not found, a warning will appear.
#
# Remove all unused driver modules to prevent unnecesessary module
# replacement.
#
DEVICE_MODULES="8139too e100 forcedeth"
#------------------------------------------------------------------------------
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