Commit e18b3f70 authored by Adam Wujek's avatar Adam Wujek

Kconfig: add optization to remove masterOnly

Saves 124B
Signed-off-by: 's avatarAdam Wujek <adam.wujek@creotech.pl>
parent 620d330e
......@@ -354,6 +354,15 @@ config CODEOPT_SO_FORCE_DISABLED
Force slaveOnly to false to reduce the footprint.
Saves ~650B.
config CODEOPT_MO_FORCE_DISABLED
boolean "Force disabled masterOnly"
depends on CODEOPT_ENABLED
default y if ARCH_WRPC
default n
help
Force masterOnly to false to reduce the footprint.
Saves ~100B.
choice
prompt "Exclusive options"
......@@ -475,6 +484,12 @@ config HAS_CODEOPT_SO_FORCE_DISABLED
default 1 if CODEOPT_SO_FORCE_DISABLED
default 0
config HAS_CODEOPT_MO_FORCE_DISABLED
int
range 0 1
default 1 if CODEOPT_MO_FORCE_DISABLED
default 0
config HAS_CODEOPT_EPC_ENABLED
int
range 0 1
......
......@@ -191,6 +191,15 @@ static inline int is_slaveOnly(defaultDS_t *def) {
return CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED == 0 && CONFIG_HAS_CODEOPT_EPC_ENABLED==0 && def->slaveOnly;
}
static inline int is_masterOnly(portDS_t *portDS) {
#if CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED
return 0;
#else
return portDS->masterOnly;
#endif
}
static inline int get_numberPorts(defaultDS_t *def) {
return CONFIG_HAS_CODEOPT_SINGLE_PORT ? 1 : def->numberPorts;
}
......
......@@ -57,7 +57,7 @@ static int wr_open(struct pp_instance *ppi, struct pp_runtime_opts *rt_opts)
){
WR_DSPOR(ppi)->wrConfig = WR_S_ONLY;
} else {
WR_DSPOR(ppi)->wrConfig = ( ppi->portDS->masterOnly ||
WR_DSPOR(ppi)->wrConfig = (is_masterOnly(ppi->portDS) ||
( is_externalPortConfigurationEnabled(DSDEF(ppi)) &&
ppi->externalPortConfigurationPortDS.desiredState==PPS_MASTER)) ?
WR_M_ONLY :
......
......@@ -622,7 +622,7 @@ static int bmc_state_decision(struct pp_instance *ppi)
bmc_setup_local_frgn_master(ppi, &d0);
if ( ppi->portDS->masterOnly ) {
if (is_masterOnly(ppi->portDS)) {
/* if there is a better master show these values */
if (ppg->ebest_idx >= 0) {
/* don't update parent dataset */
......
......@@ -162,7 +162,7 @@ int pp_init_globals(struct pp_globals *ppg, struct pp_runtime_opts *pp_rt_opts)
Enumeration8 desiradedState=ppi->cfg.desiredState;
/* Clause 17.6.5.3 : - Clause 9.2.2 shall not be in effect */
if ( ppi->portDS->masterOnly ) {
if (is_masterOnly(ppi->portDS)) {
/* priority given to externalPortConfigurationEnabled */
ppi->portDS->masterOnly=FALSE;
pp_printf("ppsi: Wrong configuration: externalPortConfigurationEnabled=materOnly=TRUE. materOnly set to FALSE\n");
......
......@@ -37,7 +37,7 @@ static int listening_handle_announce(struct pp_instance *ppi, void *buf, int len
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
struct pp_frgn_master frgn_master;
bmc_store_frgn_master(ppi, &frgn_master, buf, len);
......
......@@ -40,7 +40,7 @@ static int master_handle_announce(struct pp_instance *ppi, void *buf, int len)
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
struct pp_frgn_master frgn_master;
bmc_store_frgn_master(ppi, &frgn_master, buf, len);
......
......@@ -39,7 +39,7 @@ static int passive_handle_announce(struct pp_instance *ppi, void *buf, int len)
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
struct pp_frgn_master frgn_master;
bmc_store_frgn_master(ppi, &frgn_master, buf, len);
......
......@@ -215,7 +215,7 @@ static int slave_handle_announce(struct pp_instance *ppi, void *buf, int len)
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
bmc_add_frgn_master(ppi, &frgn_master);
}
......
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