Microchip® Advanced Software Framework

wilc/driver/source/m2m_wifi.c File Reference

This module contains WILC M2M Wi-Fi APIs implementation.

Copyright (c) 2016-2021 Microchip Technology Inc. and its subsidiaries.

#include <string.h>
#include "driver/include/m2m_wifi.h"
#include "driver/source/nmdrv.h"
#include "driver/source/m2m_hif.h"
#include "driver/source/nmasic.h"

Functions

sint8 m2m_wifi_allow_p2p_connection ()
 
sint8 m2m_wifi_ap_add_black_list (uint8 bAddNewEntry, uint8 *mac_addr)
 
sint8 m2m_wifi_ap_get_assoc_info (void)
 Request the status information of the currently connected stations to the WILC1000 AP. The result is passed to the Wi-Fi notification callback with the event M2M_WIFI_RESP_AP_ASSOC_INFO. More...
 
static void m2m_wifi_cb (uint8 u8OpCode, uint16 u16DataSize, uint8 *pu8Buffer)
 
sint8 m2m_wifi_change_monitoring_channel (uint8 u8ChannelID)
 
sint8 m2m_wifi_connect (char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, tuniM2MWifiAuth *puniAuthInfo, uint16 u16Ch)
 
sint8 m2m_wifi_deinit (void *arg)
 De-initialize the WINC driver and host interface. More...
 
sint8 m2m_wifi_disable_ap (void)
 Synchronous API to disable access point mode on the WINC IC. More...
 
NMI_API sint8 m2m_wifi_disable_mcast_filter (void)
 
sint8 m2m_wifi_disable_monitoring_mode (void)
 
sint8 m2m_wifi_disconnect (void)
 Synchronous API to request disconnection from a network. More...
 
sint8 m2m_wifi_download_cert (uint8 *pCertData, uint32 u32CertSize)
 
sint8 m2m_wifi_enable_ap (CONST tstrM2MAPConfig *pstrM2MAPConfig)
 Asynchronous API to enable access point (AKA "hot-spot") mode on the WINC IC. More...
 
NMI_API sint8 m2m_wifi_enable_mac_mcast (uint8 *pu8MulticastMacAddress, uint8 u8AddRemove)
 Add MAC filter to receive Multicast packets. More...
 
NMI_API sint8 m2m_wifi_enable_mcast_filter (void)
 Enable Multicast filter. More...
 
sint8 m2m_wifi_enable_monitoring_mode (tstrM2MWifiMonitorModeCtrl *pstrMtrCtrl)
 
sint8 m2m_wifi_get_connection_info (void)
 Request the status information of the currently connected Wi-Fi AP. The result is passed to the Wi-Fi notification callback with the event M2M_WIFI_RESP_CONN_INFO. More...
 
sint8 m2m_wifi_get_mac_address (uint8 *pu8MacAddr0, uint8 *pu8MacAddr1)
 Request the current MAC addresses of the device (the working mac addresses). (the function is Blocking until response received) More...
 
uint8 m2m_wifi_get_num_ap_found (void)
 Reads the number of AP's found in the last Scan Request, The function read the number of AP's from global variable which updated in the wifi_cb in M2M_WIFI_RESP_SCAN_DONE. More...
 
sint8 m2m_wifi_get_otp_mac_address (uint8 *pu8MacAddr, uint8 *pu8IsValid)
 Request the MAC address stored on the OTP (one time programmable) memory of the device. (the function is Blocking until response received) More...
 
uint8 m2m_wifi_get_sleep_mode (void)
 Get the current Power save mode. More...
 
sint8 m2m_wifi_handle_events (void *arg)
 Synchronous M2M event handler function. More...
 
sint8 m2m_wifi_init (tstrWifiInitParam *param)
 Synchronous API to initialize the WINC driver. More...
 
sint8 m2m_wifi_p2p (uint8 u8Channel, tenuP2PTrigger enuTrigger, uint16 u16WPS_CfgMehods)
 
sint8 m2m_wifi_p2p_disconnect (void)
 
sint8 m2m_wifi_req_curr_rssi (void)
 Request the current RSSI for the current connected AP, the response received in wifi_cb M2M_WIFI_RESP_CURRENT_RSSI. More...
 
sint8 m2m_wifi_req_scan_result (uint8 index)
 Reads the AP information from the Scan Result list with the given index, the response received in wifi_cb M2M_WIFI_RESP_SCAN_RESULT, the response pointer should be casted with tstrM2mWifiscanResult structure. More...
 
sint8 m2m_wifi_request_scan (uint8 ch)
 Asynchronous API to request the WINC IC to scan for networks. More...
 
sint8 m2m_wifi_request_scan_ssid (uint8 ch, char *pcssid)
 
sint8 m2m_wifi_send_ethernet_pkt (uint8 *pu8Packet, uint16 u16PacketSize, uint8 u8IfcId)
 
sint8 m2m_wifi_send_wlan_pkt (uint8 *pu8WlanPacket, uint16 u16WlanHeaderLength, uint16 u16WlanPktSize)
 
NMI_API sint8 m2m_wifi_set_antenna_mode (uint8 ant_mode, uint8 gpio_mode, uint8 ant_gpio1, uint8 ant_gpio2)
 
sint8 m2m_wifi_set_cust_InfoElement (uint8 *pau8M2mCustInfoElement)
 API to add or remove a user-defined Information Element. More...
 
sint8 m2m_wifi_set_ht_enable (uint8 value)
 This function enables or disables 11n HT (MCS retes) based on parameter passed. More...
 
sint8 m2m_wifi_set_lsn_int (tstrM2mLsnInt *pstrM2mLsnInt)
 Set the Wi-Fi listen interval for power save operation. It is represented in units of AP Beacon periods. More...
 
sint8 m2m_wifi_set_mac_address (uint8 au8MacAddress0[6], uint8 au8MacAddress1[6])
 Assign MAC addresses to the WILC device. More...
 
NMI_API sint8 m2m_wifi_set_max_tx_rate (tenuTxDataRate enuMaxTxDataRate)
 
sint8 m2m_wifi_set_p2p_control_ifc (uint8 u8IfcId)
 
sint8 m2m_wifi_set_p2p_pin (uint8 *pu8PinNumber, uint8 u8PinLength)
 
NMI_API sint8 m2m_wifi_set_receive_buffer (void *pvBuffer, uint16 u16BufferLen)
 set the ethernet receive buffer, should be called in the receive call back. More...
 
sint8 m2m_wifi_set_scan_list (tstrM2MScanList *pstrScanList)
 
sint8 m2m_wifi_set_scan_options (uint8 u8NumOfSlot, uint8 u8SlotTime)
 
sint8 m2m_wifi_set_scan_region (uint8 ScanRegion)
 
sint8 m2m_wifi_set_sleep_mode (uint8 PsTyp, uint8 BcastEn)
 Set the power saving mode for the WILC1000. More...
 
sint8 m2m_wifi_set_tx_power (uint8 u8TxPwrLevel)
 set the TX power More...
 
sint8 m2m_wifi_wps (uint8 u8TriggerType, const char *pcPinNumber)
 Asynchronous API to engage the WINC IC's Wi-Fi Protected Setup (enrollee) function. More...
 
sint8 m2m_wifi_wps_disable (void)
 Disable the WILC WPS operation. More...
 
sint8 m2m_wifi_set_device_name (uint8 *pu8DeviceName, uint8 u8DeviceNameLength)
 Set the WILC1000 device name which is used as P2P device name. More...
 

Variables

tuCtrlStruct guCtrlStruct __M2M_DMA_BUF_ATT__
 
static tpfAppEthCb gpfAppEthCb = NULL
 
static tpfAppMonCb gpfAppMonCb = NULL
 
tpfAppWifiCb gpfAppWifiCb = NULL
 
static uint8gpu8ethRcvBuf =NULL
 
static uint16 gu16ethRcvBufSize
 
static volatile uint8 gu8ChNum
 
static volatile uint8 gu8scanInProgress = 0
 

NMI_API sint8 m2m_wifi_allow_p2p_connection ( )
Parameters
[in]None
Warning
The p2p mode must have be enabled and active before a m2m_wifi_set_p2p_pin can be called.
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

References m2m_wifi_set_p2p_pin().

Referenced by wifi_cb().

NMI_API sint8 m2m_wifi_disable_mcast_filter ( void  )
NMI_API sint8 m2m_wifi_enable_mcast_filter ( void  )

Enable Multicast filter.

Parameters
[in]None
Returns
The function SHALL return 0 for success and a negative value otherwise.

References hif_send(), M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_ENABLE_MCAST_FILTER, and NULL.

Referenced by os_m2m_wifi_enable_mcast_filter().

NMI_API sint8 m2m_wifi_set_ht_enable ( uint8  value)

This function enables or disables 11n HT (MCS retes) based on parameter passed.

Parameters
[in]valuevalue can be 0 or 1, 0 to disable 11n HT and 1 to enable 11n HT.
See Also
tstrM2mReqHTEnable
Returns
The function shall return M2M_SUCCESE for success and a negative value otherwise

References hif_send(), M2M_ERR_FAIL, M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_HT_MIB_ENABLE, NULL, and tstrM2mReqHTEnable::u8Enable.

static uint32 u32CertChunkSize __M2M_DMA_BUF_ATT__
tpfAppEthCb gpfAppEthCb = NULL
static

Referenced by m2m_wifi_cb(), and m2m_wifi_init().

tpfAppMonCb gpfAppMonCb = NULL
static

Referenced by m2m_wifi_cb(), and m2m_wifi_init().

uint8* gpu8ethRcvBuf =NULL
static
uint16 gu16ethRcvBufSize
static
volatile uint8 gu8ChNum
static
volatile uint8 gu8scanInProgress = 0
static