libliteeth/udp: add udp_set_ip and udp_set_mac functions
This commit is contained in:
parent
1ce194007b
commit
fc6b02d0da
|
@ -166,6 +166,18 @@ static void send_packet(void)
|
||||||
static unsigned char my_mac[6];
|
static unsigned char my_mac[6];
|
||||||
static unsigned int my_ip;
|
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 */
|
/* ARP cache - one entry only */
|
||||||
static unsigned char cached_mac[6];
|
static unsigned char cached_mac[6];
|
||||||
static unsigned int cached_ip;
|
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_reader_ev_pending_write(ETHMAC_EV_SRAM_READER);
|
||||||
ethmac_sram_writer_ev_pending_write(ETHMAC_EV_SRAM_WRITER);
|
ethmac_sram_writer_ev_pending_write(ETHMAC_EV_SRAM_WRITER);
|
||||||
|
|
||||||
for(i=0;i<6;i++)
|
udp_set_ip(ip);
|
||||||
my_mac[i] = macaddr[i];
|
udp_set_mac(macaddr);
|
||||||
my_ip = ip;
|
|
||||||
|
|
||||||
cached_ip = 0;
|
cached_ip = 0;
|
||||||
for(i=0;i<6;i++)
|
for(i=0;i<6;i++)
|
||||||
|
|
|
@ -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);
|
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);
|
void udp_start(const unsigned char *macaddr, unsigned int ip);
|
||||||
int udp_arp_resolve(unsigned int ip);
|
int udp_arp_resolve(unsigned int ip);
|
||||||
void *udp_get_tx_buffer(void);
|
void *udp_get_tx_buffer(void);
|
||||||
|
|
Loading…
Reference in New Issue