Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

How to use IOCTL commands in CYW43907

lock attach
Attachments are accessible only for community members.

How to use IOCTL commands in CYW43907

RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

This blog tries to provide a guide for using IOCTL commands. Essentially, WL commands are functions that send an IOCTL or sequence of IOCTLs and process the received data. An alternate way to achieve the same is directly using IOCTL/IOVAR commands. IOCTL  basically stands for "input-output control", which are used to define device-specific system call (in specific WLAN calls). A driver can define an IOCTL which allows APPS Core (ACPU) application to send commands to the WLAN driver; which can ultimately be used to update the configurations of the WLAN. Any user application API internally calls the IOCTL/IOVARs to communicate with the WLAN core. The host interface between WLAN subsystem (WCPU) and the host processor (ACPU) is through the memory to memory DMA engine which uses Cypress proprietary SDPCM protocol for this communication. The SDPCM protocol provides multiplexing of data packets, IOVAR/IOCTL, and asynchronous event signalling allowing a communication between host driver and WLAN firmware.

To use the IOCTL/IOVAR commands directly from the application, the user can use the WWD APIs listed in WICED SDK. For wifi related parameters (like getting the RSSI, setting the transmit antenna, checking the active antenna), the APIs' can be found in wwd_wifi.c. The list of  valid IOCTLs are  provided in

43xxx_Wi-Fi/test/wl_tool/43909B0/include/wlioctl.h.

Similarly, the list of valid IOVARs are provided in

43xxx_Wi-Fi/WICED/WWD/wwd_wlioctl.h

The definition of the above-mentioned IOVARs for the specific platform are provided in

43xxx_Wi-Fi/test/wl_tool/43909B0/wl/exe/wlu_iov.c

pastedImage_0.png

The APIs used to send an IOCTL/IOVAR command or receive a status of  an IOCTL/IOVAR are given by wwd_wifi_set_ioctl/iovar_value and wwd_wifi_get_ioctl/iovar_value. For instance, to set the transmit antenna the format of this API should be

wwd_wifi_set_ioctl_value(WLC_SET_TXANT, 1, WWD_STA_INTERFACE)

The WLC_GET_VAR and WLC_SET_VAR IOCTLs provide a method of getting and setting internal wl driver state values.

  • WLC_GET_VAR takes a NULL-terminated ASCII string name
  • WLC_SET_VAR takes a NULL-terminated ASCII string name followed by an optional value

The name of the IOCTL (WLC_SET_TXANT) used in the example usage of APIs could be located in

43xxx_Wi-Fi/test/wl_tool/chip_number/test/common/include/devctrl_if/wlioctl_defs.h.

A sample application is provided here to test the RSSI using IOCTLs, scan association time using IOVARs and the same is verified using standard WL commands (wl phy_rssi_ant, wl scan_assoc_time).

ioctl.JPG

Attachments
2505 Views