URL
https://opencores.org/ocsvn/amber/amber/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 81 |
Rev 85 |
Line 235... |
Line 235... |
|
|
void parse_rx_packet(char * buf, packet_t* rx_packet)
|
void parse_rx_packet(char * buf, packet_t* rx_packet)
|
{
|
{
|
int i;
|
int i;
|
|
|
rx_packet->dst_mac[0] = buf[0];
|
for (i=0;i<6;i++)
|
rx_packet->dst_mac[1] = buf[1];
|
rx_packet->dst_mac[i] = buf[i];
|
rx_packet->dst_mac[1] = buf[2];
|
|
rx_packet->dst_mac[3] = buf[3];
|
for (i=0;i<6;i++)
|
rx_packet->dst_mac[4] = buf[4];
|
rx_packet->src_mac[i] = buf[i+6];
|
rx_packet->dst_mac[5] = buf[5];
|
|
|
|
rx_packet->src_mac[0] = buf[6];
|
|
rx_packet->src_mac[1] = buf[7];
|
|
rx_packet->src_mac[2] = buf[8];
|
|
rx_packet->src_mac[3] = buf[9];
|
|
rx_packet->src_mac[4] = buf[10];
|
|
rx_packet->src_mac[5] = buf[11];
|
|
rx_packet->eth_type = (buf[12]<<8) + buf[13];
|
rx_packet->eth_type = (buf[12]<<8) + buf[13];
|
|
|
|
|
/* ARP */
|
/* ARP */
|
if (rx_packet->eth_type == 0x0806) {
|
if (rx_packet->eth_type == 0x0806) {
|
parse_arp_packet(&buf[14]);
|
parse_arp_packet(&buf[14]);
|
}
|
}
|
|
|
|
|
/* Internet Protocol */
|
/* Internet Protocol */
|
else if (rx_packet->eth_type == 0x0800){
|
else if (rx_packet->eth_type == 0x0800){
|
parse_ip_packet(&buf[14], rx_packet);
|
parse_ip_packet(&buf[14], rx_packet);
|
}
|
}
|
}
|
}
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.