NetIF_Add
Add a network device and hardware as a network interface.
Files
net_if.h/net_if.c
Prototype
NET_IF_NBR NetIF_Add(void *if_api,
void *dev_api,
void *dev_bsp,
void *dev_cfg,
void *ext_api,
void *ext_cfg,
NET_ERR *p_err);
Arguments
if_api
Pointer to the desired link-layer API for this network interface and device hardware. The desired link-layer interface will point to the Ethernet API (NetIF_API_Ether) or the WiFi API, (NetIF_API_WiFi).
dev_api
Pointer to the desired device driver API for this network interface.
dev_bsp
Pointer to the specific device's BSP interface for this network interface (see also section Network Board Support Package).
dev_cfg
Pointer to a configuration structure used to configure the device hardware for the specific network interface (see also section Network Interface Configuration).
ext_api
Pointer to specific network extension layer API.
ext_cfg
Pointer to specific network extension layer configuration.
p_err
Pointer to variable that will receive the return error code from this function:
NET_IF_ERR_NONENET_IF_ERR_NULL_PTRNET_IF_ERR_INVALID_IFNET_IF_ERR_INVALID_CFGNET_IF_ERR_NONE_AVAILNET_BUF_ERR_POOL_INITNET_BUF_ERR_INVALID_POOL_TYPENET_BUF_ERR_INVALID_POOL_ADDRNET_BUF_ERR_INVALID_POOL_SIZENET_BUF_ERR_INVALID_POOL_QTYNET_BUF_ERR_INVALID_SIZENET_OS_ERR_INIT_DEV_TX_RDYNET_OS_ERR_INIT_DEV_TX_RDY_NAMENET_ERR_FAULT_LOCK_ACQUIRE
Returned Value
Network interface number, if device and hardware successfully added;
NET_IF_NBR_NONE, otherwise.
Required Configuration
None.
Notes / Warnings
The first network interface added and started is the default interface used for all default communication.
When a PHY layer is present, the PHY API and configuration need to be indicate in the ext_api and ext_cfg arguments.
Additional error codes may be returned by the specific interface or device driver.
See section Initializing Interfaces for a detailed example of how to add an interface.