From 9c79fa3bd50613cc5e83370f5b672abb646f0630 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Wed, 24 Nov 2021 12:17:57 +0000 Subject: [PATCH] [test_emac] - changed eth_myself - play with DHCP git-svn-id: http://moon:8086/svn/mips@213 a8ebac50-d88d-4704-bea3-6648445a41b3 --- src/test_emac.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/test_emac.c b/src/test_emac.c index bad82cb..38af1f7 100644 --- a/src/test_emac.c +++ b/src/test_emac.c @@ -154,7 +154,7 @@ void Phy_print_regs(Mii_t *pMii, uint16_t phy_id) // ------------------------------------------------------------------- uint8_t eth_bcst[6]= {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; uint8_t eth_zero[6]= {0x00,0x00,0x00,0x00,0x00,0x00}; -uint8_t eth_myself[6] = {0x00,0x00,0x31,0x10,0x19,0x70}; +uint8_t eth_myself[6] = {0x22,0x07,0x31,0x10,0x19,0x70}; uint8_t ip_zero[4] = {0, 0, 0, 0}; uint8_t ip_bcast[4] = {255, 255, 255, 255}; @@ -342,17 +342,23 @@ int main() printf("---------------------------------------------------------------\n"); Eth_pkt_create(&packet, TYPE_PROTO_IP, eth_myself, eth_bcst); DHCP_request_send(&packet, DHCP_MSG_DHCPDISCOVER, eth_myself, ip_zero, ip_bcast, NULL); + PrintBuffer8((uint8_t*)packet.pkt_buf, 16, packet.size); Eth_pkt_send(&packet); + + sleep(1000); + continue; - sleep(500); - do + while(fifo_read(&rx_descr_fifo, (uint8_t*)&rx_descr, sizeof(rx_descr_t), 0, FIFO_NONBLOCK)) { - int32_t size = Eth_pkt_recv(buffer); - PrintBuffer8((uint8_t*)buffer, 16, size); + PrintBuffer8((uint8_t*)rx_descr.pBuf, 16, rx_descr.size); pIPV4 = (IPV4*)&buffer[sizeof(eth_hdr_t)]; pUDP = (UDP*)&buffer[sizeof(eth_hdr_t) + sizeof(IPV4)]; pDHCP = (DHCP*)&buffer[sizeof(eth_hdr_t) + sizeof(IPV4) + sizeof(UDP)]; - } while (pUDP->dst_port != 68); + if (pUDP->dst_port == 68) + { + break; + } + }; printf("---------------------------------------------------------------\n");