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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [eth/] [eth.c] - Blame information for rev 50

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

Line No. Rev Author Line
1 2 rfajardo
#include "../support/support.h"
2
#include "../support/board.h"
3
 
4
#include "../support/spr_defs.h"
5
 
6 36 rfajardo
#include "../drivers/uart.h"
7
#include "../drivers/eth.h"
8 2 rfajardo
 
9
 
10 36 rfajardo
extern int eth_rx_len;
11
extern int eth_rx_done, eth_tx_done;
12
extern unsigned char * eth_rx_data;
13
extern unsigned char * eth_tx_data;
14 2 rfajardo
 
15
void eth_receive()
16
{
17
    int i;
18
    uart_print_str("Length: \n");
19 36 rfajardo
    uart_print_long(eth_rx_len);
20 2 rfajardo
    uart_print_str("\n");
21
    uart_print_str("Data: \n");
22 36 rfajardo
    for ( i = 0; i < eth_rx_len; i++ )
23 2 rfajardo
    {
24 36 rfajardo
        uart_print_short(eth_rx_data[i]);
25
        uart_print_str("\n");
26 2 rfajardo
    }
27 36 rfajardo
    eth_recv_ack();
28 2 rfajardo
}
29
 
30
int main()
31
{
32
    unsigned long lalala;
33
        uart_init();
34
 
35
        int_init();
36 36 rfajardo
        eth_init();
37 2 rfajardo
        int_add(UART_IRQ, &uart_interrupt);
38
        int_add(ETH_IRQ, &eth_interrupt);
39
 
40
        /* We can't use printf because in this simple example
41
           we don't link C library. */
42
        uart_print_str("Hello World.\n\r");
43
 
44 36 rfajardo
        eth_tx_data[0] = 0xFF;
45
        eth_tx_data[1] = 0x2B;
46
        eth_tx_data[2] = 0x40;
47
        eth_tx_data[3] = 0x50;
48 2 rfajardo
 
49
        eth_send(4);
50
 
51
    while(1)
52
    {
53 36 rfajardo
        if (eth_rx_done)
54 2 rfajardo
        {
55
            eth_receive();
56
        }
57
    }
58
 
59
        report(0xdeaddead);
60
        or32_exit(0);
61
}
62
 

powered by: WebSVN 2.1.0

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