Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PPSi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projects
PPSi
Commits
ab93f8b8
Commit
ab93f8b8
authored
11 years ago
by
Aurelio Colosimo
Browse files
Options
Downloads
Patches
Plain Diff
ppsi.conf parsing: add clock-class and clock-accuracy options
Signed-off-by:
Aurelio Colosimo
<
aurelio@aureliocolosimo.it
>
parent
ffd48dca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
etc/ppsi.conf
+7
-0
7 additions, 0 deletions
etc/ppsi.conf
lib/conf.c
+19
-0
19 additions, 0 deletions
lib/conf.c
with
26 additions
and
0 deletions
etc/ppsi.conf
+
7
−
0
View file @
ab93f8b8
...
...
@@ -2,6 +2,10 @@
# purposes, it defines the various "links" for ppsi, assigning a port
# for each link and defining the link properties.
#
# Some global setting is available:
# clock-class <val>, where val is a decimal number for Clock Class
# clock-accuracy <val>, where val is a decimal number for Clock Accuracy
#
# Each link must be defined as follows:
# link <id>, where id is a label identifying the link (e.g. a number)
# iface <eth>, where <eth> is the interface name, e.g. eth0
...
...
@@ -9,6 +13,9 @@
# role [auto|master|slave], where auto is the default
# extension [none|whiterabbit], where none is the default
# Global settings
clock
-
class
248
clock
-
accuracy
254
# Link 0 is the slave, connected to the external master clock
link
0
...
...
This diff is collapsed.
Click to expand it.
lib/conf.c
+
19
−
0
View file @
ab93f8b8
...
...
@@ -15,6 +15,7 @@ struct keyword_t {
enum
{
KW_INV
=
-
1
,
KW_LINK
,
KW_IFACE
,
KW_PROTO
,
KW_RAW
,
KW_UDP
,
KW_ROLE
,
KW_AUTO
,
KW_MASTER
,
KW_SLAVE
,
KW_EXT
,
KW_NONE
,
KW_WHITERAB
,
KW_CLOCK_CLASS
,
KW_CLOCK_ACCURACY
,
KW_NUMBER
};
static
int
handle_link
(
struct
pp_globals
*
ppg
,
char
*
val
);
...
...
@@ -22,6 +23,8 @@ static int handle_iface(struct pp_globals *ppg, char *val);
static
int
handle_proto
(
struct
pp_globals
*
ppg
,
char
*
val
);
static
int
handle_role
(
struct
pp_globals
*
ppg
,
char
*
val
);
static
int
handle_ext
(
struct
pp_globals
*
ppg
,
char
*
val
);
static
int
handle_clock_class
(
struct
pp_globals
*
ppg
,
char
*
val
);
static
int
handle_clock_accuracy
(
struct
pp_globals
*
ppg
,
char
*
val
);
static
struct
keyword_t
keywords
[
KW_NUMBER
]
=
{
{
KW_LINK
,
"link"
,
handle_link
},
...
...
@@ -31,6 +34,8 @@ static struct keyword_t keywords[KW_NUMBER] = {
{
KW_SLAVE
,
"slave"
},
{
KW_EXT
,
"extension"
,
handle_ext
},
{
KW_NONE
,
"none"
},
{
KW_WHITERAB
,
"whiterabbit"
},
{
KW_CLOCK_CLASS
,
"clock-class"
,
handle_clock_class
},
{
KW_CLOCK_ACCURACY
,
"clock-accuracy"
,
handle_clock_accuracy
},
};
static
int
detect_keyword
(
char
*
kw
)
...
...
@@ -60,6 +65,18 @@ static int handle_iface(struct pp_globals *ppg, char *val)
return
1
;
}
static
int
handle_clock_class
(
struct
pp_globals
*
ppg
,
char
*
val
)
{
GOPTS
(
ppg
)
->
clock_quality
.
clockClass
=
atoi
(
val
);
return
1
;
}
static
int
handle_clock_accuracy
(
struct
pp_globals
*
ppg
,
char
*
val
)
{
GOPTS
(
ppg
)
->
clock_quality
.
clockAccuracy
=
atoi
(
val
);
return
1
;
}
static
int
handle_proto
(
struct
pp_globals
*
ppg
,
char
*
val
)
{
int
v_id
;
...
...
@@ -121,6 +138,8 @@ static int handle_key_val(struct pp_globals *ppg, char *key, char *val)
case
KW_PROTO
:
case
KW_ROLE
:
case
KW_EXT
:
case
KW_CLOCK_CLASS
:
case
KW_CLOCK_ACCURACY
:
return
keywords
[
k_id
].
handle_key
(
ppg
,
val
);
default:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment