Commit ab93f8b8 authored by Aurelio Colosimo's avatar Aurelio Colosimo

ppsi.conf parsing: add clock-class and clock-accuracy options

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent ffd48dca
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment