Commit 18d1b7e0 authored by Tristan Gingold's avatar Tristan Gingold

Move wrc_hw_name to wrc_global_link, constify wrc_global

parent 2282fd2e
...@@ -17,7 +17,6 @@ struct dump_info dump_wrpc_info[] = { ...@@ -17,7 +17,6 @@ struct dump_info dump_wrpc_info[] = {
DUMP_HEADER("wrc_global"), DUMP_HEADER("wrc_global"),
DUMP_FIELD(uint32_t, magic), DUMP_FIELD(uint32_t, magic),
DUMP_FIELD(uint32_t, version), DUMP_FIELD(uint32_t, version),
DUMP_FIELD_SIZE(char, wrc_hw_name, HW_NAME_LENGTH),
DUMP_FIELD(pointer, link_status), DUMP_FIELD(pointer, link_status),
DUMP_FIELD(int, task_list_max), DUMP_FIELD(int, task_list_max),
DUMP_FIELD(pointer, task_list), DUMP_FIELD(pointer, task_list),
...@@ -32,6 +31,7 @@ struct dump_info dump_wrpc_info[] = { ...@@ -32,6 +31,7 @@ struct dump_info dump_wrpc_info[] = {
#define DUMP_STRUCT struct wrc_global_link #define DUMP_STRUCT struct wrc_global_link
DUMP_HEADER("wrc_global_link"), DUMP_HEADER("wrc_global_link"),
DUMP_FIELD(uint32_t, version), DUMP_FIELD(uint32_t, version),
DUMP_FIELD_SIZE(char, wrc_hw_name, HW_NAME_LENGTH),
DUMP_FIELD(link_up_status, link_up), DUMP_FIELD(link_up_status, link_up),
DUMP_FIELD(int, vlan), DUMP_FIELD(int, vlan),
DUMP_FIELD(ip_addr_status, ip_status), DUMP_FIELD(ip_addr_status, ip_status),
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
struct wrc_global_link { struct wrc_global_link {
uint32_t version; uint32_t version;
char wrc_hw_name[HW_NAME_LENGTH];
int link_up; int link_up;
int vlan; int vlan;
enum ip_status ip_status; enum ip_status ip_status;
...@@ -20,7 +21,6 @@ struct wrc_global_link { ...@@ -20,7 +21,6 @@ struct wrc_global_link {
struct wrc_global { struct wrc_global {
uint32_t magic; uint32_t magic;
uint32_t version; uint32_t version;
char wrc_hw_name[HW_NAME_LENGTH];
struct wrc_global_link *link_status; struct wrc_global_link *link_status;
int task_list_max; int task_list_max;
struct wrc_task *task_list; struct wrc_task *task_list;
...@@ -30,12 +30,9 @@ struct wrc_global { ...@@ -30,12 +30,9 @@ struct wrc_global {
struct spll_fifo_log *pll_fifo; struct spll_fifo_log *pll_fifo;
struct sfp_info *sfp_info; struct sfp_info *sfp_info;
void * config; void * config;
/* Pointer to the board specific data. Use wrc_hw_name to identify
* a board */
void * board_specific;
}; };
extern struct wrc_global_link wrc_global_link; extern struct wrc_global_link wrc_global_link;
extern struct wrc_global wrc_global; extern const struct wrc_global wrc_global;
#endif #endif
...@@ -138,8 +138,8 @@ static void lldp_add_tlv(int tlv_type) { ...@@ -138,8 +138,8 @@ static void lldp_add_tlv(int tlv_type) {
pdu_p = &lldpdu[lldpdu_len + LLDP_HEADER]; pdu_p = &lldpdu[lldpdu_len + LLDP_HEADER];
/* TLV Info srting */ /* TLV Info srting */
strncpy((char *)(pdu_p), wrc_global.wrc_hw_name, HW_NAME_LENGTH - 1); strncpy((char *)(pdu_p), wrc_global_link.wrc_hw_name, HW_NAME_LENGTH - 1);
pdu_p += strnlen(wrc_global.wrc_hw_name, HW_NAME_LENGTH - 1); pdu_p += strnlen(wrc_global_link.wrc_hw_name, HW_NAME_LENGTH - 1);
strcpy((char *)(pdu_p), ": "); strcpy((char *)(pdu_p), ": ");
pdu_p += 2; /* length of ": " */ pdu_p += 2; /* length of ": " */
strncpy((char *)(pdu_p), build_revision, 32); strncpy((char *)(pdu_p), build_revision, 32);
......
...@@ -437,7 +437,7 @@ static const uint8_t oid_wrpcShellCmdReturnCode[] = {4,0}; ...@@ -437,7 +437,7 @@ static const uint8_t oid_wrpcShellCmdReturnCode[] = {4,0};
OIDs */ OIDs */
/* wrpcVersionGroup */ /* wrpcVersionGroup */
static const struct snmp_oid oid_array_wrpcVersionGroup[] = { static const struct snmp_oid oid_array_wrpcVersionGroup[] = {
OID_FIELD_VAR( oid_wrpcVersionHwType, get_p, NO_SET, ASN_OCTET_STR, (void *)&wrc_global.wrc_hw_name), OID_FIELD_VAR( oid_wrpcVersionHwType, get_p, NO_SET, ASN_OCTET_STR, (void *)&wrc_global_link.wrc_hw_name),
OID_FIELD_VAR( oid_wrpcVersionSwVersion, get_pp, NO_SET, ASN_OCTET_STR, (void *)&build_revision), OID_FIELD_VAR( oid_wrpcVersionSwVersion, get_pp, NO_SET, ASN_OCTET_STR, (void *)&build_revision),
OID_FIELD_VAR( oid_wrpcVersionSwBuildBy, get_pp, NO_SET, ASN_OCTET_STR, (void *)&build_by), OID_FIELD_VAR( oid_wrpcVersionSwBuildBy, get_pp, NO_SET, ASN_OCTET_STR, (void *)&build_by),
OID_FIELD_VAR( oid_wrpcVersionSwBuildDate, get_p, NO_SET, ASN_OCTET_STR, (void *)&snmp_build_date), OID_FIELD_VAR( oid_wrpcVersionSwBuildDate, get_p, NO_SET, ASN_OCTET_STR, (void *)&snmp_build_date),
......
...@@ -240,7 +240,7 @@ static void print_main_description(void) ...@@ -240,7 +240,7 @@ static void print_main_description(void)
int ndevs; int ndevs;
pcprintf(1, 1, C_BLUE, "%s WR PTP Core Sync Monitor %s", pcprintf(1, 1, C_BLUE, "%s WR PTP Core Sync Monitor %s",
wrc_global.wrc_hw_name, build_revision); wrc_global_link.wrc_hw_name, build_revision);
cprintf(C_MAGENTA, "\nEsc or q = exit; r = redraw GUI"); cprintf(C_MAGENTA, "\nEsc or q = exit; r = redraw GUI");
cprintf(C_BLUE, "\n\nTAI Time:%22sUTC offset:", ""); cprintf(C_BLUE, "\n\nTAI Time:%22sUTC offset:", "");
......
...@@ -77,7 +77,7 @@ struct wrc_global_link wrc_global_link = { ...@@ -77,7 +77,7 @@ struct wrc_global_link wrc_global_link = {
.ip_status = IP_TRAINING, .ip_status = IP_TRAINING,
}; };
struct wrc_global wrc_global = { const struct wrc_global wrc_global = {
.magic = WRC_G_MAGIC, .magic = WRC_G_MAGIC,
.version = WRC_G_VERSION, .version = WRC_G_VERSION,
.link_status = &wrc_global_link, .link_status = &wrc_global_link,
...@@ -111,7 +111,7 @@ static void wrc_initialize(void) ...@@ -111,7 +111,7 @@ static void wrc_initialize(void)
wdiags_init(); wdiags_init();
pp_printf("WR Core: starting up...\n"); pp_printf("WR Core: starting up...\n");
get_hw_name(wrc_global.wrc_hw_name); get_hw_name(wrc_global_link.wrc_hw_name);
#ifndef BOARD_HAS_CUSTOM_NETWORK_INIT #ifndef BOARD_HAS_CUSTOM_NETWORK_INIT
net_rst(); net_rst();
......
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