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