Initializing a Network Device
NetDev_Init()
is called by NetIF_Add()
exactly once for each specific network device added by the application. If multiple instances of the same network device are present on the board, then this function is called for each instance of the device. However, applications should not try to add the same specific device more than once. If a network device fails to initialize, we recommend debugging to find and correct the cause of the failure.
NetDev_Init()
performs the following operations. However, depending on the device being initialized, functionality may need to be added or removed:
*p_err
if and unacceptable value have been specified to NET_DEV_ERR_INVALID_CFG
must be returned.NetDev_WiFi_CfgGPIO()
, implemented in net_bsp.c
.Configure the host interrupt controller for receive and transmit complete interrupts. Additional interrupt services may be initialized depending on the device and driver requirements. This is performed via the network device’s BSP function pointer, NetDev_WiFi_CfgIntCtrl()
, implemented in net_bsp.c
. However, receive interrupt should not be enabled before starting the interface.
NetDev_WiFi_SPI_Init()
. The communication between the host and the wireless module should not be initialized, the wireless device should be powered down during and after the initialization.p_err
to NET_DEV_ERR_NONE
if initialization proceeded as expected. Otherwise, set p_err
to an appropriate network device error code.