Skip to content
Snippets Groups Projects
Commit 1038075c authored by Adam Wujek's avatar Adam Wujek
Browse files

arch-wrs/wrs-startup: when switching a profile, set the default values defined by the new profile


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent 76821197
No related merge requests found
......@@ -257,6 +257,50 @@ static int set_extension(struct pp_instance *ppi, int extension)
return 0;
}
static void set_profile_params(struct pp_instance *ppi)
{
/* When switching a profile, set the default values for the new profile. */
/* For don't change any parametres when switching to
* PPSI_PROFILE_CUSTOM */
if (ppi->cfg.profile == PPSI_PROFILE_CUSTOM) {
/* Don't change parameters for the custom profile */
return;
}
if (!is_profile_supported(ppi->cfg.profile)) {
/* Profile not supported */
return;
}
if (DSPOR(ppi)->logMinDelayReqInterval != lut_profile_logMinDelayReqInterval_default[ppi->cfg.profile]) {
pp_diag(ppi, config, 1,
"Seting logMinDelayReqInterval (current %d) to the default value (%d) for %s profile\n",
DSPOR(ppi)->logMinDelayReqInterval,
lut_profile_logMinDelayReqInterval_default[ppi->cfg.profile],
lut_profile_name[ppi->cfg.profile]);
set_param_inst_logMinDelayReqInterval(ppi, lut_profile_logMinDelayReqInterval_default[ppi->cfg.profile]);
}
if (DSPOR(ppi)->logMinPdelayReqInterval != lut_profile_logMinPdelayReqInterval_default[ppi->cfg.profile]) {
pp_diag(ppi, config, 1,
"Seting logMinPdelayReqInterval (current %d) to the default value (%d) for %s profile\n",
DSPOR(ppi)->logMinPdelayReqInterval,
lut_profile_logMinPdelayReqInterval_default[ppi->cfg.profile],
lut_profile_name[ppi->cfg.profile]);
set_param_inst_logMinPdelayReqInterval(ppi, lut_profile_logMinPdelayReqInterval_default[ppi->cfg.profile]);
}
if (DSPOR(ppi)->logSyncInterval != lut_profile_logSyncInterval_default[ppi->cfg.profile]) {
pp_diag(ppi, config, 1,
"Seting logSyncInterval (current %d) to the default value (%d) for %s profile\n",
DSPOR(ppi)->logSyncInterval,
lut_profile_logSyncInterval_default[ppi->cfg.profile],
lut_profile_name[ppi->cfg.profile]);
set_param_inst_logSyncInterval(ppi, lut_profile_logSyncInterval_default[ppi->cfg.profile]);
}
}
static void set_l1sync_params(struct pp_instance *ppi)
{
/* Force mandatory attributes - Do not take care of the configuration */
......@@ -288,6 +332,11 @@ static int set_profile(struct pp_instance *ppi, int profile, int extension,
/* Do not take care of L1SYNC */
enable_asymmetryCorrection(ppi, ppi->cfg.asymmetryCorrectionEnable);
if (!startup) {
set_profile_params(ppi);
}
break;
case PPSI_PROFILE_HA_WR:
......@@ -319,6 +368,10 @@ static int set_profile(struct pp_instance *ppi, int profile, int extension,
}
}
if (!startup) {
set_profile_params(ppi);
}
if (CONFIG_HAS_EXT_L1SYNC) {
/* Set L1Sync params even for WR profile, since we allow
* configuration WR profile with L1Sync extension */
......
......@@ -464,6 +464,17 @@ extern void pdstate_set_state_pdetection(struct pp_instance * ppi);
extern void pdstate_set_state_pdetected(struct pp_instance * ppi);
extern void pdstate_enable_extension(struct pp_instance * ppi);
static inline int is_profile_supported(int profile)
{
if ((CONFIG_HAS_PROFILE_PTP && profile == PPSI_PROFILE_PTP)
|| (CONFIG_HAS_PROFILE_HA_WR && profile == PPSI_PROFILE_HA_WR)
|| (CONFIG_HAS_PROFILE_CUSTOM && profile == PPSI_PROFILE_CUSTOM))
return 1;
return 0;
}
/* Protocol extensions */
#include "../proto-ext-whiterabbit/wr-api.h"
#include "../proto-ext-l1sync/l1e-api.h"
......
......@@ -103,6 +103,10 @@ void help(char *prgname)
" - sets the extension; extension has to be supported by a selected profile\n"
" --profile=<ptp|wr|ha|ha_wr|custom>\n"
" - sets the profile; ha_wr, ha and wr are the same profile\n"
" setting a profile (also to the current one) may change number\n"
" of attributes to its default values (not necessary the same\n"
" as defined in ppsi.conf);\n"
" changing a profile to custom does not change any parameters;\n"
" --sync-interval=<num>\n"
" - sets logarithm to the base 2 of the mean interval of sync\n"
" message transmission; used when a port is in Master state\n"
......
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