diff --git a/litex/soc/software/libliteeth/udp.c b/litex/soc/software/libliteeth/udp.c index 9fa071901..8c34f30bd 100644 --- a/litex/soc/software/libliteeth/udp.c +++ b/litex/soc/software/libliteeth/udp.c @@ -166,6 +166,18 @@ static void send_packet(void) static unsigned char my_mac[6]; static unsigned int my_ip; +void udp_set_ip(unsigned int ip) +{ + my_ip = ip; +} + +void udp_set_mac(const unsigned char *macaddr) +{ + int i; + for(i=0;i<6;i++) + my_mac[i] = macaddr[i]; +} + /* ARP cache - one entry only */ static unsigned char cached_mac[6]; static unsigned int cached_ip; @@ -420,9 +432,8 @@ void udp_start(const unsigned char *macaddr, unsigned int ip) ethmac_sram_reader_ev_pending_write(ETHMAC_EV_SRAM_READER); ethmac_sram_writer_ev_pending_write(ETHMAC_EV_SRAM_WRITER); - for(i=0;i<6;i++) - my_mac[i] = macaddr[i]; - my_ip = ip; + udp_set_ip(ip); + udp_set_mac(macaddr); cached_ip = 0; for(i=0;i<6;i++) diff --git a/litex/soc/software/libliteeth/udp.h b/litex/soc/software/libliteeth/udp.h index 47e844b8a..5691acf0b 100644 --- a/litex/soc/software/libliteeth/udp.h +++ b/litex/soc/software/libliteeth/udp.h @@ -10,6 +10,8 @@ typedef void (*udp_callback)(unsigned int src_ip, unsigned short src_port, unsigned short dst_port, void *data, unsigned int length); +void udp_set_ip(unsigned int ip); +void udp_set_mac(const unsigned char *macaddr); void udp_start(const unsigned char *macaddr, unsigned int ip); int udp_arp_resolve(unsigned int ip); void *udp_get_tx_buffer(void);