Commit 4348ecd9 authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Grzegorz Daniluk

Kconfig: add AUX_DIAG and SNMP_AUX_DIAG

Add conditional compilation of support of aux diag registers and SNMP for
these registers.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 388baa39
......@@ -148,6 +148,14 @@ config SNMP_SET
help
This option enables support for SET requests for Mini SNMP responder
config SNMP_AUX_DIAG
depends on SNMP && AUX_DIAG
default y if AUX_DIAG
default n
boolean "Adds support of auxiliary diagnostics registers to SNMP"
help
This option adds branch wrpcAuxDiag to the SNMP
config SNMP_HW_TYPE
depends on SNMP
default "spec"
......@@ -183,6 +191,13 @@ config FLASH_INIT
default y if EMBEDDED_NODE
default n
config AUX_DIAG
default n
boolean "Add support for auxiliary diagnostics registers"
help
This option adds support for read/write of aux diag registers and
the diag command.
#
# This is a set of configuration options that should not be changed by
# normal users. If the "developer" menu is used, the binary is tainted.
......
......@@ -45,7 +45,6 @@ void timer_delay(uint32_t tics)
;
}
static int diag_rw_words, diag_ro_words;
/****************************
......@@ -64,7 +63,6 @@ void diag_read_info(uint32_t *id, uint32_t *ver, uint32_t *nrw, uint32_t *nro)
*nrw = diag_rw_words;
if (nro)
*nro = diag_ro_words;
}
int diag_read_word(uint32_t adr, int bank, uint32_t *val)
......
......@@ -74,6 +74,12 @@
#define SNMP_SET_FUNCTION(X) .set = NULL
#endif
#ifdef CONFIG_SNMP_AUX_DIAG
#define SNMP_AUX_DIAG_ENABLED 1
#else
#define SNMP_AUX_DIAG_ENABLED 0
#endif
#define MASK_SET 0x1
#define MASK_GET 0x2
#define MASK_GET_NEXT 0x4
......@@ -458,8 +464,10 @@ static struct snmp_oid_limb oid_limb_array[] = {
OID_LIMB_FIELD(oid_wrpcPtpConfigGroup, func_group, oid_array_wrpcPtpConfigGroup),
OID_LIMB_FIELD(oid_wrpcPortGroup, func_group, oid_array_wrpcPortGroup),
OID_LIMB_FIELD(oid_wrpcSfpTable, func_table, oid_array_wrpcSfpTable),
#ifdef CONFIG_SNMP_AUX_DIAG
OID_LIMB_FIELD(oid_wrpcAuxRoTable, func_aux_diag, oid_array_wrpcAuxRoTable),
OID_LIMB_FIELD(oid_wrpcAuxRwTable, func_aux_diag, oid_array_wrpcAuxRwTable),
#endif
{ 0, }
};
......@@ -473,15 +481,17 @@ static void snmp_init(void)
/* TODO: check if pointer(s) is initialized already */
wr_s_state =
&((struct wr_data *)ppi_static.ext_data)->servo_state;
/* Fix ID and version of aux diag registers by values read from FPGA */
diag_read_info(&aux_diag_id, &aux_diag_ver, &aux_diag_reg_rw_num,
&aux_diag_reg_ro_num);
snmp_verbose("aux_diag_id %d, aux_diag_ver %d\n",
aux_diag_id, aux_diag_ver);
oid_wrpcAuxRoTable[AUX_DIAG_ID_INDEX] = aux_diag_id;
oid_wrpcAuxRoTable[AUX_DIAG_VER_INDEX] = aux_diag_ver;
oid_wrpcAuxRwTable[AUX_DIAG_ID_INDEX] = aux_diag_id;
oid_wrpcAuxRwTable[AUX_DIAG_VER_INDEX] = aux_diag_ver;
if (SNMP_AUX_DIAG_ENABLED) {
/* Fix ID and version of aux diag registers by values read from FPGA */
diag_read_info(&aux_diag_id, &aux_diag_ver, &aux_diag_reg_rw_num,
&aux_diag_reg_ro_num);
snmp_verbose("aux_diag_id %d, aux_diag_ver %d\n",
aux_diag_id, aux_diag_ver);
oid_wrpcAuxRoTable[AUX_DIAG_ID_INDEX] = aux_diag_id;
oid_wrpcAuxRoTable[AUX_DIAG_VER_INDEX] = aux_diag_ver;
oid_wrpcAuxRwTable[AUX_DIAG_ID_INDEX] = aux_diag_id;
oid_wrpcAuxRwTable[AUX_DIAG_VER_INDEX] = aux_diag_ver;
}
}
static int func_group(uint8_t *buf, uint8_t in_oid_limb_matched_len,
......@@ -1495,6 +1505,10 @@ static int snmp_respond(uint8_t *buf)
set_pp(NULL, NULL);
set_ptp_config(NULL, NULL);
set_ptp_restart(NULL, NULL);
set_aux_diag(NULL, NULL);
func_aux_diag(NULL, 0, NULL, 0);
oid_array_wrpcAuxRwTable[0].oid_len = 0;
oid_array_wrpcAuxRoTable[0].oid_len = 0;
}
for (a_i = 0, h_i = 0; a_i < sizeof(match_array); a_i++, h_i++) {
......
......@@ -17,7 +17,7 @@ obj-$(CONFIG_EMBEDDED_NODE) += \
shell/cmd_gui.o \
shell/cmd_sdb.o \
shell/cmd_ptrack.o \
shell/cmd_diag.o \
obj-$(CONFIG_IP) += shell/cmd_ip.o
obj-$(CONFIG_PPSI) += shell/cmd_verbose.o
......@@ -26,3 +26,4 @@ obj-$(CONFIG_CMD_SLEEP) += shell/cmd_sleep.o
obj-$(CONFIG_CMD_LL) += shell/cmd_ll.o
obj-$(CONFIG_FLASH_INIT) += shell/cmd_init.o
obj-$(CONFIG_VLAN) += shell/cmd_vlan.o
obj-$(CONFIG_AUX_DIAG) += shell/cmd_diag.o
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