You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose I already have an ethernet core integrated into my design and wanted to send out a simple ethernet frame using a bare metal program flashed onto it. What might the program look like?
I already tried the following and can see the the preamble and SFD, but the rest of the frame is not I expect and I'm lost on modifying the payload. I appreciate any help that can be offered.
int main(void) {
#ifdef CONFIG_CPU_HAS_INTERRUPT
irq_setmask(0);
irq_setie(1);
#endif
// Random values for parts of the ethernet frame.
const unsigned char macaddr = 0x35;
unsigned int ip = 10;
unsigned short src_port = 0x66;
unsigned short dst_port = 0x77;
unsigned int length = 80;
int status = 0;
uart_init();
puts("\nTesting ethernet...\n");
eth_init();
//eth_mode();
// Pointer to payload. Is this correct?
char *payload = (char *)udp_get_tx_buffer;
*payload = 0x00;
printf("Data in payload: %d\n", *payload);
*payload = 0xee;
printf("After writing 0xEE to payload: %x\n", *(char*)udp_get_tx_buffer);
udp_start(&macaddr, ip);
udp_service();
status = udp_send(src_port, dst_port, length);
if(status == 0)
printf("Failed to send.\n");
else
printf("Successfully sent from core.\n");
while(1) {
}
return 0;
}
The text was updated successfully, but these errors were encountered:
Hello,
Suppose I already have an ethernet core integrated into my design and wanted to send out a simple ethernet frame using a bare metal program flashed onto it. What might the program look like?
I already tried the following and can see the the preamble and SFD, but the rest of the frame is not I expect and I'm lost on modifying the payload. I appreciate any help that can be offered.
The text was updated successfully, but these errors were encountered: