Commit be382fde authored by Jean-Claude BAU's avatar Jean-Claude BAU Committed by Adam Wujek

Infrastructure changes: Add concept of profile

parent c0a1b72b
......@@ -110,19 +110,36 @@ config ASSERT
error message every second. OTOH, panic() is always built,
with no Kconfig -- and it does the same, unconditionally.
config EXT_WR
config PROFILE_WR
bool
default y if ARCH_WRS
config PROFILE_HA
bool
default y if ARCH_WRS || ARCH_WRPC
config EXT_NONE
config PROFILE_PTP
bool
default !EXT_WR
default y if !(PROFILE_WR || PROFILE_HA)
config EXTENSION
string
default "whiterabbit" if EXT_WR
default "" if EXT_NONE
config EXT_WR
bool
default y if PROFILE_WR
config EXT_L1SYNC
bool
default y if PROFILE_HA
config EXT_NONE
bool
default y if PROFILE_PTP
config EXTENSIONS
string
default "whiterabbit l1sync" if (EXT_WR && EXT_L1SYNC)
default "whiterabbit" if (EXT_WR && !EXT_L1SYNC)
default "l1sync" if (!EXT_WR && EXT_L1SYNC)
default "" if PROFILE_PTP
config CROSS_COMPILE
......
......@@ -7,7 +7,7 @@
# We still accept command-line choices like we used to do.
# Also, we must remove the quotes from these Kconfig values
PROTO_EXT ?= $(patsubst "%",%,$(CONFIG_EXTENSION))
PROTO_EXTS ?= $(patsubst "%",%,$(CONFIG_EXTENSIONS))
ARCH ?= $(patsubst "%",%,$(CONFIG_ARCH))
CROSS_COMPILE ?= $(patsubst "%",%,$(CONFIG_CROSS_COMPILE))
WRPCSW_ROOT ?= $(patsubst "%",%,$(CONFIG_WRPCSW_ROOT))
......@@ -47,7 +47,9 @@ all: $(TARGET).o
# CFLAGS to use. Both this Makefile (later) and app-makefile may grow CFLAGS
CFLAGS = $(USER_CFLAGS)
CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -O$(CONFIG_OPTIMIZATION)
CFLAGS += -ggdb -Iinclude -fno-common
CFLAGS += -DPPSI_VERSION=\"$(VERSION)\"
......@@ -73,8 +75,10 @@ CFLAGS += -Iarch-$(ARCH)/include
# proto-standard is always included, as it provides default function
# so the extension can avoid duplication of code.
ifneq ($(PROTO_EXT),)
include proto-ext-$(PROTO_EXT)/Makefile
ifneq ($(PROTO_EXTS),)
PROT_EXT_DIRS=${foreach EXT_NAME,${subst $\",,${PROTO_EXTS}},proto-ext-${EXT_NAME} }
PROT_EXT_MKFS=${foreach PROT_EXT_MKF,${PROT_EXT_DIRS},${PROT_EXT_MKF}/Makefile}
include ${PROT_EXT_MKFS}
endif
include proto-standard/Makefile
......
......@@ -238,7 +238,7 @@ int main(int argc, char **argv)
ppi->portDS = alloc_fn(ppsi_head, sizeof(*ppi->portDS));
ppi->ext_hooks=&pp_hooks; /* Default value. Can be overwritten by an extension */
if (ppi->portDS) {
if ( CONFIG_EXT_WR == 1 && ppi->cfg.ext==PPSI_EXT_WR ) {
if ( CONFIG_EXT_WR == 1 && ppi->cfg.ext==PPSI_PROFILE_WR ) {
struct wr_dsport *wrp;
/* Add WR extension portDS */
......
......@@ -22,7 +22,6 @@
#include <arch/arch.h> /* ntohs and so on -- and wr-api.h for wr archs */
/* At this point in time, we need ARRAY_SIZE to conditionally build vlan code */
#undef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
......@@ -163,7 +162,6 @@ static inline struct pp_servo *SRV(struct pp_instance *ppi)
return GLBS(ppi)->servo;
}
extern void pp_prepare_pointers(struct pp_instance *ppi);
/*
......@@ -375,8 +373,15 @@ extern int f_simple_int(struct pp_argline *l, int lineno,
#define PPSI_ROLE_MASTER 1
#define PPSI_ROLE_SLAVE 2
#define PPSI_EXT_NONE 0
#define PPSI_EXT_WR 1
/* Define the PPSI extensions */
#define PPSI_EXT_NONE 0
#define PPSI_EXT_WR 1 /* WR extension */
#define PPSI_EXT_L1S 2 /* L1SYNC extension */
/* Define the PPSI profiles */
#define PPSI_PROFILE_PTP 0 /* Default PTP profile without extensions */
#define PPSI_PROFILE_WR 1 /* WR profile using WR extension */
#define PPSI_PROFILE_HA 2 /* HA profile using L1S extension, masterOnly and externalPortConfiguration options */
/* Servo */
......
......@@ -212,9 +212,15 @@ static struct pp_argname arg_role[] = {
{"slave", PPSI_ROLE_SLAVE},
{},
};
static struct pp_argname arg_ext[] = {
{"none", PPSI_EXT_NONE},
{"whiterabbit", PPSI_EXT_WR},
static struct pp_argname arg_profile[] = {
{"none", PPSI_PROFILE_PTP}, /* none is equal to ptp for backward compatibility */
{"ptp", PPSI_PROFILE_PTP},
#if CONFIG_PROFILE_WR == 1
{"whiterabbit", PPSI_PROFILE_WR},
#endif
#if CONFIG_PROFILE_HA == 1
{"highaccuracy", PPSI_PROFILE_WR},
#endif
{},
};
static struct pp_argname arg_mech[] = {
......@@ -235,7 +241,8 @@ static struct pp_argline pp_global_arglines[] = {
LEGACY_OPTION(f_if, "iface", ARG_STR),
INST_OPTION_INT("proto", ARG_NAMES, arg_proto, proto),
INST_OPTION_INT("role", ARG_NAMES, arg_role, role),
INST_OPTION_INT("extension", ARG_NAMES, arg_ext, cfg.ext),
INST_OPTION_INT("extension", ARG_NAMES, arg_profile, cfg.ext), /* TODO: stay for backward compatibility. Should be removed in the future */
INST_OPTION_INT("profile", ARG_NAMES, arg_profile, cfg.ext),
INST_OPTION_INT("mechanism", ARG_NAMES, arg_mech, cfg.mech),
LEGACY_OPTION(f_vlan, "vlan", ARG_STR),
LEGACY_OPTION(f_diag, "diagnostic", ARG_STR),
......
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