[test_emac]

- changed eth_myself
- play with DHCP

git-svn-id: http://moon:8086/svn/mips@213 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2021-11-24 12:17:57 +00:00
parent 2a12a5f931
commit 9c79fa3bd5
+12 -6
View File
@@ -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");