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
9e4a90c7
Commit
9e4a90c7
authored
Feb 26, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open-close: merge extension into std, using hooks
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
a43f3182
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
71 deletions
+18
-71
ppsi.h
include/ppsi/ppsi.h
+2
-0
Makefile
proto-ext-whiterabbit/Makefile
+0
-1
hooks.c
proto-ext-whiterabbit/hooks.c
+12
-0
open-close.c
proto-ext-whiterabbit/open-close.c
+0
-67
open-close.c
proto-standard/open-close.c
+4
-3
No files found.
include/ppsi/ppsi.h
View file @
9e4a90c7
...
...
@@ -308,6 +308,8 @@ static inline struct pp_servo *SRV(struct pp_instance *ppi)
*/
struct
pp_ext_hooks
{
int
(
*
init
)(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
);
int
(
*
open
)(
struct
pp_instance
*
ppi
,
struct
pp_runtime_opts
*
rt_opts
);
int
(
*
close
)(
struct
pp_instance
*
ppi
);
};
extern
struct
pp_ext_hooks
pp_hooks
;
/* The one for the extension we build */
...
...
proto-ext-whiterabbit/Makefile
View file @
9e4a90c7
...
...
@@ -16,7 +16,6 @@ OBJ-libwr := $D/fsm-table.o \
$D
/arith.o
\
$D
/servo.o
\
$D
/hooks.o
\
$D
/open-close.o
\
$D
/state-wr-present.o
\
$D
/state-wr-m-lock.o
\
$D
/state-wr-s-lock.o
\
...
...
proto-ext-whiterabbit/hooks.c
View file @
9e4a90c7
...
...
@@ -16,7 +16,19 @@ static int wr_init(struct pp_instance *ppi, unsigned char *pkt, int plen)
return
0
;
}
/* This currently only works with one interface (i.e. WR Node) */
static
int
wr_open
(
struct
pp_instance
*
ppi
,
struct
pp_runtime_opts
*
rt_opts
)
{
static
struct
wr_data_t
wr_data
;
/* WR-specific global data */
rt_opts
->
iface_name
=
"wr1"
;
ppi
->
ext_data
=
&
wr_data
;
return
0
;
}
struct
pp_ext_hooks
pp_hooks
=
{
.
init
=
wr_init
,
.
open
=
wr_open
,
};
proto-ext-whiterabbit/open-close.c
deleted
100644 → 0
View file @
a43f3182
/*
* Aurelio Colosimo for CERN, 2011 -- GNU LGPL v2.1 or later
*/
#include <ppsi/ppsi.h>
#include <ppsi/diag.h>
#include "wr-api.h"
/*
* This file deals with opening and closing an instance. The channel
* must already have been created. In practices, this initializes the
* state machine to the first state.
*
* A protocol extension can override none or both of these functions.
*/
struct
pp_runtime_opts
default_rt_opts
=
{
.
clock_quality
=
{
.
clockClass
=
PP_DEFAULT_CLOCK_CLASS
,
.
clockAccuracy
=
PP_DEFAULT_CLOCK_ACCURACY
,
.
offsetScaledLogVariance
=
PP_DEFAULT_CLOCK_VARIANCE
,
},
.
iface_name
=
"wr1"
,
.
inbound_latency
=
{
0
,
PP_DEFAULT_INBOUND_LATENCY
},
.
outbound_latency
=
{
0
,
PP_DEFAULT_OUTBOUND_LATENCY
},
.
max_rst
=
PP_DEFAULT_MAX_RESET
,
.
max_dly
=
PP_DEFAULT_MAX_DELAY
,
.
no_adjust
=
PP_DEFAULT_NO_ADJUST
,
.
no_rst_clk
=
PP_DEFAULT_NO_RESET_CLOCK
,
.
ap
=
PP_DEFAULT_AP
,
.
ai
=
PP_DEFAULT_AI
,
.
s
=
PP_DEFAULT_DELAY_S
,
.
ethernet_mode
=
PP_DEFAULT_ETHERNET_MODE
,
.
e2e_mode
=
PP_DEFAULT_E2E_MODE
,
.
gptp_mode
=
PP_DEFAULT_GPTP_MODE
,
.
ofst_first_updated
=
0
,
/* FIXME: is it a option or a state var? */
.
max_foreign_records
=
PP_DEFAULT_MAX_FOREIGN_RECORDS
,
.
cur_utc_ofst
=
PP_DEFAULT_UTC_OFFSET
,
.
announce_intvl
=
PP_DEFAULT_ANNOUNCE_INTERVAL
,
.
sync_intvl
=
PP_DEFAULT_SYNC_INTERVAL
,
.
prio1
=
PP_DEFAULT_PRIORITY1
,
.
prio2
=
PP_DEFAULT_PRIORITY2
,
.
domain_number
=
PP_DEFAULT_DOMAIN_NUMBER
,
.
ttl
=
PP_DEFAULT_TTL
,
};
static
struct
wr_data_t
wr_data
;
/* white rabbit specific global data */
int
pp_open_instance
(
struct
pp_instance
*
ppi
,
struct
pp_runtime_opts
*
rt_opts
)
{
if
(
rt_opts
)
ppi
->
rt_opts
=
rt_opts
;
else
ppi
->
rt_opts
=
&
default_rt_opts
;
ppi
->
ext_data
=
&
wr_data
;
ppi
->
state
=
PPS_INITIALIZING
;
return
0
;
}
int
pp_close_instance
(
struct
pp_instance
*
ppi
)
{
/* Nothing to do by now */
return
0
;
}
proto-standard/open-close.c
View file @
9e4a90c7
...
...
@@ -9,8 +9,6 @@
* This file deals with opening and closing an instance. The channel
* must already have been created. In practices, this initializes the
* state machine to the first state.
*
* A protocol extension can override none or both of these functions.
*/
struct
pp_runtime_opts
default_rt_opts
=
{
...
...
@@ -51,11 +49,14 @@ int pp_open_instance(struct pp_instance *ppi, struct pp_runtime_opts *rt_opts)
ppi
->
state
=
PPS_INITIALIZING
;
if
(
pp_hooks
.
open
)
return
pp_hooks
.
open
(
ppi
,
ppi
->
rt_opts
);
return
0
;
}
int
pp_close_instance
(
struct
pp_instance
*
ppi
)
{
/* Nothing to do by now */
if
(
pp_hooks
.
open
)
return
pp_hooks
.
close
(
ppi
);
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