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

Subversion Repositories minsoc

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

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 53 ConX.
#include "../support/or1200.h"
5 2 rfajardo
 
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 53 ConX.
        int i;
18
        uart_print_str("Length: \n");
19
        uart_print_long(eth_rx_len);
20
        uart_print_str("\n");
21
        uart_print_str("Data: \n");
22
        for ( i = 0; i < eth_rx_len; i++ )
23
        {
24
                uart_print_short(eth_rx_data[i]);
25
                uart_print_str("\n");
26
        }
27
        eth_recv_ack();
28 2 rfajardo
}
29
 
30
int main()
31
{
32 53 ConX.
        unsigned long lalala;
33 2 rfajardo
        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 53 ConX.
 
40 2 rfajardo
        /* 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 53 ConX.
        while(1)
52
        {
53
                if (eth_rx_done)
54
                {
55
                        eth_receive();
56
                }
57
        }
58
 
59 2 rfajardo
        report(0xdeaddead);
60
        or32_exit(0);
61
}
62
 

powered by: WebSVN 2.1.0

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