OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [eth/] [eth.c] - Rev 51

Go to most recent revision | Compare with Previous | Blame | View Log

#include "../support/support.h"
#include "../support/board.h"
 
#include "../support/spr_defs.h"
 
#include "../drivers/uart.h"
#include "../drivers/eth.h"
 
 
extern int eth_rx_len;
extern int eth_rx_done, eth_tx_done;
extern unsigned char * eth_rx_data;
extern unsigned char * eth_tx_data;
 
void eth_receive()
{
    int i;
    uart_print_str("Length: \n");
    uart_print_long(eth_rx_len);
    uart_print_str("\n");
    uart_print_str("Data: \n");
    for ( i = 0; i < eth_rx_len; i++ )
    {
        uart_print_short(eth_rx_data[i]);
        uart_print_str("\n");
    }
    eth_recv_ack();
}
 
int main()
{
    unsigned long lalala;
	uart_init();
 
	int_init();
	eth_init();
	int_add(UART_IRQ, &uart_interrupt);
	int_add(ETH_IRQ, &eth_interrupt);
 
	/* We can't use printf because in this simple example
	   we don't link C library. */
	uart_print_str("Hello World.\n\r");
 
	eth_tx_data[0] = 0xFF;
	eth_tx_data[1] = 0x2B;
	eth_tx_data[2] = 0x40;
	eth_tx_data[3] = 0x50;
 
	eth_send(4);
 
    while(1)
    {
        if (eth_rx_done)
        {
            eth_receive();
        }
    }
 
	report(0xdeaddead);
	or32_exit(0);
}
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.