Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
3436fdc8
Commit
3436fdc8
authored
Jun 21, 2019
by
Jean-Claude BAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Clock identity calculation from mac address
parent
b2195fc0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
state-initializing.c
proto-standard/state-initializing.c
+12
-15
No files found.
proto-standard/state-initializing.c
View file @
3436fdc8
...
...
@@ -45,7 +45,6 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
int
i
;
int
initds
=
1
;
if
(
ppg
->
rt_opts
->
clock_quality_clockClass
==
PP_PTP_CLASS_GM_LOCKED
&&
DSDEF
(
ppi
)
->
clockQuality
.
clockClass
!=
PP_PTP_CLASS_GM_LOCKED
)
{
// GM not locked
...
...
@@ -70,22 +69,20 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
unsigned
char
mac_port1
[
PP_MAC_ADRESS_SIZE
];
unsigned
char
*
mac
;
unsigned
char
*
pci
;
unsigned
char
portIdx
=
ppi
-
ppi
->
glbs
->
pp_instances
;
if
(
get_numberPorts
(
GDSDEF
(
ppg
))
>
1
)
{
if
(
get_numberPorts
(
GDSDEF
(
ppg
))
>
1
&&
portIdx
!=
0
)
{
/* Clock identity comes from mac address with 0xff:0xfe intermixed */
/* calculate MAC of Port 0 */
unsigned
char
portIdx
;
if
(
(
portIdx
=
ppi
-
ppi
->
glbs
->
pp_instances
)
>
0
)
{
unsigned
char
*
mac
=
ppi
->
ch
[
PP_NP_GEN
].
addr
;
unsigned
char
remainder
=
portIdx
;
for
(
i
=
sizeof
(
mac_port1
)
-
1
;
i
>=
0
;
i
--
)
{
mac_port1
[
i
]
=
mac
[
i
]
-
remainder
;
if
(
mac
[
i
]
>=
remainder
)
remainder
=
0
;
else
remainder
=
1
;
}
unsigned
char
*
mac
=
ppi
->
ch
[
PP_NP_GEN
].
addr
;
unsigned
char
remainder
=
portIdx
;
for
(
i
=
sizeof
(
mac_port1
)
-
1
;
i
>=
0
;
i
--
)
{
mac_port1
[
i
]
=
mac
[
i
]
-
remainder
;
if
(
mac
[
i
]
>=
remainder
)
remainder
=
0
;
else
remainder
=
1
;
}
}
else
{
memcpy
(
mac_port1
,
ppi
->
ch
[
PP_NP_GEN
].
addr
,
sizeof
(
mac_port1
));
...
...
@@ -97,7 +94,7 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
*
(
pci
++
)
=
0xfe
;
*
(
pci
++
)
=*
(
mac
++
);
*
(
pci
++
)
=*
(
mac
++
);
*
pci
=*
mac
;
init_parent_ds
(
ppi
);
init_parent_ds
(
ppi
);
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment