...
Device Driver
...
Functions for MAC
...
NetDev_Init()
...
Init()
function. This function 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 development 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 failure.Note: This function relies heavily on the implementation of several network device board support package (BSP) functions. See Chapter 6, “Network Board Support Package” on page 121 and Appendix A, “Device Driver BSP Functions” on page 336 for more information on network device BSP functions. Anchor
Files
...
Every device driver’s net_dev.c
Anchor
Prototype
anchor
...
rowspan | 2 |
---|
...
...
Anchor
Init()
function is accessed only by function pointer via the device driver’s API structure, it doesn’t need to be globally available and should therefore be declared as ‘static’‘static
’.Arguments
Anchor
pif
Pointer to the interface to initialize a network device.
...
perr
Pointer to variable that will receive the return error code from this function.
...
Returned Value
Anchor
Required Configuration
Anchor
Notes / Warnings
...
The Init()
function generally performs the following operations, however, depending on the device being initialized, functionality may need to be added or removed:
...
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 generally performed via the network device’s BSP function pointer, CfgIntCtrl()
, implemented in net_bsp.c
(see section A-3-3
...
).
...