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
6abaeb90
Commit
6abaeb90
authored
Dec 28, 2011
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state-uncalibrated first implementation
parent
11ee8a2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
state-common-fun.c
proto-standard/state-common-fun.c
+35
-1
state-common-fun.h
proto-standard/state-common-fun.h
+3
-0
state-uncalibrated.c
proto-standard/state-uncalibrated.c
+29
-1
No files found.
proto-standard/state-common-fun.c
View file @
6abaeb90
...
...
@@ -2,6 +2,7 @@
* FIXME: header
*/
#include <pproto/pproto.h>
#include <dep/dep.h>
#include "state-common-fun.h"
void
st_com_execute_slave
(
struct
pp_instance
*
ppi
)
...
...
@@ -65,7 +66,7 @@ int st_com_check_record_update(struct pp_instance *ppi)
return
0
;
}
void
st_com_add_foreign
(
unsigned
char
*
buf
,
MsgHeader
*
h
eade
r
,
void
st_com_add_foreign
(
unsigned
char
*
buf
,
MsgHeader
*
h
d
r
,
struct
pp_instance
*
ppi
)
{
/*TODO "translate" it into ptp-wr structs*/
...
...
@@ -125,3 +126,36 @@ void st_com_add_foreign(unsigned char *buf, MsgHeader *header,
}
#endif
/* _FROM_PTPD_2_1_0_ */
}
int
st_com_slave_handle_announce
(
unsigned
char
*
buf
,
int
len
,
struct
pp_instance
*
ppi
)
{
MsgHeader
*
hdr
=
&
ppi
->
msg_tmp_header
;
if
(
len
<
PP_ANNOUNCE_LENGTH
)
return
-
1
;
if
(
ppi
->
is_from_self
)
return
0
;
/*
* Valid announce message is received : BMC algorithm
* will be executed
*/
ppi
->
record_update
=
TRUE
;
if
(
!
ppi
->
is_from_cur_par
)
{
msg_unpack_announce
(
buf
,
&
ppi
->
msg_tmp
.
announce
);
s1
(
hdr
,
&
ppi
->
msg_tmp
.
announce
,
ppi
);
}
else
{
/* st_com_add_foreign takes care of announce unpacking */
st_com_add_foreign
(
buf
,
hdr
,
ppi
);
}
/*Reset Timer handling Announce receipt timeout*/
st_com_restart_annrec_timer
(
ppi
);
return
0
;
}
proto-standard/state-common-fun.h
View file @
6abaeb90
...
...
@@ -14,3 +14,6 @@ int st_com_check_record_update(struct pp_instance *ppi);
void
st_com_add_foreign
(
unsigned
char
*
buf
,
MsgHeader
*
header
,
struct
pp_instance
*
ppi
);
int
st_com_slave_handle_announce
(
unsigned
char
*
buf
,
int
len
,
struct
pp_instance
*
ppi
);
proto-standard/state-uncalibrated.c
View file @
6abaeb90
...
...
@@ -2,9 +2,37 @@
* FIXME: header
*/
#include <pproto/pproto.h>
#include "state-common-fun.h"
int
pp_uncalibrated
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
{
/* TODO */
int
e
=
0
;
switch
(
ppi
->
msg_tmp_header
.
messageType
)
{
case
PPM_ANNOUNCE
:
e
=
st_com_slave_handle_announce
(
pkt
,
plen
,
ppi
);
break
;
case
PPM_SYNC
:
/* TODO */
break
;
case
PPM_FOLLOW_UP
:
/* TODO */
break
;
default:
/* disreguard, nothing to do */
break
;
}
if
(
e
==
0
)
st_com_execute_slave
(
ppi
);
else
ppi
->
next_state
=
PPS_FAULTY
;
ppi
->
next_delay
=
PP_DEFAULT_NEXT_DELAY_MS
;
return
0
;
}
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