Versions Compared

Key

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

...

Next, each device’s/interface’s BSP functions must be organized into an interface structure used by the device driver to call specific devices’ BSP functions via function pointer instead of by name. This allows applications to add, initialize, and configure any number of instances of various devices and drivers by creating similar but unique BSP functions and interface structures for each network device/interface. (See NetIF_Add()section Interface Programming for details on how applications add interfaces to µC/TCP-IP.)

...

Details for these functions may be found in their respective sections in Wireless Device Driver BSP Functions. Templates for network device BSP functions and BSP interface structures can be found in the directory \Micrium\Software\uC-TCPIP-V2\BSP\Template\.

...

Each network device's NetDev_WiFi_CfgGPIO() should configure all required GPIO pins for the network device. For wireless devices, this function is necessary to configure the power, reset and interrupt pins.

See function NetDev_WiFi_CfgGPIO() for more information.

Starting a Wireless Device

...

Each network device’s NetDev_WiFi_Start() must set GPIO pins to power up and reset the wireless device. For wireless devices, this function is necessary to configure the power pin and other required pins to power up the wireless chip. Note that a wireless device could require the toggle on the Reset pin to be started or restarted correctly.

See function NetDev_WiFi_Start() for more information.

Stopping a Wireless Device

...

Each network device's NetDev_WiFi_Start() must set GPIO pins to power down the wireless chip to reduce the power consumption. For wireless devices, this function is necessary to configure the power pin and other required pins to power down the wireless chip.

See funciton NetDev_WiFi_Stop() for more information.

Configuring the Interrupt Controller for a Wireless Device

...

  1. Configure/store each device’s network interface number to be available for all necessary NetDev_WiFi_ISR_Handler() functions (see section Specifying the Interface Number of the Device ISR for more information). Even though devices are added dynamically, the device’s interface number must be saved in order for each device’s ISR handlers to call NetIF_WiFi_ISR_Handler() with the device’s network interface number.
  2. Configure each of the device’s interrupts on an interrupt controller (either an external or CPU-integrated interrupt controller). However, vectored interrupt controllers may not require higher-level interrupt controller sources to be explicitly configured and enabled. In this case, you may need to configure the system’s interrupt vector table with the name of the ISR handler functions declared in net_bsp.c.

NetDev_WiFi_CfgIntCtrl() should disable only each devices’ interrupt sources. See function NetDev_WiFi_CfgIntCtrl() for more information.

Enabling and Disabling Wireless Interrupt

Each network device’s NetDev_WiFi_IntCtrl() function must enable or disable all external required interrupt sources for the wireless device. This means enable or disable its corresponding interrupt source following the enable argument received.

See function NetDev_WiFi_IntCtrl() for more information.

Configuring the SPI Interface

...

If the SPI bus is not shared with other devices, it is recommended that NetDev_WiFi_SPI_Init() configures the SPI controller following the SPI device’s communication settings and keep NetDev_WiFi_SPI_Cfg() empty.

See NetDev_WiFi_SPI_Cfg() for more information.

Setting SPI Controller for a Wireless device

...

Since more than one device with different SPI communication settings may share the same SPI bus, this function must reconfigure the SPI controller following the device’s SPI communication setting each time the device driver must access the SPI bus. If the SPI bus is not shared with other devices, it’s recommended that NetDev_SPI_Cfg() configures the SPI controller following the SPI’s communication setting of the wireless device and to keep this function empty.

See  NetDev_WiFi_SPI_Cfg()  for more information.

Locking and Unlocking SPI Bus

NetDev_WiFi_SPI_Lock() acquires a specific network device's SPI bus access. This function will be called before the device driver begins to access the SPI. The application should not use the same bus to access another device until the matching call to NetDev_WiFI_SPI_Unlock() has been made. If no other SPI device shares the same SPI bus, it's recommended to keep this function empty.

See function NetDev_WiFi_SPI_Lock() for more information.

Enabling and Disabling SPI Chip select

NetDev_WiFi_SPI_ChipSelEn() enables the chip select pin of the wireless device. This function is called before the device driver begins to access the SPI. The chip select pin should stay enabled until the matching call to NetDev_WiFi_SPI_ChipSelDis() has been made. The chip select pin is typically “active low.” To enable the device, the chip select pin should be cleared; to disable the device, the chip select pin should be set.

See function NetDev_WiFi_SPI_ChipSelEn() for more information.

Writing and Reading to the SPI Bus

NetDev_WiFi_SPI_WrRd() writes and reads data to and from the SPI bus. This function is called each time the device driver accesses the SPI bus. NetDev_WiFi_SPI_WrRd() must not return until the write/read operation is complete. Writing and reading to the SPI bus by using DMA is possible, but the BSP layer must implement a notification mechanism to return from this function only when the write and read operations are entirely completed. See function NetDev_WiFi_SPI_WrRd() for more information.