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

Subversion Repositories minsoc

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

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

Line No. Rev Author Line
1 158 rfajardo
#include <interconnect.h>
2 80 rfajardo
#include <support.h>
3
#include <or1200.h>
4
#include <int.h>
5 2 rfajardo
 
6 80 rfajardo
#include <uart.h>
7
#include <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 158 rfajardo
        uart_init(UART_BASE);
33 2 rfajardo
 
34
        int_init();
35 36 rfajardo
        eth_init();
36 80 rfajardo
        int_add(UART_IRQ, &uart_interrupt, NULL);
37
        int_add(ETH_IRQ, &eth_interrupt, NULL);
38 53 ConX.
 
39 2 rfajardo
        /* We can't use printf because in this simple example
40
           we don't link C library. */
41 149 rfajardo
        uart_print_str("Hello World.\n");
42 2 rfajardo
 
43 36 rfajardo
        eth_tx_data[0] = 0xFF;
44
        eth_tx_data[1] = 0x2B;
45
        eth_tx_data[2] = 0x40;
46
        eth_tx_data[3] = 0x50;
47 2 rfajardo
 
48
        eth_send(4);
49
 
50 53 ConX.
        while(1)
51
        {
52
                if (eth_rx_done)
53
                {
54
                        eth_receive();
55
                }
56
        }
57
 
58 2 rfajardo
        report(0xdeaddead);
59
        or32_exit(0);
60
}
61
 

powered by: WebSVN 2.1.0

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