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
Similarly, the list of valid IOVARs are provided in
The definition of the above-mentioned IOVARs for the specific platform are provided in
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
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).