xref: /nrf52832-nimble/rt-thread/components/net/lwip-1.4.1/src/include/netif/ethernetif.h (revision 104654410c56c573564690304ae786df310c91fc)
1 #ifndef __NETIF_ETHERNETIF_H__
2 #define __NETIF_ETHERNETIF_H__
3 
4 #include "lwip/netif.h"
5 #include <rtthread.h>
6 
7 #define NIOCTL_GADDR		0x01
8 #ifndef RT_LWIP_ETH_MTU
9 #define ETHERNET_MTU		1500
10 #else
11 #define ETHERNET_MTU		RT_LWIP_ETH_MTU
12 #endif
13 
14 /* eth flag with auto_linkup or phy_linkup */
15 #define ETHIF_LINK_AUTOUP	0x0000
16 #define ETHIF_LINK_PHYUP	0x0100
17 
18 struct eth_device
19 {
20 	/* inherit from rt_device */
21 	struct rt_device parent;
22 
23 	/* network interface for lwip */
24 	struct netif *netif;
25 	struct rt_semaphore tx_ack;
26 
27 	rt_uint16_t flags;
28 	rt_uint8_t  link_changed;
29 	rt_uint8_t  link_status;
30 
31 	/* eth device interface */
32 	struct pbuf* (*eth_rx)(rt_device_t dev);
33 	rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
34 };
35 
36 rt_err_t eth_device_ready(struct eth_device* dev);
37 rt_err_t eth_device_init(struct eth_device * dev, char *name);
38 rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flag);
39 rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
40 
41 int eth_system_device_init(void);
42 
43 #endif /* __NETIF_ETHERNETIF_H__ */
44