50 static uint16 gu16ethRcvBufSize ;
57 static struct _tstrMgmtCtrl
63 gstrMgmtCtrl = {
NULL, 0 , 0};
117 if (app_wifi_recover_cb)
118 app_wifi_recover_cb(strState.u8CurrState);
146 M2M_INFO(
"Conflicted IP \" %u.%u.%u.%u \" \n",
211 uint16 u16BleMsgLen = (rx_buf[1] << 8) + rx_buf[0];
216 bleRx->
u16Len = u16BleMsgLen;
260 if((gpfAppEthCb) &&(gau8ethRcvBuf)&& (gu16ethRcvBufSize > 0))
296 if(u16DataSize > 0 && gstrMgmtCtrl.pu8Buf !=
NULL)
298 if(u16DataSize > (gstrMgmtCtrl.u16Sz + gstrMgmtCtrl.u16Offset))
300 u16DataSize = gstrMgmtCtrl.u16Sz;
309 gpfAppMonCb(&strRxPacketInfo, gstrMgmtCtrl.pu8Buf,u16DataSize);
312 M2M_ERR(
"Incorrect mon data size %u\n", u16DataSize);
318 M2M_ERR(
"REQ Not defined %d\n",u8OpCode);
341 if(pstrM2MAPConfig ==
NULL)
362 if(!(pstrM2MAPConfig->au8DHCPServerIP[0] || pstrM2MAPConfig->au8DHCPServerIP[1]))
364 if(!(pstrM2MAPConfig->au8DHCPServerIP[2]))
366 M2M_ERR(
"INVALID DHCP SERVER IP\n");
379 if((pstrM2MAPConfig->u8KeyIndx <= 0) || (pstrM2MAPConfig->u8KeyIndx >
WEP_KEY_MAX_INDEX))
381 M2M_ERR(
"INVALID KEY INDEX\n");
404 M2M_ERR(
"INVALID AUTHENTICATION MODE\n");
416 if(ptstrM2MScanOption ==
NULL)
426 M2M_ERR(
"INVALID No of scan slots!\n");
432 M2M_ERR(
"INVALID scan slot time!\n");
438 M2M_ERR(
"INVALID No of probe requests per scan slot\n");
589 if(pvAuthInfo ==
NULL)
601 if(pu8Psk[i]<
'0' || (pu8Psk[i]>
'9' && pu8Psk[i] <
'A')|| (pu8Psk[i]>
'F' && pu8Psk[i] <
'a') || pu8Psk[i] >
'f')
629 strConnect.
au8SSID[u8SsidLen] = 0;
633 pstrAuthInfo = &strConnect.
strSec;
666 M2M_ERR(
"Incorrect PSK key length\n");
682 M2M_ERR(
"undefined sec type\n");
838 strCmd.
u8cmd = u8Cmd;
841 M2M_ERR(
"_PS_SERVER_ is not defined\n");
853 M2M_ERR(
"_PS_SERVER_ is not defined\n");
870 M2M_ERR(
"Listen channel should only be 1, 6 or 11\n");
927 if((pu8Packet !=
NULL)&&(u16PacketSize>0))
1011 strReqScanRlt.
u8Index = index;
1106 u8DeviceNameLength ++;
1204 gstrMgmtCtrl.pu8Buf = pu8PayloadBuffer;
1205 gstrMgmtCtrl.u16Sz = u16BufferSize;
1206 gstrMgmtCtrl.u16Offset = u16DataOffset;
1220 if(pu8WlanPacket !=
NULL)
1237 if((pstrAPConfig !=
NULL))
1243 if((
m2m_strlen((
uint8 *)pcHttpServerDomainName) <= 0) || (
NULL == pcHttpServerDomainName))
1245 M2M_ERR(
"INVALID DOMAIN NAME\n");
1350 strM2mEnableLogs.
u8Enable = u8Enable;
1395 M2M_ERR(
"PRNG Buffer exceeded maximum size %d or NULL Buffer\n",u16PrngSize);
1420 if(pu8MulticastMacAddress !=
NULL )
1450 if(pvBuffer !=
NULL)
1452 gau8ethRcvBuf = pvBuffer;
1453 gu16ethRcvBufSize= u16BufferLen;
1458 M2M_ERR(
"Buffer NULL pointer\r\n");
sint8 enable_interrupts(void)
sint8 nm_drv_init_download_mode(uint32 req_serial_number)
sint8 nm_drv_init_hold(uint32 req_serial_number)
NMI_API void m2m_memcpy(uint8 *pDst, uint8 *pSrc, uint32 sz)
Copy specified number of bytes from source buffer to destination buffer.
This struct contains the Wi-Fi scan request.
sint8 hif_chip_wake(void)
To Wakeup the chip.
This struct contains the information for the PS Server command.
sint8 m2m_wifi_reinit_start(tstrWifiInitParam *param)
Second part of m2m_wifi_reinit, continuing from where m2m_wifi_reinit_hold left off.
sint8 m2m_wifi_connect(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch)
Asynchronous API to request connection to a specified access point.
sint8 m2m_wifi_req_scan_result(uint8 index)
Asynchronous API to request the information of an access point discovered via scanning.
sint8 nm_get_firmware_full_info(tstrM2mRev *pstrRev)
Get Firmware version info.
NMI_API sint8 m2m_wifi_ble_api_send(uint8 *msg, uint32 len)
sint8 m2m_wifi_set_sleep_mode(uint8 PsTyp, uint8 BcastEn)
Synchronous API to set the power-save mode of the WINC IC.
#define M2M_ETHERNET_HDR_OFFSET
This struct contains the Device Name of the WINC. It is used mainly for Wi-Fi Direct device discovery...
#define WEP_KEY_MAX_INDEX
This struct contains the MAC address to be used. The WINC loads the mac address from the efuse by def...
#define WEP_104_KEY_STRING_SIZE
sint8 nm_get_hif_info(uint16 *pu16FwHifInfo, uint16 *pu16OtaHifInfo)
Get Hif info of images in both partitions (Firmware and Ota).
#define M2M_HIF_BLOCK_VALUE
signed char sint8
Range of values between -128 to 127.
sint8 nmi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 *pu8IsValid)
sint8 m2m_wifi_set_power_profile(uint8 u8PwrMode)
Change the power profile mode.
sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100)
Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and...
sint8 m2m_wifi_disable_ap(void)
Synchronous API to disable access point mode on the WINC IC.
sint8 m2m_wifi_set_scan_options(tstrM2MScanOption *ptstrM2MScanOption)
Synchronous API for configuring the behaviour of the WINC IC's network scanning functions.
This struct contains the Wi-Fi TX Packet Info. The M2M Application has the ability to compose raw Wi-...
This struct stores the WPS configuration parameters.
static void m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
tstrEthInitParam strEthInitParam
sint8 m2m_wifi_start_provision_mode(tstrM2MAPConfig *pstrAPConfig, char *pcHttpServerDomainName, uint8 bEnableHttpRedirect)
Asynchronous API for control of Wi-Fi provisioning functionality.
This struct contains the Wi-Fi scan result.
sint8 m2m_wifi_wps(uint8 u8TriggerType, const char *pcPinNumber)
Asynchronous API to engage the WINC IC's Wi-Fi Protected Setup (enrolee) function.
void hif_yield(void)
Yields control from interrupt event handler.
This struct contains the information for the PS Server initialization.
sint8 m2m_wifi_request_dhcp_client(void)
Legacy (deprecated) Asynchronous API for starting a DHCP client on the WINC IC.
sint8 hif_handle_isr(void)
Handle interrupt received from NMC1500 firmware.
sint8 m2m_wifi_deinit(void *arg)
Synchronous API that de-initialises the WINC driver.
This struct stores the credentials for the user to authenticate with the AAA server (WPA-Enterprise M...
static sint8 m2m_validate_scan_options(tstrM2MScanOption *ptstrM2MScanOption)
Structure, holding the Wi-fi configuration attributes such as the wi-fi callback , monitoring mode callback and Ethernet parameter initialization structure. Such configuration parameters are required to be set before calling the wi-fi initialization function m2m_wifi_init. pfAppWifiCb attribute must be set to handle the wi-fi callback operations. pfAppMonCb attribute, is optional based on whether the application requires the monitoring mode configuration, and can there not be set before the initialization. strEthInitParam structure, is another optional configuration based on whether the bypass mode is set.
This struct contains the Wi-Fi RX Frame Header. The M2M application has the ability to allow Wi-Fi mo...
This struct contains the information corresponding to an AP in the scan result list identified by its...
#define M2M_HIF_HDR_OFFSET
This struct contains the Wi-Fi information for the channel regions.
sint8 m2m_wifi_get_mac_address(uint8 *pu8MacAddr)
Synchronous API to retrieve the MAC address currently in use on the device.
sint8 m2m_wifi_request_sleep(uint32 u32SlpReqTime)
Asynchronous API to place the WINC IC into sleep mode for a specified period of time.
tstrM2MAPConfig strApConfig
This struct contains a BLE message.
sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength)
Asynchronous API to set the Wi-Fi Direct "Device Name" of the WINC IC.
This struct contains the provisioning information obtained from the HTTP Provisioning server...
sint8 m2m_wifi_p2p_disconnect(void)
Synchronous API to disable Wi-Fi Direct (P2P) Mode on the WINC IC.
This struct contains the information from the Multicast filter.
sint8 hif_init(void *arg)
To initialize HIF layer.
sint8 m2m_wifi_req_curr_rssi(void)
Asynchronous API to request the current Receive Signal Strength (RSSI) of the current connection...
This struct contains the Wi-Fi Monitor Mode Filter. It sets the filtering criteria for WLAN packets w...
This struct contains the Listen Interval. It is the value of the Wi-Fi StA Listen Interval when power...
NMI_API sint8 m2m_wifi_enable_monitoring_mode(tstrM2MWifiMonitorModeCtrl *pstrMtrCtrl, uint8 *pu8PayloadBuffer, uint16 u16BufferSize, uint16 u16DataOffset)
Asynchronous call to enable Wi-Fi monitoring (promiscuous receive) mode.
unsigned short uint16
Range of values between 0 to 65535.
void m2m_wifi_yield(void)
Yield from processing more synchronous M2M events.
uint8 au8WepKey[WEP_104_KEY_STRING_SIZE+1]
sint8 m2m_wifi_init_hold(void)
First part of m2m_wifi_init, up to the point of initializing spi for flash access.
void(* tpfAppWifiCb)(uint8 u8MsgType, void *pvMsg)
This is the main callback function for the Wi-Fi driver and is responsible for processing any M2M_WIF...
sint8 hif_check_compatibility(uint16 u16HifInfo)
To check the compatibility of an image with the current driver.
WINC3400 IoT Application Interface.
This struct contains the sleep time for the Power Save request.
This struct contains the provisioning mode configuration.
sint8 m2m_wifi_check_ota_rb(void)
Synchronous API to check presence and compatibility of the WINC image that is stored in the inactive ...
This struct contains the Wi-Fi connection state.
This struct stores logging information.
sint8 m2m_wifi_connect_sc(char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch, uint8 u8NoSaveCred)
Asynchronous API to request connection to a specific AP with option to store credentials in flash...
This struct contains the connection information.
This struct stores the authentication credentials to connect to a Wi-Fi network.
sint8 m2m_wifi_enable_firmware_logs(uint8 u8Enable)
Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and...
uint8 au8macaddress[M2M_MAC_ADDRES_LEN]
sint8 m2m_wifi_reinit_hold(void)
First part of m2m_wifi_reinit, up to the point of initializing spi for flash access.
sint8 hif_register_cb(uint8 u8Grp, tpfHifCallBack fn)
sint8 m2m_wifi_get_firmware_version(tstrM2mRev *pstrRev)
Synchronous API to obtain the firmware version currently running on the WINC IC.
sint8 m2m_wifi_send_ethernet_pkt(uint8 *pu8Packet, uint16 u16PacketSize)
Asynchronous API to queue an Ethernet packet for transmission by the WINC IC.
sint8 m2m_wifi_enable_dhcp(uint8 u8DhcpEn)
Asynchronous function to control the DHCP client functionality within the WINC IC.
sint8 m2m_wifi_set_mac_address(uint8 au8MacAddress[6])
Synchronous API for assigning a MAC address to the WINC IC.
#define M2M_BUFFER_MAX_SIZE
#define M2M_SCAN_DEFAULT_NUM_PROBE
static tpfAppWifiCb gpfAppWifiCb
This module contains WINC3400 ASIC specific internal APIs.
This struct contains the response error of m2m_default_connect.
uint32 m2m_wifi_get_chipId(void)
Synchronous API to obtain the firmware WINC chip ID.
This struct contains the Power Save configuration.
sint8 m2m_wifi_request_dhcp_server(uint8 *addr)
Legacy (deprecated) Asynchronous function to start a DHCP client on the WINC IC.
This struct contains the static IP configuration.
sint8 m2m_wifi_request_scan(uint8 ch)
Asynchronous API to request the WINC IC perform a scan for networks.
sint8 nm_get_ota_firmware_info(tstrM2mRev *pstrRev)
Get Firmware version info.
NMI_API void m2m_memset(uint8 *pBuf, uint8 val, uint32 sz)
Set specified number of data bytes in specified data buffer to specified value.
This struct stores the WEP security key parameters.
tstrM2mWifiWepParams strWepInfo
#define M2M_MAC_ADDRES_LEN
sint8 m2m_wifi_set_static_ip(tstrM2MIPConfig *pstrStaticIPConf)
Synchronous API to manually assign a (static) IP address to the WINC IC.
sint8 m2m_wifi_download_mode()
Synchronous API that prepares the WINC IC to enter firmware or certificate download mode...
uint16 u16RemainigDataSize
uint8 m2m_wifi_get_num_ap_found(void)
Synchronous API to retrieve the number of AP's found during the last scan operation.
NMI_API uint16 m2m_strlen(uint8 *pcStr)
Returns the string length of a null terminated string buffer.
This struct contains the information of the gain table index from flash to be used.
sint8 m2m_wifi_init_start(tstrWifiInitParam *param)
Second part of m2m_wifi_init, continuing from where m2m_wifi_init_hold left off.
sint8 m2m_wifi_handle_events(void *arg)
Synchronous M2M event handler function.
sint8 m2m_wifi_req_unrestrict_ble(void)
Asynchronous API to request un-restricting of BLE functionality by reverting the BLE processor to ful...
#define M2M_DRIVER_VERSION_MAJOR_NO
Structure holding the incoming buffer's data size information, indicating the data size of the buff...
sint8 m2m_wifi_request_scan_passive(uint8 ch)
#define M2M_HIF_MAJOR_VALUE
sint8 m2m_wifi_default_connect(void)
Asynchronous API that attempts to reconnect to the last-associated access point.
sint8 m2m_wifi_set_tx_power(uint8 u8TxPwrLevel)
set the TX power tenuM2mTxPwrLevel
sint8 m2m_wifi_prng_get_random_bytes(uint8 *pu8PrngBuff, uint16 u16PrngSize)
Get random bytes using the PRNG bytes.
sint8 m2m_wifi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 *pu8IsValid)
Synchronous API to query the MAC address programmed into the WINC ICs OTP memory. ...
NMI_API sint8 m2m_wifi_set_receive_buffer(void *pvBuffer, uint16 u16BufferLen)
Asynchronous API to set or change the size of the WINC IC's receive buffer.
uint8 au8DeviceName[M2M_DEVICE_NAME_MAX]
This struct contains the system time.
void(* tpfAppEthCb)(uint8 u8MsgType, void *pvMsg, void *pvCtrlBuf)
Ethernet (Bypass mode) notification callback function receiving Bypass mode events as defined in the ...
#define M2M_HIF_MINOR_VALUE
#define M2M_ERR_INVALID_ARG
This struct contains the Listen Channel for P2P connect.
static sint8 m2m_validate_ap_parameters(CONST tstrM2MAPConfig *pstrM2MAPConfig)
The Wi-Fi Scan results list is stored in firmware. This struct contains the index by which the applic...
sint8 m2m_wifi_stop_provision_mode(void)
Synchronous API for terminating provisioning mode on the WINC IC.
uint8 au8PSK[M2M_MAX_PSK_LEN]
sint8 hif_enable_access(void)
To enable access to HIF layer, based on HIF level of Firmware. This function reads HIF level directly...
sint8 hif_send(uint8 u8Gid, uint8 u8Opcode, uint8 *pu8CtrlBuf, uint16 u16CtrlBufSize, uint8 *pu8DataBuf, uint16 u16DataSize, uint16 u16DataOffset)
Send packet using host interface.
NMI_API sint8 m2m_wifi_disable_monitoring_mode(void)
Asynchronous API to disable Wi-Fi monitoring (promiscuous receive) mode.
uint32 nmi_get_chipid(void)
This struct stores the Wi-Fi connect request.
sint8 m2m_wifi_set_scan_region(uint16 ScanRegion)
Synchronous API for configuring the regulatory restrictions that may affect the WINC ICs scanning beh...
tstrM2MWifiSecInfo strSec
char acHttpServerDomainName[64]
#define M2M_DRIVER_VERSION_MINOR_NO
sint8 nm_drv_deinit(void *arg)
This struct contains response when the firmware has failed to configure the gains from flash...
This struct contains the configuration options for Wi-Fi scan.
void(* tpfAppMonCb)(tstrM2MWifiRxPacketInfo *pstrWifiRxPacket, uint8 *pu8Payload, uint16 u16PayloadSize)
Wi-Fi monitoring mode callback function. This function delivers all received wi-Fi packets to the app...
uint8 hif_get_sleep_mode(void)
Get the sleep mode of the HIF layer.
unsigned long uint32
Range of values between 0 to 4294967295.
sint8 nm_drv_init_start(void *arg)
This struct contains the size and data offset for the received packet.
sint8 m2m_wifi_req_restrict_ble(void)
Asynchronous API to request restricting of BLE functionality by placing the BLE processor in a low po...
static volatile uint8 gu8ChNum
sint8 m2m_wifi_get_connection_info(void)
Asynchronous API for retrieving the WINC IC's connection status.
uint8 m2m_wifi_get_sleep_mode(void)
Synchronous API to retrieve the current power save mode of the WINC IC.
sint8 m2m_wifi_init(tstrWifiInitParam *param)
Synchronous API that initialises the WINC driver.
sint8 nmi_get_mac_address(uint8 *pu8MacAddr)
This struct stores the battery voltage.
sint8 m2m_wifi_reinit(tstrWifiInitParam *param)
Deinitialize and reinitialize wifi. Resets the WINC. Parameter may be set to NULL, in which case there is no change to the parameters given at initialization.
unsigned char uint8
Range of values between 0 to 255.
sint8 hif_chip_sleep(void)
To make the chip sleep.
sint8 m2m_wifi_enable_sntp(uint8 bEnable)
Asynchronous API to enable or disable the SNTP client running on the WINC IC.
NMI_API sint8 m2m_wifi_enable_mac_mcast(uint8 *pu8MulticastMacAddress, uint8 u8AddRemove)
Asynchronous API to add or remove MAC addresses in the multicast filter.
#define M2M_DEVICE_NAME_MAX
NMI_API sint8 m2m_wifi_ble_set_gain_table(uint8 table_idx)
Asynchronous API that notifies the WINC with the Gain Table index from Flash that should use to confi...
#define WEP_40_KEY_STRING_SIZE
uint8 au8SSID[M2M_MAX_SSID_LEN]
sint8 m2m_wifi_set_cust_InfoElement(uint8 *pau8M2mCustInfoElement)
Asynchronous API to add or remove a user-defined Information Element.
sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt *pstrM2mLsnInt)
Asynchronous API to set Wi-Fi listen interval for power save operation.
This structure holds the configuration parameters for the AP mode. It should be set by the applicatio...
void hif_set_sleep_mode(uint8 u8Pstype)
Set the sleep mode of the HIF layer.
NMI_API sint8 m2m_ota_get_firmware_version(tstrM2mRev *pstrRev)
Synchronous API to obtain the firmware version of the WINC image that is stored in the inactive flash...
sint8 m2m_wifi_p2p(uint8 u8Channel)
Asynchronous API for enabling Wi-Fi Direct (P2P) mode in the WINC IC.
This module contains M2M host interface APIs implementation.
sint8 m2m_wifi_get_sytem_time(void)
Asynchronous API to obtain the system time in use by the WINC IC.
NMI_API sint8 m2m_wifi_send_wlan_pkt(uint8 *pu8WlanPacket, uint16 u16WlanHeaderLength, uint16 u16WlanPktSize)
Asynchronous API to queue a raw Wi-Fi packet for transmission by the WINC IC.
sint8 m2m_wifi_enable_ap(CONST tstrM2MAPConfig *pstrM2MAPConfig)
Asynchronous API to enable access point (AKA "hot-spot") mode on the WINC IC.
#define M2M_ETHERNET_HDR_LEN
sint8 m2m_wifi_disconnect(void)
Synchronous API to request disconnection from a network.
This struct stores the Tx Power levels.
sint8 m2m_wifi_wps_disable(void)
Synchronous API that disables Wi-Fi Protected Setup mode in the WINC IC.
Structure holding firmware version parameters and build date/time.
tstr1xAuthCredentials strCred1x
#define M2M_DRIVER_VERSION_PATCH_NO
sint8 hif_receive(uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz, uint8 isDone)
sint8 m2m_wifi_set_sytem_time(uint32 u32UTCSeconds)
Asynchronous function for setting the system time within the WINC IC.
sint8 hif_deinit(void *arg)
To Deinitialize HIF layer.