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
2862e758
Commit
2862e758
authored
17 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Broadcast MAC address accepts first device.
parent
7cb79e76
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
NEWS
+2
-1
2 additions, 1 deletion
NEWS
TODO
+0
-3
0 additions, 3 deletions
TODO
master/module.c
+31
-15
31 additions, 15 deletions
master/module.c
script/sysconfig/ethercat
+3
-0
3 additions, 0 deletions
script/sysconfig/ethercat
with
36 additions
and
19 deletions
NEWS
+
2
−
1
View file @
2862e758
...
@@ -13,7 +13,8 @@ Changes in version 1.3.0:
...
@@ -13,7 +13,8 @@ Changes in version 1.3.0:
dynamically instead.
dynamically instead.
* Added "main" and "backup" parameters to master module to hand over the
* Added "main" and "backup" parameters to master module to hand over the
MAC addresses of the devices to wait for. This made the ec_device_index
MAC addresses of the devices to wait for. This made the ec_device_index
parameter of the ethernet drivers obsolete.
parameter of the ethernet drivers obsolete. The broadcast MAC address means,
that the master accepts the first device offered by any ethernet driver.
* Changed format of sysconfig file and accordingly adjusted functionality
* Changed format of sysconfig file and accordingly adjusted functionality
of the init script to handle the above MAC address lists.
of the init script to handle the above MAC address lists.
* Realtime interface changes:
* Realtime interface changes:
...
...
This diff is collapsed.
Click to expand it.
TODO
+
0
−
3
View file @
2862e758
...
@@ -6,9 +6,6 @@ $Id$
...
@@ -6,9 +6,6 @@ $Id$
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
* Issues for release 1.3.0:
- Take broadcast MAC address to register the first ethernet device.
* Future features:
* Future features:
- Interface/buffers for asynchronous domain IO.
- Interface/buffers for asynchronous domain IO.
- Distributed clocks.
- Distributed clocks.
...
...
This diff is collapsed.
Click to expand it.
master/module.c
+
31
−
15
View file @
2862e758
...
@@ -248,6 +248,19 @@ int ec_mac_is_zero(const uint8_t *mac)
...
@@ -248,6 +248,19 @@ int ec_mac_is_zero(const uint8_t *mac)
/*****************************************************************************/
/*****************************************************************************/
int
ec_mac_is_broadcast
(
const
uint8_t
*
mac
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
ETH_ALEN
;
i
++
)
if
(
mac
[
i
]
!=
0xff
)
return
0
;
return
1
;
}
/*****************************************************************************/
static
int
ec_mac_parse
(
uint8_t
*
mac
,
const
char
*
src
,
int
allow_empty
)
static
int
ec_mac_parse
(
uint8_t
*
mac
,
const
char
*
src
,
int
allow_empty
)
{
{
unsigned
int
i
,
value
;
unsigned
int
i
,
value
;
...
@@ -400,19 +413,19 @@ int ecdev_offer(struct net_device *net_dev, /**< net_device to offer */
...
@@ -400,19 +413,19 @@ int ecdev_offer(struct net_device *net_dev, /**< net_device to offer */
for
(
i
=
0
;
i
<
master_count
;
i
++
)
{
for
(
i
=
0
;
i
<
master_count
;
i
++
)
{
master
=
&
masters
[
i
];
master
=
&
masters
[
i
];
if
(
ec_mac_equal
(
master
->
main_mac
,
net_dev
->
dev_addr
))
{
ec_mac_print
(
master
->
main_mac
,
str
);
down
(
&
master
->
device_sem
);
if
(
master
->
main_device
.
dev
)
{
// master already has a device
up
(
&
master
->
device_sem
);
continue
;
}
if
(
ec_mac_equal
(
master
->
main_mac
,
net_dev
->
dev_addr
)
||
ec_mac_is_broadcast
(
master
->
main_mac
))
{
ec_mac_print
(
net_dev
->
dev_addr
,
str
);
EC_INFO
(
"Accepting device %s for master %u.
\n
"
,
EC_INFO
(
"Accepting device %s for master %u.
\n
"
,
str
,
master
->
index
);
str
,
master
->
index
);
down
(
&
master
->
device_sem
);
if
(
master
->
main_device
.
dev
)
{
EC_ERR
(
"Master %u already has a device attached.
\n
"
,
master
->
index
);
up
(
&
master
->
device_sem
);
return
-
1
;
}
ec_device_attach
(
&
master
->
main_device
,
net_dev
,
poll
,
module
);
ec_device_attach
(
&
master
->
main_device
,
net_dev
,
poll
,
module
);
up
(
&
master
->
device_sem
);
up
(
&
master
->
device_sem
);
...
@@ -420,9 +433,13 @@ int ecdev_offer(struct net_device *net_dev, /**< net_device to offer */
...
@@ -420,9 +433,13 @@ int ecdev_offer(struct net_device *net_dev, /**< net_device to offer */
*
ecdev
=
&
master
->
main_device
;
// offer accepted
*
ecdev
=
&
master
->
main_device
;
// offer accepted
return
0
;
// no error
return
0
;
// no error
}
}
else
if
(
master
->
debug_level
)
{
else
{
ec_mac_print
(
master
->
main_mac
,
str
);
up
(
&
master
->
device_sem
);
EC_DBG
(
"Master %u declined device %s.
\n
"
,
master
->
index
,
str
);
if
(
master
->
debug_level
)
{
ec_mac_print
(
net_dev
->
dev_addr
,
str
);
EC_DBG
(
"Master %u declined device %s.
\n
"
,
master
->
index
,
str
);
}
}
}
}
}
...
@@ -446,8 +463,7 @@ void ecdev_withdraw(ec_device_t *device /**< EtherCAT device */)
...
@@ -446,8 +463,7 @@ void ecdev_withdraw(ec_device_t *device /**< EtherCAT device */)
ec_master_t
*
master
=
device
->
master
;
ec_master_t
*
master
=
device
->
master
;
char
str
[
20
];
char
str
[
20
];
ec_mac_print
(
master
->
main_mac
,
str
);
ec_mac_print
(
device
->
dev
->
dev_addr
,
str
);
EC_INFO
(
"Master %u releasing main device %s.
\n
"
,
master
->
index
,
str
);
EC_INFO
(
"Master %u releasing main device %s.
\n
"
,
master
->
index
,
str
);
down
(
&
master
->
device_sem
);
down
(
&
master
->
device_sem
);
...
...
This diff is collapsed.
Click to expand it.
script/sysconfig/ethercat
+
3
−
0
View file @
2862e758
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
# Specify the MAC address (hexadecimal with colons) of the Ethernet device to
# Specify the MAC address (hexadecimal with colons) of the Ethernet device to
# use. Example: "00:00:08:44:ab:66"
# use. Example: "00:00:08:44:ab:66"
#
#
# The broadcast address "ff:ff:ff:ff:ff:ff" has a special meaning: It tells
# the master to accept the first device offered by any ethernet driver.
#
# The MASTER<X>_DEVICE variables also determine, how many masters will be
# The MASTER<X>_DEVICE variables also determine, how many masters will be
# created: A non-empty variable MASTER0_DEVICE will create one master, adding
# created: A non-empty variable MASTER0_DEVICE will create one master, adding
# a non-empty variable MASTER1_DEVICE will create a second master, and so on.
# a non-empty variable MASTER1_DEVICE will create a second master, and so on.
...
...
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