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
3c5a85c9
Commit
3c5a85c9
authored
Dec 29, 2011
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state-slave first partial implementation
minor fixes and comments updated elsewhere
parent
caee5bbe
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
115 additions
and
9 deletions
+115
-9
pproto.h
include/pproto/pproto.h
+5
-0
servo.c
proto-standard/servo.c
+8
-2
state-common-fun.h
proto-standard/state-common-fun.h
+4
-1
state-listening.c
proto-standard/state-listening.c
+0
-1
state-passive.c
proto-standard/state-passive.c
+4
-1
state-slave.c
proto-standard/state-slave.c
+93
-3
state-uncalibrated.c
proto-standard/state-uncalibrated.c
+1
-1
No files found.
include/pproto/pproto.h
View file @
3c5a85c9
...
...
@@ -132,6 +132,10 @@ struct pp_instance {
TimeInternal
sync_receive_time
;
UInteger16
recv_sync_sequence_id
;
TimeInternal
last_sync_correction_field
;
TimeInternal
pdelay_req_send_time
;
TimeInternal
pdelay_req_receive_time
;
TimeInternal
pdelay_resp_send_time
;
TimeInternal
pdelay_resp_receive_time
;
union
{
MsgSync
sync
;
...
...
@@ -188,6 +192,7 @@ extern int pp_timer_stop(struct pp_timer *tm);
extern
int
pp_timer_expired
(
struct
pp_timer
*
tm
);
/* returns 1 when expired */
/* Servo */
extern
void
pp_init_clock
(
struct
pp_instance
*
ppi
);
extern
void
pp_update_offset
(
TimeInternal
*
send_time
,
TimeInternal
*
recv_time
,
TimeInternal
*
correctionField
,
struct
pp_instance
*
ppi
);
/* FIXME: offset_from_master_filter: put it in ppi */
...
...
proto-standard/servo.c
View file @
3c5a85c9
...
...
@@ -4,14 +4,20 @@
#include <pproto/pproto.h>
extern
void
pp_update_offset
(
TimeInternal
*
send_time
,
TimeInternal
*
recv_time
,
void
pp_init_clock
(
struct
pp_instance
*
ppi
)
{
/* TODO */
}
void
pp_update_offset
(
TimeInternal
*
send_time
,
TimeInternal
*
recv_time
,
TimeInternal
*
correctionField
,
struct
pp_instance
*
ppi
)
/* FIXME: offset_from_master_filter: put it in ppi */
{
/* TODO */
}
extern
void
pp_update_clock
(
struct
pp_instance
*
ppi
)
void
pp_update_clock
(
struct
pp_instance
*
ppi
)
{
/* TODO */
}
...
...
proto-standard/state-common-fun.h
View file @
3c5a85c9
...
...
@@ -19,4 +19,7 @@ int st_com_slave_handle_announce(unsigned char *buf, int len,
struct
pp_instance
*
ppi
);
int
st_com_slave_handle_sync
(
unsigned
char
*
buf
,
int
len
,
TimeInternal
*
time
,
struct
pp_instance
*
ppi
);
\ No newline at end of file
struct
pp_instance
*
ppi
);
int
st_com_slave_handle_followup
(
unsigned
char
*
buf
,
int
len
,
struct
pp_instance
*
ppi
);
proto-standard/state-listening.c
View file @
3c5a85c9
...
...
@@ -4,7 +4,6 @@
#include <pproto/pproto.h>
#include "state-common-fun.h"
int
pp_listening
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
{
if
(
ppi
->
is_new_state
)
{
...
...
proto-standard/state-passive.c
View file @
3c5a85c9
...
...
@@ -19,7 +19,10 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
switch
(
ppi
->
msg_tmp_header
.
messageType
)
{
case
PPM_PDELAY_REQ
:
#ifdef _FROM_PTPD_2_1_0_
/* TODO "translate" it into ptp-wr structs*/
/* TODO "translate" it into ptp-wr structs
* put the code in a function (will be used by SLAVE and
* MASTER state too
*/
if
(
ppi
->
is_from_self
)
{
/*
* Get sending timestamp from IP stack
...
...
proto-standard/state-slave.c
View file @
3c5a85c9
...
...
@@ -2,10 +2,100 @@
* FIXME: header
*/
#include <pproto/pproto.h>
#include "state-common-fun.h"
int
pp_slave
(
struct
pp_instance
*
ppi
,
unsigned
char
*
_new
pkt
,
int
plen
)
int
pp_slave
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
{
/* TODO */
int
e
=
0
;
TimeInternal
time
;
/* TODO: handle it, see handle(...) in protocol.c */
if
(
ppi
->
is_new_state
)
{
pp_init_clock
(
ppi
);
ppi
->
waiting_for_follow
=
FALSE
;
ppi
->
pdelay_req_send_time
.
seconds
=
0
;
ppi
->
pdelay_req_send_time
.
nanoseconds
=
0
;
ppi
->
pdelay_req_receive_time
.
seconds
=
0
;
ppi
->
pdelay_req_receive_time
.
nanoseconds
=
0
;
ppi
->
pdelay_resp_send_time
.
seconds
=
0
;
ppi
->
pdelay_resp_send_time
.
nanoseconds
=
0
;
ppi
->
pdelay_resp_receive_time
.
seconds
=
0
;
ppi
->
pdelay_resp_receive_time
.
nanoseconds
=
0
;
st_com_restart_annrec_timer
(
ppi
);
if
(
ppi
->
rt_opts
->
e2e_mode
)
pp_timer_start
(
1
<<
DSPOR
(
ppi
)
->
logMinDelayReqInterval
,
ppi
->
timers
[
PP_TIMER_DELAYREQ_INTERVAL
]);
else
pp_timer_start
(
1
<<
DSPOR
(
ppi
)
->
logMinPdelayReqInterval
,
ppi
->
timers
[
PP_TIMER_PDELAYREQ_INTERVAL
]);
}
if
(
st_com_check_record_update
(
ppi
))
goto
state_updated
;
switch
(
ppi
->
msg_tmp_header
.
messageType
)
{
case
PPM_ANNOUNCE
:
e
=
st_com_slave_handle_announce
(
pkt
,
plen
,
ppi
);
break
;
case
PPM_SYNC
:
e
=
st_com_slave_handle_sync
(
pkt
,
plen
,
&
time
,
ppi
);
break
;
case
PPM_FOLLOW_UP
:
e
=
st_com_slave_handle_followup
(
pkt
,
plen
,
ppi
);
break
;
case
PPM_DELAY_REQ
:
/* TODO */
break
;
case
PPM_DELAY_RESP
:
/* TODO */
break
;
case
PPM_PDELAY_REQ
:
/* TODO */
break
;
case
PPM_PDELAY_RESP
:
/* TODO */
break
;
case
PPM_PDELAY_RESP_FOLLOW_UP
:
/* TODO */
break
;
default:
/* disreguard, nothing to do */
break
;
}
if
(
e
==
0
)
st_com_execute_slave
(
ppi
);
else
ppi
->
next_state
=
PPS_FAULTY
;
state_updated:
/* Leaving this state */
if
(
ppi
->
next_state
!=
ppi
->
state
)
{
pp_timer_stop
(
ppi
->
timers
[
PP_TIMER_ANNOUNCE_RECEIPT
]);
if
(
ppi
->
rt_opts
->
e2e_mode
)
pp_timer_stop
(
ppi
->
timers
[
PP_TIMER_DELAYREQ_INTERVAL
]);
else
pp_timer_stop
(
ppi
->
timers
[
PP_TIMER_PDELAYREQ_INTERVAL
]);
pp_init_clock
(
ppi
);
}
ppi
->
next_delay
=
PP_DEFAULT_NEXT_DELAY_MS
;
return
0
;
}
proto-standard/state-uncalibrated.c
View file @
3c5a85c9
...
...
@@ -20,7 +20,7 @@ int pp_uncalibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
break
;
case
PPM_FOLLOW_UP
:
e
=
st_com_slave_handle_followup
(
pkt
,
plen
);
e
=
st_com_slave_handle_followup
(
pkt
,
plen
,
ppi
);
break
;
default:
...
...
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