OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [trunk/] [sw/] [dev/] [test_main/] [src/] [net/] [net.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 kuzmi4
#ifndef _NET_H_
2
#define _NET_H_
3
 
4
#ifdef __cplusplus
5
extern "C"
6
{
7
#endif// __cplusplus
8
 
9
#include "xil_types.h"
10
#include "tri_mode_emac.h" // tmemac_cfg_t, tri_mode_emac_init
11
 
12
/*
13
#ifndef NULL
14
#define NULL ((void*)0)
15
#endif  // NULL
16
*/
17
 
18
// net-order macros
19
#define lswap(x) ((((x) & 0xff000000) >> 24) | \
20
                  (((x) & 0x00ff0000) >>  8) | \
21
                  (((x) & 0x0000ff00) <<  8) | \
22
                  (((x) & 0x000000ff) << 24))
23
#define htonl(l) (lswap(l))
24
#define ntohl(l) (lswap(l))
25
#define htons(s) ((((s) >> 8) & 0xff) | \
26
                  (((s) << 8) & 0xff00))
27
#define ntohs(s) htons(s)
28
 
29
// mac macros
30
#define _MAC_ADDR_HIGH(a,b)     ((a & 0xFF) <<  8) | \
31
                                ((b & 0xFF) <<  0)
32
#define _MAC_ADDR_LOW(a,b,c,d)  ((a & 0xFF) << 24) | \
33
                                ((b & 0xFF) << 16) | \
34
                                ((c & 0xFF) <<  8) | \
35
                                ((d & 0xFF) <<  0)
36
// ip macro
37
#define _IP_ADDR(a,b,c,d)       ((a & 0xFF) << 24) | \
38
                                ((b & 0xFF) << 16) | \
39
                                ((c & 0xFF) <<  8) | \
40
                                ((d & 0xFF) <<  0)
41
 
42
// tbd
43
typedef struct {
44
    // eth-tx routine
45
    int     (*net_raw_send)(char *, int);
46
    // cfg
47
    u8      *mac_addr;
48
    u32     ip_addr;
49
} net_if_t;
50
 
51
// Ext:
52
int net_init(tmemac_cfg_t *iv_tmemac_cfg, u32 pkt_tx, u32 pkt_rx);
53
int net_input(char *buff);
54
 
55
#ifdef __cplusplus
56
}
57
#endif// __cplusplus
58
 
59
#endif // _NET_H_

powered by: WebSVN 2.1.0

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