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
47
Issues
47
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
bd3f1fae
Commit
bd3f1fae
authored
Jun 12, 2016
by
Davide Ciminaghi
Committed by
Alessandro Rubini
Sep 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compliance, 6,7.2: implement PRE_MASTER
parent
a1997d64
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
12 deletions
+36
-12
ppsi.h
include/ppsi/ppsi.h
+7
-0
state-master.c
proto-standard/state-master.c
+28
-7
state-pre-master.c
proto-standard/state-pre-master.c
+1
-5
No files found.
include/ppsi/ppsi.h
View file @
bd3f1fae
...
...
@@ -419,6 +419,13 @@ extern pp_action pp_initializing, pp_faulty, pp_disabled, pp_listening,
pp_pre_master
,
pp_master
,
pp_passive
,
pp_uncalibrated
,
pp_slave
,
pp_pclock
;;
/*
* MASTER and PRE_MASTER have many things in common. This function implements
* both states. It is invoked by pp_master and pp_pre_master with pre
* respectively equal to 0 and 1.
*/
extern
int
_pp_master
(
struct
pp_instance
*
ppi
,
uint8_t
*
pkt
,
int
plen
,
int
pre
);
/* The engine */
extern
int
pp_state_machine
(
struct
pp_instance
*
ppi
,
uint8_t
*
packet
,
int
plen
);
...
...
proto-standard/state-master.c
View file @
bd3f1fae
...
...
@@ -9,20 +9,35 @@
#include <ppsi/ppsi.h>
#include "common-fun.h"
int
pp_master
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
/*
* pre indicates that we're in PRE_MASTER slave
*/
int
_pp_master
(
struct
pp_instance
*
ppi
,
uint8_t
*
pkt
,
int
plen
,
int
pre
)
{
int
msgtype
;
int
e
=
0
;
/* error var, to check errors in msg handling */
/* ignore errors; we are not getting FAULTY if not transmitting */
pp_lib_may_issue_sync
(
ppi
);
pp_lib_may_issue_announce
(
ppi
);
if
(
pre
&&
pp_timeout
(
ppi
,
PP_TO_QUALIFICATION
))
{
ppi
->
next_state
=
PPS_MASTER
;
return
0
;
}
if
(
!
pre
)
{
/*
* ignore errors; we are not getting FAULTY if not
* transmitting
*/
pp_lib_may_issue_sync
(
ppi
);
pp_lib_may_issue_announce
(
ppi
);
}
/* when the clock is using peer-delay, the muster mast send it too */
if
(
ppi
->
glbs
->
delay_mech
==
PP_P2P_MECH
)
pp_lib_may_issue_request
(
ppi
);
else
pp_timeout_set
(
ppi
,
PP_TO_REQUEST
);
else
{
if
(
!
pre
)
pp_timeout_set
(
ppi
,
PP_TO_REQUEST
);
}
if
(
plen
==
0
)
goto
out
;
...
...
@@ -54,7 +69,8 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
break
;
case
PPM_DELAY_REQ
:
msg_issue_delay_resp
(
ppi
,
&
ppi
->
last_rcv_time
);
if
(
!
pre
)
msg_issue_delay_resp
(
ppi
,
&
ppi
->
last_rcv_time
);
break
;
case
PPM_PDELAY_REQ
:
...
...
@@ -99,3 +115,8 @@ out_fault:
ppi
->
next_delay
=
500
;
/* just a delay to releif the system */
return
e
;
}
int
pp_master
(
struct
pp_instance
*
ppi
,
uint8_t
*
pkt
,
int
plen
)
{
return
_pp_master
(
ppi
,
pkt
,
plen
,
0
);
}
proto-standard/state-pre-master.c
View file @
bd3f1fae
...
...
@@ -10,9 +10,5 @@
int
pp_pre_master
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
{
/*
* No need of PRE_MASTER state because of only ordinary clock
* implementation.
*/
return
0
;
return
_pp_master
(
ppi
,
pkt
,
plen
,
1
);
}
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