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
16707d53
Commit
16707d53
authored
Mar 18, 2013
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frgn variables moved to struct pp_globals
Signed-off-by:
Aurelio Colosimo
<
aurelio@aureliocolosimo.it
>
parent
8947973d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
23 deletions
+23
-23
posix-startup.c
arch-gnu-linux/posix-startup.c
+1
-1
pp-instance.h
include/ppsi/pp-instance.h
+4
-4
bmc.c
proto-standard/bmc.c
+5
-5
common-fun.c
proto-standard/common-fun.c
+13
-13
No files found.
arch-gnu-linux/posix-startup.c
View file @
16707d53
...
...
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
if
((
!
ppi
->
defaultDS
)
||
(
!
ppi
->
currentDS
)
||
(
!
ppi
->
parentDS
)
||
(
!
ppi
->
portDS
)
||
(
!
ppi
->
timePropertiesDS
)
||
(
!
ppi
->
frgn_master
)
||
(
!
ppi
->
arch_data
)
||
(
!
GLBS
(
ppi
)
->
frgn_master
)
||
(
!
ppi
->
arch_data
)
)
exit
(
__LINE__
);
...
...
include/ppsi/pp-instance.h
View file @
16707d53
...
...
@@ -168,10 +168,6 @@ struct pp_instance {
DSTimeProperties
*
timePropertiesDS
;
/* page 70 */
unsigned
long
timeouts
[
__PP_TO_ARRAY_SIZE
];
UInteger16
frgn_rec_num
;
Integer16
frgn_rec_i
;
Integer16
frgn_rec_best
;
struct
pp_frgn_master
frgn_master
[
PP_NR_FOREIGN_RECORDS
];
UInteger16
recv_sync_sequence_id
;
Integer8
log_min_delay_req_interval
;
...
...
@@ -190,6 +186,10 @@ struct pp_instance {
struct
pp_globals
{
int
nports
;
struct
pp_instance
*
pp_instances
;
UInteger16
frgn_rec_num
;
Integer16
frgn_rec_i
;
Integer16
frgn_rec_best
;
struct
pp_frgn_master
frgn_master
[
PP_NR_FOREIGN_RECORDS
];
/* FIXME Here include all is common to many interfaces */
};
...
...
proto-standard/bmc.c
View file @
16707d53
...
...
@@ -183,7 +183,7 @@ static int bmc_state_decision(struct pp_instance *ppi, struct pp_frgn_master *m)
if
(
OPTS
(
ppi
)
->
slave_only
)
goto
slave
;
if
((
!
ppi
->
frgn_rec_num
)
&&
(
ppi
->
state
==
PPS_LISTENING
))
if
((
!
GLBS
(
ppi
)
->
frgn_rec_num
)
&&
(
ppi
->
state
==
PPS_LISTENING
))
return
PPS_LISTENING
;
/* copy local information to a foreign_master structure */
...
...
@@ -225,22 +225,22 @@ slave:
int
bmc
(
struct
pp_instance
*
ppi
)
{
struct
pp_frgn_master
*
frgn_master
=
ppi
->
frgn_master
;
struct
pp_frgn_master
*
frgn_master
=
GLBS
(
ppi
)
->
frgn_master
;
int
i
,
best
;
if
(
!
ppi
->
frgn_rec_num
)
if
(
!
GLBS
(
ppi
)
->
frgn_rec_num
)
if
(
ppi
->
state
==
PPS_MASTER
)
{
m1
(
ppi
);
return
ppi
->
state
;
}
for
(
i
=
1
,
best
=
0
;
i
<
ppi
->
frgn_rec_num
;
i
++
)
for
(
i
=
1
,
best
=
0
;
i
<
GLBS
(
ppi
)
->
frgn_rec_num
;
i
++
)
if
(
bmc_dataset_cmp
(
ppi
,
&
frgn_master
[
i
],
&
frgn_master
[
best
])
<
0
)
best
=
i
;
pp_diag
(
ppi
,
bmc
,
1
,
"Best foreign master is %i
\n
"
,
best
);
ppi
->
frgn_rec_best
=
best
;
GLBS
(
ppi
)
->
frgn_rec_best
=
best
;
return
bmc_state_decision
(
ppi
,
&
frgn_master
[
best
]);
}
proto-standard/common-fun.c
View file @
16707d53
...
...
@@ -45,8 +45,8 @@ int st_com_execute_slave(struct pp_instance *ppi)
return
ret
;
if
(
pp_timeout_z
(
ppi
,
PP_TO_ANN_RECEIPT
))
{
ppi
->
frgn_rec_num
=
0
;
ppi
->
frgn_rec_i
=
0
;
GLBS
(
ppi
)
->
frgn_rec_num
=
0
;
GLBS
(
ppi
)
->
frgn_rec_i
=
0
;
if
(
!
DSDEF
(
ppi
)
->
slaveOnly
&&
DSDEF
(
ppi
)
->
clockQuality
.
clockClass
!=
255
)
{
m1
(
ppi
);
...
...
@@ -66,38 +66,38 @@ static void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
MsgHeader
*
hdr
=
&
ppi
->
received_ptp_header
;
/* Check if foreign master is already known */
for
(
i
=
0
;
i
<
ppi
->
frgn_rec_num
;
i
++
)
{
for
(
i
=
0
;
i
<
GLBS
(
ppi
)
->
frgn_rec_num
;
i
++
)
{
if
(
!
memcmp
(
&
hdr
->
sourcePortIdentity
,
&
ppi
->
frgn_master
[
i
].
port_id
,
&
GLBS
(
ppi
)
->
frgn_master
[
i
].
port_id
,
sizeof
(
hdr
->
sourcePortIdentity
)))
{
/* already in Foreign master data set, update info */
msg_copy_header
(
&
ppi
->
frgn_master
[
i
].
hdr
,
hdr
);
msg_unpack_announce
(
buf
,
&
ppi
->
frgn_master
[
i
].
ann
);
msg_copy_header
(
&
GLBS
(
ppi
)
->
frgn_master
[
i
].
hdr
,
hdr
);
msg_unpack_announce
(
buf
,
&
GLBS
(
ppi
)
->
frgn_master
[
i
].
ann
);
return
;
}
}
/* New foreign master */
if
(
ppi
->
frgn_rec_num
<
PP_NR_FOREIGN_RECORDS
)
ppi
->
frgn_rec_num
++
;
if
(
GLBS
(
ppi
)
->
frgn_rec_num
<
PP_NR_FOREIGN_RECORDS
)
GLBS
(
ppi
)
->
frgn_rec_num
++
;
/* FIXME: replace the worst */
i
=
ppi
->
frgn_rec_i
;
i
=
GLBS
(
ppi
)
->
frgn_rec_i
;
/* Copy new foreign master data set from announce message */
memcpy
(
&
ppi
->
frgn_master
[
i
].
port_id
,
memcpy
(
&
GLBS
(
ppi
)
->
frgn_master
[
i
].
port_id
,
&
hdr
->
sourcePortIdentity
,
sizeof
(
hdr
->
sourcePortIdentity
));
/*
* header and announce field of each Foreign Master are
* usefull to run Best Master Clock Algorithm
*/
msg_copy_header
(
&
ppi
->
frgn_master
[
i
].
hdr
,
hdr
);
msg_unpack_announce
(
buf
,
&
ppi
->
frgn_master
[
i
].
ann
);
msg_copy_header
(
&
GLBS
(
ppi
)
->
frgn_master
[
i
].
hdr
,
hdr
);
msg_unpack_announce
(
buf
,
&
GLBS
(
ppi
)
->
frgn_master
[
i
].
ann
);
PP_VPRINTF
(
"New foreign Master added
\n
"
);
ppi
->
frgn_rec_i
=
(
ppi
->
frgn_rec_i
+
1
)
%
GLBS
(
ppi
)
->
frgn_rec_i
=
(
GLBS
(
ppi
)
->
frgn_rec_i
+
1
)
%
PP_NR_FOREIGN_RECORDS
;
}
...
...
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