Commit 35f2267e authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

fixes to rest of WRPC sw after merging LLRF stuff

parent 8ba6a5bf
...@@ -72,7 +72,7 @@ int wrc_board_early_init() ...@@ -72,7 +72,7 @@ int wrc_board_early_init()
mac_addr[4] = 0x66; mac_addr[4] = 0x66;
mac_addr[5] = 0x77; mac_addr[5] = 0x77;
} }
ep_set_mac_addr(mac_addr); ep_set_mac_addr(&wrc_endpoint_dev, mac_addr);
return 0; return 0;
} }
......
...@@ -60,7 +60,7 @@ int wrc_board_early_init() ...@@ -60,7 +60,7 @@ int wrc_board_early_init()
mac_addr[4] = 0x66; mac_addr[4] = 0x66;
mac_addr[5] = 0x77; mac_addr[5] = 0x77;
} }
ep_set_mac_addr(mac_addr); ep_set_mac_addr(&wrc_endpoint_dev, mac_addr);
return 0; return 0;
} }
......
...@@ -65,7 +65,7 @@ int wrc_board_early_init() ...@@ -65,7 +65,7 @@ int wrc_board_early_init()
board_dbg("Board MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); board_dbg("Board MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
ep_set_mac_addr( mac ); ep_set_mac_addr( &wrc_endpoint_dev, mac );
spll_set_aux_mode( 0, SPLL_AUX_MODE_TRACKING_SOURCE ); spll_set_aux_mode( 0, SPLL_AUX_MODE_TRACKING_SOURCE );
spll_set_aux_mode( 1, SPLL_AUX_MODE_TRACKING_SOURCE ); spll_set_aux_mode( 1, SPLL_AUX_MODE_TRACKING_SOURCE );
......
...@@ -77,7 +77,7 @@ static int process_arp(uint8_t * buf, int len) ...@@ -77,7 +77,7 @@ static int process_arp(uint8_t * buf, int len)
buf[ARP_OPER + 0] = 0; buf[ARP_OPER + 0] = 0;
buf[ARP_OPER + 1] = 2; buf[ARP_OPER + 1] = 2;
// my MAC+IP // my MAC+IP
ep_get_mac_addr(buf + ARP_SHA); ep_get_mac_addr(&wrc_endpoint_dev, buf + ARP_SHA);
memcpy(buf + ARP_SPA, myIP, 4); memcpy(buf + ARP_SPA, myIP, 4);
// his MAC+IP // his MAC+IP
memcpy(buf + ARP_THA, hisMAC, 6); memcpy(buf + ARP_THA, hisMAC, 6);
......
...@@ -40,7 +40,7 @@ int prepare_bootp(struct wr_sockaddr *addr, uint8_t * buf, int retry) ...@@ -40,7 +40,7 @@ int prepare_bootp(struct wr_sockaddr *addr, uint8_t * buf, int retry)
buf[BOOTP_HOPS] = 0; buf[BOOTP_HOPS] = 0;
/* A unique identifier for the request !!! FIXME */ /* A unique identifier for the request !!! FIXME */
ep_get_mac_addr(buf + BOOTP_XID); ep_get_mac_addr(&wrc_endpoint_dev, buf + BOOTP_XID);
buf[BOOTP_XID + 0] ^= buf[BOOTP_XID + 4]; buf[BOOTP_XID + 0] ^= buf[BOOTP_XID + 4];
buf[BOOTP_XID + 1] ^= buf[BOOTP_XID + 5]; buf[BOOTP_XID + 1] ^= buf[BOOTP_XID + 5];
buf[BOOTP_XID + 2] ^= (retry >> 8) & 0xFF; buf[BOOTP_XID + 2] ^= (retry >> 8) & 0xFF;
...@@ -56,7 +56,7 @@ int prepare_bootp(struct wr_sockaddr *addr, uint8_t * buf, int retry) ...@@ -56,7 +56,7 @@ int prepare_bootp(struct wr_sockaddr *addr, uint8_t * buf, int retry)
memset(buf + BOOTP_GIADDR, 0, 4); memset(buf + BOOTP_GIADDR, 0, 4);
memset(buf + BOOTP_CHADDR, 0, 16); memset(buf + BOOTP_CHADDR, 0, 16);
ep_get_mac_addr(buf + BOOTP_CHADDR); /* own MAC address */ ep_get_mac_addr(&wrc_endpoint_dev, buf + BOOTP_CHADDR); /* own MAC address */
memset(buf + BOOTP_SNAME, 0, 64); /* desired BOOTP server */ memset(buf + BOOTP_SNAME, 0, 64); /* desired BOOTP server */
memset(buf + BOOTP_FILE, 0, 128); /* desired BOOTP file */ memset(buf + BOOTP_FILE, 0, 128); /* desired BOOTP file */
...@@ -81,7 +81,7 @@ int process_bootp(uint8_t * buf, int len) ...@@ -81,7 +81,7 @@ int process_bootp(uint8_t * buf, int len)
uint8_t mac[6]; uint8_t mac[6];
uint8_t ip[4]; uint8_t ip[4];
ep_get_mac_addr(mac); ep_get_mac_addr(&wrc_endpoint_dev, mac);
if (len != BOOTP_END) if (len != BOOTP_END)
return 0; return 0;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ipv4.h" #include "ipv4.h"
#include "ptpd_netif.h" #include "ptpd_netif.h"
#include "dev/pps_gen.h" #include "dev/pps_gen.h"
#include "dev/netif.h"
#include "hw/etherbone-config.h" #include "hw/etherbone-config.h"
enum ip_status ip_status = IP_TRAINING; enum ip_status ip_status = IP_TRAINING;
...@@ -172,7 +173,7 @@ int ipv4_poll(void) ...@@ -172,7 +173,7 @@ int ipv4_poll(void)
{ {
int ret = 0; int ret = 0;
if (link_status == LINK_WENT_UP && ip_status == IP_OK_BOOTP) if (link_status == NETIF_LINK_WENT_UP && ip_status == IP_OK_BOOTP)
ip_status = IP_TRAINING; ip_status = IP_TRAINING;
ret = bootp_poll(); ret = bootp_poll();
......
...@@ -48,7 +48,7 @@ static void fill_mac(uint8_t *tlv, uint8_t type) ...@@ -48,7 +48,7 @@ static void fill_mac(uint8_t *tlv, uint8_t type)
{ {
*tlv = type; *tlv = type;
/* write MAC after subtype byte */ /* write MAC after subtype byte */
ep_get_mac_addr(tlv + LLDP_SUBTYPE); ep_get_mac_addr(&wrc_endpoint_dev, tlv + LLDP_SUBTYPE);
} }
static void lldp_add_tlv(int tlv_type) { static void lldp_add_tlv(int tlv_type) {
...@@ -119,7 +119,7 @@ static void lldp_add_tlv(int tlv_type) { ...@@ -119,7 +119,7 @@ static void lldp_add_tlv(int tlv_type) {
(char *)buf); (char *)buf);
} else { } else {
/* NOTE: no subtype */ /* NOTE: no subtype */
ep_get_mac_addr(mac); ep_get_mac_addr(&wrc_endpoint_dev, mac);
pp_sprintf(buf, pp_sprintf(buf,
"%02x:%02x:%02x:%02x:%02x:%02x", "%02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[0], mac[1], mac[2], mac[3],
...@@ -251,7 +251,7 @@ int lldp_poll(void) ...@@ -251,7 +251,7 @@ int lldp_poll(void)
/* periodic tasks */ /* periodic tasks */
if (ticks > LLDP_TX_TICK_INTERVAL) { if (ticks > LLDP_TX_TICK_INTERVAL) {
ep_get_mac_addr(new_mac); ep_get_mac_addr(&wrc_endpoint_dev, new_mac);
if (HAS_IP) { if (HAS_IP) {
getIP(&new_ipWR); getIP(&new_ipWR);
} }
......
...@@ -934,7 +934,7 @@ static int get_port(uint8_t *buf, struct snmp_oid *obj) ...@@ -934,7 +934,7 @@ static int get_port(uint8_t *buf, struct snmp_oid *obj)
switch ((int) obj->p) { switch ((int) obj->p) {
case (int)PORT_LINK_STATUS: case (int)PORT_LINK_STATUS:
/* overkill, since we need the link to be up to use SNMP */ /* overkill, since we need the link to be up to use SNMP */
tmp_int32 = 1 + ep_link_up(NULL); tmp_int32 = 1 + ep_link_up(&wrc_endpoint_dev, NULL);
return get_value(buf, obj->asn, &tmp_int32); return get_value(buf, obj->asn, &tmp_int32);
default: default:
break; break;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "dev/minic.h" #include "dev/minic.h"
#include "shell.h" #include "shell.h"
#include "dev/pps_gen.h" #include "dev/pps_gen.h"
#include "dev/netif.h"
#include "ipv4.h" #include "ipv4.h"
...@@ -130,7 +131,7 @@ int syslog_poll(void) ...@@ -130,7 +131,7 @@ int syslog_poll(void)
if (!tics) { if (!tics) {
/* first time ever, or new syslog server */ /* first time ever, or new syslog server */
tics = now - 1; tics = now - 1;
ep_get_mac_addr(mac); ep_get_mac_addr(&wrc_endpoint_dev, mac);
len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip); len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip);
len += pp_sprintf(buf + len, "(%s) Node up " len += pp_sprintf(buf + len, "(%s) Node up "
"since %i seconds", format_mac(b, mac), "since %i seconds", format_mac(b, mac),
...@@ -138,9 +139,9 @@ int syslog_poll(void) ...@@ -138,9 +139,9 @@ int syslog_poll(void)
goto send; goto send;
} }
if (link_status == LINK_WENT_DOWN) if (link_status == NETIF_LINK_WENT_DOWN)
down_tics = now; down_tics = now;
if (link_status == LINK_UP && down_tics) { if (link_status == NETIF_LINK_UP && down_tics) {
down_tics = now - down_tics; down_tics = now - down_tics;
len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip); len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip);
len += pp_sprintf(buf + len, "Link up after %i.%03i s", len += pp_sprintf(buf + len, "Link up after %i.%03i s",
......
...@@ -110,7 +110,7 @@ static void wrc_sim_initialize(void) ...@@ -110,7 +110,7 @@ static void wrc_sim_initialize(void)
shw_pps_gen_init(); shw_pps_gen_init();
spll_very_init(); spll_very_init();
/* wait for link up before enabling tm_time_valid_o */ /* wait for link up before enabling tm_time_valid_o */
while (ep_link_up(NULL) == 0) {} while (ep_link_up(&wrc_endpoint_dev, NULL) == 0) {}
shw_pps_gen_enable_output(1); shw_pps_gen_enable_output(1);
} }
/* /*
......
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