1 /* 2 * Description: declaration of driverif APIs 3 */ 4 5 #ifndef __DRIVERIF_H__ 6 #define __DRIVERIF_H__ 7 /** 8 * @file driverif.h 9 */ 10 /** 11 * @defgroup System_interfaces System Interfaces 12 * This contains all the system interfaces. 13 */ 14 #include "lwip/opt.h" 15 #include "netif/etharp.h" 16 17 #if defined (__cplusplus) && __cplusplus 18 extern "C" { 19 #endif 20 21 /** Type of link layer, these macros should be used for link_layer_type of struct netif */ 22 #define LOOPBACK_IF 772 23 #define LOOPBACK_MTU ((16 * 1024) + 20 + 20 + 12) 24 /** Type of link layer, these macros should be used for link_layer_type of struct netif */ 25 #define ETHERNET_DRIVER_IF 1 26 /** Type of link layer, these macros should be used for link_layer_type of struct netif */ 27 #define WIFI_DRIVER_IF 801 28 /** Type of link layer, these macros should be used for link_layer_type of struct netif */ 29 #define PLC_DRIVER_IF 10 30 /** Type of link layer, these macros should be used for link_layer_type of struct netif */ 31 #define IEEE802154_DRIVER_IF 11 32 33 /** Short names of link layer */ 34 #define LOOPBACK_IFNAME "lo" 35 /** Short names of link layer */ 36 #define ETHERNET_IFNAME "eth" 37 /** Short names of link layer */ 38 #define WIFI_IFNAME "wlan" 39 #define PLC_IFNAME "plc" 40 #define RF_IFNAME "ieee802154" 41 42 struct linklayer_addr; 43 44 /** 45 * @defgroup Driver_Interfaces Driver Interfaces 46 * This section provides information about the Network driver related interfaces. 47 */ 48 /** Function pointer of driver send function */ 49 typedef void (*drv_send_fn)(struct netif *netif, struct pbuf *p); 50 51 #if LWIP_IPV6 52 typedef err_t (*drv_send_lln_fn)(struct netif *netif, struct pbuf *p, struct linklayer_addr *destmac); 53 #endif 54 55 /** Function pointer of driver set hw address function */ 56 /* This callback function should return 0 in case of success */ 57 typedef u8_t (*drv_set_hwaddr_fn)(struct netif *netif, u8_t *addr, u8_t len); 58 59 err_t driverif_init(struct netif *netif); 60 61 #if LWIP_NETIF_PROMISC 62 /** Function pointer of driver set/unset promiscuous mode on interface */ 63 typedef void (*drv_config_fn)(struct netif *netif, u32_t config_flags, u8_t setBit); 64 #endif /* LWIP_NETIF_PROMISC */ 65 66 /* 67 * Func Name: driverif_input 68 */ 69 /** 70 * @ingroup Driver_Interfaces 71 * @brief This API must be called by the network driver to pass the input packet to lwIP. 72 * Before calling this API, the driver has to keep the packet in the pbuf structure. The driver must 73 * call pbuf_alloc() with the type as PBUF_RAM to create the pbuf structure. The driver 74 * has to pass the pbuf structure to this API to add the pbuf into the TCPIP thread. 75 * After this packet is processed by TCPIP thread, pbuf will be freed. The driver is not required to 76 * free the pbuf. 77 * @param[in] netif Indicates the lwIP network interface. 78 * @param[in] p Indicates the packet in the pbuf structure. 79 * @return None 80 * @note 81 * None 82 */ 83 void driverif_input(struct netif *netif, struct pbuf *p); 84 85 #if defined (__cplusplus) && __cplusplus 86 } 87 #endif 88 89 #endif 90 91