Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: This function relies heavily on the implementation of several network device board support package (BSP) functions. See Network Board Support Package and Ethernet Device Driver BSP Functions for more information on network device BSP functions.

...

Every device driver’s net_dev.c

Prototype

Code Block

          static void NetDev_Init (NET_IF  *p_if,
                                   NET_ERR *p_err);

Note that since every device driver’s 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’.

...

  1. Validate all wireless configuration values.
  2. Configure all necessary I/O pins for the wireless device such as power enable or reset pin. This is generally performed via the network device’s BSP function pointer, CfgGPIO(), implemented in net_bsp.c (see section A-3-2see NetDev_CfgGPIO).
  3. Initialize SPI controller for writing and reading from the wireless module.
  4. 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 B-3-4see NetDev_WiFi_CfgIntCtrl).
  5. Allocate memory for all necessary driver buffers that will be reuse only by the driver such as a read buffer to validate the command sent. This is performed via calls to µC/LIB’s memory module.
  6. Disable the transmitted and receiver (should already be disabled).
  7. Set p_err to NET_DEV_ERR_NONE if initialization proceeded as expected. Otherwise, set p_err to an appropriate network device error code.